index.vue 9.2 KB

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