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.
60 lines
1.9 KiB
60 lines
1.9 KiB
2 years ago
|
let app = new Vue({
|
||
|
el: '#vueApp',
|
||
|
data: {
|
||
|
isEnable: null
|
||
|
},
|
||
|
methods: {
|
||
|
setConfig() {
|
||
|
let self = this
|
||
|
self.requestApi({
|
||
|
modulename: "QCConfig",
|
||
|
funname: "setConfig",
|
||
|
para: { setValue: self.isEnable ===true?"Y":"N" },
|
||
|
success: (res) => {
|
||
|
if (res.res === "success") {
|
||
|
toastr.success('保存成功', '', { progressBar: true });
|
||
|
}
|
||
|
else {
|
||
|
toastr.warning('保存失败', '', { progressBar: true });
|
||
|
}
|
||
|
},
|
||
|
fail: (ex) => {
|
||
|
toastr.fail(ex.msg, '', { progressBar: true });
|
||
|
}
|
||
|
|
||
|
})
|
||
|
},
|
||
|
queryConfig() {
|
||
|
let self = this
|
||
|
self.requestApi({
|
||
|
modulename: "QCConfig",
|
||
|
funname: "queryConfig",
|
||
|
success: (res) => {
|
||
|
this.isEnable = res.isenable === "Y" ? true : false
|
||
|
},
|
||
|
fail: (ex) => {
|
||
|
console.log(ex)
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
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() {
|
||
|
this.queryConfig()
|
||
|
}
|
||
|
})
|