From 2ba2e70a2bff17e753e4ea715fbc91f9cb58eac1 Mon Sep 17 00:00:00 2001 From: 24kycj <1637269896@qq.com> Date: Sun, 17 Nov 2024 21:20:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/userInfo/userInfo.vue | 4 +- src/renderer/components/workAdd/workAdd.vue | 134 ++++++++------- src/renderer/store/modules/chat.js | 91 +++++++--- src/renderer/styles/index.scss | 5 + src/renderer/views/dashboard/index.vue | 155 +++++++++++------- 5 files changed, 237 insertions(+), 152 deletions(-) diff --git a/src/renderer/components/userInfo/userInfo.vue b/src/renderer/components/userInfo/userInfo.vue index e2129f1..384f9e9 100644 --- a/src/renderer/components/userInfo/userInfo.vue +++ b/src/renderer/components/userInfo/userInfo.vue @@ -33,13 +33,13 @@ .top_right { .top_right_name { font-weight: 500; - font-size: 15px; + font-size: 18px; color: #000000; padding: 0 16px; } .top_right_btn { font-weight: 500; - font-size: 15px; + font-size: 18px; color: #00C325; line-height: 50px; padding-left: 16px; diff --git a/src/renderer/components/workAdd/workAdd.vue b/src/renderer/components/workAdd/workAdd.vue index c82b927..fe1d444 100644 --- a/src/renderer/components/workAdd/workAdd.vue +++ b/src/renderer/components/workAdd/workAdd.vue @@ -180,13 +180,13 @@ @@ -292,6 +292,15 @@ export default { { color: '#67C23A', percentage: 99 }, { color: '#F56C6C', percentage: 100 } ], + csvForm: { + req_name: 'upload_file', + req_type: 1, + req_info: { + uuid: '', + file_name: 'templ.csv', + file_text: '' + } + }, // 高级设置 setShow: false, setForm: {}, @@ -384,13 +393,14 @@ export default { file_percent() { const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size console.log(diskSize) - let t = diskSize ? this.$accDiv(this.totalSize, diskSize)*100 : 0 + let t = diskSize ? this.$accDiv(this.totalSize, diskSize) * 100 : 0 return t > 100 ? 100.1 : t - }, + } }, mounted() { this.getTemplates() this.form.task_uuid = this.genTaskUUID() + this.csvForm.req_info.uuid = this.genTaskUUID() this.form.label = dayjs().format('YYYY-MM-DD') }, methods: { @@ -410,15 +420,13 @@ export default { sizeChange(size) { this.totalSize = size }, - async upload_over() { - - }, + async upload_over() {}, // 保存 workSave() { that.saveFlag = true setTimeout(() => { that.saveFlag = false - }, 1000); + }, 1000) }, // 提交 workSubmit() { @@ -428,7 +436,7 @@ export default { that.submitFlag = true setTimeout(() => { that.submitFlag = false - }, 1000); + }, 1000) for (let key in files) { let file = { ...files[key] } try { @@ -518,10 +526,25 @@ export default { } this.form.ass_task.push(task) } + // csv文件处理 + if (!that.form.udf_file && that.soonList.length > 0) { + const isEmpty = that.soonList.some((item) => item.val === '') + if (isEmpty) { + that.$message({ + message: '可变字段不能为空', + type: 'warning' + }) + return + } + let csv1 = that.soonList.map(item => item.origin_name).join(',') + let csv2 = that.soonList.map(item => item.val).join(',') + that.csvForm.req_info.file_text = csv1 + '\n' + csv2 + that.$store.dispatch('chat/websocketsend', that.csvForm) + } that.submitLoading = true if (that.form.json_file) that.form.has_print_task = true if (fileList.length) that.form.has_copy_task = true - let theForm = {...that.form} + let theForm = { ...that.form } if (!theForm.udf_file) delete theForm.udf_file that.testForm.req_info = theForm that.$store.dispatch('chat/websocketsend', that.testForm) @@ -623,16 +646,6 @@ export default { console.error(`stderr: ${stderr}`) }) }, - getPrintName(id) { - return this.$t('index.wordSpace') + id.substr(-5) - }, - getPrintName1(id) { - for (let i = 0; i < this.printerList.length; i++) { - if (this.printerList[i].PrinterID == id) { - return this.$t('index.wordSpace') + this.toChar(i) - } - } - }, // 文件上传处理 openFile() { this.$refs.refFile.dispatchEvent(new MouseEvent('click')) @@ -763,22 +776,22 @@ export default { } .work_top_val { .el-input { - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; } ::v-deep { .el-input__inner { width: 180px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-size: 16px; color: #000; font-weight: 500; } .el-input__icon { font-size: 16px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-weight: bold; color: #000; } @@ -787,7 +800,7 @@ export default { } .work_top_set { cursor: pointer; - height: 36px; + height: 40px; padding: 0 22px; background: rgba(0, 195, 37, 0.12); border-radius: 4px; @@ -819,7 +832,7 @@ export default { } .work_left_top_btn { cursor: pointer; - height: 32px; + height: 40px; padding: 0 22px; background: rgba(0, 195, 37, 0.12); border-radius: 4px; @@ -836,8 +849,8 @@ export default { } .work_left_top_input { .el-input { - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; } ::v-deep { .el-input-group__prepend { @@ -847,16 +860,16 @@ export default { } .el-input__inner { width: 180px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-size: 16px; color: #000; font-weight: 500; } .el-input__icon { font-size: 16px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-weight: bold; color: #000; } @@ -873,12 +886,11 @@ export default { .work_files_progress { ::v-deep { .el-progress-bar__outer { - height: 24px!important; + height: 24px !important; font-size: 12px; color: #000; } } - } } } @@ -896,23 +908,23 @@ export default { ::v-deep { .el-input__inner { width: 300px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-size: 16px; color: #000; font-weight: 500; } .el-input__icon { font-size: 16px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-weight: bold; color: #000; } } .work_right_top_file { width: 63px; - height: 32px; + height: 40px; cursor: pointer; background: rgba(195, 189, 0, 0.12); border-radius: 4px; @@ -920,13 +932,13 @@ export default { font-weight: 500; font-size: 16px; color: #d9b028; - line-height: 32px; + line-height: 40px; text-align: center; margin: 0 22px; } .work_right_top_add { width: 123px; - height: 32px; + height: 40px; cursor: pointer; background: #d8f6ff; border-radius: 4px; @@ -934,7 +946,7 @@ export default { font-weight: 500; font-size: 16px; color: #25aed9; - line-height: 32px; + line-height: 40px; text-align: center; } } @@ -993,21 +1005,21 @@ export default { } .wook_soon_input { width: 300px; - height: 32px; + height: 40px; border-radius: 4px; ::v-deep { .el-input__inner { width: 300px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-size: 16px; color: #000; font-weight: 500; } .el-input__icon { font-size: 16px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-weight: bold; color: #000; } @@ -1015,7 +1027,7 @@ export default { } .wook_soon_add { width: 110px; - height: 32px; + height: 40px; cursor: pointer; background: #d8f6ff; border-radius: 4px; @@ -1056,16 +1068,16 @@ export default { } .el-input__inner { width: 180px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-size: 16px; color: #000; font-weight: 500; } .el-input__icon { font-size: 16px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-weight: bold; color: #000; } @@ -1108,7 +1120,7 @@ export default { font-weight: 500; font-size: 16px; color: #000000; - line-height: 32px; + line-height: 40px; text-align: right; padding-right: 12px; } @@ -1116,16 +1128,16 @@ export default { ::v-deep { .el-input__inner { width: 180px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-size: 16px; color: #000; font-weight: 500; } .el-input__icon { font-size: 16px; - height: 32px; - line-height: 32px; + height: 40px; + line-height: 40px; font-weight: bold; color: #000; } @@ -1161,7 +1173,7 @@ export default { height: 62px; .set_btn1 { width: 120px; - height: 32px; + height: 40px; background: #ffffff; border-radius: 4px; border: 1px solid #000000; @@ -1173,7 +1185,7 @@ export default { } .set_btn2 { width: 120px; - height: 32px; + height: 40px; background: #00c325; border-radius: 4px; font-weight: 500; diff --git a/src/renderer/store/modules/chat.js b/src/renderer/store/modules/chat.js index 2651aa0..0753025 100644 --- a/src/renderer/store/modules/chat.js +++ b/src/renderer/store/modules/chat.js @@ -54,7 +54,7 @@ const CDStatus = { const diskTypes = { 1: 'CD', 2: 'DVD', - 3: 'BD', + 3: 'BD' } const CDTypes = { 1: 'CD', @@ -69,37 +69,37 @@ const cd_types = [ { value: 1, label: 'CD 700MB', - size: 700*1024*1024 + size: 700 * 1024 * 1024 }, { value: 2, label: 'DVD 4.7GB', - size: 4.7*1024*1024*1024 + size: 4.7 * 1024 * 1024 * 1024 }, { value: 3, label: 'DVD_DL 8.5GB', - size: 8.5*1024*1024*1024 + size: 8.5 * 1024 * 1024 * 1024 }, { value: 4, label: 'BD 25GB', - size: 25*1024*1024*1024 + size: 25 * 1024 * 1024 * 1024 }, { value: 5, label: 'BD_DL 50GB', - size: 50*1024*1024*1024 + size: 50 * 1024 * 1024 * 1024 }, { value: 6, label: 'BD_TL 100GB', - size: 100*1024*1024*1024 + size: 100 * 1024 * 1024 * 1024 }, { value: 7, label: 'BD_QL 128GB', - size: 128*1024*1024*1024 + size: 128 * 1024 * 1024 * 1024 } ] @@ -116,7 +116,25 @@ const getDefaultState = () => { CDTypes, cd_types, // 任务列表 - task_list: [], + task_list: [ + // { + // task_uuid: '20204215', + // task_name: '复制任务', + // task_size: 100000, + // finish_freq: 2, + // total_freq: 10, + // task_status: 2, + // ass_task: [ + // { + // task_size: 100000, + // cd_type: 2, + // start_time: '2024-04-01 12:00:00', + // finish_time: '2024-04-01 12:00:00', + // task_status: 2 + // } + // ] + // } + ], // 打印机信息 printer_info: { blue_last: 0, //蓝色墨盒遗留 @@ -158,7 +176,7 @@ const getDefaultState = () => { cd_list: [ { cd_pos: 1, // 设备位置 1:下光驱,2:上光驱 - cd_status: 4, // 设备状态 0:无法确定光盘状态 ,1:没有光盘 , 2:光驱托盘打开, 3:光驱未准备好,4:光盘状态正常,光盘已插入 + cd_status: 1, // 设备状态 0:无法确定光盘状态 ,1:没有光盘 , 2:光驱托盘打开, 3:光驱未准备好,4:光盘状态正常,光盘已插入 cd_taskid: '', // 当前任务id dev_path: '', // 光驱路径 dev_type: 2, // 光驱类型 @@ -182,7 +200,14 @@ const getDefaultState = () => { error3: '' }, // 日志信息 - logList: [] + logList: [ + // { + // time: '2024-04-01 12:00:00', + // text: '任务开始', + // status: 'INFO' + // } + ], + allLogList: [] } } @@ -244,7 +269,7 @@ const actions = { let typeLists = cd_types if (!isBD) { types = {} - for(let key in CDTypes) { + for (let key in CDTypes) { if (parseInt(key) < 4) types[key] = CDTypes[key] } typeLists = cd_types.slice(0, 3) @@ -252,6 +277,33 @@ const actions = { commit('setData', { name: 'CDTypes', data: types }) commit('setData', { name: 'cd_types', data: typeLists }) commit('setData', { name: 'cd_list', data: cds }) + } else if (data.resp_name === 'add_log') { + let logs = data.resp_info.add_log + let loglist = [] + let logLists = [...state.logList] + for (let i = 0; i < logs.length; i++) { + let texts = logs[i].split('|') + if (logLists.length > 20) logLists.splice(logLists.length - 1, 1) + loglist.unshift({ + time: texts[0].replace(/\//g, "-").replace(/时/g, ':').replace(/分/g, ':').replace(/秒/g, ''), + text: texts[2], + status: texts[1] + }) + } + let list = [...loglist, ...logLists] + commit('setData', { name: 'logList', data: list }) + } else if (data.resp_name === 'all_log') { + let logs = data.resp_info.add_log + let loglist = [] + for (let i = 0; i < logs.length; i++) { + let texts = logs[i].split('|') + loglist.unshift({ + time: texts[0].replace(/\//g, "-").replace(/时/g, ':').replace(/分/g, ':').replace(/秒/g, ''), + text: texts[2], + status: texts[1] + }) + } + commit('setData', { name: 'logList', data: loglist }) } else if (data.resp_name === 'printer_error') { let error = data.resp_info let info = { @@ -281,21 +333,6 @@ const actions = { setTimeout(() => { commit('setData', { name: 'printer_error', data: info }) }, 100) - } else if (data.resp_name === 'add_log') { - let logs = data.resp_info.add_log - let loglist = [] - let logLists = [...state.logList] - for (let i = 0; i < logs.length; i++) { - let texts = logs[i].split('|') - if (logLists.length > 20) logLists.splice(logLists.length - 1, 1) - loglist.unshift({ - time: texts[0], - text: texts[2], - status: texts[1] - }) - } - let list = [...loglist, ...state.logList] - commit('setData', { name: 'logList', data: list }) } } else { // 未知消息 diff --git a/src/renderer/styles/index.scss b/src/renderer/styles/index.scss index cc94f6b..5ded5e3 100644 --- a/src/renderer/styles/index.scss +++ b/src/renderer/styles/index.scss @@ -137,4 +137,9 @@ a:hover { /* 滚动条滑块hover状态样式 */ ::-webkit-scrollbar-thumb:hover { background-color: #b5b5b5; /* 设置滑块hover状态时的背景颜色 */ +} +.el-select-dropdown__item { + font-size: 16px; + height: 40px; + line-height: 40px; } \ No newline at end of file diff --git a/src/renderer/views/dashboard/index.vue b/src/renderer/views/dashboard/index.vue index 53b358d..fbc9e74 100644 --- a/src/renderer/views/dashboard/index.vue +++ b/src/renderer/views/dashboard/index.vue @@ -19,11 +19,11 @@
完成拷贝数:
-
9
+
{{ task_list.length }}
废弃拷贝数:
-
2
+
0
错误:
@@ -44,48 +44,56 @@
-
{{ printer_info.printer_name }}
+
{{ printer_info.printer_name || '打印机名称' }}
-
+
-
{{CDTypes[printer_info.strongList[1].cd_type]}} {{printer_info.strongList[1].cd_num}}张
- +
{{ CDTypes[printer_info.strongList[1].cd_type] }} {{ printer_info.strongList[1].cd_num }}张
+
-
+
-
{{CDTypes[printer_info.strongList[2].cd_type]}} {{printer_info.strongList[2].cd_num}}张
- +
{{ CDTypes[printer_info.strongList[2].cd_type] }} {{ printer_info.strongList[2].cd_num }}张
+
-
+
-
+
-
+
-
{{parseInt(printer_info.blue_last)}}%
-
{{parseInt(printer_info.red_last)}}%
-
{{parseInt(printer_info.yellow_last)}}%
+
{{ parseInt(printer_info.blue_last) }}%
+
{{ parseInt(printer_info.red_last) }}%
+
{{ parseInt(printer_info.yellow_last) }}%
@@ -128,13 +136,13 @@
-
{{ diskTypes[cd_list[0].dev_type] }}
+
{{ diskTypes[cd_list[0].dev_type] }}
{{ cd_list[0].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[0].cd_pos] }})
@@ -148,13 +156,13 @@
-
{{ diskTypes[cd_list[1].dev_type] }}
+
{{ diskTypes[cd_list[1].dev_type] }}
{{ cd_list[1].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[1].cd_pos] }})
@@ -172,7 +180,7 @@
-
{{ showAll?'最新日志':'全部日志' }}
+
{{ showAll ? '最新日志' : '全部日志' }}
@@ -186,7 +194,7 @@