wenzheng.yang
2023-04-27 31e64e0e144815e6176c1b6b81eae8dc68688570
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!-- 系统表单组件 -->
<template>
    <view class="m-form">
        <view class="m-page-over">
            <!-- <view class="m-form-head"><u-icon name="close-circle" color="#fff" size="40" @click="cancel"></u-icon></view> -->
            <!-- 修改 -->
            <view class="m-form-label">
                <u--form
                    labelPosition="left"
                    labelAlign="left"
                    :model="model"
                    ref="form"
                    labelWidth="100"
                    :labelStyle="{ color: '#459EFF', 'white-space': 'nowrap', 'letter-spacing': '0.65em' }"
                >
                    <u-form-item label="目标地址" prop="udpAdress" v-show="false" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.udpAdress"
                            readonly
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="目标端口" prop="baoliu20" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.baoliu20"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="本机地址" prop="localaddress" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.localaddress"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="本机端口" prop="localhost" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            readonly
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.localhost"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="视图刷新速率" prop="baoliu13" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.baoliu13"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="标签数量上限" prop="baoliu14" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.baoliu14"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="围栏数量上限" prop="baoliu15" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.baoliu15"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="实时轨迹时长" prop="real_trak_time" borderBottom ref="item">
                        <u--input
                            :customStyle="{
                                'background-color': '#459EFF',
                            }"
                            placeholderStyle="color:#fff"
                            color="#fff"
                            v-model="model.real_trak_time"
                            border="none"
                        ></u--input>
                    </u-form-item>
                    <u-form-item label="显示围栏" prop="gas_show" borderBottom ref="item">
                        <u-switch v-model="model.gas_show" asyncChange @change="asyncChange($event, 1)"></u-switch>
                    </u-form-item>
                    <u-form-item label="显示基站" prop="viewAnckid" borderBottom ref="item">
                        <u-switch v-model="model.viewAnckid" asyncChange @change="asyncChange($event, 2)"></u-switch>
                    </u-form-item>
                    <u-form-item label="显示轨迹" prop="baoliu16" borderBottom ref="item">
                        <u-switch v-model="model.baoliu16" asyncChange @change="asyncChange($event, 3)"></u-switch>
                    </u-form-item>
                    <u-form-item label="缩略信息" prop="baoliu17" borderBottom ref="item">
                        <u-switch v-model="model.baoliu17" asyncChange @change="asyncChange($event, 4)"></u-switch>
                    </u-form-item>
                    <u-form-item label="百度地图" prop="yulan_map" borderBottom ref="item">
                        <u-switch v-model="model.yulan_map" asyncChange @change="asyncChange($event, 5)"></u-switch>
                    </u-form-item>
                    <u-form-item label="启用密码" prop="show_password" borderBottom ref="item">
                        <u-switch v-model="model.show_password" asyncChange @change="asyncChange($event, 6)"></u-switch>
                    </u-form-item>
                </u--form>
            </view>
            <view class="m-form-button-list"><u-button type="primary" text="确定" @click="save"></u-button></view>
        </view>
    </view>
</template>
 
<script>
import { connChart,getWiFiIP } from '@/common/utils.js';
export default {
    props: {
        mapType: String
    },
    data() {
        return {
            model: {
                baoliu13: '1', //视图刷新速率
                baoliu14: '5', //标签数量上限
                baoliu15: '3', //围栏数量上限
                real_trak_time: '30', //实时轨迹时长
                udpAdress: '', //交互地址
                baoliu20: '8233', //交互端口-默认8233
                gas_show: '1', //是否显示围栏
                baoliu17: '1', //是否缩略显示信息
                viewAnckid: '1', //是否显示基站
                baoliu16: '1', //是否显示轨迹
                yulan_map: '1' ,//百度地图切换
                localhost:'7777',//本机端口
                localaddress:'',//本机地址
                show_password:'1'//是否输入密码
            }
        };
    },
    methods: {
        //保存
        save() {
            this.$store.commit('updateSys', this.model);
            //修改系统信息
            var labelModel = connChart('sys');
            labelModel.update({
                udpAdress: this.model.udpAdress,
                baoliu20: this.model.baoliu20,
                baoliu13: this.model.baoliu13,
                baoliu14: this.model.baoliu14,
                baoliu15: this.model.baoliu15,
                real_trak_time: this.model.real_trak_time,
                gas_show: this.model.gas_show?'1':'0',
                viewAnckid: this.model.viewAnckid?'1':'0',
                baoliu16: this.model.baoliu16?'1':'0',
                baoliu17: this.model.baoliu17?'1':'0',
                yulan_map: this.model.yulan_map?'1':'0',
                show_password:this.model.show_password?'1':'0'
            },(err,results)=>{
                console.log(results);
                this.$store.commit('updateSys', this.model);
                this.$emit('submitSysForm');
            });
        },
        //取消
        cancel() {
            this.$emit('cancelSysForm');
        },
        //开关
        asyncChange(e, index) {
            if (index == 1) this.model.gas_show = e;
            if (index == 2) this.model.viewAnckid = e;
            if (index == 3) this.model.baoliu16 = e;
            if (index == 4) this.model.baoliu17 = e;
            if (index == 5) this.model.yulan_map = e;
            if(index==6)this.model.show_password=e
            // uni.showModal({
            //     content: e ? '确定要打开吗' : '确定要关闭吗',
            //     confirmColor:"#68B0FE",
            //     cancelColor:"#68B0FE",
            //     success: res => {
            //         if (res.confirm) {
            //             if (index == 1) this.model.gas_show = e;
            //             if (index == 2) this.model.viewAnckid = e;
            //             if (index == 3) this.model.baoliu16 = e;
            //             if (index == 4) this.model.baoliu17 = e;
            //             if (index == 5) this.model.yulan_map = e;
            //         }
            //     }
            // });
        },
        //获取系统信息
        getSysInfo() {
            var labelModel = connChart('sys');
            labelModel.find((e,r)=>{
                console.log(e,r)
                if(r!=undefined && r.length!=0){
                    this.model = r[0];
                    this.model.gas_show=this.model.gas_show==1?true:false
                    this.model.viewAnckid=this.model.viewAnckid==1?true:false
                    this.model.baoliu16=this.model.baoliu16==1?true:false
                    this.model.baoliu17=this.model.baoliu17==1?true:false
                    this.model.yulan_map=this.model.yulan_map==1?true:false
                    this.model.show_password=this.model.show_password==1?true:false
                }else{
                    labelModel.insert({
                        udpAdress: this.model.udpAdress,
                        baoliu20: this.model.baoliu20,
                        baoliu13: this.model.baoliu13,
                        baoliu14: this.model.baoliu14,
                        baoliu15: this.model.baoliu15,
                        real_trak_time: this.model.real_trak_time,
                        gas_show: this.model.gas_show?'1':'0',
                        viewAnckid: this.model.viewAnckid?'1':'0',
                        baoliu16: this.model.baoliu16?'1':'0',
                        baoliu17: this.model.baoliu17?'1':'0',
                        yulan_map: this.model.yulan_map?'1':'0',
                        show_password:this.model.show_password?'1':'0'
                    },(e,r)=>{
                        console.log(e,r)
                    })
                }
                this.model.localhost='7777'
                this.model.localaddress=getWiFiIP()
            })
        }
    },
    mounted() {
        this.getSysInfo();
    }
};
</script>
 
<style lang="scss" scoped>
.m-form {
    position: fixed;
    top: calc(3.5em + 20px);
    left: 0;
    background-color: rgba(255, 255, 255, 0.9);
    width: 100%;
    height: calc(100vh - 3.5em - 20px - 60px);
    overflow: scroll;
    z-index: 750;
    // border-radius: 15px;
    box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.16);
    display: flex;
    flex-direction: column;
}
.m-page-over{
    width: calc(100vw - 8em - 1px);
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-right: 1px solid #63AFF9;
}
.m-form-head {
    width: 100%;
    border-bottom: 1px solid #fff;
}
.m-form-head .u-icon {
    float: right;
}
/deep/ .u-form-item:nth-of-type(5) .u-form-item__body__left__content__label,
/deep/ .u-form-item:nth-of-type(6) .u-form-item__body__left__content__label,
/deep/ .u-form-item:nth-of-type(7) .u-form-item__body__left__content__label,
/deep/ .u-form-item:nth-of-type(8) .u-form-item__body__left__content__label{
    letter-spacing: 0 !important;
}
.m-form-label {
    width: 80%;
    margin: 0 auto;
    margin-bottom: 0.5em;
    overflow: overlay;
}
input {
    width: 50px;
}
.m-form-button-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 1em;
}
.m-form-button-list .u-button {
    width: 5em;
}
.m-form-button-list .u-button:nth-child(2),
.m-form-button-list .u-button:nth-child(3),
.m-form-button-list .u-button:nth-child(4) {
    margin-top: 2em;
}
</style>