MicroCommunityWeb/public/components/property/machineState/machineState.js
2020-04-30 22:46:36 +08:00

55 lines
1.7 KiB
JavaScript

(function (vc, vm) {
vc.extends({
data: {
machineStateInfo: {
machineId: '',
stateName: '',
state: ''
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('machineState', 'openMachineStateModal', function (_params) {
vc.copyObject(_params, vc.component.machineStateInfo);
$('#machineStateModel').modal('show');
});
},
methods: {
_changeMachineState: function () {
vc.component.machineStateInfo.communityId = vc.getCurrentCommunity().communityId;
vc.http.post(
'machineState',
'update',
JSON.stringify(vc.component.machineStateInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
$('#machineStateModel').modal('hide');
vc.emit('machineManage', 'listMachine', {});
return;
}
vc.toast(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.toast(json);
});
},
_closeMachineStateModel: function () {
$('#machineStateModel').modal('hide');
}
}
});
})(window.vc, window.vc.component);