| | |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | height: 300, |
| | | column: this.formColumn(this.componentVO.tableDefineVO.cols[0]) |
| | | column: this.getColumnData(0) |
| | | } |
| | | }, |
| | | slotData() { |
| | | return this.formColumn(this.componentVO.tableDefineVO.cols[0]) |
| | | return this.getColumnData(0) |
| | | } |
| | | }, |
| | | methods: { |
| | | //转化数据 |
| | | formColumn(formList) { |
| | | return formList.map(item => { |
| | | const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type; |
| | | return formList.map(item => { |
| | | const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type; |
| | | |
| | | return { |
| | | label: item.text, |
| | | prop: item.field, |
| | | type: typeValue, |
| | | value: item.defaultValue, |
| | | dicData: item.type === 'combox' ? item.dicData : item.dicUrl, |
| | | readonly: item.readOnly, |
| | | disabled: item.disabled, |
| | | labelSuffix: item.suffix, |
| | | suffixIcon: item.prefix, |
| | | placeholder: item.placeholder, |
| | | clearable: item.clearable, |
| | | tip: item.tooltips, |
| | | keyAttr: item.keyAttr, |
| | | rules: [{ |
| | | required: item.required, |
| | | message: `请输入${item.text}!`, |
| | | trigger: "blur" |
| | | }] |
| | | } |
| | | }) |
| | | return { |
| | | label: item.text, |
| | | prop: item.field, |
| | | type: typeValue, |
| | | value: item.defaultValue, |
| | | dicData: item.type === 'combox' ? item.dicData : item.dicUrl, |
| | | readonly: item.readOnly, |
| | | disabled: item.disabled, |
| | | labelSuffix: item.suffix, |
| | | suffixIcon: item.prefix, |
| | | placeholder: item.placeholder, |
| | | clearable: item.clearable, |
| | | tip: item.tooltips, |
| | | keyAttr: item.keyAttr, |
| | | rules: [{ |
| | | required: item.required, |
| | | message: `请输入${item.text}!`, |
| | | trigger: "blur" |
| | | }] |
| | | }; |
| | | }); |
| | | }, |
| | | |
| | | //数据判空 |
| | | getColumnData(index) { |
| | | if (this.componentVO && this.componentVO.tableDefineVO && this.componentVO.tableDefineVO.cols && this.componentVO.tableDefineVO.cols.length > 0) { |
| | | return this.formColumn(this.componentVO.tableDefineVO.cols[index]) |
| | | } else { |
| | | return null; |
| | | } |
| | | }, |
| | | |
| | | buttonClick(item) { |
| | | console.log(item.id) |
| | | }, |
| | |
| | | :table-loading="loading"> |
| | | <!--top区域按钮--> |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <dynamic-button LocationType="top" type="table":butttonList="componentVO.buttons" @buttonClick="buttonClick" ></dynamic-button> |
| | | <dynamic-button LocationType="top" type="table":butttonList="componentVO.buttons" ></dynamic-button> |
| | | </template> |
| | | |
| | | <!--menu区域按钮--> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <dynamic-button :scope="scope" LocationType="menu" type="table":butttonList="componentVO.buttons" @buttonClick="buttonClick" ></dynamic-button> |
| | | <dynamic-button :scope="scope" LocationType="menu" type="table":butttonList="componentVO.buttons" ></dynamic-button> |
| | | </template> |
| | | </avue-crud> |
| | | <!-- 表格内按钮操作对话框表单 --> |
| | | <dynamic-table-form ref="dynamicForm" :formList="formList" :title="formName" :visible.sync="visible" |
| | | style="display: none"></dynamic-table-form> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | ts: "2022-02-18 14:35:53.177" |
| | | }, |
| | | ], |
| | | // 表单数据 |
| | | formList: [ |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "name", |
| | | hidden: false, |
| | | keyAttr: true, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: true, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: '$', |
| | | text: "名称", |
| | | tooltips: '名称', |
| | | type: "text", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "code", |
| | | hidden: false, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | disabled:true, |
| | | text: "编码", |
| | | tooltips: null, |
| | | type: "text", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: "EnumReviewType", |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "department", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "reviewtype", |
| | | hidden: false, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "类型", |
| | | tooltips: null, |
| | | type: "combox", |
| | | unique: false, |
| | | verify: "", |
| | | dicData: [{ |
| | | label: '测试1', |
| | | value: 'department' |
| | | }, { |
| | | label: '测试2', |
| | | value: 'departments' |
| | | }] |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "creator", |
| | | hidden: true, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: true, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "创建人", |
| | | tooltips: null, |
| | | type: "text", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: "yyyy-MM-dd HH:mm:ss", |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "createtime", |
| | | hidden: true, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "创建时间", |
| | | tooltips: null, |
| | | type: "datetime", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | { |
| | | comboxKey: null, |
| | | customClass: null, |
| | | data: null, |
| | | dateFormate: null, |
| | | defaultValue: "", |
| | | displayExtension: "", |
| | | extendAttrMap: null, |
| | | extendAttrString: null, |
| | | field: "content", |
| | | hidden: false, |
| | | keyAttr: false, |
| | | prefix: null, |
| | | readOnly: false, |
| | | referConfig: null, |
| | | required: false, |
| | | selectLibFlag: null, |
| | | showField: null, |
| | | suffix: null, |
| | | text: "备注", |
| | | tooltips: null, |
| | | type: "textarea", |
| | | unique: false, |
| | | verify: "" |
| | | }, |
| | | ], |
| | | option: { |
| | | index: true, |
| | | addBtn: false, |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | buttonClick(scope, item) { |
| | | this.formName = item.name; |
| | | |
| | | function handleAdd() { |
| | | this.visible = true; |
| | | } |
| | | |
| | | function handleEdit() { |
| | | this.visible = true; |
| | | this.$refs.dynamicForm.form = scope.row; |
| | | } |
| | | |
| | | function handleDelete() { |
| | | this.$message.success('删除成功!'); |
| | | } |
| | | |
| | | const methodHandlers = { |
| | | add: handleAdd.bind(this), |
| | | edit: handleEdit.bind(this), |
| | | delete: handleDelete.bind(this), |
| | | }; |
| | | |
| | | const method = item.paramVOS.buttonMethods; |
| | | const handler = methodHandlers[method]; |
| | | if (handler) { |
| | | handler(); |
| | | } else { |
| | | this.$message.error('请重新配置按钮!') |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |