From a5b4ca739c0bd94f083ca88c0bca24bf08d9e825 Mon Sep 17 00:00:00 2001 From: BoBoooooo <17746714@qq.com> Date: Mon, 11 Jan 2021 20:45:09 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=AB=98=E7=BA=A7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=A1=A8=E5=8D=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crud-table/src/SeniorSearchForm.vue | 127 +++++++----------- 1 file changed, 48 insertions(+), 79 deletions(-) diff --git a/src/component/crud-table/src/SeniorSearchForm.vue b/src/component/crud-table/src/SeniorSearchForm.vue index 4177784..6f08e06 100644 --- a/src/component/crud-table/src/SeniorSearchForm.vue +++ b/src/component/crud-table/src/SeniorSearchForm.vue @@ -69,7 +69,10 @@ export default class SeniorSearchForm extends Vue { entity: any = {}; - formDesign = {}; + formDesign = { + config: {}, + list: [], + }; @Prop({ type: Array, @@ -85,10 +88,6 @@ export default class SeniorSearchForm extends Vue { generateDialogForm: HTMLFormElement; }; - created() { - this.autoGenerateFormByBackend(); - } - resetForm() { this.$refs.generateDialogForm.resetForm(); this.visible = false; @@ -118,92 +117,62 @@ export default class SeniorSearchForm extends Vue { const { type, label, prop, option, } = column; - const row: any = { - type: 'grid', - columns: [], + const input: any = { + type: 'input', + name: label, options: { - gutter: 0, + type: 'input', + dataType: 'string', + placeholder: `请输入${label}`, + width: '100%', }, - model: '1575516929000_36539', + model: prop, rules: [], }; - const input: any = { - span: 24, - list: [ - { - type: 'input', - name: label, - options: { - type: 'input', - dataType: 'string', - placeholder: `请输入${label}`, - width: '100%', - }, - model: prop, - rules: [], - }, - ], - }; const date: any = { - span: 24, - list: [ - { - type: 'date', - name: label, - model: prop, - rules: [], - options: { - editable: true, - clearable: true, - startPlaceholder: '请选择开始时间', - endPlaceholder: '请选择结束时间', - type: 'monthrange', - format: 'yyyy-MM', - width: '100%', - }, - }, - ], + type: 'date', + name: label, + model: prop, + rules: [], + options: { + editable: true, + clearable: true, + startPlaceholder: '请选择开始时间', + endPlaceholder: '请选择结束时间', + type: 'monthrange', + format: 'yyyy-MM', + width: '100%', + }, }; const select: any = { - span: 24, - list: [ - { - type: 'select', - name: label, - options: { - clearable: true, - options: [], - allowCreate: false, - remote: 'dict', - remoteOptions: [], - props: { - value: 'value', - label: 'label', - }, - remoteFunc: '', - dictType: '', - ...option, - placeholder: `请选择${label}`, - width: '100%', - }, - model: prop, - rules: [], + type: 'select', + name: label, + options: { + clearable: true, + options: [], + allowCreate: false, + remote: 'dict', + remoteOptions: [], + props: { + value: 'value', + label: 'label', }, - ], + remoteFunc: '', + dictType: '', + ...option, + placeholder: `请选择${label}`, + width: '100%', + }, + model: prop, + rules: [], }; - if ( - prop.includes('date') - || prop.includes('time') - || label.includes('日期') - || label.includes('时间') - ) { - row.columns.push(date); + if (prop.includes('date') || prop.includes('time') || label.includes('日期') || label.includes('时间')) { + formJson.list.push(date); } else if (option && option.type === 'select') { - row.columns.push(select); + formJson.list.push(select); } else { - row.columns.push(input); + formJson.list.push(input); } - formJson.list.push(row); } this.formDesign = formJson; }