Skip to content

Commit 64fabe6

Browse files
修复了一些界面上的bug
1 parent bad1755 commit 64fabe6

File tree

21 files changed

+238
-122
lines changed

21 files changed

+238
-122
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<img src="https://img.shields.io/npm/v/cxs-ui?color=blue">
44
</a>
55
<a href="">
6-
<img src="https://img.shields.io/static/v1?label=Vue&message=2.0&color=green">
6+
<img src="https://img.shields.io/static/v1?label=Vue&message=2.6.12&color=green">
77
</a>
88
<a href="https://github.com/ThingsPanel/ThingsPanel-Backend-Vue">
99
<img src="https://img.shields.io/npm/dependency-version/cxs-ui/element-ui?color=green">
@@ -40,7 +40,7 @@
4040
# 2. 技术栈
4141

4242
- Backend:Golang(Go 1.17.5)
43-
- Frontend:Vue.js Element-UI (node.js 16.13)
43+
- Frontend:Vue.js(2.6.12) Element-UI (node.js 16.13)
4444
- MQTT Broker:GMQTT
4545
- TSDB: PostgreSQL 14.1
4646

public/themes/default.css

+14-4
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ span.text-blue.font-weight-bold.font-size-base.d-none.d-lg-block.mr-1 {
136136
background-color: rgba(22, 30, 67, 0.5) !important;
137137
border-color: rgba(0, 0, 0, 0.1) !important;
138138
}
139+
.el-input .el-input__count .el-input__count-inner {
140+
background-color: transparent!important;
141+
}
142+
139143
.el-dark-input .el-input__inner, .el-dark-input .el-textarea__inner {
140144
color: #fff;
141145
background-color: rgba(22, 30, 67, 0.5) !important;
@@ -422,13 +426,19 @@ span.text-blue.font-weight-bold.font-size-base.d-none.d-lg-block.mr-1 {
422426
color: #ffffff!important;
423427
}
424428

429+
.popper__arrow::after {
430+
border-bottom-color: #2d3d88!important;
431+
}
425432
.el-popover {
433+
background-color: #2d3d88!important;
434+
border: 1px solid #212d66!important;
435+
color:#fff!important;
436+
}
437+
/* .el-popover {
426438
border: unset!important;
427439
color:#000!important;
428440
}
429-
/* .el-popover.el-table {
430-
background-color: transparent!important;
431-
} */
441+
432442
.el-popover.el-table.el-table__header-wrapper {
433443
background-color: transparent!important;
434444
}
@@ -446,4 +456,4 @@ span.text-blue.font-weight-bold.font-size-base.d-none.d-lg-block.mr-1 {
446456
}
447457
.el-popover .el-table tbody tr:hover>td {
448458
background: #f5f7fa !important
449-
}
459+
} */

src/components/common/VideoPlayer.vue

+32-5
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,57 @@ export default {
2929
handler(newValue) {
3030
console.log("====video.src", newValue)
3131
if (this.player) {
32-
this.player.destroy();
33-
this.player = new WasmPlayer(null, 'Player', this.callbackFun, {Height: true, openAudio: false})
32+
this.destroy();
33+
this.createPlayer();
3434
}
3535
if (newValue) {
3636
// 调用播放
37-
this.player.play(newValue, 1)
37+
this.play();
3838
}
39-
}
39+
},
40+
immediate: true
4041
}
4142
},
4243
mounted() {
4344
this.createPlayer();
4445
},
4546
methods: {
47+
/**
48+
* 创建播放器
49+
*/
4650
createPlayer() {
4751
this.player = new WasmPlayer(null, 'Player', this.callbackFun, {Height: true, openAudio: false})
4852
},
53+
/**
54+
* 回调函数
55+
* @param e
56+
*/
4957
callbackFun(e) {
5058
console.log('callbackFun', e);
5159
this.$emit("callback", e);
60+
},
61+
/**
62+
* 播放
63+
*/
64+
play() {
65+
if (!this.player) {
66+
this.createPlayer();
67+
}
68+
setTimeout(() => {
69+
this.player.play(this.src, 1)
70+
}, 50);
71+
},
72+
/**
73+
* 销毁播放器
74+
*/
75+
destroy() {
76+
if (!this.player) return;
77+
this.player.destroy();
78+
this.player = null;
5279
}
5380
},
5481
beforeDestroy() {
55-
this.player.destroy();
82+
this.destroy();
5683
}
5784
}
5885
</script>

src/utils/tool.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,18 @@ export function jsonProp(obj) {
7575
return obj;
7676
}
7777

78-
export function dateFormat(format) {
79-
var n = parseInt(format) * 1000;
78+
export function dateFormat(timestamp) {
79+
if (!timestamp) return "";
80+
if (timestamp.toString().length === 10) {
81+
timestamp = timestamp * 1000;
82+
} else if (timestamp.toString().length === 13) {
83+
timestamp = timestamp;
84+
} else if (timestamp.toString().length === 16) {
85+
timestamp = timestamp / 1000;
86+
} else {
87+
return "";
88+
}
89+
var n = parseInt(timestamp);
8090
var D = new Date(n);
8191
var year = D.getFullYear(); //四位数年份
8292

src/view/pages/alarm/AlarmIndex.vue

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: chaoxiaoshu-mx leukotrichia@163.com
33
* @Date: 2023-02-07 10:02:17
44
* @LastEditors: chaoxiaoshu-mx leukotrichia@163.com
5-
* @LastEditTime: 2023-03-29 17:04:14
5+
* @LastEditTime: 2023-04-06 09:11:17
66
* @FilePath: \ThingsPanel-Backend-Vue\src\view\pages\alarm\index.vue
77
* @Description: 告警信息列表
88
-->
@@ -172,7 +172,7 @@ export default {
172172
* @return {*}
173173
*/
174174
getAlarmList() {
175-
console.log("getAlarmList", this.params)
175+
this.loading = true;
176176
AlarmAPI.list(this.params)
177177
.then(({ data: result }) => {
178178
if (result.code === 200) {
@@ -181,6 +181,9 @@ export default {
181181
this.total = result.data.total;
182182
}
183183
})
184+
.finally(() => {
185+
this.loading = false;
186+
});
184187
},
185188
/**
186189
* @description: 显示详情对话框

src/view/pages/automation/components/time/WeeklySelector.vue

+16-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: chaoxiaoshu-mx leukotrichia@163.com
33
* @Date: 2023-02-02 08:39:13
44
* @LastEditors: chaoxiaoshu-mx leukotrichia@163.com
5-
* @LastEditTime: 2023-03-29 15:42:30
5+
* @LastEditTime: 2023-04-06 10:48:08
66
* @FilePath: \ThingsPanel-Backend-Vue\src\view\pages\automation\components\time\WeeklySelector.vue
77
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
88
-->
@@ -12,13 +12,14 @@
1212
<el-option v-for="(week, index) in weekOptions" :key="index" :label="week.label" :value="week.value"></el-option>
1313
</el-select>
1414

15-
<el-time-picker ref="timeRef" v-if="weekValue!=''" value-format="HH:mm"
16-
v-model="timeValue" :placeholder="$t('AUTOMATION.PLACEHOLDER.SELECT_TIME')" @change="handleChange"></el-time-picker>
15+
<el-time-picker ref="timeRef" v-if="weekValue!=''" value-format="HH:mm" v-model="timeValue"
16+
:placeholder="$t('AUTOMATION.PLACEHOLDER.SELECT_TIME')" @change="handleChange"></el-time-picker>
1717
</div>
1818
</template>
1919

2020
<script>
2121
import { message_error } from '@/utils/helpers';
22+
import { Week } from "../../control/Const";
2223
export default {
2324
name: "WeeklySelector",
2425
props: {
@@ -32,24 +33,25 @@ export default {
3233
data() {
3334
return {
3435
weekValue: "",
36+
timeValue: "",
3537
weekOptions: [
36-
{ label: this.$t('AUTOMATION.WEEK.MONDAY'), value: 1 },
37-
{ label: this.$t('AUTOMATION.WEEK.TUESDAY'), value: 2 },
38-
{ label: this.$t('AUTOMATION.WEEK.WEDNESDAY'), value: 3 },
39-
{ label: this.$t('AUTOMATION.WEEK.THURSDAY'), value: 4 },
40-
{ label: this.$t('AUTOMATION.WEEK.FRIDAY'), value: 5 },
41-
{ label: this.$t('AUTOMATION.WEEK.SATURDAY'), value: 6 },
42-
{ label: this.$t('AUTOMATION.WEEK.SUDNAY'), value: 7 }
43-
],
44-
timeValue: ""
38+
{ label: this.$t('AUTOMATION.WEEK.MONDAY'), value: Week.MONDAY },
39+
{ label: this.$t('AUTOMATION.WEEK.TUESDAY'), value: Week.THURSDAY },
40+
{ label: this.$t('AUTOMATION.WEEK.WEDNESDAY'), value: Week.WEDNESDAY },
41+
{ label: this.$t('AUTOMATION.WEEK.THURSDAY'), value: Week.THURSDAY },
42+
{ label: this.$t('AUTOMATION.WEEK.FRIDAY'), value: Week.FRIDAY },
43+
{ label: this.$t('AUTOMATION.WEEK.SATURDAY'), value: Week.SATURDAY },
44+
{ label: this.$t('AUTOMATION.WEEK.SUDNAY'), value: Week.SUNDAY }
45+
]
4546
}
4647
},
4748
watch: {
4849
data: {
4950
handler(newValue) {
50-
if (newValue) {
51+
if (newValue && newValue.week && newValue.time) {
5152
console.log("RepeatTimeSelector", newValue);
52-
this.formData = JSON.parse(JSON.stringify(newValue));
53+
this.weekValue = Number(newValue.week);
54+
this.timeValue = newValue.time;
5355
}
5456
},
5557
immediate: true

src/view/pages/automation/control/Const.js

+29-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: chaoxiaoshu-mx [email protected]
33
* @Date: 2023-02-20 19:41:00
44
* @LastEditors: chaoxiaoshu-mx [email protected]
5-
* @LastEditTime: 2023-03-30 10:14:30
5+
* @LastEditTime: 2023-04-06 09:56:22
66
* @FilePath: \ThingsPanel-Backend-Vue\src\view\pages\automation\control\Const.js
77
* @Description:
88
*/
@@ -80,6 +80,18 @@ const RepeatTimeType = {
8080
getKey: value => Object.keys(RepeatTimeType).find(key => RepeatTimeType[key] === value)
8181
}
8282

83+
/**
84+
* @description: 周
85+
*/
86+
const Week = {
87+
SUNDAY: 1,
88+
MONDAY: 2,
89+
TUESDAY: 3,
90+
WEDNESDAY: 4,
91+
THURSDAY: 5,
92+
FRIDAY: 6,
93+
SATURDAY: 7,
94+
}
8395
/**
8496
* @description: 动作类型
8597
*/
@@ -159,10 +171,9 @@ export function setConditions(conditions) {
159171
break;
160172
}
161173
case RepeatTimeType.weekly: {
162-
// 每周
163-
// 周日 - 周六 对应 1 - 7
164-
let v3 = (Number(repeat.weekly.week) + 1);
165-
if (v3 === 8) v3 = 1;
174+
// 每周周几
175+
// 周日: 1, 周一: 2, ..., 周六: 7
176+
let v3 = repeat.weekly.week;
166177
condition['v3'] = v3.toString();
167178
condition['v4'] = repeat.weekly.time.toString();
168179
break;
@@ -291,7 +302,9 @@ export function getConditions(conditions) {
291302
temp = groupNumber;
292303
}
293304
if (item.condition_type == ConditionType.device) {
294-
// 设备条件
305+
// =================================================================================
306+
// 设备条件 start
307+
// =================================================================================
295308
condition.type = ConditionType.getKey(item.condition_type);
296309
condition.data = {
297310
projectId: item.business_id,
@@ -322,11 +335,13 @@ export function getConditions(conditions) {
322335
value: item.v3
323336
}
324337
};
325-
326-
327-
338+
// =================================================================================
339+
// 设备条件 end
340+
// =================================================================================
328341
} else {
329-
// 时间条件
342+
// =================================================================================
343+
// 时间条件 start
344+
// =================================================================================
330345
condition.type = ConditionType.getKey(item.condition_type);
331346
condition.data = {
332347
type: TimeType.getKey(item.time_condition_type)
@@ -391,6 +406,9 @@ export function getConditions(conditions) {
391406
break;
392407
}
393408
}
409+
// =================================================================================
410+
// 时间条件 end
411+
// =================================================================================
394412
}
395413
conditionList.push(condition);
396414
})
@@ -455,4 +473,4 @@ export function getActions(actions) {
455473
return actionList;
456474
}
457475

458-
export { ConditionType, StateMode, TimeType, RepeatTimeType, ActionType, CommandType }
476+
export { ConditionType, StateMode, TimeType, RepeatTimeType, Week, ActionType, CommandType }

src/view/pages/automation/control/ControlStrategy.vue

+4
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,17 @@ export default {
170170
* @return {*}
171171
*/
172172
getControlStrategyIndex() {
173+
this.loading = true;
173174
Auto.Control.list(this.params)
174175
.then(({data}) => {
175176
if (data.code === 200) {
176177
this.tableData = data.data?.data || [];
177178
this.total = data.data?.total || 0;
178179
}
179180
})
181+
.finally(() => {
182+
this.loading = false;
183+
})
180184
}
181185
}
182186

src/view/pages/automation/scene/index.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: chaoxiaoshu-mx leukotrichia@163.com
33
* @Date: 2023-02-02 08:39:13
44
* @LastEditors: chaoxiaoshu-mx leukotrichia@163.com
5-
* @LastEditTime: 2023-03-10 19:48:23
5+
* @LastEditTime: 2023-04-06 09:08:04
66
* @FilePath: \ThingsPanel-Backend-Vue\src\view\pages\automation\scene\index.vue
77
* @Description: 场景列表
88
-->
@@ -92,13 +92,17 @@ export default {
9292
},
9393
methods: {
9494
getSceneList() {
95+
this.loading = true;
9596
Auto.Scene.list(this.params)
9697
.then(({data}) => {
9798
if (data.code === 200) {
9899
this.tableData = data.data?.data || [];
99100
this.total = data.data?.total || 0;
100101
}
101102
})
103+
.finally(() => {
104+
this.loading = false;
105+
})
102106
},
103107
handleShowAdd() {
104108
this.formId = "";

0 commit comments

Comments
 (0)