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' }],
]" />
</base-dialog>

View File

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