提交 9168843a 编写于 作者: tony001's avatar tony001

修复下拉数据数据加载异常

上级 68272571
......@@ -19,6 +19,7 @@
import { Vue, Component, Watch, Prop, Model } from 'vue-property-decorator';
import CodeListService from "@service/app/codelist-service";
import { Util } from '@/utils';
import { Subject, Subscription } from 'rxjs';
@Component({
})
......@@ -84,6 +85,23 @@ export default class DropDownList extends Vue {
*/
@Prop() public data?: any;
/**
* 表单状态对象
*
* @type {Subject<any>}
* @memberof AppEmbedPicker
*/
@Prop() public formState!: Subject<any>
/**
* 订阅对象
*
* @protected
* @type {(Subscription | undefined)}
* @memberof SelectType
*/
protected formStateEvent: Subscription | undefined;
/**
* 监听表单数据
*
......@@ -241,6 +259,21 @@ export default class DropDownList extends Vue {
* @memberof DropDownList
*/
public created() {
if(this.formState) {
this.formStateEvent = this.formState.subscribe(({ tag, action, data }) => {
if (Object.is('load', action)) {
this.loadData();
}
});
}
}
/**
* 加载数据
*
* @memberof DropDownList
*/
public loadData(){
if(this.tag && Object.is(this.codelistType,"STATIC")){
const codelist = this.$store.getters.getCodeList(this.tag);
if (codelist) {
......@@ -372,6 +405,17 @@ export default class DropDownList extends Vue {
}
})
}
/**
* vue 生命周期
*
* @memberof DropDownList
*/
public destroyed() {
if (this.formStateEvent) {
this.formStateEvent.unsubscribe();
}
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册