严智鑫
2025-04-22 e45d0852eff0e494e232ffcc60e0c190acb28801
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
 
 
let str = window.location.href.substr(window.location.href.indexOf('?') + 1)
let json = new Object()
  const arr = str.split('&')
  for(let i = 0; i < arr.length; i++) {
    let item = arr[i].split('=')
    json[item[0]] = item[1]
}
 
var mixin={
    methods:{
        onmouseMove(){//屏幕鼠标移动循环播放
            clearInterval(this.global.polling);
            
            this.global.polling=setInterval(()=>{
            
                this.global.pollingIndex>=1?this.global.pollingIndex=0:this.global.pollingIndex++
                this.$forceUpdate();
            },this.global.timer)//根据自定义Vue全局变量进行操作
        },
        onmouseMove2(){//屏幕鼠标移动循环播放
            clearInterval(this.global.polling);
            this.global.polling=setInterval(()=>{
                this.global.pollingIndex>=2?this.global.pollingIndex=0:this.global.pollingIndex++
                this.$forceUpdate();
            },this.global.timer)//根据自定义Vue全局变量进行操作
        },
        async connects(gongneng,sql,flag,num){
          let param = new URLSearchParams(); 
          param.append("gongneng",gongneng);
          param.append("sql",sql);
          param.append("flag",flag);
          param.append("anquanma","anquanma1");
              
         await this.$http.post( '../mysqlInsert/mysql.jsp',param)
          .then(function (response) {
            if(num==1){
                  result=response.data;
                  index = result.indexOf("[[");
                  if(index>-1){
                      if(result.indexOf("[[anquanmaerr]]")>-1){
                            //alert('请先登录后操作');
                            window.parent.location.href='../login/index.jsp';
                      }else{
                          result=result.substring(index).trim()
                          alert(result);
                          window.location.reload();
                      }
                  }else{
                      alert(gongneng+"成功!")
                      window.location.reload();
                  }
              }
        })
        .catch(function (error) {
            alert('Error: ' + "服务器数据发生错误!"); 
        });
            
      },
        async loadAjxss(gongneng,sql,flag,vals){
            
          let param = new URLSearchParams(); 
          param.append("yemian","123"); 
          param.append("gongneng",gongneng);
          param.append("sql",sql);
          param.append("flag",flag);
          param.append("anquanma","anquanma1");
        await this.$http.post( '../mysqlInsert/mysql.jsp',param)
            .then(function (response) {
 
                if(flag==2){
                    let result=response.data;
                    let index = result.indexOf("[{");
                    //console.log('....'+index);
                    if(index>-1){
                        result=result.substring(index).trim();
                        app.$data[vals]=JSON.parse(result);
                        console.log(vals+":");
                        console.log(app.$data[vals]);
                    }else if(result.indexOf("[[anquanmaerr]]")>-1){
                        //alert('请先登录后操作');
                        window.parent.location.href='../login/index.jsp';
                    }
                }
            })
            .catch(function (error) {
                if(this.global.errorFlag==0){
                    this.global.errorFlag=1
                    alert('Error: ' + "服务器数据发生错误!")
                }
            });
        },
        async returnloadAjxss(parameter){//fa
          let param = new URLSearchParams(); 
          param.append("yemian","123"); 
          param.append("gongneng",parameter.gongneng);
          param.append("sql",parameter.sql);
          param.append("flag",parameter.flag);
          param.append("anquanma","anquanma1");
          
            let results=''
            await this.$http.post( '../mysqlInsert/mysql.jsp',param)
                .then(function (response) {
                        let result=response.data;
                        let index = result.indexOf("[{");
                        if(index>-1){
                            result=result.substring(index).trim();
                            results=JSON.parse(result);
                            console.log(parameter.vals+":");
                            console.log(results);
                        }else if(result.indexOf("[[anquanmaerr]]")>-1){
                            //alert('请先登录后操作');
                            window.parent.location.href='../login/index.jsp';
                        }
                })
                .catch(function (error) {
                    if(this.global.errorFlag==0){
                        this.global.errorFlag=1
                        alert('Error: ' + "服务器数据发生错误!")
                    }
                });
 
            return results
        },
        async interValLoadAjxs(gongneng,sql,flag,vals,timer){//定时器拿数据报错后清除定时器
          let param = new URLSearchParams(); 
          param.append("yemian","循环数据"); 
          param.append("gongneng",gongneng);
          param.append("sql",sql);
          param.append("flag",flag);
          param.append("anquanma","anquanma1");
        await this.$http.post( '../mysqlInsert/mysql.jsp',param)
            .then(function (response) {
                if(flag==2){
                    let result=response.data
                    let index = result.indexOf("[{");
                    if(index>-1){
                        result=result.substring(index).trim();
                        app.$data[vals]=JSON.parse(result);
                        //console.log(vals+":");
                        //console.log(app.$data[vals]);
                    }else if(result.indexOf("[[anquanmaerr]]")>-1){
                        //alert('请先登录后操作');
                        window.parent.location.href='../login/index.jsp';
                    }
                }
            })
            .catch( (error)=> {
                clearInterval(timer)
                if(this.global.errorFlag==0){
                    this.global.errorFlag=1
                    alert('Error: ' + "服务器数据发生错误!")
                    window.location.reload()
                }
                // if(this.global.getTableDataTimer){
                //     clearInterval(this.global.getTableDataTimer)
                // }
                // if(this.global.getMachineElectricTimer){
                //     clearInterval(this.global.getMachineElectricTimer)
                // }
                // if(this.global.getMachineWaterTimer){
                //     clearInterval(this.global.getMachineWaterTimer)
                // }
                //alert('Error: ' + "服务器数据发生错误!")
            });
        },
 
 
        async getTableData(machineType){//大屏显示 查询订单数据
            //this.global.getTableDataTimer=
            let getTableDataTimer=await setInterval(()=>{
                let canshu={
                    machineType:machineType,//机器类型
                }
                let sql="{call AXJ_a_largeScreen_order_machineType_select(?,?)}~"+JSON.stringify(canshu);
                this.interValLoadAjxs('表数据查询',sql,2,"tableData",getTableDataTimer)
            },5000)
        },
        async getMachineElectric(machineType,group){//大屏显示 查询机器用电量
            //this.global.getMachineElectricTimer=
            let getMachineElectricTimer=await setInterval(()=>{
                let canshu={
                    machineType:machineType,//机器类型
                    group:group  //电表组别
                }
                let sql="{call AXJ_a_largeScreen_electric_select(?,?,?)}~"+JSON.stringify(canshu);
                this.interValLoadAjxs('大屏显示钻孔查询',sql,2,"machineElectric",getMachineElectricTimer)
            },5000)
        },
        async getMachineWater(machineType,group){
            //this.global.getMachineWaterTimer=
            let getMachineWaterTimer=await setInterval(()=>{
                let canshu={
                    machineType:machineType,//机器类型
                    group:group  //水表组别
                }
                let sql="{call AXJ_a_largeScreen_water_select(?,?,?)}~"+JSON.stringify(canshu);
                this.interValLoadAjxs('大屏显示钻孔水表查询',sql,2,"machineWater",getMachineWaterTimer)
            },5000)
        }
    }
}
//gongneng:自定义,sql存储过程,flag标志(0,是用张工之前功能插入,1存储过程查询,2存储过程插入),vals:vue里data参数
 function loadAjxs(gongneng,sql,flag,vals){
     $.post("../mysqlInsert/mysql.jsp",
              {"yemian":"123","gongneng":gongneng,"sql":sql,'flag':flag,'anquanma':"anquanma1"},
              function(result){
            if(flag==2){
                result=$(result).text();
                index = result.indexOf("[{");
                if(index>-1){
                    result=result.substring(index).trim();
                    app.$data[vals]=JSON.parse(result);
                    console.log(vals+":");
                    console.log(app.$data[vals]);
                }else if(result.indexOf("[[anquanmaerr]]")>-1){
                    //alert('请先登录后操作');
                    window.parent.location.href='../login/index.jsp';
                }
            }
            
        })
         .fail(function(response) {
            alert('Error: ' + "服务器数据发生错误!"); 
        }); 
}