index.vue 8.9 KB

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