소스 검색

生产动态拆分

Zimo 3 일 전
부모
커밋
eeb54745e8

+ 2 - 2
android/simpleDemo/build.gradle

@@ -10,8 +10,8 @@ android {
         minSdkVersion 21
         // targetSdkVersion 33
         targetSdk 33
-        versionCode 10300
-        versionName "1.3.1"
+        versionCode 10302
+        versionName "1.3.2"
         multiDexEnabled true
         compileOptions {
             sourceCompatibility JavaVersion.VERSION_1_8

+ 79 - 4
pages/recordFilling/detail.vue

@@ -34,7 +34,22 @@
             <span>{{ params.createTime }}</span>
           </view>
         </view>
-        <view class="item-content flex-row align-center">
+        <view
+          v-if="deptName === 'ry'"
+          class="item-content flex-row align-center">
+          <view class="item-title full-cell flex-row align-center">
+            <span class="item-title-width">井号:</span>
+            <uni-data-select
+              :localdata="taskOptions"
+              style="text-align: right"
+              :styles="{ disableColor: '#fff' }"
+              :clear="false"
+              :disabled="!isView"
+              :placeholder="$t('operation.PleaseSelect')"
+              v-model="taskId"></uni-data-select>
+          </view>
+        </view>
+        <view v-else class="item-content flex-row align-center">
           <view class="item-title full-cell flex-row align-center">
             <span class="item-title-width">井号:</span>
             <span>{{ params.wellName || "" }}</span>
@@ -209,8 +224,19 @@
               </button>
             </uni-forms-item>
             <template v-for="(detail, index) in reportDetails" :key="index">
-              <uni-forms-item label="日期" style="margin-top: 32px">
-                <span>{{ params.createTime }}</span>
+              <uv-divider v-if="index !== 0" class="divider"></uv-divider>
+              <uni-forms-item
+                label="日期"
+                required
+                :name="['reportDetails', index, 'reportDate']"
+                :rules="[{ required: true, errorMessage: '请选择日期' }]">
+                <uni-datetime-picker
+                  class="datetime-picker"
+                  type="date"
+                  returnType="timestamp"
+                  v-model="detail.reportDate"
+                  :border="false"
+                  :disabled="!isView" />
               </uni-forms-item>
               <uni-forms-item :label="`${$t('ruiDu.timeNode')}:`" required>
                 <view
@@ -388,6 +414,9 @@ const addProductionStatusRow = () => {
     reportDetails.value = [];
   }
   reportDetails.value.push({
+    reportDate: params.createTime
+      ? dayjs(params.createTime).valueOf()
+      : dayjs().valueOf(),
     startTime: "08:00",
     endTime: "08:00",
     duration: 0,
@@ -406,6 +435,9 @@ const removeReportDetailRow = index => {
   reportDetails.value.splice(index, 1);
 };
 
+const taskId = ref(undefined);
+const taskOptions = ref([]);
+
 const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(
   list,
   val,
@@ -575,6 +607,17 @@ onLoad(async option => {
   if (params.value?.orderId) {
     const detail = (await getRecordFillingDetail(params.value.orderId)).data;
 
+    const daily = detail ?? {
+      wellNamePair: {},
+    };
+
+    taskOptions.value = Object.keys(daily.wellNamePair).map(key => ({
+      text: daily.wellNamePair[key],
+      value: Number(key),
+    }));
+
+    taskId.value = taskOptions.value[0]?.value || undefined;
+
     const data = await getDeptName(detail.deptId);
     console.log("data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", data);
     deptName.value = data.data;
@@ -981,11 +1024,13 @@ const queryList = (pageNo, pageSize) => {
 
       // 如果加载的数据中包含生产日报,应用累加值
       const hasReport = resList.some(item => item.deviceName === "生产日报");
+
       if (hasReport) {
         applyAccumulatedToReport();
 
         reportDetailsGet(params.value.orderId).then(res => {
           reportDetails.value = (res.data ?? []).map(item => ({
+            reportDate: item.reportDate ?? dayjs(params.createTime).valueOf(),
             startTime: formatT(item.startTime),
             endTime: formatT(item.endTime),
             duration: item.duration,
@@ -994,6 +1039,8 @@ const queryList = (pageNo, pageSize) => {
             constructionDetail: item.constructionDetail,
           }));
 
+          console.log("🚀 ~ reportDetails.value:", reportDetails.value);
+
           if (!reportDetails.value.length) {
             addProductionStatusRow();
           }
@@ -1605,7 +1652,10 @@ const submitData = async () => {
     // 3. 提交所有填写记录
     const reqData = {
       createReqVO: submitList,
-      reportDetails: reportDetails.value,
+      reportDetails: reportDetails.value.map(item => ({
+        ...item,
+        taskId: taskId.value,
+      })),
     };
 
     const res = await recordFillingDetailInsertDataList(reqData);
@@ -1881,4 +1931,29 @@ const submitData = async () => {
 :deep(.uni-easyinput__content-textarea) {
   margin: 0 !important;
 }
+
+.divider {
+  margin: 0;
+  transform: translateY(-2px);
+  :deep(.uv-line) {
+    border-width: 2px !important;
+    border-color: rgb(41, 121, 255) !important;
+  }
+}
+
+:deep(.datetime-picker) {
+  .uniui-calendar {
+    &::before {
+      display: none;
+    }
+  }
+
+  .uni-date-editor--x__disabled {
+    opacity: 1 !important;
+  }
+
+  .uni-date__x-input {
+    color: #333 !important;
+  }
+}
 </style>

+ 128 - 108
pages/ruiDu/approval.vue

@@ -1,106 +1,111 @@
 <script setup>
-  import { onLoad } from '@dcloudio/uni-app';
-  import { ref, getCurrentInstance } from 'vue';
-  // -------------------------- 引入api接口 start--------------------------
-  import { getRuiDuReportDetail, approveRdDailyReport } from '@/api/ruiDu.js';
-  // -------------------------- 引入api接口 end--------------------------
-  // --------------------------引入组件----------------------------------
-  import reportInfo from './compontents/report-info.vue';
-  import reportForm from './compontents/report-form.vue';
-  // --------------------------引用全局变量$t-------------------------------
-  const { appContext } = getCurrentInstance();
-  const t = appContext.config.globalProperties.$t;
-  // ----------------------------选项卡----------------------------------
-  // 选项卡标题
-  const tabTitles = ref([t('ruiDu.taskInfo'), t('ruiDu.reportInfo')]);
-  const currentTab = ref(0);
-  const styleType = ref('text');
-  const activeColor = ref('#004098');
-  const onClickTabItem = e => {
-    currentTab.value = e.currentIndex;
-  };
-  // --------------------------页面变量----------------------------------
-  // 报告ID
-  const reportId = ref('');
-  // 报告详情数据
-  const detailData = ref({});
-  // 表单组件ref
-  const reportFormEditRef = ref(null);
-  // --------------------------生命周期函数----------------------------------
-  onLoad(option => {
-    // 页面加载
-    reportId.value = option.id; // 获取页面参数
-    // 获取日报详情
-    getReportDetail();
-  });
-  // -------------------------- 页面方法 --------------------------
+import { onLoad } from "@dcloudio/uni-app";
+import { ref, getCurrentInstance } from "vue";
+// -------------------------- 引入api接口 start--------------------------
+import { getRuiDuReportDetail, approveRdDailyReport } from "@/api/ruiDu.js";
+// -------------------------- 引入api接口 end--------------------------
+// --------------------------引入组件----------------------------------
+import reportInfo from "./compontents/report-info.vue";
+import reportForm from "./compontents/report-form.vue";
+// --------------------------引用全局变量$t-------------------------------
+const { appContext } = getCurrentInstance();
+const t = appContext.config.globalProperties.$t;
+// ----------------------------选项卡----------------------------------
+// 选项卡标题
+const tabTitles = ref([t("ruiDu.taskInfo"), t("ruiDu.reportInfo")]);
+const currentTab = ref(0);
+const styleType = ref("text");
+const activeColor = ref("#004098");
+const onClickTabItem = e => {
+  currentTab.value = e.currentIndex;
+};
+// --------------------------页面变量----------------------------------
+// 报告ID
+const reportId = ref("");
+// 报告详情数据
+const detailData = ref({});
+// 表单组件ref
+const reportFormEditRef = ref(null);
+// --------------------------生命周期函数----------------------------------
+onLoad(option => {
+  // 页面加载
+  reportId.value = option.id; // 获取页面参数
   // 获取日报详情
-  const getReportDetail = () => {
-    getRuiDuReportDetail({ id: reportId.value })
-      .then(res => {
-        if (res.code === 0) {
-          detailData.value = Object.assign(detailData.value, res.data || {});
-          console.log('🚀 ~ getReportDetail ~ detailData.value:', detailData.value);
-        }
-      })
-      .catch(res => {});
-  };
+  getReportDetail();
+});
+// -------------------------- 页面方法 --------------------------
+// 获取日报详情
+const getReportDetail = () => {
+  getRuiDuReportDetail({ id: reportId.value })
+    .then(res => {
+      if (res.code === 0) {
+        detailData.value = Object.assign(detailData.value, res.data || {});
+        console.log(
+          "🚀 ~ getReportDetail ~ detailData.value:",
+          detailData.value
+        );
+      }
+    })
+    .catch(res => {});
+};
 
-  const infoRef = ref(null);
+const infoRef = ref(null);
 
-  const loading = ref(false);
+const loading = ref(false);
 
-  const handleApproval = async type => {
-    loading.value = true;
+const handleApproval = async type => {
+  loading.value = true;
 
-    try {
-      const data = {
-        attachments: detailData.value.attachments || [],
-        opinion: infoRef.value.approvalOpinion,
-        auditStatus: type === 'pass' ? 20 : 30,
-        companyId: detailData.value.companyId,
-        costCenter: detailData.value.costCenter || '',
-        dynamicFields: detailData.value.dynamicFields || {},
-        deptId: detailData.value.deptId,
-        deviceIds: detailData.value.deviceIds,
-        startTime: `${detailData.value.startTime[0].toString().padStart(2, '0')}:${detailData.value.startTime[1]
-          .toString()
-          .padStart(2, '0')}`,
-        endTime: `${detailData.value.endTime[0].toString().padStart(2, '0')}:${detailData.value.endTime[1]
-          .toString()
-          .padStart(2, '0')}`,
-        externalRental: detailData.value.externalRental,
-        faultDowntime: detailData.value.faultDowntime || '',
-        malfunction: detailData.value.malfunction,
-        nextPlan: detailData.value.nextPlan,
-        id: detailData.value.id,
-        ...(detailData.value.platformId ? { platformId: detailData.value.platformId } : {}),
-        platformWell: detailData.value.platformWell,
-        productionStatus: detailData.value.productionStatus,
-        projectDepartment: detailData.value.projectDepartment || '',
-        rdStatus: detailData.value.rdStatus,
-        techniqueIds: detailData.value.techniqueIds,
-        taskId: detailData.value.taskId,
-        timeRange: ['1970-01-01T00:00:00.008Z', '1970-01-01T00:00:00.008Z'],
-      };
+  try {
+    const data = {
+      attachments: detailData.value.attachments || [],
+      opinion: infoRef.value.approvalOpinion,
+      auditStatus: type === "pass" ? 20 : 30,
+      companyId: detailData.value.companyId,
+      costCenter: detailData.value.costCenter || "",
+      dynamicFields: detailData.value.dynamicFields || {},
+      deptId: detailData.value.deptId,
+      deviceIds: detailData.value.deviceIds,
+      startTime: `${detailData.value.startTime[0].toString().padStart(2, "0")}:${detailData.value.startTime[1]
+        .toString()
+        .padStart(2, "0")}`,
+      endTime: `${detailData.value.endTime[0].toString().padStart(2, "0")}:${detailData.value.endTime[1]
+        .toString()
+        .padStart(2, "0")}`,
+      externalRental: detailData.value.externalRental,
+      faultDowntime: detailData.value.faultDowntime || "",
+      malfunction: detailData.value.malfunction,
+      nextPlan: detailData.value.nextPlan,
+      id: detailData.value.id,
+      ...(detailData.value.platformId
+        ? { platformId: detailData.value.platformId }
+        : {}),
+      platformWell: detailData.value.platformWell,
+      productionStatus: detailData.value.productionStatus,
+      projectDepartment: detailData.value.projectDepartment || "",
+      rdStatus: detailData.value.rdStatus,
+      techniqueIds: detailData.value.techniqueIds,
+      taskId: detailData.value.taskId,
+      timeRange: ["1970-01-01T00:00:00.008Z", "1970-01-01T00:00:00.008Z"],
+    };
 
-      await approveRdDailyReport(data);
+    await approveRdDailyReport(data);
 
-      uni.showToast({
-        title: type === 'pass' ? '审批通过' : '审批驳回',
-        icon: 'success',
-      });
+    uni.showToast({
+      title: type === "pass" ? "审批通过" : "审批驳回",
+      icon: "success",
+    });
 
-      uni.reLaunch({ url: '/pages/home/index' });
-    } catch (error) {
-      console.log('🚀 ~ handleApproval ~ error:', error);
-      uni.showToast({ title: t('operation.failed'), icon: 'none' });
-    } finally {
-      loading.value = false;
-    }
-  };
+    uni.reLaunch({ url: "/pages/home/index" });
+  } catch (error) {
+    console.log("🚀 ~ handleApproval ~ error:", error);
+    uni.showToast({ title: t("operation.failed"), icon: "none" });
+  } finally {
+    loading.value = false;
+  }
+};
 
-  // -------------------------- 页面方法 end --------------------------
+// -------------------------- 页面方法 end --------------------------
 </script>
 
 <template>
@@ -125,16 +130,31 @@
       </view>
       <!-- 保养项列表 -->
       <view class="work-order-bom-list" v-show="currentTab === 1">
-        <report-form ref="reportFormEditRef" :report-id="reportId" :report-data="detailData" :form-disable="true" />
+        <report-form
+          ref="reportFormEditRef"
+          :report-id="reportId"
+          :report-data="detailData"
+          :form-disable="true"
+          type="approval" />
       </view>
     </scroll-view>
 
     <view class="segmented-footer" v-if="detailData.auditStatus === 10">
       <view class="footer-btn">
-        <button :disabled="loading" :loading="loading" class="mini-btn" type="primary" @click="handleApproval('pass')">
+        <button
+          :disabled="loading"
+          :loading="loading"
+          class="mini-btn"
+          type="primary"
+          @click="handleApproval('pass')">
           审批通过
         </button>
-        <button :disabled="loading" :loading="loading" class="mini-btn" type="warn" @click="handleApproval('reject')">
+        <button
+          :disabled="loading"
+          :loading="loading"
+          class="mini-btn"
+          type="warn"
+          @click="handleApproval('reject')">
           审批驳回
         </button>
       </view>
@@ -143,20 +163,20 @@
 </template>
 
 <style lang="scss" scoped>
-  @import '@/style/work-order-segmented.scss';
-  .page {
-    padding-bottom: 0;
-  }
+@import "@/style/work-order-segmented.scss";
+.page {
+  padding-bottom: 0;
+}
 
-  .footer-btn {
-    display: flex;
-    justify-content: flex-end;
-    padding: 0 32px;
+.footer-btn {
+  display: flex;
+  justify-content: flex-end;
+  padding: 0 32px;
 
-    gap: 0 32px;
+  gap: 0 32px;
 
-    & > uni-button {
-      margin: 0;
-    }
+  & > uni-button {
+    margin: 0;
   }
+}
 </style>

+ 20 - 3
pages/ruiDu/compontents/report-form.vue

@@ -95,6 +95,10 @@ const props = defineProps({
     type: Boolean,
     default: false, // 是否禁用表单
   },
+  type: {
+    type: String,
+    default: "edit",
+  },
 });
 
 const isRequired = computed(() => {
@@ -483,6 +487,8 @@ const formDataFormat = () => {
     };
   }
 
+  form.constructionBrief = props.reportData.constructionBrief || ""; // 施工简介
+
   form.reportDetails = (props.reportData.reportDetails || []).map(item => ({
     duration: item.duration || 0,
     constructionDetail: item.constructionDetail || "",
@@ -1303,7 +1309,7 @@ watch(
             :maxlength="1000" />
         </uni-forms-item>
         <uni-forms-item
-          v-if="istime === 'true'"
+          v-if="type !== 'edit' || istime === 'true'"
           class="form-item"
           label="当日施工简报"
           required
@@ -1311,6 +1317,7 @@ watch(
           <uni-easyinput
             class="digit-item"
             type="textarea"
+            :autoHeight="true"
             :inputBorder="false"
             :clearable="true"
             :styles="{ disableColor: '#fff' }"
@@ -1345,8 +1352,8 @@ watch(
                   type="primary"
                   size="mini"
                   class="file-picker-btn"
-                  >删除文件</button
-                >
+                  >删除文件
+                </button>
               </view>
             </view>
           </view>
@@ -1381,6 +1388,7 @@ watch(
         </div>
 
         <template v-for="(item, index) in form.reportDetails" :key="index">
+          <uv-divider v-if="index !== 0" class="divider"></uv-divider>
           <uni-forms-item class="form-item" label="日期">
             <uni-easyinput
               class="digit-item"
@@ -1871,4 +1879,13 @@ watch(
   margin-left: auto;
   float: right;
 }
+
+.divider {
+  margin: 0;
+  transform: translateY(-1px);
+  :deep(.uv-line) {
+    border-width: 2px !important;
+    border-color: rgb(41, 121, 255) !important;
+  }
+}
 </style>

+ 14 - 21
pages/ruiDu/detail.vue

@@ -6,8 +6,7 @@
         :values="tabTitles"
         :style-type="styleType"
         :active-color="activeColor"
-        @clickItem="onClickTabItem"
-      />
+        @clickItem="onClickTabItem" />
     </view>
     <scroll-view scroll-y="true" class="segmented-content">
       <!-- 工单信息 -->
@@ -16,23 +15,19 @@
       </view>
       <!-- 保养项列表 -->
       <view class="work-order-bom-list" v-show="currentTab === 1">
-        <report-form ref="reportFormEditRef" :report-id="reportId" :report-data="detailData" :form-disable="true" />
+        <report-form
+          ref="reportFormEditRef"
+          :report-id="reportId"
+          :report-data="detailData"
+          :form-disable="true"
+          type="detail" />
       </view>
     </scroll-view>
   </view>
 </template>
 <script setup>
-import { onLoad, onReady, onBackPress } from "@dcloudio/uni-app";
-import {
-  reactive,
-  ref,
-  onMounted,
-  onBeforeUnmount,
-  nextTick,
-  getCurrentInstance,
-  watch,
-} from "vue";
-import dayjs from "dayjs";
+import { onLoad } from "@dcloudio/uni-app";
+import { ref, getCurrentInstance } from "vue";
 // -------------------------- 引入api接口 start--------------------------
 import { getRuiDuReportDetail } from "@/api/ruiDu.js";
 // -------------------------- 引入api接口 end--------------------------
@@ -48,7 +43,7 @@ const tabTitles = ref([t("ruiDu.taskInfo"), t("ruiDu.reportInfo")]);
 const currentTab = ref(0);
 const styleType = ref("text");
 const activeColor = ref("#004098");
-const onClickTabItem = (e) => {
+const onClickTabItem = e => {
   currentTab.value = e.currentIndex;
 };
 // --------------------------页面变量----------------------------------
@@ -59,7 +54,7 @@ const detailData = ref({});
 // 表单组件ref
 const reportFormEditRef = ref(null);
 // --------------------------生命周期函数----------------------------------
-onLoad((option) => {
+onLoad(option => {
   // 页面加载
   reportId.value = option.id; // 获取页面参数
   // 获取日报详情
@@ -69,7 +64,7 @@ onLoad((option) => {
 // 获取日报详情
 const getReportDetail = () => {
   getRuiDuReportDetail({ id: reportId.value })
-    .then((res) => {
+    .then(res => {
       if (res.code === 0) {
         detailData.value = Object.assign(detailData.value, res.data || {});
         console.log(
@@ -78,11 +73,9 @@ const getReportDetail = () => {
         );
       }
     })
-    .catch((res) => {});
+    .catch(res => {});
 };
 
-
-
 // -------------------------- 页面方法 end --------------------------
 </script>
 
@@ -91,7 +84,7 @@ const getReportDetail = () => {
 .page {
   padding-bottom: 0;
 }
-.segmented-content{
+.segmented-content {
   height: calc(100% - 45px - 20px);
 }
 </style>

+ 59 - 56
pages/ruiDu/edit.vue

@@ -19,7 +19,8 @@
           ref="reportFormEditRef"
           :report-id="reportId"
           :report-data="detailData"
-          :form-disable="detailData.status !== 0" />
+          :form-disable="detailData.status !== 0"
+          type="edit" />
       </view>
       <!-- <view class="work-order-bom-list" v-if="currentTab === 2">
         <report-form-copy ref="reportFormEditRef" :report-id="reportId" :report-data="detailData" />
@@ -34,8 +35,10 @@
               class="mini-btn"
               type="primary"
               @click="save"
-              :disabled="detailData.status !== 0 && detailData.auditStatus !== 20">
-              {{ t('operation.save') }}
+              :disabled="
+                detailData.status !== 0 && detailData.auditStatus !== 20
+              ">
+              {{ t("operation.save") }}
             </button>
           </view>
         </uni-col>
@@ -44,62 +47,62 @@
   </view>
 </template>
 <script setup>
-  import { onLoad } from '@dcloudio/uni-app';
-  import { ref, getCurrentInstance } from 'vue';
-  // -------------------------- 引入api接口 start--------------------------
-  import { getRuiDuReportDetail } from '@/api/ruiDu.js';
-  // -------------------------- 引入api接口 end--------------------------
-  // --------------------------引入组件----------------------------------
-  import reportInfo from './compontents/report-info.vue';
-  import reportForm from './compontents/report-form.vue';
-  // --------------------------引用全局变量$t-------------------------------
-  const { appContext } = getCurrentInstance();
-  const t = appContext.config.globalProperties.$t;
-  // ----------------------------选项卡----------------------------------
-  // 选项卡标题
-  const tabTitles = ref([t('ruiDu.taskInfo'), t('ruiDu.reportInfo')]);
-  const currentTab = ref(0);
-  const styleType = ref('text');
-  const activeColor = ref('#004098');
-  const onClickTabItem = e => {
-    currentTab.value = e.currentIndex;
-  };
-  // --------------------------页面变量----------------------------------
-  // 报告ID
-  const reportId = ref('');
-  // 报告详情数据
-  const detailData = ref({});
-  // 表单组件ref
-  const reportFormEditRef = ref(null);
-  // --------------------------生命周期函数----------------------------------
-  onLoad(option => {
-    // 页面加载
-    reportId.value = option.id; // 获取页面参数
-    // 获取日报详情
-    getReportDetail();
-  });
-  // -------------------------- 页面方法 --------------------------
+import { onLoad } from "@dcloudio/uni-app";
+import { ref, getCurrentInstance } from "vue";
+// -------------------------- 引入api接口 start--------------------------
+import { getRuiDuReportDetail } from "@/api/ruiDu.js";
+// -------------------------- 引入api接口 end--------------------------
+// --------------------------引入组件----------------------------------
+import reportInfo from "./compontents/report-info.vue";
+import reportForm from "./compontents/report-form.vue";
+// --------------------------引用全局变量$t-------------------------------
+const { appContext } = getCurrentInstance();
+const t = appContext.config.globalProperties.$t;
+// ----------------------------选项卡----------------------------------
+// 选项卡标题
+const tabTitles = ref([t("ruiDu.taskInfo"), t("ruiDu.reportInfo")]);
+const currentTab = ref(0);
+const styleType = ref("text");
+const activeColor = ref("#004098");
+const onClickTabItem = e => {
+  currentTab.value = e.currentIndex;
+};
+// --------------------------页面变量----------------------------------
+// 报告ID
+const reportId = ref("");
+// 报告详情数据
+const detailData = ref({});
+// 表单组件ref
+const reportFormEditRef = ref(null);
+// --------------------------生命周期函数----------------------------------
+onLoad(option => {
+  // 页面加载
+  reportId.value = option.id; // 获取页面参数
   // 获取日报详情
-  const getReportDetail = () => {
-    getRuiDuReportDetail({ id: reportId.value })
-      .then(res => {
-        if (res.code === 0) {
-          detailData.value = Object.assign(detailData.value, res.data || {});
-        }
-      })
-      .catch(res => {});
-  };
-  // 保存
-  const save = () => {
-    reportFormEditRef.value.submitForm();
-  };
+  getReportDetail();
+});
+// -------------------------- 页面方法 --------------------------
+// 获取日报详情
+const getReportDetail = () => {
+  getRuiDuReportDetail({ id: reportId.value })
+    .then(res => {
+      if (res.code === 0) {
+        detailData.value = Object.assign(detailData.value, res.data || {});
+      }
+    })
+    .catch(res => {});
+};
+// 保存
+const save = () => {
+  reportFormEditRef.value.submitForm();
+};
 
-  // -------------------------- 页面方法 end --------------------------
+// -------------------------- 页面方法 end --------------------------
 </script>
 
 <style lang="scss" scoped>
-  @import '@/style/work-order-segmented.scss';
-  .page {
-    padding-bottom: 0;
-  }
+@import "@/style/work-order-segmented.scss";
+.page {
+  padding-bottom: 0;
+}
 </style>

+ 47 - 8
pages/ruiying/components/form.vue

@@ -115,6 +115,7 @@ async function loadDetail(id) {
     });
 
     form.value.reportDetails = form.value.reportDetails.map(item => ({
+      reportDate: item.reportDate || form.value.createTime,
       duration: item.duration || 0,
       constructionDetail: item.constructionDetail || "",
       currentDepth: item.currentDepth || 0,
@@ -149,6 +150,7 @@ const addReportDetailRow = () => {
     form.value.reportDetails = [];
   }
   form.value.reportDetails.push({
+    reportDate: form.value.createTime ?? dayjs().valueOf(),
     startTime: "08:00",
     endTime: "08:00",
     duration: 0,
@@ -268,7 +270,12 @@ const rules = reactive({
     ],
   },
   constructionBrief: {
-    rules: [{ required: true, errorMessage: `请输入当日施工简报` }],
+    rules: [
+      {
+        required: props.type === "approval",
+        errorMessage: `请输入当日施工简报`,
+      },
+    ],
   },
 });
 
@@ -489,15 +496,14 @@ const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(val, index) {
           :maxlength="1000" />
       </uni-forms-item> -->
       <uni-forms-item
-        v-if="props.type === 'approval' || props.type === 'approval-detail'"
         label="当日施工简报"
-        required
+        :required="type === 'approval'"
         name="constructionBrief">
         <uni-easyinput
           type="textarea"
           autoHeight
           v-bind="defaultProps"
-          :disabled="disabled('approval')"
+          :disabled="type !== 'approval'"
           v-model="form.constructionBrief"
           :maxlength="2000" />
       </uni-forms-item>
@@ -522,10 +528,19 @@ const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(val, index) {
         </button>
       </uni-forms-item>
       <template v-for="(item, index) in form.reportDetails" :key="index">
-        <uni-forms-item label="日期" style="margin-top: 32px">
-          <span class="readOnly">{{
-            dayjs(form.createTime).format("YYYY-MM-DD")
-          }}</span>
+        <uv-divider v-if="index !== 0" class="divider"></uv-divider>
+        <uni-forms-item
+          label="日期"
+          required
+          :name="['reportDetails', index, 'reportDate']"
+          :rules="[{ required: true, errorMessage: '请选择日期' }]">
+          <uni-datetime-picker
+            class="datetime-picker"
+            type="date"
+            returnType="timestamp"
+            v-model="item.reportDate"
+            :border="false"
+            :disabled="disabled('edit')" />
         </uni-forms-item>
         <uni-forms-item :label="`${$t('ruiDu.timeNode')}:`" required>
           <view
@@ -831,4 +846,28 @@ const inputCurrentDepth = useDebounceFn(function inputCurrentDepth(val, index) {
   align-items: center;
   justify-content: end;
 }
+.divider {
+  margin: 0;
+  transform: translateY(-7px);
+  :deep(.uv-line) {
+    border-width: 2px !important;
+    border-color: rgb(41, 121, 255) !important;
+  }
+}
+
+:deep(.datetime-picker) {
+  .uniui-calendar {
+    &::before {
+      display: none;
+    }
+  }
+
+  .uni-date-editor--x__disabled {
+    opacity: 1 !important;
+  }
+
+  .uni-date__x-input {
+    color: #333 !important;
+  }
+}
 </style>

+ 32 - 8
pages/ruiyingx/components/form.vue

@@ -109,6 +109,7 @@ async function loadDetail(id) {
     });
 
     form.value.reportDetails = form.value.reportDetails.map(item => ({
+      reportDate: item.reportDate || form.value.createTime,
       duration: item.duration || 0,
       constructionDetail: item.constructionDetail || "",
       currentOperation: item.currentOperation || "",
@@ -142,6 +143,7 @@ const addReportDetailRow = () => {
     form.value.reportDetails = [];
   }
   form.value.reportDetails.push({
+    reportDate: form.value.createTime ?? dayjs().valueOf(),
     startTime: "08:00",
     endTime: "08:00",
     duration: 0,
@@ -279,7 +281,12 @@ const rules = reactive({
     ],
   },
   constructionBrief: {
-    rules: [{ required: true, errorMessage: `请输入当日施工简报` }],
+    rules: [
+      {
+        required: props.type === "approval",
+        errorMessage: `请输入当日施工简报`,
+      },
+    ],
   },
 });
 
@@ -510,15 +517,14 @@ const reportDetailsTimeRange = data => {
           :maxlength="1000" />
       </uni-forms-item> -->
       <uni-forms-item
-        v-if="props.type === 'approval' || props.type === 'approval-detail'"
         label="当日施工简报"
-        required
+        :required="type === 'approval'"
         name="constructionBrief">
         <uni-easyinput
           type="textarea"
           autoHeight
           v-bind="defaultProps"
-          :disabled="disabled('approval')"
+          :disabled="type !== 'approval'"
           v-model="form.constructionBrief"
           :maxlength="2000" />
       </uni-forms-item>
@@ -563,10 +569,19 @@ const reportDetailsTimeRange = data => {
         </button>
       </uni-forms-item>
       <template v-for="(item, index) in form.reportDetails" :key="index">
-        <uni-forms-item label="日期" style="margin-top: 32px">
-          <span class="readOnly">{{
-            dayjs(form.createTime).format("YYYY-MM-DD")
-          }}</span>
+        <uv-divider v-if="index !== 0" class="divider"></uv-divider>
+        <uni-forms-item
+          label="日期"
+          required
+          :name="['reportDetails', index, 'reportDate']"
+          :rules="[{ required: true, errorMessage: '请选择日期' }]">
+          <uni-datetime-picker
+            class="datetime-picker"
+            type="date"
+            returnType="timestamp"
+            v-model="item.reportDate"
+            :border="false"
+            :disabled="disabled('edit')" />
         </uni-forms-item>
         <uni-forms-item :label="`${$t('ruiDu.timeNode')}:`" required>
           <view
@@ -837,4 +852,13 @@ const reportDetailsTimeRange = data => {
     color: rgb(75 85 99);
   }
 }
+
+.divider {
+  margin: 0;
+  transform: translateY(-7px);
+  :deep(.uv-line) {
+    border-width: 2px !important;
+    border-color: rgb(41, 121, 255) !important;
+  }
+}
 </style>