From 2ebaebe36e006e68aa15e02629fb18043add0618 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期三, 05 七月 2023 16:51:50 +0800
Subject: [PATCH] 修改列表展示

---
 Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue |   11 --
 Source/UBCS-WEB/src/components/Tree/attrCrud.vue      |  216 ++++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 163 insertions(+), 64 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
index dd31f9a..9e622e0 100644
--- a/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
+++ b/Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
@@ -277,7 +277,9 @@
           }else {
             if (record.templet && typeof (record.templet) == 'string' && !validatenull(record.templet) && record.templet.indexOf("function(row,column)")>-1) {
               record.formatter = eval("(" + record.templet + ")");
-              //function(row,column){return row[column.property]=='true'?'鏄�':'鍚�'}
+              //function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'}
+            }else if(record.fieldType=="truefalse"){
+              record.formatter = function(row,column){return row[column.property]=='true' || row[column.property]=='1'?'鏄�':'鍚�'}
             }
           }
         })
@@ -297,13 +299,6 @@
     },
   },
   methods: {
-    // 杞崲鏁版嵁true鍜宖alse
-    formatBoolean(row, column) {
-      if (column.fieldType === "truefalse") {
-        return row[column.property] =='true'? "鏄�" : "鍚�";
-      }
-      return row[column.property];
-    },
     // 鍙戝竷
     setHandler() {
       if (this.selectRow.length <= 0) {
diff --git a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue
index bedf452..c149993 100644
--- a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue
+++ b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue
@@ -209,7 +209,7 @@
       ></formula-editor>
       <!--    鏂板  -->
       <el-dialog :visible.sync="addVisible" append-to-body title="浠庝笟鍔$被鍨嬩腑閫夋嫨灞炴��">
-        <avue-crud :data="businessData" :option="businessOption" @select="businessSelect">
+        <avue-crud :data="businessData" :option="businessOption" @selection-change="businessSelect">
           <template slot="menuLeft">
             <div style="display: flex;">
               <el-select>
@@ -232,13 +232,14 @@
               style="width: 100%"
               @cell-click="handleCellClicks"
               @select="selectHandle"
+              @selection-change="selectionChange"
               v-if="this.crudArrayFlag"
     >
       <el-table-column
         type="selection"
         width="55">
       </el-table-column>
-      <el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>
+      <!--<el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>-->
       <el-table-column v-for="item in this.option.column" :key="item.id"
                        :label="item.label"
                        :prop="item.prop"
@@ -248,12 +249,13 @@
                        align="center"
       >
         <template slot-scope="{ row }">
-          <el-input v-if="editingRows === row && editShows== item.prop" v-model="row[item.prop]"
+          <el-input v-if="editingRows === row && editShows== item.prop && (item.edit == 'text' || item.edit == 'select' ||item.edit == 'refer')" v-model="row[item.prop]"
                     @blur="saveRows"></el-input>
+          <el-input-number controls-position="right" v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]"
+                           @blur="saveRows"></el-input-number>
           <el-switch
-            v-if="item.label === 'true' || item.label === 'false'"
-            active-color="#13ce66"
-            inactive-color="#ff4949">
+            v-if="item.edit === 'switch'" v-model="row[item.prop]" active-value="true"
+            inactive-value="false">
           </el-switch>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
@@ -335,14 +337,14 @@
       },
       // 缂栫爜鐢宠棰勮data
       applicationData: [],
-      //涓氬姟绫诲瀷鍗曢�夋暟缁�
+      //涓氬姟绫诲瀷閫夋嫨鏁扮粍
       busineSelectList: [],
       //涓氬姟绫诲瀷娣诲姞鏁版嵁
       busineAddList: {},
       //琛ㄦ牸鍗曢�夋暟缁�
-      CrudSelect: [],
+      attrSelectList: [],
       //琛ㄦ牸oid
-      CrudOid: "",
+      attrOid: "",
       //鍦烘櫙鍙橀噺
       thisSceneTableData: [
         {
@@ -940,7 +942,7 @@
       rowCellList: [],
       List: [],
       option: {
-        index: true,
+        index: false,
         border: true,
         editBtn: false,
         selection: true,
@@ -953,8 +955,14 @@
           prop: 'name',
           order: 'descending'
         },
-        column: [
-          {
+        column: [{
+          prop: 'orderNum',
+          label: '鎺掑簭鍙�',
+          sortable: true,
+          edit: 'number',
+          width: 60,
+          fixed: true
+        }, {
             label: "灞炴�ц嫳鏂囩紪鍙�",
             prop: "id",
             fixed: true,
@@ -969,6 +977,7 @@
             fixed: true,
             cell: false,
             width: 125,
+            edit: 'text',
             sortable: true
           },
           {
@@ -976,6 +985,7 @@
             prop: "attributeGroup",
             cell: false,
             sortable: true,
+            edit: 'text',
             width: 125,
           },
           {
@@ -990,78 +1000,90 @@
             cell: false,
             sortable: true,
             width: 105,
+            edit: 'number'
           },
           {
             label: "鍏抽敭灞炴��",
             prop: "keyAttrFlag",
             cell: false,
-            type: "switch",
+            edit: "switch"
           },
           {
             label: "鏌ヨ灞炴��",
             prop: "queryAttrFlag",
             cell: false,
+            edit: "switch"
           },
           {
             label: "楂樼骇鏌ヨ灞炴��",
             prop: "seniorQueryAttrFlag",
             width: 95,
             cell: false,
+            edit: "switch"
           },
           {
-            label: "鐩镐技鏌ヨ灞炴��",
+            label: "鐩镐技鏌ラ噸灞炴��",
             prop: "sameRepeatAttrFlag",
             width: 95,
             cell: false,
+            edit: "switch"
           },
           {
             label: "蹇呰緭",
             prop: "requireFlag",
             cell: false,
+            edit: "switch"
           },
           {
             label: "琛ㄥ崟鏄剧ず",
             prop: "formDisplayFlag",
             cell: false,
+            edit: "switch"
           },
           {
             label: "鍒楄〃鏄剧ず",
             prop: "tableDisplayFlag",
             cell: false,
+            edit: "switch"
           },
           {
             label: "鍙",
             prop: "readonlyFlag",
             cell: false,
+            edit: "switch"
           },
           {
             label: "鍒楄〃鎺掑簭",
             prop: "sortAttrFlag",
             cell: false,
+            edit: "switch"
           },
-
           {
             label: "澶氳鏂囨湰",
             prop: "textareaFlag",
             cell: false,
+            edit: "switch"
           },
           {
             label: "榛樿鍊�",
             prop: "defaultValue",
             sortable: true,
             cell: false,
+            edit: 'text',
             width: 95,
           },
           {
             label: "鍓嶇紑",
             prop: "prefixValue",
             sortable: true,
+            edit: 'select',
             cell: false,
           },
           {
             label: "鍚庣紑",
             prop: "suffixValue",
             sortable: true,
+            edit: 'select',
             cell: false,
           },
           {
@@ -1069,6 +1091,7 @@
             prop: "componentRule",
             sortable: true,
             cell: false,
+            edit: 'refer',
             width: 105,
           },
           {
@@ -1076,6 +1099,7 @@
             prop: "verifyRule",
             sortable: true,
             cell: false,
+            edit: 'refer',
             width: 105,
           },
           {
@@ -1083,84 +1107,97 @@
             prop: "codeDateFormat",
             sortable: true,
             width: 105,
+            edit: 'select',
             cell: false,
           },
           {
             label: "鍒嗙被娉ㄥ叆",
             prop: "classifyInvokeLevel",
             cell: false,
+            edit: 'refer'
           },
           {
             label: "鏋氫妇娉ㄥ叆",
             prop: "enumString",
             cell: false,
+            edit: 'refer'
           },
           {
             label: "绾ц仈灞炴��",
             prop: "parentCode",
             cell: false,
+            edit: 'refer'
           },
           {
             label: "鍙傜収閰嶇疆",
             prop: "referConfig",
             cell: false,
+            edit: 'refer'
           },
           {
             label: "绾ц仈鏌ヨ灞炴��",
             prop: "parentQueryAttr",
             width: 105,
             cell: false,
+            edit: 'text'
           },
           {
             label: "閫夋嫨搴撴爣璇�",
             prop: "libraryIdentification",
             width: 105,
             cell: false,
+            edit: 'text'
           },
           {
             label: "濉啓鎻愮ず",
             prop: "explain",
             cell: false,
+            edit: 'text'
           },
           {
             label: "琛ㄥ崟鏄剧ず鏍峰紡",
             prop: "formDisplayStyle",
             width: 105,
             cell: false,
+            edit: 'text'
           },
           {
             label: "琛ㄦ牸鏄剧ず鏍峰紡",
             prop: "tableDisplayStyle",
             width: 105,
             cell: false,
+            edit: 'text'
           },
           {
             label: "琛ㄥ崟瓒呴摼鎺�",
             prop: "formHref",
             width: 95,
             cell: false,
+            edit: 'text'
           },
           {
             label: "琛ㄦ牸瓒呴摼鎺�",
             prop: "tableHref",
             width: 95,
             cell: false,
+            edit: 'text'
           },
           {
             label: "琛ㄦ牸鏄剧ずjs",
             prop: "tableDisplayJs",
             width: 95,
             cell: false,
+            edit: 'text'
           },
           {
             label: "闀垮害",
             prop: "controlLength",
-            cell: false,
+            cell: false
           },
           {
             label: "灏忔暟绮惧害",
             prop: "precisionLength",
-            cell: false,
+            cell: false
           },
           {
             label: "鍙栧�艰寖鍥�",
@@ -1168,10 +1205,39 @@
             sortable: true,
             cell: false,
             width: 105,
+            edit: 'text'
           },
         ],
         List: []
+      },
+      vciFieldTypeMap : {
+        VTBoolean: "甯冨皵鍨�",
+        VTClob: "闀挎枃鏈�",
+        VTDate: "鏃ユ湡",
+        VTDateTime: "鏃ユ湡鏃堕棿",
+        VTTime: "鏃堕棿",
+        VTLong: "闀挎暣鍨�",
+        VTDouble: "閲戦/鍙岀簿搴�",
+        VTInteger: "鏁村舰",
+        VTFilePath: "鏂囦欢",
+        VTString: "瀛楃涓�"
       }
+    }
+  },
+  computed:{
+    attrOids() {
+      let oids = [];
+      this.attrSelectList.forEach(ele => {
+        oids.push(ele.oid);
+      });
+      return oids.join(",");
+    },
+    busineOids() {
+      let oids = [];
+      this.busineSelectList.forEach(ele => {
+        oids.push(ele.oid);
+      });
+      return oids.join(",");
     }
   },
   mounted() {
@@ -1186,11 +1252,11 @@
     //灞炴�у垎缁勬寜閽�
     attrVisibleHandle() {
 
-      if (this.CrudSelect.length > 1) {
+      if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�')
-      } else if (this.CrudSelect < 1) {
+      } else if (this.attrSelectList < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�')
-      } else if (this.CrudSelect.length === 1) {
+      } else if (this.attrSelectList.length === 1) {
         this.attrVisible = true;
       }
     },
@@ -1216,38 +1282,74 @@
     },
     //涓氬姟绫诲瀷淇濆瓨
     busineAddHandle() {
-      if (this.busineSelectList.length > 1) {
-        this.$message.warning('璇烽�夋嫨涓�鏉′笟鍔$被鍨嬫暟鎹�')
-      } else {
-        this.$set(this.busineAddList, 'classifytemplateoid', this.crudOid)
-        this.$set(this.busineAddList, 'oid', '')
-        this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
-        this.addVisible = false;
+      if (this.busineSelectList.length == 0) {
+        this.$message.warning('璇烽�夋嫨灞炴�ч泦');
+        return false;
       }
+debugger;
+      let ordernum = this.ProData.length;
+      this.busineSelectList.forEach((citem) => {
+        let isCopy = false;
+        this.ProData.forEach((item) => {
+          if (citem.id == item.id) {
+            isCopy = true;
+            return false;
+          }
+        })
+        if (!isCopy) {
+          citem.oid = ''
+          this.busineAddList=Object.assign(citem, {
+            orderNum: ++ordernum,
+            attributedatatype: citem.attrDataType,
+            attributeDataTypeText: this.vciFieldTypeMap[citem.attrDataType],
+            controlLength: citem.attributeLength,
+            valueArea: citem.range,
+            referbtmid: citem.referBtmTypeId,
+            referbtmname: citem.referBtmTypeName,
+            referConfig: '',
+            enumid: citem.enumId,
+            precisionLength: (citem.precisionLength ? citem.precisionLength : '') + (citem.scaleLength ? '(' + citem.scaleLength + ')' : ''),
+            classifyTemplateOid: this.crudOid,
+            classifytemplateoid: this.crudOid,
+            formDisplayFlag: true,
+            tableDisplayFlag: true,
+            sortAttrFlag: false,
+            queryAttrFlag: true,
+            seniorQueryAttrFlag: true,
+            attrTableWidth: 120
+          })
+          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
+        }
+      })
+
+
+      this.addVisible = false;
+
     },
-    //涓氬姟绫诲瀷鍗曢��
+    //涓氬姟绫诲瀷閫夋嫨
     businessSelect(selection, row) {
       this.busineSelectList = selection
-      this.busineAddList = row
     },
-    // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁
+    // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁寮圭獥
     busineHandle() {
-        this.addVisible = true;
-        AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => {
-          this.businessData = res.data.data;
-        })
+      this.addVisible = true;
+      this.busineSelectList = []
+      this.busineAddList = [];
+      AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => {
+        this.businessData = res.data.data;
+      })
     },
     // 绾ц仈灞炴�ф寜閽�
     CascadeHandle() {
-      if (this.CrudSelect.length > 1) {
+      if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�')
-      } else if (this.CrudSelect.length < 1) {
+      } else if (this.attrSelectList.length < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�')
-      } else if (this.CrudSelect.length === 1) {
+      } else if (this.attrSelectList.length === 1) {
         this.CascadeVisible = true;
         gridCodeClassifyTemplateAttr({
           'conditionMap[classifyTemplateOid]': this.Formlist[0].oid,
-          'conditionMap[oid_notequal]': this.CrudOid
+          'conditionMap[oid_notequal]': this.attrOid
         }).then(res => {
           this.CascadeData = res.data.data;
         })
@@ -1255,10 +1357,12 @@
     },
     //琛ㄦ牸鍗曢��
     selectHandle(selection, row) {
-      this.CrudOid = row.oid;
-      this.CrudSelect = selection;
+      this.attrOid = row.oid;
       this.attrRow = row;
-      console.log('123',row,selection)
+    },
+    //琛ㄦ牸閫夋嫨
+    selectionChange(list) {
+      this.attrSelectList = list;
     },
     //淇濆瓨
     addsHandler() {
@@ -1283,9 +1387,9 @@
     },
     //琛ㄦ牸琛岀紪杈�
     handleCellClicks(row, column) {
-      this.editingRows = row;
-      this.editShows = column.property;
-      this.rowOid = row.oid;
+        this.editingRows = row;
+        this.editShows = column.property;
+        this.rowOid = row.oid;
     },
     saveRows() {
       this.editingRows = null;
@@ -1308,11 +1412,11 @@
     },
     //鏋氫妇娉ㄥ叆鎸夐挳
     enmuVisHandle() {
-      if (this.CrudSelect.length > 1) {
+      if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�')
-      } else if (this.CrudSelect < 1) {
+      } else if (this.attrSelectList < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�')
-      } else if (this.CrudSelect.length === 1) {
+      } else if (this.attrSelectList.length === 1) {
         this.enumVisible = true;
       }
     },
@@ -1354,11 +1458,11 @@
     },
     //鐐瑰嚮鍒嗙被娉ㄥ叆鎸夐挳
     injectBtn() {
-      if (this.CrudSelect.length > 1) {
+      if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉挎暟鎹�')
-      } else if (this.CrudSelect.length < 1) {
+      } else if (this.attrSelectList.length < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉挎暟鎹�')
-      } else if (this.CrudSelect.length === 1) {
+      } else if (this.attrSelectList.length === 1) {
         this.injectVisible = true
       }
     },
@@ -1412,11 +1516,11 @@
     },
     //鍚屾鍒板叾浠栨ā鏉�
     syncHandle() {
-      if (this.CrudSelect.length > 1) {
+      if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
-      } else if (this.CrudSelect.length < 1) {
+      } else if (this.attrSelectList.length < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
-      } else if (this.CrudSelect.length === 1) {
+      } else if (this.attrSelectList.length === 1) {
         copyto({oid: this.attrRow.oid}).then(res => {
           this.$message.success('鍚屾鎴愬姛')
         })
@@ -1428,11 +1532,11 @@
     },
     //缁勫悎瑙勫垯
     isShowHandler() {
-      if (this.CrudSelect.length > 1) {
+      if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
-      } else if (this.CrudSelect.length < 1) {
+      } else if (this.attrSelectList.length < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
-      } else if (this.CrudSelect.length === 1) {
+      } else if (this.attrSelectList.length === 1) {
         this.isShowformulaEdit = true;
       }
     },

--
Gitblit v1.9.3