detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="content">
  3. <view class="title"> 项目详情 </view>
  4. <view class="list">
  5. <view class="detail">
  6. <span class="subTitle">项目名称:</span>
  7. <span class="detailContent">{{ currentProject.project_name }}</span>
  8. </view>
  9. <view class="detail" v-if="currentProject.TypeInfo">
  10. <span class="subTitle">项目类别:</span>
  11. <span class="detailContent">{{ currentProject.TypeInfo.name }}</span>
  12. </view>
  13. <view class="detail" v-if="currentProject.IndustryInfo">
  14. <span class="subTitle">行业名称:</span>
  15. <span class="detailContent">
  16. {{ currentProject.IndustryInfo.name }}
  17. </span>
  18. </view>
  19. <view class="detail">
  20. <span class="subTitle">流程:</span>
  21. <span class="detailContent">{{ currentProject.FlowInfo.name }}</span>
  22. </view>
  23. <view class="detail">
  24. <span class="subTitle">状态:</span>
  25. <span class="detailContent">
  26. {{ status[currentProject.project_status] }}
  27. </span>
  28. </view>
  29. <view class="detail">
  30. <span class="subTitle">节点:</span>
  31. <span class="detailContent">
  32. {{ `${currentProject.NodeInfo.node}(` }}
  33. <span v-if="currentProject.audit_status == 0">待提交</span>
  34. <span
  35. v-if="currentProject.audit_status == 1"
  36. :style="{ color: '#1890ff' }"
  37. >
  38. 审核中
  39. </span>
  40. <span
  41. v-if="currentProject.audit_status == 2"
  42. :style="{ color: '#f5222d' }"
  43. >
  44. 审核拒绝
  45. </span>
  46. <span
  47. v-if="currentProject.audit_status == 3"
  48. :style="{ color: '#a0d911' }"
  49. >
  50. 审核通过
  51. </span>
  52. <span>)</span>
  53. </span>
  54. </view>
  55. <view class="detail" v-if="currentProject.audit_status == 2">
  56. <span class="subTitle">拒绝原因:</span>
  57. <span class="detailContent">
  58. {{ currentProject.audit_comment }}
  59. </span>
  60. </view>
  61. <view class="detail" v-if="currentProject.location">
  62. <span class="subTitle">项目地区:</span>
  63. <span class="detailContent">
  64. {{ `${currentProject.location}(${currentProject.location_code})` }}
  65. </span>
  66. </view>
  67. <view class="detail" v-if="currentProject.name">
  68. <span class="subTitle">项目简称:</span>
  69. <span class="detailContent">{{ currentProject.name }}</span>
  70. </view>
  71. <view class="detail" v-if="currentProject.version">
  72. <span class="subTitle">项目批次:</span>
  73. <span class="detailContent">{{ currentProject.version }}期</span>
  74. </view>
  75. <view class="detail" v-if="currentProject.AuthorUser">
  76. <span class="subTitle">创建人:</span>
  77. <span class="detailContent">{{ currentProject.AuthorUser.CName }}</span>
  78. </view>
  79. <view class="detail" v-if="currentProject.AuthorDepInfo">
  80. <span class="subTitle">所属部门:</span>
  81. <span class="detailContent">
  82. {{ currentProject.AuthorDepInfo.Name }}
  83. </span>
  84. </view>
  85. <view class="detail">
  86. <span class="subTitle">项目编号:</span>
  87. <span class="detailContent">
  88. {{ currentProject.project_full_code }}
  89. </span>
  90. </view>
  91. </view>
  92. <view class="title">审核详情 </view>
  93. <view class="list">
  94. <uni-steps
  95. :options="nodeList.list"
  96. :active="nodeList.currentIndex"
  97. direction="column"
  98. />
  99. </view>
  100. <uni-card title="操作">
  101. <view class="editBtns" slot="actions">
  102. <view class="edit" v-if="canEdit(0)" @click="onEdit()">编辑</view>
  103. <view class="edit" v-if="canEdit(0)" @click="onDelete()">删除</view>
  104. <view class="edit" v-if="canEdit(0)" @click="onSubmitAuth()"
  105. >提交审核</view
  106. >
  107. <view class="edit" v-if="canEdit(1)" @click="onMember()">成员管理</view>
  108. <view class="edit" v-if="canEdit(2)" @click="onExecute()">转执行</view>
  109. <view class="edit" v-if="canEdit(3)" @click="onWarranty()">转质保</view>
  110. <view class="edit" v-if="canEdit(3)" @click="onOperate()">转运营</view>
  111. </view>
  112. </uni-card>
  113. <view class="group">
  114. <button v-if="canAuth()" @click="onHandleAudit(0)" class="commit">
  115. 审核拒绝
  116. </button>
  117. <button
  118. v-if="canAuth()"
  119. @click="onHandleAudit(1)"
  120. type="primary"
  121. class="commit"
  122. >
  123. 审核通过
  124. </button>
  125. </view>
  126. </view>
  127. </template>
  128. <script>
  129. import { mapState } from "vuex";
  130. import { queryFlow, deleteApproval, submitAudit } from "@/services/project";
  131. export default {
  132. data() {
  133. return {
  134. auth: false,
  135. status: ["售前", "转执行", "转运营", "转质保"],
  136. flowList: [],
  137. };
  138. },
  139. computed: {
  140. ...mapState(["currentProject"]),
  141. nodeList() {
  142. if (!this.flowList) return [];
  143. let flowInfo = this.flowList.find(
  144. (item) => item.id == this.currentProject.flow_id
  145. );
  146. if (!flowInfo) return [];
  147. let currentIndex = flowInfo.Nodes.findIndex(
  148. (item) => item.id == this.currentProject.node_id
  149. );
  150. return {
  151. currentIndex,
  152. list: flowInfo.Nodes.map((item) => ({
  153. title: item.node,
  154. desc: `审批人:${this.getAudits(item)}`,
  155. })),
  156. };
  157. },
  158. },
  159. onLoad(options) {
  160. this.auth = Boolean(options.auth);
  161. this.init();
  162. },
  163. methods: {
  164. async init() {
  165. let res;
  166. res = await queryFlow();
  167. this.flowList = res.data;
  168. },
  169. canAuth() {
  170. return this.auth;
  171. },
  172. onHandleAudit(value) {
  173. if (value) console.log("审核通过");
  174. else console.log("审核拒绝");
  175. },
  176. getAudits(nodeInfo) {
  177. switch (nodeInfo.id) {
  178. case 11:
  179. return "执行项目经理";
  180. case 12:
  181. return "运营经理";
  182. case 13:
  183. return "执行项目经理";
  184. case 14:
  185. return "质保经理";
  186. default:
  187. return (nodeInfo.NodeAudits || [])
  188. .map((item) => item.AuthorRoleInfo.Name)
  189. .join(",");
  190. }
  191. },
  192. canEdit(index) {
  193. const user = uni.getStorageSync("user");
  194. let {
  195. audit_status,
  196. project_status,
  197. author,
  198. LeaderId,
  199. opt_manager_id,
  200. wty_manager_id,
  201. } = this.currentProject;
  202. //audit_status: 0未提审1审核中2审核拒绝3审核通过
  203. //project_status: 0售前1执行2转运营3转质保
  204. switch (index) {
  205. //编辑删除提审
  206. case 0:
  207. //售前阶段,未提审/审核被拒,创建人/管理员
  208. return (
  209. project_status == 0 &&
  210. (audit_status == 0 || audit_status == 2) &&
  211. (user.ID == author || user.IsSuper)
  212. );
  213. //成员管理
  214. case 1:
  215. //售前/执行/运营/质保,审核通过,项目经理/管理员
  216. let manager;
  217. switch (project_status) {
  218. case 0:
  219. manager = author;
  220. break;
  221. case 1:
  222. manager = LeaderId;
  223. break;
  224. case 2:
  225. manager = opt_manager_id;
  226. break;
  227. case 3:
  228. manager = wty_manager_id;
  229. break;
  230. }
  231. return audit_status == 3 && (user.ID == manager || user.IsSuper);
  232. //转执行
  233. case 2:
  234. //售前,审核通过,售前经理/管理员
  235. return (
  236. project_status == 0 &&
  237. audit_status == 3 &&
  238. (user.ID == author || user.IsSuper)
  239. );
  240. //转质保运营
  241. case 3:
  242. //执行,审核通过,执行经理/管理员
  243. return (
  244. project_status == 1 &&
  245. audit_status == 3 &&
  246. (user.ID == LeaderId || user.IsSuper)
  247. );
  248. }
  249. },
  250. onEdit() {
  251. uni.navigateTo({
  252. url: `./add?project_id=${this.currentProject.id}`,
  253. });
  254. },
  255. onDelete() {
  256. uni.showModal({
  257. title: "删除项目",
  258. content: "是否确认删除该项目",
  259. confirmText: "删除",
  260. confirmColor: "#ff7875",
  261. success: async (res) => {
  262. if (res.confirm) {
  263. await deleteApproval(this.currentProject);
  264. uni.showToast({
  265. title: "删除成功",
  266. });
  267. setTimeout(function () {
  268. uni.hideToast();
  269. uni.navigateTo({
  270. url: "./list",
  271. });
  272. }, 1800);
  273. }
  274. },
  275. });
  276. },
  277. onSubmitAuth() {
  278. uni.showModal({
  279. title: "提交审核",
  280. content: "是否确认提交审核",
  281. confirmText: "提审",
  282. success: async (res) => {
  283. if (res.confirm) {
  284. let payload = {
  285. id: this.currentProject.id,
  286. flow_id: this.currentProject.flow_id,
  287. node_id: this.currentProject.node_id,
  288. };
  289. console.log(payload);
  290. await submitAudit(payload);
  291. uni.showToast({
  292. title: "提审成功",
  293. });
  294. setTimeout(function () {
  295. uni.hideToast();
  296. uni.navigateTo({
  297. url: "./list",
  298. });
  299. }, 1800);
  300. }
  301. },
  302. });
  303. },
  304. onMember() {
  305. uni.navigateTo({
  306. url: "./member",
  307. });
  308. },
  309. onExecute() {
  310. return;
  311. },
  312. onWarranty() {
  313. return;
  314. },
  315. onOperate() {
  316. return;
  317. },
  318. },
  319. };
  320. </script>
  321. <style lang="less" scoped>
  322. .content {
  323. display: flex;
  324. flex-wrap: wrap;
  325. }
  326. .title {
  327. width: 100%;
  328. padding: 0 20px 20px 20px;
  329. font: 24px bold;
  330. }
  331. .list {
  332. margin: 0 10% 20px 10%;
  333. width: 100%;
  334. }
  335. .detail {
  336. width: 100%;
  337. padding: 15px 0;
  338. font-size: 18px;
  339. display: flex;
  340. justify-items: space-between;
  341. .subTitle {
  342. width: 30%;
  343. }
  344. .detailContent {
  345. width: 70%;
  346. }
  347. }
  348. ::v-deep {
  349. .uni-steps__column-title {
  350. font-size: 18px;
  351. line-height: 24px;
  352. }
  353. .uni-steps__column-desc {
  354. font-size: 14px;
  355. line-height: 18px;
  356. }
  357. }
  358. .editBtns {
  359. display: flex;
  360. justify-content: space-around;
  361. flex-wrap: wrap;
  362. margin: 0 5%;
  363. .edit {
  364. width: 30%;
  365. margin-bottom: 20px;
  366. font-size: 16px;
  367. text-align: center;
  368. }
  369. }
  370. .group {
  371. width: 100%;
  372. display: flex;
  373. position: fixed;
  374. flex-wrap: wrap;
  375. justify-content: flex-start;
  376. bottom: 0;
  377. left: 0;
  378. .commit {
  379. width: 50%;
  380. border-radius: 0;
  381. margin: inherit;
  382. }
  383. }
  384. </style>