This commit is contained in:
2025-12-22 11:08:52 +08:00
21 changed files with 148 additions and 60 deletions

File diff suppressed because one or more lines are too long

View File

@ -441,6 +441,9 @@ img {
.ztree .checkbox_false_full + a,.ztree .checkbox_false_full_focus + a {
color: #d7d7d7;
.svg-icon {
fill: #d7d7d7 !important;
}
}
.ztree li a.curSelectedNode {
background-color: #ffffff00;
@ -450,6 +453,8 @@ img {
.svg-icon {
color: rgba(var(--color-base1), 1) !important;
fill: rgba(var(--color-base1), 1) !important;
stroke: rgba(var(--color-base1), 1) !important;
}
}

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -420,8 +420,8 @@ let rightClick = (event: MouseEvent, treeId: string, treeNode: any) => {
let customView
let entity = window['_entityMap'].get(treeNode.id)
customView = Boolean(entity.customView && entity.customView.orientation)
menus = [...menus, customView ? 'resetView' : 'setView']
// customView ? 'resetView' : 'setView'
menus = [...menus, 'resetView', 'setView']
}
// console.log('menus', menus)
if (menus.length == 0) {

View File

@ -25,7 +25,11 @@ const eventBus: any = inject('bus')
const props = defineProps(['eventList', 'hr', 'originHrOffset', 'scrollLeft'])
let clickEventBar = (event) => {
console.log("点击事件块", selectedEventId.value, event)
let entity = window['_entityMap'].get(event.sourceId)
let key = event.sourceId
/* if (event.callback == 'move')
key = event.id + "move" + event.sourceId*/
// console.log(key)
let entity = window['_entityMap'].get(key)
entity && entity.flyTo()
selectedEventId.value = (selectedEventId.value == null || selectedEventId.value != event.id) ? event.id : null
eventBus.emit('click-event-show-plane', selectedEventId.value ? event : null)

View File

@ -125,13 +125,15 @@ const updateEvent = () => {
TsApi.updateTsEvent(obj).then(res => {
console.log(res)
if (res.code == 200) {
eventBus.emit('update-event', obj)
ElMessage({type: "success", message: "操作成功"})
cancel()
cancel(false)
}
})
}
const cancel = () => {
const cancel = (cancel = true) => {
if (cancel)
revert()
eventObj.value = null
detail.value = {}
eventBus.emit('click-cancel-hide-plane',)
@ -139,6 +141,13 @@ const cancel = () => {
eventBus.on('delete-event', () => {
cancel()
})
const revert = () => {
let entity = window['_entityMap'].get(eventObj.value.id + "move" + eventObj.value.sourceId)
console.log(eventObj.value)
let detail = JSON.parse(eventObj.value.detail)
entity.lineShow = detail.line.show
entity.smooth = detail.line.smooth
}
</script>
<style lang="scss" scoped>

View File

@ -191,6 +191,11 @@ let formatTime = (timeStamp) => {
return props.TSOBJ.parseTime(timeStamp)
}
let play = () => {
if (props.TSOBJ._Store._currentTimestamp >= props.TSOBJ._Store.getTotalTime()) {
ElMessage.warning("到达推演终点")
return
}
props.TSOBJ._Clock._status = "play"
console.log(props.TSOBJ._Clock._status)
// return

View File

@ -403,6 +403,10 @@ let submit = () => {
})
}
let submitStandText = (flag) => {
if (standText.value.trim() == '' && flag) {
ElMessage.warning("内容不能为空")
return
}
showStandText.value = false
/* let res = {
currentDrawItem: currentDrawItem.value,
@ -437,6 +441,9 @@ let getEventList = () => {
})
newTS(params, events)
}
eventBus.on('update-event', (task) => {
tsOBJ.value._Store._tasks = tsOBJ.value.replaceArrayItem(tsOBJ.value._Store._tasks, task)
})
eventBus.on('delete-event', (ids) => {
tsOBJ.value._Store._tasks = tsOBJ.value._Store._tasks.filter(item => !ids.includes(item.id))

View File

@ -339,6 +339,13 @@ let addMarker = (item, needSendEvent = true) => {
window.draw.start((a, position) => {
console.log(position)
if (position != undefined) {
if (position.length == 0 && item.type == "standText") {
item.source_name = ""
return;
}
if (position.length < 2 && item.type == "waterL") {
return;
}
let obj = {id, name: item.source_name, position}
switch (item.type) {
case 'model':
@ -385,10 +392,8 @@ let addMarker = (item, needSendEvent = true) => {
if (item.type == "standText") {
item.source_name = ""
}
}
})
}

View File

@ -344,6 +344,7 @@ const reset = (changeEventType = false) => {
numbers.value = 0
times.value = 1
form.name = '闪烁-'
positions.value = []
// datetime: '',
form['datetime'] = new Date(window['tsObj']._Store._currentTimestamp)

View File

@ -37,7 +37,8 @@ export class Clock {
nowTime = now
// 设置时间指示器位置
store.setCursorLeft(store._currentTimestamp)
if (store._currentTimestamp >= store.getTotalTime()) {
if (store._currentTimestamp > store.getTotalTime()) {
eventCallback()
this.stopAnimation()
this._status = "stop"
}

View File

@ -80,4 +80,29 @@ export class TS extends Tools {
}
}
}
/**
* 替换对象数组中指定的元素通过id匹配
* @param {Array} arr - 原始对象数组元素结构需包含id属性
* @param {Object} newItem - 要替换的新对象必须包含id属性
* @param {string} [key='id'] - 匹配的唯一标识字段默认使用id
* @returns {Array} - 返回替换后的新数组(原数组不会被修改)
*/
replaceArrayItem(arr, newItem, key = 'id') {
// 边界校验
if (!Array.isArray(arr)) {
console.error('第一个参数必须是数组');
return arr;
}
if (typeof newItem !== 'object' || newItem === null || !newItem[key]) {
console.error(`新元素必须是包含${key}属性的对象`);
return arr;
}
// 遍历数组并替换匹配的元素(返回新数组,避免修改原数组)
return arr.map(item => {
// 匹配到对应id的元素则替换否则返回原元素
return item[key] === newItem[key] ? {...item, ...newItem} : item;
});
}
}

View File

@ -315,7 +315,6 @@ watch(modelName, (val) => {
// treeRef.value!.filter(val)
// }
categories.value = []
currModelList.value = []
getModelList()
})
@ -510,10 +509,41 @@ const modelClick = (index, row) => {
const renderModel = async (data, model) => {
let selectedNode = window.treeObj.getSelectedNodes()[0]
let z
let index = 0
let ids:any = []
if (data.positions.length > 0) {
data.positions.forEach(async (position, index) => {
// let source_id = this.$md5(new Date().getTime() + model.model_name+index);
data.positions.forEach(async (position, i) => {
// let source_id = this.$md5(new Date().getTime() + model.model_name+i);
let id = new YJ.Tools().randomString()
ids.push(id)
if (data.type == '面') {
z = data.rotate - 90
} else if (data.type == '线') {
z = data.rotate[i] - 90
}
let option = {
id: id,
position,
name: model.modelName + i,
show: true,
scale: { x: 1, y: 1, z: 1 },
url: service.value + model.modelDataUrl,
maximumScale: 1,
// host: 'http://127.0.0.1:8848',
rotate: {
x: 0,
y: 0,
z
}
}
let Model = await new YJ.Obj.Model(window.earth, option);
// //鼠标右键点击事件
Model.onRightClick = () => {};
(window as any)._entityMap.set(id, Model)
})
for (let position of data.positions) {
let id = ids[index]
if (data.type == '面') {
z = data.rotate - 90
} else if (data.type == '线') {
@ -535,9 +565,7 @@ const renderModel = async (data, model) => {
z
}
}
let Model = await new YJ.Obj.Model(window.earth, option)
;(window as any)._entityMap.set(id, Model)
await new Promise(resolve => setTimeout(resolve, 50))
let DbOption: any = {
params: option,
id,
@ -550,34 +578,21 @@ const renderModel = async (data, model) => {
: undefined
}
let res = await TreeApi.addOtherSource(DbOption)
if(![0, 200].includes(res.code)) {
if (![0, 200].includes(res.code)) {
return
}
ElMessage.closeAll()
ElMessage({
message: '添加成功',
type: 'success'
})
DbOption.isShow = true
DbOption.params = JSON.stringify(DbOption.params)
cusAddNodes(window.treeObj, DbOption.parentId, [DbOption])
// //鼠标右键点击事件
Model.onRightClick = () => {}
// window._entityMap.set(option.id, Model);
// Model.onClick = () => {
// leftClick(node);
// };
// let detailOption = JSON.parse(JSON.stringify(Model.options));
// detailOption.url = model.model_id + ".glb";
// let node = getNodeData(DbOption, detailOption);
// addSource(node).then((res) => {
// if ([0, 200].includes(res.code)) {
// // cusRenderNode(DbOption) DbOption.p_id
// cusAddNodes(this.treeObj, DbOption.p_id, [node]);
// }
// });
})
index++
if (index >= data.positions.length - 1) {
ElMessage.closeAll()
ElMessage({
message: '添加成功',
type: 'success'
})
}
}
}
}

View File

@ -270,6 +270,7 @@ const translate = () => {
}
}
const confirm = () => {
that.positionEditing && (that.positionEditing = false)
originalOptions = structuredClone(that.options)
baseDialog.value?.close()
let params = structuredClone(that.options)
@ -350,10 +351,8 @@ const changeMaximumParticleLife = (event) => {
const closeCallback = async () => {
entityOptions.value.originalOptions = structuredClone(originalOptions)
that.positionEditing = false
that.positionEditing && (that.positionEditing = false)
that.reset()
await YJ.Global.multiViewportMode.syncData(window.earth, that.options.id)
await YJ.Global.splitScreen.syncData(window.earth, that.options.id)
eventBus?.emit("destroyComponent")
}

View File

@ -203,6 +203,7 @@ const open = async (id: any) => {
})
}
const confirm = () => {
that.closeNodeEdit()
originalOptions = structuredClone(that.options)
baseDialog.value?.close()
let params = structuredClone(that.options)

View File

@ -156,6 +156,7 @@ const open = async (id: any) => {
})
}
const confirm = () => {
that.closeNodeEdit()
originalOptions = structuredClone(that.options)
baseDialog.value?.close()
let params = structuredClone(that.options)

View File

@ -367,6 +367,13 @@ export const useRightOperate = () => {
entity.remove();
(window as any)._entityMap.delete(entity.options.id)
}
else {
let entity = (window as any).pressModelEntities.get(item)
if (entity) {
entity.remove();
(window as any).pressModelEntities.delete(entity.options.id)
}
}
// let node = window.treeObj.getNodeByParam("id", item, null);
eventBus.emit("destroyComponent", item);
});

View File

@ -490,7 +490,7 @@ export const useTreeNode = () => {
// return (type === 'directory' || type === 'FeatureCollection') ? undefined : `http://localhost:${availablePort}/icon/${name}.png`;
return (type === 'directory' || type === 'FeatureCollection' || type === 'folder') ? undefined : `
<svg class="svg-icon" style="color: rgba(var(--color-base2), 1);margin-top: 1px;width:100%;height:100%;fill: currentColor !important;stroke: currentColor !important;stroke-width: ${strokeWidth} !important;shape-rendering: geometricPrecision;">
<svg class="svg-icon" style="color: rgba(var(--color-base2), 1);margin-top: 1px;width:100%;height:100%;fill: #fff;stroke: #fff;stroke-width: ${strokeWidth} !important;shape-rendering: geometricPrecision;">
<use xlink:href="#icon-${name}" />
</svg>
`;

View File

@ -836,7 +836,7 @@ defineExpose({
// .custom-dropdown2 {
// width: 380px !important;
// }
.el-select-dropdown__empty,
.custom-dropdown .el-select-dropdown__empty,
.el-select-dropdown__loading {
margin-top: -150px !important;
}

View File

@ -708,18 +708,21 @@ function importAuth() {
filters: [{ name: '授权文件', extensions: ['YJ'] }]
}
$sendElectronChanel('open-directory-dialog', option)
$recvElectronChanel('selectedItem', (e, paths) => {
console.log(e, paths, 'oopop')
if (paths.length != 0) {
let formdata = new FormData()
formdata.append('filePath', paths[0])
try {
let res = AuthApi.authImport(formdata)
$recvElectronChanel('selectedItem', async (e, paths) => {
let formdata = new FormData()
if(!paths[0]) {
return
}
formdata.append('filePath', paths[0])
try {
let res = await AuthApi.authImport(formdata)
if(res.code === 0 || res.code === 200) {
ElMessage.success('文件授权成功')
isAuth.value = false
baseDialog.value?.close()
} catch (error) {}
}
} else {
}
} catch (error) {}
})
}
// setTimeout(() => {