Bladeren bron

refactor: eslint

Casper Dai 3 jaren geleden
bovenliggende
commit
9a6a7cb435
68 gewijzigde bestanden met toevoegingen van 1134 en 979 verwijderingen
  1. 1 1
      .env.staging
  2. 181 115
      .eslintrc.js
  3. 8 7
      package.json
  4. 11 13
      src/api/device.js
  5. 21 19
      src/api/user.js
  6. 2 1
      src/components/AutoImage/index.vue
  7. 4 3
      src/components/EventPicker/index.vue
  8. 9 10
      src/components/Schedule/ScheduleCalendar/ScheduleCalendarWeek.vue
  9. 3 0
      src/components/Schedule/ScheduleSwiper/index.vue
  10. 17 16
      src/components/Schedule/mixins/calendar.js
  11. 0 2
      src/components/Schedule/mixins/schedule.js
  12. 3 3
      src/components/table/mixins/table.js
  13. 18 14
      src/components/tree/DeviceGroupTree/index.vue
  14. 15 6
      src/icons/SvgIcon/index.vue
  15. 1 1
      src/layout/components/Sidebar/FixiOSBug.js
  16. 5 4
      src/layout/components/Sidebar/Link.vue
  17. 2 1
      src/layout/components/Sidebar/index.vue
  18. 34 34
      src/main.js
  19. 8 10
      src/permission.js
  20. 1 1
      src/router/index.js
  21. 4 1
      src/store/modules/permission.js
  22. 1 1
      src/store/modules/user.js
  23. 22 16
      src/utils/event.js
  24. 4 2
      src/utils/index.js
  25. 17 15
      src/utils/mqtt.js
  26. 5 2
      src/utils/request.js
  27. 7 5
      src/utils/sm4.js
  28. 42 36
      src/utils/upload.js
  29. 6 4
      src/views/bigscreen/Program.vue
  30. 24 18
      src/views/bigscreen/ast/Designer.vue
  31. 23 25
      src/views/bigscreen/ast/core/components/Draggable.vue
  32. 16 14
      src/views/bigscreen/ast/core/config-json/base.js
  33. 6 4
      src/views/bigscreen/ast/core/utils.js
  34. 10 8
      src/views/bigscreen/ast/core/widget/CImage.vue
  35. 1 1
      src/views/bigscreen/ast/core/widget/CMarquee.vue
  36. 1 1
      src/views/bigscreen/ast/core/widget/CText.vue
  37. 9 9
      src/views/bigscreen/ast/core/widget/CTime.vue
  38. 1 1
      src/views/bigscreen/ast/core/widget/CWeather.vue
  39. 7 5
      src/views/bigscreen/ast/index.vue
  40. 3 4
      src/views/dashboard/components/Device.vue
  41. 12 17
      src/views/device/back/components/Video.vue
  42. 2 2
      src/views/device/back/index.vue
  43. 1 1
      src/views/device/detail/components/DeviceInvoke/DeviceNetwork/index.vue
  44. 2 9
      src/views/device/detail/components/DeviceInvoke/DeviceTime.vue
  45. 4 2
      src/views/device/detail/components/DeviceInvoke/mixins/TaskDialog.vue
  46. 11 5
      src/views/device/detail/components/DeviceInvoke/mixins/task.js
  47. 1 3
      src/views/device/detail/components/DeviceRuntime/ScreenShot.vue
  48. 12 25
      src/views/device/detail/components/LinkState.vue
  49. 2 1
      src/views/device/detail/components/external/ReceivingCard/ReceivingCardTopology.vue
  50. 1 1
      src/views/device/group/index.vue
  51. 34 34
      src/views/device/index.vue
  52. 6 8
      src/views/device/timeline/index.vue
  53. 17 20
      src/views/external/camera/components/Detail.vue
  54. 2 8
      src/views/external/camera/components/Fullscreen.vue
  55. 2 2
      src/views/external/camera/index.vue
  56. 1 1
      src/views/platform/logger/index.vue
  57. 4 3
      src/views/platform/login/index.vue
  58. 1 3
      src/views/platform/profile/index.vue
  59. 18 16
      src/views/realm/device/Device.vue
  60. 18 16
      src/views/realm/device/Group.vue
  61. 8 6
      src/views/realm/tenant/Group.vue
  62. 8 6
      src/views/realm/tenant/Tenant.vue
  63. 17 12
      src/views/realm/upgrade/index.vue
  64. 11 12
      src/views/realm/user/Account.vue
  65. 35 30
      src/views/realm/user/Settings.vue
  66. 8 10
      src/views/review/components/ReviewPublish.vue
  67. 42 44
      vue.config.js
  68. 301 249
      yarn.lock

+ 1 - 1
.env.staging

@@ -7,4 +7,4 @@ __CAMERA__ = 'enabled'
 # keycloak
 VUE_APP_KEYCLOAK_OPTIONS_URL = 'https://isoc.artaplay.com:8443/auth'
 # 71服务器
-VUE_APP_KEYCLOAK_OPTIONS_REALM = 'smsb-test'
+# VUE_APP_KEYCLOAK_OPTIONS_REALM = 'smsb-test'

+ 181 - 115
.eslintrc.js

@@ -1,15 +1,18 @@
 module.exports = {
   root: true,
-  parserOptions: {
-    parser: 'babel-eslint',
-    sourceType: 'module'
-  },
   env: {
     browser: true,
     node: true,
     es6: true
   },
-  extends: ['plugin:vue/recommended', 'eslint:recommended'],
+  extends: [
+    'plugin:vue/recommended',
+    'eslint:recommended'
+  ],
+  parserOptions: {
+    parser: '@babel/eslint-parser',
+    sourceType: 'module'
+  },
   globals: {
     __VERSION__: true,
     __DEV__: true,
@@ -19,91 +22,78 @@ module.exports = {
     __CAMERA__: true
   },
   // add your custom rules here
-  //it is base on https://github.com/vuejs/eslint-config-vue
   rules: {
+    'vue/multi-word-component-names': 0,
+    'vue/no-mutating-props': 0,
     'vue/max-attributes-per-line': [2, {
-      'singleline': 10,
-      'multiline': {
-        'max': 1,
-        'allowFirstLine': false
-      }
-    }],
-    'vue/singleline-html-element-content-newline': 'off',
-    'vue/multiline-html-element-content-newline': 'off',
-    'vue/name-property-casing': ['error', 'PascalCase'],
-    'vue/no-v-html': 'off',
-    'accessor-pairs': 2,
-    'arrow-spacing': [2, {
-      'before': true,
-      'after': true
+      'singleline': 1,
+      'multiline': 1
     }],
-    'block-spacing': [2, 'always'],
-    'brace-style': [2, '1tbs', {
-      'allowSingleLine': true
+    'vue/singleline-html-element-content-newline': 0,
+    'vue/multiline-html-element-content-newline': 0,
+    'vue/component-definition-name-casing': [2, 'PascalCase'],
+    'vue/no-v-html': 0,
+    // 8.17.0
+    // Possible Problems
+    'array-callback-return': 2,
+    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+    'no-constructor-return': 2,
+    'no-duplicate-imports': 2,
+    'no-self-compare': 2,
+    'no-unmodified-loop-condition': 2,
+    'no-unused-vars': [2, {
+      'vars': 'all',
+      'args': 'after-used',
+      'ignoreRestSiblings': true
     }],
+    'no-use-before-define': [2, 'nofunc'],
+    'no-template-curly-in-string': 2,
+    'no-unreachable-loop': 2,
+    'valid-typeof': [2, { 'requireStringLiterals': true }],
+    // Suggestions
+    'accessor-pairs': 2,
+    'arrow-body-style': [2, 'as-needed', { 'requireReturnForObjectLiteral': true }],
+    'block-scoped-var': 2,
     'camelcase': [0, {
-      'properties': 'always'
+      'properties': 'always',
+      'ignoreDestructuring': true
     }],
-    'comma-dangle': [2, 'never'],
-    'comma-spacing': [2, {
-      'before': false,
-      'after': true
+    'complexity': [0, 3],
+    'consistent-return': [2, {
+      'treatUndefinedAsUnspecified': true
     }],
-    'comma-style': [2, 'last'],
-    'constructor-super': 2,
-    'curly': [2, 'multi-line'],
-    'dot-location': [2, 'property'],
-    'eol-last': 2,
+    'consistent-this': [2, 'self'],
+    'curly': [2, 'all'],
+    'default-case': 2,
+    'default-case-last': 2,
+    'default-param-last': 2,
     'eqeqeq': ['error', 'always', { 'null': 'ignore' }],
-    'generator-star-spacing': [2, {
-      'before': true,
-      'after': true
-    }],
-    'handle-callback-err': [2, '^(err|error)$'],
-    'indent': [2, 2, {
-      'SwitchCase': 1
-    }],
-    'jsx-quotes': [2, 'prefer-single'],
-    'key-spacing': [2, {
-      'beforeColon': false,
-      'afterColon': true
-    }],
-    'keyword-spacing': [2, {
-      'before': true,
-      'after': true
-    }],
+    'func-name-matching': 2,
+    'func-names': [2, 'never'],
+    'func-style': [2, 'declaration', { 'allowArrowFunctions': true }],
+    'grouped-accessor-pairs': [2, 'getBeforeSet'],
+    'guard-for-in': 2,
+    'max-depth': [2, 4],
+    'max-nested-callbacks': [2, 4],
+    'max-params': [2, 4],
     'new-cap': [2, {
       'newIsCap': true,
       'capIsNew': false
     }],
-    'new-parens': 2,
+    'no-alert': 2,
     'no-array-constructor': 2,
     'no-caller': 2,
-    'no-console': 'off',
-    'no-class-assign': 2,
-    'no-cond-assign': 2,
-    'no-const-assign': 2,
-    'no-control-regex': 0,
-    'no-delete-var': 2,
-    'no-dupe-args': 2,
-    'no-dupe-class-members': 2,
-    'no-dupe-keys': 2,
-    'no-duplicate-case': 2,
-    'no-empty-character-class': 2,
-    'no-empty-pattern': 2,
+    'no-console': 0,
+    'no-div-regex': 2,
+    'no-else-return': [2, { 'allowElseIf': true }],
+    'no-empty-function': [2, { 'allow': ['arrowFunctions'] }],
     'no-eval': 2,
-    'no-ex-assign': 2,
     'no-extend-native': 2,
     'no-extra-bind': 2,
-    'no-extra-boolean-cast': 2,
-    'no-extra-parens': [2, 'functions'],
-    'no-fallthrough': 2,
+    'no-extra-label': 2,
     'no-floating-decimal': 2,
-    'no-func-assign': 2,
     'no-implied-eval': 2,
-    'no-inner-declarations': [2, 'functions'],
-    'no-invalid-regexp': 2,
-    'no-irregular-whitespace': 2,
+    'no-invalid-this': 2,
     'no-iterator': 2,
     'no-label-var': 2,
     'no-labels': [2, {
@@ -111,61 +101,141 @@ module.exports = {
       'allowSwitch': false
     }],
     'no-lone-blocks': 2,
-    'no-mixed-spaces-and-tabs': 2,
-    'no-multi-spaces': 2,
+    'no-lonely-if': 2,
+    'no-loop-func': 2,
+    'no-multi-assign': [2, { 'ignoreNonDeclaration': true }],
     'no-multi-str': 2,
-    'no-multiple-empty-lines': [2, {
-      'max': 1
-    }],
-    'no-native-reassign': 2,
-    'no-negated-in-lhs': 2,
+    'no-negated-condition': 2,
+    'no-new-func': 2,
     'no-new-object': 2,
-    'no-new-require': 2,
-    'no-new-symbol': 2,
     'no-new-wrappers': 2,
-    'no-obj-calls': 2,
-    'no-octal': 2,
     'no-octal-escape': 2,
-    'no-path-concat': 2,
     'no-proto': 2,
-    'no-redeclare': 2,
-    'no-regex-spaces': 2,
     'no-return-assign': [2, 'except-parens'],
-    'no-self-assign': 2,
-    'no-self-compare': 2,
+    'no-return-await': 2,
+    'no-script-url': 2,
     'no-sequences': 2,
-    'no-shadow-restricted-names': 2,
-    'no-spaced-func': 2,
-    'no-sparse-arrays': 2,
-    'no-this-before-super': 2,
     'no-throw-literal': 2,
-    'no-trailing-spaces': 2,
-    'no-undef': 2,
     'no-undef-init': 2,
-    'no-unexpected-multiline': 2,
-    'no-unmodified-loop-condition': 2,
+    'no-undefined': 2,
     'no-unneeded-ternary': [2, {
       'defaultAssignment': false
     }],
-    'no-unreachable': 2,
-    'no-unsafe-finally': 2,
-    'no-unused-vars': [2, {
-      'vars': 'all',
-      'args': 'none'
+    'no-unused-expressions': [2, {
+      'allowShortCircuit': true,
+      'allowTernary': true
     }],
     'no-useless-call': 2,
     'no-useless-computed-key': 2,
+    'no-useless-concat': 2,
     'no-useless-constructor': 2,
-    'no-useless-escape': 0,
+    'no-useless-rename': 2,
+    'no-useless-return': 2,
+    'no-var': 2,
+    'object-shorthand': [2, 'always'],
+    'one-var': [2, 'never'],
+    'operator-assignment': 2,
+    'prefer-arrow-callback': [2, {
+      'allowNamedFunctions': false,
+      'allowUnboundThis': false
+    }],
+    'prefer-const': 2,
+    'prefer-exponentiation-operator': 2,
+    'prefer-object-spread': 2,
+    'prefer-regex-literals': 2,
+    'prefer-rest-params': 2,
+    'prefer-spread': 2,
+    'prefer-template': 2,
+    'require-await': 2,
+    'spaced-comment': [2, 'always', {
+      'markers': [
+        'global',
+        'globals',
+        'eslint',
+        'eslint-disable',
+        '*package',
+        '!',
+        ','
+      ]
+    }],
+    'symbol-description': 2,
+    'yoda': [2, 'never'],
+    // Layout & Formatting
+    'array-bracket-spacing': [2, 'never'],
+    'array-element-newline': [2, 'consistent'],
+    'arrow-parens': [2, 'as-needed'],
+    'arrow-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'block-spacing': [2, 'always'],
+    'brace-style': [2, '1tbs', {
+      'allowSingleLine': true
+    }],
+    'comma-dangle': [2, 'never'],
+    'comma-spacing': [2, {
+      'before': false,
+      'after': true
+    }],
+    'comma-style': [2, 'last'],
+    'computed-property-spacing': [2, 'never'],
+    'dot-location': [2, 'property'],
+    'eol-last': [2, 'always'],
+    'func-call-spacing': [2, 'never'],
+    'function-call-argument-newline': [2, 'consistent'],
+    'function-paren-newline': [2, 'multiline-arguments'],
+    'generator-star-spacing': [2, 'before'],
+    'implicit-arrow-linebreak': [2, 'beside'],
+    'indent': [2, 2, {
+      'VariableDeclarator': 'first',
+      'SwitchCase': 1,
+      'MemberExpression': 1,
+      'ArrayExpression': 'first',
+      'ObjectExpression': 'first',
+      'ImportDeclaration': 'first',
+      'flatTernaryExpressions': false,
+      'ignoreComments': false
+    }],
+    'jsx-quotes': [2, 'prefer-single'],
+    'key-spacing': [2, {
+      'beforeColon': false,
+      'afterColon': true
+    }],
+    'keyword-spacing': [2, {
+      'before': true,
+      'after': true
+    }],
+    'max-statements-per-line': [2, { 'max': 2 }],
+    'multiline-ternary': [2, 'always-multiline'],
+    'new-parens': [2, 'always'],
+    'newline-per-chained-call': [2, { 'ignoreChainWithDepth': 3 }],
+    'no-extra-parens': [2, 'functions'],
+    'no-multi-spaces': 2,
+    'no-multiple-empty-lines': [2, { 'max': 1 }],
+    'no-tabs': 2,
+    'no-trailing-spaces': 2,
     'no-whitespace-before-property': 2,
-    'no-with': 2,
-    'one-var': [2, {
-      'initialized': 'never'
+    'nonblock-statement-body-position': [2, 'beside'],
+    'object-curly-newline': [2, {
+      'ObjectPattern': {
+        'multiline': true
+      },
+      'ImportDeclaration': {
+        'multiline': true,
+        'minProperties': 2
+      },
+      'ExportDeclaration': 'never'
+    }],
+    'object-curly-spacing': [2, 'always', {
+      'arraysInObjects': true,
+      'objectsInObjects': true
     }],
     'operator-linebreak': [2, 'after', {
       'overrides': {
         '?': 'before',
-        ':': 'before'
+        ':': 'before',
+        '&&': 'before',
+        '||': 'before'
       }
     }],
     'padded-blocks': [2, 'never'],
@@ -173,6 +243,7 @@ module.exports = {
       'avoidEscape': true,
       'allowTemplateLiterals': true
     }],
+    'rest-spread-spacing': [2, 'never'],
     'semi': [2, 'never'],
     'semi-spacing': [2, {
       'before': false,
@@ -186,18 +257,13 @@ module.exports = {
       'words': true,
       'nonwords': false
     }],
-    'spaced-comment': [2, 'always', {
-      'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
+    'switch-colon-spacing': [2, {
+      'before': false,
+      'after': true
     }],
     'template-curly-spacing': [2, 'never'],
-    'use-isnan': 2,
-    'valid-typeof': 2,
+    'template-tag-spacing': [2, 'never'],
     'wrap-iife': [2, 'any'],
-    'yield-star-spacing': [2, 'both'],
-    'yoda': [2, 'never'],
-    'prefer-const': 2,
-    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
-    'object-curly-spacing': [2, 'always'],
-    'array-bracket-spacing': [2, 'never']
+    'yield-star-spacing': [2, 'before']
   }
 }

+ 8 - 7
package.json

@@ -5,7 +5,7 @@
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
-    "lint": "vue-cli-service lint",
+    "lint": "eslint . --ext .js,.vue",
     "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
     "commit": "cz"
   },
@@ -30,20 +30,20 @@
     "vuex": "^3.4.0"
   },
   "devDependencies": {
+    "@babel/core": "^7.18.2",
+    "@babel/eslint-parser": "^7.18.2",
     "@commitlint/cli": "^16.2.3",
     "@commitlint/config-conventional": "^16.2.1",
     "@vue/cli-plugin-babel": "~4.5.0",
-    "@vue/cli-plugin-eslint": "~4.5.0",
     "@vue/cli-plugin-router": "~4.5.0",
     "@vue/cli-plugin-vuex": "~4.5.0",
     "@vue/cli-service": "~4.5.0",
-    "babel-eslint": "^10.1.0",
     "chokidar": "^3.5.2",
     "commitizen": "^4.2.4",
     "conventional-changelog-cli": "^2.1.1",
     "cz-conventional-changelog": "^3.3.0",
-    "eslint": "^6.7.2",
-    "eslint-plugin-vue": "^6.2.2",
+    "eslint": "^8.17.0",
+    "eslint-plugin-vue": "^8.0.3",
     "express-http-proxy": "^1.6.3",
     "lint-staged": "^9.5.0",
     "mockjs": "^1.1.0",
@@ -51,7 +51,8 @@
     "sass-loader": "^8.0.2",
     "script-ext-html-webpack-plugin": "^2.1.5",
     "svg-sprite-loader": "^6.0.11",
-    "vue-template-compiler": "^2.6.11"
+    "vue-template-compiler": "^2.6.11",
+    "yorkie": "^2.0.0"
   },
   "gitHooks": {
     "pre-commit": "lint-staged",
@@ -59,7 +60,7 @@
   },
   "lint-staged": {
     "*.{js,jsx,vue}": [
-      "vue-cli-service lint",
+      "eslint --ext .js,.vue --fix",
       "git add"
     ]
   },

+ 11 - 13
src/api/device.js

@@ -75,19 +75,17 @@ export function deleteDevice ({ id, name }) {
     url: `/device/${id}/standbyDevice`,
     method: 'GET',
     params: { pageNum: 1, pageSize: 1 }
-  }).then(({ data }) => {
-    return confirm(
-      data.length
-        ? `删除主设备后备份设备也将删除`
-        : `删除 ${name} ?`,
-      data.length
-        ? `删除 ${name}`
-        : null
-    ).then(() => messageSend({
-      url: `/device/${id}`,
-      method: 'DELETE'
-    }, '删除'))
-  })
+  }).then(({ data }) => confirm(
+    data.length
+      ? `删除主设备后备份设备也将删除`
+      : `删除 ${name} ?`,
+    data.length
+      ? `删除 ${name}`
+      : null
+  )).then(() => messageSend({
+    url: `/device/${id}`,
+    method: 'DELETE'
+  }, '删除'))
 }
 
 export function getDevices (query, options) {

+ 21 - 19
src/api/user.js

@@ -143,7 +143,7 @@ export async function getTenants (query) {
   }
 }
 
-export async function getTenantTree () {
+export function getTenantTree () {
   if (store.getters.isSuperAdmin) {
     return getTenantsByQuery({})
   }
@@ -169,7 +169,9 @@ export function getTopGroups () {
   if (store.getters.isSuperAdmin) {
     return getTenantsByQuery({}, true)
   }
-  return getGroups().then(data => { return { data: normalizeGroups(data.subGroups, true) } })
+  return getGroups().then(data => {
+    return { data: normalizeGroups(data.subGroups, true) }
+  })
 }
 
 async function getGroups () {
@@ -249,13 +251,13 @@ function removeUserFromGroup (userId, groupId) {
 }
 
 export async function moveUserGroup (userId, from, to) {
-  from = getGroupList(from)
-  to = getGroupList(to)
-  let fromLast = from.length - 1
-  const toLast = to.length - 1
+  const fromGroups = getGroupList(from)
+  const toGroups = getGroupList(to)
+  let fromLast = fromGroups.length - 1
+  const toLast = toGroups.length - 1
   let start = 0
   while (start <= fromLast && start <= toLast) {
-    if (from[start].id === to[start].id) {
+    if (fromGroups[start].id === toGroups[start].id) {
       start += 1
     } else {
       break
@@ -263,10 +265,10 @@ export async function moveUserGroup (userId, from, to) {
   }
   const changed = start <= fromLast || start <= toLast
   for (; fromLast >= start; fromLast--) {
-    await removeUserFromGroup(userId, from[fromLast].id)
+    await removeUserFromGroup(userId, fromGroups[fromLast].id)
   }
   for (; start <= toLast; start++) {
-    await addUserToGroup(userId, to[start].id)
+    await addUserToGroup(userId, toGroups[start].id)
   }
   return changed
 }
@@ -282,14 +284,16 @@ function getGroupList (group) {
 }
 
 export function getUserRoleMapping (id) {
-  return getUserRoles(id).then(roles => {
-    return getRoles().then(available => {
-      return {
-        available,
-        roles
+  return getUserRoles(id).then(
+    roles => getRoles().then(
+      available => {
+        return {
+          available,
+          roles
+        }
       }
-    })
-  })
+    )
+  )
 }
 
 function getUserRoles (id) {
@@ -308,9 +312,7 @@ function getRoles () {
 
 function filterRoles (roles) {
   const isSuperAdmin = store.getters.isSuperAdmin
-  return roles.filter(({ name }) => {
-    return name !== Role.SUPER_ADMIN && (isSuperAdmin || name !== Role.ADMIN) && name.startsWith('ROLE_')
-  })
+  return roles.filter(({ name }) => name !== Role.SUPER_ADMIN && (isSuperAdmin || name !== Role.ADMIN) && name.startsWith('ROLE_'))
 }
 
 export async function updateUserRoles (userId, available, fromKeys, toKeys) {

+ 2 - 1
src/components/AutoImage/index.vue

@@ -54,7 +54,8 @@ export default {
     },
     setStatus (status = 0) {
       if (this.$img) {
-        this.$img.onload = this.$img.onerror = null
+        this.$img.onload = null
+        this.$img.onerror = null
         this.$img = null
       }
       this.status = status

+ 4 - 3
src/components/EventPicker/index.vue

@@ -187,13 +187,14 @@ export default {
       return date < this.minDate || this.eventOptions.start && date < new Date(this.eventOptions.start)
     },
     init () {
-      const { byDay, ...options } = Object.assign({
+      const { byDay, ...options } = {
         freq: EventFreq.ONCE,
         start: null,
         until: null,
         startTime: '00:00:00',
-        endTime: '00:00:00'
-      }, this.event)
+        endTime: '00:00:00',
+        ...this.event
+      }
       this.eventOptions = {
         ...options,
         byDay: byDay ? byDay.split(',') : []

+ 9 - 10
src/components/Schedule/ScheduleCalendar/ScheduleCalendarWeek.vue

@@ -159,11 +159,12 @@ export default {
     },
     createPlaceholdeItem (items, minDate, maxDate) {
       const now = new Date()
+      let startDate = minDate
       if (maxDate > now && minDate < now) {
         items.push(this.createItem(null, minDate, now))
-        minDate = now
+        startDate = now
       }
-      items.push(this.createItem(null, minDate, maxDate))
+      items.push(this.createItem(null, startDate, maxDate))
     },
     createItem (eventProxy, minDate, maxDate) {
       const duration = (maxDate - minDate) / 1000
@@ -186,20 +187,18 @@ export default {
     },
     createOnceItem (eventProxy, minDate, maxDate) {
       const { start, until } = eventProxy.origin
-      minDate = pickMax(toDate(start), minDate)
-      maxDate = pickMin(toDate(until), maxDate)
-      return this.createItem(eventProxy, minDate, maxDate)
+      return this.createItem(eventProxy, pickMax(toDate(start), minDate), pickMin(toDate(until), maxDate))
     },
     createRemainderWeeklyItem (eventProxy, minDate, maxDate) {
       const { until, endTime } = eventProxy.origin
-      maxDate = pickMin(toDate(`${toDateStr(minDate)} ${correctEndTime(endTime)}`), pickMin(toDate(until), maxDate))
-      return this.createItem(eventProxy, minDate, maxDate)
+      const endDate = pickMin(toDate(`${toDateStr(minDate)} ${correctEndTime(endTime)}`), pickMin(toDate(until), maxDate))
+      return this.createItem(eventProxy, minDate, endDate)
     },
     createWeeklyItem (eventProxy, minDate, maxDate) {
       const { start, until, startTime, endTime } = eventProxy.origin
-      minDate = pickMax(toDate(`${toDateStr(minDate)} ${startTime}`), pickMax(toDate(start), minDate))
-      maxDate = pickMin(toDate(`${toDateStr(minDate, isOverDay(eventProxy.origin) ? 1 : 0)} ${correctEndTime(endTime)}`), pickMin(toDate(until), maxDate))
-      return this.createItem(eventProxy, minDate, maxDate)
+      const startDate = pickMax(toDate(`${toDateStr(minDate)} ${startTime}`), pickMax(toDate(start), minDate))
+      const endDate = pickMin(toDate(`${toDateStr(minDate, isOverDay(eventProxy.origin) ? 1 : 0)} ${correctEndTime(endTime)}`), pickMin(toDate(until), maxDate))
+      return this.createItem(eventProxy, startDate, endDate)
     },
     onClick (event) {
       this.$emit('edit', event)

+ 3 - 0
src/components/Schedule/ScheduleSwiper/index.vue

@@ -150,6 +150,9 @@ export default {
       return false
     }
   },
+  created () {
+    this.init()
+  },
   methods: {
     transformEvents (events) {
       return events.sort((a, b) => a.index - b.index).map(this.transformEvent)

+ 17 - 16
src/components/Schedule/mixins/calendar.js

@@ -102,6 +102,9 @@ export default {
       return today < this.minRange || today >= this.maxRange
     }
   },
+  created () {
+    this.init()
+  },
   methods: {
     createEventProxy (event) {
       return {
@@ -117,24 +120,22 @@ export default {
       let maxDate = null
       if (this.editable) {
         minDate = length ? pickMin(toDate(events[0].origin.start), today) : today
-      } else {
-        if (length) {
-          minDate = toDate(events[0].origin.start)
-          for (let i = length - 1; i >= 0; i--) {
-            const until = events[length - 1].origin.until
-            if (!until) {
-              maxDate = null
-              break
-            }
-            if (!maxDate || maxDate < until) {
-              maxDate = until
-            }
+      } else if (length) {
+        minDate = toDate(events[0].origin.start)
+        for (let i = length - 1; i >= 0; i--) {
+          const until = events[length - 1].origin.until
+          if (!until) {
+            maxDate = null
+            break
+          }
+          if (!maxDate || maxDate < until) {
+            maxDate = until
           }
-          maxDate = toDate(maxDate)
-        } else {
-          minDate = today
-          maxDate = today
         }
+        maxDate = toDate(maxDate)
+      } else {
+        minDate = today
+        maxDate = today
       }
       this.minDate = toZeroPoint(minDate)
       this.maxDate = maxDate

+ 0 - 2
src/components/Schedule/mixins/schedule.js

@@ -41,10 +41,8 @@ export default {
       ...this.detail,
       events: this.transformEvents(this.detail.events)
     }
-    this.init()
   },
   methods: {
-    init () { },
     transformEvents (events) {
       return events
     },

+ 3 - 3
src/components/table/mixins/table.js

@@ -147,7 +147,7 @@ export default {
             if (data.length === 0) {
               const { pageNum, pageSize } = options.params
               if (pageNum > 1) {
-                return this.pageTo(totalCount ? Math.ceil(totalCount / pageSize) : 1)
+                return void this.pageTo(totalCount ? Math.ceil(totalCount / pageSize) : 1)
               }
             }
             options.list = transform ? data.map(transform) : data
@@ -225,14 +225,14 @@ export default {
     },
     pageTo (pageNum) {
       if (pageNum >= 1) {
-        return this.mergeCondition({ pageNum })
+        return void this.mergeCondition({ pageNum })
       }
       this.mergeCondition({ pageNum: this.options.params.pageNum })
     },
     decrease (count) {
       const options = this.options
       if (options.list.length <= count) {
-        return this.pageTo(options.params.pageNum - 1)
+        return void this.pageTo(options.params.pageNum - 1)
       }
       this.pageTo()
     }

+ 18 - 14
src/components/tree/DeviceGroupTree/index.vue

@@ -140,21 +140,25 @@ export default {
   },
   methods: {
     emitChange () {
-      this.$emit('change', this.isAll || this.isIndeterminate ? [
-        ...new Set(
-          this.groups.map(group => {
-            return (
-              group.all
-                ? group.list
-                : group.indeterminate
-                  ? group.list.filter(device => device.checked)
-                  : []
+      this.$emit(
+        'change',
+        this.isAll || this.isIndeterminate
+          ? [
+            ...new Set(
+              this.groups.reduce(
+                (arr, group) => arr.concat(
+                  group.all
+                    ? group.list
+                    : group.indeterminate
+                      ? group.list.filter(device => device.checked)
+                      : []
+                ),
+                []
+              )
             )
-          }).reduce((arr, devices) => {
-            return arr.concat(devices)
-          })
-        )
-      ] : [])
+          ]
+          : []
+      )
     },
     onAllToggle () {
       this.isAll = !this.isAll

+ 15 - 6
src/icons/SvgIcon/index.vue

@@ -1,6 +1,16 @@
 <template>
-  <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
-  <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
+  <div
+    v-if="isExternal"
+    :style="styleExternalIcon"
+    class="svg-external-icon svg-icon"
+    v-on="$listeners"
+  />
+  <svg
+    v-else
+    :class="svgClass"
+    aria-hidden="true"
+    v-on="$listeners"
+  >
     <use :xlink:href="iconName" />
   </svg>
 </template>
@@ -30,10 +40,9 @@ export default {
     },
     svgClass () {
       if (this.className) {
-        return 'svg-icon ' + this.className
-      } else {
-        return 'svg-icon'
+        return `svg-icon ${this.className}`
       }
+      return 'svg-icon'
     },
     styleExternalIcon () {
       return {
@@ -56,7 +65,7 @@ export default {
 
 .svg-external-icon {
   background-color: currentColor;
-  mask-size: cover!important;
+  mask-size: cover !important;
   display: inline-block;
 }
 </style>

+ 1 - 1
src/layout/components/Sidebar/FixiOSBug.js

@@ -9,7 +9,7 @@ export default {
       const $subMenu = this.$refs.subMenu
       if ($subMenu) {
         const handleMouseleave = $subMenu.handleMouseleave
-        $subMenu.handleMouseleave = (e) => {
+        $subMenu.handleMouseleave = e => {
           handleMouseleave(e)
         }
       }

+ 5 - 4
src/layout/components/Sidebar/Link.vue

@@ -1,5 +1,8 @@
 <template>
-  <component :is="type" v-bind="linkProps(to)">
+  <component
+    :is="type"
+    v-bind="linkProps(to)"
+  >
     <slot />
   </component>
 </template>
@@ -34,9 +37,7 @@ export default {
           rel: 'noopener'
         }
       }
-      return {
-        to: to
-      }
+      return { to }
     }
   }
 }

+ 2 - 1
src/layout/components/Sidebar/index.vue

@@ -76,7 +76,8 @@ export default {
       return filterRoutes(this.permissionRoutes)
     },
     activeMenu () {
-      return this.$route.matched[1]?.path
+      const path = this.$route.matched[1]?.path
+      return path?.replace(/\/$/, '')
     }
   }
 }

+ 34 - 34
src/main.js

@@ -19,40 +19,6 @@ import {
   closeLoading
 } from './utils/pop'
 
-async function startApp () {
-  document.body.setAttribute('version', __VERSION__)
-
-  Vue.use(Element)
-  Vue.prototype.$keycloak = keycloak
-  Vue.prototype.$showLoading = showLoading
-  Vue.prototype.$closeLoading = closeLoading
-
-  Vue.prototype.__STAGING__ = __STAGING__
-  Vue.prototype.__PLACEHOLDER__ = __PLACEHOLDER__
-
-  Vue.config.productionTip = false
-  Vue.config.errorHandler = err => {
-    closeLoading()
-    throw err
-  }
-
-  await store.dispatch('user/login', keycloak)
-  store.dispatch('permission/generateRoutes', {
-    roles: store.getters.roles,
-    accesses: store.getters.accesses
-  })
-  router.addRoutes(store.getters.permissionRoutes)
-
-  Vue.prototype.roleSet = store.getters.roles
-  Vue.prototype.accessSet = store.getters.accesses
-
-  new Vue({
-    router,
-    store,
-    render: h => h(App)
-  }).$mount('#app')
-}
-
 const initOptions = {
   url: process.env.VUE_APP_KEYCLOAK_OPTIONS_URL,
   realm: process.env.VUE_APP_KEYCLOAK_OPTIONS_REALM,
@@ -86,3 +52,37 @@ keycloak
   })
   .catch(() => console.error('Authenticated Failed'))
   .finally(startApp)
+
+async function startApp () {
+  document.body.setAttribute('version', __VERSION__)
+
+  Vue.use(Element)
+  Vue.prototype.$keycloak = keycloak
+  Vue.prototype.$showLoading = showLoading
+  Vue.prototype.$closeLoading = closeLoading
+
+  Vue.prototype.__STAGING__ = __STAGING__
+  Vue.prototype.__PLACEHOLDER__ = __PLACEHOLDER__
+
+  Vue.config.productionTip = false
+  Vue.config.errorHandler = err => {
+    closeLoading()
+    throw err
+  }
+
+  await store.dispatch('user/login', keycloak)
+  store.dispatch('permission/generateRoutes', {
+    roles: store.getters.roles,
+    accesses: store.getters.accesses
+  })
+  router.addRoutes(store.getters.permissionRoutes)
+
+  Vue.prototype.roleSet = store.getters.roles
+  Vue.prototype.accessSet = store.getters.accesses
+
+  new Vue({
+    router,
+    store,
+    render: h => h(App)
+  }).$mount('#app')
+}

+ 8 - 10
src/permission.js

@@ -8,7 +8,7 @@ NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
 const whiteList = ['/error'] // no redirect whitelist
 
-router.beforeEach(async (to, from, next) => {
+router.beforeEach((to, from, next) => {
   cancelRequest()
   // start progress bar
   NProgress.start()
@@ -21,19 +21,17 @@ router.beforeEach(async (to, from, next) => {
     } else {
       next()
     }
+  } else if (whiteList.includes(to.path)) {
+    // in the free login whitelist, go directly
+    next()
   } else {
-    if (whiteList.includes(to.path)) {
-      // in the free login whitelist, go directly
-      next()
-    } else {
-      // other pages that do not have permission to access are redirected to the login page.
-      next('/error')
-      NProgress.done()
-    }
+    // other pages that do not have permission to access are redirected to the login page.
+    next('/error')
+    NProgress.done()
   }
 })
 
-router.afterEach((to, from) => {
+router.afterEach(() => {
   // finish progress bar
   NProgress.done()
 })

+ 1 - 1
src/router/index.js

@@ -321,7 +321,7 @@ export const asyncRoutes = [
 
 const createRouter = () => new Router({
   // mode: 'history', // require service support
-  scrollBehavior: () => ({ y: 0 }),
+  scrollBehavior: () => { return { y: 0 } },
   routes: constantRoutes
 })
 

+ 4 - 1
src/store/modules/permission.js

@@ -1,4 +1,7 @@
-import { constantRoutes, asyncRoutes } from '@/router'
+import {
+  constantRoutes,
+  asyncRoutes
+} from '@/router'
 import { Role } from '@/constant'
 
 function hasPermission (accessSet, access) {

+ 1 - 1
src/store/modules/user.js

@@ -107,7 +107,7 @@ const actions = {
     }
   },
 
-  async logout () {
+  logout () {
     // 登出将跳转页面,所以不需其他操作
     Vue.prototype.$keycloak.logout()
   },

+ 22 - 16
src/utils/event.js

@@ -178,7 +178,7 @@ function getConflictForWeeklyToWeekly (a, b) {
   const hitDate = getNearestHitDateForOnce(a, b.start, b.until)
   if (hitDate) {
     const untilDate = pickMin(toDate(a.until), toDate(b.until))
-    const isMore = !untilDate || isMoreThanOneWeek(maxDate - hitDate)
+    const isMore = !untilDate || isMoreThanOneWeek(untilDate - hitDate)
     const minDate = isMore ? toDate(`${toDateStr(hitDate)} 00:00:00`) : hitDate
     const maxDate = isMore ? toDate(`${toDateStr(hitDate, 7)} 00:00:00`) : untilDate
     console.log('isConflictForWeeklyToWeekly', minDate, maxDate)
@@ -190,21 +190,7 @@ function getConflictForWeeklyToWeekly (a, b) {
         console.log('isConflictForWeeklyToWeekly', b, bTimeSlices)
         const fromTimeSlices = [...aTimeSlices[0], ...bTimeSlices[0]].sort(ascSort)
         const toTimeSlices = [...aTimeSlices[1], ...bTimeSlices[1]].sort(ascSort)
-        let i = 0
-        let j = 0
-        let running = false
-        while (i < fromTimeSlices.length && j < toTimeSlices.length) {
-          if (fromTimeSlices[i] < toTimeSlices[j]) {
-            if (running) {
-              return fromTimeSlices[i]
-            }
-            running = true
-            i += 1
-          } else {
-            running = false
-            j += 1
-          }
-        }
+        return getConflictTimeSlice(fromTimeSlices, toTimeSlices)
       }
     }
   }
@@ -212,6 +198,26 @@ function getConflictForWeeklyToWeekly (a, b) {
   return null
 }
 
+function getConflictTimeSlice (fromTimeSlices, toTimeSlices) {
+  let i = 0
+  let j = 0
+  let running = false
+  while (i < fromTimeSlices.length && j < toTimeSlices.length) {
+    if (fromTimeSlices[i] < toTimeSlices[j]) {
+      if (running) {
+        return fromTimeSlices[i]
+      }
+      running = true
+      i += 1
+    } else {
+      running = false
+      j += 1
+    }
+  }
+  console.log('time slice miss')
+  return null
+}
+
 function ascSort (a, b) {
   return a - b
 }

+ 4 - 2
src/utils/index.js

@@ -19,7 +19,7 @@ export function parseTime (time, cFormat) {
     }
 
     if ((typeof time === 'number') && (time.toString().length === 10)) {
-      time = time * 1000
+      time *= 1000
     }
     date = new Date(time)
   }
@@ -35,7 +35,9 @@ export function parseTime (time, cFormat) {
   const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
     const value = formatObj[key]
     // Note: getDay() returns 0 on Sunday
-    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
+    if (key === 'a') {
+      return ['日', '一', '二', '三', '四', '五', '六'][value]
+    }
     return value.toString().padStart(2, '0')
   })
   return time_str

+ 17 - 15
src/utils/mqtt.js

@@ -22,7 +22,7 @@ const password = process.env.VUE_APP_MQTT_PASSWORD
 const options = {
   username,
   password,
-  clientId: 'mqttjs_' + Math.random().toString(16).slice(2),
+  clientId: `mqttjs_${Math.random().toString(16).slice(2)}`,
   keepalive: 60,
   protocolId: 'MQTT',
   protocolVersion: 4,
@@ -62,6 +62,7 @@ function isWhite (item, topic, message) {
   }
 }
 
+const cbs = []
 let mqttClient
 
 function changeState (state) {
@@ -114,19 +115,7 @@ function start () {
       try {
         const s = utf8ArrayBufferToString(message)
         if (s) {
-          if (whiteList.some(item => isWhite(item, topic, s))) {
-            console.log('white list')
-            message = s
-          } else {
-            const decodeStr = sm4.decrypt(message)
-            if (decodeStr) {
-              console.log('sm4')
-              message = decodeStr
-            } else {
-              console.log('unencrypted')
-              message = s
-            }
-          }
+          message = decodeMessage(topic, message, s)
         } else {
           console.log('null')
           message = s
@@ -144,6 +133,20 @@ function start () {
   return client
 }
 
+function decodeMessage (topic, arrayBuffer, message) {
+  if (whiteList.some(item => isWhite(item, topic, message))) {
+    console.log('white list')
+  } else {
+    const decodeStr = sm4.decrypt(arrayBuffer)
+    if (decodeStr) {
+      console.log('sm4')
+      return decodeStr
+    }
+    console.log('unencrypted')
+  }
+  return message
+}
+
 const decoder = new TextDecoder('utf-8')
 function utf8ArrayBufferToString (buffer) {
   return decoder.decode(buffer)
@@ -186,7 +189,6 @@ export function unsubscribe (topic, fn) {
   unlisten(fn)
 }
 
-const cbs = []
 export function listen (fn) {
   fn && cbs.push(fn)
 }

+ 5 - 2
src/utils/request.js

@@ -1,5 +1,8 @@
 import axios from 'axios'
-import { MessageBox, Message } from 'element-ui'
+import {
+  MessageBox,
+  Message
+} from 'element-ui'
 import store from '@/store'
 
 const config = {
@@ -54,7 +57,7 @@ tenantService.interceptors.request.use(
   debug
 )
 tenantService.interceptors.request.use(
-  function (config) {
+  config => {
     const { tenant, org, user } = config.params || config.data || {}
     console.log('url', config.method, config.url)
     console.log('tenant', tenant)

+ 7 - 5
src/utils/sm4.js

@@ -1,3 +1,5 @@
+/* eslint-disable array-element-newline */
+
 const UINT8_BLOCK = 16
 
 const Sbox = Uint8Array.from([
@@ -84,7 +86,7 @@ export default class SM4 {
      * @member {Uint8Array} iv
      */
     let ivBuffer = new Uint8Array(0)
-    if (config.iv !== undefined && config.iv !== null) {
+    if (config.iv) {
       // need iv
       ivBuffer = Crypt.stringToArrayBufferInUtf8(config.iv)
       if (ivBuffer.length !== 16) {
@@ -323,10 +325,10 @@ export default class SM4 {
         const roundIndex = i * UINT8_BLOCK
         const block = this.uint8ToUint32Block(padded, roundIndex)
         // xor the chain block
-        chainBlock[0] = chainBlock[0] ^ block[0]
-        chainBlock[1] = chainBlock[1] ^ block[1]
-        chainBlock[2] = chainBlock[2] ^ block[2]
-        chainBlock[3] = chainBlock[3] ^ block[3]
+        chainBlock[0] ^= block[0]
+        chainBlock[1] ^= block[1]
+        chainBlock[2] ^= block[2]
+        chainBlock[3] ^= block[3]
         // use chain block to crypt
         const cipherBlock = this.doBlockCrypt(chainBlock, this.encryptRoundKeys)
         // make the cipher block be part of next chain block

+ 42 - 36
src/utils/upload.js

@@ -41,6 +41,8 @@ const pendingQueue = []
 let idle = IDLE_MAX
 let calc = CALC_MAX
 
+const noop = () => {}
+
 export function appendFile (file) {
   const fileType = getType(file)
   if (!fileType) {
@@ -93,8 +95,9 @@ function analyzeByWorker (obj) {
     console.log(`开始解析文件${obj.name}`)
     const worker = new Worker('/mediainfo.js')
     worker.onmessage = e => {
-      const { error, media } = e.data
+      let isNeedConfirm = false
 
+      const { error, media } = e.data
       if (error) {
         console.log(`解析文件${obj.name}失败`, error)
       } else {
@@ -111,17 +114,21 @@ function analyzeByWorker (obj) {
           if (obj.type === AssetType.VIDEO) {
             const videoTrack = media.track.find(track => track['@type'] === 'Video')
             if (videoTrack && videoTrack.Format !== 'AVC') {
-              return MessageBox.confirm(
-                `视频 ${obj.name} 非H264编码将无法预览`,
-                '继续上传',
-                { type: 'warning' }
-              ).then(resolve, reject)
+              isNeedConfirm = true
             }
           }
         }
       }
 
-      resolve()
+      if (isNeedConfirm) {
+        MessageBox.confirm(
+          `视频 ${obj.name} 非H264编码将无法预览`,
+          '继续上传',
+          { type: 'warning' }
+        ).then(resolve, reject)
+      } else {
+        resolve()
+      }
       worker.terminate()
     }
     worker.onmessageerror = worker.onerror = e => {
@@ -207,7 +214,7 @@ function getType ({ name, type }) {
         type: 'warning',
         message: `暂不支持${name}该类型文件`
       })
-      return
+      return null
   }
 }
 
@@ -345,8 +352,6 @@ function calculateSimple (obj) {
   })
 }
 
-function noop () { }
-
 function createWorkerCancel (reject) {
   let worker
   return {
@@ -480,20 +485,23 @@ function isExists (obj) {
     background: true
   }).finally(() => {
     obj.source = null
-  }).then(({ data }) => {
-    return {
-      result: true,
-      message: `${obj.name}已上传过,文件名为${data.originalName}`
-    }
-  }, ({ errCode, data }) => {
-    if (errCode === '666') {
+  }).then(
+    ({ data }) => {
       return {
-        result: false,
-        message: data
+        result: true,
+        message: `${obj.name}已上传过,文件名为${data.originalName}`
+      }
+    },
+    ({ errCode, data }) => {
+      if (errCode === '666') {
+        return {
+          result: false,
+          message: data
+        }
       }
+      return Promise.reject()
     }
-    return Promise.reject()
-  })
+  )
 }
 
 async function startCheck (obj) {
@@ -570,14 +578,20 @@ function startChunkTask (obj) {
   const { name, hash, source, chunks, totalChunks } = obj
   console.log(`开始上传${name},共${totalChunks}个切片`)
 
-  const checkIdle = () => {
+  start()
+  // 抢占
+  if (COMPLETE_FIRST) {
+    checkIdle()
+  }
+
+  function checkIdle () {
     while (idle && chunks.length) {
       idle -= 1
       start(true)
     }
   }
 
-  const start = async sub => {
+  async function start (sub) {
     const chunk = chunks.shift()
     const { index, raw, size } = chunk
     try {
@@ -601,14 +615,12 @@ function startChunkTask (obj) {
       if (obj.uploaded === totalChunks) {
         idleTask()
         startMerge(obj)
+      } else if (!chunks.length || (sub && !COMPLETE_FIRST && pendingQueue.length)) {
+        idleTask()
       } else {
-        if (!chunks.length || (sub && !COMPLETE_FIRST && pendingQueue.length)) {
-          idleTask()
-        } else {
-          start(sub)
-          // 利用空闲线程
-          checkIdle()
-        }
+        start(sub)
+        // 利用空闲线程
+        checkIdle()
       }
     } catch (e) {
       chunks.unshift(chunk)
@@ -630,12 +642,6 @@ function startChunkTask (obj) {
       }
     }
   }
-
-  start()
-  // 抢占
-  if (COMPLETE_FIRST) {
-    checkIdle()
-  }
 }
 
 function startMerge (obj) {

+ 6 - 4
src/views/bigscreen/Program.vue

@@ -46,10 +46,12 @@ export default {
     },
     style () {
       const img = this.program.img
-      return img ? {
-        backgroundSize: 'contain',
-        backgroundImage: `url("${/^data/.test(img) ? img : getAssetUrl(img)}")`
-      } : {}
+      return img
+        ? {
+          backgroundSize: 'contain',
+          backgroundImage: `url("${/^data/.test(img) ? img : getAssetUrl(img)}")`
+        }
+        : {}
     },
     createTime () {
       return this.program.createTime?.split(' ')[0]

+ 24 - 18
src/views/bigscreen/ast/Designer.vue

@@ -281,7 +281,7 @@
       <template v-if="showServerAssets">
         <grid-table :schema="assetSchema">
           <grid-table-item>
-            <template v-slot="item">
+            <template #item>
               <card
                 :source="item"
                 @dblclick="onChoosenAsset"
@@ -305,7 +305,7 @@
           :schema="assetSchema"
         >
           <grid-table-item>
-            <template v-slot="item">
+            <template #item>
               <card
                 :source="item"
                 @click="onToggleGrid"
@@ -402,32 +402,36 @@ export default {
       if (this.widgetAttr?.type === 'data') {
         return this.widgetAttr.options.type
       }
-      return void 0
+      return []
     },
     assetSchema () {
       return {
         condition: { originalName: '', type: this.assetType[0] },
         list: this.getAssets,
         transform: this.transformAsset,
-        filters: (this.assetType.length > 1 ? [
-          {
-            key: 'type', type: 'select', options: this.assetType.map(type => {
-              return {
-                value: type,
-                label: this.getAssetType(type)
+        filters: (
+          this.assetType.length > 1
+            ? [
+              {
+                key: 'type', type: 'select', options: this.assetType.map(type => {
+                  return {
+                    value: type,
+                    label: this.getAssetType(type)
+                  }
+                })
               }
-            })
-          }
-        ] : []).concat([
+            ]
+            : []
+        ).concat([
           { key: 'originalName', type: 'search', placeholder: '媒资名称' }
         ])
       }
     },
     needTypeTag () {
-      return this.assetType ? this.assetType.length > 1 : false
+      return this.assetType.length > 1
     },
     assetDialogType () {
-      return this.assetType
+      return this.assetType.length
         ? this.assetType.length > 1
           ? '媒资'
           : this.getAssetType(this.assetType[0])
@@ -440,10 +444,12 @@ export default {
       return this.widget?.id
     },
     wrapperStyles () {
-      return this.node ? {
-        width: `${this.node.width * this.scale / 100}px`,
-        height: `${this.node.height * this.scale / 100}px`
-      } : null
+      return this.node
+        ? {
+          width: `${this.node.width * this.scale / 100}px`,
+          height: `${this.node.height * this.scale / 100}px`
+        }
+        : null
     }
   },
   watch: {

+ 23 - 25
src/views/bigscreen/ast/core/components/Draggable.vue

@@ -84,16 +84,13 @@ function validatenull (val) {
     if (val.length === 0) {
       return true
     }
-  } else {
-    if (
-      val === 'null' ||
-      val == null ||
-      val === 'undefined' ||
-      val === ''
-    ) {
-      return true
-    }
-    return false
+  } else if (
+    val === 'null'
+    || val == null
+    || val === 'undefined'
+    || val === ''
+  ) {
+    return true
   }
   return false
 }
@@ -201,14 +198,13 @@ export default {
     },
     styleName () {
       return Object.assign(
-        (() => {
-          if (this.active) {
-            return Object.assign({
-              zIndex: 9999
-            }, this.styleLineName)
+        this.active
+          ? {
+            zIndex: 9999,
+            ...this.styleLineName
           }
-          return { zIndex: this.zIndex }
-        })(),
+          : { zIndex: this.zIndex }
+        ,
         {
           top: this.setPx(this.baseTop),
           left: this.setPx(this.baseLeft),
@@ -277,9 +273,9 @@ export default {
       if (validatenull(val)) {
         return ''
       }
-      val = val + ''
+      val += ''
       if (val.indexOf('%') === -1) {
-        val = val + 'px'
+        val += 'px'
       }
       return val
     },
@@ -294,8 +290,7 @@ export default {
     setMove (left, top) {
       this.$emit('move', {
         index: this.index,
-        left: left,
-        top: top
+        left, top
       })
     },
     setLeft (left) {
@@ -322,11 +317,14 @@ export default {
       e.stopPropagation()
       this.rangeActive = true
       // 移动的方向
-      let x, y
+      let x
+      let y
       // 移动的位置
-      let xp, yp
+      let xp
+      let yp
       // 移动的正负
-      let xc, yc
+      let xc
+      let yc
       let disX = e.clientX
       let disY = e.clientY
       document.onmousemove = e => {
@@ -419,7 +417,7 @@ export default {
       }, 100)
       let disX = e.clientX
       let disY = e.clientY
-      document.onmousemove = (e) => {
+      document.onmousemove = e => {
         if (!this.moveActive) {
           this.moveActive = true
           this.$emit('will-move')

+ 16 - 14
src/views/bigscreen/ast/core/config-json/base.js

@@ -43,7 +43,7 @@ export const positionConfig = {
         strats: [
           {
             label: '靠左',
-            callback (node, root) {
+            callback (node) {
               Object.assign(node, {
                 left: 0
               })
@@ -68,7 +68,7 @@ export const positionConfig = {
         strats: [
           {
             label: '靠上',
-            callback (node, root) {
+            callback (node) {
               Object.assign(node, {
                 top: 0
               })
@@ -176,19 +176,21 @@ export const toggleTypeConfig = {
   props: {
     toggleType: 'cycle'
   },
-  options: __STAGING__ ? [
-    {
-      key: 'toggleType',
-      label: '播放方式',
-      type: 'select',
-      options: {
-        options: [
-          { value: 'cycle', label: '循环' },
-          { value: 'random', label: '随机' }
-        ]
+  options: __STAGING__
+    ? [
+      {
+        key: 'toggleType',
+        label: '播放方式',
+        type: 'select',
+        options: {
+          options: [
+            { value: 'cycle', label: '循环' },
+            { value: 'random', label: '随机' }
+          ]
+        }
       }
-    }
-  ] : []
+    ]
+    : []
 }
 
 export const animationConfig = {

+ 6 - 4
src/views/bigscreen/ast/core/utils.js

@@ -115,14 +115,14 @@ function transform10To16 (num) {
 // 转换为#AARRGGBB或#RRGGBB
 function transformColorToAndroid (color) {
   if (/^rgba\(/.test(color)) {
-    const rgba = /^rgba\(([^,]+),([^,]+),([^,]+),([^\)]+)\)$/i.exec(color)
+    const rgba = /^rgba\(([^,]+),([^,]+),([^,]+),([^)]+)\)$/i.exec(color)
     if (rgba) {
-      color = '#' + transform10To16(Math.round(Math.round((Number(rgba[4]) * 100)) / 100 * 255)) + transform10To16(rgba[1]) + transform10To16(rgba[2]) + transform10To16(rgba[3])
+      color = `#${transform10To16(Math.round(Math.round((Number(rgba[4]) * 100)) / 100 * 255))}${transform10To16(rgba[1])}${transform10To16(rgba[2])}${transform10To16(rgba[3])}`
     }
   } else if (/^rgb\(/.test(color)) {
-    const rgb = /^rgb\(([^,]+),([^,]+),([^\)]+)\)$/i.exec(color)
+    const rgb = /^rgb\(([^,]+),([^,]+),([^)]+)\)$/i.exec(color)
     if (rgb) {
-      color = '#' + transform10To16(rgb[1]) + transform10To16(rgb[2]) + transform10To16(rgb[3])
+      color = `#${transform10To16(rgb[1])}${transform10To16(rgb[2])}${transform10To16(rgb[3])}`
     }
   }
   return color.toUpperCase()
@@ -195,6 +195,7 @@ export function fix (node) {
       }
     }
   }
+  return null
 }
 
 export function getDuration (node) {
@@ -249,6 +250,7 @@ export function validate (node) {
         break
     }
   }
+  return null
 }
 
 export function switchToNext (toggleType, arr, curr) {

+ 10 - 8
src/views/bigscreen/ast/core/widget/CImage.vue

@@ -98,14 +98,16 @@ export default {
       }
     },
     className () {
-      return this.isSnapping ? {
-        empty: this.isEmpty
-      } : {
-        empty: this.isEmpty,
-        slide: this.isSlide,
-        fade: this.isFade,
-        flip: this.isFlip || this.isSectionFlip
-      }
+      return this.isSnapping
+        ? {
+          empty: this.isEmpty
+        }
+        : {
+          empty: this.isEmpty,
+          slide: this.isSlide,
+          fade: this.isFade,
+          flip: this.isFlip || this.isSectionFlip
+        }
     },
     isEmpty () {
       return !this.img

+ 1 - 1
src/views/bigscreen/ast/core/widget/CMarquee.vue

@@ -38,7 +38,7 @@ export default {
       return {
         width: `${width}px`,
         height: `${height}px`,
-        color: color,
+        color,
         'font-size': `${fontSize}px`,
         'font-weight': fontWeight,
         'background-color': backgroundColor

+ 1 - 1
src/views/bigscreen/ast/core/widget/CText.vue

@@ -38,7 +38,7 @@ export default {
       return {
         width: `${width}px`,
         height: `${height}px`,
-        color: color,
+        color,
         'font-size': `${fontSize}px`,
         'font-weight': fontWeight,
         'text-align': textAlign,

+ 9 - 9
src/views/bigscreen/ast/core/widget/CTime.vue

@@ -34,7 +34,7 @@ export default {
       return {
         width: `${width}px`,
         height: `${height}px`,
-        color: color,
+        color,
         'font-size': `${fontSize}px`,
         'font-weight': fontWeight,
         'justify-content': ({
@@ -64,21 +64,21 @@ export default {
     getTime () {
       const now = new Date()
       const o = {
-        'y+': (now.getFullYear() + '').padStart(2, '0'),
-        'M+': (now.getMonth() + 1 + '').padStart(2, '0'),
-        'd+': (now.getDate() + '').padStart(2, '0'),
-        'H+': (now.getHours() + '').padStart(2, '0'),
-        'm+': (now.getMinutes() + '').padStart(2, '0'),
-        's+': (now.getSeconds() + '').padStart(2, '0'),
+        'y+': `${now.getFullYear()}`.padStart(2, '0'),
+        'M+': `${now.getMonth() + 1}`.padStart(2, '0'),
+        'd+': `${now.getDate()}`.padStart(2, '0'),
+        'H+': `${now.getHours()}`.padStart(2, '0'),
+        'm+': `${now.getMinutes()}`.padStart(2, '0'),
+        's+': `${now.getSeconds()}`.padStart(2, '0'),
         'w+': ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][now.getDay()]
       }
       let format = this.format
-      for (var k in o) {
+      Object.keys(o).forEach(k => {
         format = format.replace(
           new RegExp(k),
           o[k]
         )
-      }
+      })
       this.time = format
     }
   }

+ 1 - 1
src/views/bigscreen/ast/core/widget/CWeather.vue

@@ -36,7 +36,7 @@ export default {
       return {
         width: `${width}px`,
         height: `${height}px`,
-        color: color,
+        color,
         'font-size': `${fontSize}px`,
         'font-weight': fontWeight,
         'justify-content': ({

+ 7 - 5
src/views/bigscreen/ast/index.vue

@@ -15,6 +15,9 @@ export default {
     Designer,
     Viewer
   },
+  beforeRouteLeave (to, from, next) {
+    next(false)
+  },
   props: {
     id: {
       type: String,
@@ -37,9 +40,6 @@ export default {
       immediate: true
     }
   },
-  beforeRouteLeave (to, from, next) {
-    next(false)
-  },
   methods: {
     getProgram () {
       this.loading = true
@@ -50,14 +50,16 @@ export default {
             const { id, status, name, resolutionRatio, itemJsonStr } = data
             const [width, height] = resolutionRatio.split('x')
             if (!width || !height) {
-              return this.showMessage('error', '布局分辨率异常,请联系管理员')
+              this.showMessage('error', '布局分辨率异常,请联系管理员')
+              return
             }
 
             if (status === State.READY) {
               if (this.accessSet.has(Access.MANAGE_CALENDAR)) {
                 this.activeComponent = 'Designer'
               } else {
-                return this.showMessage('warning', '暂无编辑权限,请联系管理员')
+                this.showMessage('warning', '暂无编辑权限,请联系管理员')
+                return
               }
             } else {
               this.activeComponent = 'Viewer'

+ 3 - 4
src/views/dashboard/components/Device.vue

@@ -149,9 +149,7 @@ export default {
       return `地址:${this.device.remark}`
     },
     styles () {
-      return this.isActivated && this.isOnline && this.shot ? {
-        backgroundImage: `url("${this.shot}")`
-      } : null
+      return this.isActivated && this.isOnline && this.shot ? { backgroundImage: `url("${this.shot}")` } : null
     },
     nextInfo () {
       return this.next ? `下一场:${this.next.startDate} ${this.next.startTime} ${this.next.target.name}` : ''
@@ -244,9 +242,10 @@ export default {
         }
       })
     },
-    checkTimeline (current) {
+    checkTimeline (target) {
       this.loadingTimeline = false
       const now = new Date()
+      let current = target
       let currentEndDate = null
       let next = null
       if (!current) {

+ 12 - 17
src/views/device/back/components/Video.vue

@@ -96,11 +96,13 @@ export default {
   },
   created () {
     if (this.device.onlineStatus === 1) {
+      this.$timer = -1
       this.getAuthCode()
     }
   },
   beforeDestroy () {
     if (this.player) {
+      clearTimeout(this.$timer)
       this.destroyPlay()
     }
   },
@@ -139,7 +141,7 @@ export default {
       authCode({
         deviceId: this.device.id
       }).then(({ data }) => {
-        var { token, expire, timestamp } = data
+        const { token, expire, timestamp } = data
         this.getflv(timestamp, token, expire)
       })
     },
@@ -151,18 +153,14 @@ export default {
     getflv (timestamp, token, expire) {
       if (flvjs.isSupported()) {
         // 创建一个flvjs实例
-        var url = `${CAMERA_URL}/live/${this.device.id}.flv?authorization=${token}&timestamp=${timestamp}&expire=${expire}`
+        const url = `${CAMERA_URL}/live/${this.device.id}.flv?authorization=${token}&timestamp=${timestamp}&expire=${expire}`
         this.player = flvjs.createPlayer({
           type: 'flv',
           isLive: true,
           hasAudio: false,
-          url: url
+          url
         })
-        // headers: {
-        //   'Authorization': this.$keycloak.token
-        //   'Content-Type': 'application/x-www-form-urlencoded'
-        // }
-        this.player.on('error', (e) => {
+        this.player.on('error', () => {
           this.refreshshow = true
           this.destroyPlay()
           this.$message({
@@ -170,22 +168,20 @@ export default {
             message: '设备视频流出错'
           })
         })
-        var time = 10000
-        var decodedFrames = -1
-        this.player.on('statistics_info', (res) => {
+        let decodedFrames = -1
+        this.player.on('statistics_info', res => {
           decodedFrames = res.decodedFrames
         })
-        var timer = setTimeout(() => {
+        this.$timer = setTimeout(() => {
           if (decodedFrames === 0) {
             this.destroyPlay()
             this.$message({
               type: 'warning',
-              message: this.device.name + '设备没有视频流'
+              message: `${this.device.name}设备没有视频流`
             })
             this.refreshshow = true
           }
-          clearInterval(timer)
-        }, time)
+        }, 10000)
         // 将实例挂载到video元素上面
         this.player.attachMediaElement(this.$refs.player)
 
@@ -197,8 +193,7 @@ export default {
             this.player.pause()
           }
         } catch (error) {
-          console.log('连接websocker异常:' + error)
-          return false
+          console.log('连接websocker异常', error)
         }
       }
     },

+ 2 - 2
src/views/device/back/index.vue

@@ -122,7 +122,7 @@ export default {
           options.totalCount = totalCount
           options.list = data
           options.totalCount && this.$nextTick(() => {
-            this.returnheight = (this.$refs.returnB[0].clientWidth * 9) / 16 + 'px'
+            this.returnheight = `${this.$refs.returnB[0].clientWidth * 9 / 16}px`
           })
         },
         () => {
@@ -136,7 +136,7 @@ export default {
     },
     rowChange (num) {
       if (num === this.rowNum) {
-        return false
+        return
       }
       this.options.params.pageNum = 1
       this.rowNum = num

+ 1 - 1
src/views/device/detail/components/DeviceInvoke/DeviceNetwork/index.vue

@@ -196,7 +196,7 @@ export default {
         ip6: this.createIPv6Setting()
       }
     },
-    createIPv6Setting (ip6) {
+    createIPv6Setting () {
       return {
         enable: false,
         address: '',

+ 2 - 9
src/views/device/detail/components/DeviceInvoke/DeviceTime.vue

@@ -1,9 +1,6 @@
 <template>
   <div class="l-flex--col center has-border radius has-padding">
-    <i
-      class="o-icon has-bg u-pointer"
-      @click="invoke"
-    />
+    <i class="o-icon has-bg u-pointer" />
     <div class="has-padding u-color--black u-bold">时间校对</div>
   </div>
 </template>
@@ -13,11 +10,7 @@ import baseMixin from './mixins/base'
 
 export default {
   name: 'DeviceTime',
-  mixins: [baseMixin],
-  methods: {
-    invoke () {
-    }
-  }
+  mixins: [baseMixin]
 }
 </script>
 

+ 4 - 2
src/views/device/detail/components/DeviceInvoke/mixins/TaskDialog.vue

@@ -88,10 +88,11 @@ export default {
       const task = { freq, executeTime }
       if (this.isWeekly) {
         if (this.task.dayOfWeek.length === 0) {
-          return this.$message({
+          this.$message({
             type: 'warning',
             message: '请选择生效星期'
           })
+          return
         }
         if (this.task.dayOfWeek.length === 7) {
           task.freq = 0
@@ -100,10 +101,11 @@ export default {
         }
       }
       if (!executeTime) {
-        return this.$message({
+        this.$message({
           type: 'warning',
           message: '请选择触发时间'
         })
+        return
       }
       this.$emit('confirm', {
         value: task,

+ 11 - 5
src/views/device/detail/components/DeviceInvoke/mixins/task.js

@@ -75,12 +75,16 @@ export default {
       this.$task = task
       this.$refs.editDialog.show(task)
     },
-    createTask () { },
+    createTask () {
+      // implement in component
+    },
     onSave ({ value: task, done }) {
       console.log('task', task)
-      if (!this.isAdd && Object.keys(task).every(key => {
-        return task[key] === this.$task[key]
-      }) && this.isSameTask(this.$task)) {
+      if (
+        !this.isAdd
+        && Object.keys(task).every(key => task[key] === this.$task[key])
+        && this.isSameTask(this.$task)
+      ) {
         done()
         return
       }
@@ -110,7 +114,9 @@ export default {
         this.$refs.table.pageTo()
       })
     },
-    getTask () { },
+    getTask () {
+      // implement in component
+    },
     onDel (task) {
       deleteTask(task).then(() => {
         this.$refs.table.decrease(1)

+ 1 - 3
src/views/device/detail/components/DeviceRuntime/ScreenShot.vue

@@ -49,9 +49,7 @@ export default {
   methods: {
     onScreenshotUpdate ({ waiting, base64 }) {
       this.asking = waiting
-      this.styles = !waiting && base64 ? {
-        backgroundImage: `url("${base64}")`
-      } : null
+      this.styles = !waiting && base64 ? { backgroundImage: `url("${base64}")` } : null
     },
     invoke () {
       ScreenshotCache.screenshot(this.device.id)

+ 12 - 25
src/views/device/detail/components/LinkState.vue

@@ -82,10 +82,12 @@ export default {
           key: 'led'
         }
       ],
-      lines: Array.from({ length: 7 }, (v, index) => ({
-        key: index + 1,
-        class: 'l' + (index + 1)
-      })),
+      lines: Array.from({ length: 7 }, (v, index) => {
+        return {
+          key: index + 1,
+          class: `l${index + 1}`
+        }
+      }),
       lineToItem: {
         1: 'msr',
         2: 'device',
@@ -128,7 +130,7 @@ export default {
     getDeviceBind () {
       getDeviceBind(this.device)
         .then(({ data, success }) => {
-          if (!success) return
+          if (!success) { return }
           const map = {
             0: 'gateway',
             1: 'receive_card',
@@ -161,7 +163,7 @@ export default {
           // }
           this.linkStateForm = form
         })
-        .catch((err) => {
+        .catch(err => {
           console.log('err', err)
         })
         .finally(() => {
@@ -174,34 +176,19 @@ export default {
       let params = {}
       switch (key) {
         case 'msr':
-          background =
-            'url(' + require('@/assets/linkState/icon_msr.svg') + ')'
+          background = `url("${require('@/assets/linkState/icon_msr.svg')}")`
           break
         case 'led':
           value === 0
-            ? (background =
-                'url(' +
-                (this.base64
-                  ? this.base64
-                  : require('@/assets/linkState/led_default.jpg')) +
-                ')')
+            ? (background = `url("${this.base64 ? this.base64 : require('@/assets/linkState/led_default.jpg')}")`)
             : (params = { backgroundColor: '#333333' })
-
           break
         default:
-          if (key === 'trafficCamera' || key === 'ledCamera') key = 'camera'
           if (value === 2) {
-            background =
-              'url(' + require('@/assets/linkState/icon_unbound.svg') + ')'
+            background = `url("${require('@/assets/linkState/icon_unbound.svg')}")`
           } else {
-            background =
-              'url(' +
-              require(`@/assets/linkState/icon_${key}_${
-                value === 0 ? 'online' : 'offline'
-              }.svg`) +
-              ')'
+            background = `url("${require(`@/assets/linkState/icon_${key === 'trafficCamera' || key === 'ledCamera' ? 'camera' : key}_${value === 0 ? 'online' : 'offline'}.svg`)}")`
           }
-
           break
       }
       return { backgroundImage: background, ...params }

+ 2 - 1
src/views/device/detail/components/external/ReceivingCard/ReceivingCardTopology.vue

@@ -68,6 +68,7 @@ export default {
       if (screenList) {
         const cards = []
         const status = this.info.status
+        // /* eslint
         screenList.forEach(({ outCardList }) => {
           outCardList.forEach(({ sendCardList }) => {
             sendCardList.forEach(({ rxcList }) => {
@@ -76,7 +77,7 @@ export default {
                   return a.sub - b.sub
                 }
                 return a.port - b.port
-              }).map(({ port, sub, row_index, col_index }, index) => {
+              }).forEach(({ port, sub, row_index, col_index }, index) => {
                 maxRow = Math.max(maxRow, row_index)
                 maxCol = Math.max(maxCol, col_index)
                 let tip = sub === 1 ? 'S' : ''

+ 1 - 1
src/views/device/group/index.vue

@@ -146,7 +146,7 @@ export default {
           type: 'warning',
           message: '分组名称不能为空'
         })
-        return false
+        return
       }
       this.save(done).then(() => {
         if (this.isAdd) {

+ 34 - 34
src/views/device/index.vue

@@ -78,22 +78,24 @@ export default {
           { prop: 'mac', label: 'MAC', 'min-width': 100 },
           { prop: 'remark', label: '地址' },
           { type: 'tag', 'width': 100, render ({ empty, activate, onlineStatus }) {
-            return empty ? null : {
-              type: activate
-                ? activate === 1
-                  ? void 0
-                  : onlineStatus === 1
-                    ? 'success'
-                    : 'danger'
-                : 'warning',
-              label: activate
-                ? activate === 1
-                  ? '已激活'
-                  : onlineStatus === 1
-                    ? '在线'
-                    : '离线'
-                : '未激活'
-            }
+            return empty
+              ? null
+              : {
+                type: activate
+                  ? activate === 1
+                    ? void 0
+                    : onlineStatus === 1
+                      ? 'success'
+                      : 'danger'
+                  : 'warning',
+                label: activate
+                  ? activate === 1
+                    ? '已激活'
+                    : onlineStatus === 1
+                      ? '在线'
+                      : '离线'
+                  : '未激活'
+              }
           }, on: this.onTagClick },
           { type: 'invoke', width: canEdit ? 160 : 120, render: [
             { label: '查看', render ({ empty }) { return !empty }, on: this.onViewDevice },
@@ -197,25 +199,23 @@ export default {
       this.$confirm(
         `将设备 ${this.$device.name} 的默认播放设置为 ${value.name} ?`,
         { type: 'warning' }
-      ).then(() => {
-        return publish(
-          [this.$device.id],
-          {
-            type: PublishType.EVENT,
-            detail: {
-              priority: EventPriority.DEFAULT,
-              freq: EventFreq.ONCE,
-              start: `${toDateStr(new Date())} 00:00:00`,
-              until: null,
-              target: value
-            }
-          },
-          {
-            programCalendarName: value.name,
-            resolutionRatio: this.ratio
+      ).then(() => publish(
+        [this.$device.id],
+        {
+          type: PublishType.EVENT,
+          detail: {
+            priority: EventPriority.DEFAULT,
+            freq: EventFreq.ONCE,
+            start: `${toDateStr(new Date())} 00:00:00`,
+            until: null,
+            target: value
           }
-        )
-      }).then(done)
+        },
+        {
+          programCalendarName: value.name,
+          resolutionRatio: this.ratio
+        }
+      )).then(done)
     }
   }
 }

+ 6 - 8
src/views/device/timeline/index.vue

@@ -372,9 +372,9 @@ export default {
       return date < min || date > max
     },
     initTimes (date) {
-      date = pickMax(toDate(date), new Date())
-      this.current = toZeroPoint(date)
-      this.startHour = Math.min(20, date.getHours())
+      const maxDate = pickMax(toDate(date), new Date())
+      this.current = toZeroPoint(maxDate)
+      this.startHour = Math.min(20, maxDate.getHours())
       this.refreshTimes(this.startHour)
     },
     refreshTimes (start) {
@@ -421,12 +421,10 @@ export default {
             this.refreshTimes(this.startHour = next)
           }
         }
+      } else if (next > 20) {
+        this.initTimes(this.$endDateTime)
       } else {
-        if (next > 20) {
-          this.initTimes(this.$endDateTime)
-        } else {
-          this.refreshTimes(this.startHour = next)
-        }
+        this.refreshTimes(this.startHour = next)
       }
     },
     onTimeChange (val) {

+ 17 - 20
src/views/external/camera/components/Detail.vue

@@ -238,16 +238,16 @@ export default {
       getAvailableParam().then(({ data }) => {
         data.itemList.forEach(item => {
           this.settingData[0].push({
-            value: item.snWidth + '*' + item.snHight,
+            value: `${item.snWidth}*${item.snHight}`,
             active: false
           })
         })
         for (let i = 1; i < 26; i++) {
-          this.settingData[1].push({ value: i + 'fps', active: false })
-          this.settingDatacopy.push({ value: i + 'fps', active: false })
+          this.settingData[1].push({ value: `${i}fps`, active: false })
+          this.settingDatacopy.push({ value: `${i}fps`, active: false })
         }
         data.streamRateTypeList.forEach(item => {
-          this.settingData[2].push({ value: item + 'kb/s', active: false })
+          this.settingData[2].push({ value: `${item}kb/s`, active: false })
         })
         this.availableParam = data
         this.getVideoinfo(data)
@@ -256,9 +256,9 @@ export default {
     getVideoinfo (param) {
       getVideoinfo(this.detailobj.identifier).then(({ data }) => {
         this.infoData = {
-          withHight: data.width + '*' + data.hight,
-          frameRate: data.frameRate + 'fps',
-          bitRate: data.bitRate + 'kb/s'
+          withHight: `${data.width}*${data.hight}`,
+          frameRate: `${data.frameRate}fps`,
+          bitRate: `${data.bitRate}kb/s`
         }
         this.dataInit(param, this.infoData)
       })
@@ -282,16 +282,15 @@ export default {
           this.settingData[2][i].active = true
         }
       }
-      const findobj = param.itemList.find(item => item.snWidth + '*' + item.snHight === data.withHight)
+      const findobj = param.itemList.find(item => `${item.snWidth}*${item.snHight}` === data.withHight)
 
       this.settingData[1] = this.settingData[1].filter(item => {
         const splceitem = item.value.slice(0, -3)
         return splceitem <= findobj.resolutionFpsMax
       })
       const findData = this.settingData[1].find(item => item.active === true)
-      this.infoData.frameRate = findData ? this.infoData.frameRate : (this.settingData[1].length + 'fps')
       if (!findData) {
-        this.infoData.frameRate = this.settingData[1].length + 'fps'
+        this.infoData.frameRate = findData ? this.infoData.frameRate : `${this.settingData[1].length}fps`
         this.settingData[1][this.settingData[1].length].active = true
       }
       // this.settingData[1][this.settingData[1].length].value = this.infoData.frameRate
@@ -379,31 +378,29 @@ export default {
       }
     },
     getStarttime (time, type) {
-      let time1 = new Date(time)
-      time1 = time1.getTime() // 转换为时间戳
       let onehour = 60 * 60 * 1000
       if (type === 'day') {
         onehour = 60 * 60 * 1000 * 24
       } else if (type === 'now') {
         onehour = 0
       }
-      let startTime = time1 - onehour
-      startTime = new Date(startTime).toLocaleString('zh', { hour12: false })
-      startTime = startTime.split('/').join('-')
+      const startTime = new Date(new Date(time).getTime() - onehour)
+        .toLocaleString('zh', { hour12: false })
+        .split('/')
+        .join('-')
       const arr = startTime.split(' ')[0].split('-')
       for (let i = 0; i < arr.length; i++) {
         if (arr[i].length < 2) {
-          arr[i] = '0' + arr[i]
+          arr[i] = `0${arr[i]}`
         }
       }
-      startTime = arr.join('-') + ' ' + startTime.split(' ')[1]
-      return startTime
+      return `${arr.join('-')} ${startTime.split(' ')[1]}`
     },
     getStatistic (endTime, startTime) {
       getStatistic({
         deviceId: this.detailobj.identifier,
-        startTime: startTime,
-        endTime: endTime,
+        startTime,
+        endTime,
         pageIndex: 1,
         pageSize: 10000
       }).then(({ data }) => {

+ 2 - 8
src/views/external/camera/components/Fullscreen.vue

@@ -150,7 +150,7 @@ export default {
             options.list = this.device ? data.map(({ thirdPartyDevice }) => thirdPartyDevice) : data
             options.totalCount = totalCount || options.list.length
             this.$nextTick(() => {
-              this.videoheight = this.$refs.videoC[0].clientWidth * 9 / 16 + 'px'
+              this.videoheight = `${this.$refs.videoC[0].clientWidth * 9 / 16}px`
               this.destroyPlayer()
               for (let i = 0; i < options.list.length; i++) {
                 const item = options.list[i]
@@ -199,13 +199,7 @@ export default {
     },
     initScreen () {
       this.handleFullScreen()
-      // window.addEventListener('keydown', function (event) {
-      //   const e = event || window.event
-      //   if (e && e.keyCode === 122) {
-      //     e.preventDefault()
-      //   }
-      // })
-      window.addEventListener('fullscreenchange', v => {
+      window.addEventListener('fullscreenchange', () => {
         if (this.fullscreen === true) {
           this.fullscreen = false
         } else {

+ 2 - 2
src/views/external/camera/index.vue

@@ -489,9 +489,9 @@ export default {
             this.$nextTick(() => {
               try {
                 if (this.$refs.videoB) {
-                  this.videoheight = ((this.$refs.videoB[0].clientWidth || this.$refs.screenB[0].clientWidth) * 9) / 16 + 'px'
+                  this.videoheight = `${((this.$refs.videoB[0].clientWidth || this.$refs.screenB[0].clientWidth) * 9) / 16}px`
                 } else if (this.$refs.screenB) {
-                  this.videoheight = ((this.$refs.screenB[0].clientWidth || this.$refs.videoB[0].clientWidth) * 9) / 16 + 'px'
+                  this.videoheight = `${((this.$refs.screenB[0].clientWidth || this.$refs.videoB[0].clientWidth) * 9) / 16}px`
                 }
               } catch (error) {
                 console.log(error)

+ 1 - 1
src/views/platform/logger/index.vue

@@ -199,7 +199,7 @@ export default {
       this[`$${type}`] = this[type]
       if (type === 'endTime' && !this.endTime && this.beginTime) {
         this.$nextTick(() => {
-          this.endTime = this.beginTime.split(' ')[0] + ' 23:59:59'
+          this.endTime = `${this.beginTime.split(' ')[0]} 23:59:59`
         })
       }
     },

+ 4 - 3
src/views/platform/login/index.vue

@@ -62,7 +62,7 @@ export default {
   },
   watch: {
     $route: {
-      handler: function (route) {
+      handler (route) {
         const query = route.query
         if (query) {
           this.redirect = query.redirect
@@ -121,7 +121,8 @@ export default {
   &__img {
     flex: 1 1 400px;
     display: inline-block;
-    background: url('~@/assets/illustration.png') 50% 50% / 757px 613px no-repeat;
+    background: url("~@/assets/illustration.png") 50% 50% / 757px 613px
+      no-repeat;
   }
 
   &__main {
@@ -154,7 +155,7 @@ export default {
     display: inline-block;
     width: 142px;
     height: 36px;
-    background: url('~@/assets/logo.png') 0 0 / 100% 100% no-repeat;
+    background: url("~@/assets/logo.png") 0 0 / 100% 100% no-repeat;
   }
 
   &__name {

+ 1 - 3
src/views/platform/profile/index.vue

@@ -149,9 +149,7 @@ export default {
     ...mapState('user', ['name']),
     avatarStyle () {
       const avatar = this.avatar
-      return avatar ? {
-        backgroundImage: `url("${avatar}")`
-      } : null
+      return avatar ? { backgroundImage: `url("${avatar}")` } : null
     },
     tip () {
       return this.wechat ? '解除公众号绑定' : '绑定公众号'

+ 18 - 16
src/views/realm/device/Device.vue

@@ -115,22 +115,24 @@ export default {
           { prop: 'serialNumber', label: '序列号', 'min-width': 100 },
           { prop: 'mac', label: 'MAC', 'min-width': 100 },
           { type: 'tag', 'width': 100, render ({ empty, activate, onlineStatus }) {
-            return empty ? null : {
-              type: activate
-                ? activate === 1
-                  ? void 0
-                  : onlineStatus === 1
-                    ? 'success'
-                    : 'danger'
-                : 'warning',
-              label: activate
-                ? activate === 1
-                  ? '已激活'
-                  : onlineStatus === 1
-                    ? '在线'
-                    : '离线'
-                : '未激活'
-            }
+            return empty
+              ? null
+              : {
+                type: activate
+                  ? activate === 1
+                    ? void 0
+                    : onlineStatus === 1
+                      ? 'success'
+                      : 'danger'
+                  : 'warning',
+                label: activate
+                  ? activate === 1
+                    ? '已激活'
+                    : onlineStatus === 1
+                      ? '在线'
+                      : '离线'
+                  : '未激活'
+              }
           }, on: this.onTagClick },
           { type: 'invoke', width: 180, render: [
             { label: '查看', render ({ empty }) { return !empty }, on: this.onViewDevice },

+ 18 - 16
src/views/realm/device/Group.vue

@@ -60,22 +60,24 @@ export default {
           { prop: 'serialNumber', label: '序列号', 'min-width': 100 },
           { prop: 'mac', label: 'MAC', 'min-width': 100 },
           { type: 'tag', 'width': 100, render ({ empty, activate, onlineStatus }) {
-            return empty ? null : {
-              type: activate
-                ? activate === 1
-                  ? void 0
-                  : onlineStatus === 1
-                    ? 'success'
-                    : 'danger'
-                : 'warning',
-              label: activate
-                ? activate === 1
-                  ? '已激活'
-                  : onlineStatus === 1
-                    ? '在线'
-                    : '离线'
-                : '未激活'
-            }
+            return empty
+              ? null
+              : {
+                type: activate
+                  ? activate === 1
+                    ? void 0
+                    : onlineStatus === 1
+                      ? 'success'
+                      : 'danger'
+                  : 'warning',
+                label: activate
+                  ? activate === 1
+                    ? '已激活'
+                    : onlineStatus === 1
+                      ? '在线'
+                      : '离线'
+                  : '未激活'
+              }
           }, on: this.onTagClick },
           { type: 'invoke', render: [
             { label: '查看', render ({ empty }) { return !empty }, on: this.onViewDevice }

+ 8 - 6
src/views/realm/tenant/Group.vue

@@ -119,10 +119,11 @@ export default {
           })
           return
         }
-        return addSubGroup({ id: this.tenantId }, this.group).then(() => {
+        addSubGroup({ id: this.tenantId }, this.group).then(() => {
           done()
           this.$refs.table.pageTo()
         })
+        return
       }
       if (this.$group.remark !== this.group.remark) {
         updateGroup(this.group).then(() => {
@@ -137,17 +138,18 @@ export default {
         { type: 'warning' }
       ).then(() => {
         const loading = this.$showLoading()
-        unbindDevices(group.path).then(() => {
-          return deleteGroup(group).then(() => {
+        unbindDevices(group.path)
+          .then(() => deleteGroup(group))
+          .then(() => {
             this.$message({
               type: 'success',
               message: '删除成功'
             })
             this.$refs.table.decrease(1)
           })
-        }).finally(() => {
-          this.$closeLoading(loading)
-        })
+          .finally(() => {
+            this.$closeLoading(loading)
+          })
       })
     }
   }

+ 8 - 6
src/views/realm/tenant/Tenant.vue

@@ -130,10 +130,11 @@ export default {
           })
           return
         }
-        return this.addGroup(this.group).then(() => {
+        this.addGroup(this.group).then(() => {
           done()
           this.$refs.table.pageTo()
         })
+        return
       }
       if (this.$group.remark !== this.group.remark) {
         updateGroup(this.group).then(() => {
@@ -155,8 +156,9 @@ export default {
         { type: 'warning' }
       ).then(() => {
         const loading = this.$showLoading()
-        unbindDevices(group.path).then(() => {
-          return deleteGroup(group).then(() => {
+        unbindDevices(group.path)
+          .then(() => deleteGroup(group))
+          .then(() => {
             this.$message({
               type: 'success',
               message: '删除成功'
@@ -167,9 +169,9 @@ export default {
               this.$refs.table.decrease(1)
             }
           })
-        }).finally(() => {
-          this.$closeLoading(loading)
-        })
+          .finally(() => {
+            this.$closeLoading(loading)
+          })
       })
     }
   }

+ 17 - 12
src/views/realm/upgrade/index.vue

@@ -186,19 +186,24 @@ export default {
       this.apk.file = raw
       this.apk.name = raw.name
       const loading = this.$showLoading()
-      new AppInfoParse(raw).parse().finally(() => {
-        this.$closeLoading(loading)
-      }).then(({ versionName, versionCode }) => {
-        this.manual = false
-        this.apk.versionName = versionName
-        this.apk.versionCode = versionCode
-      }, () => {
-        this.manual = true
-        this.$message({
-          type: 'warning',
-          message: '解析APK版本失败,请手动填写'
+      new AppInfoParse(raw).parse()
+        .finally(() => {
+          this.$closeLoading(loading)
         })
-      })
+        .then(
+          ({ versionName, versionCode }) => {
+            this.manual = false
+            this.apk.versionName = versionName
+            this.apk.versionCode = versionCode
+          },
+          () => {
+            this.manual = true
+            this.$message({
+              type: 'warning',
+              message: '解析APK版本失败,请手动填写'
+            })
+          }
+        )
     },
     onSave (done) {
       if (!this.apk.file) {

+ 11 - 12
src/views/realm/user/Account.vue

@@ -82,14 +82,12 @@ export default {
         ],
         cols: [
           { prop: 'username', label: '账号' },
-          { prop: 'enabled', type: 'tag', render: ({ id, enabled }) => {
-            return id === this.userId
-              ? null
-              : {
-                type: enabled ? 'success' : 'danger',
-                label: enabled ? '启用' : '禁用'
-              }
-          } },
+          { prop: 'enabled', type: 'tag', render: ({ id, enabled }) => id === this.userId
+            ? null
+            : {
+              type: enabled ? 'success' : 'danger',
+              label: enabled ? '启用' : '禁用'
+            } },
           { type: 'invoke', use: ({ id }) => id !== this.userId, render: [
             { label: '设置', on: this.onSettings }
           ] }
@@ -158,7 +156,7 @@ export default {
         })
         return
       }
-      return addUser({
+      addUser({
         username,
         groups: this.getGroups(group),
         enabled: true,
@@ -171,9 +169,10 @@ export default {
     },
     getGroups (group) {
       const groups = [group.path]
-      while (group.parentGroup) {
-        group = group.parentGroup
-        groups.unshift(group.path)
+      let target = group
+      while (target.parentGroup) {
+        target = group.parentGroup
+        groups.unshift(target.path)
       }
       return groups
     },

+ 35 - 30
src/views/realm/user/Settings.vue

@@ -143,8 +143,10 @@ import {
   getUserRoleMapping,
   updateUserRoles
 } from '@/api/user'
-import { updateBindDevices } from '@/api/device'
-import { unbindDevices } from '@/api/device'
+import {
+  unbindDevices,
+  updateBindDevices
+} from '@/api/device'
 import { Role } from '@/constant'
 
 export default {
@@ -287,13 +289,12 @@ export default {
         { type: 'warning' }
       ).then(() => {
         const loading = this.$showLoading()
-        unbindDevices(`${this.group.path}/${this.user.id}`).then(() => {
-          return deleteUser(this.user).then(() => {
-            this.$emit('del')
+        unbindDevices(`${this.group.path}/${this.user.id}`)
+          .then(() => deleteUser(this.user))
+          .then(() => this.$emit('del'))
+          .finally(() => {
+            this.$closeLoading(loading)
           })
-        }).finally(() => {
-          this.$closeLoading(loading)
-        })
       })
     },
     onGroupClick (group) {
@@ -311,10 +312,11 @@ export default {
       })
     },
     getRootGroups (group) {
-      while (group.parentGroup) {
-        group = group.parentGroup
+      let target = group
+      while (target.parentGroup) {
+        target = target.parentGroup
       }
-      return [group]
+      return [target]
     },
     findLastGroup (groups) {
       let result = { subGroups: this.groups }
@@ -342,30 +344,33 @@ export default {
       ).then(() => {
         const loading = this.$showLoading()
         updateBindDevices(`${this.$group.path}/${this.user.id}`, `${this.group.path}/${this.user.id}`).then(() => {
-          moveUserGroup(this.user.id, this.group, this.$group).then(() => {
-            this.$closeLoading(loading)
-            this.group = this.$group
-            this.$group = null
-            this.$message({
-              type: 'success',
-              message: '修改成功'
-            })
-            this.$emit('group', this.group)
-          }).catch(() => {
-            this.group = null
-            this.groupChanged = false
-            this.getSettings().then(() => {
-              if (!this.error) {
-                this.expandTree()
-              }
-            })
-          })
+          moveUserGroup(this.user.id, this.group, this.$group).then(
+            () => {
+              this.$closeLoading(loading)
+              this.group = this.$group
+              this.$group = null
+              this.$message({
+                type: 'success',
+                message: '修改成功'
+              })
+              this.$emit('group', this.group)
+            },
+            () => {
+              this.group = null
+              this.groupChanged = false
+              this.getSettings().then(() => {
+                if (!this.error) {
+                  this.expandTree()
+                }
+              })
+            }
+          )
         })
       })
     },
     onSaveRole () {
       if (!this.roleChanged) {
-        return false
+        return
       }
       const { available, stash, roles } = this.role
       const loading = this.$showLoading()

+ 8 - 10
src/views/review/components/ReviewPublish.vue

@@ -32,16 +32,14 @@ export default {
         list: getPublishes,
         transform: this.transform,
         cols: [
-          { prop: 'expand', type: 'expand',
-            render (data, h) {
-              return h('div', {
-                staticClass: 'o-info'
-              }, [
-                h('div', null, data.desc),
-                h('div', null, `设备:${data.device}`)
-              ])
-            }
-          },
+          { prop: 'expand', type: 'expand', render (data, h) {
+            return h('div', {
+              staticClass: 'o-info'
+            }, [
+              h('div', null, data.desc),
+              h('div', null, `设备:${data.device}`)
+            ])
+          } },
           { prop: 'type', label: '类型', width: 100 },
           { prop: 'name', label: '名称', 'min-width': 100 },
           { prop: 'resolutionRatio', label: '分辨率' },

+ 42 - 44
vue.config.js

@@ -53,7 +53,7 @@ module.exports = {
   lintOnSave: isProd,
   productionSourceMap: false,
   devServer: {
-    port: port,
+    port,
     open: false,
     overlay: {
       warnings: false,
@@ -126,52 +126,50 @@ module.exports = {
       })
 
     config
-      .when(isProd,
-        config => {
-          config
-            .plugin('ScriptExtHtmlWebpackPlugin')
-            .after('html')
-            .use('script-ext-html-webpack-plugin', [{
-              // `runtime` must same as runtimeChunk name. default is `runtime`
-              inline: /runtime\..*\.js$/
-            }])
-            .end()
-          config
-            .optimization.splitChunks({
-              chunks: 'all',
-              cacheGroups: {
-                libs: {
-                  name: 'chunk-libs',
-                  test: /[\\/]node_modules[\\/]/,
-                  priority: 10,
-                  chunks: 'initial' // only package third parties that are initially dependent
-                },
-                elementUI: {
-                  name: 'chunk-elementUI', // split elementUI into a single package
-                  priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
-                  test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
-                },
-                commons: {
-                  name: 'chunk-commons',
-                  test: resolve('src/components'), // can customize your rules
-                  minChunks: 3, // minimum common number
-                  priority: 5,
-                  reuseExistingChunk: true
-                }
+      .when(isProd, config => {
+        config
+          .plugin('ScriptExtHtmlWebpackPlugin')
+          .after('html')
+          .use('script-ext-html-webpack-plugin', [{
+            // `runtime` must same as runtimeChunk name. default is `runtime`
+            inline: /runtime\..*\.js$/
+          }])
+          .end()
+        config
+          .optimization.splitChunks({
+            chunks: 'all',
+            cacheGroups: {
+              libs: {
+                name: 'chunk-libs',
+                test: /[\\/]node_modules[\\/]/,
+                priority: 10,
+                chunks: 'initial' // only package third parties that are initially dependent
+              },
+              elementUI: {
+                name: 'chunk-elementUI', // split elementUI into a single package
+                priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+                test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
+              },
+              commons: {
+                name: 'chunk-commons',
+                test: resolve('src/components'), // can customize your rules
+                minChunks: 3, // minimum common number
+                priority: 5,
+                reuseExistingChunk: true
               }
-            })
+            }
+          })
           // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
-          config
-            .optimization.runtimeChunk('single')
+        config
+          .optimization.runtimeChunk('single')
           // optimization
-          config
-            .optimization.minimizer('terser').tap(args => {
-              // clear console.x
-              args[0].terserOptions.compress.drop_console = !isStaging
-              return args
-            })
-        }
-      )
+        config
+          .optimization.minimizer('terser').tap(args => {
+            // clear console.x
+            args[0].terserOptions.compress.drop_console = !isStaging
+            return args
+          })
+      })
   },
   css: {
     loaderOptions: {

File diff suppressed because it is too large
+ 301 - 249
yarn.lock


Some files were not shown because too many files changed in this diff