Selaa lähdekoodia

fix: the component Warning click invalid

Casper Dai 3 vuotta sitten
vanhempi
sitoutus
ec6ccac59a

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

@@ -5,7 +5,7 @@
   >
     <warning
       v-if="error"
-      @retry="getDevices"
+      @click="getDevices"
     />
     <template v-else>
       <div class="l-flex__none l-flex--row">

+ 36 - 54
src/components/Schedule/components/ScheduleWrapper.vue

@@ -1,49 +1,42 @@
 <template>
   <div
-    v-loading="loading"
     class="l-flex--col c-schedule-wrapper"
     @click.stop
   >
-    <warning
-      v-if="error"
-      @retry="retry"
-    />
-    <template v-if="!error && !loading">
-      <div
-        v-if="!hideHeader"
-        class="l-flex__none l-flex--row c-schedule-wrapper__header has-bottom-padding"
-      >
-        <div class="l-flex__auto l-flex--row c-sibling-item c-schedule-wrapper__tip u-ellipsis">
-          {{ name }}
-        </div>
-        <template v-if="editable">
-          <button
-            class="l-flex__none c-sibling-item o-button"
-            @click="add"
-          >
-            <i class="o-button__icon el-icon-circle-plus-outline" />
-            新增
-          </button>
-          <button
-            v-if="dirty"
-            class="l-flex__none c-sibling-item o-button"
-            @click="save"
-          >
-            <i class="o-button__icon el-icon-download" />
-            保存
-          </button>
-          <button
-            v-else
-            class="l-flex__none c-sibling-item o-button"
-            @click="submit"
-          >
-            <i class="o-button__icon el-icon-upload2" />
-            提交
-          </button>
-        </template>
+    <div
+      v-if="!hideHeader"
+      class="l-flex__none l-flex--row c-schedule-wrapper__header has-bottom-padding"
+    >
+      <div class="l-flex__auto l-flex--row c-sibling-item c-schedule-wrapper__tip u-ellipsis">
+        {{ name }}
       </div>
-      <slot />
-    </template>
+      <template v-if="editable">
+        <button
+          class="l-flex__none c-sibling-item o-button"
+          @click="onAdd"
+        >
+          <i class="o-button__icon el-icon-circle-plus-outline" />
+          新增
+        </button>
+        <button
+          v-if="dirty"
+          class="l-flex__none c-sibling-item o-button"
+          @click="onSave"
+        >
+          <i class="o-button__icon el-icon-download" />
+          保存
+        </button>
+        <button
+          v-else
+          class="l-flex__none c-sibling-item o-button"
+          @click="onSubmit"
+        >
+          <i class="o-button__icon el-icon-upload2" />
+          提交
+        </button>
+      </template>
+    </div>
+    <slot />
   </div>
 </template>
 
@@ -59,14 +52,6 @@ export default {
       type: [Boolean, String],
       default: false
     },
-    loading: {
-      type: [Boolean, String],
-      default: false
-    },
-    error: {
-      type: [Boolean, String],
-      default: false
-    },
     name: {
       type: String,
       default: ''
@@ -77,16 +62,13 @@ export default {
     }
   },
   methods: {
-    retry () {
-      this.$emit('retry')
-    },
-    add () {
+    onAdd () {
       this.$emit('add')
     },
-    submit () {
+    onSubmit () {
       this.$emit('submit')
     },
-    save () {
+    onSave () {
       this.$emit('save')
     }
   }

+ 2 - 9
src/components/Schedule/index.vue

@@ -51,7 +51,6 @@ export default {
   render (h) {
     if (this.options.loading) {
       return h('div', {
-        class: 'c-schedule',
         directives: [
           {
             name: 'loading',
@@ -62,12 +61,12 @@ export default {
     }
 
     if (this.options.error) {
-      return h('StatusWrapper', {
+      return h('Warning', {
         props: {
           error: true
         },
         on: {
-          retry: this.getSchedule
+          click: this.getSchedule
         }
       })
     }
@@ -83,9 +82,3 @@ export default {
   }
 }
 </script>
-
-<style lang="scss" scoped>
-.c-schedule {
-  min-height: 300px;
-}
-</style>

+ 1 - 1
src/components/Warning/index.vue

@@ -3,7 +3,7 @@
     <template #extra>
       <el-link
         type="warning"
-        v-bind="$listeners"
+        v-on="$listeners"
       >
         获取失败,点击重试
       </el-link>

+ 1 - 1
src/components/table/CTable/index.vue

@@ -20,7 +20,7 @@
       <status-wrapper
         slot="empty"
         :error="options.error"
-        @retry="onPagination"
+        @click="onPagination"
       />
     </el-table>
     <pagination

+ 1 - 1
src/components/table/GridTable/index.vue

@@ -71,7 +71,7 @@
     <status-wrapper
       v-if="isAbnormal"
       :error="options.error"
-      @retry="onPagination"
+      @click="onPagination"
     />
     <template v-else>
       <grid-table-body

+ 1 - 1
src/components/table/Table/index.vue

@@ -84,7 +84,7 @@
       <status-wrapper
         slot="empty"
         :error="options.error"
-        @retry="onPagination"
+        @click="onPagination"
       />
     </el-table>
     <pagination

+ 1 - 1
src/views/basic/profile/index.vue

@@ -28,7 +28,7 @@
     <div class="l-flex__fill l-flex--col center">
       <warning
         v-if="error"
-        @retry="getUserInfo"
+        @click="getUserInfo"
       />
       <div
         v-else

+ 15 - 5
src/views/device/back/index.vue

@@ -4,7 +4,10 @@
     margin
     background
   >
-    <div v-loading="loading" class="has-padding">
+    <div
+      v-loading="loading"
+      class="has-padding"
+    >
       <div class="l-flex--row c-table__header">
         <div class="l-flex__auto c-sibling-item">
           <!-- <el-checkbox-group v-model="checkList" @change="chechChange">
@@ -34,7 +37,10 @@
         </div>
       </div>
       <div>
-        <el-row :gutter="16" class="rowheight">
+        <el-row
+          :gutter="16"
+          class="rowheight"
+        >
           <el-col
             v-for="(item, index) in returnList.list"
             :key="index"
@@ -46,7 +52,11 @@
               class="bg-purple"
               :style="{ height: returnheight }"
             >
-              <Videobox :device="item" :zoomnum="zoomnum" :returnheight="returnheight" />
+              <Videobox
+                :device="item"
+                :zoomnum="zoomnum"
+                :returnheight="returnheight"
+              />
             </div>
           </el-col>
         </el-row>
@@ -59,7 +69,7 @@
       </div>
       <warning
         v-if="returnList.error"
-        @retry="getDevices"
+        @click="getDevices"
       />
     </div>
   </wrapper>
@@ -160,7 +170,7 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.imghover{
+.imghover {
   cursor: pointer;
 }
 .has-padding {

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

@@ -6,7 +6,7 @@
     <template v-if="!loading">
       <warning
         v-if="error"
-        @retry="getDefaults"
+        @click="getDefaults"
       />
       <template v-if="canEdit">
         <tabs

+ 1 - 1
src/views/device/detail/components/external/Transmitter/index.vue

@@ -6,7 +6,7 @@
     <template v-if="!loading">
       <warning
         v-if="error"
-        @retry="getDefaults"
+        @click="getDefaults"
       />
       <template v-if="info">
         <div class="c-info large">

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

@@ -11,7 +11,7 @@
     >
       <warning
         v-if="error"
-        @retry="getGroups"
+        @click="getGroups"
       />
       <template v-else>
         <div class="l-flex__none o-title">全部分组</div>

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

@@ -181,7 +181,7 @@
       <status-wrapper
         v-if="isAbnormal"
         :error="deviceOptions.error"
-        @retry="getDevices"
+        @click="getDevices"
       />
       <pagination
         :total="deviceOptions.totalCount"