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

refactor: canonical function naming

event use onX
Casper Dai пре 3 година
родитељ
комит
0434d60b97
32 измењених фајлова са 188 додато и 197 уклоњено
  1. 10 10
      src/components/DeviceTree/index.vue
  2. 4 4
      src/components/EventTargetChoose/index.vue
  3. 4 4
      src/components/Pagination/index.vue
  4. 7 6
      src/components/Schedule/ScheduleCalendar/index.vue
  5. 2 1
      src/components/Schedule/ScheduleComplex/index.vue
  6. 38 42
      src/components/Schedule/ScheduleSwiper/index.vue
  7. 2 2
      src/components/Schedule/components/ProgramChoose.vue
  8. 7 6
      src/components/Schedule/mixins/schedule.js
  9. 2 2
      src/layout/components/Navbar/Breadcrumb.vue
  10. 2 2
      src/layout/components/Navbar/index.vue
  11. 2 5
      src/views/bigscreen/core/widget/Widget.vue
  12. 7 7
      src/views/bigscreen/designer/index.vue
  13. 4 4
      src/views/bigscreen/viewer/index.vue
  14. 3 3
      src/views/device/category/index.vue
  15. 2 2
      src/views/device/detail/components/DeviceAlarm.vue
  16. 2 2
      src/views/device/detail/components/DeviceInfo.vue
  17. 2 2
      src/views/device/detail/components/ReceivingCardInfoEdit.vue
  18. 3 3
      src/views/device/group/index.vue
  19. 11 11
      src/views/device/index.vue
  20. 3 3
      src/views/device/mixins/index.js
  21. 3 3
      src/views/device/product/index.vue
  22. 4 4
      src/views/external/transmitter/index.vue
  23. 5 5
      src/views/media/index.vue
  24. 3 3
      src/views/review/components/ReviewAsset.vue
  25. 2 2
      src/views/review/components/ReviewProgram.vue
  26. 4 7
      src/views/review/components/ReviewProgramRecur.vue
  27. 19 19
      src/views/review/components/ReviewPublish.vue
  28. 4 7
      src/views/review/components/ReviewSchedule.vue
  29. 20 19
      src/views/schedule/history/index.vue
  30. 3 3
      src/views/schedule/timeline/index.vue
  31. 2 2
      src/views/upgrade/deploy/index.vue
  32. 2 2
      src/views/upgrade/index.vue

+ 10 - 10
src/components/DeviceTree/index.vue

@@ -42,7 +42,7 @@
           v-model="isAll"
           :indeterminate="isIndeterminate"
           class="l-flex__none"
-          @change="handleAllChange"
+          @change="onAllChange"
           @click.native.stop
         />
       </div>
@@ -66,7 +66,7 @@
               class="l-flex__none"
               :indeterminate="group.indeterminate"
               :disabled="group.empty"
-              @change="handleGroupAllChange(group)"
+              @change="onGroupAllChange(group)"
               @click.native.stop
             />
           </div>
@@ -84,13 +84,13 @@
               v-for="device in group.list"
               :key="device.id"
               class="c-tree__content u-pointer"
-              @click="handleDeviceToggle(group, device)"
+              @click="onDeviceToggle(group, device)"
             >
               <span class="c-tree__label">{{ device.name }} {{ showRatio ? device.resolutionRatio : '' }}</span>
               <el-checkbox
                 v-model="device.checked"
                 class="l-flex__none"
-                @change="handleDeviceChange(group, device)"
+                @change="onDeviceChange(group, device)"
                 @click.native.stop
               />
             </div>
@@ -146,7 +146,7 @@ export default {
     expand (group) {
       group.expand = !group.expand
     },
-    handleAllChange () {
+    onAllChange () {
       this.isIndeterminate = false
       const checked = this.isAll
       this.groups.forEach(group => {
@@ -162,9 +162,9 @@ export default {
     },
     toggleAllChange () {
       this.isAll = !this.isAll
-      this.handleAllChange()
+      this.onAllChange()
     },
-    handleGroupAllChange (group) {
+    onGroupAllChange (group) {
       group.indeterminate = false
       const checked = group.all
       group.list.forEach(device => {
@@ -174,7 +174,7 @@ export default {
       this.isIndeterminate = !this.isAll && (group.all || group.indeterminate || this.groups.some(group => group.all || group.indeterminate))
       this.emitChange()
     },
-    handleDeviceChange (group, { checked }) {
+    onDeviceChange (group, { checked }) {
       group.all = !group.list.some(device => !device.checked)
       if (group.all) {
         group.indeterminate = false
@@ -187,9 +187,9 @@ export default {
       }
       this.emitChange()
     },
-    handleDeviceToggle (group, device) {
+    onDeviceToggle (group, device) {
       device.checked = !device.checked
-      this.handleDeviceChange(group, device)
+      this.onDeviceChange(group, device)
     },
     getDevices () {
       this.loading = true

+ 4 - 4
src/components/EventTargetChoose/index.vue

@@ -48,7 +48,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -58,7 +58,7 @@
     <el-dialog
       :visible.sync="isPreview"
       custom-class="c-preview schedule"
-      :before-close="handleCloseScheduleDialog"
+      :before-close="onCloseScheduleDialog"
       append-to-body
     >
       <schedule
@@ -161,11 +161,11 @@ export default {
         options.loading = false
       })
     },
-    handleCloseScheduleDialog () {
+    onCloseScheduleDialog () {
       this.scheduleId = null
       this.isPreview = false
     },
-    toView ({ id }) {
+    onView ({ id }) {
       switch (this.type) {
         case EventTarget.RECUR:
           this.scheduleId = id

+ 4 - 4
src/components/Pagination/index.vue

@@ -10,8 +10,8 @@
       :background="background"
       hide-on-single-page
       v-bind="$attrs"
-      @size-change="handleSizeChange"
-      @current-change="handleCurrentChange"
+      @size-change="onSizeChange"
+      @current-change="onCurrentChange"
     />
   </div>
 </template>
@@ -67,10 +67,10 @@ export default {
     }
   },
   methods: {
-    handleSizeChange (val) {
+    onSizeChange (val) {
       this.$emit('pagination', { page: this.currentPage, limit: val })
     },
-    handleCurrentChange (val) {
+    onCurrentChange (val) {
       this.$emit('pagination', { page: val, limit: this.pageSize })
     }
   }

+ 7 - 6
src/components/Schedule/ScheduleCalendar/index.vue

@@ -1,7 +1,8 @@
 <template>
   <schedule-wrapper
     class="c-schedule-calendar"
-    v-bind="scheduleOptions"
+    :name="name"
+    :hide-header="hideHeader"
     :editable="editable"
     :dirty="dirty"
     @add="addProgram"
@@ -43,7 +44,7 @@
       :visible.sync="editing"
       custom-class="c-dialog"
       :close-on-click-modal="false"
-      :before-close="handleCloseEditDialog"
+      :before-close="onCloseEditDialog"
     >
       <schedule-edit
         v-if="program"
@@ -62,7 +63,7 @@
         </button>
         <button
           class="o-button cancel"
-          @click="handleCloseEditDialog"
+          @click="onCloseEditDialog"
         >
           取消
         </button>
@@ -355,7 +356,7 @@ export default {
         startDateTime === this.program.startDateTime &&
         endDateTime === this.program.endDateTime
       ) {
-        this.handleCloseEditDialog()
+        this.onCloseEditDialog()
         return
       }
       this._program = { id, name, startDateTime, endDateTime }
@@ -368,7 +369,7 @@ export default {
       this._mergeOrAdd()
       this.dirty = true
       this._calculate()
-      this.handleCloseEditDialog()
+      this.onCloseEditDialog()
     },
     _mergeOrAdd () {
       let program = this._program
@@ -456,7 +457,7 @@ export default {
       this.conflicting = false
       this._saveProgram()
     },
-    handleCloseEditDialog () {
+    onCloseEditDialog () {
       this.program = null
       this.editing = false
     },

+ 2 - 1
src/components/Schedule/ScheduleComplex/index.vue

@@ -1,7 +1,8 @@
 <template>
   <schedule-wrapper
     class="c-schedule-calendar"
-    v-bind="scheduleOptions"
+    :name="name"
+    :hide-header="hideHeader"
     :editable="editable"
     :dirty="dirty"
     @add="onAdd"

+ 38 - 42
src/components/Schedule/ScheduleSwiper/index.vue

@@ -1,7 +1,8 @@
 <template>
   <schedule-wrapper
     class="c-schedule-swiper"
-    v-bind="scheduleOptions"
+    :name="name"
+    :hide-header="hideHeader"
     :editable="editable"
     :dirty="dirty"
     @add="onAdd"
@@ -30,7 +31,7 @@
             <i class="l-flex__none c-schedule-swiper__mover el-icon-sort" />
             <div
               class="l-flex__auto c-schedule-swiper__program u-ellipsis u-pointer"
-              @click="toView(program)"
+              @click="onView(program)"
             >
               {{ program.name }}
             </div>
@@ -45,15 +46,10 @@
             :step="1"
             step-strictly
           />
-          <el-tooltip
-            content="删除"
-            :hide-after="2000"
-          >
-            <i
-              class="l-flex__none c-schedule-swiper__del o-icon--active el-icon-delete u-pointer"
-              @click="toDel(program, index)"
-            />
-          </el-tooltip>
+          <i
+            class="l-flex__none c-schedule-swiper__del o-icon--active el-icon-delete u-pointer"
+            @click="onDel(program, index)"
+          />
         </div>
       </draggable>
       <el-dialog
@@ -75,7 +71,7 @@
           v-for="program in events"
           :key="program.key"
           class="l-flex--row c-schedule-swiper__item readonly u-pointer"
-          @click="toView(program)"
+          @click="onView(program)"
         >
           <div class="c-schedule-swiper__program u-ellipsis">
             {{ program.name }}
@@ -112,13 +108,14 @@ export default {
       return this.events.length < 2
     },
     dirty () {
-      if (this.record) {
+      if (this.editable && this.record) {
         const { events, count } = this.record
-        if (count !== this.events.length) {
+        const currEvents = this.events
+        if (count !== currEvents.length) {
           return true
         }
         for (let i = 0; i < events.length; i++) {
-          if (events[i].id !== this.events[i].id || events[i].duration !== this.events[i].duration) {
+          if (events[i].id !== currEvents[i].id || events[i].duration !== currEvents[i].duration) {
             return true
           }
         }
@@ -127,17 +124,6 @@ export default {
     }
   },
   methods: {
-    init () {
-      this.record = {
-        events: this.events.map(({ id, duration }) => {
-          return { id, duration }
-        }),
-        count: this.events.length
-      }
-    },
-    onSave () {
-      this.save().then(this.init)
-    },
     _transformEvents (events) {
       return events.sort((a, b) => a.index - b.index)
     },
@@ -148,10 +134,22 @@ export default {
         id: programId,
         name: programName,
         url: programUrl,
-        duration: this._transformDuration(spend)
+        duration: this.transformDuration(spend)
       }
     },
-    _transformDuration (duration) {
+    _getEvents () {
+      return this.events.map(({ id, name, url, duration }, index) => {
+        return {
+          index,
+          freq: 'SECONDLY',
+          spend: duration,
+          programId: id,
+          programName: name,
+          programUrl: url
+        }
+      })
+    },
+    transformDuration (duration) {
       if (this.editable) {
         return duration
       }
@@ -175,17 +173,16 @@ export default {
       }
       return s
     },
-    _getEvents () {
-      return this.events.map(({ id, name, url, duration }, index) => {
-        return {
-          index,
-          freq: 'SECONDLY',
-          spend: duration,
-          programId: id,
-          programName: name,
-          programUrl: url
-        }
-      })
+    init () {
+      this.record = {
+        events: this.events.map(({ id, duration }) => {
+          return { id, duration }
+        }),
+        count: this.events.length
+      }
+    },
+    onSave () {
+      this.save().then(this.init)
     },
     onAdd () {
       this.choosing = true
@@ -199,13 +196,13 @@ export default {
         duration: duration || 60
       })
     },
-    toView ({ id }) {
+    onView ({ id }) {
       window.open(this.$router.resolve({
         name: 'view',
         params: { id }
       }).href, '_blank')
     },
-    toDel ({ name }, index) {
+    onDel ({ name }, index) {
       this.$confirm(
         `确定移除节目 ${name}?`,
         { type: 'warning' }
@@ -279,7 +276,6 @@ export default {
   &__del {
     padding: 10px 16px;
     margin-left: 6px;
-    color: #606266;
     font-size: 18px;
   }
 }

+ 2 - 2
src/components/Schedule/components/ProgramChoose.vue

@@ -36,7 +36,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -94,7 +94,7 @@ export default {
         options.loading = false
       })
     },
-    toView ({ id }) {
+    onView ({ id }) {
       window.open(this.$router.resolve({
         name: 'view',
         params: { id }

+ 7 - 6
src/components/Schedule/mixins/schedule.js

@@ -17,7 +17,8 @@ export default {
   },
   data () {
     return {
-      scheduleOptions: null
+      scheduleOptions: null,
+      editable: false
     }
   },
   computed: {
@@ -27,17 +28,17 @@ export default {
     isEmpty () {
       return this.events.length === 0
     },
+    name () {
+      return this.scheduleOptions?.name
+    },
     ratio () {
       return this.scheduleOptions?.resolutionRatio
-    },
-    editable () {
-      return this.scheduleOptions?.status === State.READY
     }
   },
   created () {
+    this.editable = this.detail.status === State.READY
     this.scheduleOptions = {
       ...this.detail,
-      hideHeader: this.hideHeader,
       events: this._transformEvents(this.detail.events || []).map(this._transformEvent)
     }
     this.init()
@@ -58,7 +59,7 @@ export default {
     },
     submit () {
       submitSchedule(this.scheduleOptions, this._getEvents()).then(() => {
-        this.scheduleOptions.editable = false
+        this.editable = false
         this.$emit('submit')
       })
     }

+ 2 - 2
src/layout/components/Navbar/Breadcrumb.vue

@@ -22,7 +22,7 @@
         </span>
         <a
           v-else
-          @click.prevent="handleLink(item)"
+          @click.prevent="onLink(item)"
         >
           {{ item.meta.title }}
         </a>
@@ -42,7 +42,7 @@ export default {
     }
   },
   methods: {
-    handleLink (item) {
+    onLink (item) {
       const { redirect, name, path } = item
       if (redirect) {
         this.$router.push(redirect)

+ 2 - 2
src/layout/components/Navbar/index.vue

@@ -13,7 +13,7 @@
     <el-dropdown
       class="l-flex__none c-navbar__item c-navbar__user u-pointer"
       trigger="click"
-      @command="handleCommand"
+      @command="onCommand"
     >
       <div class="l-flex--row">
         <img
@@ -55,7 +55,7 @@ export default {
     ])
   },
   methods: {
-    handleCommand (command) {
+    onCommand (command) {
       switch (command) {
         case 'profile':
           this.$router.push({ name: 'profile' })

+ 2 - 5
src/views/bigscreen/core/widget/Widget.vue

@@ -7,7 +7,7 @@
     :width="widgetsWidth"
     :height="widgetsHeight"
     v-on="$listeners"
-    @blur="handleBlur"
+    @blur="onBlur"
   >
     <component
       :is="widgetType"
@@ -83,7 +83,7 @@ export default {
     'node.height': 'check'
   },
   methods: {
-    handleBlur ({ top, left, width, height }) {
+    onBlur ({ top, left, width, height }) {
       Object.assign(this.node, {
         top: top | 0,
         left: left | 0,
@@ -109,6 +109,3 @@ export default {
   }
 }
 </script>
-
-<style scoped lang="scss">
-</style>

+ 7 - 7
src/views/bigscreen/designer/index.vue

@@ -250,7 +250,7 @@
       :visible.sync="dialogVisibleAssets"
       custom-class="c-dialog"
       :close-on-click-modal="false"
-      :before-close="handleCloseAssetsDialog"
+      :before-close="onCloseAssetsDialog"
     >
       <draggable
         v-if="sources"
@@ -265,7 +265,7 @@
           v-for="(source, index) in sources"
           :key="index"
           class="c-card u-pointer"
-          @click="toView(source.keyName)"
+          @click="onView(source.keyName)"
         >
           <div class="c-card__content">
             <i
@@ -303,7 +303,7 @@
         </button>
         <button
           class="o-button cancel"
-          @click="handleCloseAssetsDialog"
+          @click="onCloseAssetsDialog"
         >
           取消
         </button>
@@ -372,7 +372,7 @@
           <template v-slot="scope">
             <div
               class="c-table__btn u-pointer"
-              @click="toView(scope.row.keyName)"
+              @click="onView(scope.row.keyName)"
             >
               预览
             </div>
@@ -634,7 +634,7 @@ export default {
         this.dialogVisibleAssets = true
       }
     },
-    handleCloseAssetsDialog () {
+    onCloseAssetsDialog () {
       this.widgetAttr = null
       this.dialogVisibleAssets = false
     },
@@ -654,7 +654,7 @@ export default {
         }
         return source
       }))
-      this.handleCloseAssetsDialog()
+      this.onCloseAssetsDialog()
     },
     chooseAsset ({ originalName, keyName, url, duration, size, md5 }) {
       const source = {
@@ -709,7 +709,7 @@ export default {
         assetOptions.loading = false
       })
     },
-    toView (keyName) {
+    onView (keyName) {
       this.$refs.preview.show({
         type: this.widgetAttr.options.type,
         keyName

+ 4 - 4
src/views/bigscreen/viewer/index.vue

@@ -71,7 +71,7 @@
       title="数据"
       :visible.sync="dialogVisibleAssets"
       custom-class="c-dialog"
-      :before-close="handleCloseAssetsDialog"
+      :before-close="onCloseAssetsDialog"
     >
       <div
         v-if="sources"
@@ -81,7 +81,7 @@
           v-for="(source, index) in sources"
           :key="index"
           class="c-card u-pointer"
-          @click="toView(source.keyName)"
+          @click="onView(source.keyName)"
         >
           <div class="c-card__content">
             <i
@@ -152,12 +152,12 @@ export default {
         this.dialogVisibleAssets = true
       }
     },
-    handleCloseAssetsDialog () {
+    onCloseAssetsDialog () {
       this.muted = this.$muted
       this.sources = null
       this.dialogVisibleAssets = false
     },
-    toView (keyName) {
+    onView (keyName) {
       this.$refs.preview.show({
         type: this.isImage ? AssetType.IMAGE : AssetType.VIDEO,
         keyName

+ 3 - 3
src/views/device/category/index.vue

@@ -12,7 +12,7 @@
       <template #header>
         <button
           class="o-button"
-          @click="toAdd"
+          @click="onAdd"
         >
           <i class="o-button__icon el-icon-circle-plus-outline" />
           新增
@@ -37,13 +37,13 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click="toEdit(scope.row)"
+            @click="onEdit(scope.row)"
           >
             编辑
           </div>
           <div
             class="c-table__btn u-pointer"
-            @click="toDel(scope.row)"
+            @click="onDel(scope.row)"
           >
             删除
           </div>

+ 2 - 2
src/views/device/detail/components/DeviceAlarm.vue

@@ -26,7 +26,7 @@
             v-if="scope.row.picUrl"
             class="o-thumbnail u-pointer"
             :style="{ 'background-image': `url('${scope.row.picUrl}')` }"
-            @click="toView(scope.row)"
+            @click="onView(scope.row)"
           />
         </template>
       </el-table-column>
@@ -150,7 +150,7 @@ export default {
         })
       }
     },
-    toView (alarm) {
+    onView (alarm) {
       this.$refs.preview.show({
         type: AssetType.IMAGE,
         keyName: alarm.keyName

+ 2 - 2
src/views/device/detail/components/DeviceInfo.vue

@@ -5,7 +5,7 @@
       <permission :access="[Access.MANAGE_DEVICES, Access.MANAGE_DEVICE]">
         <span
           class="c-sibling-item c-info__edit u-pointer"
-          @click="toEdit"
+          @click="onEdit"
         >
           <i class="el-icon-edit" />
           编辑
@@ -112,7 +112,7 @@ export default {
     }
   },
   methods: {
-    toEdit () {
+    onEdit () {
       this.info = {
         name: this.device.name,
         remark: this.device.remark

+ 2 - 2
src/views/device/detail/components/ReceivingCardInfoEdit.vue

@@ -88,7 +88,7 @@
 
       <button
         class="o-button"
-        @click="toAdd"
+        @click="onAdd"
       >
         <i class="o-button__icon el-icon-circle-plus-outline" />
         新增
@@ -274,7 +274,7 @@ export default {
         })
       }
     },
-    toAdd () {
+    onAdd () {
       this.receivingCard = {
         manufacturerId: '',
         topologyFile: null,

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

@@ -13,7 +13,7 @@
         <div class="l-flex__auto c-sibling-item">
           <button
             class="o-button"
-            @click="toAdd"
+            @click="onAdd"
           >
             <i class="o-button__icon el-icon-circle-plus-outline" />
             新增
@@ -51,7 +51,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click="toEdit(scope.row)"
+            @click="onEdit(scope.row)"
           >
             编辑
           </div>
@@ -63,7 +63,7 @@
           </div>
           <div
             class="c-table__btn u-pointer"
-            @click="toDel(scope.row)"
+            @click="onDel(scope.row)"
           >
             删除
           </div>

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

@@ -17,7 +17,7 @@
           <button
             v-if="canEdit"
             class="o-button"
-            @click="toAdd"
+            @click="onAdd"
           >
             <i class="o-button__icon el-icon-circle-plus-outline" />
             新增
@@ -156,7 +156,7 @@
           <template v-if="!scope.row.empty">
             <div
               class="c-table__btn u-pointer"
-              @click.stop="toEditDevice(scope.row)"
+              @click.stop="onEditDevice(scope.row)"
             >
               查看
             </div>
@@ -164,7 +164,7 @@
               <div
                 v-if="scope.row.isMaster"
                 class="c-table__btn u-pointer"
-                @click.stop="toAddSubDevice(scope.row)"
+                @click.stop="onAddSubDevice(scope.row)"
               >
                 添加备份设备
               </div>
@@ -177,7 +177,7 @@
               </div>
               <div
                 class="c-table__btn u-pointer"
-                @click.stop="toDelDevice(scope.row)"
+                @click.stop="onDelDevice(scope.row)"
               >
                 删除
               </div>
@@ -252,7 +252,7 @@
       <template #footer>
         <button
           class="o-button"
-          @click="toSave"
+          @click="onSave"
         >
           确定
         </button>
@@ -521,12 +521,12 @@ export default {
       this.$device = null
       this.show = false
     },
-    toAddSubDevice (item) {
+    onAddSubDevice (item) {
       this.isSub = true
       this.$master = item
-      this.toAdd()
+      this.onAdd()
     },
-    toEditDevice (item) {
+    onEditDevice (item) {
       this.$router.push({
         name: 'device-detail',
         params: {
@@ -539,7 +539,7 @@ export default {
       item.children = []
       this.getSubDevices(item)
     },
-    toSave () {
+    onSave () {
       if (this.isSub) {
         if (this.check(this.currObj)) {
           addSubDevice(this.$master, this.currObj).then(() => {
@@ -551,9 +551,9 @@ export default {
         this.save()
       }
     },
-    toDelDevice (item) {
+    onDelDevice (item) {
       if (item.isMaster) {
-        this.toDel(item)
+        this.onDel(item)
       } else {
         this.proxy.del(item).then(() => {
           this.reloadSubDevices(item.parent)

+ 3 - 3
src/views/device/mixins/index.js

@@ -20,14 +20,14 @@ export default {
     transform (data) {
       return data
     },
-    toAdd () {
+    onAdd () {
       this.currObj = this.getDefaults()
       this.show = true
     },
     beforeEdit ({ id, name, remark }) {
       return { id, name, remark }
     },
-    toEdit (item) {
+    onEdit (item) {
       this.currObj = this.beforeEdit(item)
       this.$currObj = { ...this.currObj }
       this.show = true
@@ -78,7 +78,7 @@ export default {
         })
       }
     },
-    toDel (item) {
+    onDel (item) {
       const options = this.options || this
       this.proxy.del(item).then(() => {
         if (options.list.length === 1 && options.params.pageNum > 1) {

+ 3 - 3
src/views/device/product/index.vue

@@ -13,7 +13,7 @@
         <div class="l-flex__auto c-sibling-item">
           <button
             class="o-button"
-            @click="toAdd"
+            @click="onAdd"
           >
             <i class="o-button__icon el-icon-circle-plus-outline" />
             新增
@@ -70,13 +70,13 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click="toEdit(scope.row)"
+            @click="onEdit(scope.row)"
           >
             编辑
           </div>
           <div
             class="c-table__btn u-pointer"
-            @click="toDel(scope.row)"
+            @click="onDel(scope.row)"
           >
             删除
           </div>

+ 4 - 4
src/views/external/transmitter/index.vue

@@ -13,7 +13,7 @@
         <div class="l-flex__auto c-sibling-item">
           <button
             class="o-button"
-            @click="toAdd"
+            @click="onAdd"
           >
             <i class="o-button__icon el-icon-circle-plus-outline" />
             新增
@@ -73,13 +73,13 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click="toEdit(scope.row)"
+            @click="onEdit(scope.row)"
           >
             编辑
           </div>
           <div
             class="c-table__btn u-pointer"
-            @click="toDel(scope.row)"
+            @click="onDel(scope.row)"
           >
             删除
           </div>
@@ -241,7 +241,7 @@ export default {
         })
       }
     },
-    toAdd () {
+    onAdd () {
       this.transmitter = {
         manufacturerId: '',
         name: '',

+ 5 - 5
src/views/media/index.vue

@@ -96,7 +96,7 @@
               v-if="isImage"
               class="o-thumbnail u-pointer"
               :style="{ 'background-image': `url('${scope.row.thumbnail}')` }"
-              @click="toView(scope.row)"
+              @click="onView(scope.row)"
             />
             <span v-else>{{ scope.row.duration }}</span>
           </template>
@@ -121,7 +121,7 @@
           <template v-slot="scope">
             <div
               class="c-table__btn u-pointer"
-              @click="toView(scope.row)"
+              @click="onView(scope.row)"
             >
               预览
             </div>
@@ -138,7 +138,7 @@
             >
               <div
                 class="c-table__btn u-pointer"
-                @click="toDel(scope.row)"
+                @click="onDel(scope.row)"
               >
                 删除
               </div>
@@ -314,7 +314,7 @@ export default {
         asset.name = asset.originalName
       })
     },
-    toView (asset) {
+    onView (asset) {
       this.$refs.preview.show({
         type: this.type,
         keyName: asset.keyName
@@ -325,7 +325,7 @@ export default {
         this.reloadList()
       })
     },
-    toDel (asset) {
+    onDel (asset) {
       deleteAsset(asset).then(() => {
         this.reloadList()
       })

+ 3 - 3
src/views/review/components/ReviewAsset.vue

@@ -27,7 +27,7 @@
             v-if="scope.row.type === 1"
             class="o-thumbnail u-pointer"
             :style="{ 'background-image': `url('${scope.row.thumbnail}')` }"
-            @click="toView(scope.row)"
+            @click="onView(scope.row)"
           />
           <template v-else>{{ scope.row.duration }}</template>
         </template>
@@ -52,7 +52,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -115,7 +115,7 @@ export default {
       asset.createBy = asset.userName || asset.createBy
       return asset
     },
-    toView ({ type, keyName }) {
+    onView ({ type, keyName }) {
       this.$refs.preview.show({ type, keyName })
     }
   }

+ 2 - 2
src/views/review/components/ReviewProgram.vue

@@ -36,7 +36,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -71,7 +71,7 @@ export default {
       program.createBy = program.userName || program.createBy
       return program
     },
-    toView ({ id }) {
+    onView ({ id }) {
       window.open(this.$router.resolve({
         name: 'view',
         params: { id }

+ 4 - 7
src/views/review/components/ReviewProgramRecur.vue

@@ -36,7 +36,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -58,7 +58,7 @@
     <el-dialog
       :visible.sync="isPreview"
       custom-class="c-preview schedule"
-      :before-close="handleCloseScheduleDialog"
+      :before-close="onCloseScheduleDialog"
     >
       <schedule
         v-if="scheduleId"
@@ -93,17 +93,14 @@ export default {
   },
   methods: {
     _getList: getSchedules,
-    toView ({ id }) {
+    onView ({ id }) {
       this.scheduleId = id
       this.isPreview = true
     },
-    handleCloseScheduleDialog () {
+    onCloseScheduleDialog () {
       this.scheduleId = null
       this.isPreview = false
     }
   }
 }
 </script>
-
-<style lang="scss" scoped>
-</style>

+ 19 - 19
src/views/review/components/ReviewPublish.vue

@@ -50,7 +50,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -164,7 +164,23 @@ export default {
     toggle (row) {
       this.$refs.table.getInstance().toggleRowExpansion(row)
     },
-    toViewSchedule (id) {
+    onView ({ target: { type, detail } }) {
+      switch (type) {
+        case PublishType.CALENDAR:
+          this.viewSchedule(detail)
+          break
+        case PublishType.EVENT:
+          if (detail.target.type === EventTarget.RECUR) {
+            this.viewSchedule(detail.target.id)
+          } else {
+            this.viewProgram(detail.target.id)
+          }
+          break
+        default:
+          break
+      }
+    },
+    viewSchedule (id) {
       this.scheduleId = id
       this.isPreview = true
     },
@@ -172,28 +188,12 @@ export default {
       this.scheduleId = null
       this.isPreview = false
     },
-    toViewProgram (id) {
+    viewProgram (id) {
       console.log(id)
       window.open(this.$router.resolve({
         name: 'view',
         params: { id }
       }).href, '_blank')
-    },
-    toView ({ target: { type, detail } }) {
-      switch (type) {
-        case PublishType.CALENDAR:
-          this.toViewSchedule(detail)
-          break
-        case PublishType.EVENT:
-          if (detail.target.type === EventTarget.RECUR) {
-            this.toViewSchedule(detail.target.id)
-          } else {
-            this.toViewProgram(detail.target.id)
-          }
-          break
-        default:
-          break
-      }
     }
   }
 }

+ 4 - 7
src/views/review/components/ReviewSchedule.vue

@@ -36,7 +36,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -58,7 +58,7 @@
     <el-dialog
       :visible.sync="isPreview"
       custom-class="c-preview schedule"
-      :before-close="handleCloseScheduleDialog"
+      :before-close="onCloseScheduleDialog"
     >
       <schedule
         v-if="scheduleId"
@@ -93,17 +93,14 @@ export default {
   },
   methods: {
     _getList: getSchedules,
-    toView ({ id }) {
+    onView ({ id }) {
       this.scheduleId = id
       this.isPreview = true
     },
-    handleCloseScheduleDialog () {
+    onCloseScheduleDialog () {
       this.scheduleId = null
       this.isPreview = false
     }
   }
 }
 </script>
-
-<style lang="scss" scoped>
-</style>

+ 20 - 19
src/views/schedule/history/index.vue

@@ -55,7 +55,7 @@
         <template v-slot="scope">
           <div
             class="c-table__btn u-pointer"
-            @click.stop="toView(scope.row)"
+            @click.stop="onView(scope.row)"
           >
             预览
           </div>
@@ -175,35 +175,36 @@ export default {
     toggle (row) {
       this.$refs.table.getInstance().toggleRowExpansion(row)
     },
-    toViewSchedule (id) {
-      this.scheduleId = id
-      this.isPreview = true
-    },
-    onCloseScheduleDialog () {
-      this.scheduleId = null
-      this.isPreview = false
-    },
-    toViewProgram (id) {
-      window.open(this.$router.resolve({
-        name: 'view',
-        params: { id }
-      }).href, '_blank')
-    },
-    toView ({ target: { type, detail } }) {
+    onView ({ target: { type, detail } }) {
       switch (type) {
         case PublishType.CALENDAR:
-          this.toViewSchedule(detail)
+          this.viewSchedule(detail)
           break
         case PublishType.EVENT:
           if (detail.target.type === EventTarget.RECUR) {
-            this.toViewSchedule(detail.target.id)
+            this.viewSchedule(detail.target.id)
           } else {
-            this.toViewProgram(detail.target.id)
+            this.viewProgram(detail.target.id)
           }
           break
         default:
           break
       }
+    },
+    viewSchedule (id) {
+      this.scheduleId = id
+      this.isPreview = true
+    },
+    onCloseScheduleDialog () {
+      this.scheduleId = null
+      this.isPreview = false
+    },
+    viewProgram (id) {
+      console.log(id)
+      window.open(this.$router.resolve({
+        name: 'view',
+        params: { id }
+      }).href, '_blank')
     }
   }
 }

+ 3 - 3
src/views/schedule/timeline/index.vue

@@ -10,7 +10,7 @@
         class="l-flex__none c-device-detail__screen o-program"
         :class="{ 'u-pointer': programProxy }"
         :style="programStyle"
-        @click="toView"
+        @click="onView"
       />
       <div class="l-flex__auto l-flex--col">
         <div class="l-flex__none c-device-detail__name u-ellipsis">{{ deivceName }}</div>
@@ -18,7 +18,7 @@
           <div class="l-flex__none c-device-detail__program">
             <span
               class="u-pointer"
-              @click="toView"
+              @click="onView"
             >{{ programName }}</span>
           </div>
           <div class="l-flex__none c-device-detail__time">{{ programTime }}</div>
@@ -490,7 +490,7 @@ export default {
       }
       this.programProxy = programProxy
     },
-    toView () {
+    onView () {
       if (this.programProxy) {
         switch (this.programProxy.event.target.type) {
           case ScheduleType.CALENDAR:

+ 2 - 2
src/views/upgrade/deploy/index.vue

@@ -13,7 +13,7 @@
         <div class="l-flex__auto c-sibling-item">
           <button
             class="o-button"
-            @click="toAdd"
+            @click="onAdd"
           >
             <i class="o-button__icon el-icon-circle-plus-outline" />
             新增
@@ -324,7 +324,7 @@ export default {
         options.loading = false
       })
     },
-    toAdd () {
+    onAdd () {
       this.version = {
         name: '',
         fileId: '',

+ 2 - 2
src/views/upgrade/index.vue

@@ -13,7 +13,7 @@
         <div class="l-flex__auto c-sibling-item">
           <button
             class="o-button"
-            @click="toAdd"
+            @click="onAdd"
           >
             <i class="o-button__icon el-icon-circle-plus-outline" />
             新增
@@ -325,7 +325,7 @@ export default {
         options.loading = false
       })
     },
-    toAdd () {
+    onAdd () {
       this.apk = {
         file: null,
         name: '',