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"> - {{ $t('main.tableOnline') }} + {{ $t('main.tableOnline') }} + 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"> + + {{ scope.row.jId }} + {{ (scope.row.ParentJobID || '') | shortJobId }} + - {{ getPrintName(scope.row.PrinterID, true) }} + {{ getPrintName(scope.row.PrinterID, true) }} + {{ getPrintName(scope.row.ParentPrinterID || scope.row.PrinterID, true) }} - {{ scope.row.PrinterType }} + {{ !scope.row.AssUuid ? scope.row.PrinterType : (scope.row.ParentPrinterType || scope.row.PrinterType) }} + + {{ !scope.row.AssUuid ? scope.row.TaskCapacity : (scope.row.ParentTaskCapacity || '') }} + + + {{ !scope.row.AssUuid ? scope.row.CreateTime : (scope.row.StartTime || '') }} + + + {{ !scope.row.AssUuid ? scope.row.FinishTime : (scope.row.FinishTime || '') }} + + + {{ scope.row.JobCompletion }} + - + - handleTaskCommand(e, scope.row.JobID)" - :disabled="scope.row.JobStatus != 'Fail'"> - - {{ jobState(scope.row.JobStatus) }}{{ scope.row.CopySpeed ? Math.ceil(parseFloat(scope.row.CopySpeed)*10)/10 : '0.0' }}MB/s - - - - - {{ $t('main.commandRefresh') }} - - - {{ $t('main.commandDelete') }} - - - - + + handleTaskCommand(e, scope.row.JobID)" + :disabled="scope.row.JobStatus != 'Fail'"> + + {{ jobState(scope.row.JobStatus) }}{{ scope.row.CopySpeed ? Math.ceil(parseFloat(scope.row.CopySpeed)*10)/10 : '0.0' }}MB/s + + + + + {{ $t('main.commandRefresh') }} + + + {{ $t('main.commandDelete') }} + + + + + + + {{ jobState(scope.row.TaskStatus) }} + + @@ -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 @@ - - - - - - - - {{ $t('index.wordSpace') }} - - - - {{ getPrintName(item.PrinterID, true) }} - {{ item.PrinterType == '-1' ? $t('index.workspacenodata') : item.PrinterType }} - - - - - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step1`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ parseInt(currentStep) == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - - - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step2`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - - - {{ $t('main.doneCopyNum') }} - - {{ doneCopyNum }} - - - - {{ $t('main.cancelCopyNum') }} - - {{ cancelCopyNum }} - - - - {{ $t('main.failNum') }} - - {{ failNum }} - - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step3`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - {{ $t('main.submitTask') }} - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step8`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - - {{ $t('index.newWork') }} - - - - - - {{ $t('index.newWork') }} - - - {{ $t('admin.openWork') }} - - - - - {{ $t('admin.hello') }} {{ user }} - {{ $t('main.adminMange') }} - {{ $t('main.out') }} - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step5`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - - - - - - - {{ $t('main.systemInformation') }} - - - {{ $t('main.deviceType') }}{{ os.CardsoonModel }} - {{ $t('main.serialNumber') }}{{ os.SystemSn }} - {{ $t('main.hostName') }}{{ os.hostname }} - {{ $t('main.hostIp') }}{{ os.ip }} - - - - - - - - {{ $t('main.hardwareConfiguration') }} - - - - {{ $t('main.Cpu') }}{{ os.cpu }} - {{ $t('main.Memory') }}{{ os.ram }} - {{ $t('main.hardDrive') }}{{ os.HD }} - - {{ $t('main.cacheSpace') }}:{{ os.remainCacheSpace }} / - {{ os.totalCacheSpace }} - - - - - - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step6`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - - - - {{ getPrintName(scope.row.PrinterID, true) }} - - - - {{ $t('main.tableOnline') }} - - - - - - - - - - - - - handleMachineCommand(e, scope.row.PrinterID)"> - - {{ scope.row.PrinterType }} - - - - {{ $t('main.autoSetting') }} - - - {{ $t('main.cancelSetting') }} - - - {{ item.label }} - - - - - - - - - - - - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step7`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - - - - - - - {{ scope.$index + 1 }} - - - - - {{ scope.row.jId }} - {{ (scope.row.ParentJobID || '') | shortJobId }} - - - - - - - {{ getPrintName(scope.row.PrinterID, true) }} - {{ getPrintName(scope.row.ParentPrinterID || scope.row.PrinterID, true) }} - - - - - {{ !scope.row.AssUuid ? scope.row.PrinterType : (scope.row.ParentPrinterType || scope.row.PrinterType) }} - - - - - {{ !scope.row.AssUuid ? scope.row.TaskCapacity : (scope.row.ParentTaskCapacity || '') }} - - - - - - - {{ !scope.row.AssUuid ? scope.row.CreateTime : (scope.row.StartTime || '') }} - - - - - - - {{ !scope.row.AssUuid ? scope.row.FinishTime : (scope.row.FinishTime || '') }} - - - - - {{ scope.row.JobCompletion }} - - - - - - - - handleTaskCommand(e, scope.row.JobID)" - :disabled="scope.row.JobStatus != 'Fail'"> - - {{ jobState(scope.row.JobStatus) }}{{ scope.row.CopySpeed ? Math.ceil(parseFloat(scope.row.CopySpeed)*10)/10 : '0.0' }}MB/s - - - - - {{ $t('main.commandRefresh') }} - - - {{ $t('main.commandDelete') }} - - - - - - - {{ jobState(scope.row.TaskStatus) }} - - - - - - - - - - - - - {{ $t('index.openHistoryLog') }} - - - - - - - - - - - - - - - - {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) - - {{ $t(`guide.step4`) }} - - {{ $t('guide.skip') }} - {{ $t('guide.prev') }} - {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} - - - - {{ $t('index.notice') }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 欢迎使用卡树自动拷贝打印系统,我们将引导您使用本系统,请按照提示学习操作! - - 本次引导结束,不再进入 - - - 开始引导 - - - - - - - - - + + + + + + + + {{ $t('index.wordSpace') }} + + + + {{ getPrintName(item.PrinterID, true) }} + {{ item.PrinterType == '-1' ? $t('index.workspacenodata') : item.PrinterType }} + + + + + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step1`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ parseInt(currentStep) == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + + + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step2`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + + + {{ $t('main.doneCopyNum') }} + + {{ doneCopyNum }} + + + + {{ $t('main.cancelCopyNum') }} + + {{ cancelCopyNum }} + + + + {{ $t('main.failNum') }} + + {{ failNum }} + + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step3`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + {{ $t('main.submitTask') }} + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step8`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + + {{ $t('index.newWork') }} + + + + + + {{ $t('index.newWork') }} + + + {{ $t('admin.openWork') }} + + + + + {{ $t('admin.hello') }} {{ user }} + {{ $t('main.adminMange') }} + {{ $t('main.out') }} + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step5`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + + + + + + + {{ $t('main.systemInformation') }} + + + {{ $t('main.deviceType') }}{{ os.CardsoonModel }} + {{ $t('main.serialNumber') }}{{ os.SystemSn }} + {{ $t('main.hostName') }}{{ os.hostname }} + {{ $t('main.hostIp') }}{{ os.ip }} + + + + + + + + {{ $t('main.hardwareConfiguration') }} + + + + {{ $t('main.Cpu') }}{{ os.cpu }} + {{ $t('main.Memory') }}{{ os.ram }} + {{ $t('main.hardDrive') }}{{ os.HD }} + + {{ $t('main.cacheSpace') }}:{{ os.remainCacheSpace }} / + {{ os.totalCacheSpace }} + + + + + + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step6`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + + + + {{ getPrintName(scope.row.PrinterID, true) }} + + + + {{ $t('main.tableOnline') }} + + + + + + + + + + + + + handleMachineCommand(e, scope.row.PrinterID)"> + + {{ scope.row.PrinterType }} + + + + {{ $t('main.autoSetting') }} + + + {{ $t('main.cancelSetting') }} + + + {{ item.label }} + + + + + + + + + + + + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step7`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + + + + + + + {{ parentIndex(scope.row) }} + + + + + {{ scope.row.jId }} + + + + + + {{ scope.row.DataSource }} + + + + + + {{ getPrintName(scope.row.PrinterID, true) }} + {{ getPrintName(scope.row.ParentPrinterID || scope.row.PrinterID, true) }} + + + + + {{ !scope.row.AssUuid ? scope.row.PrinterType : (scope.row.ParentPrinterType || scope.row.PrinterType) }} + + + + + {{ !scope.row.AssUuid ? scope.row.TaskCapacity : (scope.row.ParentTaskCapacity || '') }} + + + + + + + {{ !scope.row.AssUuid ? scope.row.CreateTime : (scope.row.StartTime || '') }} + + + + + + + {{ !scope.row.AssUuid ? scope.row.FinishTime : (scope.row.FinishTime || '') }} + + + + + {{ scope.row.JobCompletion }} + - + + + + + + handleTaskCommand(e, scope.row.JobID)" + :disabled="scope.row.JobStatus != 'Fail'"> + + {{ jobState(scope.row.JobStatus) }}{{ scope.row.CopySpeed ? Math.ceil(parseFloat(scope.row.CopySpeed)*10)/10 : '0.0' }}MB/s + + + + + {{ $t('main.commandRefresh') }} + + + {{ $t('main.commandDelete') }} + + + + + + + {{ jobState(scope.row.TaskStatus) }} + + + + + + + + + + + + + {{ $t('index.openHistoryLog') }} + + + + + + + + + + + + + + + + {{ $t('guide.title') }}({{ parseInt(currentStep) + 1 }}/{{ guideStep.length }}) + + {{ $t(`guide.step4`) }} + + {{ $t('guide.skip') }} + {{ $t('guide.prev') }} + {{ currentStep == guideStep.length - 1 ? $t('guide.complete') : $t('guide.next') }} + + + + {{ $t('index.notice') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 欢迎使用卡树自动拷贝打印系统,我们将引导您使用本系统,请按照提示学习操作! + + 本次引导结束,不再进入 + + + 开始引导 + + + + + + + + + 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: {