123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- <template>
- <view class="content">
- <view class="title"> 项目详情 </view>
- <view class="list">
- <view class="detail">
- <span class="subTitle">项目名称:</span>
- <span class="detailContent">{{ currentProject.project_name }}</span>
- </view>
- <view class="detail" v-if="currentProject.TypeInfo">
- <span class="subTitle">项目类别:</span>
- <span class="detailContent">{{ currentProject.TypeInfo.name }}</span>
- </view>
- <view class="detail" v-if="currentProject.IndustryInfo">
- <span class="subTitle">行业名称:</span>
- <span class="detailContent">
- {{ currentProject.IndustryInfo.name }}
- </span>
- </view>
- <view class="detail">
- <span class="subTitle">流程:</span>
- <span class="detailContent">{{ currentProject.FlowInfo.name }}</span>
- </view>
- <view class="detail">
- <span class="subTitle">状态:</span>
- <span class="detailContent">
- {{ status[currentProject.project_status] }}
- </span>
- </view>
- <view class="detail">
- <span class="subTitle">节点:</span>
- <span class="detailContent">
- {{ `${currentProject.NodeInfo.node}(` }}
- <span v-if="currentProject.audit_status == 0">待提交</span>
- <span
- v-if="currentProject.audit_status == 1"
- :style="{ color: '#1890ff' }"
- >
- 审核中
- </span>
- <span
- v-if="currentProject.audit_status == 2"
- :style="{ color: '#f5222d' }"
- >
- 审核拒绝
- </span>
- <span
- v-if="currentProject.audit_status == 3"
- :style="{ color: '#a0d911' }"
- >
- 审核通过
- </span>
- <span>)</span>
- </span>
- </view>
- <view class="detail" v-if="currentProject.audit_status == 2">
- <span class="subTitle">拒绝原因:</span>
- <span class="detailContent">
- {{ currentProject.audit_comment }}
- </span>
- </view>
- <view class="detail" v-if="currentProject.location">
- <span class="subTitle">项目地区:</span>
- <span class="detailContent">
- {{ `${currentProject.location}(${currentProject.location_code})` }}
- </span>
- </view>
- <view class="detail" v-if="currentProject.name">
- <span class="subTitle">项目简称:</span>
- <span class="detailContent">{{ currentProject.name }}</span>
- </view>
- <view class="detail" v-if="currentProject.version">
- <span class="subTitle">项目批次:</span>
- <span class="detailContent">{{ currentProject.version }}期</span>
- </view>
- <view class="detail" v-if="currentProject.AuthorUser">
- <span class="subTitle">创建人:</span>
- <span class="detailContent">{{ currentProject.AuthorUser.CName }}</span>
- </view>
- <view class="detail" v-if="currentProject.AuthorDepInfo">
- <span class="subTitle">所属部门:</span>
- <span class="detailContent">
- {{ currentProject.AuthorDepInfo.Name }}
- </span>
- </view>
- <view class="detail">
- <span class="subTitle">项目编号:</span>
- <span class="detailContent">
- {{ currentProject.project_full_code }}
- </span>
- </view>
- </view>
- <view class="title">审核详情 </view>
- <view class="list">
- <uni-steps
- :options="nodeList.list"
- :active="nodeList.currentIndex"
- direction="column"
- />
- </view>
- <uni-card title="操作">
- <view class="editBtns" slot="actions">
- <view class="edit" v-if="canEdit(0)" @click="onEdit()">编辑</view>
- <view class="edit" v-if="canEdit(0)" @click="onDelete()">删除</view>
- <view class="edit" v-if="canEdit(0)" @click="onSubmitAuth()"
- >提交审核</view
- >
- <view class="edit" v-if="canEdit(1)" @click="onMember()">成员管理</view>
- <view class="edit" v-if="canEdit(2)" @click="onExecute()">转执行</view>
- <view class="edit" v-if="canEdit(3)" @click="onWarranty()">转质保</view>
- <view class="edit" v-if="canEdit(3)" @click="onOperate()">转运营</view>
- </view>
- </uni-card>
- <view class="group">
- <button v-if="canAuth()" @click="onHandleAudit(0)" class="commit">
- 审核拒绝
- </button>
- <button
- v-if="canAuth()"
- @click="onHandleAudit(1)"
- type="primary"
- class="commit"
- >
- 审核通过
- </button>
- </view>
- </view>
- </template>
- <script>
- import { mapState } from "vuex";
- import { queryFlow, deleteApproval, submitAudit } from "@/services/project";
- export default {
- data() {
- return {
- auth: false,
- status: ["售前", "转执行", "转运营", "转质保"],
- flowList: [],
- };
- },
- computed: {
- ...mapState(["currentProject"]),
- nodeList() {
- if (!this.flowList) return [];
- let flowInfo = this.flowList.find(
- (item) => item.id == this.currentProject.flow_id
- );
- if (!flowInfo) return [];
- let currentIndex = flowInfo.Nodes.findIndex(
- (item) => item.id == this.currentProject.node_id
- );
- return {
- currentIndex,
- list: flowInfo.Nodes.map((item) => ({
- title: item.node,
- desc: `审批人:${this.getAudits(item)}`,
- })),
- };
- },
- },
- onLoad(options) {
- this.auth = Boolean(options.auth);
- this.init();
- },
- methods: {
- async init() {
- let res;
- res = await queryFlow();
- this.flowList = res.data;
- },
- canAuth() {
- return this.auth;
- },
- onHandleAudit(value) {
- if (value) console.log("审核通过");
- else console.log("审核拒绝");
- },
- getAudits(nodeInfo) {
- switch (nodeInfo.id) {
- case 11:
- return "执行项目经理";
- case 12:
- return "运营经理";
- case 13:
- return "执行项目经理";
- case 14:
- return "质保经理";
- default:
- return (nodeInfo.NodeAudits || [])
- .map((item) => item.AuthorRoleInfo.Name)
- .join(",");
- }
- },
- canEdit(index) {
- const user = uni.getStorageSync("user");
- let {
- audit_status,
- project_status,
- author,
- LeaderId,
- opt_manager_id,
- wty_manager_id,
- } = this.currentProject;
- //audit_status: 0未提审1审核中2审核拒绝3审核通过
- //project_status: 0售前1执行2转运营3转质保
- switch (index) {
- //编辑删除提审
- case 0:
- //售前阶段,未提审/审核被拒,创建人/管理员
- return (
- project_status == 0 &&
- (audit_status == 0 || audit_status == 2) &&
- (user.ID == author || user.IsSuper)
- );
- //成员管理
- case 1:
- //售前/执行/运营/质保,审核通过,项目经理/管理员
- let manager;
- switch (project_status) {
- case 0:
- manager = author;
- break;
- case 1:
- manager = LeaderId;
- break;
- case 2:
- manager = opt_manager_id;
- break;
- case 3:
- manager = wty_manager_id;
- break;
- }
- return audit_status == 3 && (user.ID == manager || user.IsSuper);
- //转执行
- case 2:
- //售前,审核通过,售前经理/管理员
- return (
- project_status == 0 &&
- audit_status == 3 &&
- (user.ID == author || user.IsSuper)
- );
- //转质保运营
- case 3:
- //执行,审核通过,执行经理/管理员
- return (
- project_status == 1 &&
- audit_status == 3 &&
- (user.ID == LeaderId || user.IsSuper)
- );
- }
- },
- onEdit() {
- uni.navigateTo({
- url: `./add?project_id=${this.currentProject.id}`,
- });
- },
- onDelete() {
- uni.showModal({
- title: "删除项目",
- content: "是否确认删除该项目",
- confirmText: "删除",
- confirmColor: "#ff7875",
- success: async (res) => {
- if (res.confirm) {
- await deleteApproval(this.currentProject);
- uni.showToast({
- title: "删除成功",
- });
- setTimeout(function () {
- uni.hideToast();
- uni.navigateTo({
- url: "./list",
- });
- }, 1800);
- }
- },
- });
- },
- onSubmitAuth() {
- uni.showModal({
- title: "提交审核",
- content: "是否确认提交审核",
- confirmText: "提审",
- success: async (res) => {
- if (res.confirm) {
- let payload = {
- id: this.currentProject.id,
- flow_id: this.currentProject.flow_id,
- node_id: this.currentProject.node_id,
- };
- console.log(payload);
- await submitAudit(payload);
- uni.showToast({
- title: "提审成功",
- });
- setTimeout(function () {
- uni.hideToast();
- uni.navigateTo({
- url: "./list",
- });
- }, 1800);
- }
- },
- });
- },
- onMember() {
- uni.navigateTo({
- url: "./member",
- });
- },
- onExecute() {
- return;
- },
- onWarranty() {
- return;
- },
- onOperate() {
- return;
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .content {
- display: flex;
- flex-wrap: wrap;
- }
- .title {
- width: 100%;
- padding: 0 20px 20px 20px;
- font: 24px bold;
- }
- .list {
- margin: 0 10% 20px 10%;
- width: 100%;
- }
- .detail {
- width: 100%;
- padding: 15px 0;
- font-size: 18px;
- display: flex;
- justify-items: space-between;
- .subTitle {
- width: 30%;
- }
- .detailContent {
- width: 70%;
- }
- }
- ::v-deep {
- .uni-steps__column-title {
- font-size: 18px;
- line-height: 24px;
- }
- .uni-steps__column-desc {
- font-size: 14px;
- line-height: 18px;
- }
- }
- .editBtns {
- display: flex;
- justify-content: space-around;
- flex-wrap: wrap;
- margin: 0 5%;
- .edit {
- width: 30%;
- margin-bottom: 20px;
- font-size: 16px;
- text-align: center;
- }
- }
- .group {
- width: 100%;
- display: flex;
- position: fixed;
- flex-wrap: wrap;
- justify-content: flex-start;
- bottom: 0;
- left: 0;
- .commit {
- width: 50%;
- border-radius: 0;
- margin: inherit;
- }
- }
- </style>
|