feat:增加组织树及项目归属权获取数据

This commit is contained in:
lixg
2022-11-24 15:10:01 +08:00
parent 57b9ba8263
commit affd52588a
6 changed files with 263 additions and 151 deletions

View File

@@ -42,18 +42,50 @@ export default defineComponent({
}); });
const currentRouteName = computed(() => route.name); const currentRouteName = computed(() => route.name);
//获取组织树 //获取组织树
const orgTree = () => { const orgTree = () => {
let obj = {
id: 0,
keyWord: "",
pageNo: 0,
pageSize: 20,
};
api api
.orgtree() .getOrgInfo(obj)
.then((res) => { .then((res) => {
console.log("获取集团组织成功", res);
if (res.status === 200) { if (res.status === 200) {
store.commit("getOrgtreeList", res.data.data); // console.log("获取组织树成功", res.data.data);
// state.orgtreeList = res.data.data;
if (res.status === 200) {
let arr = res.data.data.rows;
for (let i = 0; i < arr.length; i++) {
let object = {
keyWord: "",
id: arr[i].id,
pageNo: 1,
pageSize: 20,
};
api
.getOrgInfo(object)
.then((res) => {
// console.log("获取子元素", res);
if (res.status === 200) {
arr[i].treeChildList = res.data.data.rows;
if (i === arr.length - 1) {
store.commit("getOrgtreeList", arr);
}
}
})
.catch((err) => {
console.log("获取子元素失败", err);
});
}
}
} }
}) })
.catch((err) => { .catch((err) => {
console.log("获取集团组织失败", err); console.log("获取组织失败", err);
}); });
}; };
orgTree(); orgTree();

View File

@@ -2,7 +2,7 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-04 22:45:31 * @Date: 2022-11-04 22:45:31
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-11-22 18:04:47 * @LastEditTime: 2022-11-24 10:59:33
* @FilePath: /fe-manage/src/api/index1.js * @FilePath: /fe-manage/src/api/index1.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
@@ -87,9 +87,21 @@ export const billboard = (obj) => http.post('/admin/project/billboard', obj);
//获取字典信息 //获取字典信息
export const getDict = (obj) => http.post('/dict/getList', obj) export const getDict = (obj) => http.post('/dict/getList', obj)
//获取组织树 //获取组织树一级列表
export const getOrgTree = (obj) => http.post('/admin/router/orgList', obj) export const getOrgTree = (obj) => http.post('/admin/router/orgList', obj)
//根据id获取组织树一级元素下所有子元素
export const orgTreeList = (obj) => http.post('/admin/router/orgTreeList', obj)
//根据id获取部门下学员
export const searchUsersByOrgId = (obj) => http.post('/admin/router/searchUsersByOrgId', obj)
//获取组织信息(修改版)
export const getOrgInfo = (obj) => http.post('/admin/orgStruct/getOrgInfo', obj)
//获取员工(修改版)
export const getMemberInfo = (obj) => http.post('/admin/orgStruct/getMemberInfo', obj)
//获取受众(修改版)
export const getAudienceInfo = (obj) => http.post('/admin/orgStruct/getAudienceInfo', obj)
//获取授权(修改版)
export const optionAuthPerm = (obj) => http.post('/admin/AuthPerm/optionAuthPerm', obj)
// 获取组织结构树 // 获取组织结构树
export const orgtree = () => http.get('/org/tree'); export const orgtree = () => http.get('/org/tree');

View File

@@ -493,7 +493,7 @@
</div> </div>
</div> </div>
<!-- 确认添加部门弹窗 --> <!-- 确认添加部门弹窗 -->
<a-modal <a-modal
v-model:visible="showOrgModal" v-model:visible="showOrgModal"
:footer="null" :footer="null"
@@ -527,10 +527,11 @@
</template> </template>
<script> <script>
import { reactive, toRefs, onMounted, onUnmounted } from "vue"; import { reactive, toRefs, onMounted, onUnmounted, computed } from "vue";
import elementResizeDetectorMaker from "element-resize-detector"; import elementResizeDetectorMaker from "element-resize-detector";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { toDate } from "../../api/method"; import { toDate } from "../../api/method";
import { useStore } from "vuex";
export default { export default {
name: "ProjCheckShip", name: "ProjCheckShip",
props: { props: {
@@ -540,8 +541,9 @@ export default {
}, },
}, },
setup(props, ctx) { setup(props, ctx) {
const store = useStore();
const state = reactive({ const state = reactive({
screenHeight: document.body.clientHeight, // 屏幕高度 screenHeight: document.body.clientHeight, // 屏幕高度
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
tableDataTotal: 50, tableDataTotal: 50,
@@ -1042,11 +1044,15 @@ export default {
selectedRowKeys2: [], //表格选中的key selectedRowKeys2: [], //表格选中的key
//受众关联------------------------------------- //受众关联-------------------------------------
}); });
//获取组织树
state.treeData = computed(() => {
return store.state.orgtreeList ? store.state.orgtreeList : [];
});
const closeDrawer = () => { const closeDrawer = () => {
state.activeKey = "1"; state.activeKey = "1";
ctx.emit("update:ProjCheckvisible", false); ctx.emit("update:ProjCheckvisible", false);
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
@@ -1393,7 +1399,7 @@ export default {
}; };
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
onSelectChange, onSelectChange,

View File

@@ -82,8 +82,14 @@
allow-clear allow-clear
:tree-data="treeData" :tree-data="treeData"
@select="departmentSelect" @select="departmentSelect"
v-model:selectedKeys="selectedKeys" :selectedKeys="selectedKeys"
v-model:expandedKeys="openKeys" v-model:expandedKeys="openKeys"
:fieldNames="{
children: 'treeChildList',
key: 'id',
title: 'name',
value: 'name',
}"
> >
<template #suffixIcon></template> <template #suffixIcon></template>
</a-tree> </a-tree>
@@ -150,7 +156,7 @@
</div> </div>
<div class="btnn"> <div class="btnn">
<button class="btn1">取消</button> <button class="btn1">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="addAuth">确定</button>
</div> </div>
</div> </div>
@@ -188,10 +194,11 @@
</template> </template>
<script> <script>
import { reactive, toRefs, onMounted, onUnmounted } from "vue"; import { reactive, toRefs, onMounted, onUnmounted, computed } from "vue";
import elementResizeDetectorMaker from "element-resize-detector"; import elementResizeDetectorMaker from "element-resize-detector";
// import { message } from "ant-design-vue"; // import { message } from "ant-design-vue";
import * as api from "../../api/index1"; import * as api from "../../api/index1";
import { useStore } from "vuex";
export default { export default {
name: "ProjOwnerShip", name: "ProjOwnerShip",
props: { props: {
@@ -199,13 +206,21 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
selectProjectId: {
type: Number,
default: null,
},
}, },
setup(props, ctx) { setup(props, ctx) {
const store = useStore();
const state = reactive({ const state = reactive({
screenHeight: document.body.clientHeight, // 屏幕高度 screenHeight: document.body.clientHeight, // 屏幕高度
//快速选人分页-----
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
tableDataTotal: 50, tableDataTotal: -1,
//快速选人分页------
pageSize1: 10, pageSize1: 10,
currentPage1: 1, currentPage1: 1,
tableDataTotal1: 50, tableDataTotal1: 50,
@@ -462,180 +477,186 @@ export default {
], ],
//快速选人的table //快速选人的table
tabledata: [ tabledata: [
{ // {
key: 1, // key: 1,
name: "小李小李小李", // name: "小李小李小李",
bum: "产研部", // bum: "产研部",
numb: "000000", // numb: "000000",
guishu: "产品部", // guishu: "产品部",
}, // },
{
key: 2,
name: "小刘小刘小刘",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 3,
name: "小李小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 4,
name: "小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 5,
name: "小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 6,
name: "小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 7,
name: "小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 8,
name: "小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 9,
name: "小小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 10,
name: "小小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 11,
name: "小小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
{
key: 12,
name: "小小李",
bum: "产研部",
numb: "000000",
guishu: "产品部",
},
], ],
tablecolumns: [ tablecolumns: [
{ {
title: "姓名", title: "姓名",
dataIndex: "name", dataIndex: "name",
key: "name", key: "name",
// width: 30, width: 80,
align: "left", align: "center",
className: "h", className: "h",
ellipsis: true,
}, },
{ {
title: "工号", title: "工号",
dataIndex: "numb", dataIndex: "numb",
key: "numb", key: "numb",
// width: 30, width: 80,
align: "center", align: "center",
className: "h", className: "h",
ellipsis: true,
}, },
{ {
title: "归属组织", title: "归属组织",
dataIndex: "guishu", dataIndex: "guishu",
key: "guishu", key: "guishu",
// width: 30, width: 80,
align: "center", align: "center",
className: "h", className: "h",
ellipsis: true,
}, },
{ {
title: "部门", title: "部门",
dataIndex: "bum", dataIndex: "bum",
key: "bum", key: "bum",
// width: 30, width: 80,
align: "center", align: "center",
className: "h", className: "h",
ellipsis: true,
}, },
], ],
//快速选人------------------------------------- //快速选人-------------------------------------
valueSelectboe: null, //快速选人的选择组织 valueSelectboe: null, //快速选人的选择组织
choosepeople: [], //总的数组 choosepeople: [], //总的数组
selectedKeys: [], //选中部门 selectedKeys: [], //选中部门的key
selectDepartment: null, //选中部门名称
showMore: false, //是否显示快速选人的查看更多 showMore: false, //是否显示快速选人的查看更多
showHidden: false, //是否显示收回 showHidden: false, //是否显示收回
selectedRowKeys: [], //表格选中的key selectedRowKeys: [], //表格选中的key
selectPeopleArr: [], //表格选中的人
//快速选人------------------------------------- //快速选人-------------------------------------
}); });
//获取组织树
const getOrgTree = () => {
let obj = {
keyword: "",
pageNo: 1,
pageSize: 10,
};
api
.getOrgTree(obj)
.then((res) => {
if (res.status === 200) {
console.log("获取组织树成功", res);
}
})
.catch((err) => {
console.log("获取组织树失败", err);
});
};
const closeDrawer = () => { const closeDrawer = () => {
state.activeKey = "1"; state.activeKey = "1";
ctx.emit("update:ProjOwnervisible", false); ctx.emit("update:ProjOwnervisible", false);
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool, props);
if (bool) {
getPeoples();
optionAuthPerm();
}
}; };
const getClientHeight = () => { const getClientHeight = () => {
state.screenHeight = document.body.clientHeight; state.screenHeight = document.body.clientHeight;
}; };
// //监测快速选人的高度 //获取组织树
// const getClientHeightSelecteds = () => { state.treeData = computed(() => {
// state.selectedsHeight = document.getElementById('selecteds').offsetHeight return store.state.orgtreeList ? store.state.orgtreeList : [];
// console.log('selectedsHeight',state.selectedsHeight) });
//获取选中部门的人员信息
const getPeoples = () => {
let obj = {
keyWord: "",
id: 0,
org: state.selectedKeys[0],
pageNo: state.currentPage,
pageSize: state.pageSize,
};
if (!state.selectedKeys[0]) {
state.tableDataTotal = 0;
return;
}
// console.log("obj", obj);
api
.getMemberInfo(obj)
.then((res) => {
// console.log("获取学员成功", res.data);
if (res.data.code === 200) {
let arr = res.data.data.rows;
let array = [];
arr.map((value) => {
// console.log("学员信息", value);
let obj = {
key: value.id,
id: value.id,
name: value.realName ? value.realName : "-",
bum: state.selectDepartment ? state.selectDepartment : "-",
numb: value.userNo ? value.userNo : "-",
guishu: state.selectDepartment ? state.selectDepartment : "-",
};
array.push(obj);
});
state.tabledata = array;
state.tableDataTotal = res.data.data.total;
}
})
.catch((err) => {
console.log("获取学员失败", err);
});
};
//分页
const changePagination = () => {
getPeoples();
};
//获取授权
const optionAuthPerm = () => {
let obj = {
keyWord: "",
tag: 1, //归属权
opt: 1, //查询
type: 2, //项目
// refId: props.selectProjectId, //项目id
refId: 64,
pageNo: 1,
pageSize: 10,
studentList: [],
};
console.log("obj", obj);
api
.optionAuthPerm(obj)
.then((res) => {
console.log("获取授权成功", res);
})
.catch((err) => {
console.log("获取授权失败", err);
});
};
//修改归属权
const changeOwnership = () => {
let obj = {
keyWord: "",
tag: 2, //归属权
opt: 3, //修改
type: 2, //项目
// refId: props.selectProjectId, //项目id
refId: 64,
pageNo: 1,
pageSize: 10,
// studentList: state.selectPeopleArr,
studentList: [{ id: "966733333637632000", name: "何丹" }],
};
console.log("修改归属权obj", obj);
api
.optionAuthPerm(obj)
.then((res) => {
console.log("修改授权成功", res);
})
.catch((err) => {
console.log("修改授权失败", err);
});
};
//确认修改归属权
const addAuth = () => {
changeOwnership();
};
// };
onMounted(() => { onMounted(() => {
// console.log("11111", 1); // console.log("11111", 1);
window.addEventListener("resize", getClientHeight, false); window.addEventListener("resize", getClientHeight, false);
// window.addEventListener("resize", getClientHeightSelecteds, false);
// judgeUrl();
getOrgTree();
}); });
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener("resize", getClientHeight, false); window.removeEventListener("resize", getClientHeight, false);
@@ -645,15 +666,35 @@ export default {
// 开始 快速选人------------------------------------------------------------------ // 开始 快速选人------------------------------------------------------------------
//选中部门 //选中部门
const departmentSelect = (e, k) => { const departmentSelect = (e, k) => {
console.log("选中的部门", e, k); if (k.node.treeChildList === null) {
state.selectedKeys = [k.node.key]; state.selectedKeys = [k.node.key];
state.selectDepartment = k.node.name;
getPeoples();
}
// console.log("kkkkkk", k);
// state.selectedKeys = [k.node.key];
// state.selectDepartment = k.node.name;
// getPeoples();
}; };
//快速选人 选中的数组 //快速选人 选中的数组
const onSelectChange = (selectedRowKeys, item) => { const onSelectChange = (selectedRowKeys, item) => {
// console.log("selectedRowKeys changed: ", selectedRowKeys,item); console.log("selectedRowKeys changed: ", selectedRowKeys, item);
state.selectedRowKeys = selectedRowKeys; state.selectedRowKeys = selectedRowKeys;
state.choosepeople = item.reverse(); state.choosepeople = item.reverse();
selectedsHeight();
//选中的人
let arr = [];
for (let i = 0; i < item.length; i++) {
console.log("item[i]", item[i]);
let obj = {
id: item[i].id,
name: item[i].name,
};
arr.push(obj);
}
state.selectPeopleArr = arr;
// selectedsHeight();
}; };
//单个删除选中的人 //单个删除选中的人
const deleteChoosePeople = (item) => { const deleteChoosePeople = (item) => {
@@ -752,6 +793,10 @@ export default {
deleteAll, deleteAll,
expandTree, expandTree,
changePagination,
optionAuthPerm,
changeOwnership,
addAuth,
}; };
}, },
}; };
@@ -1016,6 +1061,14 @@ export default {
// } // }
} }
.tabb { .tabb {
flex: 1;
// .ant-table-wrapper {
// min-height: 500px;
// }
.ant-radio {
margin-left: 8px;
// margin-right: 3px;
}
.ant-table-thead > tr > th { .ant-table-thead > tr > th {
background-color: rgba(240, 246, 252, 1); background-color: rgba(240, 246, 252, 1);
color: rgba(0, 0, 0, 0.85); color: rgba(0, 0, 0, 0.85);

View File

@@ -2,12 +2,12 @@
* @Author: lixg lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-09 09:26:26 * @Date: 2022-11-09 09:26:26
* @LastEditors: lixg lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-11-21 17:43:07 * @LastEditTime: 2022-11-23 17:25:31
* @FilePath: /fe-manage/src/store/index.js * @FilePath: /fe-manage/src/store/index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
import { createStore } from "vuex"; import { createStore } from "vuex";
// import * as api from '../api/index1'
export default createStore({ export default createStore({
state: { state: {
openpages: localStorage.getItem("openpages") openpages: localStorage.getItem("openpages")
@@ -22,7 +22,7 @@ export default createStore({
assessmentName: "", assessmentName: "",
routerId: null, routerId: null,
projectTemplateId:null, projectTemplateId: null,
orgtreeList: [], orgtreeList: [],
}, },
getters: {}, getters: {},
@@ -41,12 +41,15 @@ export default createStore({
console.log("state.assessmentName"); console.log("state.assessmentName");
console.log(state.assessmentName); console.log(state.assessmentName);
}, },
getOrgtreeList(state, orgtreeList) { //获取组织树
state.orgtreeList = orgtreeList; getOrgtreeList(state, data) {
state.orgtreeList = data
}, },
SET_projectTemplateId (state,projectTemplateId) { SET_projectTemplateId(state, projectTemplateId) {
state.projectTemplateId = projectTemplateId; state.projectTemplateId = projectTemplateId;
} }
}, },
actions: {}, actions: {},
modules: {}, modules: {},

View File

@@ -1119,11 +1119,17 @@
</a-modal> </a-modal>
<!-- 归属权抽屉 --> <!-- 归属权抽屉 -->
<proj-owner-ship v-model:ProjOwnervisible="ProjOwnervisible" /> <proj-owner-ship
v-model:ProjOwnervisible="ProjOwnervisible"
:selectProjectId="selectProjectId"
/>
<!-- 授权名单抽屉 --> <!-- 授权名单抽屉 -->
<proj-power-list v-model:ProjPvisible="ProjPvisible" /> <proj-power-list v-model:ProjPvisible="ProjPvisible" />
<!-- 查看权抽屉 --> <!-- 查看权抽屉 -->
<proj-check-ship v-model:ProjCheckvisible="ProjCheckvisible" /> <proj-check-ship
v-model:ProjCheckvisible="ProjCheckvisible"
:selectProjectId="selectProjectId"
/>
<!-- 管理权抽屉 --> <!-- 管理权抽屉 -->
<proj-manage-ship v-model:ProjManagevisible="ProjManagevisible" /> <proj-manage-ship v-model:ProjManagevisible="ProjManagevisible" />
</div> </div>
@@ -1194,6 +1200,8 @@ export default {
deleteProjectId: null, //删除的项目id deleteProjectId: null, //删除的项目id
templateProjectId: null, //存为模版的项目id templateProjectId: null, //存为模版的项目id
copyProjectId: null, //复制项目id copyProjectId: null, //复制项目id
selectProjectId: null, //选择的授权id
}); });
// 数据接入 - start - // 数据接入 - start -
const router = useRouter(); const router = useRouter();
@@ -2172,9 +2180,6 @@ export default {
width: 100, width: 100,
align: "center", align: "center",
customRender: (value) => { customRender: (value) => {
{
console.log("获取项目", value);
}
return ( return (
<div> <div>
{value.record.type !== 3 {value.record.type !== 3
@@ -2258,7 +2263,7 @@ export default {
<div <div
onClick={() => { onClick={() => {
console.log("点击了111"); console.log("点击了111");
showProjOwner(); showProjOwner(value.record.projectId);
}} }}
> >
归属权 归属权
@@ -3248,8 +3253,9 @@ export default {
state.sonproject = false; state.sonproject = false;
}; };
const showProjOwner = () => { const showProjOwner = (id) => {
state.ProjOwnervisible = true; state.ProjOwnervisible = true;
state.selectProjectId = id;
}; };
const showProjPrower = () => { const showProjPrower = () => {
state.ProjPvisible = true; state.ProjPvisible = true;