From d31a24ca22ffc8638ca8711eb3ee1cf5bbdecf73 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 03 三月 2025 16:36:55 +0800
Subject: [PATCH] 修复新增巡查子任务时,巡查人员信息没有正确录入的问题

---
 src/views/fysp/task/TaskProxy.js                  |    8 ++--
 src/api/index.js                                  |    2 
 src/views/fysp/scene/components/BaseSceneInfo.vue |   91 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 5 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 22e0559..69fae9f 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -11,7 +11,7 @@
 let ip2_file = 'https://fyami.com.cn/';
 
 if (debug) {
-  ip1 = 'http://192.168.0.138:9001/';
+  ip1 = 'http://192.168.0.110:9001/';
   // ip1_file = 'http://192.168.0.138:8080/';
   // ip2 = 'http://192.168.0.138:8080/';
   // ip2_file = 'https://fyami.com.cn/';
diff --git a/src/views/fysp/scene/components/BaseSceneInfo.vue b/src/views/fysp/scene/components/BaseSceneInfo.vue
new file mode 100644
index 0000000..ed621bd
--- /dev/null
+++ b/src/views/fysp/scene/components/BaseSceneInfo.vue
@@ -0,0 +1,91 @@
+<template>
+  <slot name="form-items"></slot>
+  <slot name="description-items"></slot>
+</template>
+<script setup>
+import { reactive, ref, watch, computed } from 'vue';
+import { useDateFormat } from '@vueuse/core';
+import sceneApi from '@/api/fysp/sceneApi';
+expose({
+  submit
+});
+const props = defineProps({
+  scene: Object,
+  //宸ュ湴棰濆淇℃伅
+  formInfo: Object,
+  //鍦烘櫙绫诲瀷锛氬伐鍦�
+  sceneType: {
+    type: Number,
+    default: 1
+  },
+});
+const emit = defineEmits([
+  'onSubmit',
+  'onCancel',
+  'update:scene',
+  'update:formInfo'
+]);
+const loading = ref(false);
+const formObj = ref({});
+const sceneObj = ref({});
+// 鍒涘缓鎴栨洿鏂板満鏅鎯�
+function createOrupdateSubScene() {
+  loading.value = true;
+
+  if (formObj.value._timeRange && formObj.value._timeRange.length == 2) {
+    const t = formObj.value._timeRange;
+    formObj.value.csStartTime = useDateFormat(t[0], 'YYYY-MM-DD');
+    formObj.value.csEndTime = useDateFormat(t[1], 'YYYY-MM-DD');
+  }
+  return sceneApi
+    .updateSubScene(props.sceneType, formObj.value)
+    .then((res) => {
+      emit('onSubmit', formObj);
+      emit('update:formInfo', formObj);
+      return res.data;
+    })
+    .finally(() => {
+      loading.value = false;
+    });
+}
+
+// 鏇存柊鍦烘櫙
+function updateScene() {
+  return sceneApi.updateScene(sceneObj.value).then(() => {
+    emit('update:scene', sceneObj);
+  });
+}
+
+function submit() {
+  updateScene();
+  return createOrupdateSubScene();
+}
+
+function cancel() {
+  emit('onCancel');
+}
+
+watch(
+  () => props.formInfo,
+  (nValue) => {
+    if (nValue) {
+      formObj.value = nValue;
+      formObj.value._timeRange = [
+        new Date(formObj.value.csStartTime),
+        new Date(formObj.value.csEndTime)
+      ];
+    }
+  },
+  { deep: false, immediate: true }
+);
+
+watch(
+  () => props.scene,
+  (nValue) => {
+    if (nValue) {
+      sceneObj.value = nValue;
+    }
+  },
+  { deep: false, immediate: true }
+);
+</script>
diff --git a/src/views/fysp/task/TaskProxy.js b/src/views/fysp/task/TaskProxy.js
index 7433661..4fcca0b 100644
--- a/src/views/fysp/task/TaskProxy.js
+++ b/src/views/fysp/task/TaskProxy.js
@@ -17,13 +17,13 @@
     executorOptions.forEach((e) => {
       const index = data.indexOf(e.value);
       if (index != -1) {
-        ids.push(e.data.guid);
-        uNames.push(e.data.acountname);
-        rNames.push(e.data.realname);
+        ids.push(e.data.id);
+        uNames.push(e.data.userName);
+        rNames.push(e.data.realName);
       }
     });
     return {
-      id: ids.join('#'),
+      ids: ids.join('#'),
       uName: uNames.join('#'),
       rName: rNames.join('#')
     };

--
Gitblit v1.9.3