-
admin
2024-06-01 a846f28bef985e7671f0b469fb73541cbfb08a93
提交 | 用户 | 时间
5966d6 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="recordId">
6             <el-input
7               v-model="queryParams.recordId"
8               placeholder="请输入检验记录编号,由各设备按自定规则生成,唯一编码"
9               clearable
10               @keyup.enter.native="handleQuery"
11             />
12           </el-form-item>
13           <el-form-item label="站点编号" prop="stationCode">
14             <el-input
15               v-model="queryParams.stationCode"
16               placeholder="请输入检测站点编号"
17               clearable
18               @keyup.enter.native="handleQuery"
19             />
20           </el-form-item>
21           <el-form-item label="pack码" prop="productNum">
22             <el-input
23               v-model="queryParams.productNum"
24               placeholder="请输入产品序列号-pack码"
25               clearable
26               @keyup.enter.native="handleQuery"
27             />
28           </el-form-item>
29           <el-form-item label="整体结果 " prop="totalResult">
30             <el-input
31               v-model="queryParams.totalResult"
32               placeholder="请输入整体结果 "
33               clearable
34               @keyup.enter.native="handleQuery"
35             />
36           </el-form-item>
37           <el-form-item label="工单号" prop="workOrderNo">
38             <el-input
39               v-model="queryParams.workOrderNo"
40               placeholder="请输入工单号"
41               clearable
42               @keyup.enter.native="handleQuery"
43             />
44           </el-form-item>
45 <!--          <el-form-item label="供应商类型" prop="supplierType">-->
46 <!--            <el-select v-model="queryParams.supplierType" placeholder="请选择供应商类型" clearable>-->
47 <!--              <el-option-->
48 <!--                v-for="dict in dict.type.${dictType}"-->
49 <!--                :key="dict.value"-->
50 <!--                :label="dict.label"-->
51 <!--                :value="dict.value"-->
52 <!--              />-->
53 <!--            </el-select>-->
54 <!--          </el-form-item>-->
55           <el-form-item label="状态编码" prop="resultCode">
56             <el-input
57               v-model="queryParams.resultCode"
58               placeholder="请输入状态编码"
59               clearable
60               @keyup.enter.native="handleQuery"
61             />
62           </el-form-item>
63           <el-form-item style="float: right">
64             <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
65             <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
66           </el-form-item>
67         </el-form>
68     </el-card>
69
70     <el-card style="margin-top: 10px" class="box-card">
71         <el-row :gutter="10" class="mb8">
72           <el-col :span="1.5">
73             <el-button
74               type="primary"
75               plain
76               icon="el-icon-plus"
77               size="mini"
78               @click="handleAdd"
79               v-hasPermi="['da:testDeviceInterface:add']"
80             >新增</el-button>
81           </el-col>
82           <el-col :span="1.5">
83             <el-button
84               type="success"
85               plain
86               icon="el-icon-edit"
87               size="mini"
88               :disabled="single"
89               @click="handleUpdate"
90               v-hasPermi="['da:testDeviceInterface:edit']"
91             >修改</el-button>
92           </el-col>
93           <el-col :span="1.5">
94             <el-button
95               type="danger"
96               plain
97               icon="el-icon-delete"
98               size="mini"
99               :disabled="multiple"
100               @click="handleDelete"
101               v-hasPermi="['da:testDeviceInterface:remove']"
102             >删除</el-button>
103           </el-col>
104           <el-col :span="1.5">
105             <el-button
106               type="warning"
107               plain
108               icon="el-icon-download"
109               size="mini"
110               @click="handleExport"
111               v-hasPermi="['da:testDeviceInterface:export']"
112             >导出</el-button>
113           </el-col>
114           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
115         </el-row>
116
117         <el-table border v-loading="loading" :data="testDeviceInterfaceList" @selection-change="handleSelectionChange">
118           <el-table-column type="selection" width="55" align="center" />
119           <el-table-column label="id" align="center" prop="id" />
120           <el-table-column label="检验记录编号" align="center" prop="recordId">
121           </el-table-column>
122           <el-table-column label="站点编号" align="center" prop="stationCode">
123           </el-table-column>
124           <el-table-column label="pack码" align="center" prop="productNum">
125           </el-table-column>
126           <el-table-column label="整体结果 " align="center" prop="totalResult">
127           </el-table-column>
128           <el-table-column label="工单号" align="center" prop="workOrderNo">
129           </el-table-column>
130           <el-table-column label="供应商类型" align="center" prop="supplierType">
131           </el-table-column>
132           <el-table-column label="入参" align="center" prop="checkList">
133           </el-table-column>
134           <el-table-column label="状态编码" align="center" prop="resultCode">
135           </el-table-column>
136           <el-table-column label="返回信息" align="center" prop="resultMessage">
137           </el-table-column>
138           <el-table-column label="出参" align="center" prop="resultData">
139           </el-table-column>
140           <el-table-column label="创建用户" align="center" prop="createUser">
141           </el-table-column>
142           <el-table-column label="创建时间" align="center" prop="createTime">
143           </el-table-column>
144           <el-table-column label="更改用户" align="center" prop="updateUser">
145           </el-table-column>
146           <el-table-column label="更改时间" align="center" prop="updateTime">
147           </el-table-column>
148           <el-table-column fixed="right" width="200" label="操作" align="center" class-name="small-padding fixed-width">
149             <template slot-scope="scope">
150               <el-button
151                 size="mini"
152                 type="success"
153                 plain
154                 style="width: 72px"
155                 icon="el-icon-edit"
156                 @click="handleUpdate(scope.row)"
157                 v-hasPermi="['da:testDeviceInterface:edit']"
158               >修改</el-button>
159               <el-button
160                 size="mini"
161                 type="danger"
162                 plain
163                 style="width: 72px"
164                 icon="el-icon-delete"
165                 @click="handleDelete(scope.row)"
166                 v-hasPermi="['da:testDeviceInterface:remove']"
167               >删除</el-button>
168             </template>
169           </el-table-column>
170         </el-table>
171     </el-card>
172
173     <pagination
174       v-show="total>0"
175       :total="total"
176       :page.sync="queryParams.pageNum"
177       :limit.sync="queryParams.pageSize"
178       @pagination="getList"
179     />
180
181     <!-- 添加或修改测试设备接口数据对话框 -->
182     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
183       <span slot="title">
184         <i class="el-icon-s-order"></i>
185         {{titleName}}
186       </span>
187       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
188         <el-form-item label="检验记录编号,由各设备按自定规则生成,唯一编码" prop="recordId">
189           <el-input v-model="form.recordId" placeholder="请输入检验记录编号,由各设备按自定规则生成,唯一编码" />
190         </el-form-item>
191         <el-form-item label="检测站点编号" prop="stationCode">
192           <el-input v-model="form.stationCode" placeholder="请输入检测站点编号" />
193         </el-form-item>
194         <el-form-item label="产品序列号-pack码" prop="productNum">
195           <el-input v-model="form.productNum" placeholder="请输入产品序列号-pack码" />
196         </el-form-item>
197         <el-form-item label="整体结果 " prop="totalResult">
198           <el-input v-model="form.totalResult" placeholder="请输入整体结果 " />
199         </el-form-item>
200         <el-form-item label="工单号" prop="workOrderNo">
201           <el-input v-model="form.workOrderNo" placeholder="请输入工单号" />
202         </el-form-item>
203 <!--        <el-form-item label="供应商类型" prop="supplierType">-->
204 <!--          <el-select v-model="form.supplierType" placeholder="请选择供应商类型">-->
205 <!--            <el-option-->
206 <!--              v-for="dict in dict.type.${dictType}"-->
207 <!--              :key="dict.value"-->
208 <!--              :label="dict.label"-->
209 <!--              :value="dict.value"-->
210 <!--            ></el-option>-->
211 <!--          </el-select>-->
212 <!--        </el-form-item>-->
213         <el-form-item label="入参-参数列表" prop="checkList">
214           <el-input v-model="form.checkList" placeholder="请输入入参-参数列表" />
215         </el-form-item>
216         <el-form-item label="状态编码" prop="resultCode">
217           <el-input v-model="form.resultCode" placeholder="请输入状态编码" />
218         </el-form-item>
219         <el-form-item label="接口的返回信息,当fail时会有报错信息" prop="resultMessage">
220           <el-input v-model="form.resultMessage" placeholder="请输入接口的返回信息,当fail时会有报错信息" />
221         </el-form-item>
222         <el-form-item label="出参-参数列表" prop="resultData">
223           <el-input v-model="form.resultData" placeholder="请输入出参-参数列表" />
224         </el-form-item>
225         <el-form-item label="备注" prop="remarks">
226           <el-input v-model="form.remarks" placeholder="请输入备注" />
227         </el-form-item>
228       </el-form>
229       <div slot="footer" class="dialog-footer">
230         <el-button type="primary" @click="submitForm">确 定</el-button>
231         <el-button @click="cancel">取 消</el-button>
232       </div>
233     </el-dialog>
234   </div>
235 </template>
236
237 <script>
238 import { listTestDeviceInterface, getTestDeviceInterface, delTestDeviceInterface, addTestDeviceInterface, updateTestDeviceInterface } from "@/api/main/da/testDeviceInterface/testDeviceInterface";
239
240 export default {
241   name: "TestDeviceInterface",
242   data() {
243     return {
244       // 遮罩层
245       loading: true,
246       titleName: "",
247       // 选中数组
248       ids: [],
249       // 非单个禁用
250       single: true,
251       // 非多个禁用
252       multiple: true,
253       // 显示搜索条件
254       showSearch: true,
255       // 总条数
256       total: 0,
257       // 测试设备接口数据表格数据
258       testDeviceInterfaceList: [],
259       // 弹出层标题
260       title: "",
261       // 是否显示弹出层
262       open: false,
263       // 查询参数
264       queryParams: {
265         pageNum: 1,
266         pageSize: 10,
267         recordId: null,
268         stationCode: null,
269         productNum: null,
270         totalResult: null,
271         workOrderNo: null,
272         supplierType: null,
273         resultCode: null,
274       },
275       // 表单参数
276       form: {},
277       // 表单校验
278       rules: {
279         id: [
280           { required: true, message: "id不能为空", trigger: "blur" }
281         ],
282       }
283     };
284   },
285   created() {
286     this.getList();
287   },
288   methods: {
289     /** 查询测试设备接口数据列表 */
290     getList() {
291       this.loading = true;
292       listTestDeviceInterface(this.queryParams).then(response => {
293         this.testDeviceInterfaceList = response.rows;
294         this.total = response.total;
295         this.loading = false;
296       });
297     },
298     // 取消按钮
299     cancel() {
300       this.open = false;
301       this.reset();
302     },
303     // 表单重置
304     reset() {
305       this.form = {
306         id: null,
307         recordId: null,
308         stationCode: null,
309         productNum: null,
310         totalResult: null,
311         workOrderNo: null,
312         supplierType: null,
313         checkList: null,
314         resultCode: null,
315         resultMessage: null,
316         resultData: null,
317         remarks: null,
318         createUser: null,
319         createTime: null,
320         updateUser: null,
321         updateTime: null,
322         spareField1: null,
323         spareField2: null,
324         spareField3: null,
325         spareField4: null
326       };
327       this.resetForm("form");
328     },
329     /** 搜索按钮操作 */
330     handleQuery() {
331       this.queryParams.pageNum = 1;
332       this.getList();
333     },
334     /** 重置按钮操作 */
335     resetQuery() {
336       this.resetForm("queryForm");
337       this.handleQuery();
338     },
339     // 多选框选中数据
340     handleSelectionChange(selection) {
341       this.ids = selection.map(item => item.id)
342       this.single = selection.length!==1
343       this.multiple = !selection.length
344     },
345     /** 新增按钮操作 */
346     handleAdd() {
347       this.reset();
348       this.open = true;
349       this.titleName = "添加测试设备接口数据";
350     },
351     /** 修改按钮操作 */
352     handleUpdate(row) {
353       this.reset();
354       const id = row.id || this.ids
355       getTestDeviceInterface(id).then(response => {
356         this.form = response.data;
357         this.open = true;
358         this.titleName = "修改测试设备接口数据";
359       });
360     },
361     /** 提交按钮 */
362     submitForm() {
363       this.$refs["form"].validate(valid => {
364         if (valid) {
365           if (this.form.id != null) {
366             updateTestDeviceInterface(this.form).then(response => {
367               this.$modal.msgSuccess("修改成功");
368               this.open = false;
369               this.getList();
370             });
371           } else {
372             addTestDeviceInterface(this.form).then(response => {
373               this.$modal.msgSuccess("新增成功");
374               this.open = false;
375               this.getList();
376             });
377           }
378         }
379       });
380     },
381     /** 删除按钮操作 */
382     handleDelete(row) {
383       const ids = row.id || this.ids;
384       this.$modal.confirm('是否确认删除测试设备接口数据编号为"' + ids + '"的数据项?').then(function() {
385         return delTestDeviceInterface(ids);
386       }).then(() => {
387         this.getList();
388         this.$modal.msgSuccess("删除成功");
389       }).catch(() => {});
390     },
391     /** 导出按钮操作 */
392     handleExport() {
393       this.download('da/testDeviceInterface/export', {
394         ...this.queryParams
395       }, `testDeviceInterface_${new Date().getTime()}.xlsx`)
396     }
397   }
398 };
399 </script>