Bladeren bron

fix: 修改 bug

闪电 1 maand geleden
bovenliggende
commit
9f481bf62d

+ 17 - 0
apps/web-ele/src/api/system/user/user.ts

@@ -18,6 +18,7 @@ import { commonExport, ContentTypeEnum } from '#/api/helper';
18 18
 import { requestClient } from '#/api/request';
19 19
 
20 20
 enum Api {
21
+  allUserList = '/system/user/stationList',
21 22
   baseUser = '/system/user',
22 23
   downLoadTemplate = '/system/user/importTemplate',
23 24
   exportUser = '/system/user/export',
@@ -27,10 +28,26 @@ enum Api {
27 28
   updateAvatar = '/system/user/profile/avatar',
28 29
   updateProfilePwd = '/system/user/profile/updatePwd',
29 30
   updateUser = '/system/user/changeStatus',
31
+  userCount = '/system/user/getStationUserCount/{stationId}',
30 32
   userImport = '/system/user/importData',
31 33
   userInfo = 'system/user/profile',
32 34
 }
33 35
 
36
+export function getStationUserCount(stationId: number) {
37
+  return requestClient.get<BaseDataResult<number>>(
38
+    Api.userCount.replace('{stationId}', stationId.toString()),
39
+    {
40
+      isTransformResponse: false,
41
+    },
42
+  );
43
+}
44
+
45
+export function getAllUserList(params?: any) {
46
+  return requestClient.get<BaseResult<User[]>>(Api.allUserList, {
47
+    params,
48
+  });
49
+}
50
+
34 51
 // 用户列表接口
35 52
 export function getUserList(params?: UserQuery) {
36 53
   return requestClient.get<BaseResult<User[]>>(Api.menuList, { params });

+ 18 - 14
apps/web-ele/src/components/selectUsers/src/index.vue

@@ -25,19 +25,21 @@ import { getRoleList } from '#/api/system/role/role';
25 25
 // API导入 - 按模块分组
26 26
 // 用户相关API
27 27
 // @ts-ignore
28
-import { getUserList, selectUserList } from '#/api/system/user/user';
28
+import { getAllUserList, selectUserList } from '#/api/system/user/user';
29 29
 
30 30
 // 定义组件属性
31 31
 interface Props {
32 32
   // 用户ID数组,用于默认选中
33 33
   modelValue?: number[];
34
-  params?: any;
34
+  userParams?: any;
35
+  onlyUsers?: boolean;
36
+  maxSelectCount?: number;
35 37
 }
36 38
 
37 39
 // 组件属性默认值
38 40
 const props = withDefaults(defineProps<Props>(), {
39 41
   modelValue: () => [],
40
-  params: () => {},
42
+  userParams: () => {},
41 43
 });
42 44
 
43 45
 // 定义组件事件
@@ -238,12 +240,12 @@ async function loadAllUsers() {
238 240
   try {
239 241
     loading.value = true;
240 242
     let params: any = {};
241
-    if (props.params) {
242
-      params = { ...params, ...props.params };
243
+    if (props.userParams) {
244
+      params = { ...params, ...props.userParams };
243 245
     }
244 246
 
245
-    const res = await getUserList(params);
246
-    allUserList.value = res.rows || [];
247
+    const res: any = await getAllUserList(params);
248
+    allUserList.value = res || [];
247 249
   } catch (error_) {
248 250
     error.value = '加载用户列表失败';
249 251
     console.error('加载用户列表失败:', error_);
@@ -556,15 +558,15 @@ async function confirmSelection() {
556 558
     );
557 559
 
558 560
     const roleIds = selectedItems.value.filter((item) => item.type === 'role');
559
-    let params = {
561
+    const params = {
560 562
       postIds: postIds.map((item) => item.id),
561 563
       deptIds: deptIds.map((item) => item.id),
562 564
       stationIds: stationIds.map((item) => item.id),
563 565
       roleIds: roleIds.map((item) => item.id),
564 566
     };
565
-    if (props.params) {
566
-      params = { ...params, ...props.params };
567
-    }
567
+    // if (props.params) {
568
+    //   params = { ...params, ...props.params };
569
+    // }
568 570
 
569 571
     const res: any = await selectUserList(params);
570 572
     if (res?.length) {
@@ -623,13 +625,13 @@ defineExpose({
623 625
         </div>
624 626
 
625 627
         <!-- 标签页 -->
626
-        <div class="tabs">
628
+        <div class="tabs" v-if="!onlyUsers">
627 629
           <ElRadioGroup v-model="activeTab" size="small">
628 630
             <ElRadioButton label="byList">用户</ElRadioButton>
629 631
             <ElRadioButton label="byDept">部门</ElRadioButton>
630 632
             <ElRadioButton label="byPost">岗位</ElRadioButton>
631 633
             <ElRadioButton label="byRole">角色</ElRadioButton>
632
-            <ElRadioButton label="byStation">场站</ElRadioButton>
634
+            <ElRadioButton label="byStation"> 场站 </ElRadioButton>
633 635
           </ElRadioGroup>
634 636
         </div>
635 637
 
@@ -740,7 +742,9 @@ defineExpose({
740 742
       <!-- 右侧已选择区域 -->
741 743
       <div class="right-panel">
742 744
         <div class="selected-header">
743
-          <span class="selected-title">已选择 ({{ totalSelected }}/1000)</span>
745
+          <span class="selected-title">
746
+            已选择 ({{ totalSelected }}/{{ maxSelectCount || 1000 }})
747
+          </span>
744 748
           <ElButton
745 749
             v-if="totalSelected > 0"
746 750
             type="text"

+ 3 - 6
apps/web-ele/src/views/schedule/detail/components/emergency.vue

@@ -131,19 +131,16 @@ const formatDateTime = (dateTime: string) => {
131 131
       </div>
132 132
       <ElDescriptions :column="4" class="mb-6">
133 133
         <ElDescriptionsItem
134
-          v-if="
135
-            emergencyData.imagesPaths && emergencyData.imagesPaths.length > 0
136
-          "
134
+          v-if="emergencyData.imagesUrl && emergencyData.imagesUrl.length > 0"
137 135
           label="演练现场图片:"
138 136
           :span="4"
139 137
         >
140 138
           <div class="task-images">
141 139
             <ElImage
142
-              v-for="(image, index) in emergencyData.imagesPaths"
140
+              v-for="(image, index) in emergencyData.imagesUrl"
143 141
               :key="index"
144 142
               :src="image"
145
-              :preview-src-list="emergencyData.imagesPaths"
146
-              :initial-index="index"
143
+              :preview-src-list="emergencyData.imagesUrl"
147 144
               fit="cover"
148 145
               alt="演练照片"
149 146
               class="task-image"

+ 3 - 4
apps/web-ele/src/views/schedule/detail/components/meeting.vue

@@ -132,17 +132,16 @@ const formatDateTime = (dateTime: string) => {
132 132
       </div>
133 133
       <ElDescriptions :column="4" class="mb-6">
134 134
         <ElDescriptionsItem
135
-          v-if="meetingData.meetingImagesUrl.length > 0"
135
+          v-if="meetingData?.meetingImagesUrl?.length > 0"
136 136
           label="会议记录和现场照片:"
137 137
           :span="4"
138 138
         >
139 139
           <div class="task-images">
140 140
             <ElImage
141
-              v-for="(image, index) in meetingData.meetingImagesUrl"
141
+              v-for="(image, index) in meetingData?.meetingImagesUrl || []"
142 142
               :key="index"
143 143
               :src="image"
144
-              :preview-src-list="meetingData.meetingImagesUrl"
145
-              :initial-index="index"
144
+              :preview-src-list="meetingData?.meetingImagesUrl || []"
146 145
               fit="cover"
147 146
               alt="会议照片"
148 147
               class="task-image"

+ 1 - 1
apps/web-ele/src/views/schedule/detail/components/plan.vue

@@ -145,7 +145,7 @@ const init = () => {
145 145
   basicTableApi.setGridOptions(gridOptions);
146 146
 
147 147
   const tableData: any = [];
148
-  props.taskDetail.evaluationRecords.forEach((item: any) => {
148
+  props.taskDetail?.evaluationRecords.forEach((item: any) => {
149 149
     const index = tableData.findIndex(
150 150
       (item2: any) => item2.employeeId === item.employeeId,
151 151
     );

+ 7 - 1
apps/web-ele/src/views/schedule/detail/drawer/emergency/index.vue

@@ -7,6 +7,8 @@ import { ref } from 'vue';
7 7
 import { useVbenDrawer, useVbenForm } from '@vben/common-ui';
8 8
 
9 9
 // @ts-ignore
10
+import { getStationUserCount } from '#/api/system/user/user';
11
+// @ts-ignore
10 12
 import { submitEmergencyWy, submitEmergencyWyReport } from '#/api/task';
11 13
 
12 14
 // @ts-ignore
@@ -42,10 +44,14 @@ const [Drawer, drawerApi] = useVbenDrawer({
42 44
     }
43 45
     try {
44 46
       drawerApi.drawerLoading(true);
45
-      const { taskId, taskName, taskList } = drawerApi.getData();
47
+      const { taskId, taskName, taskList, stationId } = drawerApi.getData();
46 48
       taskParams.value.taskId = taskId;
47 49
       taskParams.value.taskName = taskName;
48 50
       taskParams.value.taskList = taskList;
51
+      // 获取 stationId 下的用户数量
52
+      const { data }: any = await getStationUserCount(stationId);
53
+      planFormApi.setFieldValue('totalCount', data);
54
+
49 55
       // 填充计划表单
50 56
       planFormApi.setValues(taskList[0]);
51 57
       // 填充报告表单

+ 22 - 22
apps/web-ele/src/views/schedule/detail/drawer/groupLog/config-data.tsx

@@ -81,28 +81,28 @@ export const drawerFormSchema: any | FormSchemaGetter = (
81 81
       disabled: true,
82 82
     },
83 83
     rules: 'required',
84
-    renderComponentContent: (row: any, formApi: any) => {
85
-      return {
86
-        suffix: () => {
87
-          return (
88
-            <ElButton
89
-              onClick={() =>
90
-                handleClick(1, (users: any) => {
91
-                  if (users?.length) {
92
-                    formApi.setFieldValue('shiftLeaderName', users[0].name);
93
-                    formApi.setFieldValue('shiftLeaderId', users[0].id);
94
-                  }
95
-                })
96
-              }
97
-              size="small"
98
-              type="primary"
99
-            >
100
-              选择
101
-            </ElButton>
102
-          );
103
-        },
104
-      };
105
-    },
84
+    // renderComponentContent: (row: any, formApi: any) => {
85
+    //   return {
86
+    //     suffix: () => {
87
+    //       return (
88
+    //         <ElButton
89
+    //           onClick={() =>
90
+    //             handleClick(1, (users: any) => {
91
+    //               if (users?.length) {
92
+    //                 formApi.setFieldValue('shiftLeaderName', users[0].name);
93
+    //                 formApi.setFieldValue('shiftLeaderId', users[0].id);
94
+    //               }
95
+    //             })
96
+    //           }
97
+    //           size="small"
98
+    //           type="primary"
99
+    //         >
100
+    //           选择
101
+    //         </ElButton>
102
+    //       );
103
+    //     },
104
+    //   };
105
+    // },
106 106
   },
107 107
   {
108 108
     component: 'Select',

+ 19 - 31
apps/web-ele/src/views/schedule/detail/drawer/groupLog/index.vue

@@ -29,6 +29,12 @@ import { defautTableColumns, drawerFormSchema } from './config-data';
29 29
 const emit = defineEmits<{ reload: [] }>();
30 30
 
31 31
 const executorRef: any = ref(null);
32
+const selectParams = ref({
33
+  types: ['users'],
34
+  userParams: {
35
+    stationId: 0,
36
+  },
37
+});
32 38
 const [ExecutorModal, executorModalApi] = useVbenModal({
33 39
   title: '选择负责人',
34 40
   width: 1000,
@@ -87,9 +93,12 @@ const [Drawer, drawerApi] = useVbenDrawer({
87 93
     }
88 94
     try {
89 95
       drawerApi.drawerLoading(true);
90
-      const { taskId, taskName } = drawerApi.getData();
96
+      const { taskId, taskName, stationId, taskList } = drawerApi.getData();
91 97
       taskParams.value.taskId = taskId;
92 98
       taskParams.value.taskName = taskName;
99
+      formApi.setFieldValue('shiftLeaderId', taskList[0].executorId);
100
+      formApi.setFieldValue('shiftLeaderName', taskList[0].executorIdName);
101
+      selectParams.value.userParams.stationId = stationId;
93 102
     } catch (error) {
94 103
       console.error(error);
95 104
     } finally {
@@ -208,7 +217,7 @@ const [BasicTable, basicTableApi] = useVbenVxeGrid({
208 217
 });
209 218
 
210 219
 // 其他分工列表
211
-const otherDivisionList = ref<any[]>([{ id: '', name: '未选择', content: '' }]);
220
+const otherDivisionList = ref<any[]>([]);
212 221
 
213 222
 // 添加其他分工
214 223
 const addOtherDivision = () => {
@@ -265,38 +274,13 @@ onMounted(async () => {
265 274
   await init();
266 275
   // gridOptions.columns = await tableColumns();
267 276
 });
268
-
269
-const confirmEvent = (row: any) => {
270
-  //
271
-  // console.log('row', row);
272
-};
273 277
 </script>
274 278
 
275 279
 <template>
276 280
   <Drawer :title="taskParams.taskName">
277 281
     <Form>
278 282
       <template #evaluationComments>
279
-        <BasicTable table-title="" class="w-full">
280
-          <template #action="{ row }">
281
-            <ElSpace>
282
-              <ElPopconfirm
283
-                :title="$t('common.confirm-delete')"
284
-                @confirm="confirmEvent(row)"
285
-              >
286
-                <template #reference>
287
-                  <ElButton
288
-                    size="small"
289
-                    type="danger"
290
-                    plain
291
-                    v-access:code="['system:dict:remove']"
292
-                  >
293
-                    删除
294
-                  </ElButton>
295
-                </template>
296
-              </ElPopconfirm>
297
-            </ElSpace>
298
-          </template>
299
-        </BasicTable>
283
+        <BasicTable table-title="" class="w-full" />
300 284
       </template>
301 285
 
302 286
       <template #otherDivision>
@@ -304,12 +288,12 @@ const confirmEvent = (row: any) => {
304 288
           <div
305 289
             v-for="(item, index) in otherDivisionList"
306 290
             :key="index"
307
-            class="mb-2 flex items-center gap-2"
291
+            class="mb-2 flex w-full items-center gap-2"
308 292
           >
309 293
             <ElInput
310 294
               v-model="item.content"
311 295
               placeholder="请输入分工内容"
312
-              class="flex-1"
296
+              class="w-full flex-1"
313 297
             >
314 298
               <template #append>
315 299
                 <div class="flex items-center gap-1">
@@ -357,7 +341,11 @@ const confirmEvent = (row: any) => {
357 341
       </template>
358 342
     </Form>
359 343
     <ExecutorModal class="w-[700px]">
360
-      <SelectUsers ref="executorRef" :params="{}" />
344
+      <SelectUsers
345
+        ref="executorRef"
346
+        :user-params="selectParams.userParams"
347
+        :only-users="true"
348
+      />
361 349
     </ExecutorModal>
362 350
   </Drawer>
363 351
 </template>

+ 28 - 4
apps/web-ele/src/views/schedule/detail/drawer/meeting/config-data.tsx

@@ -3,6 +3,8 @@
3 3
 import type { FormSchemaGetter } from '#/adapter/form';
4 4
 // @ts-ignore: 忽略
5 5
 
6
+import { ElMessage } from 'element-plus';
7
+
6 8
 // @ts-ignore: 忽略
7 9
 import { getMultipleImageUploadConfig } from '#/components/upload';
8 10
 
@@ -35,16 +37,38 @@ export const drawerFormSchema: any | FormSchemaGetter = () => [
35 37
   },
36 38
   {
37 39
     component: 'InputNumber',
38
-    componentProps: {
39
-      placeholder: '请输入参会人数',
40
-      min: 0,
41
-      max: undefined,
40
+    componentProps: (data: any) => {
41
+      return {
42
+        placeholder: '请输入参会人数',
43
+        min: 0,
44
+        max: undefined,
45
+        onChange(val: number) {
46
+          if (val && val > data.totalCount) {
47
+            ElMessage({
48
+              message: '参会人数不能大于总人数',
49
+              type: 'warning',
50
+            });
51
+            data.attendeesCount = 0;
52
+          }
53
+        },
54
+      };
42 55
     },
43 56
     fieldName: 'attendeesCount',
44 57
     label: '参会人数',
45 58
     rules: 'required',
46 59
   },
47 60
   {
61
+    component: 'InputNumber',
62
+    componentProps: {
63
+      placeholder: '请输入总人数',
64
+      min: 0,
65
+      max: undefined,
66
+      disabled: true,
67
+    },
68
+    fieldName: 'totalCount',
69
+    label: '总人数',
70
+  },
71
+  {
48 72
     component: 'DatePicker',
49 73
     componentProps: {
50 74
       type: 'daterange',

+ 8 - 2
apps/web-ele/src/views/schedule/detail/drawer/meeting/index.vue

@@ -8,6 +8,8 @@ import { useVbenDrawer, useVbenForm } from '@vben/common-ui';
8 8
 import { ElMessage } from 'element-plus';
9 9
 
10 10
 // @ts-ignore
11
+import { getStationUserCount } from '#/api/system/user/user';
12
+// @ts-ignore
11 13
 import { handleMeeting } from '#/api/task/index';
12 14
 
13 15
 // @ts-ignore
@@ -70,12 +72,16 @@ const [Drawer, drawerApi] = useVbenDrawer({
70 72
     }
71 73
     try {
72 74
       drawerApi.drawerLoading(true);
73
-      const { taskId, taskName } = drawerApi.getData();
75
+      const { taskId, taskName, stationId } = drawerApi.getData();
74 76
       meetingParams.value.taskId = taskId;
75 77
       meetingParams.value.taskName = taskName;
78
+      // 获取站点用户数量
79
+      const { data } = await getStationUserCount(stationId);
76 80
 
77
-      // 重置表单
78 81
       formApi.resetForm(initialFormData.value);
82
+      initialFormData.value.totalCount = data;
83
+      formApi.setFieldValue('totalCount', data);
84
+      // 重置表单
79 85
     } catch (error) {
80 86
       console.error(error);
81 87
       ElMessage.error('加载会议数据失败');

+ 10 - 0
apps/web-ele/src/views/schedule/detail/drawer/upload/config-data.tsx

@@ -71,4 +71,14 @@ export const drawerFormSchema: FormSchemaGetter = () => [
71 71
       triggerFields: [''],
72 72
     },
73 73
   },
74
+  {
75
+    component: 'Input',
76
+    fieldName: 'remark',
77
+    label: '备注',
78
+    componentProps: {
79
+      type: 'textarea',
80
+      rows: 3,
81
+      maxlength: 200,
82
+    },
83
+  },
74 84
 ];

+ 1 - 0
apps/web-ele/src/views/schedule/detail/drawer/upload/index.vue

@@ -55,6 +55,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
55 55
         id: taskParams.value.taskId,
56 56
         attachment: values.attachment,
57 57
         attachmentName: values.attachmentName,
58
+        remark: values.remark,
58 59
       };
59 60
       await dealTask(params);
60 61
       emit('reload');

+ 4 - 74
apps/web-ele/src/views/schedule/detail/index.vue

@@ -70,9 +70,8 @@ import SalesSurveyComponent from './components/sales-survey.vue';
70 70
 import TankWaterComponent from './components/tank-water.vue';
71 71
 // @ts-ignore
72 72
 import WeeklyEvaluationComponent from './components/weekly-evaluation.vue';
73
-import WeeklyReportComponent from './components/weekly-report.vue';
74 73
 // @ts-ignore
75
-import WeeklyComponent from './components/weekly.vue';
74
+import WeeklyReportComponent from './components/weekly-report.vue';
76 75
 import { mobileTaskTypes } from './config-data';
77 76
 import {
78 77
   AdditiveDrawer,
@@ -416,6 +415,7 @@ const dealEvent = async () => {
416 415
         taskName: taskInfo.value.taskName,
417 416
         taskList: taskInfo.value.taskList || [],
418 417
         remark: taskResult.value.content,
418
+        stationId: taskInfo.value.stationId || 0,
419 419
         subFormType: taskInfo.value.subFormType,
420 420
         attachmentUrl: taskResult.value.images,
421 421
       };
@@ -698,24 +698,6 @@ onMounted(async () => {
698 698
           <BiddingComponent />
699 699
         </ElCard>
700 700
 
701
-        <!-- 周报信息 -->
702
-        <ElCard v-if="taskInfo.formType === 'weekly'">
703
-          <template #header>
704
-            <div class="flex items-center gap-4">
705
-              <div
706
-                style="width: 4px; height: 12px; background-color: #215acd"
707
-              ></div>
708
-              <span
709
-                class="text-lg font-bold text-gray-800"
710
-                style="font-size: 14px; font-weight: 600"
711
-              >
712
-                周报信息
713
-              </span>
714
-            </div>
715
-          </template>
716
-          <WeeklyComponent />
717
-        </ElCard>
718
-
719 701
         <!-- 检查项组件 -->
720 702
         <ElCard v-if="taskInfo.formType === 'inspection'">
721 703
           <template #header>
@@ -855,6 +837,7 @@ onMounted(async () => {
855 837
           "
856 838
         />
857 839
 
840
+        <!-- 周报信息 -->
858 841
         <WeeklyReportComponent
859 842
           :task-detail="taskInfo.taskList[0]"
860 843
           v-if="
@@ -862,62 +845,9 @@ onMounted(async () => {
862 845
             taskInfo.subFormType === 'operating_weekly_report'
863 846
           "
864 847
         />
865
-
866
-        <!-- 处理信息组件 -->
867
-        <!-- <ElCard v-if="taskInfo.status === 3">
868
-          <template #header>
869
-            <div class="flex items-center gap-4">
870
-              <div
871
-                style="width: 4px; height: 12px; background-color: #215acd"
872
-              ></div>
873
-              <span
874
-                class="text-lg font-bold text-gray-800"
875
-                style="font-size: 14px; font-weight: 600"
876
-              >
877
-                处理信息
878
-              </span>
879
-            </div>
880
-          </template>
881
-          <ElDescriptions class="task-info" :column="4">
882
-            <ElDescriptionsItem
883
-              v-if="taskResult.handleContent || taskInfo.cancelReason"
884
-              label="处理情况:"
885
-              :span="4"
886
-            >
887
-              {{ taskResult.handleContent || taskInfo.cancelReason || '' }}
888
-            </ElDescriptionsItem>
889
-            <ElDescriptionsItem label="处理时间:" :span="4">
890
-              {{ taskInfo.completeTime || taskInfo.cancelTime || '-' }}
891
-            </ElDescriptionsItem>
892
-            <ElDescriptionsItem
893
-              v-if="taskResult.files && taskResult.files.length > 0"
894
-              label="处理附件:"
895
-              :span="4"
896
-            >
897
-              <div class="attachment-list">
898
-                <div
899
-                  v-for="(file, index) in taskResult.files"
900
-                  :key="index"
901
-                  class="attachment-item"
902
-                  @click="
903
-                    () =>
904
-                      downloadFile(
905
-                        file,
906
-                        taskResult.fileNames[index] || `附件${+index + 1}`,
907
-                      )
908
-                  "
909
-                >
910
-                  <span class="attachment-name">{{
911
-                    taskResult.fileNames[index] || `附件${+index + 1}`
912
-                  }}</span>
913
-                </div>
914
-              </div>
915
-            </ElDescriptionsItem>
916
-          </ElDescriptions>
917
-        </ElCard> -->
918 848
       </div>
919 849
 
920
-      <div style="width: 412px">
850
+      <div style="width: 412px" v-if="taskInfo.status === 3">
921 851
         <!-- 评论组件 -->
922 852
         <ElCard>
923 853
           <template #header>