test #47

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

View File

@ -38,11 +38,30 @@
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm <DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
v-if="open" </base-dialog>
ref="form" </div>
:dataForm="form" </template>
:rows="[
<script>
import {
createQualityInspectionBoxBtn,
updateQualityInspectionBoxBtn,
deleteQualityInspectionBoxBtn,
getQualityInspectionBoxBtn,
getQualityInspectionBoxBtnPage,
exportQualityInspectionBoxBtnExcel,
} from '@/api/base/qualityInspectionBoxBtn';
import basicPageMixin from '../../mixin/basicPageMixin';
import moment from 'moment';
export default {
name: 'QualityInspectionBoxBtn',
mixins: [basicPageMixin],
components: {},
data() {
return {
rows: [
[ [
{ {
select: true, select: true,
@ -63,13 +82,6 @@
prop: 'sectionId', prop: 'sectionId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
}, },
// {
// select: true,
// url: '', //
// label: '',
// prop: 'inspectionDetContent',
// rules: [{ required: true, message: '', trigger: 'blur' }],
// },
], ],
[ [
{ {
@ -111,29 +123,7 @@
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
}, },
], ],
]" /> ],
</base-dialog>
</div>
</template>
<script>
import {
createQualityInspectionBoxBtn,
updateQualityInspectionBoxBtn,
deleteQualityInspectionBoxBtn,
getQualityInspectionBoxBtn,
getQualityInspectionBoxBtnPage,
exportQualityInspectionBoxBtnExcel,
} from '@/api/base/qualityInspectionBoxBtn';
import basicPageMixin from '../../mixin/basicPageMixin';
import moment from 'moment';
export default {
name: 'QualityInspectionBoxBtn',
mixins: [basicPageMixin],
components: {},
data() {
return {
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',

View File

@ -108,6 +108,18 @@ export default {
}, },
}, },
}, },
watch: {
rows: {
handler() {
console.log('watch triggered!');
this.$nextTick(() => {
this.handleOptions('watch');
});
},
deep: true,
immediate: false,
},
},
mounted() { mounted() {
// options // options
this.handleOptions(); this.handleOptions();
@ -125,32 +137,18 @@ export default {
const response = await this.$axios(url); const response = await this.$axios(url);
return response.data; return response.data;
}, },
handleOptions() { async handleOptions(trigger = 'monuted') {
// console.log("[dialogForm:handleOptions]") // console.log("[dialogForm:handleOptions]")
const promiseList = []; const promiseList = [];
this.rows.forEach((cols) => { this.rows.forEach((cols) => {
cols.forEach(async (opt) => { cols.forEach((opt) => {
if (opt.onChange) { if (opt.value && !this.form[opt.prop]) {
this.$watch(`form.${opt.prop}`, {
handler: (val) => {
this.$emit(opt.onChange.emit, val);
},
immediate: true,
});
}
if (opt.listen) {
//
this.$on(opt.listen, (val) => {
alert(val);
});
}
if (opt.value) {
// //
this.form[opt.prop] = opt.value; this.form[opt.prop] = opt.value;
} }
if (opt.options) { if (opt.options) {
this.optionListOf[opt.prop] = opt.options; this.$set(this.optionListOf, opt.prop, opt.options);
} else if (opt.url) { } else if (opt.url) {
// //
if (opt.select || (opt.input && !this.form?.id)) { if (opt.select || (opt.input && !this.form?.id)) {
@ -179,9 +177,16 @@ export default {
} }
}); });
} }
}
});
});
// watch
if (trigger == 'watch') {
this.formLoading = false;
return;
}
try { try {
// this.formLoading = true;
// console.log("[dialogForm:handleOptions:promiseList]", promiseList)
await Promise.all(promiseList.map((fn) => fn())); await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false; this.formLoading = false;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf) // console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
@ -189,9 +194,6 @@ export default {
console.log('[dialogForm:handleOptions:error]', error); console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false; this.formLoading = false;
} }
}
});
});
if (!promiseList.length) this.formLoading = false; if (!promiseList.length) this.formLoading = false;
}, },
}, },

View File

@ -38,107 +38,7 @@
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">
<DialogForm <DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
v-if="open"
ref="form"
:dataForm="form"
:rows="[
[
{
select: true,
label: '检测内容ID',
url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId',
labelKey: 'content',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
{
select: true,
label: '来源',
prop: 'source',
value: 1, //
options: [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
],
bind: {
filterable: true,
},
},
// {
// input: true,
// label: '',
// prop: 'buttonId',
// rules: [
// {
// type: 'number',
// message: '',
// trigger: 'blur',
// transform: (val) => Number(val),
// },
// ],
// },
],
[
// listen线onChange
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll',
prop: 'sectionId',
listen: 'productionLineChange', // emit
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
onChange: { emit: 'productionLineChange' },
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '检测人员',
prop: 'checkPerson',
rules: [
// {
// type: 'number',
// message: '',
// trigger: 'blur',
// transform: (val) => Number(val),
// },
],
},
{
datetime: true,
label: '检测时间',
prop: 'checkTime',
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
],
[
{
textarea: true,
label: '检测内容',
prop: 'inspectionDetContent',
value: '',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[{ textarea: true, label: '描述', prop: 'explainText' }],
[{ input: true, label: '备注', prop: 'remark' }],
]" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
@ -164,6 +64,80 @@ export default {
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
rows: [
[
{
select: true,
label: '检测内容ID',
url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId',
labelKey: 'content',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
{
select: true,
label: '来源',
prop: 'source',
value: 1, //
options: [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
],
bind: {
filterable: true,
},
},
],
[
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll', // url options
options: [], // options, options
prop: 'sectionId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '检测人员',
prop: 'checkPerson',
},
{
datetime: true,
label: '检测时间',
prop: 'checkTime',
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
],
[
{
textarea: true,
label: '检测内容',
prop: 'inspectionDetContent',
value: '',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[{ textarea: true, label: '描述', prop: 'explainText' }],
[{ input: true, label: '备注', prop: 'remark' }],
],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'select', type: 'select',
@ -296,6 +270,31 @@ export default {
this.getList(); this.getList();
this.getProductLineList(); this.getProductLineList();
}, },
watch: {
// 线
'form.productionLineId': {
handler: function (val) {
if (val == null) return;
this.$axios('/base/workshop-section/listByParentId', {
params: {
id: val,
},
}).then((response) => {
this.$set(
this.rows[1][1], // this.rows
'options',
response.data.map((item) => {
return {
label: item.name,
value: item.id,
};
})
);
});
},
immediate: true,
},
},
methods: { methods: {
/** 获取搜索栏的产线列表 */ /** 获取搜索栏的产线列表 */
getProductLineList() { getProductLineList() {