Explorar o código

Merge remote-tracking branch 'origin/master'

yusm hai 1 mes
pai
achega
be5682f7f9

+ 26 - 11
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/tasks/detail.vue

@@ -64,9 +64,15 @@
       </div>
     </van-popup>
 
+    <!-- 选择日期 -->
     <van-popup v-model:show="showDatePicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
       <van-date-picker v-model="showDatePickerVal" @confirm="showPickerConfirm" :min-date="timeJudgment" @cancel="showDatePicker = false" />
     </van-popup>
+
+    <!-- 选择时间 -->
+    <van-popup v-model:show="showDateTimePicker" destroy-on-close position="bottom" :style="{ height: '50%' }">
+      <van-time-picker v-model="showDatePickerTimeVal" @confirm="showPickerTimeConfirm" @cancel="showDateTimePicker = false" />
+    </van-popup>
   </div>
 </template>
 
@@ -99,8 +105,10 @@ const routingInformation = routingInfos['tasks']
 const infoData = ref(props.info);
 const timeout = ref(null);
 const showDelay = ref(false);
-const showDatePicker = ref(false);
-const showDatePickerVal = ref([])
+const showDatePicker = ref(false)
+const showDateTimePicker = ref(false)
+const showDatePickerVal = ref(dayjs().format("YYYY-MM-DD").split("-"))
+const showDatePickerTimeVal = ref(dayjs().format("HH:mm").split(":"))
 const todaySDate = dayjs(new Date()).format('YYYY-MM-DD')
 const showStartDelayData = ref('');
 const showEndtDelayData = ref('');
@@ -114,32 +122,39 @@ watch(() => props.info, (newValue) => {
   initializeData(newValue.id)
 })
 
-function showPickerConfirm({ selectedValues }) {
-  const dates = selectedValues.join('-')
+function showPickerTimeConfirm({ selectedValues }) {
   if(showDateType.value == 'showStartDelayData') {
-    showStartDelayData.value = dates
+    showStartDelayData.value = `${showDatePickerVal.value.join('-')} ${selectedValues.join(':')}` 
     showEndtDelayData.value = ''
   }
 
   if(showDateType.value == 'showEndtDelayData') {
-    showEndtDelayData.value = dates
+    showEndtDelayData.value = `${showDatePickerVal.value.join('-')} ${selectedValues.join(':')}` 
   }
-  console.log(showStartDelayData.value)
-  console.log(showEndtDelayData.value)
+
+  showDateTimePicker.value = false
+}
+
+function showPickerConfirm({ selectedValues }) {
   showDatePicker.value = false
+  showDateTimePicker.value = true
 }
 
 function showDatePickerCli(type) {
   showDateType.value = type
   const types = type == 'showStartDelayData' ? showStartDelayData.value : showEndtDelayData.value
   timeJudgment.value = type == 'showStartDelayData' ? new Date : new Date(showStartDelayData.value)
-  showDatePickerVal.value = types.split('-')
+
+  const nemDate = dayjs().format("YYYY-MM-DD HH:mm")
+
+  showDatePickerVal.value = types ? types.split(' ')[0].split('-') : nemDate.split(' ')[0].split('-')
+  showDatePickerTimeVal.value = types ? types.split(' ')[1].split(':') : nemDate.split(' ')[1].split(':')
   showDatePicker.value = true
 }
 
 function restartTask() {
-  showStartDelayData.value = infoData.value.startDate ? infoData.value.startDate : dayjs().format("YYYY-MM-DD")
-  showEndtDelayData.value = infoData.value.endDate ? infoData.value.endDate : dayjs().format("YYYY-MM-DD")
+  showStartDelayData.value = infoData.value.startDate ? infoData.value.startDate : dayjs().format("YYYY-MM-DD HH:mm")
+  showEndtDelayData.value = infoData.value.endDate ? infoData.value.endDate : dayjs().format("YYYY-MM-DD HH:mm")
   showDelay.value = true
 }
 function delayTimeEvent() {

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/biReport/dragEdit/index.vue

@@ -52,6 +52,7 @@ const previewTableRef = ref<InstanceType<typeof previewTable> | null>(null);
 // 保存预览的判断以及生成
 function preMethod(): any {
   const rangeFilterData = rangeFilterRef.value?.getRangeData()
+
   if(!tableData.value.length) {
     ElMessage.warning('请选择列')
     return

+ 15 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/biReport/dragEdit/previewTable.vue

@@ -7,6 +7,7 @@ import type { TableColumnCtx, SummaryMethod  } from 'element-plus'
 import rangeFilter from "./rangeFilter.vue";
 import { rangeGetSql } from '../function';
 import { formatDate } from '@/utils/times';
+import { dropdownBoxFieldIntegration } from "../list"
 
 const rangeFilterRef = ref<InstanceType<typeof rangeFilter> | null>(null);
 
@@ -79,6 +80,18 @@ function mergeColumns({ row, rowIndex, columnIndex }: { row: any, rowIndex: numb
   return { rowspan, colspan: 1 };
 }
 
+// 渲染固定数据
+function renderingLabel(row: any, item: any) {
+  const { filed } = item
+  const list = dropdownBoxFieldIntegration.filter(em => `${em.indicate}_${em.fieldName}` == filed)
+  if(list.length) {
+    const childList = list[0].list
+    return childList.find((dd: any) => dd.value == row[item.label])?.label
+  } else {
+    return row[item.label]
+  }
+}
+
 function determinationOfDataRange() {
   const rangeFilterData = rangeFilterRef.value?.getRangeData()
   const rangeSQL = rangeGetSql(rangeFilterData, addEditData)
@@ -156,7 +169,8 @@ onMounted(() => { })
               {{ scope.row[item.label] ? formatDate(new Date(scope.row[item.label])) : '' }}
             </template>
             <template v-else>
-              {{ scope.row[item.label] }}
+              <!-- {{ scope.row[item.label] }} -->
+              {{ renderingLabel(scope.row, item) }}
             </template>
           </template>
         </el-table-column>

+ 12 - 5
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/tasks/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="h-full flex">
-    <div class="p-5 w-80 pr-0">
+    <div class="p-5 w-80 pr-0" v-if="layoutSingleChoice == TABLE_VIEW">
       <div class="bg-white w-full h-full shadow-md rounded-md flex flex-col">
         <div class="flex-1 p-3 overflow-y-auto scroll-bar">
           <el-form :model="searchForm">
@@ -170,7 +170,7 @@
         </template>
         <template v-if="layoutSingleChoice == KANBAN_VIEW">
           <div class="w-full p-4 h-full overflow-auto scroll-bar">
-            <taskCalendar />
+            <taskCalendar ref="taskCalendarRef" />
           </div>
         </template>
       </div>
@@ -181,10 +181,11 @@
           <el-form-item label="重启时间" label-width="7em" prop="showStartDelayData">
             <el-date-picker
               v-model="restartFrom.timesList"
-              type="daterange"
+              type="datetimerange"
               start-placeholder="开始时间"
               end-placeholder="结束时间"
-              value-format="YYYY-MM-DD"
+              value-format="YYYY-MM-DD HH:mm"
+              format="YYYY-MM-DD HH:mm"
               style="width: 300px"
             />
           </el-form-item>
@@ -243,6 +244,8 @@ const businessLabel = isExistBusiness === "1" ? "商机" : "项目";
 const layoutSingleChoice = ref(TABLE_VIEW) // 表格视图
 // const layoutSingleChoice = ref(KANBAN_VIEW) // 日历视图
 
+const taskCalendarRef = ref<InstanceType<typeof taskCalendar> | null>()
+
 function viewsSwitching() {
 
 }
@@ -380,7 +383,11 @@ function importExcel(data: any) {
   uploadFile(IMPORT_DATA, formData).then(_res => {
     globalPopup?.showSuccess("导入成功")
     importLoading.value = "3";
-    search();
+    if(layoutSingleChoice.value == TABLE_VIEW) {
+      search();
+    } else {
+      taskCalendarRef.value && taskCalendarRef.value.getTaskCalendar()
+    }
   }).catch(err => {
     globalPopup?.showError(err.msg)
     importLoading.value = "4";

+ 3 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/tasks/taskCalendar.vue

@@ -95,6 +95,9 @@ onMounted(() => {
   getTaskCalendar()
 })
 
+defineExpose({
+  getTaskCalendar
+})
 </script>
 
 <style lang="scss" scoped>

+ 31 - 39
fhKeeper/formulahousekeeper/customerBuler-crm/src/router/routerGuards.ts

@@ -18,65 +18,57 @@ export function createRouterGuards(router: Router) {
           next();
         } else {
           setAsyncRoutesMark(true);
-          const newRouters: any = routers;
-          const addNewRouter = newRouters.find(
-            (item: any) => item.path == "/home"
-          );
-
-          let modules = import.meta.glob("@/pages/**/*.vue");
-          routerList.forEach((item: any, index: number) => {
-            let filePath = item.path.replace("/", "")
-            const children = item.children;
-            if (children && children.length > 0) {
-              children.forEach((child: any) => {
+          const modules = import.meta.glob("@/pages/**/*.vue");
+      
+          // 遍历菜单,动态添加到 'home' 路由下
+          routerList.forEach((item: any) => {
+            let filePath = item.path.replace("/", "");
+      
+            if (item.children && item.children.length > 0) {
+              item.children.forEach((child: any) => {
                 let childFilePath = child.path.replace("/", "");
-                addNewRouter?.children.push({
+                router.addRoute('home', {
                   path: child.path,
                   name: child.name,
                   meta: {},
-                  component: modules[`/src/pages/${childFilePath}/index.vue`]
+                  component: modules[`/src/pages/${childFilePath}/index.vue`],
                 });
               });
             } else {
-              addNewRouter?.children.push({
-                path: item.path,
-                name: item.name,
-                meta: {},
-                component: modules[`/src/pages/${filePath}/index.vue`],
-                redirect: item.path === '/biReport' ? `/biReport/cusReportForm` : ''
-              });
-              if(item.childrenList && item.childrenList.length > 0) {
-                addNewRouter.children[index + 1].children = item.childrenList.map((child: any) => {
+              let childRoutes: any[] = [];
+              if (item.childrenList && item.childrenList.length > 0) {
+                childRoutes = item.childrenList.map((child: any) => {
                   let childFilePath = child.path.replace("/", "");
                   return {
                     path: child.path,
                     name: child.name,
                     meta: { parentPath: item.path },
-                    component: modules[`/src/pages/${childFilePath}/index.vue`]
-                  }
-                })
-              }
-            }
-
-            if(item.childrenList && item.childrenList.length > 0) {
-              item.childrenList.forEach((child: any) => {
-                let childFilePath = child.path.replace("/", "");
-                addNewRouter?.children.push({
-                  path: child.path,
-                  name: child.name,
-                  meta: {},
-                  component: modules[`/src/pages/${childFilePath}/index.vue`]
+                    component: modules[`/src/pages/${childFilePath}/index.vue`],
+                  };
                 });
+              }
+      
+              router.addRoute('home', {
+                path: item.path,
+                name: item.name,
+                meta: {},
+                component: modules[`/src/pages/${filePath}/index.vue`],
+                redirect: item.path === '/biReport' ? `/biReport/cusReportForm` : '',
+                children: childRoutes
               });
             }
           });
-          router.addRoute(addNewRouter);
+      
+          // 添加404兜底
           router.addRoute({
             path: '/:catchAll(.*)',
             name: 'NotFound',
             component: () => import("../pages/404.vue"),
-          })
-          console.log(router.getRoutes(), '<==== router.getRoutes()')
+          });
+      
+          console.log(router.getRoutes(), '<==== router.getRoutes()');
+      
+          // ✅ 路由添加完毕后,重新进入当前页面,确保路由匹配
           next({ ...to, replace: true });
         }
       } else {