This commit is contained in:
zh
2025-12-12 17:23:12 +08:00
13 changed files with 229 additions and 123 deletions

View File

@ -1,7 +1,7 @@
server: server:
host: 127.0.0.1 host: 127.0.0.1
port: 8849 port: 8849
path: C:\Users\MSI\AppData\Roaming\dzsp_shijingjun_offline_Y_save path: C:\Users\Administrator\AppData\Roaming\dzsp_shijingjun_offline_Y_save
poi: poi:
global: global:
enabled: false enabled: false

View File

@ -12,9 +12,10 @@ import { GetHomeDir } from './config'
import { start, getServer } from "./app"; import { start, getServer } from "./app";
const http = require("http"); const http = require("http");
const yaml = require("js-yaml"); const yaml = require("js-yaml");
let Store = require('electron-store') // 移除 electron-store使用 Electron 提供的用户数据目录
Store.initRenderer(); // let Store = require('electron-store')
const store = new Store() // Store.initRenderer();
// const store = new Store()
process.on('unhandledRejection', (reason) => { process.on('unhandledRejection', (reason) => {
@ -147,7 +148,8 @@ function createWindow(): void {
ymlBatPath = process.platform === 'win32' ? ymlBatPath.replace(/^(\w:)/, '/$1') : ymlBatPath ymlBatPath = process.platform === 'win32' ? ymlBatPath.replace(/^(\w:)/, '/$1') : ymlBatPath
let ymlPath = ymlBatPath.substring(1, 200) let ymlPath = ymlBatPath.substring(1, 200)
const ymlContent = yaml.load(fs.readFileSync(ymlPath, 'utf8')); const ymlContent = yaml.load(fs.readFileSync(ymlPath, 'utf8'));
ymlContent.server.path = path.dirname(store.path) ymlContent.server.path = app.getPath('userData')
// ymlContent.server.path = path.dirname(store.path)
fs.writeFileSync(ymlPath, yaml.dump(ymlContent)); fs.writeFileSync(ymlPath, yaml.dump(ymlContent));
ipcMain.on("getIniConfig", (event, option) => { ipcMain.on("getIniConfig", (event, option) => {
let ymlPath = ymlBatPath.substring(1, 200) let ymlPath = ymlBatPath.substring(1, 200)
@ -215,6 +217,38 @@ function createWindow(): void {
event.sender.send("selectedItem", arr); event.sender.send("selectedItem", arr);
}); });
}); });
ipcMain.handle('get-user-data-path', () => {
return app.getPath('userData')
});
ipcMain.on('import-project-override', async (event, { srcZip, dst }) => {
try {
const compressing = require('compressing')
await compressing.zip.uncompress(srcZip, dst)
event.sender.send('import-project-override-res', { ok: true })
} catch (e: any) {
event.sender.send('import-project-override-res', { ok: false, error: e.message })
}
});
ipcMain.on("export-project", (event, { dst }) => {
try {
const archiver = require('archiver');
const output = fs.createWriteStream(dst);
const archive = archiver('zip', { zlib: { level: 9 } });
output.on('close', () => {
event.sender.send('export-project-res', { ok: true });
});
archive.on('error', (err) => {
event.sender.send('export-project-res', { ok: false, error: err.message });
});
archive.pipe(output);
const dbPath = path.join(app.getPath('userData'), 'app.db');
console.log('dbPath', dbPath);
archive.file(dbPath, { name: 'app.db' });
archive.finalize();
} catch (e: any) {
event.sender.send('export-project-res', { ok: false, error: e.message });
}
});
ipcMain.on("saveFile", (event, { title, filename, filters }) => { ipcMain.on("saveFile", (event, { title, filename, filters }) => {
dialog dialog
.showSaveDialog({ .showSaveDialog({

View File

@ -11,54 +11,56 @@ export const addMapSource = async ({ type, id, sourceName = '未命名对象', o
if (window.earth.entityMap.get(id)) { if (window.earth.entityMap.get(id)) {
window.earth.entityMap.get(id).remove() window.earth.entityMap.get(id).remove()
} }
let options: any = await initMapData(type, opt, cd) setTimeout(async () => {
let selectedNodes = window.treeObj.getSelectedNodes() let options: any = await initMapData(type, opt, cd)
let node = selectedNodes && selectedNodes[selectedNodes.length - 1] let selectedNodes = window.treeObj.getSelectedNodes()
function getParentId(nd: any) { let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
if (nd.sourceType === 'directory') { function getParentId(nd: any) {
return nd.id if (nd.sourceType === 'directory') {
} else { return nd.id
let parentNode = window.treeObj.getNodeByParam("id", nd.parentId, null); } else {
if (parentNode) { let parentNode = window.treeObj.getNodeByParam("id", nd.parentId, null);
return getParentId(parentNode) if (parentNode) {
} return getParentId(parentNode)
else { }
return else {
return
}
} }
} }
} let parentId
let parentId if (node) {
if (node) { parentId = getParentId(node)
parentId = getParentId(node) }
} delete options.host
delete options.host if (options.attribute && options.attribute.rtmp) {
if (options.attribute && options.attribute.rtmp) { delete options.attribute.rtmp
delete options.attribute.rtmp }
} switch (type) {
switch (type) { case 'rendezvous':
case 'rendezvous': case 'attackArrow':
case 'attackArrow': case 'pincerArrow':
case 'pincerArrow': delete options.label.ground
delete options.label.ground delete options.label.position
delete options.label.position break;
break; case 'path':
case 'path': delete options.label.text
delete options.label.text break;
break; }
} console.log('options', options)
console.log('options', options) let params: any = {
let params: any = { id: id,
id: id, sourceName: sourceName,
sourceName: sourceName, sourceType: type,
sourceType: type, // isShow: 1,
// isShow: 1, parentId: parentId,
parentId: parentId, // "treeIndex": 0,
// "treeIndex": 0, params: options
params: options }
} TreeApi.addOtherSource(params)
TreeApi.addOtherSource(params) params.params = JSON.stringify(params.params)
params.params = JSON.stringify(params.params) params.isShow = true
params.isShow = true
cusAddNodes(window.treeObj, params.parentId, [params]) cusAddNodes(window.treeObj, params.parentId, [params])
}, 10);
} }

View File

@ -156,7 +156,7 @@ const initTreeCallBack = () => {
} }
} }
if (layerTypes.includes(arr[i].sourceType)) { if (layerTypes.includes(arr[i].sourceType)) {
console.log(detail, params) // console.log(detail, params)
if (!detail && !params) { if (!detail && !params) {
detail = { detail = {
id: arr[i].id, id: arr[i].id,
@ -168,10 +168,10 @@ const initTreeCallBack = () => {
sourceType: arr[i].sourceType, sourceType: arr[i].sourceType,
detail: {...detail, ...params, layerIndex: layers.length + 1} detail: {...detail, ...params, layerIndex: layers.length + 1}
} }
console.log(layer) // console.log(layer)
layers.push(layer) layers.push(layer)
} else { } else {
console.log({...detail, ...params}) // console.log({...detail, ...params})
let details = {...detail, ...params} let details = {...detail, ...params}
details.show = Boolean(arr[i].isShow) details.show = Boolean(arr[i].isShow)
initMapData(arr[i].sourceType, details) initMapData(arr[i].sourceType, details)
@ -188,6 +188,7 @@ const initTreeCallBack = () => {
let speed = (distance / duration_S) * window['tsObj']._Store._multiplier let speed = (distance / duration_S) * window['tsObj']._Store._multiplier
detail.speed = speed detail.speed = speed
console.log("event的detail", detail) console.log("event的detail", detail)
// detail.viewFollow = true
initMapData("guiji", detail, (TrajectoryMotionObject) => { initMapData("guiji", detail, (TrajectoryMotionObject) => {
TrajectoryMotionObject.state = false; TrajectoryMotionObject.state = false;
TrajectoryMotionObject.oldSpeed = distance / duration_S * multiplier; TrajectoryMotionObject.oldSpeed = distance / duration_S * multiplier;
@ -359,7 +360,7 @@ const onCheck = async (event: any, treeId: any, treeNode: any) => {
sourceStatus(treeNode) sourceStatus(treeNode)
console.log("ids", ids) console.log("ids", ids)
return // return
const res = await TsApi.updateTreeShow(ids) const res = await TsApi.updateTreeShow(ids)
if (res.code == 0 || res.code == 200) { if (res.code == 0 || res.code == 200) {
ElMessage({ ElMessage({

View File

@ -24,7 +24,7 @@ const selectedEventId = ref(null)
const eventBus: any = inject('bus') const eventBus: any = inject('bus')
const props = defineProps(['eventList', 'hr', 'originHrOffset', 'scrollLeft']) const props = defineProps(['eventList', 'hr', 'originHrOffset', 'scrollLeft'])
let clickEventBar = (event) => { let clickEventBar = (event) => {
console.log("点击事件块", selectedEventId.value, event.id) console.log("点击事件块", selectedEventId.value, event)
let entity = window['_entityMap'].get(event.sourceId) let entity = window['_entityMap'].get(event.sourceId)
entity && entity.flyTo() entity && entity.flyTo()
selectedEventId.value = (selectedEventId.value == null || selectedEventId.value != event.id) ? event.id : null selectedEventId.value = (selectedEventId.value == null || selectedEventId.value != event.id) ? event.id : null
@ -90,6 +90,7 @@ let getWidth = (durationTime) => {
// 6. 让 progressStyle 间接依赖 refreshKey通过 getWidth // 6. 让 progressStyle 间接依赖 refreshKey通过 getWidth
let progressStyle = (task) => { let progressStyle = (task) => {
let taskLeft = task.startTime - window['tsObj']._Store._startTimestamp; let taskLeft = task.startTime - window['tsObj']._Store._startTimestamp;
console.log("taskLeft", task, taskLeft, getWidth(taskLeft))
let width = 1 let width = 1
if (!['display', 'hide'].includes(task.callback)) if (!['display', 'hide'].includes(task.callback))
width = getWidth(task.duration_time) * 1000 width = getWidth(task.duration_time) * 1000

View File

@ -4,6 +4,22 @@
<div class="eventPanel"> <div class="eventPanel">
<span class="title">{{ eventObj.name }}</span> <span class="title">{{ eventObj.name }}</span>
<div class="eventDetail"> <div class="eventDetail">
<template v-if="eventObj.callback&&eventObj.callback=='move'">
<div>
路径显隐
<el-switch size="small" v-model="detail.line.show" @change="(val)=>handleChange(val,'lineShow')"/>
</div>
<!-- <div>
实时路径
<el-switch size="small" v-model="detail.realTimeRoute"
@change="(val)=>handleChange(val,'realTimeRoute')"/>
</div>-->
<div>
是否圆滑
<el-switch size="small" v-model="detail.line.smooth"
@change="(val)=>handleChange(val,'smooth')"/>
</div>
</template>
<template v-if="eventObj.callback&&eventObj.callback=='flicker'"> <template v-if="eventObj.callback&&eventObj.callback=='flicker'">
<!-- <div> <!-- <div>
闪烁间隔 闪烁间隔
@ -16,6 +32,7 @@
</div> </div>
</template> </template>
</div> </div>
<div class="optBtn"> <div class="optBtn">
<el-button @click="updateEvent">{{ t('ts.confirm') }}</el-button> <el-button @click="updateEvent">{{ t('ts.confirm') }}</el-button>
@ -56,13 +73,37 @@ eventBus.on('click-event-show-plane', (params) => {
} }
switch (params.callback) { switch (params.callback) {
case 'flicker': case 'flicker':
case 'move':
// times.value = detail.times // times.value = detail.times
// numbers.value = detail.numbers // numbers.value = detail.numbers
detail.value = details detail.value = details
break break
} }
} }
console.log("detail.value", detail.value)
}) })
const handleChange = (val, key) => {
let entity = window['_entityMap'].get(eventObj.value.id + "move" + eventObj.value.sourceId)
console.log(eventObj.value.id + "move" + eventObj.value.sourceId)
console.log(entity)
if (entity) {
entity[key] = val
}
// 如果当前属性变为true那么其他的将变为false唯一真原则
if (val) {
switch (key) {
case 'lineShow':
detail.value.realTimeRoute = false
break
case 'realTimeRoute':
detail.value.line.show = false
break
}
}
console.log(val, key)
}
const updateEvent = () => { const updateEvent = () => {
// console.log(detail.value) // console.log(detail.value)
let obj = eventObj.value let obj = eventObj.value
@ -88,6 +129,7 @@ const updateEvent = () => {
}) })
} }
const cancel = () => { const cancel = () => {
eventObj.value = null eventObj.value = null
detail.value = {} detail.value = {}
eventBus.emit('click-cancel-hide-plane',) eventBus.emit('click-cancel-hide-plane',)

View File

@ -105,6 +105,8 @@ import {ElMessage, ElPopover} from 'element-plus'; // 确保导入ElPopover
import dragLeftRight from './util/dragLeftRight.js'; import dragLeftRight from './util/dragLeftRight.js';
import {TsApi} from "../../api/ts"; import {TsApi} from "../../api/ts";
const props = defineProps(['TSOBJ'])
console.log(props.TSOBJ)
const eventBus: any = inject('bus') const eventBus: any = inject('bus')
const instance = getCurrentInstance(); const instance = getCurrentInstance();
@ -121,7 +123,7 @@ const multiplierPopover: any = ref(null);
const isPopoverShow = ref(false); const isPopoverShow = ref(false);
let multipliers = [16, 8, 4, 2, 1, 0.5, 0.25] let multipliers = [16, 8, 4, 2, 1, 0.5, 0.25]
let currentStamp = ref(window['tsObj']._Store._startTimestamp) let currentStamp = ref(window['tsObj']._Store._startTimestamp)
let maxLevel = ref(24) let maxLevel = ref(36)
let minLevel = ref(1) let minLevel = ref(1)
let hr = ref(0) let hr = ref(0)
let originHrOffset = ref(0) let originHrOffset = ref(0)
@ -134,6 +136,8 @@ let distanceOfTicMain = ref(5)
let originOffset = ref(0) let originOffset = ref(0)
let originMainOffset = ref(0) let originMainOffset = ref(0)
let status = ref(false) let status = ref(false)
distanceOfTicTiny.value = props.TSOBJ._Store.getScale("distanceOfTicTiny")
distanceOfTicMain.value = window['tsObj']._Store.getScale('numOfMain') * distanceOfTicTiny.value distanceOfTicMain.value = window['tsObj']._Store.getScale('numOfMain') * distanceOfTicTiny.value
const propsMap = { const propsMap = {
ticTiny, ticTiny,
@ -161,8 +165,7 @@ window['updateProp'] = (key: string, val: any) => {
const level = ref(20) const level = ref(20)
const props = defineProps(['TSOBJ'])
console.log(props.TSOBJ)
level.value = props.TSOBJ.wheel level.value = props.TSOBJ.wheel
let handleMultiplierChange = (multiplier) => { let handleMultiplierChange = (multiplier) => {
props.TSOBJ._Store._multiplier = multiplier props.TSOBJ._Store._multiplier = multiplier
@ -204,6 +207,9 @@ let stopCallBack = (status) => {
props.TSOBJ._Store.setScale('scrollLeft', 0) props.TSOBJ._Store.setScale('scrollLeft', 0)
props.TSOBJ._Store.setScale('cursorLeft', 0) props.TSOBJ._Store.setScale('cursorLeft', 0)
Revert() Revert()
setTimeout(() => {
Revert()
}, 100)
} }
} }
@ -345,6 +351,7 @@ const handleDrag = (newLeft: number) => {
let tsEntitys = window['_entityMap'].get(task.sourceId); let tsEntitys = window['_entityMap'].get(task.sourceId);
tsEntitys.show = true tsEntitys.show = true
// TrajectoryMotionObject.speed = TrajectoryMotionObject.oldSpeed // TrajectoryMotionObject.speed = TrajectoryMotionObject.oldSpeed
console.log(window['tsObj']._Store._currentTimestamp - task.startTime)
TrajectoryMotionObject.setMovePositionByTime((window['tsObj']._Store._currentTimestamp - task.startTime) / 1000) TrajectoryMotionObject.setMovePositionByTime((window['tsObj']._Store._currentTimestamp - task.startTime) / 1000)
break; break;
default: default:

View File

@ -99,8 +99,10 @@
oninput="value=value.replace(/[^0-9.]/g, '').replace(/^\./, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')"/>{{ oninput="value=value.replace(/[^0-9.]/g, '').replace(/^\./, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')"/>{{
t('ts.minute') t('ts.minute')
}} </span> }} </span>
<span><el-input v-model="second" :maxlength="2" <span>
oninput="value=value.replace(/[^0-9.]/g, '').replace(/^\./, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')"/>{{ <!--:maxlength="2"-->
<el-input v-model="second"
oninput="value=value.replace(/[^0-9.]/g, '').replace(/^\./, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.')"/>{{
t('ts.second') t('ts.second')
}}</span> }}</span>
</div> </div>
@ -226,7 +228,7 @@ const addEvent = () => {
console.log(zNode.value) console.log(zNode.value)
let startTime = form.datetime.getTime() let startTime = form.datetime.getTime()
let obj: any = {} let obj: any = {}
console.log("obj", obj)
let duration_S = Number(hour.value * 3600) + Number(minute.value * 60) + Number(second.value) let duration_S = Number(hour.value * 3600) + Number(minute.value * 60) + Number(second.value)
// 数据是否合法有效 // 数据是否合法有效
let isRight = true let isRight = true
@ -234,12 +236,16 @@ const addEvent = () => {
let minPositionLength = 2 let minPositionLength = 2
switch (currentKey.value) { switch (currentKey.value) {
case 'flicker': case 'flicker':
obj = {
numbers: numbers.value,
times: 0
}
if (duration_S == 0) { if (duration_S == 0) {
isRight = false isRight = false
errorFields.push("持续时间") errorFields.push("持续时间")
} }
if (obj.numbers == 0) { if (Number(obj.numbers) == 0 || !Number(obj.numbers)) {
isRight = false isRight = false
errorFields.push("闪烁次数") errorFields.push("闪烁次数")
} }
@ -266,7 +272,8 @@ const addEvent = () => {
show: false, show: false,
positions: positions.value, positions: positions.value,
}, },
isContainModelPosition: isContainModelPosition.value isContainModelPosition: isContainModelPosition.value,
realTimeRoute: false
} }
if (!obj.line['positions'] || (obj.line['positions'] && obj.line['positions'].length < minPositionLength)) { if (!obj.line['positions'] || (obj.line['positions'] && obj.line['positions'].length < minPositionLength)) {
// ElMessage({message: "机动事件的路径不合法", type: "warning"}) // ElMessage({message: "机动事件的路径不合法", type: "warning"})
@ -300,8 +307,8 @@ const addEvent = () => {
endTime: startTime + duration_S * 1000, endTime: startTime + duration_S * 1000,
"detail": JSON.stringify(obj) "detail": JSON.stringify(obj)
} }
console.log("dbParams", dbParams) // console.log("dbParams", dbParams)
console.log("duration_S", duration_S) // console.log("duration_S", duration_S)
// return; // return;
TsApi.addTsEvent(dbParams).then(res => { TsApi.addTsEvent(dbParams).then(res => {
if (res.code == 200) { if (res.code == 200) {

View File

@ -38,8 +38,11 @@ export class Store {
let preMainIndex = Math.ceil(option.wheel / 3) let preMainIndex = Math.ceil(option.wheel / 3)
// 小格宽度的选值【3,5,8】 // 小格宽度的选值【3,5,8】
let index = option.wheel % 3 let index = option.wheel % 3
this._scales.preMainIndex = preMainIndex this._scales.preMainIndex = preMainIndex - 1
this._scales.distanceOfTicTiny = this._scales.distanceOfTicTinyRange[index] this._scales.distanceOfTicTiny = this._scales.distanceOfTicTinyRange[index]
console.log("this._scales.preMainIndex", this._scales.preMainIndex)
console.log("this._scales.preMains", this._scales.preMains)
console.log("this._scales.preMains", this._scales.preMains[this._scales.preMainIndex])
this._scales.preSecondPx = this._scales.distanceOfTicMain / this._scales.preMains[this._scales.preMainIndex] this._scales.preSecondPx = this._scales.distanceOfTicMain / this._scales.preMains[this._scales.preMainIndex]
this._multiplier = option.multiplier || 1 this._multiplier = option.multiplier || 1
@ -48,9 +51,9 @@ export class Store {
this._startTimestamp = option.startTimestamp this._startTimestamp = option.startTimestamp
this._currentTimestamp = option.currentTimestamp || option.startTimestamp this._currentTimestamp = option.currentTimestamp || option.startTimestamp
this._scales = {...this._scales, ...option.scales} this._scales = {...this._scales, ...option.scales}
let num = this.getScale("distanceOfTicMain") / this.getScale("preMains")[this.getScale("preMainIndex")] // let num = this.getScale("distanceOfTicMain") / this.getScale("preMains")[this.getScale("preMainIndex")]
console.log(num) // console.log(num)
this._scales.preSecondPx = num // this._scales.preSecondPx = num
// this.setScale("preSecondPx", num) // this.setScale("preSecondPx", num)
} }
@ -82,6 +85,7 @@ export class Store {
// 封装对_scales属性的修改器setter在此处触发监听 tsObj._Store.setScale('ticTiny', 10); // 封装对_scales属性的修改器setter在此处触发监听 tsObj._Store.setScale('ticTiny', 10);
setScale(key: ScaleKey, value: any) { setScale(key: ScaleKey, value: any) {
// console.log(key, value)
const oldValue = this._scales[key]; const oldValue = this._scales[key];
if (oldValue === value) return; // 值未变化则不触发 if (oldValue === value) return; // 值未变化则不触发
this._scales[key] = value; this._scales[key] = value;
@ -139,7 +143,7 @@ export class Store {
let m = 60 * s//一分 let m = 60 * s//一分
let h = 60 * m//一小时 let h = 60 * m//一小时
let d = 24 * h//一天 let d = 24 * h//一天
return [30 * s, 1 * m, 2 * m, 5 * m, 10 * m, 1 * h, 2 * h, 5 * h/*, 10 * h, 1 * d, 2 * d, 5 * d*/].reverse() return [30 * s, 1 * m, 2 * m, 5 * m, 10 * m, 1 * h, 2 * h, 5 * h, 10 * h, 1 * d, 2 * d, 5 * d].reverse()
} }
ceil(num) { ceil(num) {
@ -188,11 +192,11 @@ export class Store {
} }
getTaskInStamp() { getTaskInStamp() {
return this._tasks.filter(item => this._currentTimestamp > item.startTime && this._currentTimestamp <= item.endTime) return this._tasks.filter(item => this._currentTimestamp >= item.startTime && this._currentTimestamp <= item.endTime)
} }
set currentTimestamp(val) { set currentTimestamp(val) {
console.log("currentTimestamp", val) // console.log("currentTimestamp", val)
this._currentTimestamp = val this._currentTimestamp = val
window['updateProp']("currentStamp", val) window['updateProp']("currentStamp", val)
} }

View File

@ -31,11 +31,15 @@ export class TS extends Tools {
// console.log("renderLabel", nums) // console.log("renderLabel", nums)
let allTimeLabels = [] let allTimeLabels = []
for (let i = 0; i < all; i++) { for (let i = 0; i < all; i++) {
let timeOfMain = this._Store.getScale('preMains')[this._Store.getScale('preMainIndex')] let timeOfMain = this._Store.getScale('preMains')[this._Store.getScale('preMainIndex') - 1]
// console.log("timeOfMain", this._Store.getScale('preMains'))
// console.log("timeOfMain", timeOfMain)
// console.log("timeOfMain", this._Store.getScale('preMainIndex'))
// @ts-ignore // @ts-ignore
allTimeLabels.push(i * timeOfMain * 1000 + this._Store._startTimestamp) allTimeLabels.push(i * timeOfMain * 1000 + this._Store._startTimestamp)
} }
allTimeLabels.splice(0, nums) allTimeLabels.splice(0, nums)
// console.log("##########")
this._Store.setScale('timeLabels', allTimeLabels) this._Store.setScale('timeLabels', allTimeLabels)
} }

View File

@ -521,35 +521,28 @@ const importProject = () => {
if (paths.length > 0) { if (paths.length > 0) {
// let loadingInstance = this.$openLoading('拼命导入中...') // let loadingInstance = this.$openLoading('拼命导入中...')
importWin = false importWin = false
let arr = getElectronPath().replaceAll('\\', '/').split('/') const { ipcRenderer } = require('electron')
console.log(arr, 'arrarr') ipcRenderer.invoke('get-user-data-path').then((userDataPath) => {
arr.pop() ipcRenderer.send('import-project-override', { srcZip: paths[0], dst: userDataPath })
// let path: any = 'C:/Users/Administrator/AppData/Roaming/yjearth' ipcRenderer.once('import-project-override-res', (ev, res) => {
console.log(paths[0], arr.join('/'), 'pathpath') if (res && res.ok) {
unzip_file(paths[0], arr.join('/')) setTimeout(() => {
.then((res) => { ElMessage({
// loadingInstance.close() message: '载入成功将在2s后自动重启',
// ElMessage({ type: 'success'
// message: '导入成功', })
// type: 'success' }, 1000)
// }) setTimeout(() => {
setTimeout(() => { $sendElectronChanel('restart')
}, 3000)
} else {
ElMessage({ ElMessage({
message: '载入成功将在2s后自动重启', message: res?.error || '导入失败',
type: 'success' type: 'warning'
}) })
}, 1000) }
setTimeout(() => {
$sendElectronChanel('restart')
}, 3000)
})
.catch((err) => {
console.log(err)
ElMessage({
message: err,
type: 'warning'
})
}) })
})
} else { } else {
importWin = false importWin = false
} }
@ -657,31 +650,41 @@ function derive() {
$sendElectronChanel('saveFile', option) $sendElectronChanel('saveFile', option)
$recvElectronChanel('selectedFileItem', (e, path) => { $recvElectronChanel('selectedFileItem', (e, path) => {
if (path) { if (path) {
// if (result.canceled) { const { ipcRenderer } = require('electron')
// this.exportWin = !this.exportWin ipcRenderer.send('export-project', { dst: path })
// return ipcRenderer.once('export-project-res', (ev, res) => {
// } if (res && res.ok) {
// let loadingInstance = this.$openLoading('拼命导出中...')
// exportWin = !exportWin
let arr = getElectronPath().replaceAll('\\', '/').split('/')
arr.pop()
arr[arr.length - 1] = 'yjearth/app.db'
let db_path: any = arr.join('/')
// let db_path: any = 'C:/Users/Administrator/AppData/Roaming/yjearth/app.db'
try {
zip_file([db_path], path, () => {
// loadingInstance.close()
ElMessage({ ElMessage({
message: '导出完成', message: '导出完成',
type: 'success' type: 'success'
}) })
}) } else {
} catch (error) { ElMessage({
ElMessage({ message: res?.error || '导出失败',
message: error, type: 'error'
type: 'error' })
}) }
} })
// let arr = getElectronPath().replaceAll('\\', '/').split('/')
// arr.pop()
// arr[arr.length - 1] = 'yjearth/app.db'
// let db_path: any = arr.join('/')
// console.log(db_path, 'db_pathdb_path')
// try {
// zip_file([db_path], path, () => {
// // loadingInstance.close()
// ElMessage({
// message: '导出完成',
// type: 'success'
// })
// })
// } catch (error) {
// ElMessage({
// message: error,
// type: 'error'
// })
// }
} }
}) })

View File

@ -292,7 +292,7 @@ watch(photoName, (val) => {
// treeRef.value!.filter(val) // treeRef.value!.filter(val)
// } // }
getModelList() getModelList()
modelList.value = [] currModelList.value = []
}) })
const filterNode: any = (value, data) => { const filterNode: any = (value, data) => {
if (!value) return true if (!value) return true

View File

@ -230,6 +230,7 @@ var readOnly = ref(true)
const changeWater = () => { const changeWater = () => {
submerge.restart() submerge.restart()
isPausng.value = false
} }
eventBus.on('submergeDialog', () => { eventBus.on('submergeDialog', () => {