update 更新dialogForm的关联监听方案

This commit is contained in:
lb 2023-08-04 11:23:26 +08:00
rodzic f5fb852d5d
commit 61a6e7dafb
2 zmienionych plików z 26 dodań i 8 usunięć

Wyświetl plik

@ -130,10 +130,25 @@ export default {
const promiseList = [];
this.rows.forEach((cols) => {
cols.forEach(async (opt) => {
if (opt.onChange) {
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;
}
if (opt.options) {
this.optionListOf[opt.prop] = opt.options;
} else if (opt.url) {
@ -184,7 +199,7 @@ export default {
</script>
<style scoped lang="scss">
.el-date-editor,
.el-date-editor,
.el-select {
width: 100%;
}

Wyświetl plik

@ -83,18 +83,21 @@
// },
],
[
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
// 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' }],
},
],