You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.2 KiB
103 lines
3.2 KiB
2 years ago
|
var app7 = new Vue({
|
||
|
el: '#tableTest1',
|
||
|
data: {
|
||
|
//message: [],
|
||
|
message: [],
|
||
|
columns: [{
|
||
|
title: 'Id',
|
||
|
field: 'bz'
|
||
|
},
|
||
|
{
|
||
|
field: 'name',
|
||
|
title: 'Item Name'
|
||
|
}, {
|
||
|
field: 'url',
|
||
|
title: 'url'
|
||
|
}, {
|
||
|
field: 'alex',
|
||
|
title: 'alex'
|
||
|
}, {
|
||
|
field: 'country',
|
||
|
title: 'country'
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
created() {
|
||
|
//console.log(this.message)
|
||
|
this.inquireinfo();
|
||
|
//this.intervalGetData();
|
||
|
//console.log(this.message)
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
inquireinfo() {
|
||
|
//es6 箭头函数的写法
|
||
|
// $.get("selectBtTable.php?action=init_data_list", data => {
|
||
|
// var data = JSON.parse(data);
|
||
|
// this.message = data;
|
||
|
// $('#tableTest1').bootstrapTable('load', this.message);
|
||
|
// console.log("init data")
|
||
|
// })
|
||
|
var self = this;
|
||
|
self.requestApi({
|
||
|
modulename: "BatchRate",
|
||
|
funname: "BatchRate",
|
||
|
para: {},
|
||
|
success: (res) => {
|
||
|
console.log(res)
|
||
|
self.message = res;
|
||
|
console.log(self.message);
|
||
|
//if (res.res == "success") {
|
||
|
// //toastr.success("替换成功", '', {
|
||
|
// // progressBar: true
|
||
|
// //})
|
||
|
// //self.queryData(newPallet)
|
||
|
|
||
|
//} else {
|
||
|
// //toastr.error(res.msg, '替换失败', {
|
||
|
// // progressBar: true
|
||
|
// //})
|
||
|
|
||
|
//}
|
||
|
},
|
||
|
fail: (ex) => {
|
||
|
console.log(ex)
|
||
|
//toastr.error(ex, '出错', {
|
||
|
// progressBar: true
|
||
|
//})
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
operateFormatter: function (value, row, index) {
|
||
|
return [
|
||
|
'<a class="like" href="javascript:void(0)" title="Like">',
|
||
|
'<i class="fa fa-heart"></i>',
|
||
|
'</a> ',
|
||
|
'<a class="remove" href="javascript:void(0)" title="Remove">',
|
||
|
'<i class="fa fa-trash"></i>',
|
||
|
'</a>'
|
||
|
].join('')
|
||
|
},
|
||
|
requestApi: function (config) {//modulename, funname, para, success, fail) {
|
||
|
fetch("/api/" + config.modulename + "/" + config.funname + "", {
|
||
|
method: "post",
|
||
|
headers: {
|
||
|
"Accept": "application/json, text/plain, */*",
|
||
|
"Content-Type": "application/json"
|
||
|
},
|
||
|
body: JSON.stringify(config.para)
|
||
|
}).then(
|
||
|
(res) => { return res.json() }
|
||
|
).then(
|
||
|
(res) => { config.success(res) }
|
||
|
).catch(
|
||
|
(ex) => { config.fail(ex) }
|
||
|
)
|
||
|
}
|
||
|
},
|
||
|
mounted() {
|
||
|
console.log(this.message + "mounted")
|
||
|
$('#tableTest1').bootstrapTable({ columns: this.columns, search: true, showRefresh: true });
|
||
|
}
|
||
|
|
||
|
})
|