优化与对接接口

This commit is contained in:
24kycj
2024-12-05 15:25:51 +08:00
parent d8f155e940
commit e19de21de5
7 changed files with 590 additions and 185 deletions
+322 -34
View File
@@ -13,21 +13,21 @@
</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 v-for="(item, index) in moveList" :key="index" class="form_tab">{{ item.name }}</div>
<div @click="handleMove(item)" v-for="(item, index) in moveList" :key="index" class="form_tab">{{ item.name }}</div>
</div>
</div>
</div>
<div class="flex_box form_option">
<!-- <div class="flex_box form_option">
<div class="form_label">维护工作站</div>
<div class="form_val">
<div class="flex_box flex_wrap form_tabs">
<div v-for="(item, index) in actionList" :key="index" class="form_tab">{{ item.name }}</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
<div class="form_item">
@@ -66,7 +66,7 @@
</div>
</div>
</div>
<div class="form_item">
<!-- <div class="form_item">
<div class="flex_box form_title">
<div class="flex_box flex_col">
<div class="form_title_text">语言</div>
@@ -90,14 +90,38 @@
</div>
</div>
</div>
</div>
</div> -->
</div>
<!-- 手动校准驱动 -->
<el-dialog center title="手动校准驱动" :visible.sync="cdShow" width="1000px">
<div class="cd_box" v-loading="cdList.length === 0">
<div class="cd_title">请通过点击按钮弹出光驱托盘判断并设置光驱</div>
<div class="cd_desc">需对光驱进行手动设置</div>
<div class="cd_desc">使用下拉方框来指定设备中的哪个光驱是上光驱哪个是下光驱</div>
<div class="cd_list">
<div class="flex_box flex_row_between cd_item" v-for="(item, index) in cdList" :key="index">
<div class="cd_name">{{ item.dev_name }}</div>
<div class="flex_box cd_r">
<el-select v-model="item.cdType" @change="cdChange(index, item.cdType)">
<el-option v-for="type in cdOptions" :key="type.value" :label="type.label" :value="type.value"> </el-option>
</el-select>
<el-button @click="cdOpen(index)" type="success">打开</el-button>
<el-button @click="cdClose(index)" type="danger">关闭</el-button>
</div>
</div>
</div>
<div class="flex_box flex_row_center cd_footer">
<el-button @click="cdCancel" class="cd_footer_btn1">取消</el-button>
<el-button @click="cdSubmit" class="cd_footer_btn2" type="primary">确定</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import TabBar from '@/components/tabBar/tabBar.vue';
import TabBar from '@/components/tabBar/tabBar.vue'
export default {
name: 'manage',
@@ -107,27 +131,19 @@ export default {
moveList: [
{
id: 1,
name: '读卡器'
name: '校准设备'
},
{
id: 2,
name: '废卡盒'
name: '校准上光驱'
},
{
id: 3,
name: '出卡口'
name: '校准下光驱'
},
{
id: 4,
name: '等待'
},
{
id: 5,
name: '待取口'
},
{
id: 6,
name: '后出卡口'
name: '手动校准驱动'
}
],
actionList: [
@@ -169,6 +185,22 @@ export default {
label: '繁体中文',
value: 'zhYW'
}
],
cdList: [],
cdShow: false,
cdOptions: [
{
value: 1,
label: '不在设备中'
},
{
value: 2,
label: '上光驱'
},
{
value: 3,
label: '下光驱'
}
]
}
},
@@ -177,14 +209,189 @@ export default {
},
watch: {
'$store.state.chat.refreshTime': {
handler (val) {
handler(val) {
this.refreshTime = val
},
immediate: true,
deep: true
},
'$store.state.chat.cdList': {
handler(val) {
this.cdList = val.map((item) => {
item.cdType = 1
return item
})
},
deep: true,
immediate: true
}
},
methods: {
// 校准设备
handleMove(e) {
switch (e.id) {
case 1:
// 校准设备
that.$store
.dispatch('chat/websocketsend', {
req_name: 'CaliPrinter',
req_type: 2,
req_info: {
cali_num: '02'
}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
break
case 2:
// 校准上光驱
that.$store
.dispatch('chat/websocketsend', {
req_name: 'CaliPrinter',
req_type: 2,
req_info: {
cali_num: '00'
}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
break
case 3:
// 校准下光驱
that.$store
.dispatch('chat/websocketsend', {
req_name: 'CaliPrinter',
req_type: 2,
req_info: {
cali_num: '01'
}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
break
case 4:
this.$store
.dispatch('chat/websocketsend', {
req_name: 'get_all_cd',
req_type: 2,
req_info: {}
})
.then(() => {
this.cdShow = true
})
break
}
},
cdChange(index, e) {
let item = this.cdList[index]
item.cdType = e
this.$set(this.cdList, index, { ...item })
},
cdOpen(e) {
let item = this.cdList[e]
this.$store
.dispatch('chat/websocketsend', {
req_name: 'openCDDevByPath',
req_type: 2,
req_info: {
dev_path: item.dev_path
}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
},
cdClose(e) {
let item = this.cdList[e]
this.$store
.dispatch('chat/websocketsend', {
req_name: 'closeCDDevByPath',
req_type: 2,
req_info: {
dev_path: item.dev_path
}
})
.then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
},
cdCancel() {
this.cdShow = false
},
cdSubmit() {
let top = this.cdList.filter((item) => item.cdType === 2)
let bottom = this.cdList.filter((item) => item.cdType === 3)
if (!top || top.length === 0) {
this.$message({
message: '请设置上光驱',
type: 'error'
})
return
}
if (!bottom || bottom.length === 0) {
this.$message({
message: '请设置下光驱',
type: 'error'
})
return
}
if (top.length > 1) {
this.$message({
message: '上光驱只能设置一个',
type: 'error'
})
return
}
if (bottom.length > 1) {
this.$message({
message: '下光驱只能设置一个',
type: 'error'
})
return
}
this.$store
.dispatch('chat/websocketsend', {
req_name: 'setCDDevice',
req_type: 2,
req_info: {
device_list: [
{
device_path: top[0].dev_path,
device_pos: 2
},
{
device_path: bottom[0].dev_path,
device_pos: 1
}
]
}
})
.then(() => {
this.$message({
message: '提交成功',
type: 'success'
})
this.cdShow = false
})
},
// 刷新时间
handleRefresh() {
this.$store.commit('chat/setData', {
@@ -207,7 +414,7 @@ export default {
.form_item {
padding: 10px 0;
.form_title {
border-bottom: 2px solid #E1F5E5;
border-bottom: 2px solid #e1f5e5;
.form_title_text {
font-weight: 500;
font-size: 25px;
@@ -217,7 +424,7 @@ export default {
.form_title_line {
width: 100%;
height: 6px;
background: #98E8A6;
background: #98e8a6;
border-radius: 4px;
}
}
@@ -239,23 +446,23 @@ export default {
width: 250px;
height: 42px;
cursor: pointer;
background: rgba(0,195,37,0.12);
background: rgba(0, 195, 37, 0.12);
border-radius: 4px;
border: 1px solid rgba(0,195,37,0.32);
border: 1px solid rgba(0, 195, 37, 0.32);
line-height: 40px;
text-align: center;
font-weight: 500;
font-size: 19px;
color: #00C325;
color: #00c325;
margin: 6px;
}
}
.form_input {
width: 500px;
height: 42px;
background: #FFFFFF;
background: #ffffff;
border-radius: 4px;
border: 1px solid #98E8A6;
border: 1px solid #98e8a6;
overflow: hidden;
::v-deep {
.el-input-group__append {
@@ -284,7 +491,7 @@ export default {
height: 40px;
border: none;
padding: 0;
background: #00C325;
background: #00c325;
border-radius: 0px 4px 4px 0px;
}
}
@@ -300,8 +507,8 @@ export default {
height: 24px;
}
.el-checkbox__input.is-checked .el-checkbox__inner {
background-color: #00C325;
border-color: #00C325;
background-color: #00c325;
border-color: #00c325;
}
.el-checkbox__inner::after {
width: 6px;
@@ -312,16 +519,16 @@ export default {
font-size: 19px;
line-height: 24px;
}
.el-checkbox__input.is-checked+.el-checkbox__label {
color: #00C325;
.el-checkbox__input.is-checked + .el-checkbox__label {
color: #00c325;
}
}
.form_select {
width: 500px;
height: 42px;
background: #FFFFFF;
background: #ffffff;
border-radius: 4px;
border: 1px solid #98E8A6;
border: 1px solid #98e8a6;
.el-select {
width: 100%;
padding-left: 10px;
@@ -350,4 +557,85 @@ export default {
}
}
}
.cd_box {
.el-input {
height: 40px;
line-height: 40px;
}
::v-deep {
.el-input__inner {
width: 240px;
height: 40px;
line-height: 40px;
font-size: 16px;
color: #000;
font-weight: 500;
}
.el-input__icon {
font-size: 16px;
height: 40px;
line-height: 40px;
font-weight: bold;
color: #000;
}
}
.cd_title {
font-size: 16px;
font-weight: 500;
color: #000;
line-height: 28px;
}
.cd_desc {
font-size: 13px;
font-weight: 500;
color: #666;
line-height: 24px;
}
.cd_list {
padding: 32px 0;
.cd_item {
padding: 12px 0;
}
.el-button {
margin: 0;
padding: 0;
width: 80px;
height: 40px;
font-size: 15px;
}
.cd_name {
font-size: 14px;
color: #000;
line-height: 24px;
}
.cd_r {
gap: 24px;
}
}
.cd_footer {
gap: 24px;
.cd_footer_btn1 {
width: 120px;
height: 40px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #000000;
font-weight: 500;
font-size: 16px;
color: #000000;
padding: 0;
margin: 0 12px;
}
.cd_footer_btn2 {
width: 120px;
height: 40px;
background: #00c325;
border-radius: 4px;
font-weight: 500;
font-size: 16px;
padding: 0;
margin: 0 12px;
}
}
}
</style>