XiaoRuby
2023-09-24 abba64c23543cd806ed8864a9a976408618a5f45
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
<style scoped>
.raw_ins {
    height: 100%;
}
 
.raw_ins .title .el-button {
    height: 32px;
    border: 1px solid rgba(190, 190, 190, 0.44);
    box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41);
    padding: 0 12px;
}
 
.raw_ins .title {
    margin-bottom: 10px;
    padding: 0 20px;
}
 
.choose {
    padding: 21px 24px;
    display: flex;
    align-items: center;
    background-color: #fff;
    border-bottom: 3px solid rgb(245, 247, 251);
}
 
.choose * {
    font-size: 14px;
}
 
.choose .el-button {
    height: 32px;
    border: 1px solid rgba(190, 190, 190, 0.44);
    box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41);
    padding: 0 12px;
}
 
.choose span {
    /* span内容强制不换行 */
    white-space: nowrap;
}
 
.thing {
    width: calc(100% - 44px);
    height: calc(100% - 42px - 82px - 66px);
    background-color: #fff;
    overflow: auto;
    padding: 33px 22px;
}
 
.table_do {
    color: #004ea0;
    cursor: pointer;
}
</style>
<style>
.raw_ins .thing * {
    font-size: 14px;
}
 
.raw_ins .has-gutter .el-table__cell {
    background-color: #f0f1f5 !important;
    color: #333;
}
 
.raw_ins .has-gutter .el-table__cell .cell {
    font-size: 16px;
    font-weight: 500;
}
 
.raw_ins .cell {
    color: #333;
    padding-left: 17px !important;
}
 
.raw_ins .el-table__body-wrapper {
    height: 100%;
}
 
.raw_ins .el-table__body {
    height: 100%;
}
</style>
 
<template>
    <div class="raw_ins">
        <div class="title">
            <el-row>
                <el-col :span="12" style="line-height: 32px;">原材料检验</el-col>
                <el-col :span="12" style="text-align: right;">
                    <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;" @click="goDetail(null)">新增</el-button>
                    <el-button icon="el-icon-download">导出</el-button>
                </el-col>
            </el-row>
        </div>
        <div class="choose">
            <span>来料日期:</span>
            <el-date-picker v-model="search.formTime" size="small" placeholder="请输入" style="width: 13vw;margin-right: 5px;" clearable value-format="yyyy-MM-dd"></el-date-picker>
            <span>原材料编码:</span>
            <el-input v-model="search.code" placeholder="请输入" size="small" style="width: 13vw;margin-right: 5px;" clearable></el-input>
            <span>检测状态:</span>
            <el-select v-model="search.insState" size="small" placeholder="请选择" style="width: 13vw;margin-right: 5px;">
                <el-option label="全部" :value="2"></el-option>
                <el-option label="未检测" :value="0"></el-option>
                <el-option label="已检测" :value="1"></el-option>
            </el-select>
            <span>原材料名称:</span>
            <el-input v-model="search.name" size="small" placeholder="请输入" style="width: 13vw;margin-right: 5px;" clearable></el-input>
            <el-button size="mini" @click="clean()"><span>重 置</span></el-button>
            <el-button size="mini" type="primary" style="background: #004EA2;" @click="selectRawInspectsList()"><span>查 询</span></el-button>
        </div>
        <div class="thing">
            <el-table :data="tableData" border style="width: 100%;" height="calc(100% - 50px)" @selection-change="handleSelectionChange" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" row-key="id">
                <el-table-column type="index" label="序号" width="60">
                </el-table-column>
                <el-table-column prop="formTime" label="来料日期" min-width="110"> </el-table-column>
                <el-table-column prop="code" label="原材料编码" min-width="110"> </el-table-column>
                <el-table-column prop="name" label="原材料名称" min-width="110"> </el-table-column>
                <el-table-column prop="specifications" label="规格型号" min-width="100">
                </el-table-column>
                <el-table-column prop="unit" label="单位" min-width="60"> </el-table-column>
                <el-table-column prop="number" label="数量" min-width="60"> </el-table-column>
                <el-table-column prop="createTime" label="报检日期" min-width="110"> </el-table-column>
                <el-table-column prop="user_name" label="报检人" min-width="80"> </el-table-column>
                <el-table-column prop="createTime" label="检验日期" min-width="110"> </el-table-column>
                <el-table-column prop="createTime" label="检测状态" min-width="100">
                    <template slot-scope="scope">
                        <span style="color: #34BD66;" v-if="scope.row.ins_state == 1">已检测</span>
                        <span style="color: #E84738;" v-else-if="scope.row.ins_state == 0">未检测</span>
                    </template>
                </el-table-column>
                <el-table-column prop="judge_state" label="合格状态" min-width="100">
                    <template slot-scope="scope">
                        <span style="color: #34BD66;" v-if="scope.row.judge_state == 1">合格</span>
                        <span style="color: #E84738;" v-else-if="scope.row.judge_state == 0">不合格</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作" min-width="100" fixed="right">
                    <template slot-scope="scope">
                        <span class="table_do" @click="changeShowDetail(scope.row)">查看</span>
                        <span class="table_do">打印</span>
                    </template>
                </el-table-column>
            </el-table>
            <el-col style="height: 50px;display: flex;align-items: center;justify-content: right;">
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1" :page-sizes="[10, 15, 20, 30, 50]" :page-size="search.co" layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </el-col>
        </div>
    </div>
</template>
 
<script>
export default {
    data() {
        return {
            search: {
                formTime: "", // 来料时间
                code: "", // 原材料编码
                insState: "", // 检测状态
                name: "", //
                countSize: 10, // 条数/页
                pageSize: 1, // 页数
            },
            total: 0,
            tableData: [],
            selects: [],
        };
    },
    props: ["goDetail"],
    mounted() {
        this.selectRawInspectsList();
    },
    methods: {
        handleSelectionChange(val) {
            this.selects = val;
        },
        handleSizeChange(val) {
            this.search.countSize = val;
            this.selectRawInspectsList();
        },
        handleCurrentChange(val) {
            this.search.pageSize = val;
            this.selectRawInspectsList();
        },
        selectRawInspectsList() {
            this.$axios
                .get(this.$api.url.selectRawInspectsList, {
                    params: this.search,
                })
                .then((res) => {
                    this.tableData = res.data.row;
                    this.total = res.data.total;
                });
        },
        clean() {
            this.search = {
                formTime: "", // 来料时间
                code: "", // 原材料编码
                insState: "", // 检测状态
                name: "", //
                countSize: 10, // 条数/页
                pageSize: 1, // 页数
            };
            this.selectRawInspectsList();
        },
        changeShowDetail({ id }) {
            this.goDetail(id);
            // console.log(id)
            // const res = await this.$axios.post(this.$api.url.selectRawInspectsListById,{params:{id}})
            // console.log(res)
        },
    },
};
</script>