wangting
2024-12-06 be1ba16a724cc70bda924333e809d144e6725552
Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-form.vue
@@ -104,7 +104,14 @@
      },
      deep: true,
      immediate: true
    }
    },
    isShow: {
      handler(newval) {
        if(newval){
          this.handleRefresh();
        }
      }
    },
  },
  created() {
    this.getParams();
@@ -112,27 +119,41 @@
  methods: {
    sourceDataMap: function () {
      const sourceDataMap = {};
      if (Object.keys(this.sourceData).length > 0) {
        if (this.sourceData.oid) {
          if (this.sourceData.oid.indexOf('@vcitreesep@') > -1) {
            this.sourceData.oid = this.sourceData.oid.split('@vcitreesep@')[1];
      if (Object.keys(this.sourceData).length>0) {
        if(this.sourceData.part && Object.keys(this.sourceData.part).length>0){
          //说明源数据是树节点
          if(this.sourceData.part.oid ) {
            if (this.sourceData.part.oid.indexOf('@vcitreesep@') > -1) {
              this.sourceData.part.oid = this.sourceData.oid.split('@vcitreesep@')[1];
            }
            sourceDataMap.sourceBtmName = this.sourceBtmType;
            sourceDataMap.sourceOid = this.sourceData.part.oid;
          }
          sourceDataMap.sourceBtmName = this.sourceBtmType;
          ;
          sourceDataMap.sourceOid = this.sourceData.oid;
        }else {
          if(this.sourceData.oid ) {
            if (this.sourceData.oid.indexOf('@vcitreesep@') > -1) {
              this.sourceData.oid = this.sourceData.oid.split('@vcitreesep@')[1];
            }
            sourceDataMap.sourceBtmName = this.sourceBtmType;
            sourceDataMap.sourceOid = this.sourceData.oid;
          }
        }
        for (let i in this.sourceData) {
          const item = this.sourceData[i]
          if (item && item.constructor === Object) continue;
          if (['type', 'context', 'content', 'querytemplate', 'querytype'].includes(i)) continue;
          sourceDataMap['sourceData["' + i + '"]'] = item
          if (item && item.constructor === Object) {
            sourceDataMap['sourceData["' + i + '"]'] = JSON.stringify(item)
          }else {
            sourceDataMap['sourceData["' + i + '"]'] = item
          }
        }
      }
      if (Object.keys(this.paramVOS).length > 0) {
        for (let j in this.paramVOS) {
          if (this.paramVOS[j] && this.paramVOS[j].constructor === Object) continue;
          if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata'].includes(j)) continue;
          if (['type', 'context', 'content', "getdataurl", "getdatamethod", "url", "method", "uploadfileurl", "title", 'querytemplate', 'querytype', 'usesourcedata','component'].includes(j)) continue;
          sourceDataMap['sourceData["' + j + '"]'] = this.paramVOS[j]
        }
      }
@@ -140,10 +161,12 @@
    },
    getParams: function () {
      const formParams = {
        btmname: this.currentDefineVO.btmType,
        btmName: this.currentDefineVO.btmType,
        btmType: this.currentDefineVO.btmType,
        formDefineId: this.currentDefineVO.id,
        oid: this.currentDefineVO.oid
        formDefineOid: this.currentDefineVO.oid,
        componentOid: this.componentVO.oid,
        uiDefineId: this.uiContext,
      };
      if (this.dataStore[0] && this.dataStore[0].oid) {
        formParams.oid = this.dataStore[0].oid;
@@ -158,7 +181,11 @@
      }
      if (Object.keys(this.sourceData).length > 0 && this.isShow && this.actionType != "add") {
        this.loading = true;
        dataForm(this.params, this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => {
        let url=''
        if(this.componentVO.bsCustQueryCLsOrUrl && this.componentVO.bsCustQueryCLsOrUrl.indexOf('/')!=-1){
          url=this.componentVO.bsCustQueryCLsOrUrl
        }
        dataForm(this.params,  this.paramVOS.getdataurl || url, this.paramVOS.getdatamethod).then(res => {
          this.form = res.data.obj.data;
          this.loading = false;
        }).catch(error => {