修复托盘登录电池取消激活选择状态
This commit is contained in:
@@ -84,6 +84,7 @@
|
||||
:key="'sel-' + col.idx"
|
||||
type="selection"
|
||||
:width="col.width"
|
||||
:selectable="selectionSelectable || undefined"
|
||||
/>
|
||||
<!-- 2. 序号列 -->
|
||||
<el-table-column
|
||||
@@ -309,6 +310,12 @@ export default {
|
||||
*/
|
||||
tableListeners: { type: Object, default: () => ({}) },
|
||||
|
||||
/**
|
||||
* 选择列可选规则,透传给 el-table-column 的 selectable。
|
||||
* 例:row => row.active === 1
|
||||
*/
|
||||
selectionSelectable: { type: Function, default: null },
|
||||
|
||||
/**
|
||||
* 帮助文档的跳转 URL。传了才显示工具栏右侧的问号按钮,点击新窗口打开
|
||||
* 例:'/docs/factory-area-help.html'
|
||||
@@ -426,6 +433,14 @@ export default {
|
||||
this.$emit('selection-change', val)
|
||||
},
|
||||
|
||||
clearSelection () {
|
||||
if (this.$refs.table && this.$refs.table.clearSelection) {
|
||||
this.$refs.table.clearSelection()
|
||||
}
|
||||
this.tableSelected = []
|
||||
this.$emit('selection-change', [])
|
||||
},
|
||||
|
||||
/* ============ 帮助按钮 ============ */
|
||||
|
||||
openHelp () {
|
||||
|
||||
@@ -102,12 +102,14 @@
|
||||
</el-button>
|
||||
</div>
|
||||
<page-table
|
||||
ref="batteryTable"
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:loading="loadingBattery"
|
||||
:toolbar-buttons="[]"
|
||||
:row-buttons="[]"
|
||||
:pagination="null"
|
||||
:selection-selectable="isActiveBattery"
|
||||
:table-attrs="{ size: 'mini', rowKey: 'index', highlightCurrentRow: true, rowClassName: rowClassName }"
|
||||
height="520px"
|
||||
@selection-change="selectedRows = $event"
|
||||
@@ -648,11 +650,12 @@ export default {
|
||||
cancelButtonText: this.$t(this.key('cancel')),
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const rows = [...this.selectedRows]
|
||||
await sendWorkerman({
|
||||
sendData: {
|
||||
action: 'set_battery_inactivity',
|
||||
param: {
|
||||
data: this.selectedRows.map(row => ({
|
||||
data: rows.map(row => ({
|
||||
battery_id: row.Battery || row.battery_id,
|
||||
class: 'NG',
|
||||
classname: 'web_inactivity'
|
||||
@@ -660,16 +663,22 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
this.selectedRows.forEach(row => {
|
||||
rows.forEach(row => {
|
||||
const target = this.tableData.find(item => item.index === row.index)
|
||||
if (target) this.$set(target, 'active', 0)
|
||||
})
|
||||
this.tableData = [...this.tableData]
|
||||
this.selectedRows = []
|
||||
if (this.$refs.batteryTable) this.$refs.batteryTable.clearSelection()
|
||||
this.$message.success(this.$t(this.key('batch_battery_deactivate_success')))
|
||||
}).catch(() => {})
|
||||
},
|
||||
rowClassName ({ row }) {
|
||||
return Number(row.active) === 1 ? 'is-active-battery' : ''
|
||||
},
|
||||
isActiveBattery (row) {
|
||||
return Number(row.active) === 1
|
||||
},
|
||||
resetPage () {
|
||||
this.form.tray = ''
|
||||
this.batteryInputs = {}
|
||||
|
||||
Reference in New Issue
Block a user