Delay-detail.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <el-dialog v-model="state.dialogVisible" draggable title="延期详情" ref="dialogRef" width="50%" append-to-body destroy-on-close>
  3. <el-form label-width="110px" ref="ruleFormRef" :model="state.ruleForm" class="show-info-form">
  4. <el-row :gutter="10">
  5. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  6. <el-form-item label="工单编号"> {{ state.ruleForm?.order?.no }} </el-form-item>
  7. </el-col>
  8. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  9. <el-form-item label="工单标题"> {{ state.ruleForm?.order?.title }} </el-form-item>
  10. </el-col>
  11. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  12. <el-form-item label="申请人">{{ state.ruleForm?.creatorName }} </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  15. <el-form-item label="申请部门">{{ state.ruleForm?.creatorOrgName }} </el-form-item>
  16. </el-col>
  17. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  18. <el-form-item label="申请时间">{{ formatDate(state.ruleForm?.creationTime, 'YYYY-mm-dd HH:MM:SS') }} </el-form-item>
  19. </el-col>
  20. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  21. <el-form-item label="当前期满时间"> {{ formatDate(state.ruleForm?.beforeDelay, 'YYYY-mm-dd HH:MM:SS') }} </el-form-item>
  22. </el-col>
  23. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  24. <el-form-item label="延期申请数量">{{ state.ruleForm?.delayNum }} {{ state.ruleForm?.delayUnitText }} </el-form-item>
  25. </el-col>
  26. <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  27. <el-form-item label="延期后期满时间">{{ formatDate(state.ruleForm?.afterDelay, 'YYYY-mm-dd HH:MM:SS') }} </el-form-item>
  28. </el-col>-->
  29. <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
  30. <el-form-item label="是否省延期">{{ state.ruleForm?.isProDelay ? '是' : '否' }} </el-form-item>
  31. </el-col>
  32. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  33. <el-form-item label="申请理由" class="formatted-text">{{ state.ruleForm?.delayReason }} </el-form-item>
  34. </el-col>
  35. <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
  36. <el-form-item label="附件"
  37. ><annex-list name="延期申请附件" v-model="state.ruleForm.files" readonly classify="延期申请附件" />
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. </el-form>
  42. <template #footer>
  43. <span class="dialog-footer">
  44. <el-button @click="closeDialog" class="default-button">取 消</el-button>
  45. <el-button type="primary" @click="processDetail">流程明细</el-button>
  46. <el-button type="primary" @click="onAudit" v-if="state.ruleForm?.isCanHandle" v-auths="['business:delay:audit:todo', 'business:delay:audit']"
  47. >延期审批</el-button
  48. >
  49. </span>
  50. </template>
  51. </el-dialog>
  52. <!-- 审核记录 -->
  53. <audit-record ref="auditRecordRef" />
  54. <!-- 流程审批 -->
  55. <process-audit ref="processAuditRef" @orderProcessSuccess="orderProcessSuccess" @orderProcessFailed="orderProcessFailed"></process-audit>
  56. </template>
  57. <script setup lang="ts" name="delayDetail">
  58. import { defineAsyncComponent, reactive, ref } from 'vue';
  59. import { delayDetail } from '@/api/business/delay';
  60. import { formatDate } from '@/utils/formatTime';
  61. import { transformFile } from '@/utils/tools';
  62. import { useThemeConfig } from '@/stores/themeConfig';
  63. import { storeToRefs } from 'pinia';
  64. import { ElMessage } from 'element-plus';
  65. const AuditRecord = defineAsyncComponent(() => import('@/components/AuditRecord/index.vue')); // 流程明细
  66. const AnnexList = defineAsyncComponent(() => import('@/components/AnnexList/index.vue')); // 附件列表
  67. const ProcessAudit = defineAsyncComponent(() => import('@/components/ProcessAudit/index.vue')); // 流程审批
  68. // 定义子组件向父组件传值/事件
  69. const emit = defineEmits(['updateList']);
  70. // 定义变量内容
  71. const state = reactive<any>({
  72. dialogVisible: false, // 是否显示弹窗
  73. loading: false, // 是否显示加载
  74. ruleForm: {},
  75. currentId: '',
  76. });
  77. const storesThemeConfig = useThemeConfig();
  78. const { themeConfig } = storeToRefs(storesThemeConfig);
  79. /*
  80. * @param row 工单详情
  81. * @description 打开弹窗
  82. * */
  83. const openDialog = async (row: any) => {
  84. state.loading = true;
  85. state.currentId = row.id;
  86. state.dialogVisible = true;
  87. try {
  88. const res = await delayDetail(state.currentId);
  89. state.ruleForm = res.result ?? {};
  90. state.ruleForm.files = transformFile(state.ruleForm.files);
  91. state.loading = false;
  92. } catch (e) {
  93. state.loading = false;
  94. }
  95. };
  96. // 关闭弹窗
  97. const closeDialog = () => {
  98. state.dialogVisible = false;
  99. };
  100. // 延期审批
  101. const processAuditRef = ref<RefType>(); // 流程审批ref
  102. const onAudit = () => {
  103. const params = {
  104. id: state.ruleForm.workflowId,
  105. processType: '延期审批',
  106. orderDetail: state.ruleForm.order,
  107. extra: {
  108. dialogTitle: '延期审批',
  109. inputPlaceholder: '办理意见',
  110. annexName: '延期附件',
  111. classify: '延期上传',
  112. },
  113. };
  114. processAuditRef.value.openDialog(params);
  115. };
  116. // 流程明细
  117. const auditRecordRef = ref<RefType>(); // 审核记录ref
  118. const processDetail = () => {
  119. if (['ZiGong'].includes(themeConfig.value.appScope)) {
  120. // 自贡
  121. if (state.ruleForm?.automaticDelayNum === null) {
  122. // 没有自动延期正常查看
  123. const params = {
  124. dialogTitle: `延期记录 (${state.ruleForm.order?.title})`,
  125. ...state.ruleForm,
  126. };
  127. auditRecordRef.value.openDialog(params);
  128. } else {
  129. // 有自动延期,则不能查看
  130. ElMessage.warning('该工单已自动延期,没有流程明细');
  131. }
  132. } else {
  133. const params = {
  134. dialogTitle: `延期记录 (${state.ruleForm.order?.title})`,
  135. ...state.ruleForm,
  136. };
  137. auditRecordRef.value.openDialog(params);
  138. }
  139. };
  140. // 审核成功
  141. const orderProcessSuccess = () => {
  142. emit('updateList');
  143. closeDialog();
  144. };
  145. // 审核失败
  146. const orderProcessFailed = () => {
  147. emit('updateList');
  148. closeDialog();
  149. };
  150. defineExpose({
  151. openDialog,
  152. closeDialog,
  153. });
  154. </script>