wangting
2024-11-14 aa6f213ac00f69c8812b0d6a97232a1f1a9b7e44
Source/plt-web/plt-web-ui/src/components/PLT-basic-component/basicForm.vue
@@ -1,6 +1,6 @@
<template>
  <!--动态模板-->
  <avue-form ref="form" :option="option" v-model="form">
  <avue-form ref="form" :option="option" v-model="form" v-loading="loading">
    <template v-for="item in allColumn" :slot="item.prop+ ''">
      <vciWebRefer
        v-if="item.type === 'refer'"
@@ -83,6 +83,7 @@
  },
  data() {
    return {
      loading:false,
      form: this.formData,
      option: {
        menuBtn:false,
@@ -121,6 +122,7 @@
          Object.assign(this.form, this.initValue);
        }
      },
      deep:true,
      immediate: true,
    },
    formData: {
@@ -185,13 +187,14 @@
    initItem(item){
      const type=this.columnType[item.type] || item.type;
      item.text=item.text || item.label;
      const col= {
      let col= {
        ...item,
        label: item.text,
        prop: item.field,
        showProp:item.showField,
        type: type,
        labelWidth: this.labelWidth || (item.text.length >= 6 ? 115 : 90),
        disabled: !this.isEdit || item.readOnly || this.disabled,
        disabled: item.readOnly || this.disabled,
        span: item.span
          ? item.span
          : item.type === "textarea"
@@ -221,11 +224,11 @@
          required: item.required|| false,
          message: `请输入${item.text}!`,
          trigger: "submit"
        }]):[],
        ...item
        }]):[]
      };
      if(!this.isEdit){
        col.placeholder=col.label;
        col.disabled=true;
      }
      if(col.type === 'richText'){
        this.subitemName = col.field;
@@ -236,20 +239,20 @@
          col.display=false
        }
      }
      if (col.type === "select") {
        if(col.data && col.data.length>0){
      if (col.type === "select" || col.type==='radio' || col.type==='checkbox') {
        if (col.data && col.data.length > 0) {
          col.dicData = col.data.map((d) => {
            return {
              label: d.key,
              key: d.value,
              value: d.value,
              attributes:d.attributes
              attributes: d.attributes
            };
          });
        }else if(!validatenull(col.dictCode)) {
        } else if (!validatenull(col.dictCode)) {
          getDicts(col.dictCode).then((res) => {
            if (res.data.success){
              if(res.data.data && res.data.obj == null){
            if (res.data.success) {
              if (res.data.data && res.data.obj == null) {
                res.data.obj = res.data.data
              }
              const dic = res.data.obj;
@@ -258,11 +261,13 @@
                  label: d.value,
                  key: d.key,
                  value: d.key,
                  attributes:d.attributes
                  attributes: d.attributes
                };
              });
            }
          });
        } else {
          col.dicData = [];
        }
      }
      if (col.type==='refer') {