管理页面设置光盘桶

This commit is contained in:
24kycj
2026-02-05 16:14:59 +08:00
parent b277ef38b3
commit 31c9d64ba9
+125 -1
View File
@@ -134,6 +134,32 @@
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
<!-- 设置光盘桶类型 -->
<el-dialog center title="设置光盘桶类型" :visible.sync="setCDShow" width="600px">
<div class="cd_box">
<div class="cd_title">请选择左右光盘桶所对应的光盘类型</div>
<div class="cd_desc">修改后将影响作业可选择的光盘类型请谨慎操作</div>
<div class="cd_list">
<div class="flex_box flex_row_between cd_item" v-for="(item, index) in changeCD.req_info.strong_list" :key="index">
<div class="cd_name">光盘桶 {{ item.strong_pos }}</div>
<div class="flex_box cd_r">
<el-select v-model="item.strong_type" @change="(val) => handleSetCDChange(index, val)">
<el-option
v-for="(label, key) in CDTypes"
:key="key"
:label="label"
:value="parseInt(key)">
</el-option>
</el-select>
</div>
</div>
</div>
<div class="flex_box flex_row_center cd_footer">
<el-button @click="handleSetCDCancel" class="cd_footer_btn1">取消</el-button>
<el-button @click="handleSetCDSubmit" class="cd_footer_btn2" type="primary">确定</el-button>
</div>
</div>
</el-dialog>
</div> </div>
</template> </template>
@@ -180,6 +206,10 @@ export default {
// } // }
], ],
serviceList: [ serviceList: [
{
id: 7,
name: '设置光盘桶'
},
{ {
id: 4, id: 4,
name: '刷新光盘桶' name: '刷新光盘桶'
@@ -239,7 +269,18 @@ export default {
value: 3, value: 3,
label: '下光驱' label: '下光驱'
} }
] ],
// 设置光盘桶
setCDShow: false,
CDTypes: {},
changeCD: {
req_name: 'setCDStrong',
req_type: 2,
req_info: {
strong_list: []
}
},
default_cd: []
} }
}, },
computed: { computed: {
@@ -352,6 +393,10 @@ export default {
} }
] ]
this.serviceList = [ this.serviceList = [
{
id: 7,
name: '设置光盘桶'
},
{ {
id: 4, id: 4,
name: '刷新光盘桶' name: '刷新光盘桶'
@@ -381,6 +426,13 @@ export default {
}, },
deep: true, deep: true,
immediate: true immediate: true
},
'$store.state.chat.CDTypes': {
handler(val) {
this.CDTypes = { ...val }
},
deep: true,
immediate: true
} }
}, },
mounted() { mounted() {
@@ -746,6 +798,32 @@ export default {
}) })
}) })
break break
case 7:
// 设置光盘桶(手动选择左右光盘桶类型)
// 正在任务中禁止操作(与 dashboard handleRun 中的限制保持一致)
const cdList = that.$store.state.chat.cd_list || []
if ((cdList[0] && cdList[0].copy_scheduler) || (cdList[1] && cdList[1].copy_scheduler)) {
that.$message({
message: '正在任务中,无法进行操作',
type: 'warning'
})
return
}
if (!that.printer_info || !that.printer_info.strong_list || !that.printer_info.strong_list.length) {
that.$message({
message: '当前设备暂无光盘桶信息,无法设置',
type: 'error'
})
return
}
// 初始化默认光盘桶类型
that.changeCD.req_info.strong_list = that.printer_info.strong_list.map((item, index) => ({
strong_pos: index + 1,
strong_type: item.cd_type
}))
that.default_cd = JSON.parse(JSON.stringify(that.changeCD.req_info.strong_list))
that.setCDShow = true
break
} }
}, },
cdChange(index, e) { cdChange(index, e) {
@@ -972,6 +1050,52 @@ export default {
] ]
localStorage.setItem('guideStep', JSON.stringify(guideStep)) localStorage.setItem('guideStep', JSON.stringify(guideStep))
localStorage.setItem('currentStep', 0) localStorage.setItem('currentStep', 0)
},
// 设置光盘桶 - 选择类型
handleSetCDChange(index, val) {
if (!this.changeCD.req_info.strong_list[index]) return
this.changeCD.req_info.strong_list[index].strong_type = val
this.$set(this.changeCD.req_info.strong_list, index, {
...this.changeCD.req_info.strong_list[index]
})
},
// 设置光盘桶 - 取消
handleSetCDCancel() {
this.setCDShow = false
this.changeCD.req_info.strong_list = JSON.parse(JSON.stringify(this.default_cd || []))
},
// 设置光盘桶 - 确认
handleSetCDSubmit() {
let that = this
if (!that.changeCD.req_info.strong_list || !that.changeCD.req_info.strong_list.length) {
that.$message({
message: '请先设置光盘桶类型',
type: 'warning'
})
return
}
that.$store
.dispatch('chat/websocketsend', that.changeCD)
.then(() => {
// 同 dashboard 的行为:根据是否包含 BD 类型更新可选光盘类型
try {
const { getCurrentOSDiscTypes } = require('../../utils/fileSize')
let typeLists = getCurrentOSDiscTypes()
let isBD = that.changeCD.req_info.strong_list.findIndex(item => parseInt(item.strong_type) > 3)
if (isBD === -1) {
typeLists = typeLists.slice(0, 3)
}
that.$store.dispatch('chat/setDatas', { name: 'cd_types', data: typeLists })
} catch (err) {
// 安全兜底:不影响主流程
console.error(err)
}
that.$message({
message: '已发送指令',
type: 'success'
})
that.setCDShow = false
})
} }
} }
} }