YangJian0701 1 年之前
父节点
当前提交
7fdfb2a705
共有 4 个文件被更改,包括 22 次插入21 次删除
  1. 二进制
      ERP.rar
  2. 1 0
      components.d.ts
  3. 1 0
      package.json
  4. 20 21
      src/utils/common.ts

二进制
ERP.rar


+ 1 - 0
components.d.ts

@@ -50,6 +50,7 @@ declare module '@vue/runtime-core' {
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElSelect: typeof import('element-plus/es')['ElSelect']
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
+    ElTable: typeof import('element-plus/es')['ElTable']
     ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     ElTabPane: typeof import('element-plus/es')['ElTabPane']
     ElTabs: typeof import('element-plus/es')['ElTabs']

+ 1 - 0
package.json

@@ -26,6 +26,7 @@
   "devDependencies": {
     "@babel/core": "^7.21.3",
     "@babel/eslint-parser": "^7.21.3",
+    "@types/node": "^20.4.5",
     "@types/nprogress": "^0.2.0",
     "@typescript-eslint/eslint-plugin": "^5.55.0",
     "@typescript-eslint/parser": "^5.55.0",

+ 20 - 21
src/utils/common.ts

@@ -96,28 +96,27 @@ export const flatMenuListGet = (menuList: any) => {
  * @param time
  */
 export const getFormatDuration = (time: number) => {
-  
-  let h = parseInt(time / 60).toString().padStart(2,'0')
-  let m = parseInt(time % 60).toString().padStart(2,'0')
-  console.log('时间',time,h,m)
-  return (h == '00' ?'':h+'小时') + (m < 0 ?m.substring(1,3) +'分':m+'分')
+  let hour = (time / 60).toString().padStart(2,'0')
+  let minute = (time % 60).toString().padStart(2,'0')
 
-  let hour = 0
-  let minute = 0
-  let result = ''
-  if (time >= 60 || time < 0) {
-    hour = time / 60
-    minute = time % 60
-  } else {
-    result = '' + time + '小时'
-  }
-  if (Math.abs(minute) > 0) {
-    result = '' + parseInt(minute + '') + '分' + result
-  }
-  if (Math.abs(hour) > 0) {
-    result = '' + parseInt(hour + '') + '小时' + result
-  }
-  return result
+  return (parseInt(hour) == 0 ?'':parseInt(hour)+'小时') + (Number(minute)<0?minute.substring(1,3) +'分':Number(minute)==0?'':parseInt(minute)+'分')
+
+  // let hour = 0
+  // let minute = 0
+  // let result = ''
+  // if (time >= 60 || time < 0) {
+  //   hour = time / 60
+  //   minute = time % 60
+  // } else {
+  //   result = '' + time + '小时'
+  // }
+  // if (Math.abs(minute) > 0) {
+  //   result = '' + parseInt(minute + '') + '分' + result
+  // }
+  // if (Math.abs(hour) > 0) {
+  //   result = '' + parseInt(hour + '') + '小时' + result
+  // }
+  // return result
 }
 
 interface iconsType {