| | |
| | | <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"> |
| | | <template v-for="item in slotData" :slot="item.prop + 'Label'"> |
| | | <avue-form v-model="form" :option="option"> |
| | | <template v-for="item in slotData" :slot="item.prop + 'Label'"> |
| | | <span> |
| | | <span>{{ item.label }} </span> |
| | | <el-tooltip |
| | |
| | | <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> |
| | | <template slot="menuForm"> |
| | | <dynamic-button type="form" :butttonList="componentVO.buttons" @buttonClick="buttonClick"></dynamic-button> |
| | | </template> |
| | | </avue-form> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | type: Object, |
| | | default: {} |
| | | }, |
| | | visible: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | title: { |
| | | type: String |
| | | }, |
| | | formList:{ |
| | | type:Array |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | } |
| | | }, |
| | | mounted() { |
| | | // console.log('componentVO--',this.componentVO.tableDefineVO.cols[0]) |
| | | }, |
| | | computed: { |
| | | dialogFormVisible: { |
| | | get() { |
| | | return this.visible; |
| | | }, |
| | | set(val) { |
| | | this.$emit("update:visible", val); |
| | | }, |
| | | }, |
| | | option() { |
| | | return { |
| | | column: this.formColumn(this.formList) |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | height: 300, |
| | | column: this.formColumn(this.componentVO.tableDefineVO.cols[0]) |
| | | } |
| | | }, |
| | | slotData(){ |
| | | return this.formColumn(this.formList) |
| | | slotData() { |
| | | return this.formColumn(this.componentVO.tableDefineVO.cols[0]) |
| | | } |
| | | }, |
| | | methods:{ |
| | | //表单提交 |
| | | submitHandler(form,done){ |
| | | console.log(form) |
| | | console.log(this.slotData) |
| | | done() |
| | | }, |
| | | changeHandler(){ |
| | | this.form = {}; |
| | | // this.clearValidate() 清空校验 |
| | | // this.resetFields() |
| | | }, |
| | | methods: { |
| | | //转化数据 |
| | | formColumn(formList) { |
| | | return formList.map(item => { |
| | | const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type; |
| | |
| | | disabled: item.disabled, |
| | | labelSuffix: item.suffix, |
| | | suffixIcon: item.prefix, |
| | | placeholder:item.placeholder, |
| | | clearable:item.clearable, |
| | | placeholder: item.placeholder, |
| | | clearable: item.clearable, |
| | | tip: item.tooltips, |
| | | keyAttr: item.keyAttr, |
| | | rules: [{ |
| | |
| | | } |
| | | }) |
| | | }, |
| | | closeHandler(){ |
| | | this.form = {}; |
| | | buttonClick(item) { |
| | | console.log(item.id) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | <style scoped> |
| | | |
| | | </style> |