This commit is contained in:
lb 2023-08-03 10:51:44 +08:00
parent d3760f5dee
commit a402a8bf63
2 changed files with 69 additions and 27 deletions

View File

@ -31,6 +31,42 @@
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<base-dialog <base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="40%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
:dataForm="form"
:rows="[
[
{
select: true,
label: '检测类型',
prop: 'typeId',
url: '/base/quality-inspection-type/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
],
[
{
input: true,
label: '检测内容',
prop: 'content',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[{ input: true, label: '检测编码', prop: 'code' }],
[{ input: true, label: '备注', prop: 'remark' }],
]" />
</base-dialog>
<!-- <base-dialog
:dialogTitle="title" :dialogTitle="title"
:dialogVisible="open" :dialogVisible="open"
@cancel="cancel" @cancel="cancel"
@ -55,7 +91,7 @@
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</base-dialog> </base-dialog> -->
</div> </div>
</template> </template>
@ -70,10 +106,11 @@ import {
} from '@/api/base/qualityInspectionDet'; } from '@/api/base/qualityInspectionDet';
import moment from 'moment'; import moment from 'moment';
import DialogForm from '../../components/dialogForm.vue';
export default { export default {
name: 'QualityInspectionDet', name: 'QualityInspectionDet',
components: {}, components: { DialogForm },
data() { data() {
return { return {
typeList: [], // typeList: [], //
@ -209,7 +246,7 @@ export default {
}, },
/** search bar related */ /** search bar related */
handleSearchBarBtnClick(btn) { handleSearchBarBtnClick(btn) {
const keys = ['name', 'createTime']; // timeVal const keys = ['content', 'createTime']; // timeVal
switch (btn.btnName) { switch (btn.btnName) {
case 'search': case 'search':
keys.forEach((key) => { keys.forEach((key) => {
@ -218,8 +255,10 @@ export default {
this.queryParams['endTime'] = btn.timeVal[1]; this.queryParams['endTime'] = btn.timeVal[1];
return; return;
} }
console.log('key', key, btn[key])
this.queryParams[key] = btn[key] || null; this.queryParams[key] = btn[key] || null;
}); });
console.log('queryParams', this.queryParams)
this.handleQuery(); this.handleQuery();
break; break;
case 'add': case 'add':
@ -239,16 +278,14 @@ export default {
}, },
/** 获取检测类型id */ /** 获取检测类型id */
getTypeList() { getTypeList() {
this.$axios('/base/quality-inspection-type/listAll').then( this.$axios('/base/quality-inspection-type/listAll').then((response) => {
(response) => {
this.typeList = response.data.map((item) => { this.typeList = response.data.map((item) => {
return { return {
label: item.name, label: item.name,
value: item.id, value: item.id,
}; };
}); });
} });
);
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {

View File

@ -18,10 +18,12 @@
v-if="col.input" v-if="col.input"
v-model="form[col.prop]" v-model="form[col.prop]"
@change="$emit('update', form)" @change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" /> v-bind="col.bind" />
<el-select <el-select
v-if="col.select" v-if="col.select"
v-model="form[col.prop]" v-model="form[col.prop]"
:placeholder="`请选择${col.label}`"
@change="$emit('update', form)" @change="$emit('update', form)"
v-bind="col.bind"> v-bind="col.bind">
<el-option <el-option
@ -73,7 +75,7 @@ export default {
}, },
data() { data() {
return { return {
formLoading: false, formLoading: true,
optionListOf: {}, optionListOf: {},
}; };
}, },
@ -88,10 +90,10 @@ export default {
get() { get() {
return this.dataForm; return this.dataForm;
}, },
set(val) { // set(val) {
console.log('set form', val); // console.log('set form', val);
// this.$emit('update', val); // // this.$emit('update', val);
}, // },
}, },
}, },
mounted() { mounted() {
@ -108,6 +110,7 @@ export default {
}, },
handleOptions() { handleOptions() {
// console.log("[dialogForm:handleOptions]")
const promiseList = []; const promiseList = [];
this.rows.forEach((cols) => { this.rows.forEach((cols) => {
cols.forEach(async (opt) => { cols.forEach(async (opt) => {
@ -131,9 +134,11 @@ export default {
); );
}); });
try { try {
this.formLoading = true; // this.formLoading = true;
await Promise.all(promiseList); // console.log("[dialogForm:handleOptions:promiseList]", promiseList)
await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false; this.formLoading = false;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
} catch (error) { } catch (error) {
console.log('[dialogForm:handleOptions:error]', error); console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false; this.formLoading = false;