From 6b32ec29b1cd3ed12845d543e18da18f8456cdda Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 18 十月 2022 18:18:33 +0800
Subject: [PATCH] 1.安灯设置开发完成

---
 src/views/zlgl/gxjybz.vue |  109 ++++++++++++++++++++++++------------------------------
 1 files changed, 48 insertions(+), 61 deletions(-)

diff --git a/src/views/zlgl/gxjybz.vue b/src/views/zlgl/gxjybz.vue
index 59176f3..29c33dc 100644
--- a/src/views/zlgl/gxjybz.vue
+++ b/src/views/zlgl/gxjybz.vue
@@ -10,12 +10,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="鏍囧噯浠g爜" style=" display: flex;">
+            <el-form-item label-width="70px" label="鏍囧噯浠g爜" style=" display: flex;">
               <el-input v-model="form.stanedcode" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鏍囧噯鍚嶇О" style=" display: flex;">
@@ -25,14 +25,19 @@
               <el-input v-model="form.staneddescr" style="width: 200px" placeholder="璇疯緭鍏�" />
             </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"
+          class="tableFixed"
           :data="tableData"
           :height="tableHeight+'px'"
           border
@@ -127,8 +132,8 @@
       :top="isIpad?'5vh':'15vh'"
       :close-on-click-modal="false"
       @closed="handleClose"
-      @close="handleClose"
     >
+      <!--      @close="handleClose"-->
       <div style="margin-bottom: 10px">
         <i class="el-icon-s-comment" style="color:#42b983;" /> 鏍囧噯淇℃伅锛�
       </div>
@@ -159,7 +164,7 @@
         <i class="el-icon-s-comment" style="color:#42b983;" /> 妫�楠岄」淇℃伅锛�
       </div>
       <div style="margin-bottom: 10px">
-        <el-button v-if="operation==='add'" type="primary" @click="JYadd">鏂板</el-button>
+        <el-button v-if="operation==='add'||operation==='edit'" type="primary" @click="JYadd">鏂板</el-button>
       </div>
       <div>
         <el-table
@@ -179,33 +184,6 @@
             width="100"
             fixed
           />
-          <!--          <el-table-column-->
-          <!--            prop="code"-->
-          <!--            label="妫�楠屾爣鍑嗙紪鐮�(鍚嶇О)"-->
-          <!--          >-->
-          <!--            <template slot-scope="{row}">-->
-          <!--              <div v-if="row.isVisible===0" style="display: flex;">-->
-          <!--                <div>{{ row.code }}</div>-->
-          <!--                <div style="margin-left: 10px">{{ row.name }}</div>-->
-          <!--              </div>-->
-          <!--              <el-select-->
-          <!--                v-if="row.isVisible===1"-->
-          <!--                v-model="row.code"-->
-          <!--                filterable-->
-          <!--                :popper-append-to-body="false"-->
-          <!--                style="width: 400px;"-->
-          <!--                placeholder="璇烽�夋嫨"-->
-          <!--                @change="val=>changeCode(val,row)"-->
-          <!--              >-->
-          <!--                <el-option-->
-          <!--                  v-for="item in JYSelectArr"-->
-          <!--                  :key="item.code"-->
-          <!--                  :label="item.code+''+item.name"-->
-          <!--                  :value="item.code"-->
-          <!--                />-->
-          <!--              </el-select>-->
-          <!--            </template>-->
-          <!--          </el-table-column>-->
           <el-table-column
             prop="code"
             label="妫�楠屾爣鍑嗙紪鐮�"
@@ -280,7 +258,13 @@
         <div class="footerButton">
           <el-button v-if="operation==='check'" @click="dialogVisibleCancel">杩� 鍥�</el-button>
           <el-button v-if="operation!=='check'" @click="dialogVisibleCancel">鍙� 娑�</el-button>
-          <el-button v-if="operation!=='check'" type="primary" @click="dialogVisibleConfirm">鎻� 浜�</el-button>
+          <el-button
+            v-if="operation!=='check'"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            type="primary"
+            @click="dialogVisibleConfirm"
+          >鎻� 浜�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -295,32 +279,14 @@
   StepCheckItemSelect,
   StepCheckStanedSearch
 } from '@/api/zlgl'
+import { validateCode } from '@/utils/global'
 
-const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
   name: 'ZJBZ',
   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()
-        }
-      }
-    }
-    const validateTypeCode = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇烽�夋嫨涓婄骇'))
-      } else {
-        callback()
-      }
-    }
     return {
       isIpad: false,
       mainHeight: 0,
@@ -346,7 +312,7 @@
       operation: '',
       dialogFormRules: {
         code: [
-          { required: true, validator: validateName, trigger: ['blur', 'change'] }
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
         ],
         name: [
           { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] }
@@ -445,6 +411,8 @@
       this.$nextTick(() => {
         this.$refs.JYTableData.doLayout()
       })
+
+      this.JYSelectArr = [...this.JYSelectArr].filter(x => [...this.JYTableData].every(y => y.code !== x.code))
     },
     // 鍒犻櫎鎸夐挳
     async del(row) {
@@ -456,6 +424,9 @@
         DeleteStepCheckStaned({ stanedcode: row.code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
             this.getStepCheckStanedSearch()
           }
         })
@@ -481,7 +452,9 @@
     dialogVisibleConfirm() {
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
           const tableData = []
+          this.JYTableData = this.JYTableData.filter(item => item.code !== '')
           this.JYTableData.forEach((item, index) => {
             tableData.push({
               STEPCHECKITEM_SEQ: (index + 1),
@@ -498,9 +471,10 @@
           }
           AddUpdateStepCheckStaned(this.operation === 'add' ? 'Add' : 'Update', data).then(res => {
             if (res.code === '200') {
-              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.dialogVisible = false
+              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.getStepCheckStanedSearch()
+              this.$store.state.app.buttonIsDisabled = false
             } else {
               this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
             }
@@ -512,8 +486,9 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 200
+        this.tableHeight = this.mainHeight - 195
         this.isIpad = window.innerHeight < 769
+        this.$refs.tableDataRef.doLayout()
         // if (window.innerHeight < 769) {
         //   this.tableHeight = this.tableHeight - 50
         // }
@@ -524,11 +499,6 @@
       const { data: res } = await StepCheckItemSelect()
       this.JYSelectArr = res
     },
-    // 妫�楠屾爣鍑嗙紪鐮佸�兼敼鍙�
-    // changeCode(val, row) {
-    //   row.name = this.JYSelectArr.find(it => it.code === val).name
-    //   row.descr = this.JYSelectArr.find(it => it.code === val).descr
-    // },
     // 妫�楠屾爣鍑嗗悕绉板�兼敼鍙�
     changeName(val, row) {
       const res = this.JYSelectArr.find(item => {
@@ -551,6 +521,16 @@
       this.JYIsCancel = false
     },
     JYedit(row) {
+      let flag = false
+      this.JYTableData.forEach((item, index) => {
+        if (item.isVisible === 1) {
+          flag = true
+        }
+      })
+      if (flag) {
+        return this.$message.info('璇峰厛纭鎴栧彇娑堝叾瀹冭锛�')
+      }
+
       this.JYIsCancel = false
       this.JYSelectArr.splice(0, 0, {
         code: row.code,
@@ -731,7 +711,14 @@
 .userDialogVisible ::v-deep .el-form-item {
   margin-bottom: 0;
 }
-
+.tableFixed{
+  ::v-deep .el-table__fixed-right{
+    height: 100% !important;
+  }
+  ::v-deep .el-table__fixed{
+    height: 100% !important;
+  }
+}
 </style>
 <style>
 

--
Gitblit v1.9.3