代码更新

This commit is contained in:
2022-09-14 15:41:27 +08:00
parent 32d5d992c7
commit 5ce7e84c4c
2 changed files with 94 additions and 6 deletions

View File

@@ -146,7 +146,7 @@
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="mySelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="repair_id" label="设备维修单标识" />
<el-table-column prop="repair_code" label="维修单号" width="120px" show-overflow-tooltip />
@@ -365,6 +365,53 @@ export default {
} else {
this.crud.notify('状态不正确', CRUD.NOTIFICATION_TYPE.INFO)
}
},
mySelectionChange(rows) {
this.buttonChange(rows)
},
// 处理按钮是否显示
buttonChange(rows) {
if (rows.length !== 0) {
this.start_flag = false
this.execu_flag = false
this.end_flag = false
this.open_flag = false
this.confirm_flag = false
this.result_flag = false
for (let i = 0; i < rows.length; i++) {
if ('01,03,04,05,06,07,99'.includes(rows[i].invstatus)) {
this.start_flag = true
}
if ('01,02,06,07,99'.includes(rows[i].invstatus)) {
this.execu_flag = true
}
if ('01,02,04,06,07,99'.includes(rows[i].invstatus)) {
this.end_flag = true
}
if ('01,02,06,07,99'.includes(rows[i].invstatus)) {
this.open_flag = true
}
if ('01,02,03,04,05,07,99'.includes(rows[i].invstatus)) {
this.confirm_flag = true
}
if ('01,02,07,99'.includes(rows[i].invstatus)) {
this.result_flag = true
}
if (rows.length > 1) {
this.handleCurrentChange()
}
}
} else {
this.handleCurrentChange()
}
},
handleCurrentChange() {
this.start_flag = true
this.execu_flag = true
this.end_flag = true
this.open_flag = true
this.confirm_flag = true
this.result_flag = true
}
}
}

View File

@@ -84,7 +84,7 @@
type="success"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
:disabled="start_flag"
@click="startMaintain"
>
开始保养
@@ -95,7 +95,7 @@
type="success"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
:disabled="execu_flag"
@click="executeMaintain"
>
保养执行
@@ -106,7 +106,7 @@
type="success"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
:disabled="end_flag"
@click="endMaintain"
>
结束保养
@@ -117,14 +117,14 @@
type="success"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
:disabled="confirm_flag"
@click="confirmMaintain"
>
保养确认
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="mySelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="maint_id" label="保养单标识" />
<el-table-column prop="maint_code" label="保养单号" width="120px" show-overflow-tooltip />
@@ -190,6 +190,10 @@ export default {
},
data() {
return {
start_flag: true,
execu_flag: true,
end_flag: true,
confirm_flag: true,
classes: [],
class_idStr: null,
materOpt_code: '23',
@@ -298,6 +302,43 @@ export default {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
},
mySelectionChange(rows) {
this.buttonChange(rows)
},
// 处理按钮是否显示
buttonChange(rows) {
if (rows.length !== 0) {
this.start_flag = false
this.execu_flag = false
this.end_flag = false
this.confirm_flag = false
for (let i = 0; i < rows.length; i++) {
if ('01,03,04,05,99'.includes(rows[i].invstatus)) {
this.start_flag = true
}
if ('01,02,04,05,99'.includes(rows[i].invstatus)) {
this.execu_flag = true
}
if ('01,02,04,05,99'.includes(rows[i].invstatus)) {
this.end_flag = true
}
if ('01,02,03,05,99'.includes(rows[i].invstatus)) {
this.confirm_flag = true
}
if (rows.length > 1) {
this.handleCurrentChange()
}
}
} else {
this.handleCurrentChange()
}
},
handleCurrentChange() {
this.start_flag = true
this.execu_flag = true
this.end_flag = true
this.confirm_flag = true
}
}
}