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

lxm--动态代码表编辑器参数

上级 ac3b4c52
......@@ -53,6 +53,38 @@ export default class AppCheckBox extends Vue {
*/
@Prop() disabled?: boolean;
/**
* 传入表单数据
*
* @type {*}
* @memberof DropDownList
*/
@Prop() public data?: any;
/**
* 传入额外参数
*
* @type {*}
* @memberof DropDownList
*/
@Prop() public itemParam?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof AppAutocomplete
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppFormDRUIPart
*/
@Prop() public viewparams!: any;
/**
* 获取启用禁用状态
*
......@@ -166,6 +198,28 @@ export default class AppCheckBox extends Vue {
*/
public items: any[] = [];
/**
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof DropDownList
*/
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);
}
}
/**
* vue 生命周期
*
......@@ -181,7 +235,13 @@ export default class AppCheckBox extends Vue {
console.log(`----${this.tag}----$t('components.appCheckBox.notExist')`);
}
} else 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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----$t('components.appCheckBox.notExist')`);
......
......@@ -61,6 +61,14 @@ export default class AppRadioGroup extends Vue {
*/
@Prop() public codelistType?: string;
/**
* 传入表单数据
*
* @type {*}
* @memberof DropDownList
*/
@Prop() public data?: any;
/**
* 是否禁用
*
......@@ -69,6 +77,30 @@ export default class AppRadioGroup extends Vue {
*/
@Prop() public disabled?: boolean;
/**
* 传入额外参数
*
* @type {*}
* @memberof DropDownList
*/
@Prop() public itemParam?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof AppAutocomplete
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppFormDRUIPart
*/
@Prop() public viewparams!: any;
/**
* 属性名称
*
......@@ -99,6 +131,28 @@ export default class AppRadioGroup extends Vue {
*/
public items: any[] = [];
/**
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof DropDownList
*/
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);
}
}
/**
* vue 生命周期
*
......@@ -108,7 +162,13 @@ export default class AppRadioGroup extends Vue {
if(this.tag && this.codelistType == 'STATIC'){
this.items = this.$store.getters.getCodeListItems(this.tag);
}else if(this.tag && this.codelistType == 'DYNAMIC'){
this.codeListService.getItems(this.tag).then((data: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) => {
this.items = data;
}).catch((data:any)=>{
console.log(`----${this.tag}----代码表不存在!`);
......
......@@ -81,7 +81,7 @@ export default class DropDownListDynamic extends Vue {
@Watch('data',{ deep: true })
onDataChange(newVal: any, val: any){
if(newVal){
this.handleOtherParam();
}
}
......@@ -145,26 +145,40 @@ export default class DropDownListDynamic extends Vue {
public items: any[] = [];
/**
* 处理额外参数
*/
public handleOtherParam(){
if(this.itemParam){
this.queryParam = {};
this.otherParam = this.itemParam.parentdata;
if(this.otherParam && Object.keys(this.otherParam).length >0){
Object.keys(this.otherParam).forEach((item:any) =>{
let value: string | null = this.otherParam[item];
if (value && value.startsWith('%') && value.endsWith('%')) {
const key = value.substring(1, value.length - 1);
if (this.data && this.data.hasOwnProperty(key)) {
value = (this.data[key] !== null && this.data[key] !== undefined) ? this.data[key] : null;
} else {
value = null;
}
}
Object.assign(this.queryParam,{[item]:value});
})
}
* 视图上下文
*
* @type {*}
* @memberof AppAutocomplete
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppFormDRUIPart
*/
@Prop() public viewparams!: any;
/**
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof DropDownListDynamic
*/
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);
}
}
......@@ -182,7 +196,13 @@ export default class DropDownListDynamic extends Vue {
console.log(`----${this.tag}----代码表不存在`);
}
}else if(this.tag && Object.is(this.codelistType,"DYNAMIC")){
this.codeListService.getItems(this.tag,{},this.queryParam).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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
......@@ -199,7 +219,13 @@ export default class DropDownListDynamic extends Vue {
public onClick($event:any){
if($event){
if(this.tag && Object.is(this.codelistType,"DYNAMIC")){
this.codeListService.getItems(this.tag,{},this.queryParam).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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
......
......@@ -84,6 +84,38 @@ export default class DropDownListMpicker extends Vue {
*/
@Prop() public placeholder?: string;
/**
* 传入额外参数
*
* @type {*}
* @memberof DropDownListMpicker
*/
@Prop() public itemParam?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof DropDownListMpicker
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof DropDownListMpicker
*/
@Prop() public viewparams!: any;
/**
* 传入表单数据
*
* @type {*}
* @memberof DropDownListMpicker
*/
@Prop() public data?: any;
/**
* 计算属性(当前值)
* @type {any}
......@@ -113,6 +145,28 @@ export default class DropDownListMpicker extends Vue {
*/
public items: any[] = [];
/**
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof DropDownList
*/
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);
}
}
/**
* vue 生命周期
*
......@@ -127,7 +181,13 @@ export default class DropDownListMpicker extends Vue {
console.log(`----${this.tag}----代码表不存在`);
}
}else if(this.tag && 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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
......@@ -143,7 +203,13 @@ export default class DropDownListMpicker extends Vue {
*/
public onClick($event:any){
if(this.tag && 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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
......
......@@ -81,7 +81,7 @@ export default class DropDownList extends Vue {
@Watch('data',{ deep: true })
onDataChange(newVal: any, val: any){
if(newVal){
this.handleOtherParam();
}
}
......@@ -93,6 +93,22 @@ export default class DropDownList extends Vue {
*/
@Prop() public itemParam?: any;
/**
* 视图上下文
*
* @type {*}
* @memberof AppAutocomplete
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppFormDRUIPart
*/
@Prop() public viewparams!: any;
/**
* 是否禁用
* @type {any}
......@@ -145,26 +161,24 @@ export default class DropDownList extends Vue {
public items: any[] = [];
/**
* 处理额外参数
*/
public handleOtherParam(){
if(this.itemParam){
this.queryParam = {};
this.otherParam = this.itemParam.parentdata;
if(this.otherParam && Object.keys(this.otherParam).length >0){
Object.keys(this.otherParam).forEach((item:any) =>{
let value: string | null = this.otherParam[item];
if (value && value.startsWith('%') && value.endsWith('%')) {
const key = value.substring(1, value.length - 1);
if (this.data && this.data.hasOwnProperty(key)) {
value = (this.data[key] !== null && this.data[key] !== undefined) ? this.data[key] : null;
} else {
value = null;
}
}
Object.assign(this.queryParam,{[item]:value});
})
}
* 公共参数处理
*
* @param {*} arg
* @returns
* @memberof DropDownList
*/
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);
}
}
......@@ -182,7 +196,13 @@ export default class DropDownList extends Vue {
console.log(`----${this.tag}----代码表不存在`);
}
}else if(this.tag && Object.is(this.codelistType,"DYNAMIC")){
this.codeListService.getItems(this.tag,{},this.queryParam).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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
......@@ -199,7 +219,13 @@ export default class DropDownList extends Vue {
public onClick($event:any){
if($event){
if(this.tag && Object.is(this.codelistType,"DYNAMIC")){
this.codeListService.getItems(this.tag,{},this.queryParam).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) => {
this.items = res;
}).catch((error:any) => {
console.log(`----${this.tag}----代码表不存在`);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册