From 2e1a1864aab808c364c77797ab4c7e6fdc106d37 Mon Sep 17 00:00:00 2001 From: 24kycj <1637269896@qq.com> Date: Mon, 15 Sep 2025 21:47:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=82=A8=E5=AD=98?= =?UTF-8?q?=E5=8D=A1=E8=83=BD=E9=87=8F=E6=A0=BC=E7=BB=84=E4=BB=B6EnergyBar?= =?UTF-8?q?=EF=BC=88=E6=9B=B4=E7=B4=A7=E5=87=91=E3=80=81=E5=8F=AF=E8=B0=83?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E3=80=81=E5=85=85=E8=83=BD=E7=89=B9=E6=95=88?= =?UTF-8?q?=EF=BC=89=EF=BC=9B=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E5=86=B2=E7=AA=81=EF=BC=9B=E5=BE=AE=E8=B0=83=E8=89=B2?= =?UTF-8?q?=E5=B8=A6=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=BA=95=E8=89=B2=E4=B8=8E?= =?UTF-8?q?=E4=B8=8D=E6=8D=A2=E8=A1=8C=E6=98=BE=E7=A4=BA=EF=BC=9B=E6=B8=85?= =?UTF-8?q?=E7=90=86=E8=B0=83=E8=AF=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron-vue/dev-runner.js | 2 +- src/main/index - 副本.js | 2 +- src/main/index.js | 2 +- src/renderer/components/EnergyBar.vue | 148 + src/renderer/components/filepath.json | 2 +- src/renderer/components/main - 副本.vue | 186 +- src/renderer/components/main.vue | 4524 ++++++++++++----------- src/renderer/components/work.vue | 66 +- 8 files changed, 2636 insertions(+), 2296 deletions(-) create mode 100644 src/renderer/components/EnergyBar.vue diff --git a/electron-vue/dev-runner.js b/electron-vue/dev-runner.js index 27e58d8..752da05 100644 --- a/electron-vue/dev-runner.js +++ b/electron-vue/dev-runner.js @@ -74,7 +74,7 @@ function startRenderer () { } ) - server.listen(9080) + server.listen(9081) }) } diff --git a/src/main/index - 副本.js b/src/main/index - 副本.js index 6bf0fd5..6039c19 100644 --- a/src/main/index - 副本.js +++ b/src/main/index - 副本.js @@ -32,7 +32,7 @@ if (process.env.NODE_ENV !== "development") { let mainWindow; const winURL = process.env.NODE_ENV === "development" - ? `http://localhost:9080` + ? `http://localhost:9081` : `file://${__dirname}/index.html`; function createWindow() { diff --git a/src/main/index.js b/src/main/index.js index dc90cf0..d89fe23 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -41,7 +41,7 @@ if (process.env.NODE_ENV !== "development") { let mainWindow; const winURL = process.env.NODE_ENV === "development" - ? `http://localhost:9080` + ? `http://localhost:9081` : `file://${__dirname}/index.html`; function createWindow() { diff --git a/src/renderer/components/EnergyBar.vue b/src/renderer/components/EnergyBar.vue new file mode 100644 index 0000000..f1a09b4 --- /dev/null +++ b/src/renderer/components/EnergyBar.vue @@ -0,0 +1,148 @@ + + + + + + diff --git a/src/renderer/components/filepath.json b/src/renderer/components/filepath.json index 6f09e13..05a5f80 100644 --- a/src/renderer/components/filepath.json +++ b/src/renderer/components/filepath.json @@ -1 +1 @@ -{"files":["E:\\TortoiseGit License.txt"]} \ No newline at end of file +{"files":["\\\\NAS\\study\\research_reports\\2025\\数据资产价值释放之行业应用场景解析与合规框架——科学研究和技术服务业.pdf"]} \ No newline at end of file diff --git a/src/renderer/components/main - 副本.vue b/src/renderer/components/main - 副本.vue index 751a311..d566845 100644 --- a/src/renderer/components/main - 副本.vue +++ b/src/renderer/components/main - 副本.vue @@ -223,7 +223,8 @@ :class="{ guide_body: beginStep && currentStep == 7 }"> + @click="newWork" + :disabled="infoData.length == 0 && state == false"> {{ $t('index.newWork') }} @@ -408,7 +409,7 @@ prop="status" :label="$t('main.tableState')" min-width="80"> - + + row-class-name="rowclass" + :row-key="row => row.JobID || row.AssUuid" + :tree-props="{ children: 'children' }"> @@ -552,6 +555,10 @@ prop="jId" :label="$t('index.wordID')" min-width="85"> + + + + + @@ -823,6 +851,12 @@ export default { warnCard, sFooter }, + filters: { + shortJobId(v) { + if (!v) return '' + return String(v).split('-')[0] + } + }, data() { return { guideStep: null, @@ -1085,12 +1119,12 @@ export default { this.getSystemInfo() this.selectLan = localStorage.getItem('lang') this.isAdmin = localStorage.getItem('loginrole') == 'administrator' - // const tempTimer = setInterval(() => { - // if (JSON.stringify(this.ribbonList) != '{}') { - // this.getData(1) //首次触发需要先获取到Ribbon数据 - // clearInterval(tempTimer) - // } - // }, 200) + const tempTimer = setInterval(() => { + if (JSON.stringify(this.ribbonList) != '{}') { + this.getData(1) //首次触发需要先获取到Ribbon数据 + clearInterval(tempTimer) + } + }, 200) ipcRenderer.on('open-program-callback', (event, data) => { console.log(data) this.openFile(data) @@ -1105,13 +1139,12 @@ export default { ipcRenderer.send('get-root') ipcRenderer.send('open-program') this.guideStep = JSON.parse(localStorage.getItem('guideStep')) - console.log(this.guideStep) this.currentStep = localStorage.getItem('currentStep') if ((!localStorage.getItem('hideStep') || localStorage.getItem('hideStep') == 0)&&this.currentStep>-1) this.showStep = true setTimeout(() => { this.doingWorkStatus = false }, 10000) - // this.timer2 = setInterval(this.getPrintData, this.refreshTime2) + this.timer2 = setInterval(this.getPrintData, this.refreshTime2) }, beforeDestroy() { this.stopTimer() @@ -1265,13 +1298,31 @@ export default { this.state = true let tasks = [...this.tasks] this.tasks = [] - for (let item of res.data.unfinishedTasks) { - item.jId = item.JobID.split('-')[0] //+ "..."; - this.tasks.push(item) + const normalize = (task) => { + const jId = (task.JobID || '').split('-')[0] + const parentCommon = { + jId, + ParentJobID: task.JobID, + ParentPrinterID: task.PrinterID, + ParentPrinterType: task.PrinterType, + ParentTaskCapacity: task.TaskCapacity + } + const children = Array.isArray(task.AssTask) ? task.AssTask.map((child) => ({ + ...child, + ...parentCommon + })) : [] + return { + ...task, + jId, + children + } } - for (let item of res.data.finishedTasks) { - item.jId = item.JobID.split('-')[0] //+ "..."; - this.tasks.push(item) + + for (let item of (res.data.unfinishedTasks || [])) { + this.tasks.push(normalize(item)) + } + for (let item of (res.data.finishedTasks || [])) { + this.tasks.push(normalize(item)) } let total1 = 0 let total2 = 0 @@ -1681,6 +1732,19 @@ export default { } this.isNew = true this.dialogVisible = true + // 新建任务时重置文件列表与网络认证状态,避免上一次残留导致卡顿 + this.$nextTick(() => { + const workRef = this.$refs.work + if (workRef && workRef.$refs && workRef.$refs.files && workRef.$refs.files.reset) { + workRef.$refs.files.reset() + } + if (workRef) { + workRef.networkAuthVisible = false + workRef.networkAuthPaths = [] + workRef.networkCredentials = {} + workRef.submitLoading = false + } + }) }, newNetWork() { //this.isNew = true; @@ -1869,15 +1933,15 @@ export default { watch: { hasDoingWork: { handler() { - // if (this.hasDoingWork) { - // this.intervalTime = parseInt(this.refreshTime1) - // clearInterval(this.timer1) - // this.timer1 = setInterval(this.initData, this.intervalTime) - // } else { - // this.intervalTime = parseInt(this.refreshTime2) - // clearInterval(this.timer1) - // this.timer1 = setInterval(this.initData, this.intervalTime) - // } + if (this.hasDoingWork) { + this.intervalTime = parseInt(this.refreshTime1) + clearInterval(this.timer1) + this.timer1 = setInterval(this.initData, this.intervalTime) + } else { + this.intervalTime = parseInt(this.refreshTime2) + clearInterval(this.timer1) + this.timer1 = setInterval(this.initData, this.intervalTime) + } }, immediate: true }, diff --git a/src/renderer/components/main.vue b/src/renderer/components/main.vue index d566845..a9d55ca 100644 --- a/src/renderer/components/main.vue +++ b/src/renderer/components/main.vue @@ -1,2225 +1,2299 @@ - - - - - + + + + + diff --git a/src/renderer/components/work.vue b/src/renderer/components/work.vue index 4bc25c4..4cbd6aa 100644 --- a/src/renderer/components/work.vue +++ b/src/renderer/components/work.vue @@ -1209,6 +1209,10 @@ export default { this.loadNetworkCredentials() this.getTemplates() + // 加载已保存的网络认证,支持二次新建直接使用 + if (this.loadNetworkCredentials) { + this.loadNetworkCredentials() + } }, updated() {}, methods: { @@ -1244,14 +1248,50 @@ export default { // 检查是否有网络路径需要认证 checkNetworkPaths() { - if (this.$refs.files && this.$refs.files.hasNetworkPaths()) { - const networkPaths = this.$refs.files.getNetworkPaths() - if (networkPaths.length > 0) { - this.networkAuthPaths = networkPaths - this.networkAuthVisible = true - return true + if (!(this.$refs.files && this.$refs.files.hasNetworkPaths())) { + return false + } + const networkPaths = this.$refs.files.getNetworkPaths() || [] + if (networkPaths.length === 0) return false + + // 从本地存储的 credentials 中匹配已有主机 + let stored = {} + try { + stored = JSON.parse(localStorage.getItem('networkCredentials') || '{}') + } catch (e) { + stored = {} + } + const missing = [] + const prepared = [] + for (const item of networkPaths) { + const host = item.hostName || this.getHostFromPath(item.path) || '' + if (host && stored[host] && stored[host].userName && stored[host].password) { + prepared.push({ + host_name: host, + user_name: stored[host].userName, + password: stored[host].password, + }) + } else { + missing.push({ ...item, hostName: host }) } } + + if (missing.length > 0) { + // 仅对缺失凭据的主机弹窗 + this.networkAuthPaths = missing.map(m => ({ + path: m.path, + hostName: m.hostName, + userName: '', + password: '' + })) + this.networkAuthVisible = true + // 先保存已准备好的,等用户补齐再一起提交 + this.networkCredentials = prepared + return true + } + + // 全部已有凭据,直接使用 + this.networkCredentials = prepared return false }, @@ -2426,6 +2466,20 @@ export default { }, help() { ipcRenderer.send('open-help-file') + }, + // 从路径提取主机名(兼容 \\host\path 与 //host/path) + getHostFromPath(p) { + if (!p || typeof p !== 'string') return '' + if (p.indexOf('\\\\') === 0) { + const parts = p.slice(2).split('\\') + return parts[0] || '' + } + if (p.indexOf('//') === 0) { + const parts = p.slice(2).split('/') + return parts[0] || '' + } + const m = p.match(/^([^\\\/:]+)/) + return (m && m[1]) ? m[1] : '' } }, computed: {