优化woker

This commit is contained in:
24kycj
2024-12-02 12:55:52 +08:00
parent ba2579642d
commit dd7bce6b40
5 changed files with 266 additions and 70 deletions
+53 -30
View File
@@ -121,7 +121,7 @@
<div class="device_info_option_b_text device_info_option_b_text1">{{ parseInt(printer_info.yellow_last) }}%</div>
</div>
<div v-if="isLast" @click="isLast = false" class="flex_box flex_row_center device_info_option_b">
<div class="device_info_option_b_text device_info_option_b_text1">{{ $accDiv($accAdd($accAdd(printer_info.blue_last,printer_info.red_last),printer_info.yellow_last),3).toFixed(2) }}%</div>
<div class="device_info_option_b_text device_info_option_b_text1">{{ parseInt($accDiv($accAdd($accAdd(printer_info.blue_last,printer_info.red_last),printer_info.yellow_last),3)) }}%</div>
</div>
</div>
</div>
@@ -163,10 +163,10 @@
<div class="flex_box device_right_top">
<div class="flex_box flex_row_between device_right_top_item">
<div class="device_right_top_img">
<img v-if="cd_list[0].cd_status == 4" src="@/assets/images/device3.png" />
<img v-if="cd_list[0].cd_status != 4" src="@/assets/images/device2.png" />
<div class="device_right_top_img_text" v-if="cd_list[0].cd_status != 4">{{ diskTypes[cd_list[0].dev_type] }}</div>
<div class="device_right_top_img_text device_right_top_img_text1" v-if="cd_list[0].cd_status == 4">{{ CDTypes[cd_list[0].cd_type] }}</div>
<img v-if="cd_list[0].cd_status == 4 && cd_list[0].cd_type" src="@/assets/images/device3.png" />
<img v-else src="@/assets/images/device2.png" />
<div class="device_right_top_img_text device_right_top_img_text1" v-if="cd_list[0].cd_status == 4 && cd_list[0].cd_type">{{ CDTypes[cd_list[0].cd_type] }}</div>
<div class="device_right_top_img_text" v-else>{{ diskTypes[cd_list[0].dev_type] }}</div>
</div>
<div class="device_right_top_content">
<div class="device_right_top_title">{{ cd_list[0].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[0].cd_pos] }})</div>
@@ -184,10 +184,10 @@
<div class="device_right_top_line"></div>
<div class="flex_box flex_row_between device_right_top_item">
<div class="device_right_top_img">
<img v-if="cd_list[1].cd_status == 4" src="@/assets/images/device3.png" />
<img v-if="cd_list[1].cd_status != 4" src="@/assets/images/device2.png" />
<div class="device_right_top_img_text" v-if="cd_list[1].cd_status != 4">{{ diskTypes[cd_list[1].dev_type] }}</div>
<div class="device_right_top_img_text device_right_top_img_text1" v-if="cd_list[1].cd_status == 4">{{ CDTypes[cd_list[1].cd_type] }}</div>
<img v-if="cd_list[1].cd_status == 4 && cd_list[1].cd_type" src="@/assets/images/device3.png" />
<img v-else src="@/assets/images/device2.png" />
<div class="device_right_top_img_text device_right_top_img_text1" v-if="cd_list[1].cd_status == 4 && cd_list[1].cd_type">{{ CDTypes[cd_list[1].cd_type] }}</div>
<div class="device_right_top_img_text" v-else>{{ diskTypes[cd_list[1].dev_type] }}</div>
</div>
<div class="device_right_top_content">
<div class="device_right_top_title">{{ cd_list[1].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[1].cd_pos] }})</div>
@@ -242,7 +242,7 @@
<div class="flex_box work_top">
<div class="work_top_text">作业列表</div>
</div>
<el-table row-key="task_uuid" default-expand-all class="work_table" :data="task_list" empty-text="暂无作业列表" :tree-props="{children: 'ass_task', hasChildren: 'hasChildren'}">
<el-table row-key="id" default-expand-all class="work_table" :data="task_list" empty-text="暂无作业列表" :tree-props="{children: 'ass_task', hasChildren: 'hasChildren'}">
<!-- <el-table-column type="index" width="80" label="序号"></el-table-column> -->
<el-table-column prop="task_uuid" label="作业ID"></el-table-column>
<el-table-column prop="task_name" label="任务名称"></el-table-column>
@@ -285,15 +285,16 @@
</div>
<!-- 新建作业 -->
<work-add v-if="workShow" @close="workShow=false" ref="workAdd"></work-add>
<work-add v-if="workShow" @close="workShow=false" :isNew="isNew" :saveWorkList="saveWorkList" ref="workAdd"></work-add>
</div>
</template>
<script>
let that
let outTimer
let fs = require('fs')
import { mapGetters } from 'vuex'
const { app, dialog } = require('@electron/remote')
import UserInfo from '@/components/userInfo/userInfo.vue'
import WorkAdd from '@/components/workAdd/workAdd.vue'
@@ -385,7 +386,9 @@ export default {
logList: [],
allLogList: [],
showAll: false,
workShow: false
workShow: false,
isNew: true,
saveWorkList: {}
}
},
watch: {
@@ -395,11 +398,12 @@ export default {
let tasks = [...val]
let list = []
tasks.forEach((item, index) => {
item.id = item.task_uuid
if (item.ass_task&&item.ass_task.length) {
let task_size = 0
item.ass_task.forEach((item2, idx) => {
item2.task_uuid = item.task_uuid+'_'+(idx+1)
item2.task_name = item.task_name+'_'+(idx+1)
item2.id = item.task_uuid+'_'+(idx+1)
// item2.task_name = item.task_name+'_'+(idx+1)
task_size = this.$accAdd(task_size, item2.task_size)
})
item.task_size = task_size
@@ -651,13 +655,14 @@ export default {
},
// 新建作业
showWork() {
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
})
return
}
// if (!that.workStatus) {
// that.$message({
// message: '请先连接服务',
// type: 'warning'
// })
// return
// }
that.isNew = true
that.workShow = true
that.$nextTick(() => {
that.$refs.workAdd.show()
@@ -665,13 +670,31 @@ export default {
},
// 打开作业文件
openWork() {
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
// if (!that.workStatus) {
// that.$message({
// message: '请先连接服务',
// type: 'warning'
// })
// return
// }
that.isNew = false
dialog
.showOpenDialog({
title: '打开作业文件',
filters: [{ name: 'Soon Work', extensions: ['swk'] }]
})
.then((res) => {
fs.readFile(res.filePaths[0], (err, data) => {
let fName = res.filePaths[0].trim()
let fileName = fName.substring(fName.lastIndexOf('\\') + 1)
that.saveWorkList = JSON.parse(data)
that.saveWorkList.task_name = fileName
that.workShow = true
that.$nextTick(() => {
that.$refs.workAdd.show()
})
})
})
return
}
},
// 显示日志
noticeChange() {
@@ -1270,11 +1293,11 @@ $red: #ff0000;
}
td.el-table__cell {
background-color: #ffffff;
border-bottom: 2px solid #f8f8f8;
border-bottom: 1px dashed #ddd;
}
th.el-table__cell {
background-color: #f2f9f4;
border-bottom: 2px solid #f8f8f8;
border-bottom: 1px dashed #ddd;
}
.el-table__cell {
padding: 6px 0;