Selaa lähdekoodia

update 更新dialogForm的关联监听方案

pull/12/head
lb 1 vuosi sitten
vanhempi
commit
61a6e7dafb
2 muutettua tiedostoa jossa 25 lisäystä ja 7 poistoa
  1. +16
    -1
      src/views/quality/components/dialogForm.vue
  2. +9
    -6
      src/views/quality/monitoring/qualityInspectionRecord/index.vue

+ 16
- 1
src/views/quality/components/dialogForm.vue Näytä tiedosto

@@ -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%;
}


+ 9
- 6
src/views/quality/monitoring/qualityInspectionRecord/index.vue Näytä tiedosto

@@ -83,18 +83,21 @@
// },
],
[
// 此方案必须,工段(含listen)字段必须在产线字段(含onChange)之前
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
label: '工段',
url: '/base/workshop-section/listAll',
prop: 'sectionId',
listen: 'productionLineChange', // 对应上面 emit
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll',
prop: 'sectionId',
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
onChange: { emit: 'productionLineChange' },
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],


Ladataan…
Peruuta
Tallenna