提交 86a8819e 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--app-span编辑器参数处理

上级 c129eeef
<template>
<codelist v-if="tag" :tag="tag" :value="value" :codelistType="codelistType" :renderMode="renderMode" :valueSeparator="valueSeparator" :textSeparator="textSeparator"></codelist>
<codelist v-if="tag" :tag="tag" :value="value" :codelistType="codelistType" :renderMode="renderMode" :valueSeparator="valueSeparator" :textSeparator="textSeparator" :data="data" :itemParam="itemParam" :context="context" :viewparams="viewparams"></codelist>
<app-upload-file-info v-else-if="Object.is(this.editorType,'PICTURE') || Object.is(this.editorType,'PICTURE_ONE') || Object.is(this.editorType,'FILEUPLOADER')" :value="value" :name="name"></app-upload-file-info>
<span class="app-span" v-else >{{text}}</span>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch, Model } from 'vue-property-decorator';
import CodeListService from "@service/app/codelist-service";
@Component({})
export default class AppSpan extends Vue {
......@@ -64,6 +63,38 @@ export default class AppSpan extends Vue {
*/
@Prop({default:','}) public valueSeparator?: string;
/**
* 传入表单数据
*
* @type {*}
* @memberof AppSpan
*/
@Prop() public data?: any;
/**
* 传入额外参数
*
* @type {*}
* @memberof AppSpan
*/
@Prop() public itemParam?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof AppSpan
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppSpan
*/
@Prop() public viewparams!: any;
/**
* 监控表单属性 data 值
*
......
......@@ -37,14 +37,14 @@ export default class CodeList extends Vue {
* 代码表类型
*
* @type {string}
* @memberof AppCheckBox
* @memberof CodeList
*/
@Prop() public codelistType?: string;
/**
* 当前值
* @type {any}
* @memberof SelectPicker
* @memberof CodeList
*
*/
@Prop() public value?: string;
......@@ -52,24 +52,56 @@ export default class CodeList extends Vue {
/**
* 获取或模式
* @type {boolean}
* @memberof SelectPicker
* @memberof CodeList
*/
@Prop({default:"STR"}) public renderMode?: string;
/**
* 文本分隔符
* @type {boolean}
* @memberof SelectPicker
* @memberof CodeList
*/
@Prop({default:'、'}) public textSeparator?: string;
/**
* 值分隔符
* @type {boolean}
* @memberof SelectPicker
* @memberof CodeList
*/
@Prop({default:','}) public valueSeparator?: string;
/**
* 传入表单数据
*
* @type {*}
* @memberof CodeList
*/
@Prop() public data?: any;
/**
* 传入额外参数
*
* @type {*}
* @memberof CodeList
*/
@Prop() public itemParam?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof CodeList
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof CodeList
*/
@Prop() public viewparams!: any;
/**
* 是否为空
*
......@@ -131,7 +163,13 @@ export default class CodeList extends Vue {
this.ifEmpty = false;
// 动态代码表处理
if (Object.is(this.codelistType, "DYNAMIC")) {
this.codeListService.getItems(this.tag).then((res: any) => {
// 公共参数处理
let data: any = {};
this.handlePublicParams(data);
// 参数处理
let _context = data.context;
let _param = data.param;
this.codeListService.getItems(this.tag,_context,_param).then((res:any) => {
let items = res;
_this.setItems(items, _this);
}).catch((error: any) => {
......@@ -209,6 +247,28 @@ export default class CodeList extends Vue {
}
}
/**
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof CodeList
*/
public handlePublicParams(arg: any) {
// 合并表单参数
arg.param = JSON.parse(JSON.stringify(this.viewparams));
arg.context = JSON.parse(JSON.stringify(this.context));
// 附加参数处理
if (this.itemParam.context) {
let _context = this.$util.formatData(this.data,arg.context,this.itemParam.context);
Object.assign(arg.context,_context);
}
if (this.itemParam.param) {
let _param = this.$util.formatData(this.data,arg.param,this.itemParam.param);
Object.assign(arg.param,_param);
}
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册