mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-24 05:46:03 +08:00
优化代码
This commit is contained in:
parent
b4a15e480f
commit
9fd104720e
@ -210,7 +210,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}, 'ACCESS_CONTROL');
|
||||
},
|
||||
_loadAttrValue: function(_specCd, _values) {
|
||||
vc.getAttrValue(_specCd, function(data) {
|
||||
@ -220,7 +220,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}, 'ACCESS_CONTROL');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -242,7 +242,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}, 'ACCESS_CONTROL');
|
||||
},
|
||||
_loadEditAttrValue: function(_specCd, _values) {
|
||||
vc.getAttrValue(_specCd, function(data) {
|
||||
@ -252,7 +252,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}, 'ACCESS_CONTROL');
|
||||
},
|
||||
setEditMachineTypeCd: function(_typeId) {
|
||||
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
machineName: '',
|
||||
machineIp: '',
|
||||
machineMac: '',
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
domain: 'ACCESS_CONTROL',
|
||||
},
|
||||
listColumns: []
|
||||
}
|
||||
|
||||
@ -114,26 +114,10 @@
|
||||
</td>
|
||||
<td class="text-center">{{machine.createTime}}</td>
|
||||
<td class="text-center">
|
||||
<button class="btn-white btn btn-xs" v-on:click="_openDoorMachineModel(machine)" v-show="machine.machineTypeCd == '9999'"><span><vc:i18n name="开门" namespace="machineManage"></vc:i18n></span>
|
||||
<button class="btn-white btn btn-xs" @click="_openEditMachineModel(machine)"><span><vc:i18n name="修改设备" namespace="machineManage"></vc:i18n></span>
|
||||
</button>
|
||||
<button class="btn-white btn btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span><vc:i18n name="变更" namespace="machineManage"></vc:i18n></span>
|
||||
<button class="btn-white btn btn-xs" @click="_openDeleteMachineModel(machine)"><span><vc:i18n name="删除设备" namespace="machineManage"></vc:i18n></span>
|
||||
</button>
|
||||
<div class="dropdown-menu p-4 text-muted" style="max-width: 200px;">
|
||||
<p style="margin:10px 0;">
|
||||
<a href="javascript:void(0)" v-on:click="_openEditMachineModel(machine)">
|
||||
<span><vc:i18n name="修改设备" namespace="machineManage"></vc:i18n></span>
|
||||
</a>
|
||||
<span>|</span>
|
||||
<a href="javascript:void(0)" v-on:click="_openDeleteMachineModel(machine)">
|
||||
<span><vc:i18n name="删除设备" namespace="machineManage"></vc:i18n></span>
|
||||
</a>
|
||||
</p>
|
||||
<p style="margin:10px 0;">
|
||||
<a href="javascript:void(0)" v-on:click="_openRestartMachineModel(machine)">
|
||||
<span><vc:i18n name="重启设备" namespace="machineManage"></vc:i18n></span>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -155,4 +139,4 @@
|
||||
<vc:create path="property/editMachine"></vc:create>
|
||||
<vc:create path="property/deleteMachine"></vc:create>
|
||||
<vc:create path="property/machineState"></vc:create>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
var DEFAULT_PAGE = 1;
|
||||
var DEFAULT_ROWS = 10;
|
||||
vc.extends({
|
||||
@ -12,39 +12,40 @@
|
||||
records: 1,
|
||||
moreCondition: false,
|
||||
machineName: '',
|
||||
machineTypes:[],
|
||||
machineTypes: [],
|
||||
conditions: {
|
||||
machineCode: '',
|
||||
machineTypeCd: '',
|
||||
machineName: '',
|
||||
machineIp: '',
|
||||
machineMac: '',
|
||||
communityId: vc.getCurrentCommunity().communityId
|
||||
communityId: vc.getCurrentCommunity().communityId,
|
||||
domain: 'COMMON'
|
||||
|
||||
},
|
||||
listColumns: []
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
//vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
vc.getDict('machine', "machine_type_cd", function (_data) {
|
||||
vc.getDict('machine', "machine_type_cd", function(_data) {
|
||||
vc.component.machineManageInfo.machineTypes = _data;
|
||||
});
|
||||
$that._getColumns(function () {
|
||||
$that._getColumns(function() {
|
||||
vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
_initEvent: function () {
|
||||
_initEvent: function() {
|
||||
|
||||
vc.on('machineManage', 'listMachine', function (_param) {
|
||||
vc.on('machineManage', 'listMachine', function(_param) {
|
||||
vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
});
|
||||
vc.on('pagination', 'page_event', function (_currentPage) {
|
||||
vc.on('pagination', 'page_event', function(_currentPage) {
|
||||
vc.component._listMachines(_currentPage, DEFAULT_ROWS);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
_listMachines: function (_page, _rows) {
|
||||
_listMachines: function(_page, _rows) {
|
||||
|
||||
vc.component.machineManageInfo.conditions.page = _page;
|
||||
vc.component.machineManageInfo.conditions.row = _rows;
|
||||
@ -56,7 +57,7 @@
|
||||
vc.http.get('machineManage',
|
||||
'list',
|
||||
param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
let _machineManageInfo = JSON.parse(json);
|
||||
vc.component.machineManageInfo.total = _machineManageInfo.total;
|
||||
vc.component.machineManageInfo.records = _machineManageInfo.records;
|
||||
@ -67,12 +68,13 @@
|
||||
dataCount: vc.component.machineManageInfo.total,
|
||||
currentPage: _page
|
||||
});
|
||||
}, function (errInfo, error) {
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_listMachineTypes: function () {
|
||||
_listMachineTypes: function() {
|
||||
|
||||
var param = {
|
||||
params: {
|
||||
@ -85,38 +87,39 @@
|
||||
//发送get请求
|
||||
vc.http.apiGet('machineType.listMachineType',
|
||||
param,
|
||||
function (json, res) {
|
||||
function(json, res) {
|
||||
var _machineTypeManageInfo = JSON.parse(json);
|
||||
vc.component.machineManageInfo.machineTypes = _machineTypeManageInfo.data;
|
||||
}, function (errInfo, error) {
|
||||
},
|
||||
function(errInfo, error) {
|
||||
console.log('请求失败处理');
|
||||
}
|
||||
);
|
||||
},
|
||||
_openAddMachineModal: function () {
|
||||
_openAddMachineModal: function() {
|
||||
vc.emit('addMachine', 'openAddMachineModal', {});
|
||||
},
|
||||
_openEditMachineModel: function (_machine) {
|
||||
_openEditMachineModel: function(_machine) {
|
||||
vc.emit('editMachine', 'openEditMachineModal', _machine);
|
||||
},
|
||||
_openDeleteMachineModel: function (_machine) {
|
||||
_openDeleteMachineModel: function(_machine) {
|
||||
vc.emit('deleteMachine', 'openDeleteMachineModal', _machine);
|
||||
},
|
||||
_queryMachineMethod: function () {
|
||||
_queryMachineMethod: function() {
|
||||
vc.component._listMachines(DEFAULT_PAGE, DEFAULT_ROWS);
|
||||
|
||||
},
|
||||
_moreCondition: function () {
|
||||
_moreCondition: function() {
|
||||
if (vc.component.machineManageInfo.moreCondition) {
|
||||
vc.component.machineManageInfo.moreCondition = false;
|
||||
} else {
|
||||
vc.component.machineManageInfo.moreCondition = true;
|
||||
}
|
||||
},
|
||||
_openMachineDetailModel: function (_machine) {
|
||||
_openMachineDetailModel: function(_machine) {
|
||||
|
||||
},
|
||||
_openRestartMachineModel: function (_machine) { //设备重启处理
|
||||
_openRestartMachineModel: function(_machine) { //设备重启处理
|
||||
vc.emit('machineState', 'openMachineStateModal', {
|
||||
machineCode: _machine.machineCode,
|
||||
stateName: '重启',
|
||||
@ -124,7 +127,7 @@
|
||||
url: '/machine/restartMachine'
|
||||
});
|
||||
},
|
||||
_openDoorMachineModel: function (_machine) { //设备开门处理
|
||||
_openDoorMachineModel: function(_machine) { //设备开门处理
|
||||
vc.emit('machineState', 'openMachineStateModal', {
|
||||
machineCode: _machine.machineCode,
|
||||
stateName: '开门',
|
||||
@ -132,12 +135,12 @@
|
||||
url: '/machine/openDoor'
|
||||
});
|
||||
},
|
||||
dealMachineAttr: function (machines) {
|
||||
dealMachineAttr: function(machines) {
|
||||
machines.forEach(item => {
|
||||
$that._getColumnsValue(item);
|
||||
});
|
||||
},
|
||||
_getColumnsValue: function (_machine) {
|
||||
_getColumnsValue: function(_machine) {
|
||||
_machine.listValues = [];
|
||||
if (!_machine.hasOwnProperty('machineAttrs') || _machine.machineAttrs.length < 1) {
|
||||
$that.machineManageInfo.listColumns.forEach(_value => {
|
||||
@ -157,10 +160,10 @@
|
||||
})
|
||||
|
||||
},
|
||||
_getColumns: function (_call) {
|
||||
_getColumns: function(_call) {
|
||||
console.log('_getColumns');
|
||||
$that.machineManageInfo.listColumns = [];
|
||||
vc.getAttrSpec('machine_attr', function (data) {
|
||||
vc.getAttrSpec('machine_attr', function(data) {
|
||||
$that.machineManageInfo.listColumns = [];
|
||||
data.forEach(item => {
|
||||
if (item.listShow == 'Y') {
|
||||
@ -168,11 +171,11 @@
|
||||
}
|
||||
});
|
||||
_call();
|
||||
});
|
||||
}, 'COMMON');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
})(window.vc);
|
||||
})(window.vc);
|
||||
Loading…
Reference in New Issue
Block a user