bigScreen

This commit is contained in:
shijing 2022-06-23 11:09:09 +08:00
parent 8efbd85b56
commit 7da24fa7d8
5 changed files with 72 additions and 222 deletions

View File

@ -170,6 +170,7 @@
</template>
<script>
import {genTree} from "@/utils/verificate";
const defaultForm = {
id: null,
phone: '',
@ -280,8 +281,9 @@
dept: [],
},
groupsProps: {
value: "id",
// value: "id",
multiple: false,
emitPath: false,
checkStrictly: true,
},
group: [],
@ -312,32 +314,7 @@
//
async getGroup() {
let res = await this.$API.system.dept.list.req({page: 0});
let postList = res;
this.group = res;
let posts = [];
postList.forEach(item => {
let obj = new Object();
obj.id = item.id;
obj.sort = item.sort;
obj.label = item.name;
obj.type = item.type;
obj.parent = item.parent;
obj.create_time = item.create_time;
posts.push(obj)
});
let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object
let arr = [];
for (let item of posts) {
// debugger;
if (item.parent == null) {
arr.push(item);
continue
}
let parent = obj[item.parent];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
this.group = arr;
this.group =genTree(res);
},
//
open(mode) {
@ -356,15 +333,11 @@
},
//
submit() {
//debugger;
this.$refs.dialogForm.validate((valid) => {
// debugger;
if (valid) {
// debugger;
this.isSaveing = true;
this.addForm.dept = this.addForm.dept[1];
// this.addForm.dept = this.addForm.dept[1];
if (this.mode === 'add') {
// debugger;
this.$API.hrm.employee.create.req(this.form)
.then(res => {
this.isSaveing = false;
@ -388,17 +361,6 @@
this.isSaveing = false;
return err
})
this.$API.hrm.employee.update.req(this.form.id, this.form)
.then(res => {
this.isSaveing = false;
this.visible = false;
this.$emit("success", this.form, this.mode);
this.$message.success("操作成功");
return res
}).catch(err => {
this.isSaveing = false;
return err
})
}
}

View File

@ -78,6 +78,7 @@
</template>
<script>
import {genTree} from "@/utils/verificate";
export default {
name: 'dept',
data() {
@ -128,8 +129,9 @@
30:'按钮',
},
groupsProps: {
value: "id",
// value: "id",
multiple: false,
emitPath: false,
checkStrictly: true,
},
group: [],
@ -155,30 +157,7 @@
//
async getGroup() {
var res = await this.$API.system.permission.list.req({page: 0});
// debugger;
let permList = res;
this.permList = res;
let posts = [];
permList.forEach(item => {
let obj = new Object();
obj.id = item.id;
obj.label = item.name;
obj.parent = item.parent;
posts.push(obj)
});
let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object
let arr = [];
for (let item of posts) {
if (item.parent == null) {
arr.push(item);
continue
}
let parent = obj[item.parent];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
//debugger;
this.group = arr;
this.group =genTree(res);
},
//
@ -200,38 +179,16 @@
},
//
editMenu(row) {
// debugger;
this.type = 'edit';
this.addForm.id = row.id;
this.addForm.name = row.name;
// debugger;
console.log(row.codes);
this.codes = row.codes.join(',');
let parent = row.parent!==null?this.findParents(this.permList, row.parent):'';
this.addForm.parent = parent;
this.addForm.parent = row.parent;
this.addForm.type = row.type ;
/*debugger;
console.log(row.type);
console.log(this.addForm.type);*/
this.addForm.sort = row.sort;
this.limitedVisible = true;
},
findParents(arr, parent) {
//debugger;
let data = [];
arr.forEach(item => {
if (item.id === parent) {
data.unshift(item.id);
if (item.parent !== null) {
this.findParents(arr, item.parent)
} else {
return data
}
}
});
//debugger;
return data
},
//
delMenu(id) {
this.$confirm(`确定删除吗?`, '提示', {
@ -251,11 +208,6 @@
},
submitHandle() {
let that = this;
if (this.addForm.parent !== null) {
this.addForm.parent = this.addForm.parent[this.addForm.parent.length - 1];
} else {
this.addForm.parent = ""
}
if(this.codes.indexOf(','>-1)){
this.addForm.codes = this.codes.split(',');
}else{

View File

@ -68,6 +68,7 @@
</template>
<script>
import {genTree} from "@/utils/verificate";
export default {
name: 'dept',
data() {
@ -107,8 +108,9 @@
],
},
groupsProps: {
value: "id",
// value: "id",
multiple: false,
emitPath: false,
checkStrictly: true,
},
group: [],
@ -129,33 +131,8 @@
},
//
async getGroup() {
var res = await this.$API.system.dept.list.req({page: 0});
let postList = res;
this.postList = res;
let posts = [];
postList.forEach(item => {
let obj = new Object();
obj.id = item.id;
obj.sort = item.sort;
obj.label = item.name;
obj.type = item.type;
obj.parent = item.parent;
obj.create_time = item.create_time;
posts.push(obj)
});
let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object
let arr = [];
for (let item of posts) {
// debugger;
if (item.parent == null) {
arr.push(item);
continue
}
let parent = obj[item.parent];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
this.group = arr;
let res = await this.$API.system.dept.list.req({page: 0});
this.group = genTree(res);
},
//
@ -170,26 +147,12 @@
this.type='edit';
this.addForm.id=row.id;
this.addForm.name=row.name;
let parent = this.findParents(this.postList,row.parent);
this.addForm.parent=parent.reverse();
this.addForm.parent=row.parent;
this.addForm.type=row.type+"";
this.addForm.sort=row.sort;
this.limitedVisible = true;
},
findParents(arr,parent){
let that = this;
arr.forEach(item=>{
if(item.id===parent){
that.temp.push(item.id);
if(item.parent!==null){
this.findParents(arr,item.parent)
}else{
return that.temp
}
}
});
return that.temp
},
//
delDept(row){
let id = row.id;
@ -203,9 +166,7 @@
},
submitHandle(){
let that = this;
this.addForm.parent = this.addForm.parent!==null?this.addForm.parent[0]?this.addForm.parent[0]:'':'';
this.$refs.addForm.validate( (valid) => {
// debugger;
if (valid) {
this.isSaveing = true;
var res;
@ -232,16 +193,48 @@
},
//
upsearch(){
this.$refs.table.queryData(this.search)
},
//
handleSaveSuccess(data, mode){
if(mode=='add'){
this.$refs.table.refresh()
}else if(mode=='edit'){
this.$refs.table.refresh()
findParents(arr,parent){
let that = this;
arr.forEach(item=>{
if(item.id===parent){
that.temp.push(item.id);
if(item.parent!==null){
this.findParents(arr,item.parent)
}else{
return that.temp
}
}
});
return that.temp
},
treeData(postList){
let posts = [];
postList.forEach(item => {
let obj = new Object();
obj.id = item.id;
obj.sort = item.sort;
obj.label = item.name;
obj.type = item.type;
obj.parent = item.parent;
obj.create_time = item.create_time;
posts.push(obj)
});
let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object
let arr = [];
for (let item of posts) {
if (item.parent == null) {
arr.push(item);
continue
}
let parent = obj[item.parent];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
}
return arr;
},
}
}
</script>

View File

@ -66,6 +66,7 @@
</el-dialog>
</template>
<script>
import {genTree} from "@/utils/verificate";
const defaultForm = {
id:"",
name: "",
@ -104,8 +105,9 @@
list: [],
checked: [],
props: {
emitPath: false,
children: 'children',
label: 'name',
// label: 'name',
/*label: (data)=>{
return data.meta.title
}*/
@ -120,38 +122,11 @@
methods: {
handleChange(item, check) {
this.menu.checked = check.checkedKeys;
//debugger;
console.log(check);
console.log(this.checkList);
},
//
async getGroup() {
let res = await this.$API.system.permission.list.req({page: 0});
let postList = res;
let posts = [];
postList.forEach(item => {
let obj = new Object();
obj.id = item.id;
obj.name = item.name;
obj.parentId = item.parent;
obj.label=item.name;
posts.push(obj)
});
let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object
let arr = [];
// debugger;
console.log(obj);
for (let item of posts) {
// debugger;
if (item.parentId == null) {
arr.push(item);
continue
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
this.menu.list = arr;
this.menu.list = genTree(res);
},
//
getList(){
@ -189,8 +164,6 @@
this.limitedVisible = false;
this.$refs.table.refresh();
}
}
})
},
@ -198,7 +171,7 @@
//
roleEdit(row){
this.type='edit';
this.menu.checked = '[]';
this.menu.checked = null;
this.addForm.id=row.id;
this.addForm.name=row.name;
this.addForm.code=row.code;
@ -216,7 +189,6 @@
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
// this.$alert(res.message, "", {type: 'error'})
}
},
//
@ -225,7 +197,7 @@
},
//
upsearch(){
this.$refs.table.queryData(this.search)
},
//ID
filterTree(id){

View File

@ -176,6 +176,7 @@
<script>
import baseUrl from "@/config";
import {genTree} from "@/utils/verificate";
export default {
name: "user",
data() {
@ -237,6 +238,11 @@
this.getGroup();
},
methods: {
//
async getGroup() {
let res = await this.$API.system.dept.list.req({page: 0});
this.group = genTree(res);
},
getImgUrl (img) {
return 'http://49.232.14.174:2226'+ img;
},
@ -248,7 +254,6 @@
},
//
formEdit(row,index) {
// debugger;
console.log(row);
this.limitedVisible = true;
if(index==='1'){
@ -260,10 +265,6 @@
this.addForm.name = row.name;
this.addForm.username = row.username;
this.addForm.phone = row.phone;
/*
let belong_dept = this.findParents(this.postList,row.belong_dept);
this.addForm.belong_dept=belong_dept.reverse();
*/
this.addForm.is_active = row.is_active;
},
findParents(arr,belong_dept){
@ -300,37 +301,7 @@
selectionChange(selection) {
this.selection = selection;
},
//
async getGroup() {
this.showGrouploading = true;
let res = await this.$API.system.dept.list.req({page: 0});
this.showGrouploading = false;
// var allNode = { id: "", label: "" };
// res.data.unshift(allNode);
let postList = res;
this.postList = res;
let posts = [];
postList.forEach(item => {
let obj = new Object();
obj.id = item.id;
obj.label = item.name;
obj.parentId = item.parent;
posts.push(obj)
});
let obj = posts.reduce((res, v) => (res[v.id] = v , res), {});//Object
let arr = [];
for (let item of posts) {
// debugger;
if (item.parentId == null) {
arr.push(item);
continue
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
this.group = arr;
},
//
groupFilterNode(value, data) {
if (!value) return true;
@ -345,7 +316,7 @@
},
//
upsearch() {
this.$refs.table.upData(this.search);
this.$refs.table.queryData(this.search)
},
//
submit(){