yusheng hace 19 horas
padre
commit
3764c546f3

+ 16 - 0
src/api/ledgerAssets/index.js

@@ -183,3 +183,19 @@ export async function batchUnbind(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+//批量停机
+export async function batchStop(data) {
+  const res = await request.post(`/main/asset/batchStop`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//批量运行
+export async function batchRun(data) {
+  const res = await request.post(`/main/asset/batchRun`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 41 - 8
src/views/ledgerAssets/equipment/components/equipment-list.vue

@@ -81,6 +81,27 @@
         >
           设置使用单位
         </el-button>
+        <el-button
+          size="small"
+          :disabled="checkRadioData.length == 0"
+          icon="el-icon-s-tools"
+          class="ele-btn-icon"
+          type="danger"
+          @click="setStatus(1)"
+          v-if="$hasPermission('main:substance:stop')"
+        >
+          批量停机
+        </el-button>
+        <el-button
+          size="small"
+          :disabled="checkRadioData.length == 0"
+          icon="el-icon-setting"
+          class="ele-btn-icon"
+          @click="setStatus(2)"
+          v-if="$hasPermission('main:substance:run')"
+        >
+          批量运行
+        </el-button>
         <el-button
           size="small"
           type="danger"
@@ -98,13 +119,6 @@
           @click="uploadFile"
           >导入</el-button
         >
-        <!-- <el-button
-          size="small"
-          @click="moveTo(checkRadioData, 'move')"
-          :disabled="checkRadioData.length == 0"
-          class="ele-btn-icon"
-          >移动到</el-button
-        > -->
       </template>
       <!-- 编码列 -->
       <template v-slot:code="{ row }" v-if="!$route.query.isDrawer">
@@ -182,7 +196,9 @@
     getAssetList,
     downloadAsset,
     getNetworkCount,
-    batchDel
+    batchDel,
+    batchStop,
+    batchRun
   } from '@/api/ledgerAssets';
   import dictMixins from '@/mixins/dictMixins';
   import axios from 'axios';
@@ -410,6 +426,16 @@
               }
             }
           },
+          {
+            prop: 'runStatus',
+            label: '运行状态',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            formatter: (_row) => {
+              return _row.runStatus == 5 ? '停机' : '运行';
+            }
+          },
+
           {
             prop: 'pathName',
             label: '位置',
@@ -511,6 +537,13 @@
           this.checkRadioData = [];
         }
       },
+      setStatus(type) {
+        let api = type == 1 ? batchStop : batchRun;
+        api(this.checkRadioData.map((item) => item.id)).then((res) => {
+          this.$message.success('操作成功');
+          this.sucesstion(true);
+        });
+      },
       handlDelete() {
         if (this.checkRadioData.length == 0) {
           this.$message.warning('请至少选择一条数据');