提交 2097e06b 编写于 作者: KK's avatar KK

格式化

上级 995c21fc
...@@ -12,7 +12,7 @@ import { Vue, Component, Prop, Provide, Emit, Watch, } from "vue-property-decora ...@@ -12,7 +12,7 @@ import { Vue, Component, Prop, Provide, Emit, Watch, } from "vue-property-decora
import { CodeListService } from "@/ibiz-core"; import { CodeListService } from "@/ibiz-core";
import { Loading } from '@/ibiz-core/utils'; import { Loading } from '@/ibiz-core/utils';
@Component({ @Component({
components: {} components: {}
}) })
export default class AppSpan extends Vue { export default class AppSpan extends Vue {
...@@ -57,13 +57,6 @@ export default class AppSpan extends Vue { ...@@ -57,13 +57,6 @@ export default class AppSpan extends Vue {
*/ */
public queryParam: any; public queryParam: any;
/**
* 当前选中值
* @memberof AppSpan
*/
public curValue:any = this.value
/** /**
* 代码表 * 代码表
* *
...@@ -77,30 +70,14 @@ export default class AppSpan extends Vue { ...@@ -77,30 +70,14 @@ export default class AppSpan extends Vue {
* @type {*} * @type {*}
* @memberof AppSpan * @memberof AppSpan
*/ */
public text:any = ''; public text: any = '';
/** /**
* vue 生命周期 * 是否缓存
* *
* @memberof AppSpan * @type {*}
*/ * @memberof AppSelect
public created() { */
if (Object.is(this.codeListType, "STATIC")) {
this.items = this.$store.getters.getCodeListItems(this.tag);
this.setText();
} else if(Object.is(this.codeListType, "DYNAMIC")) {
this.load();
}else{
this.setText();
}
}
/**
* 是否缓存
*
* @type {*}
* @memberof AppSelect
*/
@Prop({ default: true }) protected isCache?: boolean; @Prop({ default: true }) protected isCache?: boolean;
/** /**
...@@ -111,21 +88,21 @@ export default class AppSpan extends Vue { ...@@ -111,21 +88,21 @@ export default class AppSpan extends Vue {
*/ */
public isCached: boolean = false; public isCached: boolean = false;
/** /**
* 应用上下文 * 应用上下文
* *
* @type {*} * @type {*}
* @memberof AppSpan * @memberof AppSpan
*/ */
@Prop({ default: {} }) protected context?: any; @Prop({ default: {} }) protected context?: any;
/** /**
* 当前值项 * 当前值项
* *
* @type {*} * @type {*}
* @memberof AppSpan * @memberof AppSpan
*/ */
public currentItem :any = {}; public currentItem: any = {};
/** /**
...@@ -134,10 +111,10 @@ export default class AppSpan extends Vue { ...@@ -134,10 +111,10 @@ export default class AppSpan extends Vue {
* @memberof AppSpan * @memberof AppSpan
*/ */
@Watch('value') @Watch('value')
public itemChange(){ public itemChange() {
if(this.tag && Object.is(this.codeListType,"DYNAMIC")){ if (this.tag && Object.is(this.codeListType, "DYNAMIC")) {
this.load(); this.load();
}else{ } else {
this.setText(); this.setText();
} }
} }
...@@ -147,14 +124,14 @@ export default class AppSpan extends Vue { ...@@ -147,14 +124,14 @@ export default class AppSpan extends Vue {
* *
* @memberof AppSpan * @memberof AppSpan
*/ */
public async load(): Promise<any>{ public async load(): Promise<any> {
if (Object.is(this.codeListType, "STATIC")) { if (Object.is(this.codeListType, "STATIC")) {
return; return;
} }
if (!this.isCached) { if (!this.isCached) {
// Loading.show(this.$t('app.loadding')); // Loading.show(this.$t('app.loadding'));
} }
let response: any = await this.codeListService.getItems(this.tag, { ...this.context }, this.queryParam); let response: any = await this.codeListService.getItems(this.tag, { ...this.context }, this.queryParam);
if (!this.isCached) { if (!this.isCached) {
// Loading.hidden(); // Loading.hidden();
} }
...@@ -173,7 +150,7 @@ export default class AppSpan extends Vue { ...@@ -173,7 +150,7 @@ export default class AppSpan extends Vue {
* 设置显示值 * 设置显示值
* @memberof AppSpan * @memberof AppSpan
*/ */
public setText(){ public setText() {
if (!this.value) { // 新建等没有值的情况 if (!this.value) { // 新建等没有值的情况
this.text = ""; this.text = "";
} }
...@@ -206,6 +183,21 @@ export default class AppSpan extends Vue { ...@@ -206,6 +183,21 @@ export default class AppSpan extends Vue {
} }
} }
/**
* vue 生命周期
*
* @memberof AppSpan
*/
public created() {
if (Object.is(this.codeListType, "STATIC")) {
this.items = this.$store.getters.getCodeListItems(this.tag);
this.setText();
} else if (Object.is(this.codeListType, "DYNAMIC")) {
this.load();
} else {
this.setText();
}
}
} }
</script> </script>
<style lang="less"> <style lang="less">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册