|
|
|
@ -27,10 +27,20 @@ export default { |
|
|
|
options: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
updated() { |
|
|
|
this.dictDefaultValue() |
|
|
|
}, |
|
|
|
created () { |
|
|
|
this.initOption() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
dictDefaultValue(){ |
|
|
|
// 当value值不存在 并且查询的下拉框存在默认值列,将value赋值为默认 |
|
|
|
if (!this.value && this.options.length > 0){ |
|
|
|
let find = this.options.find(item=>item.isDefault === 'Y'); |
|
|
|
this.$emit("change",find.dictValue); |
|
|
|
} |
|
|
|
}, |
|
|
|
//初始化options |
|
|
|
async initOption () { |
|
|
|
// 组合查询条件 |
|
|
|
@ -44,11 +54,6 @@ export default { |
|
|
|
if (data && data.code === 0){ |
|
|
|
this.options = data.rows; |
|
|
|
} |
|
|
|
// 当value值不存在 并且查询的下拉框存在默认值列,将value赋值为默认 |
|
|
|
if (!this.value && this.options.length > 0){ |
|
|
|
let find = this.options.find(item=>item.isDefault === 'Y'); |
|
|
|
this.$emit("change",find.dictValue); |
|
|
|
} |
|
|
|
}, |
|
|
|
// el-select @change事件,修改父组件值 |
|
|
|
changeDictData(val){ |
|
|
|
|