detail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <!--
  2. * @Author: wanglj wanglijie@dashoo.cn
  3. * @Date: 2025-03-11 18:02:10
  4. * @LastEditors: wanglj wanglijie@dashoo.cn
  5. * @LastEditTime: 2025-04-16 14:02:44
  6. * @FilePath: \vant-demo-master\vant\vue3-ts\src\view\login\index.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <div class="app-container">
  11. <header>
  12. <h4 class="mb10">{{ state.form.startUserName }}发起的{{ state.form.defName }}</h4>
  13. <p>{{ state.form.startUserName }}发起于{{ state.form.startTime }}</p>
  14. </header>
  15. <h4>审批信息</h4>
  16. <van-cell-group>
  17. <van-cell title="审批名称" title-class="cell-title" :value="state.form.instTitle" />
  18. <van-cell title="审批编号" title-class="cell-title" :value="state.form.instTitle" />
  19. <van-cell title="审批类型" title-class="cell-title" :value="state.form.defName" />
  20. <van-cell title="申请人" title-class="cell-title" :value="state.form.startUserName" />
  21. <van-cell title="申请时间" title-class="cell-title" :value="state.form.startTime" />
  22. </van-cell-group>
  23. <h4>单据信息</h4>
  24. <InstrumentAppointment v-if="state.form.defCode === 'instrument_appointment'" :code="state.form.businessCode" />
  25. <PlatPlatformAppoint v-if="state.form.defCode === 'plat_platform_appoint'" :code="state.form.businessCode" />
  26. <platServiceCommission v-if="state.form.defCode === 'commission_create'" :code="state.form.businessCode" />
  27. <PlatCageApplications v-if="state.form.defCode === 'plat_cage_applications'" :code="state.form.businessCode" />
  28. <PlatCageReleaseApplications v-if="state.form.defCode === 'plat_cage_release_applications'"
  29. :code="state.form.businessCode" />
  30. <PlatPlatformRenewal v-if="state.form.defCode === 'plat_platform_renewal'" :code="state.form.businessCode" />
  31. <PlatAnimalTakewayApplications v-if="state.form.defCode === 'plat_animal_takeway_applications'"
  32. :code="state.form.businessCode"></PlatAnimalTakewayApplications>
  33. <PlatPlatformOutRoomAppoint v-if="state.form.defCode === 'plat_platform_out_room_appoint'"
  34. :code="state.form.businessCode" />
  35. <PlatformAnimalAppointmentEthics v-if="state.form.defCode === 'platform_animal_appointment_ethics'"
  36. :code="state.form.businessCode" />
  37. <PlatAnimalTakewayReback v-if="state.form.defCode === 'plat_animal_takeway_reback'"
  38. :code="state.form.businessCode" />
  39. <h4>审批记录</h4>
  40. <FlowTable :id="state.form.id" :businessCode="state.form.businessCode" :defCode="state.form.defCode" />
  41. <h4 v-if="state.type === 'approval'">审批意见</h4>
  42. <van-form v-if="state.type === 'approval'" class="mb20" ref="formRef" required="auto">
  43. <van-cell-group>
  44. <van-field v-model="state.approvalForm.approveOpinion" label="审批意见" placeholder="请输入审批意见"
  45. :rules="[{ required: true, message: '请输入审批意见' }]" rows="3" type="textarea" />
  46. <van-field v-model="state.approvalForm.approveResult" label="审批结果" placeholder="请选择审批结果"
  47. :rules="[{ required: true, message: '请选择审批结果' }]">
  48. <template #input>
  49. <van-radio-group v-model="state.approvalForm.approveResult" direction="horizontal">
  50. <van-radio name="pass">通过</van-radio>
  51. <van-radio name="rejection">拒绝</van-radio>
  52. </van-radio-group>
  53. </template>
  54. </van-field>
  55. </van-cell-group>
  56. </van-form>
  57. <van-action-bar v-if="state.type === 'approval'" placeholder>
  58. <van-action-bar-icon icon="wap-home-o" text="首页" @click="onRouterPush('/home')" />
  59. <van-action-bar-icon icon="cluster-o" text="待办事项" @click="onRouterPush('/todo')" />
  60. <van-action-bar-button class="w100" type="primary" text="提交" @click="onSave" />
  61. </van-action-bar>
  62. </div>
  63. </template>
  64. <script name="home" lang="ts" setup>
  65. import to from 'await-to-js'
  66. import { formatDate } from '/@/utils/formatTime'
  67. import { defineAsyncComponent, onMounted, reactive, ref } from 'vue'
  68. import { useRouter, useRoute } from 'vue-router'
  69. import { useExecutionApi } from '/@/api/execution'
  70. import { useFlowApi } from '/@/api/execution/flow'
  71. import { showNotify } from 'vant'
  72. const FlowTable = defineAsyncComponent(() => import('/@/components/FlowTable.vue'))
  73. const InstrumentAppointment = defineAsyncComponent(() => import('/@/view/todo/component/instrument_appointment.vue'))
  74. const PlatPlatformAppoint = defineAsyncComponent(() => import('/@/view/todo/component/plat_platform_appoint.vue'))
  75. const platServiceCommission = defineAsyncComponent(() => import('/@/view/todo/component/plat_service_commission.vue'))
  76. const PlatCageApplications = defineAsyncComponent(() => import('/@/view/todo/component/plat_cage_applications.vue'))
  77. const PlatCageReleaseApplications = defineAsyncComponent(() => import('/@/view/todo/component/plat_cage_release_applications.vue'))
  78. const PlatPlatformRenewal = defineAsyncComponent(() => import('/@/view/todo/component/plat_platform_renewal.vue'))
  79. const PlatAnimalTakewayApplications = defineAsyncComponent(() => import('/@/view/todo/component/plat_animal_takeway_applications.vue'))
  80. const PlatPlatformOutRoomAppoint = defineAsyncComponent(() => import('/@/view/todo/component/plat_platform_out_room_appoint.vue'))
  81. const PlatformAnimalAppointmentEthics = defineAsyncComponent(() => import('/@/view/todo/component/platform_animal_appointment_ethics.vue'))
  82. const PlatAnimalTakewayReback = defineAsyncComponent(() => import('/@/view/todo/component/plat_animal_takeway_reback.vue'))
  83. const executionApi = useExecutionApi()
  84. const flowApi = useFlowApi()
  85. const router = useRouter()
  86. const route = useRoute()
  87. const apprList = ref<any[]>([])
  88. const formRef = ref()
  89. const state = reactive({
  90. type: 'approval',
  91. form: {
  92. id: 0,
  93. defId: 0,
  94. defCode: '',
  95. defName: '',
  96. instTitle: '',
  97. nodeId: '',
  98. candidate: '',
  99. taskId: 0,
  100. startTime: '',
  101. endTime: '',
  102. duration: 0,
  103. startUserId: 0,
  104. startUserName: '',
  105. isFinish: '',
  106. platformId: 0,
  107. remark: '',
  108. createdBy: 0,
  109. createdName: '',
  110. createdTime: '',
  111. updatedBy: 0,
  112. updatedName: '',
  113. updatedTime: '',
  114. formConfig: {},
  115. formData: {},
  116. processTask: [],
  117. businessCode: ''
  118. },
  119. approvalForm: {
  120. approveOpinion: '',
  121. approveResult: 'pass'
  122. }
  123. })
  124. const onClickRight = () => {
  125. router.go(-1)
  126. }
  127. // 审核方式翻译
  128. const getNodeModel = (type: string, model: string) => {
  129. if (type === 'start') return ''
  130. if (model === '10') {
  131. return '会签'
  132. } else if (model === '20') {
  133. return '或签'
  134. }
  135. }
  136. // 详情工作流列表
  137. const getFlowInstance = async () => {
  138. const [err, res]: ToResponse = await to(flowApi.getFlowInstance({ id: state.form.id, businessCode: state.form.businessCode, defCode: state.form.defCode }))
  139. if (err) return
  140. const arr = res?.data?.nodes || []
  141. apprList.value = arr
  142. }
  143. const init = async (id: number) => {
  144. const [err, res]: ToResponse = await to(executionApi.getInstanceById({ id }))
  145. if (err) return
  146. if (res?.data) {
  147. state.form = res.data
  148. }
  149. }
  150. const onRouterPush = (val: string, params?: any) => {
  151. router.push({
  152. path: val,
  153. query: { ...params }
  154. })
  155. }
  156. const onSave = async () => {
  157. const [errValid] = await to(formRef.value.validate())
  158. if (errValid) return
  159. const params = {
  160. taskId: state.form.taskId,
  161. result: state.approvalForm.approveResult,
  162. opinion: state.approvalForm.approveOpinion
  163. }
  164. const [err]: ToResponse = await to(executionApi.approve(params))
  165. if (err) return
  166. showNotify({
  167. type: 'success',
  168. message: '审批成功'
  169. })
  170. router.push({
  171. path: '/todo'
  172. })
  173. }
  174. onMounted(() => {
  175. const id = route.query.id ? +route.query.id : 0
  176. state.type = route.query.type.toString()
  177. init(id)
  178. })
  179. </script>
  180. <style lang="scss" scoped>
  181. .app-container {
  182. header {
  183. padding: 14px;
  184. background-color: #f9ffff;
  185. border-radius: 4px;
  186. margin-top: 10px;
  187. }
  188. >h4 {
  189. margin: 10px 0;
  190. height: 20px;
  191. line-height: 20px;
  192. &::before {
  193. display: inline-block;
  194. content: '';
  195. background-color: #3c78e3;
  196. width: 4px;
  197. height: 20px;
  198. margin-right: 4px;
  199. vertical-align: top;
  200. }
  201. }
  202. :deep(.flow-cell) {
  203. margin-left: 22px;
  204. display: flex;
  205. justify-content: space-between;
  206. color: #333;
  207. }
  208. :deep(.cell-title) {
  209. flex: 0 0 80px;
  210. }
  211. .van-action-bar {
  212. z-index: 2;
  213. }
  214. }
  215. </style>