1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
 入驻园区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROW = 10;
    vc.extends({
        data: {
            equipmentAccountManageInfo: {
                currentPage: '1',
                equipmentAccounts: [],
                total: 0,
                records: 1,
                moreCondition: false,
                machineId: '',
                conditions: {
                    machineName: '',
                    machineCode: '',
                    releaseUserName: '',
                    state: '',
                    importanceLevel: '',
                    chargeOrgId: '',
                    firstEnableTime: '',
                    typeId: ''
                },
                useStatus: []
            },
            machineTypeInfo: {},
            importanceLevels: []
        },
        _initMethod: function () {
            vc.getDict('machine_type', "importance_level", function (_data) {
                vc.component.importanceLevels = _data;
            });
        },
        _initEvent: function () {
            vc.on('equipmentAccount', 'switchType', function (_param) {
                vc.component.equipmentAccountManageInfo.conditions.typeId = _param.typeId;
                vc.component.equipmentAccountManageInfo.conditions.flag = 1;
                vc.component._listEquipmentAccounts(DEFAULT_PAGE, DEFAULT_ROW);
            });
        },
        methods: {
            _listEquipmentAccounts: function (_page, _row) {
                if (!$that.equipmentAccountManageInfo.conditions.typeId) {
                    vc.toast('请先选择设备分类');
                    return;
                }
                let _machineTypes = $that.machineTypesTreeInfo.machineTypes;
                let _machineType;
                _machineTypes.forEach(item => {
                    if (item.typeId == $that.equipmentAccountManageInfo.conditions.typeId) {
                        _machineType = item;
                    }
                });
                vc.component.machineTypeInfo = _machineType;
            },
            _openAddMachineTypeModal: function () {
                if (!$that.equipmentAccountManageInfo.conditions.typeId) {
                    vc.toast('请先选择设备分类');
                    return;
                }
                vc.emit('addMachineType', 'openAddMachineTypeModal', {typeId: $that.equipmentAccountManageInfo.conditions.typeId});
            },
            _openAddParentMachineTypeModal: function () {
                vc.emit('addMachineType', 'openAddMachineTypeModal', {});
            },
            _openEditMachineTypeModel: function () {
                if (!$that.equipmentAccountManageInfo.conditions.typeId) {
                    vc.toast('请先选择设备分类');
                    return;
                }
                let _machineTypes = $that.machineTypesTreeInfo.machineTypes;
                let _machineType;
                _machineTypes.forEach(item => {
                    if (item.typeId == $that.equipmentAccountManageInfo.conditions.typeId) {
                        _machineType = item;
                    }
                });
                vc.emit('editMachineType', 'openEditMachineTypeModal', _machineType);
            },
            _openDeleteMachineTypeModel: function () {
                if (!$that.equipmentAccountManageInfo.conditions.typeId) {
                    vc.toast('请先选择设备分类');
                    return;
                }
                let _machineTypes = $that.machineTypesTreeInfo.machineTypes;
                let _machineType;
                _machineTypes.forEach(item => {
                    if (item.typeId == $that.equipmentAccountManageInfo.conditions.typeId) {
                        _machineType = item;
                    }
                });
                vc.emit('deleteMachineType', 'openDeleteMachineTypeModal', _machineType);
            },
        }
    });
})(window.vc);