Explorar el Código

feat(camera): the viewing time range of recorded video is changed to 6 hours

Casper Dai hace 2 años
padre
commit
334f5c2b1b
Se han modificado 2 ficheros con 17 adiciones y 11 borrados
  1. 2 4
      src/components/table/Table/index.vue
  2. 15 7
      src/views/device/camera/index.vue

+ 2 - 4
src/components/table/Table/index.vue

@@ -74,12 +74,10 @@
               @search="onChange"
             />
           </template>
-          <template v-if="filter.type === 'datetime'">
+          <template v-if="filter.type === 'datepicker'">
             <el-date-picker
               v-model="options.params[filter.key]"
-              type="datetime"
-              :placeholder="filter.placeholder"
-              value-format="yyyy-MM-dd HH:mm:ss"
+              v-bind="filter.options"
               @change="onChange"
             />
           </template>

+ 15 - 7
src/views/device/camera/index.vue

@@ -21,8 +21,8 @@
       :schema="sdRecordSchema"
     >
       <template #header>
-        <div class="u-color--error">
-          展示的为结束时间往前一小时内的录像,默认为当前时间
+        <div class="l-flex--row u-color--info">
+          展示的为结束时间往前&nbsp;<span class="u-color--blue u-font-size--lg">6</span>&nbsp;小时内的录像
         </div>
       </template>
     </table-dialog>
@@ -105,7 +105,13 @@ export default {
         nonPagination: true,
         list: this.getSDRecords,
         filters: [
-          { key: 'time', type: 'datetime', placeholder: '结束时间' }
+          { key: 'time', type: 'datepicker', options: {
+            type: 'datetime',
+            placeholder: '结束时间',
+            'picker-options': {
+              disabledDate: this.isDisableDate
+            }
+          } }
         ],
         cols: [
           { type: 'refresh' },
@@ -150,7 +156,6 @@ export default {
       this.$refs.recordTableDialog.show()
     },
     getRecords (params) {
-      console.log(params)
       clearTimeout(this.$timer)
       if (params.pageNum === 1) {
         this.$timer = setTimeout(() => {
@@ -181,12 +186,15 @@ export default {
       this.$refs.previewDialog.show({ type: AssetType.VIDEO, url })
     },
     onViewSD () {
-      this.$refs.sdRecordTableDialog.show()
+      if (!this.$date) {
+        this.$date = new Date()
+      }
+      this.$refs.sdRecordTableDialog.show({ time: this.$date })
     },
     getSDRecords ({ time }) {
-      time = time ? new Date(time) : new Date()
+      this.$date = time
       const startTime = new Date(time.getTime())
-      startTime.setHours(startTime.getHours() - 1)
+      startTime.setHours(startTime.getHours() - 6)
       return getSDRecords({
         identifier: this.identifier,
         startTime: parseTime(startTime, '{y}-{m}-{d} {h}:{i}:{s}'),