From 4156640e66d90d41e8bc933eb774296375218df5 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 24 十月 2024 18:00:11 +0800
Subject: [PATCH] 表单定义 新增表单添加查询明白 自定义组件添加选择属性

---
 Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue |  126 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 116 insertions(+), 10 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue
index cabe032..b57d37c 100644
--- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue
+++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/formDefine/components/formDialog.vue
@@ -30,12 +30,15 @@
               <div style="display: flex;justify-content: center">
                 <span style="display: flex;align-items: center; margin-right: 5px;">
                  <p class="tableTopLabel">鍚嶇О锛�</p>
-                 <el-input v-model="topForm.viName" placeholder="璇疯緭鍏ュ唴瀹�" size="mini"></el-input>
+                 <el-input v-model="topForm.viName" placeholder="璇疯緭鍏ュ悕绉�" size="mini"></el-input>
                 </span>
 
                 <span style="display: flex;align-items: center; margin-right: 5px;">
                  <p class="tableTopLabel">鏌ヨ妯℃澘鍚嶇О锛�</p>
-                 <el-input v-model="form.itemQtName" placeholder="璇疯緭鍏ユ煡璇㈡ā鏉垮悕绉�" size="mini"></el-input>
+                  <el-select v-model="form.itemQtName" placeholder="璇烽�夋嫨鏌ヨ妯℃澘" size="mini">
+                    <el-option v-for="(item,index) in searchQtNameList" :key="index" :label="item.qtName"
+                       :value="item.qtName"></el-option>
+                  </el-select>
                 </span>
 
                 <span style="display: flex;align-items: center; margin-right: 5px;">
@@ -129,7 +132,8 @@
               </el-button>
               <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addCustomClickHandler">娣诲姞鑷畾涔夌粍浠�
               </el-button>
-              <el-button icon="el-icon-zoom-in" plain size="small" type="primary" @click="checkViewHandler" >棰勮</el-button>
+              <el-button icon="el-icon-zoom-in" plain size="small" type="primary" @click="checkViewHandler">棰勮
+              </el-button>
             </div>
           </basic-container>
         </el-main>
@@ -668,6 +672,29 @@
          <el-button type="primary" @click="customSaveHandler">纭� 瀹�</el-button>
     </span>
     </el-dialog>
+    <!-- 娣诲姞鑷畾涔夌粍浠堕�夋嫨灞炴�ф睜灞炴�у璇濇  -->
+    <el-dialog
+      v-dialogDrag
+      :visible.sync="customAttrVisible"
+      append-to-body="true"
+      class="avue-dialog"
+      title="閫夋嫨灞炴��"
+      width="50%">
+      <avue-crud
+        ref="userCrud"
+        :data="customAttrData"
+        :option="customAttrOption"
+        :page.sync="page"
+        :table-loading="customAttrLoading"
+        @row-click="customAttrRowClickHandler"
+      >
+      </avue-crud>
+      <span slot="footer" class="dialog-footer">
+         <el-button @click="customAttrVisible = false">鍙� 娑�</el-button>
+         <el-button type="primary" @click="customAttrSaveHandler">纭� 瀹�</el-button>
+    </span>
+    </el-dialog>
+    <!-- 棰勮  -->
     <el-dialog
       v-dialogDrag
       :visible.sync="checkViewVisible"
@@ -748,8 +775,10 @@
 </template>
 
 <script>
-import {getTreeAttributes, savePortalVI} from "@/api/UI/formDefine/api";
+import {getObjTypeQTs, getTreeAttributes, savePortalVI} from "@/api/UI/formDefine/api";
 import func from "@/util/func";
+import basicOption from "@/util/basic-option";
+import {gridAttribute} from "@/api/modeling/attributePool/api";
 
 export default {
   name: "formDialog",
@@ -771,6 +800,51 @@
   },
   data() {
     return {
+      searchQtNameList:[],
+      customAttrRow: {},
+      customAttrOption: {
+        ...basicOption,
+        calcHeight: -60,
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        menu: false,
+        refreshBtn: false,
+        highlightCurrentRow: true,
+        selection: false,
+        column: [
+          {
+            label: '灞炴�у悕',
+            prop: 'id',
+            sortable: true,
+          },
+          {
+            label: '鏍囩',
+            prop: 'name',
+            sortable: true,
+          },
+          {
+            label: '绫诲瀷',
+            prop: 'attributeDataTypeText',
+            sortable: true,
+            width: 100
+          },
+          {
+            label: '榛樿鍊�',
+            prop: 'defaultValue',
+            sortable: true,
+            width: 120
+          },
+          {
+            label: '鎻忚堪',
+            prop: 'description',
+            overHidden: true,
+          },
+        ]
+      },
+      customAttrData: [],
+      customAttrLoading: false,
+      customAttrVisible: false,
       checkViewVisible: false,
       optionObj: {
         optionName: '',
@@ -954,6 +1028,7 @@
           this.treeLoading = false;
         }
       })
+      this.getSearchSelectList();
     },
 
     // 寮�濮嬫嫋鎷芥爲鑺傜偣浜嬩欢
@@ -1139,11 +1214,11 @@
     // 淇濆瓨鎸夐挳
     saveClickHandler() {
       if (!this.topForm.viName) {
-        this.$message.error('鍚嶇О涓嶈兘涓虹┖');
+        this.$message.error('琛ㄥ崟鍚嶇О涓嶈兘涓虹┖');
         return;
       }
       if (this.formList.length <= 0) {
-        this.$message.error('椤甸潰涓嶈兘涓虹┖');
+        this.$message.error('椤甸潰瀹氫箟涓嶈兘涓虹┖');
         return;
       }
       this.formList = this.formList.map(item => {
@@ -1207,7 +1282,7 @@
         return;
       }
       const status = this.formList.some(item => item.text === this.customForm.text);
-      if(status){
+      if (status) {
         this.$message.error('璇锋鏌ユ槸鍚︽坊鍔犵浉鍚岄」');
         return;
       }
@@ -1238,14 +1313,38 @@
       this.customForm.itemListTable = this.customForm.itemListTxt = this.customForm.itemListVal = this.customForm.itemStyle = "";
     },
 
+    // 鑷畾涔夎〃鍗曚娇鐢ㄥ瓧娈佃〃鏍艰鐐瑰嚮
+    customAttrRowClickHandler(row) {
+      this.customAttrRow = row;
+    },
+
     // 鑷畾涔夎〃鍗曚娇鐢ㄥ瓧娈甸�夋嫨
     customTextHandler() {
+      this.customAttrVisible = true;
+      this.customAttrLoading = true
+      gridAttribute().then(res => {
+        const data = res.data.data;
+        this.customAttrData = data;
+        this.customAttrLoading = false;
+      }).catch(err => {
+        this.$message.error(err)
+      });
+    },
 
+    // 鑷畾涔夎〃鍗曚娇鐢ㄥ瓧娈典繚瀛�
+    customAttrSaveHandler() {
+      if (func.isEmptyObject(this.customAttrRow)) {
+        this.$message.error('璇烽�夋嫨涓�鏉℃暟鎹繘琛屼繚瀛�');
+        return;
+      }
+      // console.log(this.customAttrRow)
+      this.customForm.text = this.customAttrRow.id;
+      this.customAttrVisible = false;
     },
 
     // 鍙充晶琛ㄥ崟搴旂敤鎸夐挳
     asideFormHandler() {
-      if(!this.form.text){
+      if (!this.form.text) {
         this.$message.error('璇锋坊鍔犱竴鏉℃暟鎹繘琛屼繚瀛橈紒');
         return;
       }
@@ -1257,9 +1356,16 @@
     },
 
     // 棰勮鎸夐挳
-    checkViewHandler(){
+    checkViewHandler() {
       this.checkViewVisible = true;
-    }
+    },
+
+    // 鏌ヨ妯℃澘涓嬫媺鎺ュ彛鏌ヨ
+    getSearchSelectList() {
+      getObjTypeQTs({btName: this.treeRadio === '0' ? this.TreeNodeRow.id : this.TreeNodeRow.name}).then(res => {
+        this.searchQtNameList = res.data.data;
+      })
+    },
 
   }
 }

--
Gitblit v1.9.3