diff --git a/src/api/ss/time.js b/src/api/ss/time.js
new file mode 100644
index 0000000..5bec71b
--- /dev/null
+++ b/src/api/ss/time.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询设备时长变化记录列表
+export function listTime(query) {
+ return request({
+ url: '/ss/time/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询设备时长变化记录详细
+export function getTime(id) {
+ return request({
+ url: '/ss/time/' + id,
+ method: 'get'
+ })
+}
+
+// 新增设备时长变化记录
+export function addTime(data) {
+ return request({
+ url: '/ss/time',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改设备时长变化记录
+export function updateTime(data) {
+ return request({
+ url: '/ss/time',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除设备时长变化记录
+export function delTime(id) {
+ return request({
+ url: '/ss/time/' + id,
+ method: 'delete'
+ })
+}
diff --git a/src/api/system/device.js b/src/api/system/device.js
index 3420ea6..3a7dfa3 100644
--- a/src/api/system/device.js
+++ b/src/api/system/device.js
@@ -76,3 +76,19 @@ export function refreshIot(deviceId) {
method: 'get'
})
}
+
+// 添加时长
+export function addTime(deviceId, amount) {
+ return request({
+ url: `/system/device/addTime/${deviceId}?amount=${amount}`,
+ method: 'put'
+ })
+}
+
+// 时长归零
+export function resetDevice(deviceId) {
+ return request({
+ url: `/system/device/${deviceId}/reset`,
+ method: 'put'
+ })
+}
diff --git a/src/utils/index.js b/src/utils/index.js
index 605c351..8e495bf 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -450,3 +450,7 @@ export function escapeHtml(text, allowScript = false) {
// 再转义其他HTML特殊字符
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}
+
+export function isEmpty(str) {
+ return str == null || str.length === 0;
+}
diff --git a/src/utils/mixins.js b/src/utils/mixins.js
new file mode 100644
index 0000000..15e501e
--- /dev/null
+++ b/src/utils/mixins.js
@@ -0,0 +1,27 @@
+export const $view = {
+ props: {
+ view: {
+ type: String,
+ default: null
+ }
+ },
+ computed: {
+ hasView() {
+ return (views) => {
+ if (views == null || views.length === 0) {
+ return false;
+ }
+ let list = views;
+ if (views instanceof String) {
+ list = views.split(',');
+ }
+ return list != null && list.includes(this.view);
+ }
+ },
+ notHasView() {
+ return (views) => {
+ return !this.hasView(views);
+ }
+ }
+ }
+}
diff --git a/src/views/ss/time/index.vue b/src/views/ss/time/index.vue
new file mode 100644
index 0000000..fe8ca4d
--- /dev/null
+++ b/src/views/ss/time/index.vue
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 导出
+
+
+
+
+
+
+
+
+ {{d.row.amount}} 分钟
+
+ \
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/system/device/detail.vue b/src/views/system/device/detail.vue
index 7c59a1e..f536174 100644
--- a/src/views/system/device/detail.vue
+++ b/src/views/system/device/detail.vue
@@ -3,6 +3,8 @@
+ 时长归零
+ 增加时长
刷新设备信息
---->
{{deviceData.wifi | defaultValue}}
- {{surplusTime | defaultValue}} 分钟
+ {{surplusTime}} 分钟
+
+ {{deviceData.remainTime / 60 | money | defaultValue}} 分钟
+
+
{{deviceData.realTimePower | defaultValue}} KWH
{{deviceData.remark | defaultValue}}
-
-
-
+
+
+
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+ 分钟
+
+
+
+ 确认
+ 取消
+
+