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