system-phone 1.2.80-socket-12 → 1.2.80-socket-13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "system-phone",
3
- "version": "1.2.80-socket-12",
3
+ "version": "1.2.80-socket-13",
4
4
  "description": "手机模块 前端组件",
5
5
  "author": "何宁社 <524395609@qq.com>",
6
6
  "license": "ISC",
@@ -1,245 +1,245 @@
1
- <template>
2
- <div style="height: 7%">
3
- <tools-page :need-back="!isMenu" :title="titleName" @back="back('返回')" > </tools-page>
4
- </div>
5
- <div id="app" :class="{'auto':isMenu,'app-height':!isMenu}">
6
- <div class="row" :style="isMenu?'overflow-y: scroll;overflow-x: hidden;height:80vh':'overflow-y: scroll;overflow-x: hidden;'">
7
- <route v-ref:route> </route>
8
- </div>
9
- <tab-bar @select-item="onClickTabBarItem" v-show="isMenu">
10
- </tab-bar>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- import Vue from 'vue'
16
- export default {
17
- title: 'app',
18
- data: function () {
19
- return {
20
- item: 0,
21
- isMenu:true,
22
- beforeName:'主界面',
23
- titleName:'待办工作',
24
- backthis:'',
25
- safe:false,
26
- beforetabs:[],
27
- iftabbar:'',
28
- lockReconnect: false, // 避免重复连接
29
- timeout: 10000, // 10秒发一次心跳
30
- connectNumber: 10, // 重连次数
31
- timeoutObj: null,
32
- serverTimeoutObj: null
33
- }
34
- },
35
- ready(){
36
-
37
- Vue.prototype.$connectNumber = this.connectNumber
38
- this.initWebSocket()
39
- },
40
- methods: {
41
- // 清除
42
- reset () {
43
- clearTimeout(this.timeoutObj)
44
- clearTimeout(this.serverTimeoutObj)
45
- },
46
- // 发送心跳
47
- start () {
48
- // 重置
49
- Vue.prototype.$connectNumber = this.connectNumber
50
- this.timeoutObj = setTimeout(() => {
51
- this.$socket.send('ping')
52
- console.log('ping!')
53
- this.serverTimeoutObj = setTimeout(() => {
54
- this.$socket.close()
55
- }, this.timeout)
56
- }, this.timeout)
57
- },
58
- // 重连
59
- reconnect () {
60
- if (this.lockReconnect) return
61
- if (this.$connectNumber <= 0) {
62
- this.showMessage('连接已断开,将无法接收消息,请重新登录', ['confirm']).then((res) => {
63
- if (res === 'confirm') {
64
- this.$androidUtil.setPreference('f_repairman_id', 'x')
65
- this.$androidUtil.setPreference('f_repairman_name', 'x')
66
- this.beforetabs = []
67
- this.$back()
68
- }
69
- })
70
- return
71
- }
72
- this.$connectNumber--
73
- setTimeout(() => {
74
- console.log('连接异常,尝试重新连接。。。。')
75
- this.initWebSocket()
76
- this.lockReconnect = false
77
- }, 1000 * 60)
78
- },
79
- // 初始化
80
- initWebSocket () {
81
- console.log("初始化")
82
- console.log(this.$androidUtil.getProxyUrl())
83
- let wshttp = `${this.$androidUtil.getProxyUrl()}`
84
- let pathhttp = wshttp.substring(7)
85
-
86
- let path = `ws://${pathhttp}ws?token=${Vue.user.id}`
87
- console.log(path)
88
- console.log("9999999999999999999999999")
89
- try {
90
- if ('WebSocket' in window) {
91
- // 创建对象
92
- Vue.prototype.$socket = new WebSocket(path)
93
- } else {
94
- this.$showMessage('您的浏览器不支持websocket的协议,建议使用新版谷歌浏览器,请勿使用IE浏览器,360浏览器请使用极速模式,不要使用兼容模式!"')
95
- }
96
- } catch (e) {
97
- this.reconnect()
98
- }
99
-
100
- this.$socket.onopen = this.onOpen // 连接成功
101
- this.$socket.onmessage = this.onMessage // 收到消息时回调
102
- this.$socket.onclose = this.onClose // 连接关闭时回调
103
- this.$socket.onerror = this.onError // 通讯异常
104
- },
105
- // 通讯异常
106
- onError () {
107
- this.reconnect()
108
- },
109
- // 连接成功
110
- onOpen () {
111
- console.log('webSocket连接成功')
112
- this.start()
113
- },
114
- // 收到消息时回调函数
115
- onMessage (event) {
116
- if (event.data === 'pong') {
117
- this.reset()
118
- this.start()
119
- return
120
- }
121
- // if (event.type === 'apply-task') {
122
- // console.log("aaa")
123
- // }
124
- console.log("555555555555")
125
- console.log(event)
126
- let data = JSON.parse(event.data)
127
- if (data.type === 'dot-task') {
128
- HostApp.voicePromptOnce('dadian.mp3')
129
- }
130
- this.$broadcast('onMessage', data)
131
- this.$showMessage(data.message)
132
- },
133
- // 关闭连接时回调函数
134
- onClose () {
135
- console.log('webSocket连接断开')
136
- this.reset()
137
- this.reconnect()
138
- },
139
- back(flag){
140
- if(this.safe && flag == '返回' ){
141
- this.$showMessage('此返回所录入内容将无法找回!', ['confirm', 'cancel']).then((res) => {
142
- if (res === 'confirm') {
143
- this.safe = false
144
- this.delback()
145
- this.backthis.$back()
146
- }
147
- })
148
- }else{
149
- this.delback()
150
- this.safe = false
151
- this.backthis.$back()
152
- }
153
- },
154
- delback(){
155
- // 先确认出 前一个组件的名字
156
- var title = this.beforeName
157
- var beforetitle = '主界面'
158
- var j = -1
159
- for(var i = 0;i<this.beforetabs.length;i++){
160
- if(this.beforetabs[i].titleName == title){
161
- beforetitle = this.beforetabs[i].beforeName
162
- this.backthis =this.beforetabs[i].backthis
163
- this.safe = this.beforetabs[i].safe
164
- j = i
165
- break;
166
- }
167
- }
168
- this.beforetabs.splice(j + 1, 1)
169
- this.beforeName = beforetitle
170
- this.titleName = title
171
- // 判断是否 显示底层导航
172
- if(this.iftabbar == this.titleName){
173
- this.isMenu = true
174
- }
175
- },
176
- onClickTabBarItem(titlefg) {
177
- var param = titlefg.link
178
- if(titlefg.name == '退出系统'){
179
- this.$showMessage('即将返回登陆界面!', ['confirm', 'cancel']).then((res) => {
180
- if (res === 'confirm') {
181
- this.$androidUtil.setPreference('f_repairman_id', 'x')
182
- this.$androidUtil.setPreference('f_repairman_name', 'x')
183
- this.$back()
184
- }
185
- })
186
- }else{
187
- if(this.beforeName == titlefg.name){
188
- return
189
- }
190
- this.titleName = titlefg.name
191
- this.beforeName = titlefg.name
192
- let data = {
193
- sourcet: '竖屏'
194
- }
195
- // if(titlefg.name == '待办工单'){
196
- // param = param+'V'
197
- // }
198
- this.$refs.route.init(param,data)
199
- }
200
- }
201
- },
202
- events: {
203
- 'gotoson': function (prpdata) {
204
- // 事件回调内的 `this` 自动绑定到注册它的实例上
205
- // safe 返回事件是否进行判断后再返回
206
- // 每进入一次,beforetabs 数组添加 返回 删除
207
- this.backthis = prpdata._this
208
- this.safe = prpdata.safe
209
- this.isMenu = false
210
- // 记录本次跳转
211
- var beforedata = {
212
- beforeName: this.titleName,
213
- titleName: prpdata.title,
214
- backthis:prpdata._this,
215
- safe:prpdata.safe
216
- }
217
- this.beforetabs.push(beforedata)
218
- if( this.beforetabs.length == 1){
219
- this.iftabbar = beforedata.beforeName
220
- }
221
- // 写入跳转后 前后组件名字
222
- this.beforeName = this.titleName
223
- this.titleName = prpdata.title
224
-
225
- console.log('进入子组件,通知外层组件,我已经进入')
226
- },
227
- 'confirm': function () {
228
- // 提交处理返回事件
229
- this.back('提交')
230
- },
231
- 'backarrdel': function () {
232
- this.delback()
233
- },
234
- 'gologin': function () {
235
- this.beforetabs = []
236
- this.$back()
237
- }
238
- }
239
- }
240
- </script>
241
- <style scoped>
242
- .app-height{
243
- height: 93%;
244
- }
245
- </style>
1
+ <template>
2
+ <div style="height: 7%">
3
+ <tools-page :need-back="!isMenu" :title="titleName" @back="back('返回')" > </tools-page>
4
+ </div>
5
+ <div id="app" :class="{'auto':isMenu,'app-height':!isMenu}">
6
+ <div class="row" :style="isMenu?'overflow-y: scroll;overflow-x: hidden;height:80vh':'overflow-y: scroll;overflow-x: hidden;'">
7
+ <route v-ref:route> </route>
8
+ </div>
9
+ <tab-bar @select-item="onClickTabBarItem" v-show="isMenu">
10
+ </tab-bar>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import Vue from 'vue'
16
+ export default {
17
+ title: 'app',
18
+ data: function () {
19
+ return {
20
+ item: 0,
21
+ isMenu:true,
22
+ beforeName:'主界面',
23
+ titleName:'待办工作',
24
+ backthis:'',
25
+ safe:false,
26
+ beforetabs:[],
27
+ iftabbar:'',
28
+ lockReconnect: false, // 避免重复连接
29
+ timeout: 10000, // 10秒发一次心跳
30
+ connectNumber: 10, // 重连次数
31
+ timeoutObj: null,
32
+ serverTimeoutObj: null
33
+ }
34
+ },
35
+ ready(){
36
+
37
+ Vue.prototype.$connectNumber = this.connectNumber
38
+ this.initWebSocket()
39
+ },
40
+ methods: {
41
+ // 清除
42
+ reset () {
43
+ clearTimeout(this.timeoutObj)
44
+ clearTimeout(this.serverTimeoutObj)
45
+ },
46
+ // 发送心跳
47
+ start () {
48
+ // 重置
49
+ Vue.prototype.$connectNumber = this.connectNumber
50
+ this.timeoutObj = setTimeout(() => {
51
+ this.$socket.send('ping')
52
+ console.log('ping!')
53
+ this.serverTimeoutObj = setTimeout(() => {
54
+ this.$socket.close()
55
+ }, this.timeout)
56
+ }, this.timeout)
57
+ },
58
+ // 重连
59
+ reconnect () {
60
+ if (this.lockReconnect) return
61
+ if (this.$connectNumber <= 0) {
62
+ this.showMessage('连接已断开,将无法接收消息,请重新登录', ['confirm']).then((res) => {
63
+ if (res === 'confirm') {
64
+ this.$androidUtil.setPreference('f_repairman_id', 'x')
65
+ this.$androidUtil.setPreference('f_repairman_name', 'x')
66
+ this.beforetabs = []
67
+ this.$back()
68
+ }
69
+ })
70
+ return
71
+ }
72
+ this.$connectNumber--
73
+ setTimeout(() => {
74
+ console.log('连接异常,尝试重新连接。。。。')
75
+ this.initWebSocket()
76
+ this.lockReconnect = false
77
+ }, 1000 * 60)
78
+ },
79
+ // 初始化
80
+ initWebSocket () {
81
+ console.log("初始化")
82
+ console.log(this.$androidUtil.getProxyUrl())
83
+ let wshttp = `${this.$androidUtil.getProxyUrl()}`
84
+ let pathhttp = wshttp.substring(7)
85
+
86
+ let path = `ws://${pathhttp}ws?token=${Vue.user.id}`
87
+ console.log(path)
88
+ console.log("9999999999999999999999999")
89
+ try {
90
+ if ('WebSocket' in window) {
91
+ // 创建对象
92
+ Vue.prototype.$socket = new WebSocket(path)
93
+ } else {
94
+ this.$showMessage('您的浏览器不支持websocket的协议,建议使用新版谷歌浏览器,请勿使用IE浏览器,360浏览器请使用极速模式,不要使用兼容模式!"')
95
+ }
96
+ } catch (e) {
97
+ this.reconnect()
98
+ }
99
+
100
+ this.$socket.onopen = this.onOpen // 连接成功
101
+ this.$socket.onmessage = this.onMessage // 收到消息时回调
102
+ this.$socket.onclose = this.onClose // 连接关闭时回调
103
+ this.$socket.onerror = this.onError // 通讯异常
104
+ },
105
+ // 通讯异常
106
+ onError () {
107
+ this.reconnect()
108
+ },
109
+ // 连接成功
110
+ onOpen () {
111
+ console.log('webSocket连接成功')
112
+ this.start()
113
+ },
114
+ // 收到消息时回调函数
115
+ onMessage (event) {
116
+ if (event.data === 'pong') {
117
+ this.reset()
118
+ this.start()
119
+ return
120
+ }
121
+ // if (event.type === 'apply-task') {
122
+ // console.log("aaa")
123
+ // }
124
+ console.log("555555555555")
125
+ console.log(event)
126
+ let data = JSON.parse(event.data)
127
+ if (data.type === 'dot-task') {
128
+ HostApp.voicePromptOnce('dadian.mp3')
129
+ }
130
+ this.$broadcast('onMessage', data)
131
+ this.$showMessage(data.message)
132
+ },
133
+ // 关闭连接时回调函数
134
+ onClose () {
135
+ console.log('webSocket连接断开')
136
+ this.reset()
137
+ this.reconnect()
138
+ },
139
+ back(flag){
140
+ if(this.safe && flag == '返回' ){
141
+ this.$showMessage('此返回所录入内容将无法找回!', ['confirm', 'cancel']).then((res) => {
142
+ if (res === 'confirm') {
143
+ this.safe = false
144
+ this.delback()
145
+ this.backthis.$back()
146
+ }
147
+ })
148
+ }else{
149
+ this.delback()
150
+ this.safe = false
151
+ this.backthis.$back()
152
+ }
153
+ },
154
+ delback(){
155
+ // 先确认出 前一个组件的名字
156
+ var title = this.beforeName
157
+ var beforetitle = '主界面'
158
+ var j = -1
159
+ for(var i = 0;i<this.beforetabs.length;i++){
160
+ if(this.beforetabs[i].titleName == title){
161
+ beforetitle = this.beforetabs[i].beforeName
162
+ this.backthis =this.beforetabs[i].backthis
163
+ this.safe = this.beforetabs[i].safe
164
+ j = i
165
+ break;
166
+ }
167
+ }
168
+ this.beforetabs.splice(j + 1, 1)
169
+ this.beforeName = beforetitle
170
+ this.titleName = title
171
+ // 判断是否 显示底层导航
172
+ if(this.iftabbar == this.titleName){
173
+ this.isMenu = true
174
+ }
175
+ },
176
+ onClickTabBarItem(titlefg) {
177
+ var param = titlefg.link
178
+ if(titlefg.name == '退出系统'){
179
+ this.$showMessage('即将返回登陆界面!', ['confirm', 'cancel']).then((res) => {
180
+ if (res === 'confirm') {
181
+ this.$androidUtil.setPreference('f_repairman_id', 'x')
182
+ this.$androidUtil.setPreference('f_repairman_name', 'x')
183
+ this.$back()
184
+ }
185
+ })
186
+ }else{
187
+ if(this.beforeName == titlefg.name){
188
+ return
189
+ }
190
+ this.titleName = titlefg.name
191
+ this.beforeName = titlefg.name
192
+ let data = {
193
+ sourcet: '竖屏'
194
+ }
195
+ // if(titlefg.name == '待办工单'){
196
+ // param = param+'V'
197
+ // }
198
+ this.$refs.route.init(param,data)
199
+ }
200
+ }
201
+ },
202
+ events: {
203
+ 'gotoson': function (prpdata) {
204
+ // 事件回调内的 `this` 自动绑定到注册它的实例上
205
+ // safe 返回事件是否进行判断后再返回
206
+ // 每进入一次,beforetabs 数组添加 返回 删除
207
+ this.backthis = prpdata._this
208
+ this.safe = prpdata.safe
209
+ this.isMenu = false
210
+ // 记录本次跳转
211
+ var beforedata = {
212
+ beforeName: this.titleName,
213
+ titleName: prpdata.title,
214
+ backthis:prpdata._this,
215
+ safe:prpdata.safe
216
+ }
217
+ this.beforetabs.push(beforedata)
218
+ if( this.beforetabs.length == 1){
219
+ this.iftabbar = beforedata.beforeName
220
+ }
221
+ // 写入跳转后 前后组件名字
222
+ this.beforeName = this.titleName
223
+ this.titleName = prpdata.title
224
+
225
+ console.log('进入子组件,通知外层组件,我已经进入')
226
+ },
227
+ 'confirm': function () {
228
+ // 提交处理返回事件
229
+ this.back('提交')
230
+ },
231
+ 'backarrdel': function () {
232
+ this.delback()
233
+ },
234
+ 'gologin': function () {
235
+ this.beforetabs = []
236
+ this.$back()
237
+ }
238
+ }
239
+ }
240
+ </script>
241
+ <style scoped>
242
+ .app-height{
243
+ height: 93%;
244
+ }
245
+ </style>
@@ -1,275 +1,290 @@
1
- <template>
2
- <div class="nav-bgcolor">
3
- <div class="auto">
4
- <div class="row nav-bgcolor" >
5
- <div class="col-xs-6 manbiankuang" v-for="tab in tabs" @click="gotopage(tab.link,tab.name)">
6
- <img class="imgs" :src="imgback(tab.name)">
7
- <p></p>
8
- <p class="pagesfoot">{{tab.name}}</p>
9
- <p></p>
10
- </div>
11
- </div>
12
- </div>
13
- </div>
14
- <modal :show.sync="show" v-ref:modal backdrop="false">
15
- <header slot="modal-header" class="modal-header text-center">
16
- <h4 class="modal-title">清除项选择</h4>
17
- <input type="checkbox" class="" id="f_operator" v-model="all">
18
- <label for="f_operator" class="font-size">全选</label>
19
- </header>
20
- <article slot="modal-body" v-if="show">
21
- <div class="auto col-sm-11 col-xs-11 col-xs-offset-1 col-md-offset-1" style="margin-top: 10px;">
22
- <div class="col-sm-4 col-xs-4" v-for="f in fields">
23
- <input type="checkbox" class="" :id="'export-col-'+$index" v-model="modelval" :value="$key">
24
- <label :for="'export-col-'+$index" class="font-size">{{f}}</label>
25
- </div>
26
- </div>
27
- </article>
28
- <footer slot="modal-footer" class="modal-footer">
29
- <center>
30
- <button v-show="show" type="button" class="btn btn-default" @click='close()'>取消</button>
31
- <button v-show="show" type="button" class="btn btn-success" @click='clear()'>确定</button>
32
- </center>
33
- </footer>
34
- </modal>
35
- </template>
36
-
37
- <script>
38
- import Vue from 'vue'
39
-
40
- export default {
41
- title: '系统设置',
42
- data() {
43
- return {
44
- titleName:'系统设置',
45
- all: false,
46
- flag:true,
47
- show:false,
48
- fields: {},
49
- dataclear:[],
50
- tabs: this.getTabs(),
51
- //tabs:[{name:"清空数据"}],
52
- modelval: [],
53
- text: '导航组件this',
54
- beforeName:'系统设置',
55
- }
56
- },
57
- ready(){
58
- if(Vue.config.safecheck) {
59
- if (Vue.config.safecheck.clearPhone) {
60
- let aaa = Vue.config.safecheck.clearPhone.cleardata
61
- for (let i = 0; i < aaa.length; i++) {
62
- this.fields[aaa[i].module] = aaa[i].module
63
- }
64
- }
65
- }
66
- },
67
- methods: {
68
- clear(){
69
- let aaa=Vue.config.safecheck.clearPhone.cleardata
70
- console.log(this.modelval)
71
- for (let i = 0; i < aaa.length; i++) {
72
- for (let j = 0; j < this.modelval.length; j++) {
73
- if (aaa[i].module==this.modelval[i]){
74
- this.dataclear=Object.assign([],this.dataclear,aaa[i].tables)
75
- }
76
- }
77
- }
78
- console.log(this.dataclear)
79
- this.cleandata()
80
- },
81
- close(){
82
- this.show=false
83
- this.all=false
84
- this.flag=true
85
- this.modelval=[]
86
- },
87
- sortModelval () {
88
- let sortModel = []
89
- Object.keys(this.fields).forEach((key) => {
90
- if (this.modelval.includes(key)) {
91
- sortModel.push(key)
92
- }
93
- })
94
- console.log('看看选择的顺序。。。', sortModel)
95
- console.log('看看选择的顺序。。。', this.modelval)
96
- if (sortModel.length==this.modelval.length-1){
97
- this.flag=false
98
- console.log("66666666666666")
99
- this.all=false
100
- }
101
- console.log(Object.keys(this.fields).length)
102
- if (sortModel.length==Object.keys(this.fields).length){
103
- this.all=true
104
- }
105
- this.modelval = sortModel
106
- },
107
- imgback(val){
108
- return require('../assets/'+val+'.png')
109
- },
110
- getTabs(){
111
- for(let funs in Vue.user.functions){
112
- if(Vue.user.functions[funs].link == 'system-setup'){
113
- return Vue.user.functions[funs].children
114
- }
115
- }
116
- },
117
- gotopage(link,name) {
118
- if(name == '清空数据'){
119
- this.cleanalldata()
120
- }else if (name == '清除数据'){
121
- this.openclear()
122
- } else if(name == '导出数据'){
123
- this.outdata()
124
- }else if(name == '退出系统'){
125
- this.$showMessage('即将返回登陆界面!', ['confirm', 'cancel']).then((res) => {
126
- if (res === 'confirm') {
127
- Vue.prototype.$connectNumber = 0 // 重连剩余次数
128
- Vue.prototype.$socket.close() // 关闭websocket连接
129
- this.$androidUtil.setPreference('f_repairman_id', 'x')
130
- this.$androidUtil.setPreference('f_repairman_name', 'x')
131
- this.$dispatch('gologin')
132
- }
133
- })
134
- }else{
135
- console.log('进入子组件')
136
- var prpdata = {
137
- _this:this,
138
- title:name,
139
- safe:true
140
- }
141
- this.$dispatch('gotoson',prpdata)
142
- this.$goto(link)
143
- }
144
- },
145
- cleanalldata(){
146
- this.$showMessage('此操作为清理数据,无法恢复!', ['confirm', 'cancel']).then((res) => {
147
- if (res === 'confirm') {
148
- let result = this.$androidUtil.bzLogic('clearPhoneData', {flag: 0})
149
- console.log((result.result))
150
- if(result.result == '成功'){
151
- this.$showMessage('清除数据完成!')
152
- }else{
153
- this.$showMessage('清除数据失败!')
154
- }
155
- }
156
- })
157
- },
158
- // 清空数据
159
- cleandata(){
160
- console.log("88888888888")
161
- this.$showMessage('此操作为清理数据,无法恢复!', ['confirm', 'cancel']).then((res) => {
162
- if (res === 'confirm') {
163
- let result = this.$androidUtil.bzLogic('clearPhoneDataNew', {tables: this.dataclear})
164
- console.log((result.result))
165
- if(result.result == '成功'){
166
- this.$showMessage('清除数据完成!')
167
- }else{
168
- this.$showMessage('清除数据失败!')
169
- }
170
- this.close()
171
- }
172
- })
173
- },
174
- // 导出数据
175
- openclear(){
176
- this.show=true
177
- },
178
- outdata(){
179
- HostApp.backupDatabase()
180
- this.$showMessage('数据导出成功!')
181
- },
182
- //取消自动登录
183
- cancelAutoLogin(){
184
- let auto=this.$androidUtil.getPreference('autoLogin')
185
- if(auto){
186
- this.$androidUtil.setPreference('autoLogin', false)
187
- this.$showMessage('已取消自动登录!')
188
- }else{
189
- this.$showMessage('当前已处于非自动登录!')
190
- }
191
- }
192
- },
193
- watch: {
194
- 'all' (val) {
195
- if (val) {
196
- this.modelval = Object.keys(this.fields)
197
- } else {
198
- console.log(this.flag)
199
- if (this.flag){
200
- this.modelval = []
201
- }
202
- }
203
- this.flag=true
204
- },
205
- 'modelval.length' () {
206
- this.sortModelval()
207
- }
208
- }
209
- }
210
-
211
- </script>
212
- <style scoped>
213
- .flex-between {
214
- display: flex;
215
- justify-content: space-between;
216
- align-items: center;
217
- }
218
- .flex-between span {
219
- padding-right: 10px;
220
- }
221
- .flex-full {
222
- flex: 1;
223
- }
224
- .name{
225
- font: 15px PingFang-SC-Medium;
226
- color: #666666;
227
- }
228
- .imgs{
229
- width: 35px;
230
- margin-top: 15px;
231
- }
232
- .plan {
233
- border-bottom: 0.5px solid #EAEAEA;
234
- border-right: 0.5px solid #EAEAEA;
235
- height: 120px;
236
- }
237
- .manbiankuang{
238
- width: 44%;
239
- margin-top: 15px;
240
- margin-left: 4%;
241
- border:1px solid #e3e3e3;
242
- border-radius:10px 10px 10px 10px;
243
- text-align: center;
244
- background-color: #ffffff;
245
- }
246
- .user{
247
- border-bottom: 0.5px solid #EAEAEA;
248
- border-right: 0.5px solid #EAEAEA;
249
- border-left: 0.5px solid #EAEAEA;
250
- height: 120px;
251
- }
252
- .safecheck{
253
- border-bottom: 0.5px solid #EAEAEA;
254
- border-left: 0.5px solid #EAEAEA;
255
- height: 120px;
256
- }
257
- .appointment{
258
- border-top: 0.5px solid #EAEAEA;
259
- border-right: 0.5px solid #EAEAEA;
260
- height: 120px;
261
- }
262
- .search{
263
- border-top: 0.5px solid #EAEAEA;
264
- border-right: 0.5px solid #EAEAEA;
265
- border-left: 0.5px solid #EAEAEA;
266
- height: 120px;
267
- }
268
- .upload{
269
- border-top: 0.5px solid #EAEAEA;
270
- border-left: 0.5px solid #EAEAEA;
271
- height: 120px;
272
- }
273
-
274
-
275
- </style>
1
+ <template>
2
+ <div class="nav-bgcolor">
3
+ <div class="auto">
4
+ <div class="row nav-bgcolor" >
5
+ <div class="col-xs-6 manbiankuang" v-for="tab in tabs" @click="gotopage(tab.link,tab.name)">
6
+ <img class="imgs" :src="imgback(tab.name)">
7
+ <p></p>
8
+ <p class="pagesfoot">{{tab.name}}</p>
9
+ <p></p>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <modal :show.sync="show" v-ref:modal backdrop="false">
15
+ <header slot="modal-header" class="modal-header text-center">
16
+ <h4 class="modal-title">清除项选择</h4>
17
+ <input type="checkbox" class="" id="f_operator" v-model="all">
18
+ <label for="f_operator" class="font-size">全选</label>
19
+ </header>
20
+ <article slot="modal-body" v-if="show">
21
+ <div class="auto col-sm-11 col-xs-11 col-xs-offset-1 col-md-offset-1" style="margin-top: 10px;">
22
+ <div class="col-sm-4 col-xs-4" v-for="f in fields">
23
+ <input type="checkbox" class="" :id="'export-col-'+$index" v-model="modelval" :value="$key">
24
+ <label :for="'export-col-'+$index" class="font-size">{{f}}</label>
25
+ </div>
26
+ </div>
27
+ </article>
28
+ <footer slot="modal-footer" class="modal-footer">
29
+ <center>
30
+ <button v-show="show" type="button" class="btn btn-default" @click='close()'>取消</button>
31
+ <button v-show="show" type="button" class="btn btn-success" @click='clear()'>确定</button>
32
+ </center>
33
+ </footer>
34
+ </modal>
35
+ </template>
36
+
37
+ <script>
38
+ import Vue from 'vue'
39
+
40
+ export default {
41
+ title: '系统设置',
42
+ data() {
43
+ return {
44
+ titleName:'系统设置',
45
+ all: false,
46
+ flag:true,
47
+ show:false,
48
+ fields: {},
49
+ dataclear:[],
50
+ tabs: this.getTabs(),
51
+ //tabs:[{name:"清空数据"}],
52
+ modelval: [],
53
+ text: '导航组件this',
54
+ beforeName:'系统设置',
55
+ }
56
+ },
57
+ ready(){
58
+ if(Vue.config.safecheck) {
59
+ if (Vue.config.safecheck.clearPhone) {
60
+ let aaa = Vue.config.safecheck.clearPhone.cleardata
61
+ for (let i = 0; i < aaa.length; i++) {
62
+ this.fields[aaa[i].module] = aaa[i].module
63
+ }
64
+ }
65
+ }
66
+ },
67
+ methods: {
68
+ clear(){
69
+ let aaa=Vue.config.safecheck.clearPhone.cleardata
70
+ console.log(this.modelval)
71
+ for (let i = 0; i < aaa.length; i++) {
72
+ for (let j = 0; j < this.modelval.length; j++) {
73
+ if (aaa[i].module==this.modelval[i]){
74
+ this.dataclear=Object.assign([],this.dataclear,aaa[i].tables)
75
+ }
76
+ }
77
+ }
78
+ console.log(this.dataclear)
79
+ this.cleandata()
80
+ },
81
+ close(){
82
+ this.show=false
83
+ this.all=false
84
+ this.flag=true
85
+ this.modelval=[]
86
+ },
87
+ sortModelval () {
88
+ let sortModel = []
89
+ Object.keys(this.fields).forEach((key) => {
90
+ if (this.modelval.includes(key)) {
91
+ sortModel.push(key)
92
+ }
93
+ })
94
+ console.log('看看选择的顺序。。。', sortModel)
95
+ console.log('看看选择的顺序。。。', this.modelval)
96
+ if (sortModel.length==this.modelval.length-1){
97
+ this.flag=false
98
+ console.log("66666666666666")
99
+ this.all=false
100
+ }
101
+ console.log(Object.keys(this.fields).length)
102
+ if (sortModel.length==Object.keys(this.fields).length){
103
+ this.all=true
104
+ }
105
+ this.modelval = sortModel
106
+ },
107
+ imgback(val){
108
+ return require('../assets/'+val+'.png')
109
+ },
110
+ getTabs(){
111
+ for(let funs in Vue.user.functions){
112
+ if(Vue.user.functions[funs].link == 'system-setup'){
113
+ return Vue.user.functions[funs].children
114
+ }
115
+ }
116
+ },
117
+ gotopage(link,name) {
118
+ if(name == '清空数据'){
119
+ this.cleanalldata()
120
+ }else if (name == '清除数据'){
121
+ this.openclear()
122
+ } else if(name == '导出数据'){
123
+ this.outdata()
124
+ }else if(name == '退出系统'){
125
+ HostApp.back_home()
126
+ // this.$showMessage('即将返回登陆界面!', ['confirm', 'cancel']).then((res) => {
127
+ // if (res === 'confirm') {
128
+ // Vue.prototype.$connectNumber = 0 // 重连剩余次数
129
+ // if (Vue.prototype.$socket){
130
+ // Vue.prototype.$socket.close() // 关闭websocket连接
131
+ // }
132
+ // this.$androidUtil.setPreference('f_repairman_id', 'x')
133
+ // this.$androidUtil.setPreference('f_repairman_name', 'x')
134
+ // this.$dispatch('gologin')
135
+ // }
136
+ // })
137
+ }else if(name == '退出登录'){
138
+ this.$showMessage('即将返回登陆界面!', ['confirm', 'cancel']).then((res) => {
139
+ if (res === 'confirm') {
140
+ Vue.prototype.$connectNumber = 0 // 重连剩余次数
141
+ if (Vue.prototype.$socket){
142
+ Vue.prototype.$socket.close() // 关闭websocket连接
143
+ }
144
+ this.$androidUtil.setPreference('f_repairman_id', 'x')
145
+ this.$androidUtil.setPreference('f_repairman_name', 'x')
146
+ this.$dispatch('gologin')
147
+ }
148
+ })
149
+ }else{
150
+ console.log('进入子组件')
151
+ var prpdata = {
152
+ _this:this,
153
+ title:name,
154
+ safe:true
155
+ }
156
+ this.$dispatch('gotoson',prpdata)
157
+ this.$goto(link)
158
+ }
159
+ },
160
+ cleanalldata(){
161
+ this.$showMessage('此操作为清理数据,无法恢复!', ['confirm', 'cancel']).then((res) => {
162
+ if (res === 'confirm') {
163
+ let result = this.$androidUtil.bzLogic('clearPhoneData', {flag: 0})
164
+ console.log((result.result))
165
+ if(result.result == '成功'){
166
+ this.$showMessage('清除数据完成!')
167
+ }else{
168
+ this.$showMessage('清除数据失败!')
169
+ }
170
+ }
171
+ })
172
+ },
173
+ // 清空数据
174
+ cleandata(){
175
+ console.log("88888888888")
176
+ this.$showMessage('此操作为清理数据,无法恢复!', ['confirm', 'cancel']).then((res) => {
177
+ if (res === 'confirm') {
178
+ let result = this.$androidUtil.bzLogic('clearPhoneDataNew', {tables: this.dataclear})
179
+ console.log((result.result))
180
+ if(result.result == '成功'){
181
+ this.$showMessage('清除数据完成!')
182
+ }else{
183
+ this.$showMessage('清除数据失败!')
184
+ }
185
+ this.close()
186
+ }
187
+ })
188
+ },
189
+ // 导出数据
190
+ openclear(){
191
+ this.show=true
192
+ },
193
+ outdata(){
194
+ HostApp.backupDatabase()
195
+ this.$showMessage('数据导出成功!')
196
+ },
197
+ //取消自动登录
198
+ cancelAutoLogin(){
199
+ let auto=this.$androidUtil.getPreference('autoLogin')
200
+ if(auto){
201
+ this.$androidUtil.setPreference('autoLogin', false)
202
+ this.$showMessage('已取消自动登录!')
203
+ }else{
204
+ this.$showMessage('当前已处于非自动登录!')
205
+ }
206
+ }
207
+ },
208
+ watch: {
209
+ 'all' (val) {
210
+ if (val) {
211
+ this.modelval = Object.keys(this.fields)
212
+ } else {
213
+ console.log(this.flag)
214
+ if (this.flag){
215
+ this.modelval = []
216
+ }
217
+ }
218
+ this.flag=true
219
+ },
220
+ 'modelval.length' () {
221
+ this.sortModelval()
222
+ }
223
+ }
224
+ }
225
+
226
+ </script>
227
+ <style scoped>
228
+ .flex-between {
229
+ display: flex;
230
+ justify-content: space-between;
231
+ align-items: center;
232
+ }
233
+ .flex-between span {
234
+ padding-right: 10px;
235
+ }
236
+ .flex-full {
237
+ flex: 1;
238
+ }
239
+ .name{
240
+ font: 15px PingFang-SC-Medium;
241
+ color: #666666;
242
+ }
243
+ .imgs{
244
+ width: 35px;
245
+ margin-top: 15px;
246
+ }
247
+ .plan {
248
+ border-bottom: 0.5px solid #EAEAEA;
249
+ border-right: 0.5px solid #EAEAEA;
250
+ height: 120px;
251
+ }
252
+ .manbiankuang{
253
+ width: 44%;
254
+ margin-top: 15px;
255
+ margin-left: 4%;
256
+ border:1px solid #e3e3e3;
257
+ border-radius:10px 10px 10px 10px;
258
+ text-align: center;
259
+ background-color: #ffffff;
260
+ }
261
+ .user{
262
+ border-bottom: 0.5px solid #EAEAEA;
263
+ border-right: 0.5px solid #EAEAEA;
264
+ border-left: 0.5px solid #EAEAEA;
265
+ height: 120px;
266
+ }
267
+ .safecheck{
268
+ border-bottom: 0.5px solid #EAEAEA;
269
+ border-left: 0.5px solid #EAEAEA;
270
+ height: 120px;
271
+ }
272
+ .appointment{
273
+ border-top: 0.5px solid #EAEAEA;
274
+ border-right: 0.5px solid #EAEAEA;
275
+ height: 120px;
276
+ }
277
+ .search{
278
+ border-top: 0.5px solid #EAEAEA;
279
+ border-right: 0.5px solid #EAEAEA;
280
+ border-left: 0.5px solid #EAEAEA;
281
+ height: 120px;
282
+ }
283
+ .upload{
284
+ border-top: 0.5px solid #EAEAEA;
285
+ border-left: 0.5px solid #EAEAEA;
286
+ height: 120px;
287
+ }
288
+
289
+
290
+ </style>