个人设置-颜色设置、消息警示提醒开发
This commit is contained in:
@@ -16,8 +16,7 @@ export class PersonalSettingsComponent implements OnInit {
|
||||
public disabledUpTop:any=true; //置顶控制按钮可选状态 true 禁止选择 false可选择
|
||||
public disabledDownBtm:any=true; //最低控制按钮可选状态 true 禁止选择 false可选择
|
||||
public selectedType:any=''; //当前选中项所在项目 1在可选项 2在已选项框
|
||||
|
||||
moveIndex:any='false';
|
||||
public moveIndex:any='false';
|
||||
|
||||
constructor() { }
|
||||
|
||||
@@ -27,18 +26,20 @@ export class PersonalSettingsComponent implements OnInit {
|
||||
备注:实际数据中,把原始数据录入到临时变量中,方便取消按钮,重置数据
|
||||
这里数组复制不能用浅复制sourceList=list;而是要用深度复制,this.sourceList=[...this.list]
|
||||
*/
|
||||
this.sourceList=[...this.list];
|
||||
this.list.forEach(item=>{
|
||||
let option=this.deepCopy(item);
|
||||
this.sourceList.push(option);
|
||||
})
|
||||
}
|
||||
//保存-自定义列显示保存
|
||||
saveSelf(){
|
||||
console.log(this.targetList);
|
||||
console.log(this.sourceList);
|
||||
}
|
||||
//重置数据
|
||||
cancelSelf(){
|
||||
//等后台接口出来后,重置this.sourceList this.targetList
|
||||
this.sourceList=this.list;
|
||||
this.targetList=[];
|
||||
//对象数组深度复制
|
||||
deepCopy(data){
|
||||
let itemObj={
|
||||
bgColor:'#fafafa',
|
||||
};
|
||||
for(let key in data){
|
||||
itemObj[key]=data[key];
|
||||
}
|
||||
return itemObj;
|
||||
}
|
||||
//上下调整项目顺序 type 1上移 2下移 3置顶 4置底 要做头尾判断
|
||||
moveUpDown(type){
|
||||
@@ -141,6 +142,22 @@ export class PersonalSettingsComponent implements OnInit {
|
||||
this.disabledUpTop=true;
|
||||
|
||||
}
|
||||
//保存-自定义列显示保存
|
||||
saveSelf(){
|
||||
console.log(this.targetList);
|
||||
console.log(this.sourceList);
|
||||
}
|
||||
//重置数据
|
||||
cancelSelf(){
|
||||
this.sourceList=[];
|
||||
//等后台接口出来后,重置this.sourceList this.targetList
|
||||
//深度复制
|
||||
this.list.forEach(item=>{
|
||||
let option=this.deepCopy(item);
|
||||
this.sourceList.push(option);
|
||||
})
|
||||
this.targetList=[];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user