detail.vue 8.1 KB

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