优化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
+81 -46
View File
@@ -19,66 +19,32 @@ export default {
if (that.$store.getters.token) {
that.$store.dispatch('chat/initWebSocket') // 初始化websocket
}
this.showNotify()
this.showNotify()
this.showNotify()
this.showNotify()
},
watch: {
'$store.state.chat.printer_error': {
handler(val) {
let that = this
const currentTime = dayjs().format('HH:mm:ss');
const currentTime = dayjs().format('HH:mm:ss')
if (val.message) {
if (that.errors.indexOf(val.message) === -1) {
that.errors.push(val.message)
that.$message({
message: val.message,
type: val.type,
onClose() {
that.errors.splice(that.errors.indexOf(val.message), 1)
}
})
that.showNotify({ time: currentTime, message: val.message, ...val })
}
}
if (val.notify) {
if (that.errors.indexOf(val.notify) === -1) {
that.errors.push(val.notify)
that.$notify({
title: '温馨提示:' + currentTime,
message: val.notify,
type: val.type,
duration: 0,
onClose() {
that.errors.splice(that.errors.indexOf(val.notify), 1)
}
})
that.showNotify({ time: currentTime, message: val.notify, ...val })
}
}
if (val.confirm) {
if (that.errors.indexOf(val.confirm) === -1) {
that.errors.push(val.confirm)
that.$notify({
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)
}
});
that.showNotify({ time: currentTime, message: val.confirm, ...val })
}
}
},
@@ -86,7 +52,76 @@ export default {
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>
<style lang="scss">
@@ -96,9 +131,9 @@ export default {
}
.el-notification__content {
margin: 0;
line-height: 24PX;
line-height: 24px;
}
.notify_btns{
.notify_btns {
display: flex;
align-items: center;
justify-content: end;
@@ -117,7 +152,7 @@ export default {
border: 1px solid #ccc;
}
.notify_btn2 {
background-color: #409EFF;
background-color: #409eff;
color: #fff;
}
}
+5 -5
View File
@@ -206,10 +206,10 @@ const defaultData = {
system_ip: '', //主机IP
system_name: '', //主机名称
is_set_cddev: 0,
// 左右盘仓
// 左右光盘桶
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_num: 0
},
@@ -360,7 +360,7 @@ const actions = {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设备门盖被打开,请关闭门盖。' } })
}
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 })
// 驱动信息
@@ -488,7 +488,7 @@ const actions = {
if (data.resp_info.res_code === 0) {
} 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') {
if (data.resp_info.res_code === 0) {
@@ -506,7 +506,7 @@ const actions = {
if (data.resp_info.res_code === 0) {
} 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') {
if (data.resp_info.res_code === 0) {
+28 -54
View File
@@ -36,7 +36,7 @@
<div class="top_left_line"></div>
</div>
<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>
</div>
</div>
@@ -53,12 +53,6 @@
<div class="device_info_main" :class="{ device_info_main1: infoStatus === 1 }">
<div class="device_info_item">
<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 v-if="printer_info.strongList[2]" class="device_info_option">
<div class="device_info_option_box">
@@ -66,7 +60,7 @@
<div class="device_info_option_cap">
<div
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 + '%' }"
></div>
</div>
@@ -94,7 +88,7 @@
<div class="device_info_option_cap">
<div
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 + '%' }"
></div>
</div>
@@ -140,6 +134,12 @@
</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 class="device_info_item">
<div class="device_info_text">系统序列号</div>
@@ -339,11 +339,15 @@ export default {
deviceImg: {
4200: {
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: {
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: '',
currentRunVal: '',
sureText: '请设置左右盘仓类型并按确定键',
sureText: '请设置左右光盘桶类型并按确定键',
sureTime: 0,
runList: [
{
@@ -373,7 +377,7 @@ export default {
},
{
value: 6,
label: '设置盘仓'
label: '设置光盘桶'
},
{
value: 7,
@@ -495,14 +499,6 @@ export default {
{
value: 2,
label: '清除错误'
},
{
value: 5,
label: '自动匹配光驱'
},
{
value: 7,
label: '进入运输模式'
}
]
} else {
@@ -515,33 +511,16 @@ export default {
value: 2,
label: '清除错误'
},
{
value: 5,
label: '自动匹配光驱'
},
{
value: 6,
label: '设置盘仓'
},
{
value: 7,
label: '进入运输模式'
label: '设置光盘桶'
}
]
}
if (this.printer_info.is_set_cddev == 1) {
if (this.is_set_cddev) return
this.is_set_cddev = true
this.$confirm('上下光驱未设置,请前往设置', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.is_set_cddev = false
this.goSet('/manage')
}).catch(() => {
this.is_set_cddev = false
});
this.goSet('/manage?type=cddev')
}
},
deep: true,
@@ -789,9 +768,9 @@ export default {
})
break
case 3:
// 校准盘仓
// 校准光盘桶
that
.$confirm('确定执行校准盘仓操作吗?', '温馨提示', {
.$confirm('确定执行校准光盘桶操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@@ -897,7 +876,7 @@ export default {
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) {
// that.$message({
// message: '盘仓类型不能相同',
// message: '光盘桶类型不能相同',
// type: 'warning'
// })
// return
@@ -965,17 +944,14 @@ export default {
return
}
if (that.printer_info.is_set_cddev == 1) {
if (that.is_set_cddev) return
that.is_set_cddev = true
that.$confirm('上下光驱未设置,请前往设置', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.is_set_cddev = false
that.goSet('/manage')
that.goSet('/manage?type=cddev')
}).catch(() => {
that.is_set_cddev = false
});
return
}
@@ -995,17 +971,14 @@ export default {
return
}
if (that.printer_info.is_set_cddev == 1) {
if (that.is_set_cddev) return
that.is_set_cddev = true
that.$confirm('上下光驱未设置,请前往设置', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.is_set_cddev = false
that.goSet('/manage')
that.goSet('/manage?type=cddev')
}).catch(() => {
that.is_set_cddev = false
});
return
}
@@ -1240,9 +1213,10 @@ $red: #ff0000;
font-size: 25px;
color: #000000;
line-height: 38px;
padding-bottom: 10px;
}
.device_info_sure {
height: 42px;
padding: 10px 0 0;
.device_info_sure_box {
width: 100%;
height: 100%;
+36 -37
View File
@@ -13,7 +13,7 @@
</div>
<div class="form_content">
<div class="flex_box form_option">
<div class="form_label">设置设备</div>
<div class="form_label">设置光驱</div>
<div class="form_val">
<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>
@@ -153,10 +153,6 @@ export default {
{
id: 4,
name: '校准光盘桶'
},
{
id: 5,
name: '刷新光盘'
}
],
actionList: [
@@ -170,6 +166,10 @@ export default {
}
],
serviceList: [
{
id: 4,
name: '刷新光盘桶'
},
{
id: 1,
name: '重启设备'
@@ -257,10 +257,6 @@ export default {
{
id: 4,
name: '校准光盘桶'
},
{
id: 5,
name: '刷新光盘'
}
]
} else {
@@ -280,10 +276,6 @@ export default {
{
id: 4,
name: '校准光盘桶'
},
{
id: 5,
name: '刷新光盘'
}
]
}
@@ -292,6 +284,12 @@ export default {
immediate: true
},
},
mounted() {
let type = this.$route.query.type
if (type && type === 'cddev') {
this.handleAction(this.actionList[0])
}
},
methods: {
// 校准设备
handleMove(e) {
@@ -395,29 +393,6 @@ export default {
})
})
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
switch (e.id) {
case 1:
console.log('手动设置光驱')
// 手动设置光驱
that.$store
.dispatch('chat/websocketsend', {
@@ -439,7 +415,7 @@ export default {
case 2:
// 自动设置光驱
that
.$confirm('请再左右盘仓至少放入一张光盘,点击确认后将自动设置上下光驱,如果自动设置失败请手动设置光驱', '温馨提示', {
.$confirm('请再左右光盘桶至少放入一张光盘,点击确认后将自动设置上下光驱,如果自动设置失败请手动设置光驱', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
@@ -534,6 +510,29 @@ export default {
})
})
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) {