From e713b378b01d189f972cfb5b9eae749ee95a8b51 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期六, 29 十月 2022 13:48:00 +0800
Subject: [PATCH] 1.解决两个账号登录,是否被挤掉的问题

---
 src/views/sbgl/bybz.vue |  182 +++++++++++++++++++++++++++------------------
 1 files changed, 108 insertions(+), 74 deletions(-)

diff --git a/src/views/sbgl/bybz.vue b/src/views/sbgl/bybz.vue
index a2cc60f..9a1491e 100644
--- a/src/views/sbgl/bybz.vue
+++ b/src/views/sbgl/bybz.vue
@@ -3,19 +3,19 @@
     <div class="body" :style="{height:mainHeight+'px'}">
       <div class="bodyTopButtonGroup" style="justify-content: space-between">
         <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
-        <el-button icon="el-icon-download" @click="upload">瀵煎叆</el-button>
+        <!--        <el-button icon="el-icon-download" @click="upload">瀵煎叆</el-button>-->
       </div>
 
       <div class="bodyTopFormGroup">
         <el-form
           ref="form"
           :model="form"
-          label-width="80px"
+          label-width="100px"
           inline
           style="display: flex;justify-content: space-between"
         >
           <div class="elForm">
-            <el-form-item label="鏍囧噯缂栫爜" style=" display: flex;">
+            <el-form-item label="鏍囧噯缂栫爜" label-width="70px" style=" display: flex;">
               <el-input v-model="form.repairstandcode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;">
@@ -25,18 +25,23 @@
               <el-input v-model="form.repairstanddescr" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
           </div>
-          <div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
+          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened?'5%':'10%'}">
             <el-button type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
             <el-button type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
           </div>
         </el-form>
+        <div
+          class="bodyTopFormExpand"
+        />
       </div>
 
       <div class="elTableDiv">
         <el-table
+          ref="tableDataRef"
           :data="tableData"
           :height="tableHeight+'px'"
           border
+          class="tableFixed"
           :row-class-name="tableRowClassName"
           :style="{width: 100+'%',height:tableHeight+'px',}"
           highlight-current-row
@@ -138,7 +143,7 @@
         :page.sync="form.page"
         :limit.sync="form.rows"
         align="right"
-        layout="prev, pager, next,sizes"
+        layout="total,prev, pager, next,sizes"
         popper-class="select_bottom"
         @pagination="getDeviceRepairStandArdSearch"
       />
@@ -252,6 +257,7 @@
           <el-table-column
             prop="repairitem_descr"
             label="淇濆吇瑕佹眰"
+            show-tooltip-when-overflow
           >
             <template slot-scope="{row}">
               <div v-if="row.isVisible===0">{{ row.repairitem_descr }}</div>
@@ -298,7 +304,12 @@
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
           <el-button @click="dialogVisibleCancel">鍙� 娑�</el-button>
-          <el-button type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>
+          <el-button
+            type="primary"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            @click="dialogVisibleConfirm"
+          >纭� 瀹�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -367,7 +378,12 @@
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
           <el-button @click="eqpDialogVisibleCancel">鍙� 娑�</el-button>
-          <el-button type="primary" @click="eqpDialogVisibleConfirm">纭� 瀹�</el-button>
+          <el-button
+            type="primary"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            @click="eqpDialogVisibleConfirm"
+          >纭� 瀹�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -387,46 +403,26 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
-import { getCookie } from '@/utils/auth'
+
 import ImportPicker from '@/components/ImportPicker'
 import {
-  AddUpdateDeviceCheckStandArd, AddUpdateDeviceRepairStandArd,
-  DeleteDeviceCheckStaned, DeleteDeviceRepairStaned,
-  DeviceCheckItemSelect,
-  DeviceCheckStandArdSearch,
-  DeviceCheckStanedAssociationEqp, DeviceRepairItemSelect,
-  DeviceRepairStandArdSearch, DeviceRepairStanedAssociationEqp,
-  SaveDeviceCheckStanedAssociationEqp, SaveDeviceRepairStanedAssociationEqp,
-  ViewDeviceCheckStanedSearch, ViewDeviceRepairStanedSearch
+  AddUpdateDeviceRepairStandArd,
+  DeleteDeviceRepairStaned,
+  DeviceRepairItemSelect,
+  DeviceRepairStandArdSearch,
+  DeviceRepairStanedAssociationEqp,
+  SaveDeviceRepairStanedAssociationEqp,
+  ViewDeviceRepairStanedSearch
 } from '@/api/sbgl'
 import $ from 'jquery'
+import { validateCode } from '@/utils/global'
 
-const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
   name: 'Zzjg',
   components: {
     Pagination, ImportPicker
   },
   data() {
-    const validateName = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇疯緭鍏ョ紪鐮�'))
-      } else {
-        if (SER_HZ.test(value)) {
-          return callback(new Error('缂栫爜涓嶈兘涓轰腑鏂�'))
-        } else {
-          callback()
-        }
-      }
-    }
-    const validateTypeCode = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇烽�夋嫨涓婄骇'))
-      } else {
-        callback()
-      }
-    }
     return {
       mainHeight: 0,
       tableHeight: 0,
@@ -462,7 +458,7 @@
       dialogFormRules: {
 
         code: [
-          { required: true, validator: validateName, trigger: ['blur', 'change'] }
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
         ],
         name: [
           { required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: ['blur', 'change'] }
@@ -589,7 +585,7 @@
     },
     // 淇敼鍓嶈姹傛帴鍙�
     async getViewDeviceRepairStanedSearch(repairstand_code) {
-      const { data: res } = await ViewDeviceRepairStanedSearch({ repairstand_code	 })
+      const { data: res } = await ViewDeviceRepairStanedSearch({ repairstand_code })
       this.tableDataDialog = res.Data
 
       this.dialogForm.code = res.code
@@ -601,7 +597,7 @@
         item.isVisible = 0
         item.repairitem_code = item.code
         item.repairitem_name = item.name
-        item.repairitem_descr = item.chkdesc
+        item.repairitem_descr = item.chk_desc
       })
 
       this.repairItemSelectArr = [...this.repairItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.repairitem_code !== x.code))
@@ -645,6 +641,7 @@
     dialogVisibleConfirm() {
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
           this.tableDataDialog.filter(item => item.repairitem_code !== '')
 
           let Data = []
@@ -666,9 +663,10 @@
 
           AddUpdateDeviceRepairStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => {
             if (res.code === '200') {
-              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.dialogVisible = false
+              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.getDeviceRepairStandArdSearch()
+              this.$store.state.app.buttonIsDisabled = false
             } else {
               this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
             }
@@ -781,50 +779,67 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 200
+        this.tableHeight = this.mainHeight - 195
+        this.$refs.tableDataRef.doLayout()
       })
     },
     tableRowClassName({ row, rowIndex }) {
       return 'custom-row'
     },
     // 鍏宠仈璁惧
-    async checkeqpClick(row) {
+    checkeqpClick(row) {
+      const loading = this.$loading({
+        lock: true,
+        text: '姝e湪鍔犺浇鏁版嵁锛岃绋嶇瓑...',
+        spinner: 'el-icon-loading',
+        customClass: 'osloading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+
       this.dialogFormEqp.name = row.name
       this.dialogFormEqp.code = row.code
 
-      const { data: res } = await DeviceRepairStanedAssociationEqp({ repairstand_code: row.code })
-      this.dialogFormEqp.eqpAll = res.filter(item => item.children.length > 0)
+      DeviceRepairStanedAssociationEqp({ repairstand_code: row.code }).then(res => {
+        if (res.code === '200') {
+          setTimeout(() => {
+            loading.close()
+            this.dialogFormEqp.eqpAll = res.data.filter(item => item.children.length > 0)
 
-      if (this.dialogFormEqp.eqpAll.length > 0) {
-        this.dialogFormEqp.eqpAll.forEach((item, index) => {
-          this.dialogFormEqp.eqpArr.push({
-            code: item.code,
-            name: item.name,
-            type: item.type,
-            isSelected1: index === 0,
-            isSelected2: item.flag === 'Y'
-          })
-          if (item.flag === 'Y') {
-            this.$nextTick(() => {
-              $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+            if (this.dialogFormEqp.eqpAll.length > 0) {
+              this.dialogFormEqp.eqpAll.forEach((item, index) => {
+                this.dialogFormEqp.eqpArr.push({
+                  code: item.code,
+                  name: item.name,
+                  type: item.type,
+                  isSelected1: index === 0,
+                  isSelected2: item.flag === 'Y'
+                })
+                if (item.flag === 'Y') {
+                  this.$nextTick(() => {
+                    $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+                  })
+                }
+                if (item.children && item.children.length > 0) {
+                  item.children.forEach(it => {
+                    if (it.flag === 'Y') {
+                      this.dialogFormEqp.eqpCodeSelectedArr.push(it.code)
+                    }
+                  })
+                }
+              })
+              this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴'
+              this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]]
+            }
+
+            this.dialogVisibleEqp = true
+
+            this.$nextTick(() => { // 鏍戝舰鍥炴樉
+              this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr)
             })
-          }
-          if (item.children && item.children.length > 0) {
-            item.children.forEach(it => {
-              if (it.flag === 'Y') {
-                this.dialogFormEqp.eqpCodeSelectedArr.push(it.code)
-              }
-            })
-          }
-        })
-        this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴'
-        this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]]
-      }
-
-      this.dialogVisibleEqp = true
-
-      this.$nextTick(() => { // 鏍戝舰鍥炴樉
-        this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr)
+          }, 1000)
+        } else {
+          loading.close()
+        }
       })
     },
     // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂�
@@ -984,6 +999,7 @@
     eqpDialogVisibleConfirm() {
       // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888)
       // this.dialogVisibleEqp = false
+      this.$store.state.app.buttonIsDisabled = true
       const data = []
       this.dialogFormEqp.eqpAll.forEach((item, index) => {
         if (item.children && item.children.length > 0) {
@@ -1000,9 +1016,10 @@
 
       SaveDeviceRepairStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => {
         if (res.code === '200') {
+          this.dialogVisibleEqp = false
           this.$message.success('鍏宠仈鎴愬姛锛�')
           this.getDeviceRepairStandArdSearch()
-          this.dialogVisibleEqp = false
+          this.$store.state.app.buttonIsDisabled = false
         }
       })
     }
@@ -1175,9 +1192,26 @@
   align-items: center;
   justify-content: center;
 }
+
+.tableFixed {
+  ::v-deep .el-table__fixed-right {
+    height: 100% !important;
+  }
+
+  ::v-deep .el-table__fixed {
+    height: 100% !important;
+  }
+}
+
 </style>
 <style>
+.osloading{
+  font-size: 26px !important;
+}
 
+.el-loading-text{
+  font-size: 26px !important;
+}
 .el-table .custom-row {
   background: #f8f8fa;
 }

--
Gitblit v1.9.3