wangting
2023-09-08 bc796666e8267f1e47ff9451d9c105b6e327ecff
修改参照bug
已修改4个文件
594 ■■■■ 文件已修改
Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue 206 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/refer/vciWebReferTable.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/mixins/codeApply.js 380 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/FormTemplate/CodeApply.vue
@@ -1,103 +1,103 @@
<template>
  <FormTemplate
    ref="FormTemplate"
    :selfColumnType="selfColumnType"
    :selfColumnConfig="selfColumnConfig"
  ></FormTemplate>
</template>
<script>
export default {
  name: "CodeApply",
  components: { FormTemplate: () => import('./FormTemplate.vue') },
  props: {
  },
  data() {
    return {
      secVOList: [],
      formItems: [],
      trendsSpan: 8,
      selfColumnType: {
        codefixedsec: "combox",
        codeclassifysec: "refer",
        codevariablesec: "text",
        coderefersec: "refer",
      },
      selfColumnConfig: {
        function: {
          required: this.isRequired,
          dicData: this.getOptionList,
          type: this.getType,
        },
        exchange: {
          text: "name",
          field: "oid",
          prop: "oid",
          showField: "name",
          parentClassifySecOid: "parentClassifySecOid",
          label: "name",
          maxlength: "codeSecLength",
          data: "fixedValueVOList",
        },
        directVoluation: {
          search: true,
          props: {
            label: "id",
            value: "id",
          },
        },
      },
    };
  },
  created() {
    this.handleResize();
  },
  mounted() {},
  methods: {
    getType(item) {
      return this.selfColumnType[item.sectype];
    },
    isRequired(item) {
      return item.nullableFlag != "true";
    },
    getOptionList(item) {
      if (
        Array.isArray(item.fixedValueVOList) &&
        item.fixedValueVOList.length > 0
      ) {
        const configAttr = {
          key: "id",
          value: "id",
        };
        const optionList = item.fixedValueVOList.map((item) => {
          for (const key in configAttr) {
            if (Object.hasOwnProperty.call(configAttr, key)) {
              const element = configAttr[key];
              item[key] = item[element];
            }
          }
          return item;
        });
        return optionList;
      } else {
        return [];
      }
    },
    init(columnList) {
      this.$refs.FormTemplate.templateRender(columnList);
    },
    handleResize() {
      let windowWidth = document.body.clientWidth;
      this.trendsSpan = 24 / Math.floor(windowWidth / 500);
    },
    async validate() {
      return await this.$refs.FormTemplate.validate();
    },
  },
  watch: {},
};
</script>
<style lang="less" scoped></style>
<template>
  <FormTemplate
    ref="FormTemplate"
    :selfColumnType="selfColumnType"
    :selfColumnConfig="selfColumnConfig"
  ></FormTemplate>
</template>
<script>
export default {
  name: "CodeApply",
  components: { FormTemplate: () => import('./FormTemplate.vue') },
  props: {
  },
  data() {
    return {
      secVOList: [],
      formItems: [],
      trendsSpan: 8,
      selfColumnType: {
        codefixedsec: "combox",
        codeclassifysec: "refer",
        codevariablesec: "text",
        coderefersec: "refer",
      },
      selfColumnConfig: {
        function: {
          required: this.isRequired,
          dicData: this.getOptionList,
          type: this.getType,
        },
        exchange: {
          text: "name",
          field: "oid",
          prop: "oid",
          showField: "name",
          parentClassifySecOid: "parentClassifySecOid",
          label: "name",
          maxlength: "codeSecLength",
          data: "fixedValueVOList",
        },
        directVoluation: {
          search: true,
          props: {
            label: "id",
            value: "id",
          },
        },
      },
    };
  },
  created() {
    this.handleResize();
  },
  mounted() {},
  methods: {
    getType(item) {
      return this.selfColumnType[item.sectype];
    },
    isRequired(item) {
      return item.nullableFlag != "true";
    },
    getOptionList(item) {
      if (
        Array.isArray(item.fixedValueVOList) &&
        item.fixedValueVOList.length > 0
      ) {
        const configAttr = {
          key: "id",
          value: "id",
        };
        const optionList = item.fixedValueVOList.map((item) => {
          for (const key in configAttr) {
            if (Object.hasOwnProperty.call(configAttr, key)) {
              const element = configAttr[key];
              item[key] = item[element];
            }
          }
          return item;
        });
        return optionList;
      } else {
        return [];
      }
    },
    init(columnList) {
      this.$refs.FormTemplate.templateRender(columnList);
    },
    handleResize() {
      let windowWidth = document.body.clientWidth;
      this.trendsSpan = 24 / Math.floor(windowWidth / 500);
    },
    async validate() {
      return await this.$refs.FormTemplate.validate();
    },
  },
  watch: {},
};
</script>
<style lang="less" scoped></style>
Source/UBCS-WEB/src/components/refer/vciWebReferDefalut.vue
@@ -222,7 +222,7 @@
      this.selectionList.forEach((item,_index) =>{
        if(isMutiValue){
          var valueFieldArray = _that.props.value.split(",");
          valueFieldArray.forEach((_indexField,_itemField)=>{
          valueFieldArray.forEach((_itemField,_indexField)=>{
            value.push( item[_itemField] + (_that.referConfig.valueSep?_that.referConfig.valueSep:' '));
          })
        }else {
@@ -230,7 +230,7 @@
        }
        if(isMutiRaw) {
          var rawFieldArray = _that.props.label.split(",");
          rawFieldArray.forEach((_indexField,_itemField)=>{
          rawFieldArray.forEach((_itemField,_indexFiel)=>{
            text.push(item[_itemField] + (_that.referConfig.textSep?_that.referConfig.textSep:' ')) ;
          })
        }else{
Source/UBCS-WEB/src/components/refer/vciWebReferTable.vue
@@ -282,7 +282,7 @@
      this.selectionList.forEach((item,_index) =>{
        if(isMutiValue){
          var valueFieldArray = _that.props.value.split(",");
          valueFieldArray.forEach((_indexField,_itemField)=>{
          valueFieldArray.forEach((_itemField,_indexFiel)=>{
            value.push( item[_itemField] + (_that.referConfig.valueSep?_that.referConfig.valueSep:' '));
          })
        }else {
@@ -290,7 +290,7 @@
        }
        if(isMutiRaw) {
          var rawFieldArray = _that.props.label.split(",");
          rawFieldArray.forEach((_indexField,_itemField)=>{
          rawFieldArray.forEach((_itemField,_indexField)=>{
            text.push(item[_itemField] + (_that.referConfig.textSep?_that.referConfig.textSep:' ')) ;
          })
        }else{
Source/UBCS-WEB/src/mixins/codeApply.js
@@ -1,190 +1,190 @@
import { getCodeRule } from "@/api/formTemplate.js";
export default {
  data() {
    return {
      secVOList: [],
      localSecVOList: [],
      showCodeApply: false,
      selfColumnType: {
        codefixedsec: "combox",
        codeclassifysec: "refer",
        codevariablesec: "text",
        coderefersec: "refer",
      },
      selfColumnConfig: {
        function: {
          required: this.isRequired,
          dicData: this.getOptionList,
          type: this.getType,
          referConfig: this.getReferConfig,
          readOnly: this.getDisabled,
        },
        exchange: {
          text: "name",
          field: "oid",
          prop: "oid",
          showField: "name",
          parentClassifySecOid: "parentClassifySecOid",
          label: "name",
          maxlength: "codeSecLength",
          data: "fixedValueVOList",
        },
        directVoluation: {
          search: true,
          span: 12,
          props: {
            label: "id",
            value: "id",
          },
        },
      },
      codeApplyForm: {},
    }
  },
  created() {
    if (this.type === 'batchImportApply') {
      this.getCodeRule()
    }
  },
  methods: {
    // 获取码值申请数据
    getCodeRule() {
      getCodeRule({ codeClassifyOid: this.localCodeClassifyOid || this.codeClassifyOid }).then((res) => {
        if (res.data && res.data.code === 200) {
          const typeList = [
            "codefixedsec",
            "codeclassifysec",
            "codevariablesec",
            "coderefersec",
          ];
          this.secVOList = res.data.data.secVOList || []
          this.localSecVOList = (res.data.data.secVOList || []).filter((item) =>
            typeList.includes(item.secType)
          );
          if (this.localSecVOList.length > 0) {
            this.showCodeApply = true
            this.$nextTick(() => {
              if (this.batchApplyCodeTableData) {
                this.batchApplyCodeTableData[this.codeRuleOid]["localSecVOList"] = this.localSecVOList
              }
              this.$refs.CodeApply.templateRender(this.localSecVOList);
            });
          } else {
            this.showCodeApply = false
          }
        }
      });
    },
    getCodeApplyFormData(codeApplyForm) {
      this.codeApplyForm = codeApplyForm;
      if (this.batchApplyCodeTableData) {
        this.batchApplyCodeTableData[this.codeRuleOid]["codeApply"] = codeApplyForm
      }
    },
    getType(item) {
      console.log(item.secType, 'item.secType');
      return this.selfColumnType[item.secType];
    },
    getReferConfig(item) {
      let params = {};
      if (item.secType == "codeclassifysec") {
        params = {
          isMuti: false,
          type: "grid",
          tableConfig: {
            limit: -1,
            cols: [
              {
                field: "id",
                title: "英文名称",
                sort: true,
                width: 150,
              },
              {
                field: "name",
                title: "中文名称",
                sort: true,
                width: 150,
              },
              {
                field: "description",
                title: "描述",
                width: 250,
              },
            ],
            queryColumns: [
              {
                field: "id",
                title: "英文名称",
              },
              {
                field: "name",
                title: "中文名称",
              },
            ],
          },
          url: "api/ubcs-code/ubcs-code/mdmEngineController/listCodeClassifyValueBySecOid",
          extraParams: {
            classifySecOid: item.oid,
            parentClassifyValueOid: item.parentClassifySecOid
              ? this.codeApplyForm[item.parentClassifySecOid]
              : "",
          },
        };
      } else if (item.secType == "coderefersec") {
        params = JSON.parse(item.referValueInfo);
      }
      return params;
    },
    getDisabled(item) {
      if (item.secType === "codeclassifysec") {
        if (item.parentClassifySecOid) {
          if (!this.codeApplyForm[item.parentClassifySecOid]) {
            return true;
          } else {
            return false;
          }
        }
      }
    },
    isRequired(item) {
      return item.nullableFlag != "true";
    },
    getOptionList(item) {
      if (
        Array.isArray(item.fixedValueVOList) &&
        item.fixedValueVOList.length > 0
      ) {
        const configAttr = {
          key: "id",
          value: "id",
        };
        const optionList = item.fixedValueVOList.map((item) => {
          for (const key in configAttr) {
            if (Object.hasOwnProperty.call(configAttr, key)) {
              const element = configAttr[key];
              item[key] = item[element];
            }
          }
          return item;
        });
        return optionList;
      } else {
        return [];
      }
    },
    // 参照组件数据变更
    referConfigDataUpdate(data) {
      const { field } = data;
      this.localSecVOList = this.localSecVOList.map((item) => {
        if (item.parentClassifySecOid === field) {
          this.$refs.CodeApply.form[item.oid] = undefined;
          this.$refs.CodeApply.form[item.name] = undefined;
        }
        return item;
      });
      this.$refs.CodeApply.templateRender(this.localSecVOList);
    },
  }
}
import { getCodeRule } from "@/api/formTemplate.js";
export default {
  data() {
    return {
      secVOList: [],
      localSecVOList: [],
      showCodeApply: false,
      selfColumnType: {
        codefixedsec: "combox",
        codeclassifysec: "refer",
        codevariablesec: "text",
        coderefersec: "refer",
      },
      selfColumnConfig: {
        function: {
          required: this.isRequired,
          dicData: this.getOptionList,
          type: this.getType,
          referConfig: this.getReferConfig,
          readOnly: this.getDisabled,
        },
        exchange: {
          text: "name",
          field: "oid",
          prop: "oid",
          showField: "name",
          parentClassifySecOid: "parentClassifySecOid",
          label: "name",
          maxlength: "codeSecLength",
          data: "fixedValueVOList",
        },
        directVoluation: {
          search: true,
          span: 12,
          props: {
            label: "id",
            value: "id",
          },
        },
      },
      codeApplyForm: {},
    }
  },
  created() {
    if (this.type === 'batchImportApply') {
      this.getCodeRule()
    }
  },
  methods: {
    // 获取码值申请数据
    getCodeRule() {
      getCodeRule({ codeClassifyOid: this.localCodeClassifyOid || this.codeClassifyOid }).then((res) => {
        if (res.data && res.data.code === 200) {
          const typeList = [
            "codefixedsec",
            "codeclassifysec",
            "codevariablesec",
            "coderefersec",
          ];
          this.secVOList = res.data.data.secVOList || []
          this.localSecVOList = (res.data.data.secVOList || []).filter((item) =>
            typeList.includes(item.secType)
          );
          if (this.localSecVOList.length > 0) {
            this.showCodeApply = true
            this.$nextTick(() => {
              if (this.batchApplyCodeTableData) {
                this.batchApplyCodeTableData[this.codeRuleOid]["localSecVOList"] = this.localSecVOList
              }
              this.$refs.CodeApply.templateRender(this.localSecVOList);
            });
          } else {
            this.showCodeApply = false
          }
        }
      });
    },
    getCodeApplyFormData(codeApplyForm) {
      this.codeApplyForm = codeApplyForm;
      if (this.batchApplyCodeTableData) {
        this.batchApplyCodeTableData[this.codeRuleOid]["codeApply"] = codeApplyForm
      }
    },
    getType(item) {
      console.log(item.secType, 'item.secType');
      return this.selfColumnType[item.secType];
    },
    getReferConfig(item) {
      let params = {};
      if (item.secType == "codeclassifysec") {
        params = {
          isMuti: false,
          type: "grid",
          tableConfig: {
            limit: -1,
            cols: [
              {
                field: "id",
                title: "英文名称",
                sort: true,
                width: 150,
              },
              {
                field: "name",
                title: "中文名称",
                sort: true,
                width: 150,
              },
              {
                field: "description",
                title: "描述",
                width: 250,
              },
            ],
            queryColumns: [
              {
                field: "id",
                title: "英文名称",
              },
              {
                field: "name",
                title: "中文名称",
              },
            ],
          },
          url: "api/ubcs-code/ubcs-code/mdmEngineController/listCodeClassifyValueBySecOid",
          extraParams: {
            classifySecOid: item.oid,
            parentClassifyValueOid: item.parentClassifySecOid
              ? this.codeApplyForm[item.parentClassifySecOid]
              : "",
          },
        };
      } else if (item.secType == "coderefersec") {
        params = JSON.parse(item.referValueInfo);
      }
      return params;
    },
    getDisabled(item) {
      if (item.secType === "codeclassifysec") {
        if (item.parentClassifySecOid) {
          if (!this.codeApplyForm[item.parentClassifySecOid]) {
            return true;
          } else {
            return false;
          }
        }
      }
    },
    isRequired(item) {
      return item.nullableFlag != "true";
    },
    getOptionList(item) {
      if (
        Array.isArray(item.fixedValueVOList) &&
        item.fixedValueVOList.length > 0
      ) {
        const configAttr = {
          key: "id",
          value: "id",
        };
        const optionList = item.fixedValueVOList.map((item) => {
          for (const key in configAttr) {
            if (Object.hasOwnProperty.call(configAttr, key)) {
              const element = configAttr[key];
              item[key] = item[element];
            }
          }
          return item;
        });
        return optionList;
      } else {
        return [];
      }
    },
    // 参照组件数据变更
    referConfigDataUpdate(data) {
      const { field } = data;
      this.localSecVOList = this.localSecVOList.map((item) => {
        if (item.parentClassifySecOid === field) {
          this.$refs.CodeApply.form[item.oid] = undefined;
          this.$refs.CodeApply.form[item.name] = undefined;
        }
        return item;
      });
      this.$refs.CodeApply.templateRender(this.localSecVOList);
    },
  }
}