From 8199d1738e8b75ccad7f3465dfd88aac2bb1a160 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 04 八月 2023 14:56:11 +0800
Subject: [PATCH] 主题库切换树模板流程和阶段显示bug

---
 Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue |  160 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 122 insertions(+), 38 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
index 34a0cec..39bad89 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -1,7 +1,6 @@
 <template>
   <div>
-    <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArrayFlag" class="app">
-
+    <div style="display: flex;flex-wrap: wrap; display: inline-block" v-if="this.crudArrayFlag" class="app" >
       <el-button-group>
       <!--鏂板-->
       <el-button v-if="attrEditVisible == false && attrFlagChiledren==false && editOpenFlag &&  (!checkStatus || crudLCStatus=='Editing' )" size="small" type="primary" icon="el-icon-plus" plain @click="busineHandle">娣诲姞 {{ msg }}</el-button>
@@ -14,7 +13,7 @@
       </el-button-group>
       <el-button-group>
         <!--    淇濆瓨-->
-        <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" size="small" type="success" plain @click="addsHandler" icon="el-icon-check">淇濆瓨</el-button>
+        <el-button v-if="(!checkStatus|| crudLCStatus=='Editing') && editOpenFlag" size="small" type="success" plain @click.prevent="addsHandler" icon="el-icon-check">淇濆瓨</el-button>
         <!--    棰勮鎺掑簭-->
         <el-button size="small" @click="orderHandle" icon="el-icon-arrow-down">棰勮鎺掑簭</el-button>
         <!--    鍒犻櫎-->
@@ -89,6 +88,12 @@
       <el-dialog :visible.sync="enumVisible" append-to-body title="鏋氫妇娉ㄥ叆" :before-close="this.enumBeforeClose">
         <!-- 娓叉煋琛ㄦ牸鍙婃寜閽� -->
         <!-- 娓叉煋琛ㄦ牸鍙婃寜閽� -->
+        <el-alert
+          title="璇锋柊澧炲悗鐐瑰嚮鍗曞厓鏍艰緭鍏ユ灇涓炬暟鎹�"
+          type="success"
+          style="margin-bottom: 10px;display: inline-block"
+          :closable="false">
+        </el-alert>
         <div>
           <el-button icon="el-icon-plus" type="primary" @click="addRow">鏂板</el-button>
           <el-table :data="tableData" style="width: 100%" @cell-click="handleCellClick"
@@ -166,11 +171,11 @@
         </div>
       </el-dialog>
       <!--        灞炴�у垎缁�-->
-      <el-dialog :visible.sync="attrVisible" append-to-body style="width: 800px; left:30vw;top: 10vh ;"
+      <el-dialog :visible.sync="attrVisible" append-to-body :before-close="attrClose" style="width: 800px; left:30vw;top: 10vh ;"
                  title="杈撳叆鍒嗙粍鐨勫悕绉�">
         <el-form ref="form" label-width="70px">
           <el-form-item label="灞炴�у垎缁�">
-            <el-input v-model="attrModel"></el-input>
+            <el-input v-model="attrModel" autofocus></el-input>
           </el-form-item>
           <div style="display: flex;justify-content: flex-end">
             <el-button size="small" type="primary" @click="attrHandle">鎻愪氦</el-button>
@@ -218,7 +223,7 @@
       </el-dialog>
       <!--        鍏ㄥ睆缂栬緫-->
       <el-dialog :visible.sync="attrEditVisible" append-to-body fullscreen="true" :before-close="escEdit" >
-        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :editStyleFlag="editStyleFlag" :editOpenFlag="editOpenFlag" :crudArrayFlag="this.crudArrayFlag"></attrCrud>
+        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" @editCloseChildren="editClose" :editStyleFlag="editStyleFlag" :editOpenFlag="editOpenFlag" :crudArrayFlag="this.crudArrayFlag"></attrCrud>
       </el-dialog>
       <!--      缁勫悎瑙勫垯-->
       <formula-editor :systemVariableTableData="systemVariableTableData"
@@ -327,6 +332,7 @@
 <script>
 import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto,listByFlag} from '@/api/template/templateAttr'
 import {getList} from "@/api/refer/table";
+import func from "@/util/func";
 
 export default {
   name: "attrCrud .vue",
@@ -380,6 +386,11 @@
         if(newval){
           this.editOpenFlag=false
         }
+      }
+    },
+    crudArrayFlag:{
+      handler(newval,olaval){
+        console.log('crudArrayFlag',newval)
       }
     },
     crudArray:{
@@ -1536,12 +1547,15 @@
       }else {
         this.$set(this.attrSelectList[0], 'attributeGroup', this.attrModel)
       }
-      this.attrModel = "";
-      this.attrVisible = false;
+      this.attrClose()
     },
     //灞炴�у垎缁勬竻绌�
     attrRemove() {
       this.attrModel = ""
+    },
+    attrClose(){
+      this.attrModel = "";
+      this.attrVisible=false
     },
     //琛ㄦ牸鏁版嵁
     CrudRend() {
@@ -1677,15 +1691,72 @@
       this.attrRow = row;
     },
     //淇濆瓨
-    addsHandler() {
-      batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
-        this.$message.success('淇濆瓨鎴愬姛')
-        this.editOpenFlag=false
-      }).catch(()=>{
-        this.$message.warning('淇濆瓨澶辫触锛岃鏌ョ湅鎺у埗鍙拌緭鍑猴紒')
+    addsHandler(event) {
+      this.$refs.referAttrCrud.sort("orderNum");
+      var ischeck = true;
+      console.log(this.ProData)
+      this.ProData.forEach((item,index)=>{
+        if((item.requireFlag && item.requireFlag.toString()=='true') && (item.readOnlyFlag && item.readOnlyFlag.toString()=='true')){
+          this.$message.warning(item.name+"("+item.id+")蹇呰緭鐨勫睘鎬т笉鑳芥槸鍙");
+          console.log(item)
+          ischeck=false;
+          return;
+        }
+        var num=0;
+        if(item.componentRule){
+          //缁勫悎瑙勫垯
+          num++
+          console.log('componentRule',num)
+        }
+        if(item.enumString || item.enumId){
+          //鏋氫妇
+          num++
+          console.log('enumString',num)
+        }
+        if(item.referConfig || item.referBtmId){
+          //鍙傜収
+          num++
+          console.log('referConfig',num)
+        }
+        if(item.codeDateFormat){
+          //鏃堕棿鏍煎紡
+          num++
+          console.log('codeDateFormat',num)
+        }
+        //濡傛灉绌哄悗鍙拌繑鍥瀗one
+        if(item.classifyInvokeLevel && item.classifyInvokeLevel != 'none'){
+          //鍒嗙被娉ㄥ叆
+          num++
+          console.log('classifyInvokeLevel',num)
+          console.log(item.classifyInvokeLevel)
+        }
+        if(num>1 && ischeck){
+          this.$message({
+            showClose: true,
+            message: item.name+"("+item.id+") 灞炴�у彧鑳芥槸缁勫悎瑙勫垯锛屾灇涓撅紝鍙傜収锛屾椂闂存牸寮忥紝鍒嗙被娉ㄥ叆涓殑涓�绉�",
+            type: 'warning'
+          });
+          ischeck=false;
+          return;
+        }
       })
+      if(!ischeck){
+        return ;
+      }
+      // 鏂板嚱鏁扮敤浜庢墽琛宐atchAddSave鏂规硶
+      const executeBatchAddSave = () => {
+        batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
+          this.$message.success('淇濆瓨鎴愬姛')
+          this.editOpenFlag=false;
+          // 璋冪敤鐖剁粍浠朵慨鏀规寜閽姸鎬�
+          this.$emit('editCloseChildren')
+        }).catch(()=>{
+          this.$message.warning('淇濆瓨澶辫触锛岃鏌ョ湅鎺у埗鍙拌緭鍑猴紒')
+        });
+      }
+      // 鎵�鏈塱f鏉′欢鍜岄�昏緫閫氳繃鍚庤皟鐢╡xecuteBatchAddSave鍑芥暟
+      executeBatchAddSave();
     },
-
     //琛ㄦ牸琛岀紪杈�
     handleCellClicks(row, column) {
        if(this.editOpenFlag){
@@ -1705,6 +1776,7 @@
            }
            // this.$refs.referConfigFormDialog.onloadAttrData();
          }else if(column.property == 'classifyInvokeText'){
+           this.injectVisible=true;
            if (this.CurrentCell.classifyInvokeAttr != '') {
              this.injectOption = {
                classifyInvokeAttr: this.CurrentCell.classifyInvokeAttr,
@@ -1741,6 +1813,9 @@
            this.rulesVisible=true;
          }else if(column.property == 'attributeGroup'){
            this.attrVisible = true;
+           if(this.CurrentCell.attributeGroup !== ''){
+                this.attrModel=this.CurrentCell.attributeGroup
+           }
          }
        }
     },
@@ -1792,29 +1867,33 @@
     },
     //鏋氫妇娉ㄥ叆淇濆瓨
     enumAddHandle() {
-      let hasError = false; // 娣诲姞涓�涓彉閲�
-      this.tableData.forEach((item, index) => {
-        if (item.key === '') {
-          this.$message.warning(`绗�${index + 1}琛岀殑閫夐」鍊间笉鑳戒负绌篳);
-          hasError = true;
-          return;
-        } else if (item.value === '') {
-          this.$message.warning(`绗�${index + 1}琛岀殑閫夐」涓枃鏍囩涓嶈兘涓虹┖`);
-          hasError = true;
-          return;
-        }
-      });
-        // 淇濆瓨鎵ц閫昏緫
-      if (!hasError) {
-        if (this.CurrentCell) {
-          this.$set(this.CurrentCell, 'enumString', JSON.stringify(this.tableData));
-          this.enumVisible = false;
-        } else {
-          this.$set(this.attrSelectList[0], 'enumString', JSON.stringify(this.tableData));
-          this.tableData=[];
-          this.enumVisible = false;
-        }
-      }
+     if(this.tableData.length>=1){
+       let hasError = false; // 娣诲姞涓�涓彉閲�
+       this.tableData.forEach((item, index) => {
+         if (item.key === '') {
+           this.$message.warning(`绗�${index + 1}琛岀殑閫夐」鍊间笉鑳戒负绌篳);
+           hasError = true;
+           return;
+         } else if (item.value === '') {
+           this.$message.warning(`绗�${index + 1}琛岀殑閫夐」涓枃鏍囩涓嶈兘涓虹┖`);
+           hasError = true;
+           return;
+         }
+       });
+       // 淇濆瓨鎵ц閫昏緫
+       if (!hasError) {
+         if (this.CurrentCell) {
+           this.$set(this.CurrentCell, 'enumString', JSON.stringify(this.tableData));
+           this.enumVisible = false;
+         } else {
+           this.$set(this.attrSelectList[0], 'enumString', JSON.stringify(this.tableData));
+           this.tableData=[];
+           this.enumVisible = false;
+         }
+       }
+     }else {
+       this.$message.warning('璇锋坊鍔犳灇涓炬敞鍏ユ暟鎹紒')
+     }
     },
     // 灏嗘鍦ㄧ紪杈戠殑琛岀殑鐘舵�佸彉涓� null锛屽嵆閫�鍑虹紪杈戠姸鎬�
     saveRow() {
@@ -1889,6 +1968,7 @@
           this.$set(this.attrSelectList[0],'classifyInvokeText',data)
         }
         this.injectHandleReset()
+
       if(this.injectOption.classifyInvokeLevel !== 'min'){
         this.injectOption.classifyInvokeLevel=this.injectOption.classifyNumber;
       }else  {
@@ -1995,6 +2075,10 @@
     editOpen(){
       this.editOpenFlag=true;
     },
+    //瀹氫箟涓�涓叧闂紪杈戠殑鏂规硶渚涘瓙缁勪欢浣跨敤
+    editClose(){
+      this.editOpenFlag=false;
+    },
     //鎵归噺璁剧疆switch
     batchSetFlag(value){
       this.attrSelectList.forEach(item=>{

--
Gitblit v1.9.3