优化bug

This commit is contained in:
24kycj
2025-03-31 20:33:06 +08:00
parent 8d3fd6b4d2
commit 1589efc667
4 changed files with 150 additions and 142 deletions
+80 -45
View File
@@ -19,66 +19,32 @@ export default {
if (that.$store.getters.token) { if (that.$store.getters.token) {
that.$store.dispatch('chat/initWebSocket') // 初始化websocket that.$store.dispatch('chat/initWebSocket') // 初始化websocket
} }
this.showNotify()
this.showNotify()
this.showNotify()
this.showNotify()
}, },
watch: { watch: {
'$store.state.chat.printer_error': { '$store.state.chat.printer_error': {
handler(val) { handler(val) {
let that = this let that = this
const currentTime = dayjs().format('HH:mm:ss'); const currentTime = dayjs().format('HH:mm:ss')
if (val.message) { if (val.message) {
if (that.errors.indexOf(val.message) === -1) { if (that.errors.indexOf(val.message) === -1) {
that.errors.push(val.message) that.errors.push(val.message)
that.$message({ that.showNotify({ time: currentTime, message: val.message, ...val })
message: val.message,
type: val.type,
onClose() {
that.errors.splice(that.errors.indexOf(val.message), 1)
}
})
} }
} }
if (val.notify) { if (val.notify) {
if (that.errors.indexOf(val.notify) === -1) { if (that.errors.indexOf(val.notify) === -1) {
that.errors.push(val.notify) that.errors.push(val.notify)
that.$notify({ that.showNotify({ time: currentTime, message: val.notify, ...val })
title: '温馨提示:' + currentTime,
message: val.notify,
type: val.type,
duration: 0,
onClose() {
that.errors.splice(that.errors.indexOf(val.notify), 1)
}
})
} }
} }
if (val.confirm) { if (val.confirm) {
if (that.errors.indexOf(val.confirm) === -1) { if (that.errors.indexOf(val.confirm) === -1) {
that.errors.push(val.confirm) that.errors.push(val.confirm)
that.$notify({ that.showNotify({ time: currentTime, message: val.confirm, ...val })
title: '温馨提示:' + currentTime,
duration: 0,
showClose: false,
dangerouslyUseHTMLString: true,
message: `<div class="notify_text">${val.confirm}</div><div class="notify_btns"><div class="notify_btn notify_btn2" id="notifyAgain" data-type="continue_task">重试</div></div>`,
onClick(event) {
if (val.req && val.req === 'continue_task') {
// 下一个任务
that.$store.dispatch('chat/websocketsend', {
req_name: 'continue_task',
req_type: 1,
req_info: {}
}).then(() => {
}).catch(() => {
})
}
this.close()
},
onClose() {
that.errors.splice(that.errors.indexOf(val.confirm), 1)
}
});
} }
} }
}, },
@@ -86,7 +52,76 @@ export default {
immediate: true immediate: true
} }
}, },
methods: {} methods: {
showNotify(data) {
let that = this
let notifyInstance
function renderNotifyContent() {
let btns = [
that.$createElement(
'el-button',
{
props: { size: 'mini' },
on: {
click: () => {
notifyInstance.close()
}
}
},
'跳过'
),
that.$createElement(
'el-button',
{
props: { type: 'primary', size: 'mini' },
style: { marginLeft: '10px' },
on: {
click: () => {
that.errors.splice(that.errors.indexOf(data.message), 1)
notifyInstance.close()
}
}
},
'确定'
)
]
if (data.confirm) {
btns[1] = that.$createElement(
'el-button',
{
props: { type: 'primary', size: 'mini' },
style: { marginLeft: '10px' },
on: {
click: () => {
// 下一个任务
that.$store
.dispatch('chat/websocketsend', {
req_name: 'continue_task',
req_type: 1,
req_info: {}
})
.then(() => {})
.catch(() => {})
that.errors.splice(that.errors.indexOf(data.message), 1)
notifyInstance.close()
}
}
},
'重试'
)
}
return that.$createElement('div', [that.$createElement('p', { style: 'margin-top: 8px; line-height: 24px' }, data.message), that.$createElement('div', { style: 'margin-top: 8px; text-align: right' }, btns)])
}
// 创建通知实例
notifyInstance = that.$notify({
title: '温馨提示:' + data.time,
message: renderNotifyContent(), // 初始化时直接生成内容
duration: 0,
type: data.type,
showClose: false,
})
}
}
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -96,7 +131,7 @@ export default {
} }
.el-notification__content { .el-notification__content {
margin: 0; margin: 0;
line-height: 24PX; line-height: 24px;
} }
.notify_btns { .notify_btns {
display: flex; display: flex;
@@ -117,7 +152,7 @@ export default {
border: 1px solid #ccc; border: 1px solid #ccc;
} }
.notify_btn2 { .notify_btn2 {
background-color: #409EFF; background-color: #409eff;
color: #fff; color: #fff;
} }
} }
+5 -5
View File
@@ -206,10 +206,10 @@ const defaultData = {
system_ip: '', //主机IP system_ip: '', //主机IP
system_name: '', //主机名称 system_name: '', //主机名称
is_set_cddev: 0, is_set_cddev: 0,
// 左右盘仓 // 左右光盘桶
strong_list: [ strong_list: [
{ {
strong_pos: 1, // 1:右盘仓2:左盘仓 strong_pos: 1, // 1:右光盘桶2:左光盘桶
cd_type: 1, //CD类型:CD1DVD2 DVD_DL:3BD4,BD_DL:5,BD_TL:6,BD_QL:7 cd_type: 1, //CD类型:CD1DVD2 DVD_DL:3BD4,BD_DL:5,BD_TL:6,BD_QL:7
cd_num: 0 cd_num: 0
}, },
@@ -360,7 +360,7 @@ const actions = {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设备门盖被打开,请关闭门盖。' } }) commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设备门盖被打开,请关闭门盖。' } })
} }
if (info.calibration_flag) { if (info.calibration_flag) {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: '请校准设备。' } }) commit('setData', { name: 'printer_error', data: { type: 'error', notify: '请校准打印机。' } })
} }
commit('setData', { name: 'printer_info', data: info }) commit('setData', { name: 'printer_info', data: info })
// 驱动信息 // 驱动信息
@@ -488,7 +488,7 @@ const actions = {
if (data.resp_info.res_code === 0) { if (data.resp_info.res_code === 0) {
} else { } else {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设置盘仓失败' } }) commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设置光盘桶失败' } })
} }
} else if (data.resp_name === 'setCDDeviceRes') { } else if (data.resp_name === 'setCDDeviceRes') {
if (data.resp_info.res_code === 0) { if (data.resp_info.res_code === 0) {
@@ -506,7 +506,7 @@ const actions = {
if (data.resp_info.res_code === 0) { if (data.resp_info.res_code === 0) {
} else { } else {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: '校准盘仓失败' } }) commit('setData', { name: 'printer_error', data: { type: 'error', notify: '校准光盘桶失败' } })
} }
} else if (data.resp_name === 'CaliPrinterRes') { } else if (data.resp_name === 'CaliPrinterRes') {
if (data.resp_info.res_code === 0) { if (data.resp_info.res_code === 0) {
+28 -54
View File
@@ -36,7 +36,7 @@
<div class="top_left_line"></div> <div class="top_left_line"></div>
</div> </div>
<div class="flex_box"> <div class="flex_box">
<div v-if="printer_info.test_use" class="top_tip">试用版 {{printer_info.test_use}}请及时续费</div> <div v-if="printer_info.test_use" class="top_tip">试用版 {{printer_info.test_use}}</div>
<user-info></user-info> <user-info></user-info>
</div> </div>
</div> </div>
@@ -53,12 +53,6 @@
<div class="device_info_main" :class="{ device_info_main1: infoStatus === 1 }"> <div class="device_info_main" :class="{ device_info_main1: infoStatus === 1 }">
<div class="device_info_item"> <div class="device_info_item">
<div class="device_info_title">光盘刻录一体机{{ printer_info.printer_name }}</div> <div class="device_info_title">光盘刻录一体机{{ printer_info.printer_name }}</div>
<div class="device_info_sure">
<div v-if="currentRunVal === 6" class="flex_box flex_row_between device_info_sure_box">
<div class="device_info_sure_text">{{ sureText }}</div>
<el-button @click="sureCD" class="device_info_sure_btn" type="primary">确定</el-button>
</div>
</div>
<div class="flex_box flex_row_between device_info_options"> <div class="flex_box flex_row_between device_info_options">
<div v-if="printer_info.strongList[2]" class="device_info_option"> <div v-if="printer_info.strongList[2]" class="device_info_option">
<div class="device_info_option_box"> <div class="device_info_option_box">
@@ -66,7 +60,7 @@
<div class="device_info_option_cap"> <div class="device_info_option_cap">
<div <div
class="device_info_option_cap_box" class="device_info_option_cap_box"
:class="{ device_info_option_cap_box1: printer_info.strongList[2].cd_num < 30, device_info_option_cap_box2: printer_info.strongList[2].cd_num < 10 }" :class="{ device_info_option_cap_box1: printer_info.strongList[2].cd_num < deviceImg[printer_info.printer_name || '4200'].num2, device_info_option_cap_box2: printer_info.strongList[2].cd_num < deviceImg[printer_info.printer_name || '4200'].num1 }"
:style="{ height: $accDiv(printer_info.strongList[2].cd_num, 50) * 100 + '%' }" :style="{ height: $accDiv(printer_info.strongList[2].cd_num, 50) * 100 + '%' }"
></div> ></div>
</div> </div>
@@ -94,7 +88,7 @@
<div class="device_info_option_cap"> <div class="device_info_option_cap">
<div <div
class="device_info_option_cap_box" class="device_info_option_cap_box"
:class="{ device_info_option_cap_box1: printer_info.strongList[1].cd_num < 30, device_info_option_cap_box2: printer_info.strongList[1].cd_num < 10 }" :class="{ device_info_option_cap_box1: printer_info.strongList[1].cd_num < deviceImg[printer_info.printer_name || '4200'].num2, device_info_option_cap_box2: printer_info.strongList[1].cd_num < deviceImg[printer_info.printer_name || '4200'].num1 }"
:style="{ height: $accDiv(printer_info.strongList[1].cd_num, 50) * 100 + '%' }" :style="{ height: $accDiv(printer_info.strongList[1].cd_num, 50) * 100 + '%' }"
></div> ></div>
</div> </div>
@@ -140,6 +134,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="device_info_sure">
<div v-if="currentRunVal === 6" class="flex_box flex_row_between device_info_sure_box">
<div class="device_info_sure_text">{{ sureText }}</div>
<el-button @click="sureCD" class="device_info_sure_btn" type="primary">确定</el-button>
</div>
</div>
</div> </div>
<div class="device_info_item"> <div class="device_info_item">
<div class="device_info_text">系统序列号</div> <div class="device_info_text">系统序列号</div>
@@ -339,11 +339,15 @@ export default {
deviceImg: { deviceImg: {
4200: { 4200: {
img1: require('@/assets/images/4200.png'), img1: require('@/assets/images/4200.png'),
img2: require('@/assets/images/4200-open.png') img2: require('@/assets/images/4200-open.png'),
num1: 5,
num2: 10
}, },
SE3: { SE3: {
img1: require('@/assets/images/SE3.png'), img1: require('@/assets/images/SE3.png'),
img2: require('@/assets/images/SE3-open.png') img2: require('@/assets/images/SE3-open.png'),
num1: 3,
num2: 6
} }
}, },
// 服务状态 // 服务状态
@@ -356,7 +360,7 @@ export default {
// 运行选项 // 运行选项
runVal: '', runVal: '',
currentRunVal: '', currentRunVal: '',
sureText: '请设置左右盘仓类型并按确定键', sureText: '请设置左右光盘桶类型并按确定键',
sureTime: 0, sureTime: 0,
runList: [ runList: [
{ {
@@ -373,7 +377,7 @@ export default {
}, },
{ {
value: 6, value: 6,
label: '设置盘仓' label: '设置光盘桶'
}, },
{ {
value: 7, value: 7,
@@ -495,14 +499,6 @@ export default {
{ {
value: 2, value: 2,
label: '清除错误' label: '清除错误'
},
{
value: 5,
label: '自动匹配光驱'
},
{
value: 7,
label: '进入运输模式'
} }
] ]
} else { } else {
@@ -515,33 +511,16 @@ export default {
value: 2, value: 2,
label: '清除错误' label: '清除错误'
}, },
{
value: 5,
label: '自动匹配光驱'
},
{ {
value: 6, value: 6,
label: '设置盘仓' label: '设置光盘桶'
},
{
value: 7,
label: '进入运输模式'
} }
] ]
} }
if (this.printer_info.is_set_cddev == 1) { if (this.printer_info.is_set_cddev == 1) {
if (this.is_set_cddev) return if (this.is_set_cddev) return
this.is_set_cddev = true this.is_set_cddev = true
this.$confirm('上下光驱未设置,请前往设置', '温馨提示', { this.goSet('/manage?type=cddev')
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.is_set_cddev = false
this.goSet('/manage')
}).catch(() => {
this.is_set_cddev = false
});
} }
}, },
deep: true, deep: true,
@@ -789,9 +768,9 @@ export default {
}) })
break break
case 3: case 3:
// 校准盘仓 // 校准光盘桶
that that
.$confirm('确定执行校准盘仓操作吗?', '温馨提示', { .$confirm('确定执行校准光盘桶操作吗?', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@@ -897,7 +876,7 @@ export default {
sureCD() { sureCD() {
// if (that.changeCD.req_info.strong_list[0]&&that.changeCD.req_info.strong_list[1]&&that.changeCD.req_info.strong_list[0].strong_type == that.changeCD.req_info.strong_list[1].strong_type) { // if (that.changeCD.req_info.strong_list[0]&&that.changeCD.req_info.strong_list[1]&&that.changeCD.req_info.strong_list[0].strong_type == that.changeCD.req_info.strong_list[1].strong_type) {
// that.$message({ // that.$message({
// message: '盘仓类型不能相同', // message: '光盘桶类型不能相同',
// type: 'warning' // type: 'warning'
// }) // })
// return // return
@@ -965,17 +944,14 @@ export default {
return return
} }
if (that.printer_info.is_set_cddev == 1) { if (that.printer_info.is_set_cddev == 1) {
if (that.is_set_cddev) return
that.is_set_cddev = true
that.$confirm('上下光驱未设置,请前往设置', '温馨提示', { that.$confirm('上下光驱未设置,请前往设置', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
that.is_set_cddev = false that.goSet('/manage?type=cddev')
that.goSet('/manage')
}).catch(() => { }).catch(() => {
that.is_set_cddev = false
}); });
return return
} }
@@ -995,17 +971,14 @@ export default {
return return
} }
if (that.printer_info.is_set_cddev == 1) { if (that.printer_info.is_set_cddev == 1) {
if (that.is_set_cddev) return
that.is_set_cddev = true
that.$confirm('上下光驱未设置,请前往设置', '温馨提示', { that.$confirm('上下光驱未设置,请前往设置', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
that.is_set_cddev = false that.goSet('/manage?type=cddev')
that.goSet('/manage')
}).catch(() => { }).catch(() => {
that.is_set_cddev = false
}); });
return return
} }
@@ -1240,9 +1213,10 @@ $red: #ff0000;
font-size: 25px; font-size: 25px;
color: #000000; color: #000000;
line-height: 38px; line-height: 38px;
padding-bottom: 10px;
} }
.device_info_sure { .device_info_sure {
height: 42px; padding: 10px 0 0;
.device_info_sure_box { .device_info_sure_box {
width: 100%; width: 100%;
height: 100%; height: 100%;
+36 -37
View File
@@ -13,7 +13,7 @@
</div> </div>
<div class="form_content"> <div class="form_content">
<div class="flex_box form_option"> <div class="flex_box form_option">
<div class="form_label">设置设备</div> <div class="form_label">设置光驱</div>
<div class="form_val"> <div class="form_val">
<div class="flex_box flex_wrap form_tabs"> <div class="flex_box flex_wrap form_tabs">
<div @click="handleAction(item)" v-for="(item, index) in actionList" :key="index" class="form_tab">{{ item.name }}</div> <div @click="handleAction(item)" v-for="(item, index) in actionList" :key="index" class="form_tab">{{ item.name }}</div>
@@ -153,10 +153,6 @@ export default {
{ {
id: 4, id: 4,
name: '校准光盘桶' name: '校准光盘桶'
},
{
id: 5,
name: '刷新光盘'
} }
], ],
actionList: [ actionList: [
@@ -170,6 +166,10 @@ export default {
} }
], ],
serviceList: [ serviceList: [
{
id: 4,
name: '刷新光盘桶'
},
{ {
id: 1, id: 1,
name: '重启设备' name: '重启设备'
@@ -257,10 +257,6 @@ export default {
{ {
id: 4, id: 4,
name: '校准光盘桶' name: '校准光盘桶'
},
{
id: 5,
name: '刷新光盘'
} }
] ]
} else { } else {
@@ -280,10 +276,6 @@ export default {
{ {
id: 4, id: 4,
name: '校准光盘桶' name: '校准光盘桶'
},
{
id: 5,
name: '刷新光盘'
} }
] ]
} }
@@ -292,6 +284,12 @@ export default {
immediate: true immediate: true
}, },
}, },
mounted() {
let type = this.$route.query.type
if (type && type === 'cddev') {
this.handleAction(this.actionList[0])
}
},
methods: { methods: {
// 校准设备 // 校准设备
handleMove(e) { handleMove(e) {
@@ -395,29 +393,6 @@ export default {
}) })
}) })
break break
case 5:
// 刷新光盘
that
.$confirm('点击确定后将刷新所有光盘桶的光盘数量。', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'RefreshCdNum',
req_type: 2,
req_info: {}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
})
break
} }
}, },
// 设置设备 // 设置设备
@@ -425,6 +400,7 @@ export default {
let that = this let that = this
switch (e.id) { switch (e.id) {
case 1: case 1:
console.log('手动设置光驱')
// 手动设置光驱 // 手动设置光驱
that.$store that.$store
.dispatch('chat/websocketsend', { .dispatch('chat/websocketsend', {
@@ -439,7 +415,7 @@ export default {
case 2: case 2:
// 自动设置光驱 // 自动设置光驱
that that
.$confirm('请再左右盘仓至少放入一张光盘,点击确认后将自动设置上下光驱,如果自动设置失败请手动设置光驱', '温馨提示', { .$confirm('请再左右光盘桶至少放入一张光盘,点击确认后将自动设置上下光驱,如果自动设置失败请手动设置光驱', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@@ -534,6 +510,29 @@ export default {
}) })
}) })
break break
case 4:
// 刷新光盘桶
that
.$confirm('点击确定后将刷新所有光盘桶的光盘数量。', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'RefreshCdNum',
req_type: 2,
req_info: {}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
})
break
} }
}, },
cdChange(index, e) { cdChange(index, e) {