春风项目四线(合箱线、总装线)
cl
2024-01-18 d18622be3bf4c48e9cf17bc4d3254245438ed272
提交 | 用户 | 时间
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="opCode">
6         <el-input
7           v-model="queryParams.opCode"
8           placeholder="请输入工序编码"
9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
13       <el-form-item label="工序名称" prop="opName">
14         <el-input
15           v-model="queryParams.opName"
16           placeholder="请输入工序名称"
17           clearable
18           @keyup.enter.native="handleQuery"
19         />
20       </el-form-item>
21       <el-form-item label="物料编码" prop="materialCode">
22         <el-input
23           v-model="queryParams.materialCode"
24           placeholder="请输入物料编码"
25           clearable
26           @keyup.enter.native="handleQuery"
27         />
28       </el-form-item>
29       <el-form-item label="物料名称" label-width="120" prop="materialName">
30         <el-input
31           v-model="queryParams.materialName"
32           placeholder="请输入物料名称"
33           clearable
34           @keyup.enter.native="handleQuery"
35         />
36       </el-form-item>
37       <el-form-item style="float: right">
38         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
39         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
40       </el-form-item>
41     </el-form>
42     </el-card>
43
44     <el-card style="margin-top: 10px" class="box-card">
45
46     <el-row :gutter="10" class="mb8">
47       <el-col :span="1.5">
48         <el-button
49           type="primary"
50           plain
51           icon="el-icon-plus"
52           size="mini"
53           @click="handleAdd"
54           v-hasPermi="['bs:ProductBomChild:add']"
55         >新增</el-button>
56       </el-col>
57       <el-col :span="1.5">
58         <el-button
59           type="success"
60           plain
61           icon="el-icon-edit"
62           size="mini"
63           :disabled="single"
64           @click="handleUpdate"
65           v-hasPermi="['bs:ProductBomChild:edit']"
66         >修改</el-button>
67       </el-col>
68       <el-col :span="1.5">
69         <el-button
70           type="danger"
71           plain
72           icon="el-icon-delete"
73           size="mini"
74           :disabled="multiple"
75           @click="handleDelete"
76           v-hasPermi="['bs:ProductBomChild:remove']"
77         >删除</el-button>
78       </el-col>
79       <el-col :span="1.5">
80         <el-button
81           type="warning"
82           plain
83           icon="el-icon-download"
84           size="mini"
85           @click="handleExport"
86           v-hasPermi="['bs:ProductBomChild:export']"
87         >导出</el-button>
88       </el-col>
89       <el-col :span="1.5">
90         <el-button
91           type="warning"
92           plain
93           icon="el-icon-close"
94           size="mini"
95           @click="handleClose"
96         >关闭</el-button>
97       </el-col>
98       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
99     </el-row>
100
101     <el-descriptions class="margin-top" :column="4" :size="size" border>
102       <el-descriptions-item :span="1">
103         <template slot="label">
104           <i class="el-icon-user"></i>
105           BOM编码
106         </template>
107         {{headerInformationData.bomCode}}
108       </el-descriptions-item>
109       <el-descriptions-item :span="1">
110         <template slot="label">
111           <i class="el-icon-mobile-phone"></i>
112           BOM名称
113         </template>
114         {{headerInformationData.bomName}}
115       </el-descriptions-item>
116       <el-descriptions-item :span="1">
117         <template slot="label">
118           <i class="el-icon-location-outline"></i>
119           产品编码
120         </template>
121         {{headerInformationData.productCode}}
122       </el-descriptions-item>
123       <el-descriptions-item :span="1">
124         <template slot="label">
125           <i class="el-icon-tickets"></i>
126           产品名称
127         </template>
128         {{headerInformationData.productName}}
129       </el-descriptions-item>
130     </el-descriptions>
131
132     <el-table v-loading="loading"  border :data="ProductBomChildList" @selection-change="handleSelectionChange" v-if="ProductBomChildList.length > 0">
133       <el-table-column type="selection" width="55" align="center" />
134       <el-table-column label="工序编码" align="center" prop="opCode">
135       </el-table-column>
136       <el-table-column label="工序名称" align="center" prop="opName">
137       </el-table-column>
138       <el-table-column label="物料编码" align="center" prop="materialCode">
139       </el-table-column>
140       <el-table-column label="物料名称" align="center" prop="materialName">
141       </el-table-column>
142       <el-table-column label="单耗" align="center" prop="costQty">
143       </el-table-column>
144       <el-table-column label="单位" align="center" prop="unit">
145       </el-table-column>
146       <el-table-column label="备注" align="center" prop="remark">
147       </el-table-column>
148       <el-table-column label="BOM编码" align="center" prop="bomCode">
149       </el-table-column>
150       <el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width">
151         <template slot-scope="scope">
152           <el-button
153             size="mini"
154             type="success"
155             plain
156             style="width: 72px"
157             icon="el-icon-edit"
158             @click="handleUpdate(scope.row)"
159             v-hasPermi="['bs:ProductBomChild:edit']"
160           >修改</el-button>
161           <el-button
162             size="mini"
163             plain
164             style="width: 72px"
165             type="danger"
166             icon="el-icon-delete"
167             @click="handleDelete(scope.row)"
168             v-hasPermi="['bs:ProductBomChild:remove']"
169           >删除</el-button>
170         </template>
171       </el-table-column>
172     </el-table>
173       <el-empty v-else>
174         <span slot="description">暂无数据</span>
175       </el-empty>
176     </el-card>
177
178     <pagination
179       v-show="total>0"
180       :total="total"
181       :page.sync="queryParams.pageNum"
182       :limit.sync="queryParams.pageSize"
183       @pagination="getList"
184     />
185
186     <!-- 添加或修改基础BOM子信息对话框 -->
187     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
188       <span slot="title">
189         <i class="el-icon-s-order"></i>
190         {{titleName}}
191       </span>
192       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
193         <el-form-item label="BOM编码" prop="bomCode">
194           <el-input v-model="querybomCode" :disabled="true" />
195         </el-form-item>
196 <!--        <el-form-item label="物料编码" prop="materialCode">-->
197 <!--          <el-input v-model="form.materialCode" placeholder="请输入物料编码" />-->
198 <!--        </el-form-item>-->
199 <!--        <el-form-item label="物料名称" prop="materialName">-->
200 <!--          <el-input v-model="form.materialName" placeholder="请输入物料名称" />-->
201 <!--        </el-form-item>-->
202         <el-form-item label="物料编码" prop="productCode">
203           <el-input v-model="form.materialCode" placeholder="请选择产品" >
204             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
205           </el-input>
206           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
207         </el-form-item>
208         <el-form-item label="物料名称" prop="materialName">
209           <el-input disabled v-model="form.materialName" placeholder="请输入物料名称" />
210         </el-form-item>
211         <el-form-item label="单耗" prop="costQty">
212           <el-input v-model="form.costQty" placeholder="请输入单耗" />
213         </el-form-item>
214         <el-form-item label="单位" prop="unit">
215           <el-input v-model="form.unit" placeholder="请输入单位" />
216         </el-form-item>
217         <el-form-item label="工序编码" prop="opCode">
218           <el-input v-model="form.opCode" placeholder="请输入工序编码" />
219         </el-form-item>
220         <el-form-item label="工序名称" prop="opName">
221           <el-input v-model="form.opName" placeholder="请输入工序名称" />
222         </el-form-item>
223 <!--        <el-form-item label="预留字段1" prop="spareField1">-->
224 <!--          <el-input v-model="form.spareField1" placeholder="请输入预留字段1" />-->
225 <!--        </el-form-item>-->
226 <!--        <el-form-item label="预留字段2" prop="spareField2">-->
227 <!--          <el-input v-model="form.spareField2" placeholder="请输入预留字段2" />-->
228 <!--        </el-form-item>-->
229 <!--        <el-form-item label="预留字段3" prop="spareField3">-->
230 <!--          <el-input v-model="form.spareField3" placeholder="请输入预留字段3" />-->
231 <!--        </el-form-item>-->
232         <el-form-item label="备注" prop="remark">
233           <el-input v-model="form.remark" placeholder="请输入备注" />
234         </el-form-item>
235 <!--        <el-form-item label="BOM主表ID" prop="bomInfoId">-->
236 <!--          <el-input v-model="form.bomInfoId" placeholder="请输入BOM主表ID" />-->
237 <!--        </el-form-item>-->
238       </el-form>
239       <div slot="footer" class="dialog-footer">
240         <el-button type="primary" @click="submitForm">确 定</el-button>
241         <el-button @click="cancel">取 消</el-button>
242       </div>
243     </el-dialog>
244   </div>
245 </template>
246
247 <script>
248 import { listProductBomChild, getProductBomChild, delProductBomChild, addProductBomChild, updateProductBomChild } from "@/api/main/bs/ProductBomChild/ProductBomChild";
249 import {listProcesses} from "@/api/main/bs/processes/processes";
250 import {listProductBom} from "@/api/main/bs/ProductBom/ProductBom";
251 import {listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
252 import ItemSelect from "@/components/itemSelect/single.vue";
253
254 export default {
255   name: "ProductBomChild",
256   components: {
257     ItemSelect ,
258   },
259   data() {
260     return {
261       // 遮罩层
262       loading: true,
263       titleName: 'test',
264       // 选中数组
265       ids: [],
266       // 非单个禁用
267       single: true,
268       // 非多个禁用
269       multiple: true,
270       // 显示搜索条件
271       showSearch: true,
272       // 总条数
273       total: 0,
274       // 基础BOM子信息表格数据
275       ProductBomChildList: [],
276       // 弹出层标题
277       title: "",
278       querybomCode: "",
279       // 是否显示弹出层
280       open: false,
281       // 查询参数
282       queryParams: {
283         pageNum: 1,
284         pageSize: 10,
285         materialCode: null,
286         bomCode: null,
287         opCode: null,
288         opName: null,
289         materialName: null,
290       },
291       headerInformationData:{
292         bomCode: "",
293         bomName: "",
294         productCode: "",
295         productName: ""
296       },
297       // 表单参数
298       form: {},
299       // 表单校验
300       rules: {
301         id: [
302           { required: true, message: "主键id不能为空", trigger: "blur" }
303         ],
304         costQty: [
305           { required: true, message: "单耗不能为空", trigger: "blur" }
306         ],
307         unit: [
308           { required: true, message: "单位不能为空", trigger: "blur" }
309         ],
310         bomCode: [
311           { required: true, message: "BOM编码不能为空", trigger: "blur" }
312         ],
313       }
314     };
315   },
316   created() {
317
318     let bomCode = this.$route.query.bomCode;
319     this.queryParams.bomCode = bomCode
320     this.querybomCode = bomCode
321     this.getList();
322     this.headerInformation();
323     this.getProcesses();
324   },
325   methods: {
326     //物料选择弹出框
327     onItemSelected(obj){
328       if(obj !== undefined && obj !== null){
329         this.form.materialCode = obj.materialCode;
330         this.form.materialName = obj.materialName;
331       }
332     },
333     handleSelectProduct(){
334       this.$refs.itemSelect.showFlag = true;
335     },
336     getProcesses() {
337       listProcesses(null).then(response => {
338         this.options = response.rows;
339       });
340     },
341     /** BOM表头信息 */
342     headerInformation() {
343       listProductBom(this.queryParams).then(response => {
344         this.headerInformationData = response.rows[0];
345         //this.$modal.msgSuccess(this.headerInformationData.bomCode);
346       });
347     },
348     /** 返回按钮操作 */
349     handleClose() {
350       const obj = { path: "/main/pm/ProductBom" };
351       this.$tab.closeOpenPage(obj);
352     },
353     /** 查询基础BOM子信息列表 */
354     getList() {
355       this.loading = true;
356       listProductBomChild(this.queryParams).then(response => {
357         this.ProductBomChildList = response.rows;
358         this.total = response.total;
359         this.loading = false;
360       });
361     },
362     // 取消按钮
363     cancel() {
364       this.open = false;
365       this.reset();
366     },
367     // 表单重置
368     reset() {
369       this.form = {
370         id: null,
371         opCode: null,
372         opName: null,
373         materialCode: null,
374         materialName: null,
375         costQty: null,
376         unit: null,
377         spareField1: null,
378         spareField2: null,
379         spareField3: null,
380         remark: null,
381         bomCode: null,
382         bomInfoId: null
383       };
384       this.resetForm("form");
385     },
386     /** 搜索按钮操作 */
387     handleQuery() {
388       this.queryParams.pageNum = 1;
389       this.getList();
390     },
391     /** 重置按钮操作 */
392     resetQuery() {
393       this.resetForm("queryForm");
394       this.handleQuery();
395     },
396     // 多选框选中数据
397     handleSelectionChange(selection) {
398       this.ids = selection.map(item => item.id)
399       this.single = selection.length!==1
400       this.multiple = !selection.length
401     },
402     /** 新增按钮操作 */
403     handleAdd() {
404       this.reset();
405       this.open = true;
406       this.titleName = "添加BOM子信息";
407     },
408     /** 修改按钮操作 */
409     handleUpdate(row) {
410       this.reset();
411       const id = row.id || this.ids
412       getProductBomChild(id).then(response => {
413         this.form = response.data;
414         this.open = true;
415         this.titleName = "修改基础BOM子信息";
416       });
417     },
418     /** 提交按钮 */
419     submitForm() {
420       this.form.bomCode = this.querybomCode;
421       this.$refs["form"].validate(valid => {
422         if (valid) {
423           if (this.form.id != null) {
424             updateProductBomChild(this.form).then(response => {
425               this.$modal.msgSuccess("修改成功");
426               this.open = false;
427               this.getList();
428             });
429           } else {
430             addProductBomChild(this.form).then(response => {
431               this.$modal.msgSuccess("新增成功");
432               this.open = false;
433               this.getList();
434             });
435           }
436         }
437       });
438     },
439     /** 删除按钮操作 */
440     handleDelete(row) {
441       const ids = row.id || this.ids;
442       this.$modal.confirm('是否确认删除基础BOM子信息编号为"' + ids + '"的数据项?').then(function() {
443         return delProductBomChild(ids);
444       }).then(() => {
445         this.getList();
446         this.$modal.msgSuccess("删除成功");
447       }).catch(() => {});
448     },
449     /** 导出按钮操作 */
450     handleExport() {
451       this.download('bs/ProductBomChild/export', {
452         ...this.queryParams
453       }, `ProductBomChild_${new Date().getTime()}.xlsx`)
454     }
455   }
456 };
457 </script>