var vm = new Vue({ el: '#app', data: { password1enabled: true, password1: "", password2enabled: false, password2: "", }, mounted() { this.getPasswords(); }, methods: { getPasswords() { let _this = this axios .get('/DevOps/GetCimPasswords') .then(function (response) { for (var i = 0; i < response.data.length; i++) { if (response.data[i].no === 1) { _this.password1enabled = response.data[i].enabled; _this.password1 = response.data[i].password; } else if (response.data[i].no === 2) { _this.password2enabled = response.data[i].enabled; _this.password2 = response.data[i].password; } } }) .catch(function (error) { console.log(error) }); }, savePassword1() { let _this = this axios .post('/DevOps/SetCimPassword', { No: 1, Password: _this.password1, Enabled: _this.password1enabled }) .then(function (response) { result = response.data; if (result.code === 0) { alert("保存成功!"); } else if (result.code === 1) { alert("执行失败:" + result.message); } }) .catch(function (error) { console.log(error) }); }, savePassword2() { let _this = this axios .post('/DevOps/SetCimPassword', { No: 2, Password: _this.password2, Enabled: _this.password2enabled }) .then(function (response) { result = response.data; if (result.code === 0) { alert("保存成功!"); } else if (result.code === 1) { alert("执行失败:" + result.message); } }) .catch(function (error) { console.log(error) }); }, clearElectricEnergyCache() { axios .post('/EnergyConsumptionMeterCheck/ClearElectricEnergyCache', ) .then(function (response) { result = response.data; if (result.code === 0) { alert("执行成功!"); } else if (result.code === 1) { alert("执行失败:" + result.message); } }) .catch(function (error) { console.log(error) }); }, initElectricEnergyList() { axios .post('/EnergyConsumptionMeterCheck/InitMeters',) .then(function (response) { result = response.data; if (result.code === 0) { alert("执行成功!"); } else if (result.code === 1) { alert("执行失败:" + result.message); } }) .catch(function (error) { console.log(error) }); }, exampleInputFile() { } } })