From 3c6c92b68a1b113b5450554db750ebe1d8bd26bb Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 20 九月 2024 15:16:14 +0800
Subject: [PATCH] 整合代码 action管理

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue |  133 +++++++++++++++++++++++++-------------------
 1 files changed, 75 insertions(+), 58 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue
index f6d274e..16b6cb2 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/enumType/index.vue
@@ -16,7 +16,7 @@
         >
 
           <template slot="menuLeft" slot-scope="scope">
-            <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">鍒涘缓</el-button>
+            <el-button icon="el-icon-plus" plain size="small" type="primary" @click="rowSaveHandlerClick">鍒涘缓</el-button>
             <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">鍒犻櫎</el-button>
             <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">鏌ョ湅浣跨敤鑼冨洿</el-button>
             <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">涓嬭浇瀵煎叆妯℃澘
@@ -84,9 +84,9 @@
           </el-form>
 
           <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="rowSaveHandler">纭� 瀹�</el-button>
-        <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
-      </span>
+            <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+            <el-button type="primary" @click="rowSaveHandler">纭� 瀹�</el-button>
+          </span>
         </el-dialog>
 
         <!-- 鏌ョ湅浣跨敤鑼冨洿    -->
@@ -97,7 +97,7 @@
           append-to-body="true"
           class="avue-dialog"
           title="鏌ョ湅浣跨敤鑼冨洿"
-          width="70%"
+          width="60%"
         >
           <avue-crud
             ref="checkViewCrud"
@@ -243,6 +243,7 @@
       dialogData: [],
       dialogOption: {
         ...basicOption,
+        calcHeight: 50,
         refreshBtn: false,
         selection: false,
         column: [
@@ -320,7 +321,8 @@
       },
       tableLoading: false,
       selectList: [],
-      searchParams: {}
+      searchParams: {},
+      lastIndex: null
     }
   },
   computed: {
@@ -366,13 +368,22 @@
 
     // 閫夋嫨妗�
     selectChange(row) {
-      console.log(row)
       this.selectList = row;
     },
 
     // 鐐瑰嚮琛�
     rowClickHandler(row) {
-      this.$refs.userCrud.toggleRowSelection(row);
+      func.rowClickHandler(
+        row,
+        this.$refs.userCrud,
+        this.lastIndex,
+        (newIndex) => {
+          this.lastIndex = newIndex;
+        },
+        () => {
+          this.selectList = [];
+        }
+      );
     },
 
     // 鍏抽棴瀵硅瘽妗�
@@ -466,61 +477,67 @@
 
     // 瀵硅瘽妗嗘灇涓句繚瀛�
     rowSaveHandler() {
-      const lengthStatus = this.dialogData.some(item => item.value.length > this.form.length)
-      if (lengthStatus) {
-        this.$message.error('璇锋鏌ユ灇涓惧�兼槸鍚﹁秴杩囨渶澶ч暱搴︼紒')
-        return;
-      }
-
-      if (this.form.enumValueDataType === "Integer") {
-        // 鍒ゆ柇鏄惁鍖呭惈闈炴暟瀛楀瓧绗�
-        const integerStatus = this.dialogData.some(item => {
-          if (!/^\-?\d+$/.test(item.value)) {
-            return true;
+      const lengthStatus = this.dialogData.some(item => item.value.length > this.form.length);
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          if (lengthStatus) {
+            this.$message.error('璇锋鏌ユ灇涓惧�兼槸鍚﹁秴杩囨渶澶ч暱搴︼紒')
+            return;
           }
-        })
 
-        // 鍒ゆ柇鏄惁鏄痠nteger鏍煎紡
-        const integerNumStatus = this.dialogData.some(item => {
-          let numValue = parseInt(item.value);
-          if (isNaN(numValue) || !Number.isInteger(numValue)) {
-            return true;
+          if (this.form.enumValueDataType === "Integer") {
+            // 鍒ゆ柇鏄惁鍖呭惈闈炴暟瀛楀瓧绗�
+            const integerStatus = this.dialogData.some(item => {
+              if (!/^\-?\d+$/.test(item.value)) {
+                return true;
+              }
+            })
+
+            // 鍒ゆ柇鏄惁鏄痠nteger鏍煎紡
+            const integerNumStatus = this.dialogData.some(item => {
+              let numValue = parseInt(item.value);
+              if (isNaN(numValue) || !Number.isInteger(numValue)) {
+                return true;
+              }
+            })
+
+            if (integerStatus || integerNumStatus) {
+              this.$message.error('鏋氫妇鍊煎繀椤绘槸Integer绫诲瀷');
+              return;
+            }
           }
-        })
 
-        if (integerStatus || integerNumStatus) {
-          this.$message.error('鏋氫妇鍊煎繀椤绘槸Integer绫诲瀷');
-          return;
+          if (this.dialogType === 'add') {
+            let params = {
+              ...this.form,
+              items: this.dialogData
+            }
+            addEnumType(params).then(res => {
+              if (res.data.code === 200) {
+                this.$message.success(res.data.obj);
+                this.dialogVisible = false;
+                this.getTableList();
+              }
+            })
+          } else if (this.dialogType === 'edit') {
+            let params = {
+              ...this.form,
+              items: this.dialogData,
+              oid: this.editRow.oid,
+              ts: this.editRow.ts
+            }
+            updateEnumType(params).then(res => {
+              if (res.data.code === 200) {
+                this.$message.success(res.data.obj);
+                this.dialogVisible = false;
+                this.getTableList();
+              }
+            })
+          }
+        } else {
+          return false;
         }
-      }
-
-      if (this.dialogType === 'add') {
-        let params = {
-          ...this.form,
-          items: this.dialogData
-        }
-        addEnumType(params).then(res => {
-          if (res.data.code === 200) {
-            this.$message.success(res.data.obj);
-            this.dialogVisible = false;
-            this.getTableList();
-          }
-        })
-      } else if (this.dialogType === 'edit') {
-        let params = {
-          ...this.form,
-          items: this.dialogData,
-          oid: this.editRow.oid,
-          ts: this.editRow.ts
-        }
-        updateEnumType(params).then(res => {
-          if (res.data.code === 200) {
-            this.$message.success(res.data.obj);
-            this.dialogVisible = false;
-            this.getTableList();
-          }
-        })
-      }
+      });
     },
 
     // 鏋氫妇椤规柊澧�

--
Gitblit v1.9.3