研发图纸文件管理系统-前端项目
longyvfengyun
2023-11-30 84d71524cca35c0f0ddb73f3e8bef7a82703746a
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<script>
import AdvanceTable from "@/components/table/advance/AdvanceTable";
import {mapGetters} from "vuex";
import moment from "moment";
import {getUserList} from "@/pages/permission/apis";
import {bomFeedbackListPage} from "@/pages/workplace/apis";
import {ExportFile} from "@/assets/exportFile";
export default {
    name: "workplaceList",
    components: {
        AdvanceTable,
    },
    data() {
        let startTime = moment().add(-30, 'day').format("YYYY-MM-DD");
        let endTime = moment().format("YYYY-MM-DD");
        const columns = [
            {
                title: "产品名称",
                dataIndex: "parentName",
                align: "center",
                width: 120
            },
            {
                title: "产品型号",
                dataIndex: "parentModel",
                align: "center",
                width: 300
            },
            {
                title: "定制单号",
                dataIndex: "customCode",
                align: "center",
                width: 120
            },
            {
                title: "版本时间",
                dataIndex: "versionTime",
                align: "center",
                width: 120
            },
            {
                title: "创建人",
                dataIndex: "senderName",
                align: "center",
            },
            {
                title: "创建时间",
                dataIndex: "createTime",
                align: "center",
            },
            {
                title: "反馈接收人",
                dataIndex: "receiverNames",
                align: "center",
            },
            {
                title: "确认人",
                dataIndex: "confirmUserName",
                align: "center",
            },
            {
                title: "回复内容",
                dataIndex: "replyContent",
                align: "center",
            },
            {
                title: "回复时间",
                dataIndex: "replyTime",
                align: "center",
            },
            {
                title: "变更单流水号",
                dataIndex: "ecrNumber",
                align: "center",
            },
            // {
            //     title: "操作",
            //     dataIndex: "operation",
            //     key: "operation",
            //     align: "center",
            //     fixed: "right",
            //     width: 160,
            //     scopedSlots: { customRender: "action" },
            // },
        ];
        return {
            y: 400,
            update: -1,
            spinning: false,
            loading: false,
            pageCurr: 1,
            pageSize: 20,
            total: 0,
            columns,
            dataSource: [],
            createTimeRange: [startTime, endTime],
            userName: -1,
            userList: [
                {
                    id: -1,
                    name: "所有人"
                }
            ],
            state: -1,
            stateList: [
                {
                    label: "全部状态",
                    value: -1,
                },
                {
                    label: "未处理",
                    value: 0,
                },
                {
                    label: "已确认",
                    value: 3,
                },
                {
                    label: "已完结",
                    value: 124,
                }
            ],
        }
    },
    watch: {
        update(n) {
            if (-1 != n && !this._inactive) {
                this.$nextTick(() => {
                    const table = this.$refs.table;
                    const header = document.querySelectorAll(
                        ".doc-center-table .ant-table-header"
                    )[0].clientHeight;
                    const bar = document.querySelectorAll(".header-bar")[0].clientHeight;
                    if (table.fullScreen) {
                        this.y = table.$el.clientHeight - bar - header - 64;
                    } else {
                        const wraper = this.$refs.wraper.clientHeight;
                        const card = document.querySelectorAll(".ant-card-body")[0];
                        const { paddingBottom, paddingTop } = getComputedStyle(card, null);
                        const h =
                            wraper -
                            header -
                            64 -
                            bar -
                            parseInt(paddingBottom) -
                            parseInt(paddingTop);
                        console.log(h, "h",wraper, header, bar );
                        this.y = h;
                    }
                });
            }
        },
        affixed() {
            setTimeout(() => {
                this.update = Math.random();
            }, 200);
        },
    },
    methods: {
        resize() {
            setTimeout(() => {
                this.update = Math.random();
            }, 200);
        },
        activeFN() {
            this.resize();
        },
        async getUserList() {
            try{
                let res = await getUserList();
                let rs = res.data;
                if(rs.code === 1 && rs.data) {
                    this.userList = rs.data2;
                }
                this.userList.unshift({
                    id: -1,
                    name: "所有人"
                });
            }catch (e) {
                this.userList.unshift({
                    id: -1,
                    name: "全部"
                });
                console.log(e);
            }
        },
        getSearchParams() {
            let startTime = moment(this.createTimeRange[0]).format("YYYY-MM-DD")+" 00:00:00";
            let endTime =  moment(this.createTimeRange[1]).format("YYYY-MM-DD")+" 23:59:59";
            let confirmStatus = this.state;
            let senderId = this.userName;
            return {
                confirmStatus,
                startTime,
                endTime,
                senderId
            };
        },
        rowClassFn(record) {
            let classList = [];
            if (record.enabled == -1) {
                classList.push("locked");
            }
            return classList;
        },
        async searchData(isExportFile) {
            // 判断是否导出全部 === 不能删除,防止isExPortFile={}
            isExportFile = isExportFile === true;
 
            if (-1 == this.update) {
                this.update = Math.random();
            }
            let params = this.getSearchParams();
            let pageCurr = isExportFile?1:this.pageCurr;
            let pageSize = isExportFile?this.total:this.pageSize;
            try {
                let res = await bomFeedbackListPage(params, pageCurr, pageSize);
                let rs = res.data;
                let list = [];
                let total = 0;
                if(rs.code === 1) {
                    list = rs.data.list;
                    total = rs.data.total;
                }
                if(isExportFile) {
                    this.exportExcel(list);
                }else {
                    this.dataSource = list;
                    this.total = total;
                }
            }catch (e) {
                this.dataSource = [];
                this.total = 0;
                console.log(e);
            }
 
        },
        onSearch(conditions, searchOptions) {
            this.pageCurr = 1;
            this.conditions = conditions;
            this.searchData();
        },
        onPageChange(page, pageSize) {
            this.pageCurr = page;
            this.pageSize = pageSize;
            this.searchData();
        },
        onSizeChange(current, size) {
            this.pageCurr = 1;
            this.pageSize = size;
            this.searchData();
        },
        onRefresh(conditions) {
            this.conditions = conditions;
            this.searchData();
        },
        onReset(conditions) {
            this.conditions = conditions;
            this.searchData();
        },
        exportExcel(list) {
            ExportFile(this.columns, list, "反馈总表");
        },
        exportCurrPage() {
            this.exportExcel(this.dataSource);
        }
    },
    computed: {
        ...mapGetters("setting", ["affixed"]),
    },
    mounted() {
        this.getUserList();
        this.searchData();
        window.addEventListener("resize", this.resize);
    },
    destroyed() {
        window.removeEventListener("resize", this.resize);
    },
}
</script>
 
<template>
    <div class="main">
        <div class="inner" ref="wraper">
            <a-spin class="" :spinning="spinning" tip="拼命加载中...">
                <a-card>
                    <advance-table
                        ref="table"
                        class="doc-center-table"
                        :data-source="dataSource"
                        :columns="columns"
                        :loading="loading"
                        title=""
                        row-key="id"
                        @search="onSearch"
                        @refresh="onRefresh"
                        @reset="onReset"
                        :format-conditions="true"
                        :scroll="{ x: 400, y }"
                        :pagination="{
              current: pageCurr,
              pageSize: pageSize,
              total: total,
              showSizeChanger: true,
              showLessItems: true,
              showQuickJumper: true,
              pageSizeOptions: ['10', '20', '50', '100'],
              showTotal: (total, range) =>
                `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`,
              onChange: onPageChange,
              onShowSizeChange: onSizeChange,
            }"
                        :rowClassName="rowClassFn">
                        <template slot="title">
                            <a-space class="operator">
                                <span class="title">问题反馈总表</span>
                                <div class="filter-container">
                                    <div class="filter-item">
                                        <span class="filter-label">创建人:</span>
                                        <div class="filter-content">
                                            <a-select style="width: 180px" v-model="userName" @change="searchData">
                                                <a-select-option
                                                    v-for="(item, key) in userList" :key="'key'+key"
                                                    :value="item.id">{{item.name}}</a-select-option>
                                            </a-select>
                                        </div>
                                    </div>
                                    <div class="filter-item">
                                        <span class="filter-label">创建时间:</span>
                                        <div class="filter-content">
                                            <a-range-picker v-model="createTimeRange" @change="searchData"/>
                                        </div>
                                    </div>
                                    <div class="filter-item">
                                        <span class="filter-label">问题反馈状态:</span>
                                        <div class="filter-content">
                                            <a-select style="width: 180px" v-model="state" @change="searchData">
                                                <a-select-option
                                                    v-for="(item, key) in stateList" :key="'key'+key"
                                                    :value="item.value">{{item.label}}</a-select-option>
                                            </a-select>
                                        </div>
                                    </div>
                                    <div class="filter-item">
                                        <a-popover title="" trigger="hover">
                                            <a-space direction="vertical" slot="content">
                                                <a-button type="primary" @click="exportCurrPage()">导出当前</a-button>
                                                <a-button type="primary" @click="searchData(true)">导出全部</a-button>
                                            </a-space>
                                            <a-button>更多操作</a-button>
                                        </a-popover>
                                    </div>
                                </div>
                            </a-space>
                        </template>
                    </advance-table>
                </a-card>
            </a-spin>
        </div>
    </div>
</template>
 
<style scoped lang="less">
.main {
    height: 100%;
    position: relative;
 
    .inner {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
    }
}
.filter-container {
    font-size: 14px;
    font-weight: normal;
    margin-left: 16px;
    .filter-item {
        display: inline-block;
        margin-right: 16px;
        .filter-content {
            display: inline-block;
        }
    }
}
</style>