提交 03d42e69 编写于 作者: ibizdev's avatar ibizdev

lab_qyk 发布系统代码

上级 dc2e0751
......@@ -51,21 +51,16 @@ export default class AppOrgSelect extends Vue {
*/
@Watch('data',{immediate:true,deep:true})
onDataChange(newVal: any, oldVal: any) {
// 计算出选中值
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
if(newVal){
this.computedSelectedData();
if(this.filter){
let tempFilterValue:any = this.initBasicData();
// filter值变化才去请求数据
if(tempFilterValue && (this.copyFilterValue !== tempFilterValue)){
this.loadTreeData(this.orgDataUrl.replace('${orgid}',tempFilterValue));
this.copyFilterValue = tempFilterValue;
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{
// 多选
}
}
......@@ -91,11 +86,11 @@ export default class AppOrgSelect extends Vue {
public NodesData:any = [];
/**
* 过滤值
* 备份过滤值
*
* @memberof AppOrgSelect
*/
public filterValue:any;
public copyFilterValue:any;
/**
* vue生命周期
......@@ -103,8 +98,9 @@ export default class AppOrgSelect extends Vue {
* @memberof AppOrgSelect
*/
public created(){
this.initBasicData();
this.loadTreeData();
if(!this.filter){
this.loadTreeData(this.orgDataUrl.replace('${orgid}','alls'));
}
}
/**
......@@ -116,25 +112,44 @@ export default class AppOrgSelect extends Vue {
// 计算出过滤值
if(this.filter){
if(this.data && this.data[this.filter]){
this.filterValue= this.data[this.filter];
return this.data[this.filter];
}else if(this.context && this.context[this.filter]){
this.filterValue= this.context[this.filter];
return this.context[this.filter];
}else{
return null;
}
}
}
/**
* 加载树数据
* 计算选中值
*
* @memberof AppOrgSelect
*/
public loadTreeData(){
let requestUrl:string = "";
if(!this.filter){
requestUrl = this.orgDataUrl.replace('${orgid}','alls');
public computedSelectedData(){
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{
requestUrl = this.orgDataUrl.replace('${orgid}',this.filterValue);
// 多选
}
}
/**
* 加载树数据
*
* @memberof AppOrgSelect
*/
public loadTreeData(requestUrl:string){
Http.getInstance().get(requestUrl).then((res:any) =>{
if(!res.status && res.status !== 200){
console.error("加载数据失败");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册