cl
2024-08-07 7402d66b621b9b76c9932590b5c47d330486cf04
提交 | 用户 | 时间
bf64f6 1 <template>
A 2   <div class="app-container">
3     <el-card class="box-card">
4         <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
5           <el-form-item label="厂商代码" prop="mfCode">
6             <el-input
7               v-model="queryParams.mfCode"
8               placeholder="请输入厂商代码"
9               clearable
10               @keyup.enter.native="handleQuery"
11             />
12           </el-form-item>
13           <el-form-item label="产品类型代码" prop="proTypeCode">
14             <el-input
15               v-model="queryParams.proTypeCode"
16               placeholder="请输入产品类型代码"
17               clearable
18               @keyup.enter.native="handleQuery"
19             />
20           </el-form-item>
21           <el-form-item style="float: right">
22             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
23             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
24           </el-form-item>
25         </el-form>
26     </el-card>
27
28     <el-card style="margin-top: 10px" class="box-card">
29         <el-row :gutter="10" class="mb8">
30           <el-col :span="1.5">
31             <el-button
32               type="primary"
33               plain
34               icon="el-icon-plus"
35               size="mini"
36               @click="handleAdd"
37               v-hasPermi="['da:psConf:add']"
38             >新增</el-button>
39           </el-col>
40           <el-col :span="1.5">
41             <el-button
42               type="success"
43               plain
44               icon="el-icon-edit"
45               size="mini"
46               :disabled="single"
47               @click="handleUpdate"
48               v-hasPermi="['da:psConf:edit']"
49             >修改</el-button>
50           </el-col>
51           <el-col :span="1.5">
52             <el-button
53               type="danger"
54               plain
55               icon="el-icon-delete"
56               size="mini"
57               :disabled="multiple"
58               @click="handleDelete"
59               v-hasPermi="['da:psConf:remove']"
60             >删除</el-button>
61           </el-col>
62           <el-col :span="1.5">
63             <el-button
64               type="warning"
65               plain
66               icon="el-icon-download"
67               size="mini"
68               @click="handleExport"
69               v-hasPermi="['da:psConf:export']"
70             >导出</el-button>
71           </el-col>
72           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
73         </el-row>
74
75         <el-table border v-loading="loading" :data="psConfList" @selection-change="handleSelectionChange">
76           <el-table-column type="selection" width="55" align="center" />
7402d6 77           <el-table-column label="供应商识别码" align="center" prop="spareField1">
C 78           </el-table-column>
79           <el-table-column label="供应商名称" align="center" prop="remarks">
80           </el-table-column>
bf64f6 81           <el-table-column label="厂商代码" align="center" prop="mfCode">
A 82           </el-table-column>
83           <el-table-column label="产品类型代码" align="center" prop="proTypeCode">
84           </el-table-column>
85           <el-table-column label="电池类型代码" align="center" prop="batteryTypeCode">
86           </el-table-column>
87           <el-table-column label="规格代码" align="center" prop="specificationsCode">
88           </el-table-column>
89           <el-table-column label="追溯信息代码" align="center" prop="traceInfoCode">
90           </el-table-column>
91           <el-table-column label="生产日期代码" align="center" prop="proDateCode">
92           </el-table-column>
93           <el-table-column label="序列号" align="center" prop="sfcCode">
94           </el-table-column>
7402d6 95           <el-table-column label="状态 (启用1,禁用0)" align="center" prop="state">
bf64f6 96           </el-table-column>
7402d6 97
C 98 <!--          <el-table-column label="预留字段2" align="center" prop="spareField2">
bf64f6 99           </el-table-column>
A 100           <el-table-column label="创建用户" align="center" prop="createUser">
101           </el-table-column>
102           <el-table-column label="更改用户" align="center" prop="updateUser">
7402d6 103           </el-table-column>-->
bf64f6 104           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
A 105             <template slot-scope="scope">
106               <el-button
107                 size="mini"
108                 type="success"
109                 plain
110                 style="width: 72px"
111                 icon="el-icon-edit"
112                 @click="handleUpdate(scope.row)"
113                 v-hasPermi="['da:psConf:edit']"
114               >修改</el-button>
115               <el-button
116                 size="mini"
117                 type="danger"
118                 plain
119                 style="width: 72px"
120                 icon="el-icon-delete"
121                 @click="handleDelete(scope.row)"
122                 v-hasPermi="['da:psConf:remove']"
123               >删除</el-button>
124             </template>
125           </el-table-column>
126         </el-table>
127     </el-card>
128
129     <pagination
130       v-show="total>0"
131       :total="total"
132       :page.sync="queryParams.pageNum"
133       :limit.sync="queryParams.pageSize"
134       @pagination="getList"
135     />
136
137     <!-- 添加或修改1P1S配置对话框 -->
7402d6 138     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="600px" append-to-body>
bf64f6 139       <span slot="title">
A 140         <i class="el-icon-s-order"></i>
141         {{titleName}}
142       </span>
7402d6 143       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
C 144         <el-form-item label="供应商识别码" prop="spareField1">
145           <el-input v-model="form.spareField1" placeholder="请输入供应商识别码" />
146         </el-form-item>
147         <el-form-item label="供应商名称" prop="remarks">
148           <el-input v-model="form.remarks" placeholder="请输入供应商名称" />
149         </el-form-item>
bf64f6 150         <el-form-item label="厂商代码" prop="mfCode">
A 151           <el-input v-model="form.mfCode" placeholder="请输入厂商代码" />
152         </el-form-item>
153         <el-form-item label="产品类型代码" prop="proTypeCode">
154           <el-input v-model="form.proTypeCode" placeholder="请输入产品类型代码" />
155         </el-form-item>
156         <el-form-item label="电池类型代码" prop="batteryTypeCode">
157           <el-input v-model="form.batteryTypeCode" placeholder="请输入电池类型代码" />
158         </el-form-item>
159         <el-form-item label="规格代码" prop="specificationsCode">
160           <el-input v-model="form.specificationsCode" placeholder="请输入规格代码" />
161         </el-form-item>
162         <el-form-item label="追溯信息代码" prop="traceInfoCode">
163           <el-input v-model="form.traceInfoCode" placeholder="请输入追溯信息代码" />
164         </el-form-item>
7402d6 165 <!--        <el-form-item label="生产日期代码" prop="proDateCode">
C 166           <el-input v-model="form.proDateCode" placeholder="请输入生产日期代码(不填)" />
167         </el-form-item>-->
bf64f6 168         <el-form-item label="序列号" prop="sfcCode">
7402d6 169           <el-input v-model="form.sfcCode" placeholder="请输入序列号"/>
bf64f6 170         </el-form-item>
7402d6 171         <el-form-item label="状态" prop="state">
C 172           <el-input v-model="form.state" placeholder="请输入状态 (启用1,禁用0)" />
bf64f6 173         </el-form-item>
7402d6 174
C 175 <!--        <el-form-item label="预留字段2" prop="spareField2">
bf64f6 176           <el-input v-model="form.spareField2" placeholder="请输入预留字段2" />
A 177         </el-form-item>
178         <el-form-item label="创建用户" prop="createUser">
179           <el-input v-model="form.createUser" placeholder="请输入创建用户" />
180         </el-form-item>
181         <el-form-item label="更改用户" prop="updateUser">
182           <el-input v-model="form.updateUser" placeholder="请输入更改用户" />
7402d6 183         </el-form-item>-->
bf64f6 184       </el-form>
A 185       <div slot="footer" class="dialog-footer">
186         <el-button type="primary" @click="submitForm">确 定</el-button>
187         <el-button @click="cancel">取 消</el-button>
188       </div>
189     </el-dialog>
190   </div>
191 </template>
192
193 <script>
194 import { listPsConf, getPsConf, delPsConf, addPsConf, updatePsConf } from "@/api/main/da/psConf/psConf";
195
196 export default {
197   name: "PsConf",
198   data() {
199     return {
200       // 遮罩层
201       loading: true,
202       titleName: "",
203       // 选中数组
204       ids: [],
205       // 非单个禁用
206       single: true,
207       // 非多个禁用
208       multiple: true,
209       // 显示搜索条件
210       showSearch: true,
211       // 总条数
212       total: 0,
213       // 1P1S配置表格数据
214       psConfList: [],
215       // 弹出层标题
216       title: "",
217       // 是否显示弹出层
218       open: false,
219       // 查询参数
220       queryParams: {
221         pageNum: 1,
222         pageSize: 10,
223         mfCode: null,
224         proTypeCode: null,
225         batteryTypeCode: null,
226         specificationsCode: null,
227         traceInfoCode: null,
228         proDateCode: null,
229         sfcCode: null,
230         state: null,
231         remarks: null,
232         spareField1: null,
233         spareField2: null,
234         createUser: null,
235         updateUser: null,
236       },
237       // 表单参数
238       form: {},
239       // 表单校验
240       rules: {
241         id: [
242           { required: true, message: "主键id不能为空", trigger: "blur" }
243         ],
244       }
245     };
246   },
247   created() {
248     this.getList();
249   },
250   methods: {
251     /** 查询1P1S配置列表 */
252     getList() {
253       this.loading = true;
254       listPsConf(this.queryParams).then(response => {
255         this.psConfList = response.rows;
256         this.total = response.total;
257         this.loading = false;
258       });
259     },
260     // 取消按钮
261     cancel() {
262       this.open = false;
263       this.reset();
264     },
265     // 表单重置
266     reset() {
267       this.form = {
268         id: null,
269         mfCode: null,
270         proTypeCode: null,
271         batteryTypeCode: null,
272         specificationsCode: null,
273         traceInfoCode: null,
274         proDateCode: null,
275         sfcCode: null,
276         state: null,
277         remarks: null,
278         spareField1: null,
279         spareField2: null,
280         createUser: null,
281         createTime: null,
282         updateUser: null,
283         updateTime: null
284       };
285       this.resetForm("form");
286     },
287     /** 搜索按钮操作 */
288     handleQuery() {
289       this.queryParams.pageNum = 1;
290       this.getList();
291     },
292     /** 重置按钮操作 */
293     resetQuery() {
294       this.resetForm("queryForm");
295       this.handleQuery();
296     },
297     // 多选框选中数据
298     handleSelectionChange(selection) {
299       this.ids = selection.map(item => item.id)
300       this.single = selection.length!==1
301       this.multiple = !selection.length
302     },
303     /** 新增按钮操作 */
304     handleAdd() {
305       this.reset();
306       this.open = true;
307       this.titleName = "添加1P1S配置";
308     },
309     /** 修改按钮操作 */
310     handleUpdate(row) {
311       this.reset();
312       const id = row.id || this.ids
313       getPsConf(id).then(response => {
314         this.form = response.data;
315         this.open = true;
316         this.titleName = "修改1P1S配置";
317       });
318     },
319     /** 提交按钮 */
320     submitForm() {
321       this.$refs["form"].validate(valid => {
322         if (valid) {
323           if (this.form.id != null) {
324             updatePsConf(this.form).then(response => {
325               this.$modal.msgSuccess("修改成功");
326               this.open = false;
327               this.getList();
328             });
329           } else {
330             addPsConf(this.form).then(response => {
331               this.$modal.msgSuccess("新增成功");
332               this.open = false;
333               this.getList();
334             });
335           }
336         }
337       });
338     },
339     /** 删除按钮操作 */
340     handleDelete(row) {
341       const ids = row.id || this.ids;
342       this.$modal.confirm('是否确认删除1P1S配置编号为"' + ids + '"的数据项?').then(function() {
343         return delPsConf(ids);
344       }).then(() => {
345         this.getList();
346         this.$modal.msgSuccess("删除成功");
347       }).catch(() => {});
348     },
349     /** 导出按钮操作 */
350     handleExport() {
351       this.download('da/psConf/export', {
352         ...this.queryParams
353       }, `psConf_${new Date().getTime()}.xlsx`)
354     }
355   }
356 };
357 </script>