From c89113ec9b5032b5553334ec6c9ac3700ba6c398 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 23 六月 2022 16:35:29 +0800
Subject: [PATCH] 1.设备管理、设备类型(查询、新增、删除)功能开发 2.设备管理、设备组(查询、新增、删除)功能开发

---
 src/views/jcsz/zzjg.vue |   12 +
 src/views/jcsz/wldw.vue |   11 
 src/views/jcsz/yhqd.vue |   11 
 src/views/jcsz/jsqd.vue |   16 +-
 src/views/sbgl/sbqd.vue |  323 +++++++++++++++++++++++++++++++++++++++++----
 5 files changed, 318 insertions(+), 55 deletions(-)

diff --git a/src/views/jcsz/jsqd.vue b/src/views/jcsz/jsqd.vue
index 3feb640..096d44a 100644
--- a/src/views/jcsz/jsqd.vue
+++ b/src/views/jcsz/jsqd.vue
@@ -12,13 +12,13 @@
         >
           <div class="elForm">
             <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;">
-              <el-input v-model="form.RoleCode" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.RoleCode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="瑙掕壊鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.RoleName" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.RoleName" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="瑙掕壊绫诲瀷" style=" display: flex;">
-              <el-select v-model="form.RoleTypeCode" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.RoleTypeCode" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in RoleTypeCodeArr2"
                   :key="item.roletype_code"
@@ -28,7 +28,7 @@
               </el-select>
             </el-form-item>
             <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
-              <el-input v-model="form.UserName" style="width: calc(100%-30px)" placeholder="璇疯緭鍏�" />
+              <el-input v-model="form.UserName" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
           </div>
           <div style="display: flex;align-items: start;margin-top: 5px;">
@@ -47,6 +47,7 @@
         <el-table
           :data="tableData"
           border
+          stripe
           :style="{width: 100+'%',height:tableHeight+'px'}"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
@@ -212,7 +213,7 @@
         <el-table-column
           width="50"
           label="搴忓彿"
-          type="index"
+          prop="RowNum"
         />
         <el-table-column
           prop="roletype_code"
@@ -789,6 +790,7 @@
           this.RoleTypeCodeArr.splice(index, 1)
         }
       })
+      this.getRoleTypeSearch2()
     },
     // 璁剧疆瀵硅瘽妗嗗彇娑堜簨浠�
     settingDialogVisibleCancel() {
@@ -840,7 +842,7 @@
     // 璁剧疆琛ㄥ崟鍙栨秷浜嬩欢
     formSettingCancel(row) {
       this.RoleTypeCodeArr.forEach((item, index) => {
-        if (item.isVisible === 1) {
+        if (item.isVisible === 1 && item.roletype_code === row.roletype_code) {
           this.RoleTypeCodeArr.splice(index, 1)
         }
       })
@@ -1475,7 +1477,7 @@
 .elForm {
   display: flex;
   justify-content: flex-start;
-  width: 85%;
+  width: 100%;
   flex-wrap: wrap;
 }
 </style>
diff --git a/src/views/jcsz/wldw.vue b/src/views/jcsz/wldw.vue
index 0fd1086..349d2d6 100644
--- a/src/views/jcsz/wldw.vue
+++ b/src/views/jcsz/wldw.vue
@@ -11,13 +11,13 @@
         >
           <div class="elForm">
             <el-form-item label="鍗曚綅缂栫爜" style=" display: flex;">
-              <el-input v-model="form.CuntUnitCode" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.CuntUnitCode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鍗曚綅鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.CuntUnitName" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.CuntUnitName" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鍗曚綅灞炴��" style=" display: flex;">
-              <el-select v-model="form.UnitAttr" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.UnitAttr" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in UnitAttrArr"
                   :key="item.value"
@@ -27,7 +27,7 @@
               </el-select>
             </el-form-item>
             <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
-              <el-input v-model="form.CreateUser" style="width: calc(100%-30px)" placeholder="璇疯緭鍏�" />
+              <el-input v-model="form.CreateUser" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
           </div>
           <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
@@ -45,6 +45,7 @@
         <el-table
           :data="tableData"
           border
+          stripe
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
@@ -581,7 +582,7 @@
 .elForm {
   display: flex;
   justify-content: flex-start;
-  width: 85%;
+  width: 100%;
   flex-wrap: wrap;
 }
 </style>
diff --git a/src/views/jcsz/yhqd.vue b/src/views/jcsz/yhqd.vue
index f7c0952..56a8215 100644
--- a/src/views/jcsz/yhqd.vue
+++ b/src/views/jcsz/yhqd.vue
@@ -12,10 +12,10 @@
         >
           <div class="elForm">
             <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">
-              <el-input v-model="form.UserCode" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.UserCode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鐢ㄦ埛鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.UserName" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.UserName" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鎵�灞炵粍缁�" style=" display: flex;">
               <el-cascader
@@ -27,7 +27,7 @@
               />
             </el-form-item>
             <el-form-item label="宸ヨ祫绫诲瀷" style=" display: flex;">
-              <el-select v-model="form.wagetype" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.wagetype" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in wagetypeArr"
                   :key="item.value"
@@ -37,7 +37,7 @@
               </el-select>
             </el-form-item>
             <el-form-item label="鍦ㄨ亴鐘舵��" style=" display: flex;">
-              <el-select v-model="form.Enable" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.Enable" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in EnableArr"
                   :key="item.value"
@@ -61,6 +61,7 @@
         <el-table
           :data="tableData"
           border
+          stripe
           highlight-current-row
           :style="{width: 100+'%',height:tableHeight+'px'}"
           :header-cell-style="this.$headerCellStyle"
@@ -1067,7 +1068,7 @@
 .elForm {
   display: flex;
   justify-content: flex-start;
-  width: 85%;
+  width: 100%;
   flex-wrap: wrap;
 }
 </style>
diff --git a/src/views/jcsz/zzjg.vue b/src/views/jcsz/zzjg.vue
index cae3213..440ae40 100644
--- a/src/views/jcsz/zzjg.vue
+++ b/src/views/jcsz/zzjg.vue
@@ -12,13 +12,13 @@
         >
           <div class="elForm">
             <el-form-item label="缁勭粐缂栫爜" style=" display: flex;">
-              <el-input v-model="form.OrgCode" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.OrgCode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="缁勭粐鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="缁勭粐绫诲瀷" style=" display: flex;">
-              <el-select v-model="form.OrgType" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.OrgType" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in OrgTypeArr"
                   :key="item.value"
@@ -28,7 +28,7 @@
               </el-select>
             </el-form-item>
             <el-form-item label="鍒涘缓浜哄憳" style=" display: flex;">
-              <el-input v-model="form.UserName" style="width: calc(100%-30px)" placeholder="璇疯緭鍏�" />
+              <el-input v-model="form.UserName" style="width: 200px" placeholder="璇疯緭鍏�" />
             </el-form-item>
           </div>
           <div style="display: flex;align-items: start;margin-top: 5px;">
@@ -47,6 +47,7 @@
         <el-table
           :data="tableData"
           border
+          stripe
           :style="{width: 100+'%',height:tableHeight+'px'}"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
@@ -139,6 +140,7 @@
         <el-form-item label="缁勭粐绫诲瀷" prop="OrgType">
           <el-radio-group
             v-model="dialogForm.OrgType"
+            style="display: flex; align-items: center; height: 40px;"
             @change="changeRadio"
           >
             <el-radio
@@ -502,7 +504,7 @@
 .elForm {
   display: flex;
   justify-content: flex-start;
-  width: 85%;
+  width: 100%;
   flex-wrap: wrap;
 }
 </style>
diff --git a/src/views/sbgl/sbqd.vue b/src/views/sbgl/sbqd.vue
index 5fe46db..717a8a9 100644
--- a/src/views/sbgl/sbqd.vue
+++ b/src/views/sbgl/sbqd.vue
@@ -9,15 +9,15 @@
           inline
           style="display: flex;justify-content: space-between"
         >
-          <div class="elForm" style="width:100%">
+          <div class="elForm">
             <el-form-item label="璁惧缂栫爜" style=" display: flex;">
-              <el-input v-model="form.DeviceCode" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.DeviceCode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="璁惧鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.DeviceName" placeholder="璇疯緭鍏�" style="width: calc(100%-30px)" />
+              <el-input v-model="form.DeviceName" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="浣跨敤鐘舵��" style=" display: flex;">
-              <el-select v-model="form.Status" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.Status" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in StatusArr"
                   :key="item.value"
@@ -27,7 +27,7 @@
               </el-select>
             </el-form-item>
             <el-form-item label="鎵�灞炶溅闂�" style=" display: flex;">
-              <el-select v-model="form.WorkShop" filterable style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select v-model="form.WorkShop" filterable style="width: 200px" placeholder="璇烽�夋嫨">
                 <el-option
                   v-for="item in WorkShopArr"
                   :key="item.code"
@@ -37,7 +37,7 @@
               </el-select>
             </el-form-item>
             <el-form-item filterable label="璁惧绫诲瀷" style="display: flex;">
-              <el-select v-model="form.DeviceType" style="width: calc(100%-30px)" placeholder="璇烽�夋嫨" @change="deviceTypeChange">
+              <el-select v-model="form.DeviceType" style="width: 200px" placeholder="璇烽�夋嫨" @change="deviceTypeChange">
                 <el-option
                   v-for="item in DeviceTypeArr"
                   :key="item.code"
@@ -47,7 +47,12 @@
               </el-select>
             </el-form-item>
             <el-form-item label="璁惧缁�" style=" display: flex;">
-              <el-select v-model="form.DeviceGroup" :disabled="form.DeviceType===''" style="width: calc(100%-30px)" placeholder="璇烽�夋嫨">
+              <el-select
+                v-model="form.DeviceGroup"
+                :disabled="form.DeviceType===''"
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+              >
                 <el-option
                   v-for="item in DeviceGroupArr"
                   :key="item.code"
@@ -74,6 +79,7 @@
         <el-table
           :data="tableData"
           border
+          stripe
           highlight-current-row
           :style="{width: 100+'%',height:tableHeight+'px'}"
           :header-cell-style="this.$headerCellStyle"
@@ -246,7 +252,7 @@
 
     <!--璁惧绫诲瀷-->
     <el-dialog
-      title="瑙掕壊绫诲瀷"
+      title="璁惧绫诲瀷"
       :visible.sync="DeviceTypeDialogVisible"
       width="50%"
       top="15vh"
@@ -310,12 +316,6 @@
               <el-button v-if="row.isVisible===1" type="text" @click="DeviceTypeCancel(row)">鍙栨秷</el-button>
             </div>
           </template>
-          <!--          <template v-for="item in RoleTypeCodeArr" slot-scope="{row}">-->
-          <!--            <div :key="item.roletype_code" class="operationClass">-->
-          <!--              <el-button v-if="item.isVisible" type="text" @click="formSettingSave(row)">淇濆瓨</el-button>-->
-          <!--              <el-button v-if="item.isVisible" type="text" @click="formSettingCancel(row)">鍙栨秷</el-button>-->
-          <!--            </div>-->
-          <!--          </template>-->
         </el-table-column>
       </el-table>
       <!--鍒嗛〉-->
@@ -338,16 +338,127 @@
     </el-dialog>
 
     <!--璁惧缁�-->
+    <el-dialog
+      title="璁惧缁�"
+      :visible.sync="DeviceGroupDialogVisible"
+      width="70%"
+      top="15vh"
+      class="DeviceTypeDialogVisible"
+      @close="handleCloseDeviceGroup"
+    >
+      <div style="margin-bottom: 20px;display: flex">
+        <el-button type="primary" icon="el-icon-circle-plus-outline" @click="addDeviceGroup">鏂板</el-button>
+      </div>
+      <el-table
+        :data="DeviceGroupArray"
+        border
+        highlight-current-row
+        :style="{width: 100+'%',height:tableHeight-300+'px'}"
+        :header-cell-style="this.$headerCellStyle"
+        :cell-style="this.$cellStyle"
+        @sort-change="sortChangeOfDeviceGroup"
+      >
+        <el-table-column
+          width="50"
+          label="搴忓彿"
+          prop="RowNum"
+        />
+        <el-table-column
+          prop="code"
+          label="鍒嗙粍缂栫爜"
+          sortable="custom"
+        >
+          <template slot-scope="{row}">
+            <el-input v-if="row.isVisible===1" v-model="row.code" placeholder="璇疯緭鍏�" />
+            <div v-else> {{ row.code }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="name"
+          label="鍒嗙粍鍚嶇О"
+          sortable="custom"
+        >
+          <template slot-scope="{row}">
+            <el-input v-if="row.isVisible===1" v-model="row.name" placeholder="璇疯緭鍏�" />
+            <div v-else> {{ row.name }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="eqptype_name"
+          label="鎵�灞炶澶囩被鍨�"
+          sortable="custom"
+        >
+          <template slot-scope="{row}">
+            <!--            <el-input v-if="row.isVisible===1" v-model="row.eqptype_code" placeholder="璇疯緭鍏�" />-->
+            <el-select v-if="row.isVisible===1" v-model="row.eqptype_code" placeholder="璇烽�夋嫨">
+              <el-option
+                v-for="item in DeviceTypeArr"
+                :key="item.code"
+                :label="item.name"
+                :value="item.code"
+              />
+            </el-select>
+            <div v-else> {{ row.eqptype_name }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="remark"
+          label="鍒嗙粍鎻忚堪"
+          show-overflow-tooltip
+          sortable="custom"
+        >
+          <template slot-scope="{row}">
+            <el-input v-if="row.isVisible===1" v-model="row.remark" placeholder="璇疯緭鍏�" />
+            <div v-else> {{ row.remark }}</div>
+          </template>
+        </el-table-column>
+        <el-table-column label="鎿嶄綔">
+          <template slot-scope="{row}">
+            <div class="operationClass">
+              <el-button v-if="row.isVisible===0" type="text" @click="DeviceGroupDel(row)">鍒犻櫎</el-button>
+              <el-button v-if="row.isVisible===1" type="text" @click="DeviceGroupSave(row)">淇濆瓨</el-button>
+              <el-button v-if="row.isVisible===1" type="text" @click="DeviceGroupCancel(row)">鍙栨秷</el-button>
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+      <!--鍒嗛〉-->
+      <pagination
+        v-show="DeviceGroupTotal>0"
+        :total="DeviceGroupTotal"
+        :page.sync="formDeviceGroup.page"
+        :limit.sync="formDeviceGroup.rows"
+        align="right"
+        layout="prev, pager, next,sizes"
+        popper-class="select_bottom"
+        @pagination="getDeviceGroupSearchDialog"
+      />
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button @click="DeviceGroupDialogVisibleCancel">杩斿洖</el-button>
+          <!--          <el-button type="primary" @click="settingDialogVisibleConfirm">纭� 瀹�</el-button>-->
+        </div>
+      </span>
+    </el-dialog>
 
     <!--瀵煎叆-->
+
   </div>
 </template>
 
 <script>
 import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
+import {
+  AddUpdateOrganization,
+  DeleteOrganization,
+  OrganizationSearch,
+  PrentOrganization,
+  RoleTypeDelete
+} from '@/api/jcsz'
 import { getCookie } from '@/utils/auth'
 import {
+  AddUpdateDeviceGroup,
+  AddUpdateDeviceType, DeleteDeviceType,
   DeviceGroupSearch,
   DeviceMangerSearch,
   DeviceTypeSearch,
@@ -430,17 +541,21 @@
       DeviceTypeDialogVisible: false,
       DeviceTypeArray: [], // 璁惧绫诲瀷瀵硅瘽妗嗗唴鐨勬暟缁�
       formDeviceType: {
-        // code: '',
-        // name: '',
-        // group: '',
-        // description: '',
-        rows: 1,
-        row: 10,
+        page: 1,
+        rows: 10,
         prop: 'code',
         order: 'desc'
       },
-      DeviceTypeTotal: 0
-
+      DeviceTypeTotal: 0,
+      DeviceGroupDialogVisible: false,
+      DeviceGroupArray: [], // 璁惧缁勫璇濇鍐呯殑鏁扮粍
+      formDeviceGroup: {
+        page: 1,
+        rows: 10,
+        prop: 'code',
+        order: 'desc'
+      },
+      DeviceGroupTotal: 0
     }
   },
   created() {
@@ -463,7 +578,7 @@
       this.total = res.count
     },
     // 鑾峰彇鎵�灞炶溅闂翠笅鎷�
-    async  getWorkShopSelect() {
+    async getWorkShopSelect() {
       const { data: res } = await WorkShopSelect()
       this.WorkShopArr = res
     },
@@ -473,7 +588,7 @@
       this.DeviceTypeArr = res
     },
     // 璁惧绫诲瀷鏀瑰彉鏃�
-    async  deviceTypeChange(val) {
+    async deviceTypeChange(val) {
       this.form.DeviceType = val
       const { data: res } = await DeviceTypeSelectGroup({ eqptypecode: val })
       this.DeviceGroupArr = res
@@ -603,7 +718,12 @@
     },
     // 澶勭悊瀵硅瘽妗嗗叧闂�
     handleCloseDeviceType() {
-      // this.DeviceTypeDialogVisible = false
+      this.DeviceTypeArray.forEach((item, index) => {
+        if (item.isVisible === 1) {
+          this.DeviceTypeArray.splice(index, 1)
+        }
+      })
+      this.getDeviceTypeSelect()
     },
     // 璁惧绫诲瀷琛ㄥ崟鐐瑰嚮鎺掑簭
     sortChangeOfDeviceType({ column, prop, order }) {
@@ -620,19 +740,55 @@
     },
     // 鏂板鎸夐挳
     addDeviceType() {
-      this.DeviceTypeArray.unshift({ code: '', name: '', group: '', description: '', isVisible: 1 })
+      this.DeviceTypeArray.unshift({ code: '', name: '', group: '', remark: '', isVisible: 1 })
     },
     // 鍒犻櫎
     DeviceTypeDel(row) {
-
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        DeleteDeviceType({ devicetypecode: row.code }).then(res => {
+          if (res.code === '200') {
+            this.$message.success('鍒犻櫎鎴愬姛!')
+            this.getDeviceTypeSearchDialog()
+          }
+        })
+      }).catch(() => {
+        this.$message.info('宸插彇娑堝垹闄�')
+      })
     },
     // 淇濆瓨
-    DeviceTypeSave(row) {
-
+    async DeviceTypeSave(row) {
+      if (row.code.trim().length < 1) {
+        return this.$message.info('绫诲瀷缂栫爜涓嶈兘涓虹┖锛�')
+      }
+      if (row.name.trim().length < 1) {
+        return this.$message.info('绫诲瀷鍚嶇О涓嶈兘涓虹┖锛�')
+      }
+      if (row.remark.trim().length < 1) {
+        return this.$message.info('绫诲瀷鎻忚堪涓嶈兘涓虹┖锛�')
+      }
+      const data = {
+        'code': row.code,
+        'name': row.name,
+        'group': '',
+        'description': row.remark
+      }
+      const res = await AddUpdateDeviceType([data])
+      if (res.code === '200') {
+        this.$message.success('娣诲姞鎴愬姛锛�')
+        await this.getDeviceTypeSearchDialog()
+      }
     },
     // 鍙栨秷
     DeviceTypeCancel(row) {
-
+      this.DeviceTypeArray.forEach((item, index) => {
+        if (item.isVisible === 1 && item.code === row.code) {
+          this.DeviceTypeArray.splice(index, 1)
+        }
+      })
     },
     // 杩斿洖鎸夐挳
     DeviceTypeDialogVisibleCancel() {
@@ -642,7 +798,101 @@
     /* 璁惧缁勬ā鍧�*/
     // 鐐瑰嚮璁惧缁勬寜閽�
     deviceGroupButton() {
-
+      this.DeviceGroupDialogVisible = true
+      this.getDeviceGroupSearchDialog()
+    },
+    // 璁惧缁勫璇濇鍏抽棴浜嬩欢
+    handleCloseDeviceGroup() {
+      this.DeviceGroupDialogVisible = false
+      this.DeviceGroupArray.forEach((item, index) => {
+        if (item.isVisible === 1) {
+          this.DeviceGroupArray.splice(index, 1)
+        }
+      })
+      if (this.form.DeviceType !== '') {
+        this.deviceTypeChange(this.form.DeviceType)
+      }
+    },
+    // 鏂板
+    addDeviceGroup() {
+      this.DeviceGroupArray.unshift({ code: '', name: '', eqptype_code: '', eqptype_name: '', remark: '', isVisible: 1 })
+    },
+    // 鎺掑簭
+    sortChangeOfDeviceGroup({ column, prop, order }) {
+      if (order === 'descending') {
+        order = 'desc'
+      } else if (order === 'ascending') {
+        order = 'asc'
+      } else {
+        order = 'desc'
+      }
+      this.formDeviceGroup.order = order
+      this.formDeviceGroup.prop = prop
+      this.getDeviceGroupSearchDialog()
+    },
+    // 鑾峰彇璁惧缁勫垪琛�
+    async getDeviceGroupSearchDialog() {
+      const res = await DeviceGroupSearch(this.formDeviceGroup)
+      this.DeviceGroupArray = res.data
+      this.DeviceGroupTotal = res.count
+      this.DeviceGroupArray.forEach(item => {
+        item.isVisible = 0
+      })
+    },
+    // 杩斿洖鎸夐挳
+    DeviceGroupDialogVisibleCancel() {
+      this.DeviceGroupDialogVisible = false
+    },
+    // 鍒犻櫎鎸夐挳
+    DeviceGroupDel(row) {
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        DeleteDeviceGroup({ devicegroupcode: row.code }).then(res => {
+          if (res.code === '200') {
+            this.$message.success('鍒犻櫎鎴愬姛!')
+            this.getDeviceGroupSearchDialog()
+          }
+        })
+      }).catch(() => {
+        this.$message.info('宸插彇娑堝垹闄�')
+      })
+    },
+    // 淇濆瓨鎸夐挳
+    async DeviceGroupSave(row) {
+      if (row.code.trim().length < 1) {
+        return this.$message.info('鍒嗙粍缂栫爜涓嶈兘涓虹┖锛�')
+      }
+      if (row.name.trim().length < 1) {
+        return this.$message.info('鍒嗙粍鍚嶇О涓嶈兘涓虹┖锛�')
+      }
+      if (row.eqptype_code.trim().length < 1) {
+        return this.$message.info('鎵�灞炶澶囩被鍨嬩笉鑳戒负绌猴紒')
+      }
+      if (row.remark.trim().length < 1) {
+        return this.$message.info('鍒嗙粍鎻忚堪涓嶈兘涓虹┖锛�')
+      }
+      const data = {
+        'code': row.code,
+        'name': row.name,
+        'group': row.eqptype_code,
+        'description': row.remark
+      }
+      const res = await AddUpdateDeviceGroup([data])
+      if (res.code === '200') {
+        this.$message.success('娣诲姞鎴愬姛锛�')
+        await this.getDeviceGroupSearchDialog()
+      }
+    },
+    // 鍙栨秷鎸夐挳
+    DeviceGroupCancel(row) {
+      this.DeviceGroupArray.forEach((item, index) => {
+        if (item.isVisible === 1 && item.code === row.code) {
+          this.DeviceGroupArray.splice(index, 1)
+        }
+      })
     }
   }
 }
@@ -701,6 +951,12 @@
   ::v-deep .el-dialog__body {
     padding: 20px 20px !important;
   }
+
+  ::v-deep .el-select .el-input .el-select__caret {
+    display: flex;
+    align-items: center;
+  }
+
 }
 
 ::v-deep .el-radio__input.is-checked .el-radio__inner {
@@ -780,10 +1036,11 @@
 ::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
   margin: 10px 30px 0px 0;
 }
+
 .elForm {
   display: flex;
   justify-content: flex-start;
-  width: 85%;
+  width: 100%;
   flex-wrap: wrap;
 }
 </style>

--
Gitblit v1.9.3