guoyuji
2023-11-30 a136a7f99674969283287ba38aa9bd6199750dd7
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
Vue.prototype.global={
  polling:null,
  pollingIndex:0,
  timer:30000
}
 
 
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:{
        connects1:function(gongneng,sql,flag,num){
              $.post("../mysqlInsert/mysql.jsp",
                      {"gongneng":gongneng,"sql":sql,'flag':flag,'anquanma':json["anquanma"]},
                      function(result){
                          if(num==1){
                              result=$(result).text();
                              index = result.indexOf("[[");
                              if(index>-1){
                                  if(result.indexOf("[[安全码异常]]")>-1){
                                        //alert('请先登录后操作');
                                        window.parent.location.href='../login/index.jsp';
                                  }else{
                                      result=result.substring(index).trim()
                                      alert(result);  
                                  }
                                  
                              }else{
                                  alert(gongneng+"成功!")
                                  window.location.reload();
                              }
                          }
                          
                })
                 .fail(function(response) {
                    alert('Error: ' + "服务器数据发生错误!");
                    return false;
                });
      },
        connects:function(gongneng,sql,flag,num){
            $.ajax({ 
                url :'../mysqlInsert/mysql.jsp',
                type : "post",//不局限于get 
                data:{"gongneng":gongneng,"sql":sql,'flag':flag,'anquanma':json["anquanma"]}, 
                async : true, 
                success : function(result) { 
                    if(num==1){
                        result=$(result).text();
                        index = result.indexOf("[[");
                        if(index>-1){
                            if(result.indexOf("[[安全码异常]]")>-1){
                                //alert('请先登录后操作');
                                window.parent.location.href='../login/index.jsp';
                            }else{
                                result=result.substring(index).trim()
                                alert(result);  
                            }
                            
                        }else{
                            alert(gongneng+"成功!")
                            window.location.reload();
                        }
                    }
                    
                }, 
                error : function(data) { 
                 alert( 'Error: ' + "服务器数据发生错误!"+data); 
                } 
             });
    },
    }
}
//gongneng:自定义,sql存储过程,flag标志(0,是用张工之前功能插入,1存储过程查询,2存储过程插入),vals:vue里data参数
function loadAjxs1(gongneng,sql,flag,vals){
    $.post("../mysqlInsert/mysql.jsp",
              {"yemian":"123","gongneng":gongneng,"sql":sql,'flag':flag,'anquanma':json["anquanma"]},
              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(app.$data[vals]);
                }else if(result.indexOf("[[anquanmaerr]]")>-1){
                    //alert('请先登录后操作');
                    window.parent.location.href='../login/index.jsp';
                    event.preventDefault()
                }
            }
        })
         .fail(function(response) {
            alert('Error: ' + "服务器数据发生错误!"); 
            event.preventDefault()
        }); 
}
 
function loadAjxs(gongneng,sql,flag,vals){
    $.ajax({ 
        url :'../mysqlInsert/mysql.jsp',
        type : "GET",//不局限于get 
        data:{"yemian":"123","gongneng":gongneng,"sql":sql,'flag':flag,'anquanma':json["anquanma"]}, 
        async : true, 
        success : function(result) { 
         result=$(result).text();
                index = result.indexOf("[{");
                if(index>-1){
                    result=result.substring(index).trim();
                    app.$data[vals]=JSON.parse(result);
                    console.log(app.$data[vals]);
                }else if(result.indexOf("[[anquanmaerr]]")>-1){
                    //alert('请先登录后操作');
                    window.parent.location.href='../login/index.jsp';
                    event.preventDefault()
                }
            
        }, 
        error : function(data) { 
         alert( 'Error: ' + "服务器数据发生错误!"); 
        } 
     });
}