abnormal-data-add.vue
8.41 KB
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
<template>
<div class="container resource close-left-menu">
<!-- 操作栏 -->
<div class="pop-banner clearfix">
<div class="operate-btns">
<a href="javascript:void(0)" class="fbtn fb-save" v-on:click="saveList()">保存</a>
<a v-link="{path:'/abnormalData'}" href="javascript:void(0)" class="fbtn fb-return">返回</a>
</div>
<h3 class="current-module">异常数据新增</h3>
</div>
<div class="pd-form">
<div class="fheader">
<h4 class="fh-edit">异常信息</h4>
</div>
<div class="group-row">
<div class="form-group form-label" style="width:100%">
<label class="label" for="cn1">标题</label>
<div class="control" style="width:91%">
<input type="text" id="cn1" v-model="title" class="inp2" maxlength="10" placeholder="请输入最多10个汉字作为标题">
</div>
</div>
</div>
<div class="group-row">
<div class="form-group form-label" style="width:100%">
<label for="cn2" class="label">sql内容</label>
<div class="control" style="width:91%">
<textarea id="cn2" rows="7" v-model='sqlcontent' class="inp3"></textarea>
</div>
</div>
</div>
<div class="fheader">
<h4 class="fh-notes">异常明细</h4>
</div>
<div class="purchase-plan mt-20">
<table class="itable itable-bordertop itable-thead-13px">
<thead>
<tr>
<th class="w60">序号</th>
<th class="w100">标题</th>
<th class="w150">sql内容</th>
<th class="w100">操作</th>
</tr>
</thead>
<tbody>
<tr v-if="abnormalList.length==0">
<td colspan="4">暂无数据!</td>
</tr>
<tr v-for="list in abnormalList">
<td> {{ $index + 1 }} </td>
<td class="t-left pr10 pl10">{{list.title}}</td>
<td class="t-left pr10 pl10">{{list.sqlcontent}}</td>
<td>
<a class="btn-d btn-d-red btn-w60" href="javascript:" v-on:click="delList(list)" >删除</a>
</td>
</tr>
</tbody>
</table>
<div class="pagination m-20-0">
<em class="page">明细条目数【{{ search.total }}】</em>
<pagination @page-change="getData(true)" :class="['m-20-0']" :page-no.sync="search.page" :total-pages.sync="search.totalPages">
</pagination>
</div>
</div>
</div>
<div class="roll-bg" v-show='requestS'>
<div class="w60" style="margin:0 auto;">
<img src="/images/roll.gif">
</div>
<div class="container resource t-center text-color-red">
正在处理中,请勿关闭!
</div>
</div>
</div>
</template>
<script>
module.exports = {
data: function() {
return {
abnormalList: [],//异常明细数
search: {
pageSize: 50,
page: 1,
totalPages: 0,
total: 0,
},
titel:'',
sqlcontent:'',
requestS:false,
};
},
methods: {
getData:function(){
var self=this;
Ajax.post('/systemdata/getMFAbnormalChecklist',self.search).
then(function(response){
var data = response.data.data;
if(response.data.errorCode==0){
self.search.totalPages=data.totalPages;
self.search.total=data.total;
self.$set("abnormalList", data.list);
}else{
self.MessageBox({
title: '提示',
message: response.data.message,
type: 'alert'
}, function(action) {});
}
})
},
saveList:function() {
var self = this;
if(self.title==null || self.title==''){
self.MessageBox({title:'提示',message:'异常标题不能为空!',type:'alert'
},function(action){
});
return;
}
if(self.sqlcontent==null || self.sqlcontent==''){
self.MessageBox({title:'提示',message:'异常sql内容不能为空!',type:'alert'
},function(action){
});
return;
}
self.requestS=true;
var param = {'title':self.title,'sqlcontent':self.sqlcontent};
Ajax.post('/systemdata/saveMFAbnormalCheck',param)
.then(function (response){
self.requestS=false;
var data = response.data.data;
if(response.data.errorCode==0){
var text = "添加成功!";
if(data && data == "fail"){
text = "添加失败!"
}
self.MessageBox({
title: '提示',
message: text,
type: 'alert'
}, function(action) {
if(data && data == "success"){
self.title = "";
self.sqlcontent = "";
self.getData();
}
});
}else{
self.MessageBox({
title: '提示',
message: response.data.message,
type: 'alert'
}, function(action) {});
}
})
},
delList:function(list){
var self=this;
self.MessageBox({
title: '提示',
message: '是否确定删除?',
type: 'alert',
showCancelButton: true
}, function(action) {
if(action == 'confirm') {
self.delListDetail(list);
}
})
},
delListDetail:function(list){
var self=this;
Ajax.post('/systemdata/deleteMFAbnormalChecklist',{'guid':list.guid}).
then(function(response){
var data = response.data.data;
if(response.data.errorCode==0){
var text = "删除成功!";
if(data && data == "fail"){
text = "删除失败!"
}
self.MessageBox({
title: '提示',
message: text,
type: 'alert'
}, function(action) {
if(data && data == "success"){
self.getData();
}
});
}else{
self.MessageBox({
title: '提示',
message: response.data.message,
type: 'alert'
}, function(action) {});
}
})
}
},
watch: {
},
route: {
// 画面初始化
activate: function() {
this.getData();
}
}
};
</script>