zhangjiaqing
8 天以前 1cef3adee31c6934c0da4b4f0b8a6f5ac03b364f
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
99
100
101
102
103
104
105
106
107
108
/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            storehouseManageInfo: {
                storehouses: [],
                total: 0,
                records: 1,
                moreCondition: false,
                shId: '',
                shTypes: [],
                conditions: {
                    shName: '',
                    shType: '',
                    isShow: '',
                    shId: '',
                    communityId: vc.getCurrentCommunity().communityId
                }
            }
        },
        _initMethod: function () {
            $that._listStorehouses(DEFAULT_PAGE, DEFAULT_ROWS);
            vc.getDict('storehouse', "sh_type", function (_data) {
                $that.storehouseManageInfo.shTypes = _data;
            });
        },
        _initEvent: function () {
            vc.on('storehouseManage', 'listStorehouse', function (_param) {
                $that._listStorehouses(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function (_currentPage) {
                $that._listStorehouses(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            //查询方法
            _listStorehouses: function (_page, _rows) {
                $that.storehouseManageInfo.conditions.page = _page;
                $that.storehouseManageInfo.conditions.row = _rows;
                $that.storehouseManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
                let param = {
                    params: $that.storehouseManageInfo.conditions
                };
                param.params.shName = param.params.shName.trim();
                param.params.shId = param.params.shId.trim();
                //发送get请求
                vc.http.apiGet('/resourceStore.listStorehouses',
                    param,
                    function (json, res) {
                        var _storehouseManageInfo = JSON.parse(json);
                        $that.storehouseManageInfo.total = _storehouseManageInfo.total;
                        $that.storehouseManageInfo.records = _storehouseManageInfo.records;
                        $that.storehouseManageInfo.storehouses = _storehouseManageInfo.data;
                        vc.emit('pagination', 'init', {
                            total: $that.storehouseManageInfo.records,
                            dataCount: $that.storehouseManageInfo.total,
                            currentPage: _page
                        });
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                    }
                );
            },
            //重置
            _resetStorehouses: function (_page, _rows) {
                $that.storehouseManageInfo.conditions.shId = "";
                $that.storehouseManageInfo.conditions.shName = "";
                $that.storehouseManageInfo.conditions.shType = "";
                $that.storehouseManageInfo.conditions.isShow = "";
                $that._listStorehouses(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _openAddStorehouseModal: function () {
                vc.emit('addStorehouse', 'openAddStorehouseModal', {});
            },
            _openEditStorehouseModel: function (_storehouse) {
                vc.emit('editStorehouse', 'openEditStorehouseModal', _storehouse);
            },
            _openDeleteStorehouseModel: function (_storehouse) {
                vc.emit('deleteStorehouse', 'openDeleteStorehouseModal', _storehouse);
            },
            _openDetailStorehouseModel: function (_storehouse) {
                vc.jumpToPage("/#/pages/common/resourceStoreManage?shId=" + _storehouse.shId + "&flag=1");
            },
            _queryStorehouseMethod: function () {
                $that._listStorehouses(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            //重置
            _resetStorehouseMethod: function () {
                $that._resetStorehouses(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _toAuditPage: function () {
                vc.jumpToPage('/#/pages/property/workflowManage?tab=流程管理');
            },
            _moreCondition: function () {
                if ($that.storehouseManageInfo.moreCondition) {
                    $that.storehouseManageInfo.moreCondition = false;
                } else {
                    $that.storehouseManageInfo.moreCondition = true;
                }
            }
        }
    });
})(window.vc);