wangting
2024-04-30 f5f8aaedd1d488fb20a293182dd7a40e2e82096e
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -131,7 +131,7 @@
      this.$refs.dynamicForm.form = row;
    },
    buttonClick(buttonitem) {
      const paramVOS=buttonitem.paramVOS;
      const paramVOS = buttonitem.paramVOS;
      const DefineVO = this.componentVO.treeDefineVO || this.componentVO.tableDefineVO || this.componentVO.treeTableDefineVO || this.componentVO.formDefineVO;
      if (!paramVOS['title']) {
        paramVOS['title'] = buttonitem.name + (DefineVO.title || this.componentVO.description || '');
@@ -140,59 +140,24 @@
      if (!paramVOS['type']) {
        paramVOS['type'] = DefineVO.btmType;
      }
      paramVOS['initvalue']=paramVOS['initvalue'] || paramVOS['initValue'];
      let isShow = true;
      if (paramVOS['initvalue'] && typeof(paramVOS.initvalue)=='string') {
        let values = paramVOS['initvalue'].split(';');
        let initValues = {}
        values.forEach((item,i) => {
          if(isShow){
            item = item.replace(':', '=');
            if (item.indexOf('${') > -1) {
              if (item.split('=')[1].indexOf('.') > -1) {
                if (this.sourceData.length < 1 || !this.sourceData.oid) {
                  isShow = false;
                  this.$message.error("请先选择一条来源数据")
                  return false;
                }
                let name = item.split('=')[1].split('.')[1].replace('${', '').replace('}', '');
                initValues[item.split('=')[0]] = this.sourceData[name]
              } else {
                if (this.dataStore.length < 1) {
                  isShow = false;
                  this.$message.error("请先选择一条数据");
                  return false;
                }
                let name = item.split('=')[1].replace('${', '').replace('}', '');
                initValues[item.split('=')[0]] = this.dataStore[0][name];
              }
            }
          }
        })
        if(isShow){
          paramVOS['initvalue'] = initValues
      if (paramVOS['BSContent'] || paramVOS['BSContext']) {
        paramVOS['context'] = paramVOS['BSContext'] || paramVOS['BSContent']
        paramVOS['content'] = paramVOS['BSContext'] || paramVOS['BSContent'];
      }
      const that = this;
      //paramVOS.customBtn //弹窗默认有保存按钮,customBtn为true时内容展示自定义按钮
      paramVOS.form = "editknowledgefolderall"
      doAction(buttonitem, {
        paramVOS: paramVOS,
        dataStore: this.dataStore || [],
        sourceData: this.sourceData || {}
      }, function () {
        if (that.$parent.handleRefresh) {
          that.$parent.handleRefresh()
        }
      }
      if(paramVOS['BSContent'] || paramVOS['BSContext']){
        paramVOS['context']=paramVOS['BSContext'] || paramVOS['BSContent']
        paramVOS['content']=paramVOS['BSContext'] || paramVOS['BSContent'];
      }
      const that=this;
      if(isShow) {
        //paramVOS.customBtn //弹窗默认有保存按钮,customBtn为true时内容展示自定义按钮
        //paramVOS.form="editknowledgefolderall"
        doAction(buttonitem, {
          paramVOS: paramVOS,
          dataStore: this.dataStore || [],
          sourceData: this.sourceData || {}
        },function (){
          if (that.$parent.handleRefresh) {
            that.$parent.handleRefresh()
          }
        });
      }
      });
    }
  },
}