miaofuhao 5 日 前
コミット
cb5afca6f8

+ 4 - 7
apps/web-ele/src/views/workflow/components/approval-details.vue

@@ -3,9 +3,6 @@
3 3
 动态渲染要显示的内容 需要再flowDescripionsMap先定义好组件
4 4
 -->
5 5
 <script setup lang="ts">
6
-import type { FlowComponentsMapMapKey } from '../register';
7
-
8
-import type { FlowInfoResponse } from '#/api/workflow/instance/model';
9 6
 import type { TaskInfo } from '#/api/workflow/task/model';
10 7
 
11 8
 import { ApprovalTimeline } from '.';
@@ -17,7 +14,6 @@ defineOptions({
17 14
 });
18 15
 
19 16
 defineProps<{
20
-  currentFlowInfo: FlowInfoResponse;
21 17
   task: TaskInfo;
22 18
 }>();
23 19
 </script>
@@ -28,10 +24,11 @@ defineProps<{
28 24
      动态渲染要显示的内容 需要再flowDescripionsMap先定义好组件
29 25
      business-id为业务ID 必传
30 26
     -->
27
+    <!-- <component :is="flowComponentsMap[task.formPath as FlowComponentsMapMapKey]" :business-id="task.businessId" /> -->
31 28
     <component
32
-      :is="flowComponentsMap[task.formPath as FlowComponentsMapMapKey]"
33
-      :business-id="task.businessId"
29
+      :is="flowComponentsMap['/workflow/leaveEdit/index']"
30
+      :task="task"
34 31
     />
35
-    <ApprovalTimeline :list="currentFlowInfo.list" />
32
+    <ApprovalTimeline :id="task.id" />
36 33
   </div>
37 34
 </template>

+ 5 - 7
apps/web-ele/src/views/workflow/components/approval-panel.vue

@@ -19,13 +19,10 @@ import { CopyDocument } from '@element-plus/icons-vue';
19 19
 import { useClipboard } from '@vueuse/core';
20 20
 import { ElCard, ElMessage, ElTabPane, ElTabs } from 'element-plus';
21 21
 
22
-import { flowInfo } from '#/api/workflow/instance';
23
-import { getTaskByTaskId } from '#/api/workflow/task';
24 22
 import { renderDict } from '#/utils/render';
25 23
 
26 24
 import { FlowActions } from './actions';
27 25
 import ApprovalDetails from './approval-details.vue';
28
-import FlowPreview from './flow-preview.vue';
29 26
 
30 27
 defineOptions({
31 28
   name: 'ApprovalPanel',
@@ -158,7 +155,9 @@ async function handleCopy(text: string) {
158 155
             <div class="text-2xl font-bold">
159 156
               {{ task.orderNo }}
160 157
             </div>
161
-            <el-icon @click="() => handleCopy(task.orderNo)"><CopyDocument /></el-icon>
158
+            <el-icon @click="() => handleCopy(task.orderNo)">
159
+              <CopyDocument />
160
+            </el-icon>
162 161
             <div>
163 162
               <component
164 163
                 :is="renderDict(task.status, DictEnum.TICKET_STATUS)"
@@ -197,9 +196,9 @@ async function handleCopy(text: string) {
197 196
             />
198 197
           </ElTabPane>
199 198
 
200
-          <ElTabPane key="2" label="审批流程图">
199
+          <!-- <ElTabPane key="2" label="审批流程图">
201 200
             <FlowPreview :instance-id="currentFlowInfo.instanceId" />
202
-          </ElTabPane>
201
+          </ElTabPane> -->
203 202
         </ElTabs>
204 203
       </div>
205 204
 
@@ -219,4 +218,3 @@ async function handleCopy(text: string) {
219 218
     </slot>
220 219
   </div>
221 220
 </template>
222
-

+ 25 - 7
apps/web-ele/src/views/workflow/components/approval-timeline.vue

@@ -1,19 +1,37 @@
1 1
 <script setup lang="ts">
2
-import type { Flow } from '#/api/workflow/instance/model';
2
+import { onMounted, shallowRef } from 'vue';
3
+
4
+import { ElEmpty, ElMessage, ElTimeline } from 'element-plus';
5
+
6
+import { requestClient } from '#/api/request';
3 7
 
4
-// import { Empty, Timeline } from 'ant-design-vue';
5 8
 import ApprovalTimelineItem from './approval-timeline-item.vue';
6 9
 
7 10
 interface Props {
8
-  list: Flow[];
11
+  id: string;
9 12
 }
10 13
 
11
-defineProps<Props>();
14
+const props = defineProps<Props>();
15
+const list = shallowRef([]);
16
+
17
+onMounted(async () => {
18
+  if (!props.id) return;
19
+
20
+  try {
21
+    const resp = await requestClient.get('/workOrderRecord/record/list', {
22
+      params: { orderId: props.id },
23
+    });
24
+    list.value = resp.data;
25
+    console.log(resp.data);
26
+  } catch {
27
+    ElMessage.error('获取工单记录失败');
28
+  }
29
+});
12 30
 </script>
13 31
 
14 32
 <template>
15
-  <Timeline v-if="list.length > 0">
33
+  <ElTimeline v-if="id">
16 34
     <ApprovalTimelineItem v-for="item in list" :key="item.id" :item="item" />
17
-  </Timeline>
18
-  <Empty v-else />
35
+  </ElTimeline>
36
+  <ElEmpty v-else />
19 37
 </template>

+ 31 - 1
apps/web-ele/src/views/workflow/leave/api/model.d.ts

@@ -7,11 +7,41 @@ export interface LeaveVO {
7 7
   id: number | string;
8 8
 
9 9
   /**
10
+   * 工单类型
11
+   */
12
+  ticketTypeName: string;
13
+
14
+  /**
15
+   * 场站名称
16
+   */
17
+  stationName: string;
18
+
19
+  /**
20
+   * 填报内容
21
+   */
22
+  content: string;
23
+
24
+  /**
25
+   * 附件
26
+   */
27
+  attachment: string;
28
+
29
+  /**
10 30
    * 请假类型
11 31
    */
12 32
   leaveType: string;
13 33
 
14 34
   /**
35
+   * 联系人
36
+   */
37
+  contact: string;
38
+
39
+  /**
40
+   * 联系电话
41
+   */
42
+  phone: string;
43
+
44
+  /**
15 45
    * 开始时间
16 46
    */
17 47
   startDate: string;
@@ -32,7 +62,7 @@ export interface LeaveVO {
32 62
   remark: string;
33 63
 
34 64
   /**
35
-   *
65
+   * 状态 0:草稿 1:已提交 2:已同意 3:已拒绝
36 66
    */
37 67
   status: string;
38 68
   applyCode?: string;

+ 25 - 31
apps/web-ele/src/views/workflow/leave/leave-description.vue

@@ -1,32 +1,20 @@
1 1
 <script setup lang="ts">
2 2
 import type { LeaveVO } from '../leave/api/model';
3 3
 
4
-import { computed, onMounted, shallowRef } from 'vue';
4
+import { onMounted, shallowRef } from 'vue';
5 5
 
6
-import { Descriptions, DescriptionsItem, Skeleton } from 'ant-design-vue';
7 6
 import dayjs from 'dayjs';
8 7
 
9
-import { leaveInfo } from './api';
10
-import { leaveTypeOptions } from './data';
11
-
12 8
 defineOptions({
13 9
   name: 'LeaveDescription',
14 10
   inheritAttrs: false,
15 11
 });
16 12
 
17
-const props = defineProps<{ businessId: number | string }>();
13
+const props = defineProps<{ task: LeaveVO }>();
18 14
 
19 15
 const data = shallowRef<LeaveVO>();
20 16
 onMounted(async () => {
21
-  const resp = await leaveInfo(props.businessId);
22
-  data.value = resp;
23
-});
24
-
25
-const leaveType = computed(() => {
26
-  return (
27
-    leaveTypeOptions.find((item) => item.value === data.value?.leaveType)
28
-      ?.label ?? '未知'
29
-  );
17
+  data.value = props.task;
30 18
 });
31 19
 
32 20
 function formatDate(date: string) {
@@ -36,21 +24,27 @@ function formatDate(date: string) {
36 24
 
37 25
 <template>
38 26
   <div class="rounded-[6px] border p-2">
39
-    <Descriptions v-if="data" :column="1" size="middle">
40
-      <DescriptionsItem label="请假类型">
41
-        {{ leaveType }}
42
-      </DescriptionsItem>
43
-      <DescriptionsItem label="请假时间">
44
-        {{ formatDate(data.startDate) }} - {{ formatDate(data.endDate) }}
45
-      </DescriptionsItem>
46
-      <DescriptionsItem label="请假时长">
47
-        {{ data.leaveDays }}天
48
-      </DescriptionsItem>
49
-      <DescriptionsItem label="请假原因">
50
-        {{ data.remark || '无' }}
51
-      </DescriptionsItem>
52
-    </Descriptions>
53
-
54
-    <Skeleton active v-else />
27
+    <ElDescriptions v-if="data" :column="1">
28
+      <ElDescriptionsItem label="工单类型:">
29
+        {{ data.ticketTypeName }}
30
+      </ElDescriptionsItem>
31
+      <ElDescriptionsItem label="场站:">
32
+        {{ data.stationName || '无' }}
33
+      </ElDescriptionsItem>
34
+      <ElDescriptionsItem label="联系人:">
35
+        {{ data.contact || '无' }}
36
+      </ElDescriptionsItem>
37
+      <ElDescriptionsItem label="联系电话:">
38
+        {{ data.phone || '无' }}
39
+      </ElDescriptionsItem>
40
+      <ElDescriptionsItem label="提报内容:">
41
+        {{ data.content || '无' }}
42
+      </ElDescriptionsItem>
43
+      <ElDescriptionsItem label="附件:">
44
+        {{ data.attachment || '无' }}
45
+      </ElDescriptionsItem>
46
+    </ElDescriptions>
47
+
48
+    <ElSkeleton active v-else :rows="4" />
55 49
   </div>
56 50
 </template>

+ 3 - 1
apps/web-ele/src/views/workflow/register.ts

@@ -1,3 +1,5 @@
1
+import { defineAsyncComponent, markRaw } from 'vue';
2
+
1 3
 /**
2 4
  * 这里定义流程描述组件
3 5
  */
@@ -13,7 +15,7 @@ export const flowComponentsMap = {
13 15
   /**
14 16
    * 请假申请 详情
15 17
    */
16
-  '/workflow/leaveEdit/index': null,
18
+  '/workflow/leaveEdit/index': markRaw(LeaveDescription),
17 19
 };
18 20
 
19 21
 export type FlowComponentsMapMapKey = keyof typeof flowComponentsMap;