Browse Source

chore: 清理调试代码与未使用的数据属性

移除browse.vue中的调试日志,删除pollingRules和scheduledTasks中未使用的tablePageSizes属性,并为camera、robot、subDevice视图添加分页配置支持。
yusheng 1 month ago
parent
commit
25315893e5

+ 1 - 8
src/components/jimureport/browse.vue

@@ -19,14 +19,7 @@
     },
 
     methods: {},
-    created() {
-      this.$nextTick(() => {
-        setTimeout(() => {
-        let dom = document.getElementById('iframe');
-          console.log(dom.contentWindow.document, 'dom');
-        }, 5000);
-      });
-    }
+    created() {}
   };
 </script>
 <style scoped lang="scss"></style>

+ 0 - 1
src/views/config/pollingRules/index.vue

@@ -99,7 +99,6 @@ export default {
       cacheKeyUrl: 'videoPollingTable',
       delColor: '#F56C6C',
       selection: [],
-      tablePageSizes: [10, 20, 50, 100],
       // 表格列配置
       columns: [
         {

+ 0 - 1
src/views/config/scheduledTasks/index.vue

@@ -206,7 +206,6 @@ export default {
       ],
       // 加载状态
       loading: false,
-      tablePageSizes: [10, 20, 50, 100]
     }
   },
   created() {

+ 1 - 0
src/views/ledgerAssets/camera/index.vue

@@ -10,6 +10,7 @@
         :datasource="datasource"
         :selection.sync="selection"
         :cache-key="cacheKeyUrl"
+        :pageSizes="tablePageSizes"
         :response="{
           dataName: 'data.records', // 数据列表的字段名称,支持嵌套,例如:data.rows
           countName: 'data.total' // 数据总数的字段名称,例如:data.total

+ 253 - 252
src/views/ledgerAssets/robot/index.vue

@@ -13,80 +13,81 @@
         </el-card>
       </el-col>
       <el-col :span="20" :xs="24"> -->
-        <el-card shadow="never">
-          <!-- 搜索表单 -->
-          <robot-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">
+      <!-- 搜索表单 -->
+      <robot-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:robot:create')"
+            @click="openForm('create')"
           >
-            <!-- 表头工具栏 -->
-            <template v-slot:toolbar>
-              <el-button
-                type="primary"
-                icon="el-icon-plus"
-                class="ele-btn-icon"
-                v-if="$hasPermission('ledgerAssets:robot:create')"
-                @click="openForm('create')"
-              >
-                新建
-              </el-button>
-              <el-button
-                type="danger"
-                icon="el-icon-delete"
-                class="ele-btn-icon"
-                v-if="
-                  $hasPermission('ledgerAssets:robot: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:robot: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:robot: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:robot: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:robot: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:robot:delete')"
+            @click="handleDelete(row.id)"
+          >
+            删除
+          </el-link>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <!-- </el-col>
     </el-row> -->
 
     <!-- 详情弹窗 -->
@@ -98,199 +99,199 @@
 </template>
 
 <script>
-import * as RobotApi from '@/api/ledgerAssets/robot';
-import formModel from './components/formModel.vue';
-import robotSearch from './components/robot-search.vue';
-import detail from './components/detail.vue';
-// import StationTree from '@/views/isp/ispLine/area/stationTree.vue';
+  import * as RobotApi from '@/api/ledgerAssets/robot';
+  import formModel from './components/formModel.vue';
+  import robotSearch from './components/robot-search.vue';
+  import detail from './components/detail.vue';
+  // import StationTree from '@/views/isp/ispLine/area/stationTree.vue';
 
-export default {
-  name: 'LedgerRobot',
-  components: {
-    formModel,
-    robotSearch,
-    detail,
-    // StationTree
-  },
-  data() {
-    return {
-      cacheKeyUrl: 'ledgerRobotTable',
-      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: 'kjgName',
-          label: '可见光摄像机',
-          headerAlign: 'center',
-          align: 'center',
-          showOverflowTooltip: true,
-          width: 150
-        },
-        {
-          prop: 'hwName',
-          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 RobotApi.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: 'LedgerRobot',
+    components: {
+      formModel,
+      robotSearch,
+      detail
+      // StationTree
     },
-
-    /* 场站树节点点击 */
-    handleDeptNodeClick(data) {
-      this.stationData = data;
-      this.reload();
+    data() {
+      return {
+        cacheKeyUrl: 'ledgerRobotTable',
+        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: 'kjgName',
+            label: '可见光摄像机',
+            headerAlign: 'center',
+            align: 'center',
+            showOverflowTooltip: true,
+            width: 150
+          },
+          {
+            prop: 'hwName',
+            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 RobotApi.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 RobotApi.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 RobotApi.deletedDevice(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 RobotApi.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 RobotApi.deletedDevice(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 RobotApi.deletedDevice(id);
+            }
+            this.$message.success('删除成功');
+            this.reload();
+          })
+          .catch(() => {});
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped></style>

+ 255 - 252
src/views/ledgerAssets/subDevice/index.vue

@@ -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>

+ 6 - 2
src/views/maintenance/components/programRulesDialog.vue

@@ -430,7 +430,7 @@
     </el-form>
     <template v-slot:footer>
       <el-button @click="visible = false">取消</el-button>
-      <el-button type="primary" @click="save">
+      <el-button type="primary" @click="save" v-loading="loading">
         {{ dialogTitle === '派单' ? '派单' : '保存' }}</el-button
       >
     </template>
@@ -531,6 +531,7 @@
         ruleId: '',
         formLabel: '',
         isBindPlan: false,
+        loading: false,
         ruleObj: {
           ruleId: '',
           name: '',
@@ -916,9 +917,11 @@
               } else {
                 type = this.dialogTitle.includes('新增') ? '新增' : '编辑';
               }
-              // return
+              this.loading = true;
               try {
                 let res = await saveOrUpdate(sendMsg);
+                this.loading = false;
+
                 if (res) {
                   this.$message.success(type + '成功!');
                   this.$emit('done');
@@ -926,6 +929,7 @@
                 }
               } catch (error) {
                 this.$message.error(type + '失败!');
+                this.loading = false;
               }
             }
           });