春风项目四线(合箱线、总装线)
wujian
2024-01-31 c74dcb8dca7b9e3eded0d20299f19a26a6b70974
提交 | 用户 | 时间
fd2207 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="repairIdentification">
6         <el-input
7           v-model="queryParams.repairIdentification"
8           placeholder="请输入返修标识"
9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
13       <el-form-item label="箱体编码" prop="boxCode">
14         <el-input
15           v-model="queryParams.boxCode"
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     <el-card style="margin-top: 10px" class="box-card">
28     <el-row :gutter="10" class="mb8">
29 <!--      <el-col :span="1.5">-->
30 <!--        <el-button-->
31 <!--          type="primary"-->
32 <!--          plain-->
33 <!--          icon="el-icon-plus"-->
34 <!--          size="mini"-->
35 <!--          @click="handleAdd"-->
36 <!--          v-hasPermi="['rm:repairRecord:add']"-->
37 <!--        >新增</el-button>-->
38 <!--      </el-col>-->
39 <!--      <el-col :span="1.5">-->
40 <!--        <el-button-->
41 <!--          type="success"-->
42 <!--          plain-->
43 <!--          icon="el-icon-edit"-->
44 <!--          size="mini"-->
45 <!--          :disabled="single"-->
46 <!--          @click="handleUpdate"-->
47 <!--          v-hasPermi="['rm:repairRecord:edit']"-->
48 <!--        >修改</el-button>-->
49 <!--      </el-col>-->
50       <el-col :span="1.5">
51         <el-button
52           type="danger"
53           plain
54           icon="el-icon-delete"
55           size="mini"
56           :disabled="multiple"
57           @click="handleDelete"
58           v-hasPermi="['rm:repairRecord:remove']"
59         >删除</el-button>
60       </el-col>
61       <el-col :span="1.5">
62         <el-button
63           type="warning"
64           plain
65           icon="el-icon-download"
66           size="mini"
67           @click="handleExport"
68           v-hasPermi="['rm:repairRecord:export']"
69         >导出</el-button>
70       </el-col>
71       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
72     </el-row>
73
74     <el-table v-loading="loading" border :data="repairRecordList" @selection-change="handleSelectionChange" v-if="repairRecordList.length > 0">
75       <el-table-column type="selection" width="55" align="center" />
76       <el-table-column label="返修标识" align="center" prop="repairIdentification" />
77       <el-table-column label="箱体编码" align="center" prop="boxCode" />
78       <el-table-column label="工序编码" align="center" prop="processesCode" />
79       <el-table-column label="原结果" align="center" prop="originalResult" />
80       <el-table-column label="返修结果" align="center" prop="repairResults" />
81       <el-table-column label="创建用户" align="center" prop="createUser" />
82       <el-table-column label="创建时间" align="center" prop="createTime" />
83       <el-table-column label="返修时间" align="center" prop="repairTime" />
84       <el-table-column label="状态" align="center" prop="status" width="80">
85         <template slot-scope="scope">
86           <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
87         </template>
88       </el-table-column>
89 <!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
90 <!--        <template slot-scope="scope">-->
91 <!--          <el-button-->
92 <!--            size="mini"-->
93 <!--            type="text"-->
94 <!--            icon="el-icon-edit"-->
95 <!--            @click="handleUpdate(scope.row)"-->
96 <!--            v-hasPermi="['rm:repairRecord:edit']"-->
97 <!--          >修改</el-button>-->
98 <!--          <el-button-->
99 <!--            size="mini"-->
100 <!--            type="text"-->
101 <!--            icon="el-icon-delete"-->
102 <!--            @click="handleDelete(scope.row)"-->
103 <!--            v-hasPermi="['rm:repairRecord:remove']"-->
104 <!--          >删除</el-button>-->
105 <!--        </template>-->
106 <!--      </el-table-column>-->
107     </el-table>
108       <el-empty v-else>
109         <span slot="description">暂无数据</span>
110       </el-empty>
111     </el-card>
112     <pagination
113       v-show="total>0"
114       :total="total"
115       :page.sync="queryParams.pageNum"
116       :limit.sync="queryParams.pageSize"
117       @pagination="getList"
118     />
119
120     <!-- 添加或修改返修记录对话框 -->
121     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
122       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
123         <el-form-item label="总成编码" prop="snCode">
124           <el-input v-model="form.snCode" placeholder="请输入总成编码" />
125         </el-form-item>
126         <el-form-item label="返修标识" prop="repairIdentification">
127           <el-input v-model="form.repairIdentification" placeholder="请输入返修标识" />
128         </el-form-item>
129         <el-form-item label="箱体编码" prop="boxCode">
130           <el-input v-model="form.boxCode" placeholder="请输入箱体编码" />
131         </el-form-item>
132         <el-form-item label="工序编码" prop="processesCode">
133           <el-input v-model="form.processesCode" placeholder="请输入工序编码" />
134         </el-form-item>
135         <el-form-item label="原结果" prop="originalResult">
136           <el-input v-model="form.originalResult" placeholder="请输入原结果" />
137         </el-form-item>
138         <el-form-item label="创建用户" prop="createUser">
139           <el-input v-model="form.createUser" placeholder="请输入创建用户" />
140         </el-form-item>
141         <el-form-item label="更新用户" prop="updateUser">
142           <el-input v-model="form.updateUser" placeholder="请输入更新用户" />
143         </el-form-item>
144         <el-form-item label="返修结果" prop="repairResults">
145           <el-input v-model="form.repairResults" placeholder="请输入返修结果" />
146         </el-form-item>
147         <el-form-item label="备注" prop="remarks">
148           <el-input v-model="form.remarks" placeholder="请输入备注" />
149         </el-form-item>
150         <el-form-item label="预留字段1" prop="spareField1">
151           <el-input v-model="form.spareField1" placeholder="请输入预留字段1" />
152         </el-form-item>
153         <el-form-item label="预留字段2" prop="spareField2">
154           <el-input v-model="form.spareField2" placeholder="请输入预留字段2" />
155         </el-form-item>
156         <el-form-item label="状态" prop="status">
157           <el-radio-group v-model="form.status">
158             <el-radio
159               v-for="dict in dict.type.sys_normal_disable"
160               :key="dict.value"
161               :label="dict.value"
162             >{{dict.label}}</el-radio>
163           </el-radio-group>
164         </el-form-item>
165       </el-form>
166       <div slot="footer" class="dialog-footer">
167         <el-button type="primary" @click="submitForm">确 定</el-button>
168         <el-button @click="cancel">取 消</el-button>
169       </div>
170     </el-dialog>
171   </div>
172 </template>
173
174 <script>
175 import { listRepairRecord, getRepairRecord, delRepairRecord, addRepairRecord, updateRepairRecord } from "@/api/main/rm/repairRecord/repairRecord";
176
177 export default {
178   name: "RepairRecord",
179   dicts: ['sys_normal_disable'],
180   data() {
181     return {
182       // 遮罩层
183       loading: true,
184       // 选中数组
185       ids: [],
186       // 非单个禁用
187       single: true,
188       // 非多个禁用
189       multiple: true,
190       // 显示搜索条件
191       showSearch: true,
192       // 总条数
193       total: 0,
194       // 返修记录表格数据
195       repairRecordList: [],
196       // 弹出层标题
197       title: "",
198       // 是否显示弹出层
199       open: false,
200       // 查询参数
201       queryParams: {
202         pageNum: 1,
203         pageSize: 10,
204         snCode: null,
205         repairIdentification: null,
206         boxCode: null,
207         processesCode: null,
208         originalResult: null,
209         createUser: null,
210         updateUser: null,
211         repairResults: null,
212         status: null,
213         remarks: null,
214         spareField1: null,
215         spareField2: null
216       },
217       // 表单参数
218       form: {},
219       // 表单校验
220       rules: {
221         id: [
222           { required: true, message: "主键id不能为空", trigger: "blur" }
223         ],
224       }
225     };
226   },
227   created() {
228     this.getList();
229   },
230   methods: {
231     /** 查询返修记录列表 */
232     getList() {
233       this.loading = true;
234       listRepairRecord(this.queryParams).then(response => {
235         this.repairRecordList = response.rows;
236         this.total = response.total;
237         this.loading = false;
238       });
239     },
240     // 取消按钮
241     cancel() {
242       this.open = false;
243       this.reset();
244     },
245     // 表单重置
246     reset() {
247       this.form = {
248         id: null,
249         snCode: null,
250         repairIdentification: null,
251         boxCode: null,
252         processesCode: null,
253         originalResult: null,
254         createUser: null,
255         createTime: null,
256         updateTime: null,
257         updateUser: null,
258         repairResults: null,
259         status: "0",
260         remarks: null,
261         spareField1: null,
262         repairTime: null,
263         spareField2: null
264       };
265       this.resetForm("form");
266     },
267     /** 搜索按钮操作 */
268     handleQuery() {
269       this.queryParams.pageNum = 1;
270       this.getList();
271     },
272     /** 重置按钮操作 */
273     resetQuery() {
274       this.resetForm("queryForm");
275       this.handleQuery();
276     },
277     // 多选框选中数据
278     handleSelectionChange(selection) {
279       this.ids = selection.map(item => item.id)
280       this.single = selection.length!==1
281       this.multiple = !selection.length
282     },
283     /** 新增按钮操作 */
284     handleAdd() {
285       this.reset();
286       this.open = true;
287       this.title = "添加返修记录";
288     },
289     /** 修改按钮操作 */
290     handleUpdate(row) {
291       this.reset();
292       const id = row.id || this.ids
293       getRepairRecord(id).then(response => {
294         this.form = response.data;
295         this.open = true;
296         this.title = "修改返修记录";
297       });
298     },
299     /** 提交按钮 */
300     submitForm() {
301       this.$refs["form"].validate(valid => {
302         if (valid) {
303           if (this.form.id != null) {
304             updateRepairRecord(this.form).then(response => {
305               this.$modal.msgSuccess("修改成功");
306               this.open = false;
307               this.getList();
308             });
309           } else {
310             addRepairRecord(this.form).then(response => {
311               this.$modal.msgSuccess("新增成功");
312               this.open = false;
313               this.getList();
314             });
315           }
316         }
317       });
318     },
319     /** 删除按钮操作 */
320     handleDelete(row) {
321       const ids = row.id || this.ids;
322       this.$modal.confirm('是否确认删除返修记录编号为"' + ids + '"的数据项?').then(function() {
323         return delRepairRecord(ids);
324       }).then(() => {
325         this.getList();
326         this.$modal.msgSuccess("删除成功");
327       }).catch(() => {});
328     },
329     /** 导出按钮操作 */
330     handleExport() {
331       this.download('rm/repairRecord/export', {
332         ...this.queryParams
333       }, `repairRecord_${new Date().getTime()}.xlsx`)
334     }
335   }
336 };
337 </script>