田源
2024-01-09 17c19bbc8e187ca61a7f949e13eb905058158534
集团属性映射xml 增删改
已修改2个文件
137 ■■■■■ 文件已修改
Source/UBCS-WEB/src/api/integration/groupMapAttrXML.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/integration/groupMapAttrXML.vue 115 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/api/integration/groupMapAttrXML.js
@@ -1,9 +1,27 @@
import request from '@/router/axios';
//列表
export const getGroupMapXML = (params) => {
  return request({
    url: '/api/ubcs-code/groupMapAttrXML/getGroupMapXML',
    url: '/api/ubcs-code/groupMapAttrXML/getGroupMapXMLList',
    method: 'get',
    params: params
  })
}
}
//新增
export const addGroupMapXML = (data) => {
  return request({
    url: '/api/ubcs-code/groupMapAttrXML/addGroupMapXML',
    method: 'post',
    data: data
  })
}
//修改
export const updateGroupMapXML = (data) => {
  return request({
    url: '/api/ubcs-code/groupMapAttrXML/updateGroupMapXML',
    method: 'PUT',
    data: data
  })
}
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>