优化服务

This commit is contained in:
24kycj
2024-11-19 21:13:18 +08:00
parent 1707dfdbcc
commit 8eb94d7c5d
6 changed files with 328 additions and 195 deletions
+134 -37
View File
@@ -7,16 +7,20 @@
<img src="@/assets/images/Plus1_icon.png" />
<div>新建作业</div>
</div>
<div class="flex_box flex_row_center top_btn2">
<div @click="openWork" class="flex_box flex_row_center top_btn2">
<img src="@/assets/images/Search_icon.png" />
<div>打开作业文件</div>
</div>
<div @click="$router.push({ path: '/manage' })" class="flex_box flex_row_center top_btn2">
<div @click="goUrl('/manage')" class="flex_box flex_row_center top_btn2">
<img src="@/assets/images/Setting_icon.png" />
<div>系统设置</div>
</div>
<div class="top_left_line"></div>
<el-switch class="top_left_status" v-model="workStatus" active-color="#07C160" inactive-color="#aaa"> </el-switch>
<el-tooltip :content="workStatus?'关闭服务':'打开服务'" placement="bottom">
<div class="flex_box flex_row_center top_left_status_box">
<el-switch :disabled="!serviceStatus" @change="serviceChange" class="top_left_status" v-model="workStatus" active-color="#07C160" inactive-color="#aaa"> </el-switch>
</div>
</el-tooltip>
<div class="flex_box top_left_option">
<div class="top_left_text">完成拷贝数:</div>
<div class="top_left_num">{{ task_list.length }}</div>
@@ -136,7 +140,8 @@
</div>
</div>
</div>
<div :class="`flex_box device_status device_status${printer_info.printer_status} device_status${printer_info.cover_flag}`">
<!-- <div class="flex_box device_status" :class="`flex_box device_status device_status${printer_info.printer_status} device_status${printer_info.cover_flag}`"> -->
<div class="flex_box device_status" :class="{ 'device_status1': printer_info.printer_status === 'I', 'device_status2': printer_info.printer_status === 'B' || printer_info.printer_status === 'P', 'device_status3': printer_info.cover_flag || !isConnect || !serviceStatus }">
<div class="device_status_dot"></div>
<div class="device_status_text">{{ runText }}</div>
</div>
@@ -154,15 +159,15 @@
<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].total_size" src="@/assets/images/device3.png" />
<img v-if="!cd_list[0].total_size" src="@/assets/images/device2.png" />
<div class="device_right_top_img_text" :class="{ 'device_right_top_img_text1': cd_list[0].total_size }">{{ diskTypes[cd_list[0].dev_type] }}</div>
<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" :class="{ 'device_right_top_img_text1': cd_list[0].cd_status == 4 }">{{ 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>
<template v-if="cd_list[0].total_size">
<template v-if="cd_list[0].copy_scheduler > 0">
<div class="flex_box device_right_top_progress">
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[0].cd_taskid.copy_scheduler + '%' }"></div>
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[0].copy_scheduler + '%' }"></div>
</div>
<div class="device_right_top_text">{{ $filterSize($accSub(cd_list[0].total_size, cd_list[0].use_size)) }}可用{{ $filterSize(cd_list[0].total_size) }}</div>
</template>
@@ -174,15 +179,15 @@
<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].total_size" src="@/assets/images/device3.png" />
<img v-if="!cd_list[1].total_size" src="@/assets/images/device2.png" />
<div class="device_right_top_img_text" :class="{ 'device_right_top_img_text1': cd_list[1].total_size }">{{ diskTypes[cd_list[1].dev_type] }}</div>
<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" :class="{ 'device_right_top_img_text1': cd_list[1].cd_status == 4 }">{{ 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>
<template v-if="cd_list[1].total_size">
<template v-if="cd_list[1].copy_scheduler">
<div class="flex_box device_right_top_progress">
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[1].cd_taskid.copy_scheduler + '%' }"></div>
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[1].copy_scheduler + '%' }"></div>
</div>
<div class="device_right_top_text">{{ $filterSize($accSub(cd_list[1].total_size, cd_list[1].use_size)) }}可用{{ $filterSize(cd_list[1].total_size) }}</div>
</template>
@@ -198,7 +203,7 @@
<img src="@/assets/images/inform1_icon.png" />
<div>动态</div>
</div>
<div @click="showAll = !showAll" class="flex_box notice_all">
<div @click="noticeChange" class="flex_box notice_all">
<img src="@/assets/images/Calendar_icon.png" />
<div>{{ showAll ? '最新日志' : '全部日志' }}</div>
</div>
@@ -316,7 +321,7 @@
</div>
<!-- 新建作业 -->
<work-add ref="workAdd"></work-add>
<work-add v-if="workShow" @close="workShow=false" ref="workAdd"></work-add>
</div>
</template>
@@ -333,11 +338,11 @@ export default {
components: { UserInfo, WorkAdd },
data() {
return {
// 设备运行状态
workStatus: true,
// 服务状态
isConnect: false,
serviceStatus: false,
// 工作状态
infoStatus: 0,
runText: '',
// 运行选项
runVal: 1,
currentRunVal: 0,
@@ -410,7 +415,8 @@ export default {
// 日志信息
logList: [],
allLogList: [],
showAll: false
showAll: false,
workShow: false
}
},
watch: {
@@ -434,11 +440,6 @@ export default {
},
'$store.state.chat.printer_info': {
handler(val) {
if (val.cover_flag) {
this.runText = '设备门盖被打开,请关闭门盖。'
} else {
this.runText = this.$store.state.chat.PrinterStatus[val.printer_status]
}
this.default_cd = val.strongList
this.printer_info = { ...val }
},
@@ -479,17 +480,65 @@ export default {
},
deep: true,
immediate: true
},
'$store.state.chat.isConnect': {
handler(val) {
this.isConnect = val
},
deep: true,
immediate: true
},
'$store.state.chat.serviceStatus': {
handler(val) {
this.serviceStatus = val
},
deep: true,
immediate: true
}
},
computed: {
...mapGetters(['name', 'roles'])
...mapGetters(['name', 'roles']),
runText() {
let text = this.$store.state.chat.PrinterStatus[this.printer_info.printer_status]
if (this.printer_info.cover_flag) {
text = '设备门盖被打开,请关闭门盖。'
}
if (!this.isConnect) {
text = '服务已关闭'
}
if (!this.serviceStatus) {
text = '正在连接服务器,请检查服务器是否正常'
}
return text
},
workStatus() {
return this.isConnect&&this.serviceStatus
},
},
mounted() {
that = this
},
methods: {
// 服务打开/关闭
serviceChange(e) {
if (!that.serviceStatus) {
return
}
if (e) {
that.$store.dispatch('chat/initWebSocket')
} else {
that.$store.dispatch('chat/closeWebsocket')
}
},
// 执行
handleRun() {
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
})
return
}
const index = that.runList.findIndex((item) => item.value == that.runVal)
// that.$message({
// message: that.runList[index].label,
@@ -510,13 +559,59 @@ export default {
this.changeCD.req_info.strong_list[type].strong_type = e
},
sureCD() {
that.$store.dispatch('chat/websocketsend', this.changeCD)
clearTimeout(outTimer)
this.currentRunVal = 0
that.$store.dispatch('chat/websocketsend', this.changeCD).then(() => {
clearTimeout(outTimer)
this.currentRunVal = 0
}).catch(() => {
clearTimeout(outTimer)
this.currentRunVal = 0
})
},
// 新建作业
showWork() {
that.$refs.workAdd.show()
// if (!that.workStatus) {
// that.$message({
// message: '请先连接服务',
// type: 'warning'
// })
// return
// }
that.workShow = true
that.$nextTick(() => {
that.$refs.workAdd.show()
})
},
// 打开作业文件
openWork() {
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
})
return
}
},
// 显示日志
noticeChange() {
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
})
return
}
that.showAll = !that.showAll
},
// 跳转
goUrl(e) {
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
})
return
}
that.$router.push({ path: e })
},
// 退出登录
goOut() {
@@ -579,9 +674,12 @@ $red: #ff0000;
background: #e0e0e0;
margin: 0 16px;
}
.top_left_status {
padding: 0 16px;
zoom: 1.3;
.top_left_status_box {
width: 90px;
.top_left_status {
padding: 0 16px;
zoom: 1.3;
}
}
.top_left_option {
margin-left: 16px;
@@ -814,7 +912,7 @@ $red: #ff0000;
line-height: 30px;
}
}
.device_statusI {
.device_status1 {
.device_status_dot {
background-color: $green;
}
@@ -822,8 +920,7 @@ $red: #ff0000;
color: $green;
}
}
.device_statusB,
.device_statusP {
.device_status2 {
.device_status_dot {
background-color: $yellow;
}
@@ -831,7 +928,7 @@ $red: #ff0000;
color: $yellow;
}
}
.device_statustrue {
.device_status3 {
.device_status_dot {
background-color: $red;
}