提交 950b4ea9 编写于 作者: glod-money-money's avatar glod-money-money

update:更新

上级 cf2f28d7
......@@ -142,6 +142,7 @@ import AppGridPagination from './components/app-grid-pagination/app-grid-paginat
import AppSearchbar from './components/app-searchbar/app-searchbar.vue';
import AppEYUpload from './components/app-ey-upload/app-ey-upload.vue';
import ExtendActionTimeline from './components/extend-action-timeline/extend-action-timeline.vue';
import AppAddressCascader from './components/app-address-cascader/app-address-cascader.vue';
// 布局组件
import AppIndexViewLayoutLeft from './layout/index-view-layout-left/index-view-layout-left.vue';
import AppIndexViewLayoutTop from './layout/index-view-layout-top/index-view-layout-top.vue';
......@@ -316,5 +317,6 @@ export const AppComponents = {
v.component('app-pickup-view-layout',AppPickUpViewLayout);
v.component('app-mpickup-view-layout',AppMPickUpViewLayout);
v.component('app-pickup-grid-view-layout',AppPickUpGridViewLayout);
v.component('app-address-cascader',AppAddressCascader);
},
};
\ No newline at end of file
<template>
<div class="appAddressCascader">
<el-cascader style="width: 100%" :disabled="disabled" size="medium" v-model="CurrentVal" :options="items">
</el-cascader>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Model, Watch } from 'vue-property-decorator';
import CodeListService from '@/codelist/codelist-service';
@Component({})
export default class AppAddressCascader extends Vue {
/**
* 传入值
* @type {any}
* @memberof AppAddressCascader
*/
@Prop() public value?: any;
/**
* 是否禁用
* @type {boolean}
* @memberof AppAddressCascader
*/
@Prop() public disabled?: boolean;
/**
* 代码表标识
*
* @type {string}
* @memberof AppAddressCascader
*/
@Prop() public tag?: string;
/**
* 局部上下文导航参数
*
* @type {any}
* @memberof AppCheckBox
*/
@Prop() public localContext!: any;
/**
* 局部导航参数
*
* @type {any}
* @memberof AppCheckBox
*/
@Prop() public localParam!: any;
/**
* 传入表单数据
*
* @type {*}
* @memberof AppCheckBox
*/
@Prop() public data?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof AppCheckBox
*/
@Prop() public context!: any;
/**
* 代码表类型
*
* @type {string}
* @memberof AppAddressCascader
*/
@Prop() public codelistType?: string;
/**
* 视图参数
*
* @type {*}
* @memberof AppCheckBox
*/
@Prop() public viewparams!: any;
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof AppAddressCascader
*/
public codeListService: CodeListService = new CodeListService();
/**
* 当前值
*
* @memberof AppAddressCascader
*/
get CurrentVal() {
return this.value;
}
/**
* 值变化
*
* @memberof AppAddressCascader
*/
set CurrentVal(val: any) {
this.$emit("change", val);
}
/**
* 城市数据
*
* @memberof AppAddressCascader
*/
public items: any = [];
/**
* 获取树形代码表数据
*
* @memberof AppAddressCascader
*/
public load() {
if (this.tag) {
if (Object.is(this.codelistType, "STATIC")) {
const codelist = this.$store.getters.getCodeList(this.tag);
if (codelist) {
this.items = [...JSON.parse(JSON.stringify(codelist.items))];
} else {
console.warn(`${this.tag}--代码表配置异常`);
}
} else if (Object.is(this.codelistType, "DYNAMIC")) {
// 公共参数处理
let data: any = {};
this.handlePublicParams(data);
// 参数处理
let _context = data.context;
let _param = data.param;
this.codeListService.getItems(this.tag, _context, _param).then((res: any) => {
this.items = res;
}).catch((error: any) => {
console.error(error);
});
}
}
}
/**
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof AppCheckBox
*/
public handlePublicParams(arg: any) {
// 合并表单参数
arg.param = this.viewparams ? JSON.parse(JSON.stringify(this.viewparams)) : {};
arg.context = this.context ? JSON.parse(JSON.stringify(this.context)) : {};
// 附加参数处理
if (this.localContext && Object.keys(this.localContext).length > 0) {
let _context = this.$util.computedNavData(this.data, arg.context, arg.param, this.localContext);
Object.assign(arg.context, _context);
}
if (this.localParam && Object.keys(this.localParam).length > 0) {
let _param = this.$util.computedNavData(this.data, arg.param, arg.param, this.localParam);
Object.assign(arg.param, _param);
}
}
/**
* 生命周期
*
* @memberof AppAddressCascader
*/
public created() {
this.load();
}
}
</script>
<style lang="scss">
@import "./app-address-cascader.scss";
</style>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册