riku
2025-03-03 d31a24ca22ffc8638ca8711eb3ee1cf5bbdecf73
修复新增巡查子任务时,巡查人员信息没有正确录入的问题
已修改2个文件
已添加1个文件
101 ■■■■■ 文件已修改
src/api/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/scene/components/BaseSceneInfo.vue 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/fysp/task/TaskProxy.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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/';
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>
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('#')
    };