瀏覽代碼

feat: adjust some styles and api parameters

set the timeout time for the device api to 30s
Casper Dai 2 年之前
父節點
當前提交
bcf1ff49ff

+ 7 - 2
src/api/device.js

@@ -145,6 +145,7 @@ export function getDevicesByTenant (tenant, query, options) {
       pageSize,
       ...params
     },
+    timeout: 30000,
     ...options
   })
 }
@@ -160,6 +161,7 @@ export function getDevicesByOrg (org, query, options) {
       pageSize,
       ...params
     },
+    timeout: 30000,
     ...options
   })
 }
@@ -590,11 +592,13 @@ export function getStatusReport (id, options) {
   })
 }
 
-export function getDevicesWithPower (params) {
+export function getDevicesWithPower (params, options) {
   return request({
     url: '/device/bond/multiFunction/list',
     method: 'GET',
-    params: addTenant(params)
+    params: addTenant(params),
+    timeout: 30000,
+    ...options
   })
 }
 
@@ -611,6 +615,7 @@ export function getDepartmentDeviceTreeByGroup (path, options) {
     url: '/tenant/department/device/list',
     method: 'GET',
     params: data,
+    timeout: 30000,
     ...options
   })
 }

+ 17 - 13
src/components/dialog/TaskDialog/index.vue

@@ -7,22 +7,24 @@
   >
     <template #default>
       <div class="c-grid-form auto u-align-self--center">
-        <div class="c-grid-form__label">重复方式</div>
-        <div>
-          <el-select v-model="task.freq">
-            <el-option
-              v-for="option in freqOptions"
-              :key="option.value"
-              :label="option.label"
-              :value="option.value"
-            />
-          </el-select>
-        </div>
+        <div class="c-grid-form__label">执行方式</div>
+        <el-radio-group
+          v-model="task.freq"
+          class="l-flex--row c-grid-form__auto u-width--lg"
+        >
+          <el-radio
+            v-for="option in freqOptions"
+            :key="option.value"
+            :label="option.value"
+          >
+            {{ option.label }}
+          </el-radio>
+        </el-radio-group>
         <template v-if="isWeekly">
           <div class="c-grid-form__label c-grid-form__auto u-required">每周</div>
           <el-checkbox-group
             v-model="task.dayOfWeek"
-            class="c-grid-form__auto l-flex--row"
+            class="l-flex--row c-grid-form__auto"
             size="mini"
             fill="#1c5cb0"
           >
@@ -38,8 +40,10 @@
         <div class="c-grid-form__label u-required">执行时间</div>
         <el-time-picker
           v-model="task.executeTime"
+          class="u-width--xs"
           placeholder="请选择执行时间"
           value-format="HH:mm:ss"
+          format="HH:mm"
           :clearable="false"
         />
         <slot :freq="task.freq" />
@@ -112,7 +116,7 @@ export default {
       this.task = {
         freq,
         dayOfWeek: dayOfWeek ? dayOfWeek.split(',') : [],
-        executeTime: executeTime || parseTime(new Date(), '{h}:{i}:{s}')
+        executeTime: executeTime ? executeTime.replace(/\d{2}$/, '00') : parseTime(new Date(), '{h}:{i}:00')
       }
       this.$refs.dialog.show()
     },

+ 0 - 36
src/views/ad/automation/api.js

@@ -1,7 +1,6 @@
 import request from '@/utils/request'
 import {
   send,
-  confirmAndSend,
   addTenantOrOrg
 } from '@/api/base'
 
@@ -32,38 +31,3 @@ export function getContract (id) {
     params: { id }
   })
 }
-
-export function getDeviceSchedulings (query, options) {
-  const { pageNum: pageIndex, pageSize, ...params } = query
-  return request({
-    url: '/ad/tenant/order/scheduling/list',
-    method: 'GET',
-    params: {
-      order: 'startDate',
-      pageIndex, pageSize,
-      ...params,
-      ...options
-    }
-  })
-}
-
-export function getDeviceScheduling (query, options) {
-  const { pageNum: pageIndex, pageSize, ...params } = query
-  return request({
-    url: '/ad/tenant/order/scheduling/detail',
-    method: 'GET',
-    params: {
-      pageIndex, pageSize,
-      ...params,
-      ...options
-    }
-  })
-}
-
-export function setSchedulingEnable ({ id, startDate }, enable) {
-  return confirmAndSend(enable ? `发布${startDate}节目单` : `停用${startDate}节目单`, null, {
-    url: `/ad/tenant/order/scheduling/${enable ? 'enable' : 'disable'}`,
-    method: 'POST',
-    data: { id }
-  })
-}

+ 4 - 1
src/views/device/detail/components/DeviceInvoke/MultifunctionCardPowerSwitch.vue

@@ -58,15 +58,18 @@
           v-if="freq === 2"
           key="taskTime"
           v-model="taskTime"
+          class="u-width--sm"
           type="date"
           placeholder="选择日期"
           value-format="yyyy-MM-dd"
           :picker-options="singleTimePickerOptions"
+          :clearable="false"
         />
         <el-date-picker
           v-else
           key="taskDate"
           v-model="taskDate"
+          class="u-width--lg"
           type="daterange"
           range-separator="至"
           start-placeholder="开始日期"
@@ -301,8 +304,8 @@ export default {
               ? { type: 'success', label: '启用' }
               : { type: 'danger', label: '停用' } },
           { type: 'invoke', render: [
+            { label: ({ enable }) => enable ? '停用' : '启用', allow: task => !this.isExpired(task), on: this.onToggle },
             { label: '编辑', on: this.onEdit },
-            { label: ({ enable }) => enable ? '停用' : '启用', render: task => !this.isExpired(task), on: this.onToggle },
             { label: '删除', on: this.onDel }
           ], width: 140 }
         ]

+ 4 - 2
src/views/device/power/index.vue

@@ -40,6 +40,7 @@
           v-if="freq === 2"
           key="taskTime"
           v-model="taskTime"
+          class="u-width--sm"
           type="date"
           placeholder="选择日期"
           value-format="yyyy-MM-dd"
@@ -49,6 +50,7 @@
           v-else
           key="taskDate"
           v-model="taskDate"
+          class="u-width--lg"
           type="daterange"
           range-separator="至"
           start-placeholder="开始日期"
@@ -63,13 +65,13 @@
             v-model="taskAction"
             :label="0"
           >
-            开启
+            开启电源
           </el-radio>
           <el-radio
             v-model="taskAction"
             :label="1"
           >
-            关闭
+            关闭电源
           </el-radio>
         </div>
       </template>