Kaynağa Gözat

任务登记、任务更新BUG修复

lizhouming 7 ay önce
ebeveyn
işleme
aee2bc553c

+ 9 - 0
src/api/emergencyCommandMap/JointDuty.ts

@@ -94,6 +94,15 @@ export function getUnits(params) {
   });
   });
 }
 }
 
 
+// 获取用户信息(静态)
+export function getUser(params) {
+  return request({
+    url: '/system/user/getInfo',
+    method: 'get',
+    params: params
+  });
+}
+
 // 任务删除
 // 任务删除
 export function deleteTask(data) {
 export function deleteTask(data) {
   return request({
   return request({

+ 1 - 17
src/types/components.d.ts

@@ -17,10 +17,10 @@ declare module 'vue' {
     Dialog: typeof import('./../components/Dialog/index.vue')['default']
     Dialog: typeof import('./../components/Dialog/index.vue')['default']
     DictTag: typeof import('./../components/DictTag/index.vue')['default']
     DictTag: typeof import('./../components/DictTag/index.vue')['default']
     Editor: typeof import('./../components/Editor/index.vue')['default']
     Editor: typeof import('./../components/Editor/index.vue')['default']
+    ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
     ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
     ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
     ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
     ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
     ElButton: typeof import('element-plus/es')['ElButton']
     ElButton: typeof import('element-plus/es')['ElButton']
-    ElCard: typeof import('element-plus/es')['ElCard']
     ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
     ElCol: typeof import('element-plus/es')['ElCol']
     ElCol: typeof import('element-plus/es')['ElCol']
     ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
     ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
@@ -42,28 +42,17 @@ declare module 'vue' {
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElPagination: typeof import('element-plus/es')['ElPagination']
     ElPagination: typeof import('element-plus/es')['ElPagination']
-    ElPopover: typeof import('element-plus/es')['ElPopover']
-    ElRadio: typeof import('element-plus/es')['ElRadio']
-    ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
     ElRow: typeof import('element-plus/es')['ElRow']
     ElRow: typeof import('element-plus/es')['ElRow']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElSelect: typeof import('element-plus/es')['ElSelect']
     ElSelect: typeof import('element-plus/es')['ElSelect']
     ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
     ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
     ElSkeletonItem: typeof import('element-plus/es')['ElSkeletonItem']
     ElSkeletonItem: typeof import('element-plus/es')['ElSkeletonItem']
     ElSlider: typeof import('element-plus/es')['ElSlider']
     ElSlider: typeof import('element-plus/es')['ElSlider']
-    ElStep: typeof import('element-plus/es')['ElStep']
-    ElSteps: typeof import('element-plus/es')['ElSteps']
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElSwitch: typeof import('element-plus/es')['ElSwitch']
     ElSwitch: typeof import('element-plus/es')['ElSwitch']
-    ElTable: typeof import('element-plus/es')['ElTable']
-    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
-    ElTabPane: typeof import('element-plus/es')['ElTabPane']
-    ElTabs: typeof import('element-plus/es')['ElTabs']
     ElTimeline: typeof import('element-plus/es')['ElTimeline']
     ElTimeline: typeof import('element-plus/es')['ElTimeline']
     ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
     ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
-    ElTooltip: typeof import('element-plus/es')['ElTooltip']
     ElTree: typeof import('element-plus/es')['ElTree']
     ElTree: typeof import('element-plus/es')['ElTree']
-    ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
     FooterSection: typeof import('./../components/FooterSection/index.vue')['default']
     FooterSection: typeof import('./../components/FooterSection/index.vue')['default']
@@ -74,7 +63,6 @@ declare module 'vue' {
     HikvisionPlayer: typeof import('./../components/HKVideo/hikvision-player.vue')['default']
     HikvisionPlayer: typeof import('./../components/HKVideo/hikvision-player.vue')['default']
     HKVideo: typeof import('./../components/HKVideo/index.vue')['default']
     HKVideo: typeof import('./../components/HKVideo/index.vue')['default']
     IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
     IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
-    IEpUploadFilled: typeof import('~icons/ep/upload-filled')['default']
     IFrame: typeof import('./../components/iFrame/index.vue')['default']
     IFrame: typeof import('./../components/iFrame/index.vue')['default']
     ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
     ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
     ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']
     ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']
@@ -107,10 +95,6 @@ declare module 'vue' {
     VideoContainer: typeof import('./../components/HKVideo/video-container.vue')['default']
     VideoContainer: typeof import('./../components/HKVideo/video-container.vue')['default']
     VideoContainer2: typeof import('./../components/HKVideo/video-container2.vue')['default']
     VideoContainer2: typeof import('./../components/HKVideo/video-container2.vue')['default']
     YMap: typeof import('./../components/Map/YMap.vue')['default']
     YMap: typeof import('./../components/Map/YMap.vue')['default']
-    YMapold: typeof import('./../components/Map/YMapold.vue')['default']
     YztMap: typeof import('./../components/Map/YztMap/index.vue')['default']
     YztMap: typeof import('./../components/Map/YztMap/index.vue')['default']
   }
   }
-  export interface ComponentCustomProperties {
-    vLoading: typeof import('element-plus/es')['ElLoadingDirective']
-  }
 }
 }

+ 19 - 8
src/views/emergencyCommandMap/RightSection/RenWuDengJi.vue

@@ -5,12 +5,7 @@
       <div class="dialog-body">
       <div class="dialog-body">
         <el-form ref="taskFormRef" :model="newTask">
         <el-form ref="taskFormRef" :model="newTask">
           <el-form-item label="任务内容" label-width="200px">
           <el-form-item label="任务内容" label-width="200px">
-            <el-input
-              v-model="newTask.task_description"
-              class="custom-input2"
-              clearable
-              placeholder="请输入相关任务描述"
-            />
+            <el-input v-model="newTask.task_description" class="custom-input2" clearable placeholder="请输入相关任务描述" />
           </el-form-item>
           </el-form-item>
           <el-form-item label="执行单位" label-width="200px">
           <el-form-item label="执行单位" label-width="200px">
             <el-select
             <el-select
@@ -36,13 +31,13 @@
 
 
 <script lang="ts" setup>
 <script lang="ts" setup>
 import { ref, reactive, onMounted } from 'vue';
 import { ref, reactive, onMounted } from 'vue';
-import { addTask, getUnits } from '@/api/emergencyCommandMap/JointDuty.ts';
+import { addTask, getUnits, getUser } from '@/api/emergencyCommandMap/JointDuty.ts';
 
 
 const showRegisterDialog = ref(true);
 const showRegisterDialog = ref(true);
 const newTask = reactive({
 const newTask = reactive({
   task_description: '',
   task_description: '',
   unit_name: '',
   unit_name: '',
-  registrar: '当前用户'
+  registrar: ''
 });
 });
 const units = ref([]);
 const units = ref([]);
 
 
@@ -50,6 +45,21 @@ const props = defineProps<{
   eventId?: string;
   eventId?: string;
 }>();
 }>();
 
 
+// 获取当前登录用户信息
+const fetchUser = async () => {
+  try {
+    const response = await getUser();
+    if (response.code === 200) {
+      // 假设返回的用户信息中包含 username 字段
+      newTask.registrar = response.data.user.userName;
+    } else {
+      console.error('获取用户信息失败:', response.msg);
+    }
+  } catch (error) {
+    console.error('请求用户信息失败:', error);
+  }
+};
+
 const fetchUnits = async () => {
 const fetchUnits = async () => {
   try {
   try {
     const response = await getUnits();
     const response = await getUnits();
@@ -85,6 +95,7 @@ const confirmRegister = async () => {
 };
 };
 
 
 onMounted(() => {
 onMounted(() => {
+  fetchUser();
   fetchUnits();
   fetchUnits();
 });
 });
 </script>
 </script>

+ 10 - 5
src/views/emergencyCommandMap/RightSection/RenWuGengXin.vue

@@ -18,7 +18,13 @@
             </el-col>
             </el-col>
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item label="完成进度">
               <el-form-item label="完成进度">
-                <el-select v-model="newTask.processing_status" class="custom-select" size="large" :teleported="false" popper-class="custom-select-popper">
+                <el-select
+                  v-model="newTask.processing_status"
+                  class="custom-select"
+                  size="large"
+                  :teleported="false"
+                  popper-class="custom-select-popper"
+                >
                   <el-option v-for="unit in units" :key="unit" :label="unit" :value="unit"></el-option>
                   <el-option v-for="unit in units" :key="unit" :label="unit" :value="unit"></el-option>
                 </el-select>
                 </el-select>
               </el-form-item>
               </el-form-item>
@@ -43,7 +49,7 @@ import { updateTaskRegistration } from '@/api/emergencyCommandMap/JointDuty.ts';
 
 
 const props = defineProps({
 const props = defineProps({
   modelValue: { type: Boolean, required: true },
   modelValue: { type: Boolean, required: true },
-  task: { type: Object, default: () => ({ task_id: '', task_description: '', unit_name: '', registrar: '' }) },
+  task: { type: Object, default: () => ({ task_id: '', task_description: '', unit_name: '', registrar: '', processing_status: '' }) },
   eventId: { type: String, required: true }
   eventId: { type: String, required: true }
 });
 });
 
 
@@ -64,16 +70,16 @@ const resetForm = () => {
   newTask.task_description = '';
   newTask.task_description = '';
   newTask.unit_name = '';
   newTask.unit_name = '';
   newTask.registrar = '';
   newTask.registrar = '';
+  newTask.processing_status = '';
 };
 };
 
 
 // 任务进度更新
 // 任务进度更新
 const confirmRegister = async () => {
 const confirmRegister = async () => {
   console.log('任务进度更新:', newTask);
   console.log('任务进度更新:', newTask);
-  console.log('提交前的任务状态:', newTask.registrar);
   try {
   try {
     const response = await updateTaskRegistration({
     const response = await updateTaskRegistration({
       task_id: newTask.task_id,
       task_id: newTask.task_id,
-      processing_status: newTask.registrar,
+      processing_status: newTask.processing_status,
       event_code: props.eventId
       event_code: props.eventId
     });
     });
     if (response.code === 200) {
     if (response.code === 200) {
@@ -95,7 +101,6 @@ watch(
   () => props.task,
   () => props.task,
   (newTaskData) => {
   (newTaskData) => {
     Object.assign(newTask, newTaskData);
     Object.assign(newTask, newTaskData);
-    console.log('当前任务状态:', newTask.processing_status);
   },
   },
   { immediate: true }
   { immediate: true }
 );
 );