zhangjq
2026-01-21 e6a3d55ef049c4fd14d61d27f7d513eb639f11ec
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/**
    入驻小区
**/
(function(vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            assetImportLogDetailInfo: {
                logs: [],
                logTypes: [],
                states: [{
                        name: '全部',
                        value: ''
                    },
                    {
                        name: '待导入',
                        value: 'W'
                    },
                    {
                        name: '导入成功',
                        value: 'C'
                    },
                    {
                        name: '导入失败',
                        value: 'F'
                    }
                ],
                total: 0,
                records: 1,
                moreCondition: false,
                logId: '',
                logType: '',
                state: '',
            },
            logDetails: ''
        },
        _initMethod: function() {
            $that.assetImportLogDetailInfo.logId = vc.getParam('logId');
            $that.assetImportLogDetailInfo.logType = vc.getParam('logType');
 
            $that.queryAssetImportLogType();
 
 
        },
        _initEvent: function() {
 
            vc.on('assetImportLogDetail', 'listAssetImportLogDetail', function(_param) {
                $that._listAssetImportLogDetails(DEFAULT_PAGE, DEFAULT_ROWS);
            });
            vc.on('pagination', 'page_event', function(_currentPage) {
                $that._listAssetImportLogDetails(_currentPage, DEFAULT_ROWS);
            });
        },
        methods: {
            _openDelRoomModel: function(content) {
                // 解析 JSON 字符串
                try {
                    if (!content) {
                        this.logDetails = '内容为空';
                    } else if (typeof content === 'object') {
                        // 如果已经是对象,直接转换为格式化的JSON字符串
                        this.logDetails = JSON.stringify(content, null, 2);
                    } else if (typeof content === 'string') {
                        if (content.trim() === '') {
                            this.logDetails = '无内容';
                        } else {
                            try {
                                // 尝试解析字符串为JSON
                                const parsedContent = JSON.parse(content);
                                // 将解析后的对象转换为格式化的JSON字符串
                                this.logDetails = JSON.stringify(parsedContent, null, 2);
                            } catch (e) {
                                // 如果解析失败,显示原始字符串
                                this.logDetails = content;
                            }
                        }
                    } else {
                        // 其他类型直接显示
                        this.logDetails = content.toString();
                    }
                } catch (e) {
                    console.error('无法解析内容: ', e);
                    // 显示原始内容,而不是简单的错误信息
                    this.logDetails = content || '内容无法解析';
                }
                
                // 打开模态框
                $('#detailModal').modal('show');
            },
            
            _listAssetImportLogDetails: function(_page, _rows) {
                var param = {
                    params: {
                        page: _page,
                        row: _rows,
                        logId: $that.assetImportLogDetailInfo.logId,
                        communityId: vc.getCurrentCommunity().communityId,
                        state: $that.assetImportLogDetailInfo.state,
                    }
                };
                //发送get请求
                vc.http.apiGet('/assetImportLogDetail/queryAssetImportLogDetail',
                    param,
                    function(json, res) {
                        var _assetImportLogDetailInfo = JSON.parse(json);
                        $that.assetImportLogDetailInfo.total = _assetImportLogDetailInfo.total;
                        $that.assetImportLogDetailInfo.records = _assetImportLogDetailInfo.records;
                        $that.assetImportLogDetailInfo.logs = _assetImportLogDetailInfo.data;
                        vc.emit('pagination', 'init', {
                            total: $that.assetImportLogDetailInfo.records,
                            dataCount: $that.assetImportLogDetailInfo.total,
                            currentPage: _page
                        });
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理', errInfo, error);
                    }
                );
            },
            queryAssetImportLogType: function(_page, _rows) {
                let param = {
                    params: {
                        logType: $that.assetImportLogDetailInfo.logType,
                    }
                };
                //发送get请求
                vc.http.apiGet('/assetImportLogType/queryAssetImportLogType',
                    param,
                    function(json, res) {
                        let _json = JSON.parse(json);
                        $that.assetImportLogDetailInfo.logTypes = _json.data;
                        $that._listAssetImportLogDetails(DEFAULT_PAGE, DEFAULT_ROWS);
                    },
                    function(errInfo, error) {
                        console.log('请求失败处理', errInfo, error);
                    }
                );
            },
 
 
            _goBack: function() {
                vc.goBack();
            },
            queryAssetImportLogDetail: function() {
                $that._listAssetImportLogDetails(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            swatchDetailState: function(_item) {
                $that.assetImportLogDetailInfo.state = _item.value;
                $that._listAssetImportLogDetails(DEFAULT_PAGE, DEFAULT_ROWS);
            }
        }
    });
})(window.vc);