index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <div class="processApproval">
  3. <div class="left-card">
  4. <div class="top">
  5. <div class="commons-title title">
  6. {{ route.query.flowName || "流程标题(发起)" }}
  7. </div>
  8. <SendSubscribe
  9. ref="makeDom"
  10. v-if="flowForm.flowKey == 'subscribe_flow'"
  11. ></SendSubscribe>
  12. <SendPurchase
  13. ref="makeDom"
  14. v-else-if="flowForm.flowKey == 'purchase_flow'"
  15. :queryData="queryData.data"
  16. ></SendPurchase>
  17. <SendFunds
  18. ref="makeDom"
  19. v-else-if="flowForm.flowKey == 'account_request_funds_flow'"
  20. :queryData="queryData.data"
  21. ></SendFunds>
  22. <ReturnGood
  23. ref="makeDom"
  24. v-else-if="flowForm.flowKey == 'sales_return_flow'"
  25. :queryData="queryData.data"
  26. ></ReturnGood>
  27. <PurchaseRefund
  28. ref="makeDom"
  29. v-else-if="flowForm.flowKey == 'refund_flow'"
  30. :queryData="queryData.data"
  31. ></PurchaseRefund>
  32. <PurchasePayment
  33. ref="makeDom"
  34. v-else-if="flowForm.flowKey == 'pay_flow'"
  35. :queryData="queryData.data"
  36. ></PurchasePayment>
  37. <PriceSheet
  38. ref="makeDom"
  39. v-else-if="flowForm.flowKey == 'sale_quotation_flow'"
  40. :queryData="queryData.data"
  41. ></PriceSheet>
  42. <Contract
  43. ref="makeDom"
  44. v-else-if="flowForm.flowKey == 'contract_flow'"
  45. :queryData="queryData.data"
  46. ></Contract>
  47. <ServiceContract
  48. ref="makeDom"
  49. v-else-if="flowForm.flowKey == 'service_contract_flow'"
  50. :queryData="queryData.data"
  51. ></ServiceContract>
  52. <!-- 维多利亚 -->
  53. <SendSubscribeWDLY
  54. ref="makeDom"
  55. v-else-if="flowForm.flowKey == 'wdly_apply_purchase'"
  56. ></SendSubscribeWDLY>
  57. <SendPurchaseWDLY
  58. ref="makeDom"
  59. v-else-if="flowForm.flowKey == 'wdly_purchase'"
  60. :queryData="queryData.data"
  61. ></SendPurchaseWDLY>
  62. </div>
  63. <div class="bottom">
  64. <div class="commons-title title">处理意见</div>
  65. <el-form :model="flowForm" :rules="flowRules" ref="flowFormDom">
  66. <el-form-item prop="remark" label-width="0px" label="">
  67. <el-input
  68. type="textarea"
  69. placeholder="请输入"
  70. v-model="flowForm.remark"
  71. >
  72. </el-input>
  73. </el-form-item>
  74. <el-form-item>
  75. <el-button type="primary" @click="handleSubmit">提交</el-button>
  76. </el-form-item>
  77. </el-form>
  78. </div>
  79. </div>
  80. <div class="right-card">
  81. <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
  82. <el-tab-pane label="审批记录" name="first">
  83. <ul class="flow-chart">
  84. <li v-for="item in recordList" :key="item.id">
  85. <div class="left-icon">
  86. <i class="iconfont icon-iconm_daick"></i>
  87. <i class="iconfont icon-icomx_quertj1 right-btm-status"></i>
  88. </div>
  89. <div class="right-conetnt">
  90. <div class="name">发起人:{{ item.processedUser }}</div>
  91. <div class="remark">
  92. <div class="label">{{ item.nodeName }}</div>
  93. {{ item.remark }}
  94. </div>
  95. </div>
  96. <div class="line"></div>
  97. </li>
  98. </ul>
  99. </el-tab-pane>
  100. <!-- <el-tab-pane label="决策辅助" name="second">
  101. <auxiliary></auxiliary>
  102. </el-tab-pane> -->
  103. </el-tabs>
  104. </div>
  105. <el-dialog title="下一处理人" width="400" v-model="dialogVisible">
  106. <el-form :model="flowForm">
  107. <el-form-item prop="remark" label="处理人">
  108. <el-select
  109. v-model="flowForm.handleUserId"
  110. placeholder="请选择"
  111. filterable
  112. style="width: 100%"
  113. >
  114. <el-option
  115. v-for="item in nextHandleUser"
  116. :label="item.name"
  117. :value="item.id"
  118. >
  119. </el-option>
  120. </el-select>
  121. </el-form-item>
  122. <el-form-item>
  123. <div style="width: 100%; text-align: center">
  124. <el-button type="primary" @click="handleSelectUser">提交</el-button>
  125. </div>
  126. </el-form-item>
  127. </el-form>
  128. </el-dialog>
  129. </div>
  130. </template>
  131. <script setup name='ProcessApproval'>
  132. import useTagsViewStore from "@/store/modules/tagsView.js";
  133. import { useRouter, useRoute } from "vue-router";
  134. //决策辅助
  135. import auxiliary from "./auxiliary";
  136. //申购发起
  137. import SendSubscribe from "@/components/process/SendSubscribe";
  138. //采购发起
  139. import SendPurchase from "@/components/process/SendPurchase";
  140. //请款发起
  141. import SendFunds from "@/components/process/SendFunds";
  142. //退货
  143. import ReturnGood from "@/components/process/ReturnGood";
  144. // 消息提示
  145. import { ElMessage, ElMessageBox } from "element-plus";
  146. //退款
  147. import PurchaseRefund from "@/components/process/PurchaseRefund";
  148. // 付款
  149. import PurchasePayment from "@/components/process/PurchasePayment";
  150. // 报价单
  151. import PriceSheet from "@/components/process/PriceSheet";
  152. // 销售合同
  153. import Contract from "@/components/process/Contract";
  154. // 服务合同
  155. import ServiceContract from "@/components/process/ServiceContract";
  156. // /``````````````````````````````维多利亚专属 /
  157. //申购发起
  158. import SendSubscribeWDLY from "@/components/WDLY/process/SendSubscribeWDLY";
  159. //采购发起
  160. import SendPurchaseWDLY from "@/components/WDLY/process/SendPurchaseWDLY";
  161. const router = useRouter();
  162. const route = useRoute();
  163. // tab切换逻辑
  164. const activeName = ref("first");
  165. const handleClick = (tab, event) => {
  166. // console.log(tab, event);
  167. };
  168. // 意见表单
  169. const flowForm = reactive({
  170. flowKey: "",
  171. handleUserId: "",
  172. remark: "",
  173. data: {},
  174. });
  175. const flowRules = reactive({
  176. // remark: [{ required: true, message: "请输入处理意见", trigger: "blur" }],
  177. });
  178. //组件实例
  179. const { proxy } = getCurrentInstance();
  180. const makeDom = ref(null);
  181. const flowFormDom = ref(null);
  182. let dialogVisible = ref(false);
  183. const nextHandleUser = ref([]);
  184. const handleSelectUser = () => {
  185. if (!flowForm.handleUserId) {
  186. return ElMessage({
  187. message: "请选择下一节点处理人!",
  188. type: "info",
  189. });
  190. }
  191. handleSubmit();
  192. };
  193. const handleResult = (res) => {
  194. if (res !== null && res.success) {
  195. skipPage();
  196. } else {
  197. dialogVisible.value = true;
  198. nextHandleUser.value = res.userList;
  199. }
  200. };
  201. // 提交逻辑
  202. const handleSubmit = async () => {
  203. try {
  204. // 调用发起组件的提交事件
  205. const flag = await makeDom.value.handleSubmit();
  206. if (flag) {
  207. flowFormDom.value.validate((valid) => {
  208. if (valid) {
  209. const data = { ...makeDom.value.submitData };
  210. if (flowForm.flowKey == "subscribe_flow") {
  211. data.subscribeDetailList = data.subscribeDetailList.map((x) => ({
  212. bussinessId: x.bussinessId,
  213. count: x.count,
  214. remark: x.remark,
  215. }));
  216. } else if (flowForm.flowKey == "purchase_flow") {
  217. data.purchaseDetailList = data.purchaseDetailList.map((x) => ({
  218. bussinessId: x.bussinessId,
  219. subscribeDetailId: x.id,
  220. count: x.count,
  221. price: x.price,
  222. amount: x.amount,
  223. }));
  224. } else if (flowForm.flowKey == "account_request_funds_flow") {
  225. } else if (flowForm.flowKey == "sales_return_flow") {
  226. } else if (flowForm.flowKey == "refund_flow") {
  227. } else if (flowForm.flowKey == "wdly_apply_purchase") {
  228. data.subscribeDetailList = data.subscribeDetailList.map((x) => ({
  229. bussinessId: x.bussinessId,
  230. count: x.count,
  231. remark: x.remark,
  232. }));
  233. const victoriatouristJson = {
  234. planArrivalTime: data.planArrivalTime,
  235. receiptWarehouseId: data.receiptWarehouseId,
  236. };
  237. data.victoriatouristJson = JSON.stringify(victoriatouristJson);
  238. } else if (flowForm.flowKey == "wdly_purchase") {
  239. data.purchaseDetailList = data.purchaseDetailList.map((x) => ({
  240. bussinessId: x.bussinessId,
  241. subscribeDetailId: x.id,
  242. count: x.count,
  243. price: x.price,
  244. amount: x.amount,
  245. }));
  246. const victoriatouristJson = {
  247. isAgreement: data.isAgreement,
  248. paymentMethod: data.paymentMethod,
  249. otherFeeList: data.otherFeeList,
  250. contractCode: data.contractCode,
  251. };
  252. data.victoriatouristJson = JSON.stringify(victoriatouristJson);
  253. }
  254. proxy
  255. .post("/flowProcess/initiate", {
  256. ...flowForm,
  257. data,
  258. })
  259. .then((res) => {
  260. handleResult(res);
  261. });
  262. }
  263. });
  264. }
  265. } catch (err) {
  266. console.log("数据未填完整!", err);
  267. }
  268. };
  269. // 页面跳转
  270. const skipPage = () => {
  271. const useTagsStore = useTagsViewStore();
  272. useTagsStore.delVisitedView(router.currentRoute.value);
  273. ElMessage({
  274. message: "操作成功!",
  275. type: "success",
  276. });
  277. if (flowForm.flowKey == "subscribe_flow") {
  278. router.replace({
  279. path: "/purchaseManage/purchaseManage/subscribe",
  280. });
  281. } else if (flowForm.flowKey == "purchase_flow") {
  282. router.replace({
  283. path: "/purchaseManage/purchaseManage/purchase",
  284. });
  285. } else if (flowForm.flowKey == "sales_return_flow") {
  286. router.replace({
  287. path: "/purchaseManage/purchaseManage/returnGoods",
  288. });
  289. } else if (flowForm.flowKey == "account_request_funds_flow") {
  290. router.replace({
  291. path: "/finance/fundManage/funds",
  292. });
  293. } else if (flowForm.flowKey == "refund_flow") {
  294. router.replace({
  295. path: "/purchaseManage/purchasePayment/invoice",
  296. });
  297. } else if (flowForm.flowKey == "pay_flow") {
  298. router.replace({
  299. path: "/purchaseManage/purchasePayment/payment",
  300. });
  301. } else if (flowForm.flowKey == "sale_quotation_flow") {
  302. router.replace({
  303. path: "/salesMange/saleContract/priceSheet",
  304. });
  305. } else if (flowForm.flowKey == "contract_flow") {
  306. router.replace({
  307. path: "/salesMange/saleContract/contract",
  308. });
  309. } else if (flowForm.flowKey == "service_contract_flow") {
  310. router.replace({
  311. path: "/salesMange/saleContract/serviceContract",
  312. });
  313. } else if (flowForm.flowKey == "wdly_purchase") {
  314. router.replace({
  315. path: "/WDLY/purchaseManage/alreadyPurchase_wdly",
  316. });
  317. } else if (flowForm.flowKey == "wdly_apply_purchase") {
  318. router.replace({
  319. path: "/WDLY/purchaseManage/subscribe_wdly",
  320. });
  321. }
  322. };
  323. let queryData = reactive({
  324. data: {},
  325. });
  326. // 记录
  327. const recordList = ref([]);
  328. const getRecords = () => {
  329. proxy
  330. .post("/flowExample/getFlowNode", {
  331. flowKey: flowForm.flowKey,
  332. })
  333. .then((res) => {
  334. console.log(res, "ass");
  335. recordList.value = res;
  336. });
  337. };
  338. onMounted(() => {
  339. queryData.data = { ...route.query };
  340. flowForm.flowKey = route.query.flowKey;
  341. getRecords();
  342. });
  343. </script>
  344. <style lang="scss" scoped>
  345. .processApproval {
  346. display: flex;
  347. justify-content: space-between;
  348. margin-top: 20px;
  349. padding: 0 20px;
  350. height: calc(100vh - 130px);
  351. .left-card {
  352. // background: #fff;
  353. border-radius: 4px;
  354. // padding: 20px;
  355. flex: 1;
  356. margin-right: 20px;
  357. display: flex;
  358. flex-direction: column;
  359. .top {
  360. flex: 1;
  361. overflow-y: auto;
  362. background: #fff;
  363. padding: 20px 20px 0px 20px;
  364. }
  365. .bottom {
  366. margin-top: 10px;
  367. height: 170px;
  368. background: #fff;
  369. padding: 20px 20px 0px 20px;
  370. }
  371. }
  372. .right-card {
  373. background: #fff;
  374. border-radius: 4px;
  375. padding: 0 20px 20px;
  376. width: 600px;
  377. box-sizing: border-box;
  378. .flow-chart {
  379. overflow: auto;
  380. padding: 0;
  381. margin: 0;
  382. li {
  383. margin: 0;
  384. padding: 0 0 20px;
  385. list-style: none;
  386. display: flex;
  387. justify-content: space-between;
  388. position: relative;
  389. .right-conetnt {
  390. flex: 1;
  391. .name {
  392. font-size: 12px;
  393. color: #333;
  394. margin-bottom: 10px;
  395. span {
  396. color: #999;
  397. float: right;
  398. }
  399. }
  400. .remark {
  401. padding: 10px;
  402. color: #666666;
  403. font-size: 12px;
  404. background: #f1f1f1;
  405. border-radius: 2px;
  406. .label {
  407. color: #39c55a;
  408. margin-bottom: 10px;
  409. }
  410. }
  411. }
  412. .left-icon {
  413. width: 40px;
  414. height: 40px;
  415. text-align: center;
  416. line-height: 40px;
  417. background: #0084ff;
  418. border-radius: 10px;
  419. color: #fff;
  420. font-size: 20px;
  421. position: relative;
  422. margin-right: 27px;
  423. z-index: 2;
  424. .right-btm-status {
  425. position: absolute;
  426. bottom: 0px;
  427. right: -10px;
  428. height: 20px;
  429. width: 20px;
  430. line-height: 16px;
  431. border-radius: 10px;
  432. background: #39c55a;
  433. border: 2px solid #fff;
  434. font-size: 12px;
  435. box-sizing: border-box;
  436. }
  437. }
  438. }
  439. li::before {
  440. content: "";
  441. position: absolute;
  442. top: 0;
  443. left: 20px;
  444. width: 2px;
  445. height: 100%;
  446. background: #ddd;
  447. z-index: 1;
  448. }
  449. li:last-child::before {
  450. display: none;
  451. }
  452. }
  453. }
  454. }
  455. </style>