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