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/sbqd.vue |  120 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 83 insertions(+), 37 deletions(-)

diff --git a/src/views/sbgl/sbqd.vue b/src/views/sbgl/sbqd.vue
index 89cd85d..6c58af2 100644
--- a/src/views/sbgl/sbqd.vue
+++ b/src/views/sbgl/sbqd.vue
@@ -2,10 +2,13 @@
   <div>
     <div class="body" :style="{height:mainHeight+'px'}">
 
-      <div class="bodyTopButtonGroup">
+      <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-c-scale-to-original" @click="deviceTypeButton">璁惧绫诲瀷</el-button>
-        <el-button icon="el-icon-document-copy" @click="deviceGroupButton">璁惧缁�</el-button>
+        <div style="display: flex">
+          <el-button icon="el-icon-c-scale-to-original" @click="deviceTypeButton">璁惧绫诲瀷</el-button>
+          <el-button icon="el-icon-document-copy" @click="deviceGroupButton">璁惧缁�</el-button>
+        </div>
+
         <!--        <el-button type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>-->
       </div>
 
@@ -13,12 +16,12 @@
         <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;">
+          <div class="elForm" style="justify-content: flex-start">
+            <el-form-item label-width="70px" label="璁惧缂栫爜" style=" display: flex;">
               <el-input v-model="form.DeviceCode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="璁惧鍚嶇О" style=" display: flex;">
@@ -57,14 +60,13 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item filterable label="璁惧绫诲瀷" style="display: flex;">
+            <el-form-item v-show="isExpandForm" label-width="70px" filterable label="璁惧绫诲瀷" style="display: flex;">
               <el-select
                 v-model="form.DeviceType"
                 :popper-append-to-body="false"
                 style="width: 200px"
                 filterable
                 placeholder="璇烽�夋嫨"
-
                 @change="deviceTypeChange"
               >
                 <!--                @focus="getDeviceTypeSelect"-->
@@ -76,7 +78,7 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item label="璁惧缁�" style=" display: flex;">
+            <el-form-item v-show="isExpandForm" label="璁惧缁�" style=" display: flex;">
               <el-select
                 v-model="form.DeviceGroup"
                 filterable
@@ -94,21 +96,40 @@
               </el-select>
             </el-form-item>
           </div>
-          <div style="display: flex;align-items: start;margin-top: 5px;">
+          <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"
+        >
+          <svg-icon
+            v-show="mouseHoverType==='mouseout'"
+            style="cursor: pointer"
+            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"
+            @mouseenter="mouseHoverType=$event.type"
+          />
+          <svg-icon
+            v-show="mouseHoverType==='mouseenter'"
+            style="cursor: pointer"
+            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"
+            @click="isExpandForm=!isExpandForm"
+            @mouseout="mouseHoverType=$event.type"
+          />
+        </div>
       </div>
 
-      <div class="elTableDiv">
+      <div class="elTableDiv" style="margin-top: 0;">
         <el-table
+          ref="tableDataRef"
           :data="tableData"
           border
-          :height="tableHeight+'px'"
+          class="tableFixed"
+          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
           highlight-current-row
           :row-class-name="tableRowClassName"
-          :style="{width: 100+'%',height:(tableHeight-50)+'px'}"
+          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
           :header-cell-style="this.$headerCellStyle"
           :cell-style="this.$cellStyle"
           @sort-change="sortChange"
@@ -144,6 +165,7 @@
           <el-table-column
             prop="eqpgroup_name"
             label="璁惧缁�"
+            show-tooltip-when-overflow
             min-width="110"
             sortable="custom"
           />
@@ -186,7 +208,8 @@
             width="100"
           >
             <template slot-scope="{row}">
-              <div>{{ row.operation_ration }}%</div>
+              <div v-if=" parseFloat(row.operation_ration)===0">/</div>
+              <div v-else>{{ row.operation_ration }}%</div>
             </template>
           </el-table-column>
           <el-table-column
@@ -221,7 +244,6 @@
       </div>
       <!--鍒嗛〉-->
       <pagination
-        v-show="total>0"
         :total="total"
         :page.sync="form.page"
         :limit.sync="form.rows"
@@ -352,7 +374,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>
@@ -386,6 +413,7 @@
           width="50"
           label="搴忓彿"
           prop="RowNum"
+          fixed
         />
         <el-table-column
           prop="code"
@@ -393,7 +421,7 @@
           sortable="custom"
         >
           <template slot-scope="{row}">
-            <el-input v-if="row.isVisible===1" v-model="row.code" placeholder="璇疯緭鍏�" />
+            <el-input v-if="row.isVisible===1" v-model="row.code" oninput="value=value.replace(/[^0-9a-zA-Z]/g,'')" placeholder="璇疯緭鍏�" />
             <div v-else> {{ row.code }}</div>
           </template>
         </el-table-column>
@@ -429,7 +457,6 @@
       </el-table>
       <!--鍒嗛〉-->
       <pagination
-        v-show="DeviceTypeTotal>0"
         :total="DeviceTypeTotal"
         :page.sync="formDeviceType.page"
         :limit.sync="formDeviceType.rows"
@@ -475,6 +502,7 @@
         <el-table-column
           width="50"
           label="搴忓彿"
+          fixed
           prop="RowNum"
         />
         <el-table-column
@@ -483,7 +511,7 @@
           sortable="custom"
         >
           <template slot-scope="{row}">
-            <el-input v-if="row.isVisible===1" v-model="row.code" placeholder="璇疯緭鍏�" />
+            <el-input v-if="row.isVisible===1"v-model="row.code" oninput="value=value.replace(/[^0-9a-zA-Z]/g,'')" placeholder="璇疯緭鍏�" />
             <div v-else> {{ row.code }}</div>
           </template>
         </el-table-column>
@@ -542,7 +570,6 @@
       </el-table>
       <!--鍒嗛〉-->
       <pagination
-        v-show="DeviceGroupTotal>0"
         :total="DeviceGroupTotal"
         :page.sync="formDeviceGroup.page"
         :limit.sync="formDeviceGroup.rows"
@@ -569,7 +596,7 @@
 import Pagination from '@/components/Pagination'
 import {
   AddUpdateDeviceGroup, AddUpdateDeviceManger,
-  AddUpdateDeviceType, DeleteDeviceManger, DeleteDeviceType,
+  AddUpdateDeviceType, DeleteDeviceGroup, DeleteDeviceManger, DeleteDeviceType,
   DeviceGroupSearch,
   DeviceMangerSearch,
   DeviceTypeSearch,
@@ -577,27 +604,17 @@
   DeviceTypeSelectGroup,
   WorkShopSelect, WorkShopSelectLine
 } from '@/api/sbgl'
-import { handleDatetime } from '@/utils/global'
+import { handleDatetime, validateCode } from '@/utils/global'
 
-const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
   name: 'SBQD',
   components: {
     Pagination
   },
   data() {
-    const validateName = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇疯緭鍏ョ紪鐮�'))
-      } else {
-        if (SER_HZ.test(value)) {
-          return callback(new Error('缂栫爜涓嶈兘涓轰腑鏂�'))
-        } else {
-          callback()
-        }
-      }
-    }
     return {
+      mouseHoverType: 'mouseout',
+      isExpandForm: false,
       mainHeight: 0,
       tableHeight: 0,
       form: {
@@ -639,7 +656,7 @@
       operation: '',
       dialogFormRules: {
         devicecode: [
-          { required: true, validator: validateName, trigger: ['blur', 'change'] }
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
         ],
         devicename: [
           { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] }
@@ -793,6 +810,9 @@
         DeleteDeviceManger({ devicecode: row.code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
             this.getDeviceMangerSearch()
           }
         })
@@ -834,6 +854,7 @@
     dialogVisibleConfirm() {
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
           const data = {
             id: this.dialogForm.id,
             devicecode: this.dialogForm.devicecode,
@@ -850,9 +871,10 @@
           }
           AddUpdateDeviceManger(data).then(res => {
             if (res.code === '200') {
-              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.dialogVisible = false
+              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.getDeviceMangerSearch()
+              this.$store.state.app.buttonIsDisabled = false
             } else {
               this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
             }
@@ -864,7 +886,8 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 240
+        this.tableHeight = this.mainHeight - 245
+        this.$refs.tableDataRef.doLayout()
         // if (window.innerHeight < 769) {
         //   this.tableHeight = this.tableHeight - 50
         // }
@@ -926,6 +949,9 @@
         DeleteDeviceType({ devicetypecode: row.code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
+            if (this.formDeviceType.page > 1 && this.DeviceTypeArray.length === 1) {
+              this.formDeviceType.page--
+            }
             this.getDeviceTypeSearchDialog()
           }
         })
@@ -1040,6 +1066,9 @@
         DeleteDeviceGroup({ devicegroupcode: row.code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
+            if (this.formDeviceGroup.page > 1 && this.DeviceGroupArray.length === 1) {
+              this.formDeviceGroup.page--
+            }
             this.getDeviceGroupSearchDialog()
           }
         })
@@ -1096,6 +1125,10 @@
 <!--鍏叡椤甸潰鏍峰紡-->
 <style lang="scss" scoped>
 $main_color: #42b983;
+::v-deep .el-button--text{
+  font-size: 14px ;
+  cursor: pointer ;
+}
 .el-icon-share ,.el-icon-delete,.el-icon-edit-outline{
   color: $main_color;
   cursor: pointer;
@@ -1181,7 +1214,20 @@
 .userDialogVisible ::v-deep .el-form-item {
   margin-bottom: 0;
 }
+::v-deep .el-select__caret{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
 
+.tableFixed{
+  ::v-deep .el-table__fixed-right{
+    height: 100% !important;
+  }
+  ::v-deep .el-table__fixed{
+    height: 100% !important;
+  }
+}
 </style>
 <style>
 

--
Gitblit v1.9.3