From f5052fa7d4e73c0df5a02a6ad8987f35df42b8f8 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 07 十一月 2024 17:23:50 +0800
Subject: [PATCH] 1. 完成场景报告模块 2. 日报管理模块添加时间范围选择以及word报告生成

---
 src/views/fysp/scene/CompSceneConstructionInfo.vue |   70 +++++++++++++++++++++++++++++-----
 1 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/src/views/fysp/scene/CompSceneConstructionInfo.vue b/src/views/fysp/scene/CompSceneConstructionInfo.vue
index 6d2c70f..65d98bd 100644
--- a/src/views/fysp/scene/CompSceneConstructionInfo.vue
+++ b/src/views/fysp/scene/CompSceneConstructionInfo.vue
@@ -1,7 +1,7 @@
 <!-- 宸ュ湴涓撳睘淇℃伅缂栬緫 -->
 <template>
   <el-form
-    v-if="showStyle == 'form'"
+    v-show="showStyle == 'form'"
     :inline="false"
     :model="formObj"
     ref="formRef"
@@ -164,7 +164,7 @@
   </el-form>
 
   <el-descriptions
-    v-else-if="showStyle == 'descriptions'"
+    v-show="showStyle == 'descriptions'"
     :column="2"
     :size="fontSize"
     direction="horizontal"
@@ -175,14 +175,17 @@
     </template>
     <template #extra>
       <el-button
+        :disabled="!edit && !ignoreEdit"
         :size="fontSize"
-        :disabled="!edit"
         type="primary"
         @click="onSubmit"
         :loading="loading"
         >鎻愪氦</el-button
       >
-      <el-button :size="fontSize" :disabled="!edit" @click="onReset"
+      <el-button
+        :size="fontSize"
+        :disabled="!edit && !ignoreEdit"
+        @click="onReset"
         >閲嶇疆</el-button
       >
     </template>
@@ -237,7 +240,7 @@
     <el-descriptions-item label="鏂藉伐鍦板潃" span="2"
       ><el-input
         clearable
-        v-model="formObj.location"
+        v-model="sceneObj.location"
         placeholder="鏂藉伐鍦板潃"
         :size="fontSize"
     /></el-descriptions-item>
@@ -271,6 +274,25 @@
         <template #append>銕�</template>
       </el-input></el-descriptions-item
     >
+    <el-descriptions-item label="椤圭洰璐熻矗浜�"
+      ><el-input
+        :size="fontSize"
+        clearable
+        v-model="sceneObj.contacts"
+        placeholder="椤圭洰璐熻矗浜�"
+    /></el-descriptions-item>
+    <el-descriptions-item label="椤圭洰璐熻矗浜虹數璇�"
+      ><el-input
+        :size="fontSize"
+        clearable
+        type="tel"
+        v-model="sceneObj.contactst"
+        placeholder="椤圭洰璐熻矗浜虹數璇�"
+      >
+        <template #prepend>
+          <el-icon><Iphone /></el-icon>
+        </template> </el-input
+    ></el-descriptions-item>
     <el-descriptions-item label="瀹夊叏鍛�"
       ><el-input
         :size="fontSize"
@@ -342,7 +364,7 @@
 </template>
 
 <script setup>
-import { defineProps, defineEmits, reactive, ref, watch } from 'vue';
+import { reactive, ref, watch, computed } from 'vue';
 import { useDateFormat } from '@vueuse/core';
 import { enumStatusNA, enumStageNA } from '@/enum/construction';
 import sceneApi from '@/api/fysp/sceneApi';
@@ -366,8 +388,14 @@
   title: String
 });
 const fontSize = ref('small');
-const emit = defineEmits(['onSubmit', 'onCancel']);
+const emit = defineEmits([
+  'onSubmit',
+  'onCancel',
+  'update:scene',
+  'update:formInfo'
+]);
 
+const sceneObj = ref({});
 const { formObj, formRef, edit, onSubmit, onReset } = useFormConfirm({
   submit: {
     do: submit
@@ -376,6 +404,8 @@
     do: cancel
   }
 });
+const ignoreEdit = computed(() => props.showStyle == 'descriptions');
+
 const loading = ref(false);
 const status = reactive(enumStatusNA());
 const stage = reactive(enumStageNA());
@@ -404,7 +434,7 @@
 });
 
 // 鍒涘缓鎴栨洿鏂板満鏅鎯�
-function createOrupdateScene() {
+function createOrupdateSubScene() {
   loading.value = true;
 
   if (formObj.value._timeRange && formObj.value._timeRange.length == 2) {
@@ -415,6 +445,8 @@
   return sceneApi
     .updateSubScene(props.sceneType, formObj.value)
     .then((res) => {
+      emit('onSubmit', formObj);
+      emit('update:formInfo', formObj);
       return res.data;
     })
     .finally(() => {
@@ -422,10 +454,16 @@
     });
 }
 
-function submit() {
-  emit('onSubmit', formObj);
+// 鏇存柊鍦烘櫙
+function updateScene() {
+  return sceneApi.updateScene(sceneObj.value).then(() => {
+    emit('update:scene', sceneObj);
+  });
+}
 
-  return createOrupdateScene();
+function submit() {
+  updateScene();
+  return createOrupdateSubScene();
 }
 
 function cancel() {
@@ -445,6 +483,16 @@
   },
   { deep: false, immediate: true }
 );
+
+watch(
+  () => props.scene,
+  (nValue) => {
+    if (nValue) {
+      sceneObj.value = nValue;
+    }
+  },
+  { deep: false, immediate: true }
+);
 </script>
 
 <style>

--
Gitblit v1.9.3