processDtl.vue 10 KB

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