From 17c19bbc8e187ca61a7f949e13eb905058158534 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 09 一月 2024 11:28:40 +0800
Subject: [PATCH] 集团属性映射xml 增删改

---
 Source/UBCS-WEB/src/views/integration/groupMapAttrXML.vue |  115 +++++++++++++++++++++++++++++++--------------------------
 1 files changed, 63 insertions(+), 52 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/integration/groupMapAttrXML.vue b/Source/UBCS-WEB/src/views/integration/groupMapAttrXML.vue
index 5af9066..91d746e 100644
--- a/Source/UBCS-WEB/src/views/integration/groupMapAttrXML.vue
+++ b/Source/UBCS-WEB/src/views/integration/groupMapAttrXML.vue
@@ -1,10 +1,12 @@
 <template>
   <basic-container>
-    <avue-crud :option="option"
-               :data="tableData"
-               @on-load="onLoad">
+    <avue-crud :data="tableData"
+               :option="option"
+               @on-load="onLoad"
+               @row-save="rowSave"
+               @row-update="rowUpdate">
       <template slot="groupMapAttrContent" slot-scope="scope">
-        <avue-text-ellipsis :text="scope.row.groupMapAttrContent" :height="50">
+        <avue-text-ellipsis :height="50" :text="scope.row.groupMapAttrContent">
           <small slot="more">...</small>
         </avue-text-ellipsis>
       </template>
@@ -13,53 +15,23 @@
 </template>
 
 <script>
-import {getGroupMapXML} from "@/api/integration/groupMapAttrXML.js";
+import {getGroupMapXML, addGroupMapXML, updateGroupMapXML} from "@/api/integration/groupMapAttrXML.js";
 
 export default {
   data() {
     return {
       xmlContent: "", // 浠庡悗绔幏鍙栫殑XML鍐呭
-      tableData:[
-        {
-          groupMapAttrName:"娴嬭瘯test",
-          attrMapPath:"娴嬭瘯test",
-          groupMapAttrContent:"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
-            "<clsfs>\n" +
-            "    <clsf library=\"10\">\n" +
-            "        <prop        sourceKey=\"c6e_partName\"        sourceName=\"Part鍚嶇О\"        targetKey=\"partname\"        targetName=\"Part鍚嶇О\"/>\n" +
-            "        <prop        sourceKey=\"c6e_drawingNo\"        sourceName=\"鍥惧彿\"        targetKey=\"drawingno\"        targetName=\"鍥惧彿/鏍囪\"/>\n" +
-            "        <prop        sourceKey=\"c6e_prodModel\"        sourceName=\"浜у搧鍨嬪彿\"        targetKey=\"model\"        targetName=\"鍒濆鍨嬪彿\"/>\n" +
-            "        <prop        sourceKey=\"c6e_partClass\"        sourceName=\"Part鍒嗙被\"        targetKey=\"partclass\"        targetName=\"Part鍒嗙被\"/>\n" +
-            "        <prop        sourceKey=\"c6e_partVer\"        sourceName=\"Part鐗堟湰\"        targetKey=\"partver\"        targetName=\"Part鐗堟湰\"/>\n" +
-            "        <prop        sourceKey=\"c6e_prodStage\"        sourceName=\"鍒堕�犻樁娈垫爣璇哱"        targetKey=\"prodstage\"        targetName=\"闃舵鏍囪瘑\"/>      \n" +
-            "                <prop        sourceKey=\"c6e_unit\"        sourceName=\"璁¢噺鍗曚綅\"        targetKey=\"unit\"        targetName=\"璁¢噺鍗曚綅\"/>\n" +
-            "                <prop        sourceKey=\"c6e_virtualPartMark\"        sourceName=\"铏氭嫙浠舵爣璇哱"        targetKey=\"virtualpartmark\"        targetName=\"铏氭嫙浠舵爣璇哱"/>\n" +
-            "        <prop        sourceKey=\"c6e_componentMark\"        sourceName=\"缁勫埆浠舵爣璇哱"        targetKey=\"        componentmark\"        targetName=\"缁勫埆浠舵爣璇哱"/>\n" +
-            "        <prop        sourceKey=\"c6e_characterType\"        sourceName=\"鐗规�у垎绫籠"        targetKey=\"charactertype\"        targetName=\"鐗规�у垎绫籠"/>\n" +
-            "        <prop        sourceKey=\"c6e_material\"        sourceName=\"鏉愭枡鐗屽彿\"        targetKey=\"material\"        targetName=\"鏉愭枡鐗屽彿\"/>\n" +
-            "        <prop        sourceKey=\"c6e_materialStandard\"        sourceName=\"鏉愭枡鎶�鏈爣鍑哱"        targetKey=\"materialstandard\"        targetName=\"鎶�鏈爣鍑哱"/>\n" +
-            "        <prop        sourceKey=\"c6e_blankStandard\"        sourceName=\"姣涘潖鏍囧噯\"        targetKey=\"blankstandard\"        targetName=\"姣涘潖鏍囧噯\"/>        \n" +
-            "        <prop        sourceKey=\"c6e_blankType\"        sourceName=\"姣涘潖绫诲瀷\"        targetKey=\"blanktype\"        targetName=\"姣涘潖绫诲瀷\"/>        \n" +
-            "        <prop        sourceKey=\"c6e_prodModel\"        sourceName=\"鍒堕�犲瀷鍙穃"        targetKey=\"prodmodel\"        targetName=\"鍒堕�犲瀷鍙穃"/>   \n" +
-            "        <prop        sourceKey=\"c6e_stageID\"        sourceName=\"璁捐闃舵鏍囪瘑\"        targetKey=\"stageid\"        targetName=\"璁捐闃舵鏍囪瘑\"/>      \n" +
-            "        <prop        sourceKey=\"c6e_remark\"        sourceName=\"澶囨敞\"        targetKey=\"remark\"        targetName=\"澶囨敞\"/>               \n" +
-            "        <prop        sourceKey=\"c6e_productCode\"        sourceName=\"浜у搧缂栫爜\"        targetKey=\"productcode\"        targetName=\"浜у搧缂栫爜\"/>             \n" +
-            "        <prop        sourceKey=\"c6e_hash\"        sourceName=\"鍝堝笇鐮乗"        targetKey=\"hash\"        targetName=\"鍝堝笇鐮乗"/>   \n" +
-            "        <prop        sourceKey=\"c6e_attrSynMark\"        sourceName=\"鏇存柊鏍囪瘑\"        targetKey=\"attrssynmark\"        targetName=\"鏇存柊鏍囪瘑\"/>             \n" +
-            "    </clsf>\n" +
-            "</clsfs>"
-        }
-      ],
-      option:{
-        height:'auto',
+      tableData: [],
+      option: {
+        height: 'auto',
         border: true,
         index: true,
         viewBtn: true,
-        delBtn:false,
-        columnBtn:false,
-        refreshBtn:false,
-        highlightCurrentRow:true,
-        dialogClickModal:true,
+        delBtn: false,
+        columnBtn: false,
+        refreshBtn: false,
+        highlightCurrentRow: true,
+        dialogClickModal: true,
         column: [
           {
             label: "鏂囦欢鍚嶇О",
@@ -68,7 +40,8 @@
           {
             label: "鏂囦欢淇濆瓨璺緞",
             prop: "attrMapPath",
-            labelWidth:120,
+            display: false,
+            labelWidth: 120,
           },
           {
             type: "textarea",
@@ -76,8 +49,20 @@
             prop: "groupMapAttrContent",
             slot: true,
             minRows: 15,
-            span:24
+            span: 24
           },
+          {
+            label: '鏄犲皠鏂囦欢鐘舵��',
+            prop: "isEnable",
+            dicData: [{key: true, value: '鍚敤'}, {key: false, value: '鏈惎鐢�'}],
+            html: true,
+            align: 'center',
+            width: 125,
+            display: false,
+            formatter: function (row) {
+              return row.isEnable ? '<i class="el-icon-check" style="color: #32cd32;font-size: 20px;font-weight: 800"></i>' : '<i class="el-icon-close" style="color: #ff0000;font-size: 20px;font-weight: 800"></i>'
+            }
+          }
         ]
       }
     };
@@ -86,18 +71,44 @@
 
   },
   created() {
-    this.onLoad();
+
   },
   methods: {
     onLoad() {
-      let xmlName = "PDM";
-      //   getGroupMapXML({ xmlName: xmlName }).then((res) => {
-      //     this.xmlContent = res.data.data;
-      //     console.log(res.data.data);
-      //   });
+      getGroupMapXML().then((res) => {
+        this.tableData = res.data.data;
+      });
     },
+    rowSave(row, done) {
+      row.groupMapAttrName = row.groupMapAttrName + '.xml';
+      addGroupMapXML(row).then(res => {
+        this.$message({
+          type: "success",
+          message: res.data.msg
+        });
+        done(row)
+        this.onLoad()
+      })
+    },
+    rowUpdate(row, index, done) {
+      // updateXMLName 淇敼鏂囦欢鍚�
+      // groupMapAttrName 鍘熸枃浠跺悕
+      const XMLParts = row.attrMapPath.split('/');
+      const XMLLastPart = XMLParts[XMLParts.length - 1];
 
-  },
+      row.updateXMLName = row.groupMapAttrName.includes('.xml') ? row.groupMapAttrName : row.groupMapAttrName + '.xml';
+      row.groupMapAttrName = XMLLastPart;
+
+      updateGroupMapXML(row).then(res => {
+        this.$message({
+          type: "success",
+          message: res.data.msg
+        });
+        done();
+        this.onLoad();
+      });
+    }
+  }
 };
 </script>
 <style>

--
Gitblit v1.9.3