wangting
2024-05-06 506b5b59e3899d8dd40a61cc8b9a575bbde3caaa
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,15 +1,20 @@
<template>
  <div :id="'UI-dynamic-'+areasName+componentVO.oid" class="UI-dynamic">
    <dynamic-button v-if="componentVO && componentVO.buttons" :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData" type="form"></dynamic-button>
    <basic-form :span="this.componentVO.formDefineVO.columnOneRow?(24/this.componentVO.formDefineVO.columnOneRow) : 12"
    <dynamic-button v-if="componentVO && componentVO.buttons" :key="areasName+'buttons-'+componentVO.oid"
                    :componentVO="componentVO" :butttonList="componentVO.buttons" :dataStore="[form]" :sourceData="sourceData" type="form"></dynamic-button>
    <basic-form :key="areasName+'basicForm-'+componentVO.oid"
                :span="this.componentVO.formDefineVO.columnOneRow?(24/this.componentVO.formDefineVO.columnOneRow) : 12"
                :formItems="this.componentVO.formDefineVO && this.componentVO.formDefineVO.items"
                :formData="form">
                :disabled="!inDialog"
                :isEdit="canEdit"
                :formData="form"
                :initValue="paramVOS.initvalue"
                @getFormData="getFormData">
    </basic-form>
  </div>
</template>
<script>
import {dataForm} from "@/api/base/ui";
export default {
@@ -30,6 +35,11 @@
    inDialog: {
      type: Boolean,
      default: false
    },
    canEdit:{
      //内容是否可编辑
      type:Boolean,
      default:false
    },
    areasName: {
      type: String,
@@ -76,8 +86,14 @@
          this.$emit("setDataStore", {
            area: this.areasName,
            type:this.componentVO.uiComponentType,
            btmType:this.componentVO.treeDefineVO.btmType,
            btmType:this.currentDefineVO.btmType,
            dataStore:[newval]
          });
          this.$emit("setData", {
            area: this.areasName,
            type:this.componentVO.uiComponentType,
            btmType:this.currentDefineVO.btmType,
            data:newval
          });
        }
      }
@@ -128,8 +144,6 @@
        btmname: this.currentDefineVO.btmType,
        btmType:this.currentDefineVO.btmType,
        formDefineId: this.currentDefineVO.id,
        componentOid: this.componentVO.oid,
        uiDefineId: this.uiContext,
        oid:this.currentDefineVO.oid
      };
      if(this.dataStore[0] && this.dataStore[0].oid) {
@@ -140,6 +154,9 @@
      this.params = Object.assign({},formParams, sourceDataMapList);
    },
    onLoad:function () {
      if (this.paramVOS.initvalue) {
        this.form=this.paramVOS.initvalue;
      }
      if (Object.keys(this.sourceData).length>0 && this.isShow) {
        this.loading = true;
        dataForm(this.params).then(res => {
@@ -151,8 +168,12 @@
        });
      }
    },
    handleRefresh(){
    handleRefresh() {
      this.form={}
      this.onLoad();
    },
    getFormData(form) {
      this.form = form;
    }
  }
}