From dc304410cf29d73853b6f22cbaef7ba62c80e6da Mon Sep 17 00:00:00 2001 From: qinoy Date: Fri, 15 Jul 2022 09:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=8A=E5=88=A9=E9=A1=B9=E7=9B=AE=E3=80=90?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E7=AD=9B=E9=80=89=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/store/index.js | 44 +- .../src/views/repository/Repository.vue | 38 +- .../src/views/repository/RepositoryList.vue | 18 +- .../src/views/repository/RepositoryMain.vue | 441 +++++++++++++++++- .../views/repository/RepositoryMainList.vue | 17 + 5 files changed, 553 insertions(+), 5 deletions(-) diff --git a/com.actionsoft.apps.coe.pal/src/store/index.js b/com.actionsoft.apps.coe.pal/src/store/index.js index c8656e3..08e4f1e 100644 --- a/com.actionsoft.apps.coe.pal/src/store/index.js +++ b/com.actionsoft.apps.coe.pal/src/store/index.js @@ -10,7 +10,11 @@ export default new Vuex.Store({ navigationQueryVisible: false, // 导航栏输入框的快速搜索结果显示控制 navigationConditionQueryVisible: false, // 导航栏输入框的快速搜索结果显示控制 wsId: '',// 资产库id - teamId: ''// 小组id + teamId: '',// 小组id + createUsers:[], + orgIds:[], + methodIds:[], + pageFunction: {} }, getters: {// 提供获取state相关数据的方法 getTopMainHeightFn(state) {// 获取PAL主页面主体高度 @@ -28,6 +32,18 @@ export default new Vuex.Store({ }, getWsIdFn(state) {// 获取资产库id return state.wsId; + }, + getCreateUsers(state){ + return state.createUsers; + }, + getOrgIds(state){ + return state.orgIds; + }, + getMethodIds(state){ + return state.methodIds; + }, + getPageFunction(state){ + return state.pageFunction; } }, actions: {// 提供跟后台接口交互的方法,并且调用mutations提供的方法进行更新提交 @@ -46,6 +62,18 @@ export default new Vuex.Store({ }, setWsIdFn({commit, state}, wsId) { commit('setWsIdFn', wsId) + }, + setCreateUsers({commit, state},createUsers){ + commit('setCreateUsers', createUsers) + }, + setOrgIds({commit, state},orgIds){ + commit('setOrgIds', orgIds) + }, + setMethodIds({commit, state},methodIds){ + commit('setMethodIds', methodIds) + }, + setPageFunction({commit,state},functionObj){ + commit('setPageFunction',functionObj) } }, mutations: {// 提供存储设置state数据的方法 @@ -64,6 +92,20 @@ export default new Vuex.Store({ setWsIdFn(state, wsId) {// 设置资产库Id state.wsId = wsId; }, + setCreateUsers(state,createUsers){ + state.createUsers = createUsers; + }, + setOrgIds(state,orgIds){ + state.orgIds = orgIds; + }, + setMethodIds(state,methodIds){ + state.methodIds = methodIds; + }, + setPageFunction(state,functionObj){ + for (let key in functionObj) { + state.pageFunction[key] = functionObj[key] + } + }, edit(state, data) { for (let p in data) { state[p] = data[p]; diff --git a/com.actionsoft.apps.coe.pal/src/views/repository/Repository.vue b/com.actionsoft.apps.coe.pal/src/views/repository/Repository.vue index 13bfda4..f5aff84 100644 --- a/com.actionsoft.apps.coe.pal/src/views/repository/Repository.vue +++ b/com.actionsoft.apps.coe.pal/src/views/repository/Repository.vue @@ -1,10 +1,10 @@ @@ -13,6 +13,7 @@ import RepositoryMain from "./RepositoryMain"; import RepositoryMainList from "./RepositoryMainList"; import RepositoryList from "./RepositoryList"; + import awsuiAxios from "../../awsuiAxios"; export default { name: "Repository", components: {RepositoryMain, RepositoryMainList, RepositoryList}, @@ -22,7 +23,9 @@ mainContent: '', uuid: '', reFresh: false, + conditionReFresh: false, treeNode:{}, + conditionData: {} } }, provide: function() { @@ -33,8 +36,39 @@ }, created() { this.getRouteParam(this.$route.query); + this.initConditionData(); }, methods: { + // 获取历史 + initConditionData(){ + const that = this; + const data = { + url: 'jd', + data: { + wsId: that.$store.getters.getWsIdFn, + teamId: that.$store.getters.getTeamIdFn, + cmd: 'com.actionsoft.apps.coe.pal_condition_data_query' + } + }; + // 查询数据 + awsuiAxios.post(data).then(function (ro) { + if (ro.result === 'ok') { + that.conditionData = ro.data + // 历史查询条件保存 + let tempUserArr = [...that.conditionData.historyCondition.createUsers]; + that.$store.commit('setCreateUsers',tempUserArr); + let tempOrgIdArr = [...that.conditionData.historyCondition.orgIds]; + that.$store.commit('setOrgIds',tempOrgIdArr); + let tempMethodIdArr = [...that.conditionData.historyCondition.methodIds]; + that.$store.commit('setMethodIds',tempMethodIdArr); + that.conditionReFresh = true + }else { + that.$message({message: ro.msg, type: 'warning'}); + } + }).catch(error => { + console.log(error); + }) + }, getRouteParam(params) { if (JSON.stringify(params) == '{}' || !params.id) {// 无搜索,显示全部树和最近列表 this.reFresh = false; diff --git a/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryList.vue b/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryList.vue index 537a02a..81eace5 100644 --- a/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryList.vue +++ b/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryList.vue @@ -478,6 +478,19 @@ mounted() { this.initData(); this.rowDrop(); + // 【伊利架构筛选需求】将本组件内的initData方法暴露 方便别的组件调用 + let self = this; + this.$nextTick(() => { + let eventObj = {}; + for (const selfItem in self) { + if (selfItem === 'initData') { + let funcName = 'repositoryList_initData' + eventObj[funcName] = self[selfItem]; + break; + } + } + this.$store.commit('setPageFunction',eventObj) + }); }, methods: { handleCloseFolder(done) { @@ -557,7 +570,10 @@ cmd: 'com.actionsoft.apps.coe.pal_processlevel_repository_child_data_query', wsId: wsId, teamId: teamId, - id: that.uuid + id: that.uuid, + createUsers: JSON.stringify(that.$store.getters.getCreateUsers), + orgIds: JSON.stringify(that.$store.getters.getOrgIds), + methodIds: JSON.stringify(that.$store.getters.getMethodIds) } }; // 查询数据 diff --git a/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMain.vue b/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMain.vue index 96176f9..08c2fa8 100644 --- a/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMain.vue +++ b/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMain.vue @@ -75,6 +75,119 @@
+ +
+ + + +
+ 创建人 +
+
+ + + + +
+ 组织机构 +
+
+ + + + +
+ 文件类型 +
+
+
+
{ if (value === undefined ) { @@ -194,8 +313,34 @@ }; return { isDisabled:false, + multiple: true, + // 创建人 + currentUserCheck: true, + currentUser: '', + searchUserName: '', + createUserOptions: [], + createUserList: [], + checkCreateUserIds: [], + userCheckAll: false, + userIndeterminate: false, + // 文件类型 + conditionBoxVisible1: false, + conditionBoxVisible2: true, + conditionBoxVisible3: false, + methodIdText: '', + methodIdOptions: [], + methodIds: [], + checkMethodIds: [], + checkAll: false, + isIndeterminate: false, + // 组织机构 + addressType: 'department', + searchOrgName: '', + checkOrgIds: [], + currentUserDeptCheck: true, + dis: false, - headerHeight1: '60px', + headerHeight1: '88px', headerHeight2: '10px', treeHeight: (parseInt(this.$store.getters.getTopMainHeightFn)) - (this.havingWritePerm || this.havingCreatePerm ? parseInt(this.headerHeight1) : parseInt(this.headerHeight2)) + 'px', fileMethodList: [], @@ -291,6 +436,7 @@ }, created() { this.initData(); + this.resolveConditionData(); }, mounted() { bus.$on("getisDisabled",data =>{ @@ -298,6 +444,280 @@ }); }, methods: { + filterNode(value, data) { + if (!value) return true; + return data.name.indexOf(value) !== -1; + }, + searchOrgNameFun(){ + this.$refs.orgTree.filter(this.searchOrgName); + }, + // 当前人的部门是否选中 + handleCheckCurrentUserDeptChange(val){ + let temp = []; + temp = [...this.checkOrgIds]; + if (val) { + temp.push(this.currentUser.deptId); + } + this.$refs.orgTree.setCheckedKeys(temp) + this.$store.commit('setOrgIds',temp); + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // 刷新左侧树 + this.refreshNode('process'); + }, + orgCheckChange(data,checked,isChildCheck){ + let node = this.$refs.orgTree.getNode(data.id) + if (checked) { + if (node.expanded) { + node.expanded = false + node.loaded = false + } + // 去重保存勾选节点信息 + if (this.checkOrgIds.indexOf(data.id) === -1) { + this.checkOrgIds.push(data.id) + } + }else { + node.expanded = false + node.isLeaf = false + node.loaded = false + if (this.checkOrgIds.indexOf(data.id) !== -1) { // 删除取消勾选节点 + this.checkOrgIds.splice(this.checkOrgIds.indexOf(data.id),1) + } + } + this.$refs.orgTree.setCheckedKeys(this.checkOrgIds) + this.$store.commit('setOrgIds',this.checkOrgIds); + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // 刷新左侧树 + this.refreshNode('process'); + }, + loadNodeOrg(node, resolve) {// `动态`加载 + const that = this; + that.loading = true; + const data = { + url:'jd', + data:{ + cmd: 'com.actionsoft.apps.coe.pal_bpm_org_address_component_subjson', + addressType: 'department', + pid: '', + highSecurityFilter: '', + parentType: '' + } + }; + if (node.level === 0) { + // 获取根目录 + data.data.pid = ''; + data.data.parentType = ''; + } else { + // 获取其他目录 + data.data.pid = node.data.id; + data.data.parentType = node.data.type; + } + + if (node.level > 0 && that.checkOrgIds.indexOf(node.data.id) !== -1 && node.checked) { + resolve([]) + return; + } + // 查询数据 + awsuiAxios.post(data).then(function (ro) { + // 设置是否可选中 + if (that.multiple) {// 多选 + const isDept = that.addressType.indexOf('department') > -1; + const isUser = that.addressType.indexOf('user') > -1; + const isRole = that.addressType.indexOf('role') > -1; + const isPosition = that.addressType.indexOf('position') > -1; + for (let i = 0; i < ro.data.length; i++) { + const curr = ro.data[i]; + if (curr.type == 'company' || curr.type == 'roleRoot' || curr.type == 'roleGroup' || curr.type == 'positionRoot' || curr.type == 'positionGroup') { + curr.disabled = true; + } else { + if (isDept && curr.type == 'department') curr.disabled = false; + if (!isDept && curr.type == 'department') curr.disabled = true; + if (isUser && curr.type == 'user') curr.disabled = false; + if (!isUser && curr.type == 'user') curr.disabled = true; + if (isRole && curr.type == 'role') curr.disabled = false; + if (!isRole && curr.type == 'role') curr.disabled = true; + if (isPosition && curr.type == 'position') curr.disabled = false; + if (!isPosition && curr.type == 'position') curr.disabled = true; + } + } + }; + resolve(ro.data); + that.loading = false; + if (node.level == 0 && ro.data.length > 0) { + const tree = that.$refs.orgTree; + tree.getNode(ro.data[0].id).expand(); + setTimeout(function(){ + const childNode = tree.getNode(ro.data[0].id).childNodes[0]; + if (childNode != null) { + childNode.expand(); + } + }, 500); + } + }).catch(error=>{ + console.log(error); + }) + }, + closeNodeOrg(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载 + node.childNodes = []; + node.loaded = false; + }, + // 当前人状态改变 + handleCheckCurrentUserChange(val){ + let temp = []; + temp = [...this.checkCreateUserIds]; + if (val) { + temp.push(this.currentUser.userId); + } + this.$store.commit('setCreateUsers',temp); + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // 刷新左侧树 + this.refreshNode('process'); + }, + // 创建人全选 + handleCheckAllUserChange(val){ + let temp = [] + if (val) { + this.createUserList.forEach(user => temp.push(user.userId)); + this.checkCreateUserIds = temp; + }else{ + this.checkCreateUserIds = temp; + } + // 更新创建人信息 判断是否勾选的当前人 + if (this.currentUserCheck){ + temp.push(this.currentUser.userId) + } + this.$store.commit('setCreateUsers',temp); + this.userIndeterminate = false; + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // TODO 刷新左侧树 + this.refreshNode('process'); + }, + handleCheckedUserChange(value){ + let checkedCount = value.length; + this.userCheckAll = checkedCount === this.createUserList.length; + this.userIndeterminate = checkedCount > 0 && checkedCount < this.createUserList.length; + // 保存创建人信息 + let tempArr = []; + if (this.currentUserCheck) { + tempArr.push(this.currentUser.userId); + value.forEach(userId => { + tempArr.push(userId); + }) + }else { + tempArr = [...value]; + } + this.$store.commit('setCreateUsers',tempArr); + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // TODO 刷新左侧树 + this.refreshNode('process'); + }, + searchUserNameText() { + this.createUserList = []; + if (!this.searchUserName) { + this.createUserList = this.createUserOptions; + return; + } + this.createUserOptions.forEach(item => { + if (item.userName.indexOf(this.searchUserName) !== -1){ + this.createUserList.push(item); + } + }); + }, + // 文件类型全选 + handleCheckAllChange(val){ + let temp = [] + if (val) { + this.methodIds.forEach(item => temp.push(item.methodId)); + this.checkMethodIds = temp; + }else { + this.checkMethodIds = temp; + } + this.$store.commit('setMethodIds',temp); + this.isIndeterminate = false; + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // TODO 刷新左侧树 + this.refreshNode(); + }, + handleCheckedMethodIdChange(value){ + let checkedCount = value.length; + this.checkAll = checkedCount === this.methodIds.length; + this.isIndeterminate = checkedCount > 0 && checkedCount < this.methodIds.length; + + this.$store.commit('setMethodIds',[...value]); + // 刷新左侧文件树以及右侧最近编辑与收藏 + this.$store.getters.getPageFunction['repositoryMainList_initData'](); + // TODO 刷新左侧树 + this.refreshNode('process'); + }, + // 文件类型筛选 + searchMethodIdText(){ + this.methodIds = []; + if (!this.methodIdText) { + this.methodIds = this.methodIdOptions; + return; + } + this.methodIdOptions.forEach(item => { + if (item.name.indexOf(this.methodIdText) !== -1){ + this.methodIds.push(item); + } + }); + }, + // 初始化筛选条件数据 + resolveConditionData(){ + const that = this; + that.methodIdOptions = that.conditionData.methodIds + that.methodIds = that.methodIdOptions + that.currentUser = that.conditionData.currentUser + that.conditionData.createUsers.forEach(item => { + item.deptNameView = item.deptName + if (item.deptName.length > 8) { + item.deptNameView = `${item.deptName.substring(0,4)}***${item.deptName.substring(item.deptName.length-4)}` + } + }) + console.log('=========',that.conditionData.createUsers) + that.createUserOptions = that.conditionData.createUsers; + that.createUserList = that.createUserOptions; + console.log('=========',that.createUserList) + + let checkMethodIdCount = that.conditionData.historyCondition.methodIds.length + let checkCreateUsersCount = that.conditionData.historyCondition.createUsers.length + let index = that.conditionData.historyCondition.createUsers.indexOf(that.currentUser.userId); + if (index !== -1) { + checkCreateUsersCount = checkCreateUsersCount - 1; + that.currentUserCheck = true + }else { + that.currentUserCheck = false + } + that.checkAll = checkMethodIdCount === that.methodIds.length; + that.userCheckAll = checkCreateUsersCount === that.createUserList.length; + that.isIndeterminate = checkMethodIdCount > 0 && checkMethodIdCount < that.methodIds.length; + that.userIndeterminate = checkCreateUsersCount > 0 && checkCreateUsersCount < that.createUserList.length; + + // 根据历史筛选条件初始化多选框 + that.checkCreateUserIds = []; + that.conditionData.historyCondition.createUsers.forEach(userId => { + if (userId !== that.currentUser.userId) { + that.checkCreateUserIds.push(userId); + } + }) + that.checkMethodIds = [...that.conditionData.historyCondition.methodIds]; + that.checkOrgIds = [...that.conditionData.historyCondition.orgIds]; + let orgIdIndex = that.conditionData.historyCondition.orgIds.indexOf(that.currentUser.deptId); + if (orgIdIndex !== -1) { + that.currentUserDeptCheck = true; + }else { + that.currentUserDeptCheck = false; + } + that.$nextTick(() => { + that.$refs.orgTree.setCheckedKeys(that.checkOrgIds); + }) + }, + initData() { const that = this; that.loadingText = '加载中'; @@ -383,6 +803,9 @@ }; data.data.wsId = that.$store.getters.getWsIdFn; data.data.teamId = that.$store.getters.getTeamIdFn; + data.data.createUsers = JSON.stringify(that.$store.getters.getCreateUsers); + data.data.orgIds = JSON.stringify(that.$store.getters.getOrgIds); + data.data.methodIds = JSON.stringify(that.$store.getters.getMethodIds); data.data.cmd = 'com.actionsoft.apps.coe.pal_processlevel_tree_data'; if (node.level === 0) { // 获取根目录 @@ -974,4 +1397,20 @@ .main-tree::-webkit-scrollbar { display: none; } + .condition-box >>> .el-divider--vertical { + height: 18px; + } + .methodId-box >>> .el-divider--horizontal { + margin: 8px 0; + } + .org-box >>> .el-divider--horizontal { + margin: 8px 0; + } + .create-user-box >>> .el-divider--horizontal { + margin: 8px 0; + } + /deep/ .el-checkbox-group { + display: flex; + flex-direction: column; + } diff --git a/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMainList.vue b/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMainList.vue index 6a5d0fd..c2f6002 100644 --- a/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMainList.vue +++ b/com.actionsoft.apps.coe.pal/src/views/repository/RepositoryMainList.vue @@ -273,6 +273,20 @@ }, created() { this.initData(); + + // 【伊利架构筛选需求】将本组件内的initData方法暴露 方便别的组件调用 + let self = this; + this.$nextTick(() => { + let eventObj = {}; + for (const selfItem in self) { + if (selfItem === 'initData') { + let funcName = 'repositoryMainList_initData' + eventObj[funcName] = self[selfItem]; + break; + } + } + this.$store.commit('setPageFunction',eventObj) + }); }, methods: { handleRecnetOrStore(tab, event){ @@ -362,6 +376,9 @@ cmd: 'com.actionsoft.apps.coe.pal_processlevel_recent_and_favorite_data_query', wsId: that.$store.getters.getWsIdFn, teamId: that.$store.getters.getTeamIdFn, + createUsers: JSON.stringify(that.$store.getters.getCreateUsers), + orgIds: JSON.stringify(that.$store.getters.getOrgIds), + methodIds: JSON.stringify(that.$store.getters.getMethodIds) } }; // 查询数据