重构
This commit is contained in:
@ -110,6 +110,11 @@
|
||||
sortable="custom"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="selectable" label="操作" width="90" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="selectPoint(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-show="tableData.length > 0"
|
||||
@ -147,6 +152,7 @@ export default {
|
||||
this.pageNum = 1;
|
||||
this.totalSize = 0;
|
||||
this.dataType = '';
|
||||
this.selectable = false;
|
||||
this.form = {
|
||||
sortMethod: "desc", //升序不传或者asc、降序desc)
|
||||
sortData: this.defaultSort.prop,
|
||||
@ -191,9 +197,14 @@ export default {
|
||||
pageSize: 10, //分页栏当前每个数据总数
|
||||
pageNum: 1, //分页栏当前页数
|
||||
totalSize: 0, //table表格数据总数
|
||||
selectable: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
selectPoint(row) {
|
||||
this.$emit('select-point', row || {})
|
||||
this.show = false
|
||||
},
|
||||
showChart({pointName}) {
|
||||
if (pointName) {
|
||||
const {deviceCategory, deviceId} = this;
|
||||
@ -235,12 +246,13 @@ export default {
|
||||
this.getData()
|
||||
});
|
||||
},
|
||||
showTable({deviceCategory, siteId, deviceId, parentId = ""}, dataType) {
|
||||
showTable({deviceCategory, siteId, deviceId, parentId = ""}, dataType, options = {}) {
|
||||
this.dataType = dataType;
|
||||
this.deviceCategory = deviceCategory;
|
||||
this.siteId = siteId;
|
||||
this.deviceId = deviceId;
|
||||
this.parentId = deviceCategory === "BATTERY" ? parentId : ""; //只有单体电池需要这个值
|
||||
this.selectable = !!options.selectable
|
||||
this.show = true;
|
||||
this.getData()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user