田源
2024-03-18 58dea2b63641f930bad79a8b5a4c66b860967b88
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -1,7 +1,22 @@
<template>
  <basic-container>
    <el-dialog v-if="dialogFormVisible" :title="title" :visible.sync="dialogFormVisible" @close="closeHandler" append-to-body>
      <avue-form v-model="form" :option="option" @submit="submitHandler" @reset-change="changeHandler"></avue-form>
      <avue-form v-model="form" :option="option" @submit="submitHandler" @reset-change="changeHandler">
        <template v-for="item in slotData" :slot="item.prop + 'Label'">
        <span>
          <span>{{ item.label }} </span>
          <el-tooltip
            v-if="item.keyAttr"
            class="item"
            content="该属性为关键属性"
            effect="dark"
            placement="top-start"
          >
            <i class="el-icon-star-on" style="font-size: 17px !important; color: red;vertical-align: baseline;"></i>
          </el-tooltip>
        </span>
        </template>
      </avue-form>
    </el-dialog>
  </basic-container>
</template>
@@ -61,11 +76,15 @@
        column: this.formColumn(this.formList)
      }
    },
    slotData(){
      return this.formColumn(this.formList)
    }
  },
  methods:{
    //表单提交
    submitHandler(form,done){
      console.log(form)
      console.log(this.slotData)
      done()
    },
    changeHandler(){
@@ -89,6 +108,8 @@
          suffixIcon: item.prefix,
          placeholder:item.placeholder,
          clearable:item.clearable,
          tip: item.tooltips,
          keyAttr: item.keyAttr,
          rules: [{
            required: item.required,
            message: `请输入${item.text}!`,
@@ -104,6 +125,6 @@
}
</script>
<style scoped>
<style scoped lang="scss">
</style>