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