Merge branch 'zyl' of http://xny.yj-3d.com:3000/zhouyulong/electron-4 into zyl
This commit is contained in:
@ -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
|
||||||
|
|||||||
@ -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({
|
||||||
|
|||||||
@ -11,6 +11,7 @@ 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()
|
||||||
}
|
}
|
||||||
|
setTimeout(async () => {
|
||||||
let options: any = await initMapData(type, opt, cd)
|
let options: any = await initMapData(type, opt, cd)
|
||||||
let selectedNodes = window.treeObj.getSelectedNodes()
|
let selectedNodes = window.treeObj.getSelectedNodes()
|
||||||
let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
|
let node = selectedNodes && selectedNodes[selectedNodes.length - 1]
|
||||||
@ -61,4 +62,5 @@ export const addMapSource = async ({ type, id, sourceName = '未命名对象', o
|
|||||||
params.isShow = true
|
params.isShow = true
|
||||||
|
|
||||||
cusAddNodes(window.treeObj, params.parentId, [params])
|
cusAddNodes(window.treeObj, params.parentId, [params])
|
||||||
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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({
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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',)
|
||||||
|
|||||||
@ -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:
|
||||||
|
|||||||
@ -99,7 +99,9 @@
|
|||||||
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>
|
||||||
|
<!--:maxlength="2"-->
|
||||||
|
<el-input v-model="second"
|
||||||
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.second')
|
t('ts.second')
|
||||||
}}</span>
|
}}</span>
|
||||||
@ -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) {
|
||||||
|
|||||||
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -521,18 +521,11 @@ 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('/'))
|
|
||||||
.then((res) => {
|
|
||||||
// loadingInstance.close()
|
|
||||||
// ElMessage({
|
|
||||||
// message: '导入成功',
|
|
||||||
// type: 'success'
|
|
||||||
// })
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '载入成功,将在2s后自动重启',
|
message: '载入成功,将在2s后自动重启',
|
||||||
@ -542,13 +535,13 @@ const importProject = () => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$sendElectronChanel('restart')
|
$sendElectronChanel('restart')
|
||||||
}, 3000)
|
}, 3000)
|
||||||
})
|
} else {
|
||||||
.catch((err) => {
|
|
||||||
console.log(err)
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: err,
|
message: res?.error || '导入失败',
|
||||||
type: 'warning'
|
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: error,
|
message: res?.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'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user