|
@@ -38,11 +38,11 @@
|
|
|
</view>
|
|
|
<My_input ref="MyInput" @customMethod="customMethod">
|
|
|
<view class="change-item" v-if="changeItem.funcname">
|
|
|
- <picker mode="time" :value="changeItem.showValue.begin" :end="changeItem.showValue.end" data-name="begin"
|
|
|
+ <picker mode="time" :value="changeItem.showValue.begin" :end="endTime" data-name="begin"
|
|
|
@change="timeChange">
|
|
|
<view class="row">
|
|
|
<view class="label">
|
|
|
- 开始时间:
|
|
|
+ 开始时间:{{ endTime }}
|
|
|
</view>
|
|
|
<view class="value day-parting-row">{{ changeItem.showValue.begin || ' --' }}
|
|
|
</view>
|
|
@@ -81,26 +81,32 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
list: [],
|
|
|
- changeItem: {}
|
|
|
+ changeItem: {},
|
|
|
+ endTime: ""
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- loadData(newVal) {
|
|
|
+ loadData(newVal, Chinese = false) {
|
|
|
let reg = /^时段\d{1,5}$/,
|
|
|
count = 0,
|
|
|
list = [];
|
|
|
for (const key in newVal.function) {
|
|
|
if (reg.test(key)) count++
|
|
|
}
|
|
|
+
|
|
|
+ let Nzh = require("nzh");
|
|
|
+ let nzhcn = require("nzh/cn"); //直接使用简体中文
|
|
|
+
|
|
|
for (let i = 1; i <= count; i++) {
|
|
|
+ let name = Chinese ? nzhcn.encodeS(i) : i;
|
|
|
let obj = newVal.function[`时段${i}`],
|
|
|
keyList = [
|
|
|
- `时段${i}分钟开始`,//0
|
|
|
- `时段${i}分钟结束`,//1
|
|
|
- `时段${i}小时开始`,//2
|
|
|
- `时段${i}小时结束`,//3
|
|
|
- `时段${i}流量设定`,//4
|
|
|
- `时间段${i}置位`,//5
|
|
|
+ `时段${name}分钟开始`,//0
|
|
|
+ `时段${name}分钟结束`,//1
|
|
|
+ `时段${name}小时开始`,//2
|
|
|
+ `时段${name}小时结束`,//3
|
|
|
+ `时段${name}流量设定`,//4
|
|
|
+ `时间段${name}置位`,//5
|
|
|
],
|
|
|
item = {
|
|
|
keyList,
|
|
@@ -118,7 +124,6 @@ export default {
|
|
|
},
|
|
|
params: {}
|
|
|
};
|
|
|
-
|
|
|
keyList.forEach(key => {
|
|
|
item.params[key] = newVal.params[key];
|
|
|
});
|
|
@@ -128,8 +133,8 @@ export default {
|
|
|
this.list = list;
|
|
|
},
|
|
|
onClick(item) {
|
|
|
- this.$refs.MyInput.openInput(item, true)
|
|
|
- if (this.changeItem.funcname != item.funcname) this.changeItem = JSON.parse(JSON.stringify(item));
|
|
|
+ this.changeItem = JSON.parse(JSON.stringify(item));
|
|
|
+ this.endTime = this.changeItem.showValue.end == '0:0' ? "" : this.changeItem.showValue.end;
|
|
|
let toBeUpdated = [];
|
|
|
if (item.paramValue.begin) toBeUpdated.push(`开始时间:${item.paramValue.begin}`);
|
|
|
if (item.paramValue.end) toBeUpdated.push(`结束时间:${item.paramValue.begin}`);
|
|
@@ -137,6 +142,7 @@ export default {
|
|
|
if (toBeUpdated.length) {
|
|
|
model.toBeUpdated = '待更新记录:' + toBeUpdated.join(",")
|
|
|
}
|
|
|
+ this.$refs.MyInput.openInput(item, true)
|
|
|
},
|
|
|
timeChange(e) {
|
|
|
const name = e.currentTarget.dataset.name;
|
|
@@ -148,20 +154,22 @@ export default {
|
|
|
w_functionid,
|
|
|
params,
|
|
|
index,
|
|
|
- funcname
|
|
|
} = this.changeItem,
|
|
|
MyInput = this.$refs.MyInput;
|
|
|
if (!showValue.begin) return MyInput.submitBreak("还未填写开始时间")
|
|
|
if (!showValue.end) return MyInput.submitBreak("还未填写结束时间")
|
|
|
if ((showValue.value + '').length == 0) return MyInput.submitBreak("还未设定流量")
|
|
|
+ let Nzh = require("nzh");
|
|
|
+ let nzhcn = require("nzh/cn"); //直接使用简体中文
|
|
|
+ let funcname = '时段' + nzhcn.encodeS(index)
|
|
|
showValue.value = (showValue.value - 0).toFixed(params[funcname + '流量设定'].num_scale)
|
|
|
MyInput.submit(w_functionid, {
|
|
|
- "时段1分钟开始": showValue.begin.split(":")[1],
|
|
|
- "时段1小时开始": showValue.begin.split(":")[0],
|
|
|
- "时段1分钟结束": showValue.end.split(":")[1],
|
|
|
- "时段1小时结束": showValue.end.split(":")[0],
|
|
|
- "时段1流量设定": showValue.value,
|
|
|
- [`时间段${index}置位`]: params[`时间段${index}置位`].lastvalue
|
|
|
+ [funcname + "分钟开始"]: showValue.begin.split(":")[1],
|
|
|
+ [funcname + "小时开始"]: showValue.begin.split(":")[0],
|
|
|
+ [funcname + "分钟结束"]: showValue.end.split(":")[1],
|
|
|
+ [funcname + "小时结束"]: showValue.end.split(":")[0],
|
|
|
+ [funcname + "流量设定"]: showValue.value,
|
|
|
+ [`时间段${nzhcn.encodeS(index)}置位`]: params[`时间段${nzhcn.encodeS(index)}置位`].lastvalue
|
|
|
})
|
|
|
}
|
|
|
}
|