提交 338217ba 编写于 作者: sq3536's avatar sq3536

reset

上级 fb9fdb66
......@@ -211,10 +211,12 @@ export default class AppFormPart extends Vue {
* @memberof AppFormPart
*/
public loadRemoteFormModel(){
let that: any = this;
return new Promise((resolve:any,reject:any) =>{
this.$http.get(this.remoteUrl).then((res:any) =>{
if(res.status && res.status == 200){
let result:any = res.data;
that.transitionDicUrlCondition(result);
resolve(result);
}else{
console.warn("加载动态表单模型数据异常");
......@@ -237,6 +239,38 @@ export default class AppFormPart extends Vue {
}
}
/**
* 配置的下拉列表转换符号支持动态配置
*
* @memberof AvueCustomForm
* @param {*}
*/
public transitionDicUrlCondition(options: any) {
let that: any = this;
let recursive: any = function (obj: any) {
if (obj.column && obj.column.length > 0) {
obj.column.forEach((col: any) => {
if (col.dicUrl && col.dicUrl.indexOf("$") > 0) {
let g = /\${[^+]+}/;
let dicGroup = col.dicUrl.match(g);
dicGroup.forEach((dic: any) => {
col.dicUrl = col.dicUrl.replace(
dic,
that.data[dic.substring(2, dic.length - 1)]
);
});
}
if (col.children) recursive(col.children);
if (col.group) recursive(col.group);
});
}
if (obj.children) recursive(obj.children);
if (obj.group) recursive(obj.group);
};
recursive(options);
}
}
</script>
<style lang = "less">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册