2024-03-22 18:49:41 +08:00
|
|
|
<template>
|
2024-04-10 16:18:11 +08:00
|
|
|
<!-- 项目首页 -->
|
|
|
|
|
<div class="fullHeight">
|
|
|
|
|
<vhead
|
|
|
|
|
:titleName="projectName"
|
|
|
|
|
:showR="true"
|
2024-05-02 11:55:48 +08:00
|
|
|
v-if="!selectGroupDialog&&postMessageDataList.length>0"
|
2024-04-10 16:18:11 +08:00
|
|
|
></vhead>
|
2024-04-12 19:42:47 +08:00
|
|
|
<div class="content-part" v-if="!selectGroupDialog && workSpaceShow">
|
2024-04-10 16:18:11 +08:00
|
|
|
<iframe
|
|
|
|
|
id="myIframe"
|
2024-04-14 11:20:00 +08:00
|
|
|
ref="myIframeRef"
|
2024-04-10 16:18:11 +08:00
|
|
|
:src="
|
2024-04-19 22:26:33 +08:00
|
|
|
`${$store.state.WORKFLOWURL}?token=${$store.state.userInfo.token}&projectSn=${$store.state.projectSn}`
|
2024-04-10 16:18:11 +08:00
|
|
|
"
|
|
|
|
|
style="width: 100%; height: 100%; border: medium none"
|
|
|
|
|
frameborder="1"
|
|
|
|
|
></iframe>
|
2024-03-22 18:49:41 +08:00
|
|
|
</div>
|
2024-04-12 21:02:09 +08:00
|
|
|
<div class="placeholderBox" v-if="!selectGroupDialog && !workSpaceShow">
|
2024-04-12 19:42:47 +08:00
|
|
|
<img src="@/assets/images/noData.png" alt="" />
|
|
|
|
|
<p>暂无数据</p>
|
|
|
|
|
</div>
|
2024-04-10 16:18:11 +08:00
|
|
|
<!-- 选择组织 -->
|
|
|
|
|
<el-dialog
|
|
|
|
|
title="选择组织"
|
|
|
|
|
:modal-append-to-body="false"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
:close-on-press-escape="false"
|
|
|
|
|
:show-close="false"
|
2024-05-02 11:55:48 +08:00
|
|
|
|
2024-04-10 16:18:11 +08:00
|
|
|
:visible.sync="selectGroupDialog"
|
|
|
|
|
>
|
2024-04-19 22:26:33 +08:00
|
|
|
<div class="content-list" :style="{height: groupListData.length > 4?'300px':'auto'}">
|
|
|
|
|
<vue-scroll style="height: 100%;">
|
|
|
|
|
<div
|
|
|
|
|
class="content-list-item"
|
|
|
|
|
v-for="(item, index) in groupListData"
|
|
|
|
|
:key="index"
|
|
|
|
|
@click="selectedGroupData(item)"
|
|
|
|
|
>
|
|
|
|
|
<!-- <i class="el-icon-trophy-1"></i> -->
|
|
|
|
|
<img src="@/assets/images/headerImg/icon3.png" />
|
|
|
|
|
<span>{{ item.companyName }}</span>
|
|
|
|
|
<i class="el-icon-arrow-right"></i>
|
|
|
|
|
</div>
|
|
|
|
|
</vue-scroll>
|
2024-04-11 19:15:19 +08:00
|
|
|
<!-- <div class="content-list-item" @click="selectedGroupData()">
|
2024-04-10 16:18:11 +08:00
|
|
|
<img src="@/assets/images/headerImg/icon4.png" />
|
|
|
|
|
<span>{{ $store.state.userInfo.account }}</span>
|
|
|
|
|
<div>个人租户</div>
|
|
|
|
|
<i class="el-icon-arrow-right"></i>
|
2024-04-11 19:15:19 +08:00
|
|
|
</div> -->
|
2024-04-10 16:18:11 +08:00
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import vhead from "@/components/header";
|
|
|
|
|
import { getProjectDetail } from "@/assets/js/api/baseInfo.js";
|
2024-04-20 19:07:58 +08:00
|
|
|
import { getGroupListByCompanyApi, jumpLargeUserInfoApi } from "@/assets/js/api/loginSign.js";
|
2024-04-11 22:30:23 +08:00
|
|
|
import {
|
|
|
|
|
getAllModuleApi,
|
|
|
|
|
getNewUserAllModulePageApi,
|
|
|
|
|
} from "@/assets/js/api/jxjadmin.js";
|
2024-04-23 20:03:49 +08:00
|
|
|
import { getComapnyStatisticsSupplierListApi } from "@/assets/js/api/company/project";
|
2024-04-10 16:18:11 +08:00
|
|
|
export default {
|
|
|
|
|
name: "workSpace",
|
|
|
|
|
components: { vhead },
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2024-05-02 11:55:48 +08:00
|
|
|
workSpaceShow: false,
|
2024-04-10 16:18:11 +08:00
|
|
|
projectSn: "",
|
|
|
|
|
projectName: "",
|
2024-05-02 11:55:48 +08:00
|
|
|
selectGroupDialog: false,
|
2024-04-10 16:18:11 +08:00
|
|
|
groupListData: [],
|
|
|
|
|
selectedDataSn: "",
|
2024-04-14 11:20:00 +08:00
|
|
|
postMessageDataList: [],
|
2024-04-10 16:18:11 +08:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
2024-05-02 11:55:48 +08:00
|
|
|
// if (!this.$store.state.selectedGroupSn) {
|
|
|
|
|
// this.selectGroupDialog = true;
|
|
|
|
|
// }
|
2024-04-10 16:18:11 +08:00
|
|
|
this.getGroupTreeData();
|
|
|
|
|
},
|
2024-04-11 19:15:19 +08:00
|
|
|
mounted() {
|
|
|
|
|
// 挂载后来给iframe传递菜单数据
|
2024-04-14 11:20:00 +08:00
|
|
|
if (this.$store.state.selectedGroupSn && !this.selectGroupDialog) {
|
2024-04-11 19:15:19 +08:00
|
|
|
this.getModuleList();
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-14 11:20:00 +08:00
|
|
|
beforeDestroy() {
|
|
|
|
|
// 移除事件监听器,避免内存泄漏
|
|
|
|
|
let iframe = this.$refs.myIframeRef;
|
|
|
|
|
iframe.removeEventListener("load", this.onIframeLoad);
|
|
|
|
|
},
|
2024-04-10 16:18:11 +08:00
|
|
|
methods: {
|
2024-04-23 20:03:49 +08:00
|
|
|
// 查询全部模块
|
|
|
|
|
getModuleMenuList() {
|
|
|
|
|
getNewUserAllModulePageApi({
|
|
|
|
|
projectSn: this.$store.state.projectSn,
|
|
|
|
|
userId: this.$store.state.userInfo.userId,
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
console.log(res,'我爱你测试')
|
|
|
|
|
this.$store.commit("setUserInfo", {
|
|
|
|
|
...this.$store.state.userInfo,
|
|
|
|
|
menuAuthority: {
|
|
|
|
|
menuList: res.result.menuList,
|
|
|
|
|
moduleList: res.result.moduleList
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-04-14 11:20:00 +08:00
|
|
|
onIframeLoad() {
|
|
|
|
|
// iframe加载完毕后
|
|
|
|
|
// 传递的工作流菜单
|
|
|
|
|
const defaultMenuList = [
|
|
|
|
|
{
|
|
|
|
|
menuName: "审批列表",
|
|
|
|
|
path: "/workspace/forms",
|
|
|
|
|
icon: "el-icon-s-order",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "待我处理",
|
|
|
|
|
path: "/workspace/unfinished",
|
|
|
|
|
icon: "el-icon-s-check",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "已处理的",
|
|
|
|
|
path: "/workspace/finished",
|
|
|
|
|
icon: "el-icon-s-custom",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "我发起的",
|
|
|
|
|
path: "/workspace/submit",
|
|
|
|
|
icon: "el-icon-s-claim",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
menuName: "关于我的",
|
|
|
|
|
path: "/workspace/cc",
|
|
|
|
|
icon: "el-icon-s-promotion",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2024-05-05 14:07:31 +08:00
|
|
|
// console.error("================发消息之前的userInfo==================")
|
|
|
|
|
// console.error(this.$store.state.userInfo)
|
|
|
|
|
// console.error("================发消息之前的userInfo==================")
|
2024-05-03 00:13:56 +08:00
|
|
|
|
2024-05-05 14:07:31 +08:00
|
|
|
// console.error("================发消息之前的projectSn==================")
|
|
|
|
|
// console.error(this.$store.state.projectSn)
|
|
|
|
|
// console.error("================发消息之前的projectSn==================")
|
2024-05-03 00:13:56 +08:00
|
|
|
|
2024-05-02 22:47:36 +08:00
|
|
|
// let iframe = document.getElementById("myIframe");
|
|
|
|
|
let iframe = this.$refs.myIframeRef;
|
2024-04-14 11:20:00 +08:00
|
|
|
iframe.contentWindow.postMessage(
|
|
|
|
|
{
|
|
|
|
|
type: "emitData",
|
|
|
|
|
data: JSON.stringify({
|
|
|
|
|
...this.$store.state.userInfo,
|
|
|
|
|
projectSn: this.$store.state.projectSn,
|
|
|
|
|
}),
|
|
|
|
|
authMenuList:
|
|
|
|
|
this.postMessageDataList.length > 0
|
|
|
|
|
? JSON.stringify(this.postMessageDataList)
|
|
|
|
|
: JSON.stringify(defaultMenuList),
|
|
|
|
|
},
|
|
|
|
|
"*"
|
|
|
|
|
);
|
|
|
|
|
},
|
2024-04-10 16:18:11 +08:00
|
|
|
// 查询全部模块(拿到工作流的模块菜单)
|
2024-04-11 22:30:23 +08:00
|
|
|
getModuleList() {
|
|
|
|
|
getNewUserAllModulePageApi({
|
|
|
|
|
projectSn: this.$store.state.projectSn,
|
|
|
|
|
moduleType: 7,
|
2024-04-12 21:02:09 +08:00
|
|
|
userId: this.$store.state.userInfo.userId,
|
2024-04-11 22:30:23 +08:00
|
|
|
}).then((res) => {
|
|
|
|
|
// 传递的工作流菜单
|
|
|
|
|
const responseMenuList = [];
|
|
|
|
|
let all = res.result.moduleList;
|
2024-04-12 21:02:09 +08:00
|
|
|
if (all.length == 0) {
|
2024-04-12 19:42:47 +08:00
|
|
|
this.workSpaceShow = false;
|
|
|
|
|
return;
|
2024-04-13 22:51:12 +08:00
|
|
|
} else {
|
|
|
|
|
this.workSpaceShow = false;
|
|
|
|
|
all.forEach((element, index) => {
|
2024-04-14 11:20:00 +08:00
|
|
|
if (element.moduleName == "工作台") {
|
|
|
|
|
this.workSpaceShow = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-12 19:42:47 +08:00
|
|
|
}
|
2024-04-11 22:30:23 +08:00
|
|
|
console.log("all", res.result);
|
|
|
|
|
all.forEach((element, index) => {
|
|
|
|
|
all[index].operation = false;
|
2024-04-13 22:51:12 +08:00
|
|
|
if (element.moduleName == "工作台") {
|
2024-04-12 21:02:09 +08:00
|
|
|
element.menuList.forEach((element2) => {
|
2024-04-11 22:30:23 +08:00
|
|
|
all[index].operation = true;
|
2024-04-11 19:15:19 +08:00
|
|
|
responseMenuList.push({
|
2024-04-11 22:30:23 +08:00
|
|
|
menuName: element2.menuName,
|
|
|
|
|
path: element2.path,
|
|
|
|
|
icon: element2.icon,
|
2024-04-11 19:15:19 +08:00
|
|
|
});
|
2024-04-12 21:02:09 +08:00
|
|
|
});
|
|
|
|
|
}
|
2024-04-11 22:30:23 +08:00
|
|
|
});
|
2024-04-12 21:02:09 +08:00
|
|
|
console.log(responseMenuList, "我的测试11112222222222");
|
2024-04-14 11:20:00 +08:00
|
|
|
this.postMessageDataList = responseMenuList;
|
2024-04-19 22:26:33 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
|
let iframe = this.$refs.myIframeRef;
|
|
|
|
|
iframe.addEventListener("load", this.onIframeLoad);
|
|
|
|
|
})
|
2024-04-10 16:18:11 +08:00
|
|
|
});
|
2024-03-22 18:49:41 +08:00
|
|
|
},
|
2024-04-10 16:18:11 +08:00
|
|
|
// 默认选中已选中组织的第一个项目
|
|
|
|
|
selectedDefaultProject(obj) {
|
|
|
|
|
if (obj.list && obj.list.length > 0) {
|
|
|
|
|
obj.list.map((item) => {
|
|
|
|
|
this.selectedDefaultProject(item);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.projectSn = this.$store.state.projectSn || "";
|
|
|
|
|
if (!this.projectSn) {
|
|
|
|
|
// 加判断是为了在循环中只选中第一个
|
|
|
|
|
this.projectSn = obj.sn;
|
|
|
|
|
// 修改全局projectSn
|
2024-04-23 20:03:49 +08:00
|
|
|
console.log(obj.sn,'我爱你测试')
|
2024-04-10 16:18:11 +08:00
|
|
|
this.$store.commit("setProjectSn", obj.sn);
|
|
|
|
|
}
|
2024-04-23 20:03:49 +08:00
|
|
|
this.getModuleMenuList();
|
|
|
|
|
this.getDataDateils();
|
2024-04-08 19:12:10 +08:00
|
|
|
}
|
2024-03-22 18:49:41 +08:00
|
|
|
},
|
2024-04-10 16:18:11 +08:00
|
|
|
// 点击选中组织
|
|
|
|
|
selectedGroupData(item) {
|
2024-04-20 19:07:58 +08:00
|
|
|
let data = {
|
|
|
|
|
token: this.$store.state.userInfo.token,
|
|
|
|
|
headquartersSn: item.companySn
|
|
|
|
|
};
|
|
|
|
|
jumpLargeUserInfoApi(data).then((res) => {
|
|
|
|
|
console.log(res,'重新获取信息');
|
|
|
|
|
if(res.result){
|
|
|
|
|
this.$store.commit("setUserInfo", res.result);
|
2024-04-23 20:03:49 +08:00
|
|
|
console.log(item,123456789)
|
2024-04-20 19:07:58 +08:00
|
|
|
if (item) {
|
|
|
|
|
this.selectedDataSn = item.companySn;
|
|
|
|
|
this.$store.commit("setSelectedGroupSn", item.companySn); // 存储选中的组织Sn
|
|
|
|
|
this.selectedDefaultProject(item);
|
|
|
|
|
} else {
|
|
|
|
|
let storeVal = this.$store.state.userInfo;
|
|
|
|
|
this.selectedDataSn = storeVal.headquartersSn;
|
|
|
|
|
this.$store.commit("setSelectedGroupSn", storeVal.headquartersSn); // 存储选中的组织Sn
|
|
|
|
|
// this.selectedDefaultProject(storeVal.userInfo);
|
|
|
|
|
}
|
|
|
|
|
this.selectGroupDialog = false;
|
|
|
|
|
this.getModuleList();
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-04-10 16:18:11 +08:00
|
|
|
},
|
|
|
|
|
getGroupTreeData() {
|
|
|
|
|
let data = {
|
|
|
|
|
userId: this.$store.state.userInfo.userId,
|
2024-04-20 19:07:58 +08:00
|
|
|
// headquartersSn: this.$store.state.userInfo.headquartersSn
|
2024-04-10 16:18:11 +08:00
|
|
|
};
|
2024-04-23 20:03:49 +08:00
|
|
|
// getGroupListByCompanyApi
|
2024-04-20 19:07:58 +08:00
|
|
|
getGroupListByCompanyApi(data).then((res) => {
|
2024-04-10 16:18:11 +08:00
|
|
|
// console.log(res);
|
|
|
|
|
if (res.code == 200 && res.result) {
|
|
|
|
|
this.groupListData = res.result;
|
2024-05-02 11:55:48 +08:00
|
|
|
console.log("this.groupListData",this.groupListData)
|
|
|
|
|
if(this.groupListData.length==1){
|
|
|
|
|
this.selectedGroupData(this.groupListData[0]);
|
|
|
|
|
}else{
|
|
|
|
|
this.selectGroupDialog = true
|
|
|
|
|
}
|
2024-04-10 16:18:11 +08:00
|
|
|
this.$store.commit("setGroupTreeList", res.result); // 存储组织树数据
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
//获取详情
|
|
|
|
|
getDataDateils() {
|
|
|
|
|
let data = {
|
|
|
|
|
projectSn: this.projectSn,
|
|
|
|
|
};
|
|
|
|
|
getProjectDetail(data).then((res) => {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
this.projectName = res.result.projectName;
|
|
|
|
|
document.title = this.projectName;
|
|
|
|
|
this.$store.commit("setProDetail", res.result);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-13 16:49:55 +08:00
|
|
|
watch: {
|
|
|
|
|
params: {
|
|
|
|
|
deep: true,
|
|
|
|
|
handler() {
|
|
|
|
|
this.getUserNotify();
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-14 11:20:00 +08:00
|
|
|
"$store.state.projectSn": {
|
2024-04-13 16:49:55 +08:00
|
|
|
deep: true,
|
2024-04-14 11:20:00 +08:00
|
|
|
// immediate: true,
|
2024-04-13 16:49:55 +08:00
|
|
|
handler(to, from) {
|
2024-04-14 11:20:00 +08:00
|
|
|
console.log(to, "最新值");
|
|
|
|
|
if (this.$store.state.projectSn) this.getModuleList();
|
2024-04-13 16:49:55 +08:00
|
|
|
},
|
2024-04-14 11:20:00 +08:00
|
|
|
},
|
2024-04-13 16:49:55 +08:00
|
|
|
},
|
2024-04-10 16:18:11 +08:00
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.flexStyle() {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2024-04-03 18:19:28 +08:00
|
|
|
}
|
2024-04-10 16:18:11 +08:00
|
|
|
.content-part {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: calc(100% - 60px);
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
.content-list {
|
|
|
|
|
&-item {
|
|
|
|
|
.flexStyle();
|
|
|
|
|
padding: 10px 15px;
|
|
|
|
|
border: 1px solid #dadbdb;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
img {
|
|
|
|
|
width: 30px;
|
|
|
|
|
height: 30px;
|
|
|
|
|
}
|
|
|
|
|
// >div{
|
|
|
|
|
// border: 1px solid #7299F8;
|
|
|
|
|
// border-radius: 5px;
|
|
|
|
|
// background-color: #E3F6FF;
|
|
|
|
|
// padding: 5px 15px;
|
|
|
|
|
// color: #5A88F7;
|
|
|
|
|
// }
|
|
|
|
|
> span:nth-child(2) {
|
|
|
|
|
margin: 0px 15px 0px 10px;
|
|
|
|
|
}
|
|
|
|
|
> div {
|
|
|
|
|
padding: 3px 10px;
|
|
|
|
|
color: #79acfa;
|
|
|
|
|
background-color: #e4f5ff;
|
|
|
|
|
border: 1px solid #99c3fb;
|
2024-04-03 18:19:28 +08:00
|
|
|
border-radius: 5px;
|
2024-04-10 16:18:11 +08:00
|
|
|
margin-top: 2px;
|
|
|
|
|
font-size: 10px;
|
2024-04-03 18:19:28 +08:00
|
|
|
}
|
2024-04-10 16:18:11 +08:00
|
|
|
/deep/.el-icon-arrow-right {
|
|
|
|
|
margin-left: auto;
|
2024-04-03 18:19:28 +08:00
|
|
|
}
|
|
|
|
|
}
|
2024-04-10 16:18:11 +08:00
|
|
|
&-item:not(:last-child) {
|
|
|
|
|
margin-bottom: 10px;
|
2024-04-03 18:19:28 +08:00
|
|
|
}
|
2024-04-10 16:18:11 +08:00
|
|
|
}
|
|
|
|
|
/deep/.el-dialog {
|
|
|
|
|
width: 25%;
|
|
|
|
|
.el-dialog__body {
|
|
|
|
|
padding-top: 10px;
|
|
|
|
|
padding-bottom: 15px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|