widget.js
2.56 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
var self = new Vue({
el:'#app',
data(){
return {
search:'',
projectId:null,
userId:null,
pageNum:1,
pageSize:10,
total:0,
// 表格数据
tabaledata:[],
multipleSelection: []
}
},
mounted(){
this.getData();
},
directives:{
focus: {
inserted:function f(el) {
el.focus()
}
}
},
methods:{
//数据请求
getData() {
axios.get(CONF_NEWGHSC_SERVERURL + '/wfsj/list',{
params:{
pageNum:this.pageNum,
pageSize:this.pageSize,
keyWord:this.search
}
}).then(res => {
if(res && res.data && res.data.code==200){
this.tabaledata = res.data.data.list;
this.total = res.data.data.total
}
}).catch(err=>{
console.log(err)
});
},
clickData(row){
// console.log(row)
let id = row.id;
window.parent.document.getElementById('iframecontent').src = 'view/PHJG/WFSJ/xmgl/Sonwidget.html?id='+id;
},
//点击删除
handlDelete(){
if(this.multipleSelection.length < 1){
this.$message.warning('请先选择需要删除的数据')
return false
}
let params =[];
this.multipleSelection.forEach(item=>{
params.push(item.id)
})
axios.delete(CONF_NEWGHSC_SERVERURL + '/wfsj/phqgz',{data:params}).then(res=>{
if(res && res.data && res.data.code ==200){
this.$message.success('删除数据成功')
}
this.getData()
}
)
},
//点击表格的多选框
handleSelectionChange(val){
this.multipleSelection = val
console.log(this.multipleSelection)
},
//搜索事件
SearchInfo(){
this.getData()
},
handleSizeChange(pageSize){
this.pageSize = pageSize
this.getData()
},
handleCurrentChange(pageNum){
this.pageNum = pageNum
this.getData()
},
//点击添加
AddNewPage(){
window.parent.document.getElementById('iframecontent').src = 'view/PHJG/WFSJ/xmgl/Sonwidget.html';
},
}
})