|
|
@@ -13,80 +13,82 @@
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
<el-col :span="20" :xs="24"> -->
|
|
|
- <el-card shadow="never">
|
|
|
- <!-- 搜索表单 -->
|
|
|
- <subdevice-search ref="searchRef" @search="reload" />
|
|
|
- <!-- 数据表格 -->
|
|
|
- <ele-pro-table
|
|
|
- ref="table"
|
|
|
- :columns="columns"
|
|
|
- :datasource="datasource"
|
|
|
- :selection.sync="selection"
|
|
|
- :cache-key="cacheKeyUrl"
|
|
|
- :response="{
|
|
|
- dataName: 'data.records',
|
|
|
- countName: 'data.total'
|
|
|
- }"
|
|
|
+ <el-card shadow="never">
|
|
|
+ <!-- 搜索表单 -->
|
|
|
+ <subdevice-search ref="searchRef" @search="reload" />
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ :selection.sync="selection"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
+ :pageSizes="tablePageSizes"
|
|
|
+ :response="{
|
|
|
+ dataName: 'data.records',
|
|
|
+ countName: 'data.total'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ v-if="$hasPermission('ledgerAssets:subDevice:create')"
|
|
|
+ @click="openForm('create')"
|
|
|
>
|
|
|
- <!-- 表头工具栏 -->
|
|
|
- <template v-slot:toolbar>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- icon="el-icon-plus"
|
|
|
- class="ele-btn-icon"
|
|
|
- v-if="$hasPermission('ledgerAssets:subDevice:create')"
|
|
|
- @click="openForm('create')"
|
|
|
- >
|
|
|
- 新建
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- icon="el-icon-delete"
|
|
|
- class="ele-btn-icon"
|
|
|
- v-if="
|
|
|
- $hasPermission('ledgerAssets:subDevice:delete') && selection.length
|
|
|
- "
|
|
|
- @click="handleBatchDelete"
|
|
|
- >
|
|
|
- 批量删除
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
+ 新建
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ v-if="
|
|
|
+ $hasPermission('ledgerAssets:subDevice:delete') &&
|
|
|
+ selection.length
|
|
|
+ "
|
|
|
+ @click="handleBatchDelete"
|
|
|
+ >
|
|
|
+ 批量删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
|
|
|
- <!-- 设备状态列 -->
|
|
|
- <template v-slot:activityStatus="{ row }">
|
|
|
- <el-switch
|
|
|
- v-model="row.activityStatus"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- @change="handleStatusChange(row)"
|
|
|
- />
|
|
|
- </template>
|
|
|
+ <!-- 设备状态列 -->
|
|
|
+ <template v-slot:activityStatus="{ row }">
|
|
|
+ <el-switch
|
|
|
+ v-model="row.activityStatus"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ @change="handleStatusChange(row)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
|
|
|
- <!-- 操作列 -->
|
|
|
- <template v-slot:action="{ row }">
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-edit"
|
|
|
- v-if="$hasPermission('ledgerAssets:subDevice:update')"
|
|
|
- @click="openForm('update', row.id)"
|
|
|
- >
|
|
|
- 编辑
|
|
|
- </el-link>
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-delete"
|
|
|
- :style="{ color: delColor }"
|
|
|
- v-if="$hasPermission('ledgerAssets:subDevice:delete')"
|
|
|
- @click="handleDelete(row.id)"
|
|
|
- >
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </ele-pro-table>
|
|
|
- </el-card>
|
|
|
- <!-- </el-col>
|
|
|
+ <!-- 操作列 -->
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ v-if="$hasPermission('ledgerAssets:subDevice:update')"
|
|
|
+ @click="openForm('update', row.id)"
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </el-link>
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ :style="{ color: delColor }"
|
|
|
+ v-if="$hasPermission('ledgerAssets:subDevice:delete')"
|
|
|
+ @click="handleDelete(row.id)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-card>
|
|
|
+ <!-- </el-col>
|
|
|
</el-row> -->
|
|
|
|
|
|
<!-- 详情弹窗 -->
|
|
|
@@ -98,199 +100,200 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import * as DeviceApi from '@/api/ledgerAssets/device';
|
|
|
-import formModel from './components/formModel.vue';
|
|
|
-import subdeviceSearch from './components/subdevice-search.vue';
|
|
|
-import detail from './components/detail.vue';
|
|
|
-// import StationTree from '@/views/isp/ispLine/area/stationTree.vue';
|
|
|
+ import * as DeviceApi from '@/api/ledgerAssets/device';
|
|
|
+ import formModel from './components/formModel.vue';
|
|
|
+ import subdeviceSearch from './components/subdevice-search.vue';
|
|
|
+ import detail from './components/detail.vue';
|
|
|
+ // import StationTree from '@/views/isp/ispLine/area/stationTree.vue';
|
|
|
|
|
|
-export default {
|
|
|
- name: 'LedgerSubDevice',
|
|
|
- components: {
|
|
|
- formModel,
|
|
|
- subdeviceSearch,
|
|
|
- detail,
|
|
|
- // StationTree
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- cacheKeyUrl: 'ledgerSubDeviceTable',
|
|
|
- delColor: '#F56C6C',
|
|
|
- selection: [],
|
|
|
- stationData: {},
|
|
|
- // 表格列配置
|
|
|
- columns: [
|
|
|
- {
|
|
|
- width: 45,
|
|
|
- type: 'selection',
|
|
|
- columnKey: 'selection',
|
|
|
- align: 'center',
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'deviceCode',
|
|
|
- label: '设备编号',
|
|
|
- headerAlign: 'center',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- width: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '设备名称',
|
|
|
- headerAlign: 'center',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- minWidth: 200
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'brandName',
|
|
|
- label: '设备品牌',
|
|
|
- headerAlign: 'center',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- width: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'modelName',
|
|
|
- label: '设备型号',
|
|
|
- headerAlign: 'center',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- width: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'classifyName',
|
|
|
- label: '设备类型',
|
|
|
- headerAlign: 'center',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- width: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'loadDeviceName',
|
|
|
- label: '关联设备',
|
|
|
- headerAlign: 'center',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- width: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'activityStatus',
|
|
|
- label: '设备状态',
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- width: 100,
|
|
|
- slot: 'activityStatus'
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- fixed: 'right',
|
|
|
- label: '操作',
|
|
|
- width: 150,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- showOverflowTooltip: true
|
|
|
- }
|
|
|
- ],
|
|
|
- loading: false
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /* 表格数据源 */
|
|
|
- async datasource({ page, limit, where }) {
|
|
|
- return await DeviceApi.getDevicePage({
|
|
|
- pageNo: page,
|
|
|
- pageSize: limit,
|
|
|
- stationId: this.stationData.stationId || this.stationData.id || undefined,
|
|
|
- areaId: this.stationData.stationId ? this.stationData.id : undefined,
|
|
|
- ...where
|
|
|
- });
|
|
|
+ export default {
|
|
|
+ name: 'LedgerSubDevice',
|
|
|
+ components: {
|
|
|
+ formModel,
|
|
|
+ subdeviceSearch,
|
|
|
+ detail
|
|
|
+ // StationTree
|
|
|
},
|
|
|
-
|
|
|
- /* 场站树节点点击 */
|
|
|
- handleDeptNodeClick(data) {
|
|
|
- this.stationData = data;
|
|
|
- this.reload();
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ cacheKeyUrl: 'ledgerSubDeviceTable',
|
|
|
+ delColor: '#F56C6C',
|
|
|
+ selection: [],
|
|
|
+ stationData: {},
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'deviceCode',
|
|
|
+ label: '设备编号',
|
|
|
+ headerAlign: 'center',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '设备名称',
|
|
|
+ headerAlign: 'center',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 200
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'brandName',
|
|
|
+ label: '设备品牌',
|
|
|
+ headerAlign: 'center',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'modelName',
|
|
|
+ label: '设备型号',
|
|
|
+ headerAlign: 'center',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'classifyName',
|
|
|
+ label: '设备类型',
|
|
|
+ headerAlign: 'center',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'loadDeviceName',
|
|
|
+ label: '关联设备',
|
|
|
+ headerAlign: 'center',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ width: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'activityStatus',
|
|
|
+ label: '设备状态',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ width: 100,
|
|
|
+ slot: 'activityStatus'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ fixed: 'right',
|
|
|
+ label: '操作',
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ loading: false
|
|
|
+ };
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ /* 表格数据源 */
|
|
|
+ async datasource({ page, limit, where }) {
|
|
|
+ return await DeviceApi.getDevicePage({
|
|
|
+ pageNo: page,
|
|
|
+ pageSize: limit,
|
|
|
+ stationId:
|
|
|
+ this.stationData.stationId || this.stationData.id || undefined,
|
|
|
+ areaId: this.stationData.stationId ? this.stationData.id : undefined,
|
|
|
+ ...where
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where) {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- },
|
|
|
+ /* 场站树节点点击 */
|
|
|
+ handleDeptNodeClick(data) {
|
|
|
+ this.stationData = data;
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
|
|
|
- /** 添加/修改操作 */
|
|
|
- openForm(type, id) {
|
|
|
- this.$refs.formModelRef.open(type, id, this.stationData);
|
|
|
- },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ },
|
|
|
|
|
|
- /** 状态切换 */
|
|
|
- handleStatusChange(row) {
|
|
|
- const text = row.activityStatus === 1 ? '启用' : '停用';
|
|
|
- this.$confirm('确认要' + text + '设备"' + row.name + '"吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- row.extInfo = row.extInfo || '{}';
|
|
|
- await DeviceApi.updateDevice(row);
|
|
|
- this.$message.success(text + '成功');
|
|
|
- this.reload();
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- row.activityStatus = row.activityStatus === 1 ? 0 : 1;
|
|
|
- });
|
|
|
- },
|
|
|
+ /** 添加/修改操作 */
|
|
|
+ openForm(type, id) {
|
|
|
+ this.$refs.formModelRef.open(type, id, this.stationData);
|
|
|
+ },
|
|
|
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(id) {
|
|
|
- this.$confirm('是否确认删除该数据项?', '警告', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- await DeviceApi.deleteDevice(id);
|
|
|
- this.$message.success('删除成功');
|
|
|
- this.reload();
|
|
|
+ /** 状态切换 */
|
|
|
+ handleStatusChange(row) {
|
|
|
+ const text = row.activityStatus === 1 ? '启用' : '停用';
|
|
|
+ this.$confirm('确认要' + text + '设备"' + row.name + '"吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
- },
|
|
|
+ .then(async () => {
|
|
|
+ row.extInfo = row.extInfo || '{}';
|
|
|
+ await DeviceApi.updateDevice(row);
|
|
|
+ this.$message.success(text + '成功');
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ row.activityStatus = row.activityStatus === 1 ? 0 : 1;
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- /** 批量删除按钮操作 */
|
|
|
- handleBatchDelete() {
|
|
|
- if (this.selection.length === 0) {
|
|
|
- this.$message.warning('请选择要删除的数据项');
|
|
|
- return;
|
|
|
- }
|
|
|
- this.$confirm('是否确认删除选中的数据项?', '警告', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- const ids = this.selection.map((item) => item.id);
|
|
|
- for (const id of ids) {
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(id) {
|
|
|
+ this.$confirm('是否确认删除该数据项?', '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
await DeviceApi.deleteDevice(id);
|
|
|
- }
|
|
|
- this.$message.success('删除成功');
|
|
|
- this.reload();
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 批量删除按钮操作 */
|
|
|
+ handleBatchDelete() {
|
|
|
+ if (this.selection.length === 0) {
|
|
|
+ this.$message.warning('请选择要删除的数据项');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm('是否确认删除选中的数据项?', '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .then(async () => {
|
|
|
+ const ids = this.selection.map((item) => item.id);
|
|
|
+ for (const id of ids) {
|
|
|
+ await DeviceApi.deleteDevice(id);
|
|
|
+ }
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|