董国庆
2025-06-25 d8d68a0aee93073b5ec3195368ca0ed1076f66a2
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
<template>
    <div class="list">
        <TableCustom :queryForm="queryForm" :tableData="tableData" :total="total" @currentChange="handleCurrentChange"
            @sizeChange="handleSizeChange">
            <template #search>
                <el-form :model="form" label-width="140px" inline>
                    <el-form-item label="项目组名称:">
                        <el-input v-model="form.teamName" placeholder="请输入"></el-input>
                    </el-form-item>
                    <el-form-item label="创建日期:">
                        <el-date-picker v-model="value1" type="daterange" range-separator="至" start-placeholder="开始日期"
                            end-placeholder="结束日期">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="状态:">
                        <el-select v-model="form.status" placeholder="请选择">
                            <el-option label="全部" value="" />
                            <el-option label="草稿箱" value="-1" />
                            <el-option label="已提交" value="1" />
                        </el-select>
                    </el-form-item>
                    <el-form-item class="search-btn-box">
                        <el-button @click="handleReset">重置</el-button>
                        <el-button type="primary" @click="handleSearch">查询</el-button>
                    </el-form-item>
                </el-form>
            </template>
            <template #table>
                <el-table-column prop="teamName" label="项目组名称" />
                <el-table-column prop="teamIntegral" label="项目组总积分" />
                <el-table-column prop="engineerIntegral" label="工艺工程师积分" />
                <el-table-column prop="chemistIntegral" label="化验师积分" />
                <el-table-column prop="testerIntegral" label="实验员积分" />
                <el-table-column prop="startTime" label="评定开始时间" />
                <el-table-column prop="endTime" label="评定结束时间" />
                <el-table-column prop="status" label="状态">
                    <template #default="{ row }">
                        <span>{{ formatStatus(row.status) }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作">
                    <template #default="{ row }">
                        <el-button @click="goDetail(row)" type="text">详情</el-button>
                    </template>
                </el-table-column>
            </template>
        </TableCustom>
    </div>
</template>
 
<script>
import {pageList} from './service.js'
export default {
    name: 'ProjectTeamIntegral',
    data() {
        return {
            form: {
                teamName: '', // 项目组名称
                status: '', // 状态
                date: [], // 日期范围
            },
            value1: [], // 用于日期选择器
            tableData: [],
            queryForm: {
                pageSize: 10,
                pageNum: 1
            },
            total: 0
        }
    },
    methods: {
        goDetail(row) {
            this.$router.push({
                path: '/deliveryAssessment/projectTeamIntegral-detail',
                query: { id: row.id }
            })
        },
        handleCurrentChange(page) {
            this.queryForm.pageNum = page
            this.getList()
        },
        handleSizeChange(size) {
            this.queryForm.pageSize = size
            this.getList()
        },
        // 查询按钮
        async handleSearch() {
            this.queryForm.pageNum = 1
            await this.getList()
        },
        // 重置按钮
        handleReset() {
            this.form = {
                teamName: '',
                status: '',
                date: [],
            }
            this.value1 = []
            this.queryForm.pageNum = 1
            this.getList()
        },
        async getList() {
            // 参数组装
            const params = {
                ...this.queryForm,
                teamName: this.form.teamName,
                status: this.form.status === '' ? undefined : Number(this.form.status),
            }
            // 日期处理
            if (this.value1 && this.value1.length === 2) {
                params.startTime = this.value1[0]
                params.endTime = this.value1[1]
            } else {
                params.startTime = ''
                params.endTime = ''
            }
            try {
                const res = await pageList(params)
                this.tableData = res.data.records || []
                this.total = res.data.total || 0
            } catch (e) {
                this.tableData = []
                this.total = 0
            }
        },
        formatStatus(status) {
            if (status === -1) return '草稿箱'
            if (status === 1) return '已提交'
            return '全部'
        }
    },
    mounted() {
        this.getList()
    }
}
</script>
 
<style scoped lang="less">
.list {
    height: 100%;
}
</style>