bigScreen
This commit is contained in:
parent
8efbd85b56
commit
7da24fa7d8
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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(){
|
||||
|
|
Loading…
Reference in New Issue