From 021db80b57a7bd79eda3ef718b33320ea4be2470 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期一, 18 九月 2023 14:12:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue |   47 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue
index e69ddc8..8247fdc 100644
--- a/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue
+++ b/Source/UBCS-WEB/src/components/refer/vciWebReferTree.vue
@@ -1,5 +1,5 @@
 <template>
-  <avue-input-tree ref="referTree" :props="props" :lazy="lazy" :tree-load="treeLoad" :node-click="nodeClick" :checked="checked" :leaf-only="referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="title" :dic="treeData"></avue-input-tree>
+  <avue-input-tree ref="referTree" :props="props" :disabled="disabled" :lazy="lazy" :tree-load="treeLoad" :node-click="nodeClick" :checked="checked" :leaf-only="referConfig.onlyLeaf" :multiple="isMuti" v-model="value" :placeholder="title" :dic="treeData"></avue-input-tree>
 </template>
 
 <script>
@@ -8,7 +8,7 @@
 
 export default {
   name: "vciWebReferTree",
-  props:["referConfig","value","text","title"],
+  props:["referConfig","value","text","title","disabled"],
   data() {
     return {
       options: this.referConfig.options,
@@ -34,8 +34,8 @@
   },
   created() {
     this.getParams();
-    console.log('referConfig:')
-    console.log(this.referConfig)
+    // console.log('referConfig:')
+    // console.log(this.referConfig)
   },
   mounted() {
     if(!this.lazy){
@@ -88,6 +88,12 @@
           queryParams[key] = this.options.rootParams[key];
         }
       }
+      if(this.options.sortField){
+        queryParams['sort'] = this.options.sortField;//瀛楁
+      }
+      if(this.options.sortType){
+        queryParams['order'] = this.options.sortType;//鏂规硶
+      }
       if (this.options.conditionParams) {
         //璇存槑鏄墿灞曞睘鎬�
         for (var key in this.options.conditionParams) {
@@ -123,10 +129,23 @@
       this.params=queryParams;
 
     },
-    getTree(){
-      getTree(this.params,this.treeUrl).then(res => {
-          this.treeData=res.data
+    getTree() {
+      getTree(this.params, this.treeUrl).then(res => {
+        res.data.map(item => {
+          if (!item.attribute) {
+            item.attribute = {
+              data: {}
+            }
+          } else {
+            item.attribute.data = item.attribute.data || {}
+          }
+          return {
+            ...item,
+            leaf: !item.hasChildren
+          }
         })
+        this.treeData = res.data
+      })
     },
     treeLoad: function (treeNode, resolve) {
       const parentOid = (treeNode.level === 0) ? 0 : treeNode.data.oid;
@@ -142,6 +161,13 @@
       }
       getLazyTree(this.params,this.treeUrl).then(res => {
         resolve(res.data.data.map(item => {
+          if(!item.attribute){
+            item.attribute={
+              data:{}
+            }
+          }else{
+            item.attribute.data=item.attribute.data || {}
+          }
           return {
             ...item,
             leaf: !item.hasChildren
@@ -163,13 +189,13 @@
       const textSep =this.config.textSep;
       for(var j =0;j<checkedData.checkedNodes.length;j++){
         const item=checkedData.checkedNodes[j];
-        var v=this.config.valueField.indexOf("attribute.")>=0?item.attributes[this.config.valueField.replace("attribute.","")]:(item.attributes[this.config.valueField] || item[this.config.valueField])
+        var v=this.config.valueField.indexOf("attribute.")>=0?(item.attributes[this.config.valueField.replace("attribute.","")] || item.attributes.data[this.config.valueField.replace("attribute.","")]):(item.attributes[this.config.valueField] || item[this.config.valueField] || item.attributes.data[this.config.valueField])
         value.push(v);
         var tempRaw = [];
         var textFieldArray = this.config.textField.split(",");
         for (var i = 0; i < textFieldArray.length; i++) {//鏄剧ず鐨勫瓧娈靛彲鑳芥湁澶氫釜
           if (!validatenull(textFieldArray[i])) {
-            var t=textFieldArray[i].indexOf("attribute.")>=0?item.attributes[textFieldArray[i].replace("attribute.","")]:(item.attributes[textFieldArray[i]] || item[textFieldArray[i]])
+            var t=textFieldArray[i].indexOf("attribute.")>=0?(item.attributes[textFieldArray[i].replace("attribute.","")] ||item.attributes.data[textFieldArray[i].replace("attribute.","")]):(item.attributes[textFieldArray[i]] || item[textFieldArray[i]] || item.attributes.data[textFieldArray[i]])
             tempRaw.push(t);
           }
         }
@@ -183,7 +209,8 @@
         value: this.value,
         text: this.text || '',
         isTreeMuti:this.isMuti,
-        rawData: checkedData.checkedNodes
+        rawData: checkedData.checkedNodes,
+        fieldMap:this.referConfig.fieldMap
       });
     }
   },

--
Gitblit v1.9.3