index.vue 11 KB

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