processDtl.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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 PriceSheet from './components/PriceSheet'
  95. import Contract from './components/Contract'
  96. import SendPurchase from './components/SendPurchase'
  97. import SendPurchasePayment from './components/SendPurchasePayment'
  98. import { showSuccessToast, showFailToast } from 'vant'
  99. const route = useRoute()
  100. const proxy = getCurrentInstance().proxy
  101. const onClickLeft = () => proxy.$router.push(componentObj.value[route.query.flowKey].backUrl)
  102. const message = ref('')
  103. const onClickRight = () => {
  104. proxy.$router.push('/main/working')
  105. }
  106. const makeDom = ref(null)
  107. let stepsNum = ref(0)
  108. let queryData = reactive({
  109. data: {},
  110. })
  111. let footerMoreType = ref(false)
  112. const flowForm = reactive({
  113. flowKey: '',
  114. tenantType: '',
  115. handleUserId: '',
  116. remark: '',
  117. data: {},
  118. })
  119. let recordList = ref([])
  120. const approvalRecordData = ref({
  121. buttonInfoList: [],
  122. })
  123. const getAuxiliaryData = (data) => {
  124. auxiliaryData.value = data
  125. }
  126. let componentObj = ref({
  127. subscribe_flow: {
  128. title: '申购',
  129. component: SendSubscribe,
  130. backUrl: '/main/subscribe',
  131. },
  132. account_request_funds_flow: {
  133. title: '请款',
  134. component: SendFunds,
  135. backUrl: '/main/funds',
  136. },
  137. sale_quotation_flow: {
  138. title: '报价单',
  139. component: PriceSheet,
  140. backUrl: '/main/priceSheet',
  141. },
  142. contract_flow: {
  143. title: '销售合同',
  144. component: Contract,
  145. backUrl: '/main/contract',
  146. },
  147. purchase_flow: {
  148. title: '采购',
  149. component: SendPurchase,
  150. backUrl: '/main/procureList',
  151. },
  152. pay_flow: {
  153. title: '采购付款',
  154. component: SendPurchasePayment,
  155. backUrl: '/main/purchasePayment',
  156. },
  157. })
  158. let dialogVisible = ref(false)
  159. //判断是否有下一节点处理人
  160. const handleResult = (res) => {
  161. if (res !== null && res.success) {
  162. skipPage()
  163. } else {
  164. dialogVisible.value = true
  165. nextHandleUser.value = res.userList
  166. }
  167. }
  168. const skipPage = () => {
  169. onClickLeft()
  170. // proxy.$router({
  171. // path:
  172. // route.query.processType === 10
  173. // ? '/main/processApproval'
  174. // : componentObj.value[route.query.flowKey].backUrl,
  175. // })
  176. }
  177. const handleSelectUser = () => {
  178. if (!flowForm.handleUserId) {
  179. return ElMessage({
  180. message: '请选择下一节点处理人!',
  181. type: 'info',
  182. })
  183. }
  184. handleSubmit()
  185. }
  186. const handleSubmit = async (_type) => {
  187. const childrenData = await makeDom.value.handleSubmit()
  188. console.log(childrenData,'www');
  189. if (childrenData) {
  190. if (route.query.processType == 10 || route.query.processType == 30) {
  191. proxy
  192. .post('/flowProcess/jump', {
  193. ...flowForm,
  194. data: childrenData,
  195. handleType: _type,
  196. version: route.query.version,
  197. flowId: route.query.id,
  198. })
  199. .then((res) => {
  200. handleResult(res.data)
  201. })
  202. if (_type && _type == 1) {
  203. proxy
  204. .post('/flowExample/setStartData', {
  205. exampleId: route.query.id,
  206. startDate: childrenData,
  207. })
  208. .then()
  209. }
  210. return
  211. } else {
  212. proxy
  213. .post('/flowProcess/initiate', {
  214. ...flowForm,
  215. data: childrenData,
  216. })
  217. .then((res) => {
  218. handleResult(res.data)
  219. })
  220. }
  221. }
  222. }
  223. const getRecords = (_id) => {
  224. if (_id) {
  225. proxy
  226. .post('/flowExample/getApprovalRecord', {
  227. id: _id,
  228. })
  229. .then((res) => {
  230. for (let i = 0; i < res.data.recordList.length; i++) {
  231. const element = res.data.recordList[i]
  232. if (element.status === 2) {
  233. stepsNum.value = i
  234. break
  235. }
  236. }
  237. recordList.value = res.data.recordList
  238. queryData.data.recordList = res.data.recordList
  239. approvalRecordData.value = res.data
  240. })
  241. } else {
  242. proxy
  243. .post('/flowExample/getFlowNode', {
  244. flowKey: flowForm.flowKey,
  245. })
  246. .then((res) => {
  247. recordList.value = res.data
  248. stepsNum.value = 0
  249. })
  250. }
  251. }
  252. onMounted(async () => {
  253. //processType 10 为审批 20为查看 30回退发起 无为发起
  254. if (!componentObj.value[route.query.flowKey]) {
  255. showSuccessToast('代码未配置此流程!')
  256. return
  257. }
  258. if (
  259. route.query.processType == 10 ||
  260. route.query.processType == 20 ||
  261. route.query.processType == 30
  262. ) {
  263. await proxy
  264. .post('/flowProcess/getStartData', { flowId: route.query.id })
  265. .then((res) => {
  266. queryData.data = { ...res.data }
  267. })
  268. } else {
  269. queryData.data = { ...route.query }
  270. }
  271. flowForm.flowKey = route.query.flowKey
  272. getRecords(route.query.id)
  273. })
  274. </script>
  275. <style>
  276. .van-step--vertical .van-step__circle-container {
  277. top: 25px;
  278. }
  279. .van-step--vertical .van-step__line {
  280. top: 23px;
  281. }
  282. </style>
  283. <style lang="scss">
  284. .process {
  285. .more-modal {
  286. .van-field {
  287. border: none;
  288. background: #f1f1f1;
  289. border-radius: 5px;
  290. padding: 5px 10px;
  291. }
  292. }
  293. .load-btn-box {
  294. height: 50px;
  295. text-align: center;
  296. padding: 9px;
  297. box-sizing: border-box;
  298. }
  299. .foot-btn-warp {
  300. height: 50px;
  301. line-height: 50px;
  302. text-align: center;
  303. display: flex;
  304. width: 100vw;
  305. font-size: 16px;
  306. .agree-btn {
  307. flex: 1;
  308. background: #eaf0ff;
  309. color: #0084ff;
  310. }
  311. .next-btn {
  312. flex: 1;
  313. background: #0084ff;
  314. color: #fff;
  315. }
  316. }
  317. .btn-warp {
  318. position: fixed;
  319. bottom: 0;
  320. left: 0;
  321. right: 0;
  322. margin: 0;
  323. z-index: 2;
  324. button {
  325. width: 48%;
  326. }
  327. .content {
  328. height: 0;
  329. overflow: hidden;
  330. transition: all 0.3s ease;
  331. background: #fff;
  332. padding: 0 12px;
  333. }
  334. .more-btn {
  335. width: 100%;
  336. background: #fff;
  337. color: #999999;
  338. font-size: 14px;
  339. text-align: center;
  340. height: 50px;
  341. line-height: 50px;
  342. }
  343. }
  344. .open-more {
  345. .content {
  346. height: 170px;
  347. }
  348. }
  349. padding-bottom: 60px;
  350. .card {
  351. background: #fff;
  352. padding: 0 12px;
  353. margin-top: 10px;
  354. }
  355. .textarea {
  356. .van-field {
  357. border: none;
  358. background: #f1f1f1;
  359. border-radius: 5px;
  360. padding: 5px 10px;
  361. }
  362. }
  363. .more-btn {
  364. height: 60px;
  365. line-height: 60px;
  366. font-size: 14px;
  367. color: #0084ff;
  368. text-align: center;
  369. }
  370. }
  371. </style>