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

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

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