processDtl.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div class="process">
  3. <van-nav-bar title="流程审批" left-text="" left-arrow @click-left="onClickLeft">
  4. </van-nav-bar>
  5. <div>
  6. <component ref="makeDom" :queryData="queryData.data" :is="
  7. componentObj[route.query.flowKey]
  8. ? componentObj[route.query.flowKey].component
  9. : SendSubscribe
  10. "></component>
  11. </div>
  12. <!-- <div class="card">
  13. <div class="common-title border-btm">申购信息</div>
  14. <div class="common-form-text">
  15. <div class="common-form-text-item">
  16. <div class="common-form-text-item-label">申购单号</div>
  17. <div class="common-form-text-item-value">
  18. PR-221101-170404-296
  19. </div>
  20. </div>
  21. <div class="common-form-text-item">
  22. <div class="common-form-text-item-label">申购时间</div>
  23. <div class="common-form-text-item-value">
  24. 2022-11-01 17:04:04
  25. </div>
  26. </div>
  27. <div class="common-form-text-item">
  28. <div class="common-form-text-item-label">申购部门</div>
  29. <div class="common-form-text-item-value">仓库</div>
  30. </div>
  31. <div class="common-form-text-item">
  32. <div class="common-form-text-item-label">申购人</div>
  33. <div class="common-form-text-item-value">阮平芳</div>
  34. </div>
  35. <div class="common-form-text-item">
  36. <div class="common-form-text-item-label">申购类型</div>
  37. <div class="common-form-text-item-value">物料</div>
  38. </div>
  39. </div>
  40. </div> -->
  41. <div class="btn-warp" :class="footerMoreType ? 'open-more' : ''">
  42. <div class="more-btn" @click="footerMoreType = true">
  43. 更多 <van-icon name="arrow-up" />
  44. </div>
  45. <div class="foot-btn-warp">
  46. <div class="agree-btn" @click="handleSubmit(1)">同意</div>
  47. <div class="next-btn" @click="nextFn">下一步</div>
  48. </div>
  49. </div>
  50. <van-action-sheet v-model:show="footerMoreType" title="审批记录" class="more-modal">
  51. <div class="card">
  52. <van-steps direction="vertical" :active="stepsNum" class="common-steps">
  53. <van-step v-for="(i, index) in recordList" :key="i.nodeId">
  54. <div class="label">
  55. <span class="name">{{ i.processedUser }}</span>
  56. <span class="tip">{{ i.nodeName }}</span>
  57. <span class="state" :class="index == stepsNum
  58. ? 'cl-yl'
  59. : index < stepsNum
  60. ? 'cl-blue'
  61. : ''
  62. ">
  63. {{ i.nodeName }}
  64. </span>
  65. </div>
  66. <div class="content">审批意见:{{ i.remark }}</div>
  67. <p>{{ i.processedDate }}</p>
  68. </van-step>
  69. </van-steps>
  70. </div>
  71. <div style="padding: 0 12px">
  72. <van-field v-model="flowForm.remark" rows="3" autosize type="textarea" maxlength="400" placeholder="请输入审批意见"
  73. show-word-limit style="backround: #f1f1f1" />
  74. </div>
  75. <div class="load-btn-box">
  76. <van-button size="small" type="primary" plain round v-for="i in approvalRecordData.buttonInfoList"
  77. :key="i.type" v-show="i.type != 1" @click="handleSubmit(i.type)">{{ i.name }}
  78. </van-button>
  79. </div>
  80. <div class="content">
  81. <div class="foot-btn-warp">
  82. <div class="agree-btn" @click="handleSubmit(1)">同意</div>
  83. <div class="next-btn" @click="nextFn">下一步</div>
  84. </div>
  85. </div>
  86. </van-action-sheet>
  87. </div>
  88. </template>
  89. <script setup>
  90. import { ref, getCurrentInstance, onMounted, reactive } from 'vue'
  91. import { useRoute } from 'vue-router'
  92. import SendSubscribe from './components/SendSubscribe'
  93. import SendFunds from './components/SendFunds'
  94. import Contract from './components/Contract'
  95. import SendPurchasePayment from './components/SendPurchasePayment'
  96. import { showSuccessToast, showFailToast } from 'vant'
  97. const route = useRoute()
  98. const proxy = getCurrentInstance().proxy
  99. const onClickLeft = () => proxy.$router.push(componentObj.value[route.query.flowKey].backUrl)
  100. const message = ref('')
  101. const onClickRight = () => {
  102. proxy.$router.push('/main/working')
  103. }
  104. const makeDom = ref(null)
  105. let stepsNum = ref(0)
  106. let queryData = reactive({
  107. data: {},
  108. })
  109. let footerMoreType = ref(false)
  110. const flowForm = reactive({
  111. flowKey: '',
  112. tenantType: '',
  113. handleUserId: '',
  114. remark: '',
  115. data: {},
  116. })
  117. let recordList = ref([])
  118. const approvalRecordData = ref({
  119. buttonInfoList: [],
  120. })
  121. const getAuxiliaryData = (data) => {
  122. auxiliaryData.value = data
  123. }
  124. let componentObj = ref({
  125. subscribe_flow: {
  126. title: '申购',
  127. component: SendSubscribe,
  128. backUrl: '/main/subscribe',
  129. },
  130. account_request_funds_flow: {
  131. title: '请款',
  132. component: SendFunds,
  133. backUrl: '/main/funds',
  134. },
  135. contract_flow: {
  136. title: '销售合同',
  137. component: Contract,
  138. backUrl: '/main/contract',
  139. },
  140. pay_flow: {
  141. title: '采购付款',
  142. component: SendPurchasePayment,
  143. backUrl: '/main/purchasePayment',
  144. },
  145. })
  146. let dialogVisible = ref(false)
  147. //判断是否有下一节点处理人
  148. const handleResult = (res) => {
  149. if (res !== null && res.success) {
  150. skipPage()
  151. } else {
  152. dialogVisible.value = true
  153. nextHandleUser.value = res.userList
  154. }
  155. }
  156. const skipPage = () => {
  157. onClickLeft()
  158. // proxy.$router({
  159. // path:
  160. // route.query.processType === 10
  161. // ? '/main/processApproval'
  162. // : componentObj.value[route.query.flowKey].backUrl,
  163. // })
  164. }
  165. const handleSelectUser = () => {
  166. if (!flowForm.handleUserId) {
  167. return ElMessage({
  168. message: '请选择下一节点处理人!',
  169. type: 'info',
  170. })
  171. }
  172. handleSubmit()
  173. }
  174. const handleSubmit = async (_type) => {
  175. const childrenData = await makeDom.value.handleSubmit()
  176. if (childrenData) {
  177. if (route.query.processType == 10 || route.query.processType == 30) {
  178. proxy
  179. .post('/flowProcess/jump', {
  180. ...flowForm,
  181. data: childrenData,
  182. handleType: _type,
  183. version: route.query.version,
  184. flowId: route.query.id,
  185. })
  186. .then((res) => {
  187. handleResult(res.data)
  188. })
  189. if (_type && _type == 1) {
  190. proxy
  191. .post('/flowExample/setStartData', {
  192. exampleId: route.query.id,
  193. startDate: childrenData,
  194. })
  195. .then()
  196. }
  197. return
  198. } else {
  199. proxy
  200. .post('/flowProcess/initiate', {
  201. ...flowForm,
  202. data: childrenData,
  203. })
  204. .then((res) => {
  205. handleResult(res.data)
  206. })
  207. }
  208. }
  209. }
  210. const getRecords = (_id) => {
  211. if (_id) {
  212. proxy
  213. .post('/flowExample/getApprovalRecord', {
  214. id: _id,
  215. })
  216. .then((res) => {
  217. for (let i = 0; i < res.data.recordList.length; i++) {
  218. const element = res.data.recordList[i]
  219. if (element.status === 2) {
  220. stepsNum.value = i
  221. break
  222. }
  223. }
  224. recordList.value = res.data.recordList
  225. queryData.data.recordList = res.data.recordList
  226. approvalRecordData.value = res.data
  227. })
  228. } else {
  229. proxy
  230. .post('/flowExample/getFlowNode', {
  231. flowKey: flowForm.flowKey,
  232. })
  233. .then((res) => {
  234. recordList.value = res.data
  235. stepsNum.value = 0
  236. })
  237. }
  238. }
  239. onMounted(async () => {
  240. //processType 10 为审批 20为查看 30回退发起 无为发起
  241. if (!componentObj.value[route.query.flowKey]) {
  242. showSuccessToast('代码未配置此流程!')
  243. return
  244. }
  245. if (
  246. route.query.processType == 10 ||
  247. route.query.processType == 20 ||
  248. route.query.processType == 30
  249. ) {
  250. await proxy
  251. .post('/flowProcess/getStartData', { flowId: route.query.id })
  252. .then((res) => {
  253. queryData.data = { ...res.data }
  254. })
  255. } else {
  256. queryData.data = { ...route.query }
  257. }
  258. flowForm.flowKey = route.query.flowKey
  259. getRecords(route.query.id)
  260. })
  261. </script>
  262. <style>
  263. .van-step--vertical .van-step__circle-container {
  264. top: 25px;
  265. }
  266. .van-step--vertical .van-step__line {
  267. top: 23px;
  268. }
  269. </style>
  270. <style lang="scss">
  271. .process {
  272. .more-modal {
  273. .van-field {
  274. border: none;
  275. background: #f1f1f1;
  276. border-radius: 5px;
  277. padding: 5px 10px;
  278. }
  279. }
  280. .load-btn-box {
  281. height: 50px;
  282. text-align: center;
  283. padding: 9px;
  284. box-sizing: border-box;
  285. }
  286. .foot-btn-warp {
  287. height: 50px;
  288. line-height: 50px;
  289. text-align: center;
  290. display: flex;
  291. width: 100vw;
  292. font-size: 16px;
  293. .agree-btn {
  294. flex: 1;
  295. background: #eaf0ff;
  296. color: #0084ff;
  297. }
  298. .next-btn {
  299. flex: 1;
  300. background: #0084ff;
  301. color: #fff;
  302. }
  303. }
  304. .btn-warp {
  305. position: fixed;
  306. bottom: 0;
  307. left: 0;
  308. right: 0;
  309. margin: 0;
  310. z-index: 2;
  311. button {
  312. width: 48%;
  313. }
  314. .content {
  315. height: 0;
  316. overflow: hidden;
  317. transition: all 0.3s ease;
  318. background: #fff;
  319. padding: 0 12px;
  320. }
  321. .more-btn {
  322. width: 100%;
  323. background: #fff;
  324. color: #999999;
  325. font-size: 14px;
  326. text-align: center;
  327. height: 50px;
  328. line-height: 50px;
  329. }
  330. }
  331. .open-more {
  332. .content {
  333. height: 170px;
  334. }
  335. }
  336. padding-bottom: 60px;
  337. .card {
  338. background: #fff;
  339. padding: 0 12px;
  340. margin-top: 10px;
  341. }
  342. .textarea {
  343. .van-field {
  344. border: none;
  345. background: #f1f1f1;
  346. border-radius: 5px;
  347. padding: 5px 10px;
  348. }
  349. }
  350. .more-btn {
  351. height: 60px;
  352. line-height: 60px;
  353. font-size: 14px;
  354. color: #0084ff;
  355. text-align: center;
  356. }
  357. }
  358. </style>