伊利项目【架构筛选】

This commit is contained in:
qinoy 2022-07-15 09:57:05 +08:00
parent 61a94211fc
commit dc304410cf
5 changed files with 553 additions and 5 deletions

View File

@ -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];

View File

@ -1,10 +1,10 @@
<template>
<el-container id="repository" :style="{'width': '100%', 'height': mainHeight}">
<el-aside width="280px" style="overflow: hidden;border-right: 1px solid #F2F2F2">
<RepositoryMain v-if="reFresh" ref="repositoryMain" key="repositoryMain"/>
<RepositoryMain v-if="reFresh && conditionReFresh" :condition-data="conditionData" ref="repositoryMain" key="repositoryMain"/>
</el-aside>
<el-main>
<component ref="component" :is="mainContent" :uuid="uuid" :key="Math.random()" :refreshTreeParentNode="refreshTreeParentNode" :refreshTreeNode="refreshTreeNode" :treeNode="treeNode"></component>
<component v-if="conditionReFresh" ref="component" :is="mainContent" :uuid="uuid" :key="Math.random()" :refreshTreeParentNode="refreshTreeParentNode" :refreshTreeNode="refreshTreeNode" :treeNode="treeNode"></component>
</el-main>
</el-container>
</template>
@ -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;

View File

@ -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)
}
};
//

View File

@ -75,6 +75,119 @@
</el-popover>
</div>
<div v-if="havingWritePerm || havingCreatePerm" style="width: 100%;border-bottom: 1px solid #F2F2F2;"></div>
<!-- 伊利需求左侧新增查询条件 -->
<div class="condition-box" style="margin-bottom: 10px;display: flex;justify-content: space-evenly;">
<!-- 创建人 -->
<el-popover
placement="bottom"
width="310"
trigger="hover"
>
<template slot="default">
<div class="create-user-box">
<el-input size="mini" placeholder="请输入用户名" v-model="searchUserName" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="searchUserNameText"></el-button>
</el-input>
<div style="margin: 6px 0;">
<el-checkbox v-model="currentUserCheck" @change="handleCheckCurrentUserChange">
<div style="font-weight: 600;">
<span>{{ currentUser.userName }}</span><span style="margin-left: 15px;">(当前用户)</span>
</div>
</el-checkbox>
</div>
<el-divider></el-divider>
<div style="margin: 4px 0;">
<el-checkbox :indeterminate="userIndeterminate" v-model="userCheckAll" @change="handleCheckAllUserChange"><span style="font-weight: 600">全部</span></el-checkbox>
</div>
<el-checkbox-group v-model="checkCreateUserIds" @change="handleCheckedUserChange">
<el-checkbox v-for="item in createUserList" :label="item.userId" :key="item.userId">
<div style="display: inline-flex;justify-content: space-between;width: 280px;font-weight: 600;">
<span>{{item.userName}}</span>
<el-tooltip class="item" effect="dark" :content="item.deptName" placement="bottom">
<span style="margin-left: 55px;">{{ item.deptNameView }}</span>
</el-tooltip>
</div>
</el-checkbox>
</el-checkbox-group>
</div>
</template>
<div slot="reference" style="cursor: pointer">
<span style="font-size: 12px;color: rgb(147,147,153);margin-right: 8px;">创建人</span><span style="color: rgb(147,147,153);"><i class="el-icon-arrow-down"></i></span>
</div>
</el-popover>
<el-divider direction="vertical"></el-divider>
<!-- 组织机构 -->
<el-popover
placement="bottom"
width="300"
trigger="hover"
>
<template slot="default">
<div class="org-box">
<el-input size="mini" placeholder="请输入组织" v-model="searchOrgName" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="searchOrgNameFun"></el-button>
</el-input>
<div style="margin: 6px 0;">
<el-checkbox v-model="currentUserDeptCheck" @change="handleCheckCurrentUserDeptChange">
<div style="font-weight: 600;">
<span>{{ currentUser.userName }}</span><span style="margin-left: 145px;">({{ currentUser.deptName }})</span>
</div>
</el-checkbox>
</div>
<el-divider></el-divider>
<div style="overflow: auto">
<el-tree
ref="orgTree"
:props="treeProps"
:show-checkbox="multiple"
:expand-on-click-node=false
:check-strictly=true
:highlight-current=true
@node-collapse="closeNodeOrg"
:filter-node-method="filterNode"
@check-change="orgCheckChange"
node-key="id"
lazy
:load="loadNodeOrg">
<span slot-scope="{node, data}">
<i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': node.data.icon.color}" v-html="node.data.icon.icon"></i>
<span>{{node.label}}</span>
</span>
</el-tree>
</div>
</div>
</template>
<div slot="reference" style="cursor: pointer">
<span style="font-size: 12px;color: rgb(147,147,153);margin-right: 8px;">组织机构</span><span style="color: rgb(147,147,153);"><i class="el-icon-arrow-down"></i></span>
</div>
</el-popover>
<el-divider direction="vertical"></el-divider>
<!-- 文件类型 -->
<el-popover
placement="bottom-end"
width="200"
trigger="hover"
>
<template slot="default">
<div class="methodId-box">
<el-input size="mini" placeholder="请输入文件类型" v-model="methodIdText" class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="searchMethodIdText"></el-button>
</el-input>
<div style="margin: 6px 0;">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全部类型</el-checkbox>
</div>
<el-divider></el-divider>
<el-checkbox-group v-model="checkMethodIds" @change="handleCheckedMethodIdChange">
<el-checkbox v-for="item in methodIds" :label="item.methodId" :key="item.methodId">{{item.name}}</el-checkbox>
</el-checkbox-group>
</div>
</template>
<div slot="reference" style="cursor: pointer">
<span style="font-size: 12px;color: rgb(147,147,153);margin-right: 8px;">文件类型</span><span style="color: rgb(147,147,153);"><i class="el-icon-arrow-down"></i></span>
</div>
</el-popover>
</div>
<div v-if="havingWritePerm" style="width: 100%;border-bottom: 1px solid #F2F2F2;"></div>
</el-header>
<el-main class="main-tree" :style="{'overflow': 'auto', 'height': treeHeight}">
<el-tree
@ -184,6 +297,12 @@
export default {
name: "RepositoryTree",
components: {RepositoryImport},
props: {
conditionData: {
type: Object,
default: null
}
},
data() {
let securityValidate = (rule, value, callback) => {
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;
}
</style>

View File

@ -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)
}
};
//