Lijy пре 1 година
родитељ
комит
34d14fbeba

+ 3 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/business/index.vue

@@ -127,6 +127,7 @@ import { GETSYSFILED, MOD, GETPERSONNEL, GETGENERATEFOEM, GETBUSINESSLIST, UPDAT
 import { GETTABLELIST } from '@/pages/product/api'
 import { post, get } from "@/utils/request";
 import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate } from '@/utils/tools'
+import { formatDateTime } from '@/utils/times'
 import { GenerateForm } from '@zmjs/form-design';
 import RelatedProducts from './component/relatedProducts.vue'
 
@@ -178,8 +179,8 @@ function editBusiness(visibles: boolean) {
     let productTableListData = relatedProductsRef?.value?.returnData()
     let newForm = {
       ...res,
-      expectedTransactionDate: res.expectedTransactionDate ? formatDate(new Date(res.expectedTransactionDate)) : '',
-      // businessItemProductList: productTableListData ? JSON.stringify(productTableListData) : []
+      expectedTransactionDate: res.expectedTransactionDate ? formatDateTime(new Date(res.expectedTransactionDate)) : '',
+      businessItemProductList: productTableListData ? JSON.stringify(productTableListData) : []
     }
     allLoading.businessSaveLading = true
     post(UPDATEINSET, { ...newForm }).then((_res) => {

+ 15 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/utils/times.ts

@@ -29,3 +29,18 @@ export function formatDate(date: Date) {
   const day = date.getDate().toString().padStart(2, "0");
   return `${year}-${month}-${day}`;
 }
+
+/**
+ * 将 Date 对象格式化为 "YYYY-MM-DD HH:mm:ss" 的形式
+ * @param date 日期 new Date()
+ * @returns
+ */
+export function formatDateTime(date: Date) {
+  const year = date.getFullYear();
+  const month = (1 + date.getMonth()).toString().padStart(2, "0");
+  const day = date.getDate().toString().padStart(2, "0");
+  const hour = date.getHours().toString().padStart(2, "0");
+  const minute = date.getMinutes().toString().padStart(2, "0");
+  const second = date.getSeconds().toString().padStart(2, "0");
+  return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
+}