processDtl.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <div class="process">
  3. <van-nav-bar
  4. :title="route.query.processType == 20 ? '流程详情' : '流程审批'"
  5. left-text=""
  6. left-arrow
  7. @click-left="onClickLeft"
  8. >
  9. </van-nav-bar>
  10. <div>
  11. <component
  12. ref="makeDom"
  13. :queryData="queryData.data"
  14. :is="
  15. componentObj[route.query.flowKey]
  16. ? componentObj[route.query.flowKey].component
  17. : SendSubscribe
  18. "
  19. ></component>
  20. </div>
  21. <div class="btn-warp" :class="footerMoreType ? 'open-more' : ''">
  22. <!-- <div class="more-btn" @click="footerMoreType = !footerMoreType">
  23. 更多 <van-icon name="arrow-up" v-if="!footerMoreType" /> <van-icon name="arrow-down" v-else />
  24. </div> -->
  25. <div class="foot-btn-warp" v-if="route.query.processType != 20">
  26. <div
  27. class="for-btn"
  28. v-for="(i, index) in approvalRecordData.buttonInfoList"
  29. :key="i.type"
  30. v-show="index == 0"
  31. @click="handleSubmit(i.type)"
  32. >
  33. <div>
  34. <i class="iconfont" :class="iconObj[i.type]"></i>
  35. </div>
  36. {{ i.name }}
  37. </div>
  38. <div class="for-btn" @click="footerMoreType = !footerMoreType">
  39. <div>
  40. <i class="iconfont icon-icomx_message"></i>
  41. </div>
  42. 审批意见
  43. </div>
  44. <div
  45. class="for-btn"
  46. @click="footerMoreBtnType = !footerMoreBtnType"
  47. v-if="approvalRecordData.buttonInfoList.length < 1"
  48. >
  49. <div>
  50. <i class="iconfont icon-iconx__caidan1"></i>
  51. </div>
  52. 更多
  53. </div>
  54. <div
  55. class="agree-btn"
  56. @click="nextFn"
  57. v-if="componentObj[route.query.flowKey].tabsNum"
  58. >
  59. 下一步
  60. </div>
  61. <div class="next-btn" @click="handleSubmit(1)">同意</div>
  62. </div>
  63. </div>
  64. <van-action-sheet
  65. v-model:show="footerMoreBtnType"
  66. title="更多操作"
  67. class="more-modal"
  68. >
  69. <div
  70. class="for-btn-more"
  71. v-for="(i, index) in approvalRecordData.buttonInfoList"
  72. :key="i.type"
  73. v-show="index != 0"
  74. @click="handleSubmit(i.type)"
  75. >
  76. <span style="margin-right: 20px">
  77. <i class="iconfont" :class="iconObj[i.type]"></i>
  78. </span>
  79. {{ i.name }}
  80. </div>
  81. <div style="height: 50px">1</div>
  82. </van-action-sheet>
  83. <van-action-sheet
  84. v-model:show="footerMoreType"
  85. title="审批记录"
  86. class="more-modal"
  87. >
  88. <div class="card">
  89. <van-steps direction="vertical" :active="stepsNum" class="common-steps">
  90. <van-step v-for="(i, index) in recordList" :key="i.nodeId">
  91. <div class="label">
  92. <span class="name">{{ i.processedUser }}</span>
  93. <span class="tip">{{ i.nodeName }}</span>
  94. <span
  95. class="state"
  96. :class="
  97. index == stepsNum
  98. ? 'cl-yl'
  99. : index < stepsNum
  100. ? 'cl-blue'
  101. : ''
  102. "
  103. >
  104. {{ i.nodeName }}
  105. </span>
  106. </div>
  107. <div class="content">审批意见:{{ i.remark }}</div>
  108. <p>{{ i.processedDate }}</p>
  109. </van-step>
  110. </van-steps>
  111. </div>
  112. <div v-if="route.query.processType != 20">
  113. <div style="padding: 0 12px">
  114. <van-field
  115. v-model="flowForm.remark"
  116. rows="3"
  117. autosize
  118. type="textarea"
  119. maxlength="400"
  120. placeholder="请输入审批意见"
  121. show-word-limit
  122. style="backround: #f1f1f1"
  123. />
  124. </div>
  125. <div class="load-btn-box">
  126. <van-button
  127. size="small"
  128. type="primary"
  129. plain
  130. round
  131. v-for="i in approvalRecordData.buttonInfoList"
  132. :key="i.type"
  133. v-show="i.type != 1"
  134. @click="handleSubmit(i.type)"
  135. >{{ i.name }}
  136. </van-button>
  137. </div>
  138. <div class="content">
  139. <div class="foot-btn-warp">
  140. <div class="agree-btn" @click="handleSubmit(1)">同意</div>
  141. <div class="next-btn" @click="nextFn">下一步</div>
  142. </div>
  143. </div>
  144. </div>
  145. </van-action-sheet>
  146. </div>
  147. </template>
  148. <script setup>
  149. import { ref, getCurrentInstance, onMounted, reactive } from "vue";
  150. import { useRoute } from "vue-router";
  151. import SendSubscribe from "./components/SendSubscribe";
  152. import SendFunds from "./components/SendFunds";
  153. import PriceSheet from "./components/PriceSheet";
  154. import Contract from "./components/Contract";
  155. import EhsdContract from "./components/EhsdContract";
  156. import EhsdContractChange from "./components/EhsdContractChange";
  157. import SendPurchase from "./components/SendPurchase";
  158. import SendPurchasePayment from "./components/SendPurchasePayment";
  159. import ContractAlteration from "./components/ContractAlteration";
  160. import { showSuccessToast, showFailToast } from "vant";
  161. const route = useRoute();
  162. const proxy = getCurrentInstance().proxy;
  163. // const onClickLeft = () => proxy.$router.push(componentObj.value[route.query.flowKey].backUrl)
  164. const onClickLeft = () => proxy.$router.go(-1);
  165. const message = ref("");
  166. const onClickRight = () => {
  167. proxy.$router.push("/main/working");
  168. };
  169. const iconObj = ref({
  170. 2: "icon-icomx_shanchu",
  171. 3: "icon-icomx_sent",
  172. 4: "icon-iconx_tuihfqr",
  173. 5: "icon-iconm_shanchu",
  174. });
  175. const makeDom = ref(null);
  176. let stepsNum = ref(0);
  177. let queryData = reactive({
  178. data: {},
  179. });
  180. let footerMoreBtnType = ref(false);
  181. let footerMoreType = ref(false);
  182. const flowForm = reactive({
  183. flowKey: "",
  184. tenantType: "",
  185. handleUserId: "",
  186. remark: "",
  187. data: {},
  188. });
  189. let recordList = ref([]);
  190. const approvalRecordData = ref({
  191. buttonInfoList: [],
  192. });
  193. const getAuxiliaryData = (data) => {
  194. auxiliaryData.value = data;
  195. };
  196. let componentObj = ref({
  197. subscribe_flow: {
  198. title: "申购",
  199. component: SendSubscribe,
  200. backUrl: "/main/subscribe",
  201. tabsNum: 2,
  202. },
  203. account_request_funds_flow: {
  204. title: "请款",
  205. component: SendFunds,
  206. backUrl: "/main/funds",
  207. tabsNum: 3,
  208. },
  209. sale_quotation_flow: {
  210. title: "报价单",
  211. component: PriceSheet,
  212. backUrl: "/main/priceSheet",
  213. tabsNum: 4,
  214. },
  215. contract_flow: {
  216. title: "销售合同",
  217. component: EhsdContract,
  218. backUrl: "/main/contract",
  219. tabsNum: 5,
  220. },
  221. purchase_flow: {
  222. title: "采购",
  223. component: SendPurchase,
  224. backUrl: "/main/procureList",
  225. },
  226. pay_flow: {
  227. title: "采购付款",
  228. component: SendPurchasePayment,
  229. backUrl: "/main/purchasePayment",
  230. },
  231. contract_update_flow: {
  232. title: "销售合同变更",
  233. component: EhsdContractChange,
  234. backUrl: "/main/contract",
  235. tabsNum: 5,
  236. },
  237. });
  238. let dialogVisible = ref(false);
  239. //判断是否有下一节点处理人
  240. const handleResult = (res) => {
  241. if (res !== null && res.success) {
  242. skipPage();
  243. } else {
  244. dialogVisible.value = true;
  245. nextHandleUser.value = res.userList;
  246. }
  247. };
  248. const skipPage = () => {
  249. onClickLeft();
  250. // proxy.$router({
  251. // path:
  252. // route.query.processType === 10
  253. // ? '/main/processApproval'
  254. // : componentObj.value[route.query.flowKey].backUrl,
  255. // })
  256. };
  257. const handleSelectUser = () => {
  258. if (!flowForm.handleUserId) {
  259. return ElMessage({
  260. message: "请选择下一节点处理人!",
  261. type: "info",
  262. });
  263. }
  264. handleSubmit();
  265. };
  266. const handleSubmit = async (_type) => {
  267. const childrenData = await makeDom.value.handleSubmit();
  268. if (childrenData) {
  269. if (route.query.processType == 10 || route.query.processType == 30) {
  270. proxy
  271. .post("/flowProcess/jump", {
  272. ...flowForm,
  273. data: childrenData,
  274. handleType: _type,
  275. version: route.query.version,
  276. flowId: route.query.id,
  277. })
  278. .then((res) => {
  279. // handleResult(res.data)
  280. proxy.$router.go(-1);
  281. });
  282. if (_type && _type == 1) {
  283. proxy
  284. .post("/flowExample/setStartData", {
  285. exampleId: route.query.id,
  286. startData: childrenData,
  287. })
  288. .then();
  289. }
  290. return;
  291. } else {
  292. proxy
  293. .post("/flowProcess/initiate", {
  294. ...flowForm,
  295. data: childrenData,
  296. })
  297. .then((res) => {
  298. // handleResult(res.data)
  299. proxy.$router.go(-1);
  300. });
  301. }
  302. proxy.$router.go(-1);
  303. }
  304. };
  305. const nextFn = () => {
  306. makeDom.value.tabsChange();
  307. };
  308. const getRecords = (_id) => {
  309. if (_id) {
  310. proxy
  311. .post("/flowExample/getApprovalRecord", {
  312. id: _id,
  313. })
  314. .then((res) => {
  315. for (let i = 0; i < res.data.recordList.length; i++) {
  316. const element = res.data.recordList[i];
  317. if (element.status === 2) {
  318. stepsNum.value = i;
  319. break;
  320. }
  321. }
  322. recordList.value = res.data.recordList;
  323. queryData.data.recordList = res.data.recordList;
  324. approvalRecordData.value = res.data;
  325. //删除type为1的按钮
  326. approvalRecordData.value.buttonInfoList =
  327. approvalRecordData.value.buttonInfoList.filter(
  328. (item) => item.type != 1
  329. );
  330. });
  331. } else {
  332. proxy
  333. .post("/flowExample/getFlowNode", {
  334. flowKey: flowForm.flowKey,
  335. })
  336. .then((res) => {
  337. recordList.value = res.data;
  338. stepsNum.value = 0;
  339. });
  340. }
  341. };
  342. onMounted(async () => {
  343. //processType 10 为审批 20为查看 30回退发起 无为发起
  344. if (!componentObj.value[route.query.flowKey]) {
  345. showSuccessToast("代码未配置此流程!");
  346. return;
  347. }
  348. if (
  349. route.query.processType == 10 ||
  350. route.query.processType == 20 ||
  351. route.query.processType == 30
  352. ) {
  353. await proxy
  354. .post("/flowProcess/getStartData", { flowId: route.query.id })
  355. .then((res) => {
  356. queryData.data = { ...res.data };
  357. });
  358. } else {
  359. queryData.data = { ...route.query };
  360. }
  361. flowForm.flowKey = route.query.flowKey;
  362. getRecords(route.query.id);
  363. });
  364. </script>
  365. <style>
  366. .van-step--vertical .van-step__circle-container {
  367. top: 25px;
  368. }
  369. .van-step--vertical .van-step__line {
  370. top: 23px;
  371. }
  372. </style>
  373. <style lang="scss">
  374. .process {
  375. .more-modal {
  376. .van-field {
  377. border: none;
  378. background: #f1f1f1;
  379. border-radius: 5px;
  380. padding: 5px 10px;
  381. }
  382. }
  383. .for-btn-more {
  384. height: 50px;
  385. line-height: 50px;
  386. text-align: center;
  387. display: flex;
  388. width: 100vw;
  389. font-size: 16px;
  390. padding: 0 12px;
  391. font-size: 12px;
  392. }
  393. .load-btn-box {
  394. height: 50px;
  395. text-align: center;
  396. padding: 9px;
  397. box-sizing: border-box;
  398. margin-bottom: 50px;
  399. }
  400. .foot-btn-warp {
  401. height: 50px;
  402. line-height: 50px;
  403. text-align: center;
  404. display: flex;
  405. width: 100vw;
  406. font-size: 16px;
  407. .for-btn {
  408. flex: 1;
  409. background: #fff;
  410. color: #999999;
  411. font-size: 12px;
  412. text-align: center;
  413. height: 50px;
  414. line-height: 15px;
  415. padding: 10px 0;
  416. box-sizing: border-box;
  417. i {
  418. font-size: 24px;
  419. }
  420. }
  421. .agree-btn {
  422. flex: 1;
  423. background: #eaf0ff;
  424. color: #0084ff;
  425. }
  426. .next-btn {
  427. flex: 1;
  428. background: #0084ff;
  429. color: #fff;
  430. }
  431. }
  432. .btn-warp {
  433. position: fixed;
  434. bottom: 0;
  435. left: 0;
  436. right: 0;
  437. margin: 0;
  438. z-index: 10002;
  439. button {
  440. width: 48%;
  441. }
  442. .content {
  443. height: 0;
  444. overflow: hidden;
  445. transition: all 0.3s ease;
  446. background: #fff;
  447. padding: 0 12px;
  448. }
  449. .more-btn {
  450. width: 100%;
  451. background: #fff;
  452. color: #999999;
  453. font-size: 14px;
  454. text-align: center;
  455. height: 50px;
  456. line-height: 50px;
  457. }
  458. }
  459. .open-more {
  460. .content {
  461. height: 170px;
  462. }
  463. }
  464. padding-bottom: 60px;
  465. .card {
  466. background: #fff;
  467. padding: 0 12px;
  468. margin-top: 10px;
  469. }
  470. .textarea {
  471. .van-field {
  472. border: none;
  473. background: #f1f1f1;
  474. border-radius: 5px;
  475. padding: 5px 10px;
  476. }
  477. }
  478. .more-btn {
  479. height: 60px;
  480. line-height: 60px;
  481. font-size: 14px;
  482. color: #0084ff;
  483. text-align: center;
  484. }
  485. }
  486. </style>