From 5eeb8864bebb1dc4f97f2feef32b742d8a9a10d5 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 14 九月 2022 15:43:04 +0800
Subject: [PATCH] 1.新增报表管理菜单

---
 src/views/zlgl/gxjybz.vue |   74 ++++++++++---------------------------
 1 files changed, 20 insertions(+), 54 deletions(-)

diff --git a/src/views/zlgl/gxjybz.vue b/src/views/zlgl/gxjybz.vue
index 59176f3..4296788 100644
--- a/src/views/zlgl/gxjybz.vue
+++ b/src/views/zlgl/gxjybz.vue
@@ -127,8 +127,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 +159,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 +179,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="妫�楠屾爣鍑嗙紪鐮�"
@@ -295,32 +268,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 +301,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 +400,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 +413,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()
           }
         })
@@ -482,6 +442,7 @@
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
           const tableData = []
+          this.JYTableData = this.JYTableData.filter(item => item.code !== '')
           this.JYTableData.forEach((item, index) => {
             tableData.push({
               STEPCHECKITEM_SEQ: (index + 1),
@@ -524,11 +485,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 +507,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,

--
Gitblit v1.9.3