田源
2024-04-16 ef5bf67bac4342cf66c447295ab108cd569735f1
属性池映射管理
已修改2个文件
已添加2个文件
317 ■■■■■ 文件已修改
Source/UBCS-WEB/src/api/vciAttrbute.js 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/integration/integrationIndex.vue 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/integration/vciAttribute.vue 228 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/modeling/LinkType.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/api/vciAttrbute.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
import request from '@/router/axios';
//  æ•°æ®æŸ¥è¯¢æŽ¥å£
export const getGroupAttrPoolALlList = (params) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/groupAttrPoolMapping/getGroupAttrPoolALlList',
    method: 'get',
    params: {
      ...params
    }
  })
}
// ä¿å­˜æŽ¥å£
export const editGroupAttr = (data) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/groupAttrPoolMapping/editGroupAttr',
    method: 'post',
    data
  })
}
// åŒæ­¥æŽ¥å£
export const syncGroupAttrMapping = (data) => {
  return request({
    url: '/api/ubcs-applyjtcodeservice/groupAttrPoolMapping/syncGroupAttrMapping',
    method: 'post',
    data
  })
}
Source/UBCS-WEB/src/views/integration/integrationIndex.vue
@@ -51,9 +51,9 @@
                       @selection-change="selectionChange"
                       @select-all="handleSelectAll">
              <template slot="menuLeft">
<!--                <el-button :disabled="disabledPush" icon="el-icon-plus" size="small" type="primary"-->
<!--                           @click="dialogPush = true">新 å¢ž-->
<!--                </el-button>-->
                <!--                <el-button :disabled="disabledPush" icon="el-icon-plus" size="small" type="primary"-->
                <!--                           @click="dialogPush = true">新 å¢ž-->
                <!--                </el-button>-->
                <el-button icon="el-icon-check" size="small" type="primary" @click="handleSave">保 å­˜
                </el-button>
                <el-button icon="el-icon-connection" size="small" type="primary"
@@ -62,6 +62,9 @@
                <el-button icon="el-icon-connection" size="small" type="primary"
                           @click="handleSync('one')">同步详细模型
                </el-button>
                <el-button icon="el-icon-coordinate" size="small" type="primary"
                           @click="handlerAuto">自动填充
                </el-button>
              </template>
            </avue-crud>
          </el-card>
@@ -69,6 +72,11 @@
            <avue-crud ref="crudRange" :data="rangeData" :option="optinoRange" :style="{ marginTop: '-20px'}"
                       @row-update="handleUpdate"
                       @row-dblclick="handleRowClick">
              <template slot="menuLeft">
                <el-button icon="el-icon-coordinate" size="small" type="primary"
                           @click="handlerAuto">自动填充
                </el-button>
              </template>
            </avue-crud>
          </el-card>
        </el-card>
@@ -140,8 +148,8 @@
      optinoRange: {
        title: '属性映射取值范围',
        maxHeight: '280px',
        header: false,
        rowKey: 'oid',
        refreshBtn: false,
        column: [
          {label: '属性集团枚举值', prop: 'numTextValue', minWidth: 80},
          {label: '集团属性枚举显示名称', prop: 'numText', minWidth: 80},
@@ -181,7 +189,7 @@
        border: true,
        searchMenuSpan: 8,
        highlightCurrentRow: true,
        $cellEdit:true,
        $cellEdit: true,
        column: [
          {label: '集团分类', prop: 'sourceClassifyName', minWidth: 80},
          {label: '所属视图', prop: 'viewName', minWidth: 80},
@@ -192,14 +200,13 @@
            prop: 'targetAttrName',
            type: 'select',
            cell: true,
            allowCreate: true,
            filterable: true,
            minWidth: 80,
            props:{
              label:'targetAttrName',
              value:'targetAttrName'
            props: {
              label: 'targetAttrName',
              value: 'targetAttrName'
            },
            dicData: this.targetNameList,
            dicData: [],
          },
          // {
          //   label: '默认值',
@@ -277,7 +284,7 @@
            targetAttrId: item.oid,
            targetAttrKey: item.id,
            targetAttrName: item.name,
            disabled:false
            disabled: false
          }
        });
    },
@@ -305,8 +312,8 @@
        this.loading = false
        this.mappingData = response.data.data
        for (const item of this.mappingData){
          if(item.targetAttrName && item.targetAttrId && item.targetAttrKey){
        for (const item of this.mappingData) {
          if (item.targetAttrName && item.targetAttrId && item.targetAttrKey) {
            const targetObject = this.targetColumn.dicData.find(obj => obj.targetAttrName === item.targetAttrName);
            targetObject.disabled = true;
          }
@@ -417,14 +424,14 @@
    },
    // ä¿å­˜æŒ‰é’®
    async handleSave() {
      const getTargetCorresponding = (row) =>{
      const getTargetCorresponding = (row) => {
        return this.targetColumn.dicData.find(column => column.targetAttrName === row.targetAttrName);
      }
      for (const item of this.mappingData) {
        item.$cellEdit = false;
        if(item.targetAttrName){
          const { targetAttrId, targetAttrKey, targetAttrName } = await getTargetCorresponding(item);
          Object.assign(item, { targetAttrId, targetAttrKey, targetAttrName });
        if (item.targetAttrName) {
          const {targetAttrId, targetAttrKey, targetAttrName} = await getTargetCorresponding(item);
          Object.assign(item, {targetAttrId, targetAttrKey, targetAttrName});
        }
      }
      const response = await batchAddSave({dockingPreAttrMappingVOList: this.mappingData})
@@ -547,12 +554,12 @@
        }
        // èŽ·å–ç›®æ ‡å±žæ€§ä¿¡æ¯
        const { targetAttrId, targetAttrKey, targetAttrName } = await getTargetCorresponding(row);
        const {targetAttrId, targetAttrKey, targetAttrName} = await getTargetCorresponding(row);
        // æ›´æ–°è¡Œæ•°æ®
        Object.assign(row, { targetAttrId, targetAttrKey, targetAttrName });
        Object.assign(row, {targetAttrId, targetAttrKey, targetAttrName});
        const response = await batchAddSave({ dockingPreAttrMappingVOList: this.mappingData });
        const response = await batchAddSave({dockingPreAttrMappingVOList: this.mappingData});
        if (response.status === 200) {
          this.$message({
@@ -613,8 +620,9 @@
  .el-transfer-panel {
    width: 270px;
  }
  .el-scrollbar__view  {
    height: 100px ;
  .el-scrollbar__view {
    height: 100px;
  }
}
Source/UBCS-WEB/src/views/integration/vciAttribute.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,228 @@
<template>
  <basic-container>
    <avue-crud ref="crud" :data="data" :option="options" :page.sync="page" @current-change="currentChange"
               @size-change="sizeChange" @row-dblclick="handleRowClick" @row-update="handleUpdate"
               @selection-change="selectChange">
      <template slot="menuLeft">
        <el-button plain size="small" type="success" @click="savaHandler">保存</el-button>
        <el-button plain size="small" type="primary" @click="syncHandler">同步</el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
import {getGroupAttrPoolALlList, editGroupAttr,syncGroupAttrMapping} from '@/api/vciAttrbute'
import {getPage} from "@/api/omd/OmdAttribute";
export default {
  name: "vciAttribute",
  data() {
    return {
      data: [],
      options: {
        height: 'auto',
        calcHeight: 20,
        headerAlign: "center",
        border: true,
        selection: true,
        tip: false,
        index: true,
        refreshBtn: false,
        searchShowBtn: false,
        addBtn: false,
        delBtn: false,
        $cellEdit: true,
        rowKey: 'oid',
        cellBtn: true,
        highlightCurrentRow: true,
        column: [
          {
            label: '集团属性编号',
            prop: 'groupAttrKey'
          },
          {
            label: '集团属性名称',
            prop: 'groupAttrName'
          },
          {
            label: '属性编号',
            prop: 'codeMetaAttrKey'
          },
          {
            label: '属性名称',
            prop: 'codeMetaAttrName',
            type: 'select',
            cell: true,
            filterable: true,
            props: {
              label: 'codeMetaAttrName',
              value: 'codeMetaAttrOid',
            },
            dicData: []
          }
        ]
      },
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      selectList: []
    }
  },
  created() {
    const params = {
      'conditionMap[groupAttrKey_like]': 'RY_',
      page: this.page.currentPage,
      limit: this.page.pageSize
    }
    this.onLoad(params)
    this.codeColumnOnload()
  },
  computed: {
    codeMetaColumn() {
      return this.options.column.find(column => column.prop === 'codeMetaAttrName');
    }
  },
  methods: {
    codeMetaDis() {
      for (const item of this.data) {
        if (item.codeMetaAttrOid && item.codeMetaAttrKey && item.codeMetaAttrName) {
          console.log(this.codeMetaColumn)
          console.log(this.codeMetaColumn.dicData)
          if (this.codeMetaColumn.dicData.length >= 1) {
            const targetObject = this.codeMetaColumn.dicData.find(obj => obj.codeMetaAttrName === item.codeMetaAttrName);
            console.log(targetObject)
          }
          // targetObject.disabled = true;
        }
      }
    },
    selectChange(list) {
      this.selectList = list;
    },
    async onLoad(params) {
      getGroupAttrPoolALlList(params).then(res => {
        const data = res.data.data;
        this.data = data.records;
        this.page.total = data.total;
      })
    },
    codeColumnOnload() {
      getPage(1, -1).then(res => {
        const data = res.data.data;
        this.codeMetaColumn.dicData = data.records.filter(item => item.name && item.name.trim() !== "") // è¿‡æ»¤æŽ‰name为空的属性
          .map(item => {
            return {
              codeMetaAttrOid: item.oid,
              codeMetaAttrKey: item.id,
              codeMetaAttrName: item.name,
              disabled: false
            }
          })
      })
    },
    handleRowClick(row, column) {
      if (column.label === '属性名称') this.$refs.crud.rowCell(row, row.$index)
    },
    async handleUpdate(row, index, done) {
      if (!row.codeMetaAttrName) {
        this.$message.warning('请选择要保存的属性名称!');
        done();
        return;
      }
      // row.codeMetaAttrName因为下拉框value值原因绑定为codeMetaAttrOid
      const updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName)
      // å› ä¸ºrow里面的值是不正确的 é‡æ–°èµ‹å€¼ä¸€é
      const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList;
      Object.assign(row, {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName});
      const objet = {
        oid: row.oid,
        groupAttrKey: row.groupAttrKey,
        groupAttrName: row.groupAttrName,
        codeMetaAttrOid: row.codeMetaAttrOid,
        codeMetaAttrKey: row.codeMetaAttrKey,
        codeMetaAttrName: row.codeMetaAttrName
      }
      const response = await editGroupAttr([objet])
      if (response.data.data.success) {
        this.$message.success('保存成功!')
      }
      done()
    },
    async savaHandler() {
      if (this.selectList.length <= 0) {
        this.$message.warning('请选择一条数据后进行保存!')
      } else {
        const hasTrueValue = this.selectList.some(item => !item.$cellEdit);
        if (hasTrueValue) {
          this.$message.warning('请开启编辑后保存!')
        } else {
          let saveList = []
          for (const item of this.selectList) {
            const updataList = this.codeMetaColumn.dicData.find(p => p.codeMetaAttrOid === item.codeMetaAttrName);
            const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList;
            Object.assign(item, {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName});
            item.$cellEdit = false;
            saveList.push({
              oid: item.oid,
              groupAttrKey: item.groupAttrKey,
              groupAttrName: item.groupAttrName,
              codeMetaAttrOid: item.codeMetaAttrOid,
              codeMetaAttrKey: item.codeMetaAttrKey,
              codeMetaAttrName: item.codeMetaAttrName
            })
          }
          const response = await editGroupAttr(saveList)
          if (response.data.data.success) {
            this.$message.success('保存成功!')
          }
        }
      }
    },
    async syncHandler(){
      if(this.selectList.length <= 0){
        this.$message.warning('请至少选择一条数据进行同步!')
      }else {
        const syncList = [];
        for (const item of this.selectList) {
          syncList.push({
            groupAttrKey: item.groupAttrKey,
            groupAttrName: item.groupAttrName,
          })
        }
        const response = await syncGroupAttrMapping(syncList)
        if(response.data.success){
          this.$message.success(response.data.msg)
        }
      }
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
      const params = {
        'conditionMap[groupAttrKey_like]': 'RY_',
        page: this.page.currentPage,
        limit: this.page.pageSize
      }
      this.onLoad(params)
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      const params = {
        'conditionMap[groupAttrKey_like]': 'RY_',
        page: this.page.currentPage,
        limit: this.page.pageSize
      }
      this.onLoad(params)
    },
  }
}
</script>
<style scoped>
</style>
Source/UBCS-WEB/src/views/modeling/LinkType.vue
@@ -141,7 +141,7 @@
    </el-container>
    <link-type-add ref="linkAdd" :domainOption="domainOptions" :icons="icons" :linkStatus="linkStatus"
                   :linkType="addOption.linkType"
                   @refreshTable="initTreeOnLoad">
                   @refreshTable="initTable">
    </link-type-add>
  </el-container>
@@ -161,6 +161,7 @@
  name: "LinkType",
  data() {
    return {
      nodeClickOid:'',
      linkStatus: '',
      addOption: {
        linkType: {
@@ -253,10 +254,16 @@
  methods: {
    // æ ‘点击
    nodeClick(data) {
      this.nodeClickOid = data.oid;
      getDetail(data.oid).then(res => {
        this.obj = res.data.data;
      })
    },
    initTable(){
      getDetail(this.nodeClickOid).then(res => {
        this.obj = res.data.data;
      })
    },
    // æ·»åŠ æŒ‰é’®ç‚¹å‡»äº‹ä»¶
    linkTypeAdd() {
      this.$refs.linkAdd.linkType = {};