admin
2024-10-15 6d313a4a6f9f9d7ea65ec50ab0d4491e595edb97
提交 | 用户 | 时间
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="processesCode">
6             <el-input
7               v-model="queryParams.processesCode"
8               placeholder="请输入工序"
9               clearable
10               @keyup.enter.native="handleQuery"
11             />
12           </el-form-item>
768498 13           <el-form-item label="参数编码" prop="paramCode">
e57a89 14             <el-input
768498 15               v-model="queryParams.paramCode"
A 16               placeholder="请输入参数编码"
e57a89 17               clearable
18               @keyup.enter.native="handleQuery"
19             />
20           </el-form-item>
768498 21 <!--          <el-form-item label="产线" prop="lineCode">-->
A 22 <!--            <el-input-->
23 <!--              v-model="queryParams.lineCode"-->
24 <!--              placeholder="请输入产线"-->
25 <!--              clearable-->
26 <!--              @keyup.enter.native="handleQuery"-->
27 <!--            />-->
e57a89 28 <!--          </el-form-item>-->
768498 29 <!--          <el-form-item label="产品编号" prop="productCode">-->
A 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.operation_type"
41                 :key="dict.value"
42                 :label="dict.label"
43                 :value="dict.value"
44               />
45             </el-select>
46           </el-form-item>
e57a89 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     <!-- 添加或修改配方配置子信息对话框 -->
768498 221     <el-dialog v-dialogpop-up  :title="title" :visible.sync="open" width="1000px" append-to-body>
e57a89 222       <span slot="title">
223         <i class="el-icon-s-order"></i>
224         {{titleName}}
225       </span>
768498 226       <el-form ref="form" :inline="true" :model="form" :rules="rules" label-width="80px">
e57a89 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>
a846f2 267         <el-form-item label="上限" prop="spareField2">
A 268           <el-input v-model="form.spareField2" placeholder="请输入备注" />
269         </el-form-item>
270         <el-form-item label="下限" prop="spareField3">
271           <el-input v-model="form.spareField3" placeholder="请输入备注" />
272         </el-form-item>
273         <el-form-item label="参数值" prop="collectData">
274           <el-input v-model="form.collectData" placeholder="请输入备注" />
275         </el-form-item>
276         <el-form-item label="状态" prop="results">
277           <el-input v-model="form.results" placeholder="请输入备注" />
e57a89 278         </el-form-item>
279         <el-form-item label="备注" prop="remarks">
280           <el-input v-model="form.remarks" placeholder="请输入备注" />
281         </el-form-item>
282       </el-form>
283       <div slot="footer" class="dialog-footer">
284         <el-button type="primary" @click="submitForm">确 定</el-button>
285         <el-button @click="cancel">取 消</el-button>
286       </div>
287     </el-dialog>
288   </div>
289 </template>
290
291 <script>
292 import { listFormula} from "@/api/main/bs/formula/formula";
293 import { listFormulaChild, getFormulaChild, delFormulaChild, addFormulaChild, updateFormulaChild } from "@/api/main/bs/formulaChild/formulaChild";
294
295 export default {
296   name: "FormulaChild",
297   dicts: ['operation_type'],
298   data() {
299     return {
300       pjtUrl: process.env.VUE_APP_BASE_API,
301       headerInformationData:{
302         formulaCode: "",
303         formulaName: "",
304         productCode: "",
305         productName: ""
306       },
307       // 遮罩层
308       loading: true,
309       titleName: "",
310       // 选中数组
311       ids: [],
312       // 非单个禁用
313       single: true,
314       // 非多个禁用
315       multiple: true,
316       // 显示搜索条件
317       showSearch: true,
318       // 总条数
319       total: 0,
320       formulaCode:  "",
321       // 配方配置子信息表格数据
322       formulaChildList: [],
323       // 弹出层标题
324       title: "",
325       // 是否显示弹出层
326       open: false,
327       // 查询参数
328       queryParams: {
329         pageNum: 1,
330         pageSize: 10,
331         workshopCode: null,
332         lineCode: null,
333         processesCode: null,
334         productCode: null,
335         operationType: null,
336         formulaCode: null,
337       },
338       // 表单参数
339       form: {},
340       // 表单校验
341       rules: {
342         id: [
343           { required: true, message: "id不能为空", trigger: "blur" }
344         ],
345       }
346     };
347   },
348   created() {
349     let formulaCode = this.$route.query.formulaCode;
350     this.queryParams.formulaCode = formulaCode;
351     this.formulaCode = formulaCode;
352     this.headerInformation();
353     this.getList();
354   },
355   methods: {
356     /** 工艺流程表头信息 */
357     headerInformation() {
358       listFormula(this.queryParams).then(response => {
359         this.headerInformationData = response.rows[0];
360       });
361     },
362     /** 返回按钮操作 */
363     handleClose() {
364       const obj = { path: "/main/pm/formula" };
365       this.$tab.closeOpenPage(obj);
366     },
367     /** 查询配方配置子信息列表 */
368     getList() {
369       this.loading = true;
370       listFormulaChild(this.queryParams).then(response => {
371         this.formulaChildList = response.rows;
372         this.total = response.total;
373         this.loading = false;
374       });
375     },
376     // 取消按钮
377     cancel() {
378       this.open = false;
379       this.reset();
380     },
381     // 表单重置
382     reset() {
383       this.form = {
384         id: null,
385         workshopCode: null,
386         lineCode: null,
387         processesCode: null,
388         productCode: null,
389         operationSteps: null,
390         techRequirement: null,
391         operationType: null,
392         stepSort: null,
393         paramCode: null,
394         materialCode: null,
395         formulaCode: null,
396         picture: null,
397         remarks: null,
398         createUser: null,
399         createTime: null,
400         updateUser: null,
a846f2 401         collectData: null,
A 402         results: null,
e57a89 403         updateTime: null,
404         spareField1: null,
405         spareField2: null,
406         spareField3: null,
407         spareField4: null
408       };
409       this.resetForm("form");
410     },
411     /** 搜索按钮操作 */
412     handleQuery() {
413       this.queryParams.pageNum = 1;
414       this.getList();
415     },
416     /** 重置按钮操作 */
417     resetQuery() {
418       this.resetForm("queryForm");
419       this.handleQuery();
420     },
421     // 多选框选中数据
422     handleSelectionChange(selection) {
423       this.ids = selection.map(item => item.id)
424       this.single = selection.length!==1
425       this.multiple = !selection.length
426     },
427     /** 新增按钮操作 */
428     handleAdd() {
429       this.reset();
430       this.open = true;
431       this.titleName = "添加配方配置子信息";
432     },
433     /** 修改按钮操作 */
434     handleUpdate(row) {
435       this.reset();
436       const id = row.id || this.ids
437       getFormulaChild(id).then(response => {
a846f2 438         console.log(response.data)
e57a89 439         this.form = response.data;
440         this.open = true;
441         this.titleName = "修改配方配置子信息";
442       });
443     },
444     /** 提交按钮 */
445     submitForm() {
446       this.form.formulaCode = this.formulaCode;
447       this.$refs["form"].validate(valid => {
448         if (valid) {
449           if (this.form.id != null) {
450             updateFormulaChild(this.form).then(response => {
451               this.$modal.msgSuccess("修改成功");
452               this.open = false;
453               this.getList();
454             });
455           } else {
456             addFormulaChild(this.form).then(response => {
457               this.$modal.msgSuccess("新增成功");
458               this.open = false;
459               this.getList();
460             });
461           }
462         }
463       });
464     },
465     /** 删除按钮操作 */
466     handleDelete(row) {
467       const ids = row.id || this.ids;
468       this.$modal.confirm('是否确认删除配方配置子信息编号为"' + ids + '"的数据项?').then(function() {
469         return delFormulaChild(ids);
470       }).then(() => {
471         this.getList();
472         this.$modal.msgSuccess("删除成功");
473       }).catch(() => {});
474     },
475     /** 导出按钮操作 */
476     handleExport() {
477       this.download('bs/formulaChild/export', {
478         ...this.queryParams
479       }, `formulaChild_${new Date().getTime()}.xlsx`)
480     }
481   }
482 };
483 </script>