test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
2 changed files with 42 additions and 17 deletions
Showing only changes of commit 7c665484a7 - Show all commits

View File

@ -52,7 +52,14 @@
// } // }
}, },
], ],
[{ input: true, label: '检测类型编码', prop: 'code' }], [
{
input: true,
label: '检测类型编码',
prop: 'code',
url: '/base/quality-inspection-type/getCode',
},
],
[{ input: true, label: '备注', prop: 'remark' }], [{ input: true, label: '备注', prop: 'remark' }],
]" /> ]" />
</base-dialog> </base-dialog>

View File

@ -97,6 +97,9 @@ export default {
get() { get() {
return this.dataForm; return this.dataForm;
}, },
set(val) {
console.log('set form', val);
},
}, },
}, },
mounted() { mounted() {
@ -111,7 +114,11 @@ export default {
resetFields(args) { resetFields(args) {
return this.$refs.form.resetFields(args); return this.$refs.form.resetFields(args);
}, },
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
handleOptions() { handleOptions() {
// console.log("[dialogForm:handleOptions]") // console.log("[dialogForm:handleOptions]")
const promiseList = []; const promiseList = [];
@ -120,13 +127,19 @@ export default {
if (opt.options) { if (opt.options) {
this.optionListOf[opt.prop] = opt.options; this.optionListOf[opt.prop] = opt.options;
} else if (opt.url) { } else if (opt.url) {
//
if (opt.select || (opt.input && !this.form?.id)) {
promiseList.push(async () => { promiseList.push(async () => {
const response = await this.$axios(opt.url, { const response = await this.$axios(opt.url, {
method: opt.method ?? 'get', method: opt.method ?? 'get',
}); });
console.log('[dialogForm:handleOptions:response]', response); console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) {
//
const list = const list =
'list' in response.data ? response.data.list : response.data; 'list' in response.data
? response.data.list
: response.data;
this.$set( this.$set(
this.optionListOf, this.optionListOf,
opt.prop, opt.prop,
@ -135,7 +148,12 @@ export default {
value: item[opt.valueKey ?? 'id'], value: item[opt.valueKey ?? 'id'],
})) }))
); );
} else if (opt.input) {
//
this.form[opt.prop] = response.data;
}
}); });
}
try { try {
// this.formLoading = true; // this.formLoading = true;
// console.log("[dialogForm:handleOptions:promiseList]", promiseList) // console.log("[dialogForm:handleOptions:promiseList]", promiseList)