Преглед изворни кода

Merge branch 'dev_zyh' of United_Software/k_online_ui into dev

Jack Zhou пре 1 година
родитељ
комит
b37e56fd5e

+ 1 - 1
package.json

@@ -10,9 +10,9 @@
     "build": "run-p type-check \"build-only {@}\" --",
     "preview": "vite preview",
     "build-only": "vite build",
+    "build:dev": "vite build --mode development",
     "build:test": "vite build --mode test",
     "build:pro": "vite build --mode product",
-    "build:dev": "vite build --mode development",
     "type-check": "vue-tsc --build --force",
     "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
     "format": "prettier --write src/"

+ 15 - 12
src/utils/tools.ts

@@ -5,6 +5,9 @@ export const formatTimezone = (time: string, timezone: string) => {
   let formattedTime = ''
   if (time.length > 12) {
     formattedTime = moment(time).format('MMM-DD-YYYY hh:mm A')
+    if (!timezone) {
+      return formattedTime
+    }
     let gmtOffset = ''
     const timeZoneOffset = moment().tz(timezone).format('Z')
     // 替换 "+07:00" 为 "GMT+07"
@@ -19,17 +22,17 @@ export const formatTimezone = (time: string, timezone: string) => {
 export const formatTimezoneByUTCorGMT = (time: string, timezone: string) => {
   if (!time) return '--'
   let formattedTime = ''
-    formattedTime = moment(time).format('MMM-DD-YYYY hh:mm A')
-    let gmtOffset = ''
-    console.log(timezone,formattedTime)
-    if(timezone!= null) {
-      const timeZoneOffset = moment().tz(timezone).format('Z')
-      // 替换 "+07:00" 为 "GMT+07"
-      if (timezone.includes('Seoul')) {
-        gmtOffset = `(UTC${timeZoneOffset.slice(0, 3)})`
-      } else {
-        gmtOffset = `(GMT${timeZoneOffset.slice(0, 3)})`
-      }
-      return `${formattedTime} ${gmtOffset}`
+  formattedTime = moment(time).format('MMM-DD-YYYY hh:mm A')
+  let gmtOffset = ''
+  console.log(timezone, formattedTime)
+  if (timezone != null) {
+    const timeZoneOffset = moment().tz(timezone).format('Z')
+    // 替换 "+07:00" 为 "GMT+07"
+    if (timezone.includes('Seoul')) {
+      gmtOffset = `(UTC${timeZoneOffset.slice(0, 3)})`
+    } else {
+      gmtOffset = `(GMT${timeZoneOffset.slice(0, 3)})`
     }
+    return `${formattedTime} ${gmtOffset}`
+  }
 }

+ 5 - 1
src/views/Booking/src/components/BookingTable/src/BookingTable.vue

@@ -323,8 +323,12 @@ const getExportTableData = (status: number) => {
 }
 // 导出表格 status: 1 导出当前表格 2 导出所有字段表格
 const exportTable = (status: number) => {
+  let type = 'xlsx'
+  if (allTable.value.data.length > 20000) {
+    type = 'csv'
+  }
   const exportConfig: any = {
-    type: 'xlsx',
+    type: type,
     message: false,
     filename: `Booking List_${dayjs().format('YYYYMMDDHH[h]mm[m]ss[s]')}`
   }

+ 67 - 0
src/views/Login/src/loginView.vue

@@ -9,6 +9,73 @@ import dayjs from 'dayjs'
 const router = useRouter()
 const route = useRoute()
 
+// 手动获取url中的参数,直接获取route.query的参数时如果有+号会被转义成空格
+const getQueryParams = (url: string) => {
+  const params = url.split('?')[1]
+  const query = {}
+  if (params) {
+    params.split('&').forEach((param) => {
+      const [key, value] = param.split('=')
+      query[key] = value
+    })
+  }
+  return query
+}
+const handleTokenRedirect = () => {
+  if (route.query.token && route.query.uname) {
+    const obj: any = getQueryParams(route.fullPath)
+    $api
+      .login({
+        uname: obj.uname,
+        token: obj.token
+      })
+      .then((res: any) => {
+        if (res.code === 200) {
+          const { data } = res
+          if (data.msg === 'today') {
+            ElMessageBox.alert('Your password will expire today, please reset', 'Prompt', {
+              confirmButtonText: 'OK',
+              type: 'warning',
+              confirmButtonClass: 'el-button--dark'
+            })
+          } else if (data.msg === 'last') {
+            ElMessageBox.alert(
+              `Your password will expire in${data.data}days, please reset`,
+              'Prompt',
+              {
+                confirmButtonText: 'OK',
+                type: 'warning',
+                confirmButtonClass: 'el-button--dark'
+              }
+            )
+          }
+          userStore.setUsername(res.data.uname || '')
+          router.push('/')
+        } else if (res.code === 400) {
+          const { data } = res
+          if (data.msg === 'Invalid token') {
+            ElMessageBox.alert('Invalid token', 'Prompt', {
+              confirmButtonText: 'OK',
+              type: 'warning',
+              confirmButtonClass: 'el-button--dark'
+            })
+          } else if (data.msg === 'passwordExpires') {
+            ElMessageBox.alert('Password expired, please change your password', 'Prompt', {
+              confirmButtonText: 'OK',
+              type: 'warning',
+              confirmButtonClass: 'el-button--dark'
+            })
+            userStore.setUsername(res.data.uname || '')
+            router.push({
+              name: 'Reset Password'
+            })
+          }
+        }
+      })
+  }
+}
+handleTokenRedirect()
+
 const loginForm = ref({
   username: '',
   password: '',

+ 5 - 1
src/views/Tracking/src/components/TrackingTable/src/TrackingTable.vue

@@ -399,8 +399,12 @@ const getExportTableData = (status: number) => {
 }
 // 导出表格 status: 1 导出当前表格 2 导出所有字段表格
 const exportTable = (status: number) => {
+  let type = 'xlsx'
+  if (allTable.value.data.length > 20000) {
+    type = 'csv'
+  }
   const exportConfig: any = {
-    type: 'xlsx',
+    type: type,
     message: false,
     filename: `Tracking List_${dayjs().format('YYYYMMDDHH[h]mm[m]ss[s]')}`
   }