春风项目四线(合箱线、总装线)
jiang
2024-01-26 2907adc5cea3d3cee48d758e2df7d9f55087cc55
提交 | 用户 | 时间
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="processesCode">
6           <el-input
7             v-model="queryParams.processesCode"
8             placeholder="请输入工序编码"
9             clearable
10             @keyup.enter.native="handleQuery"
11           />
12         </el-form-item>
13         <el-form-item label="工序名称" prop="processesName">
14           <el-input
15             v-model="queryParams.processesName"
16             placeholder="请输入工序名称"
17             clearable
18             @keyup.enter.native="handleQuery"
19           />
20         </el-form-item>
21         <el-form-item label-width="120" label="是否关键工序" prop="keyProcessesFlag">
22           <el-select v-model="queryParams.keyProcessesFlag" placeholder="请选择" clearable>
23             <el-option
24               v-for="dict in dict.type.sys_yes_no"
25               :key="dict.value"
26               :label="dict.label"
27               :value="dict.value"
28             />
29           </el-select>
30         </el-form-item>
31         <el-form-item style="float: right">
32           <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
33           <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
34         </el-form-item>
35       </el-form>
36     </el-card>
37
38     <el-card style="margin-top: 10px" class="box-card">
39       <el-row :gutter="10" class="mb8">
40         <el-col :span="1.5">
41           <el-button
42             type="primary"
43             plain
44             icon="el-icon-plus"
45             size="mini"
46             @click="handleAdd"
47             v-hasPermi="['bs:technologyRouteChild:add']"
48           >新增</el-button>
49         </el-col>
50         <el-col :span="1.5">
51           <el-button
52             type="success"
53             plain
54             icon="el-icon-edit"
55             size="mini"
56             :disabled="single"
57             @click="handleUpdate"
58             v-hasPermi="['bs:technologyRouteChild:edit']"
59           >修改</el-button>
60         </el-col>
61         <el-col :span="1.5">
62           <el-button
63             type="danger"
64             plain
65             icon="el-icon-delete"
66             size="mini"
67             :disabled="multiple"
68             @click="handleDelete"
69             v-hasPermi="['bs:technologyRouteChild:remove']"
70           >删除</el-button>
71         </el-col>
72         <el-col :span="1.5">
73           <el-button
74             type="warning"
75             plain
76             icon="el-icon-download"
77             size="mini"
78             @click="handleExport"
79             v-hasPermi="['bs:technologyRouteChild:export']"
80           >导出</el-button>
81         </el-col>
82         <el-col :span="1.5">
83           <el-button
84             type="warning"
85             plain
86             icon="el-icon-close"
87             size="mini"
88             @click="handleClose"
89           >关闭</el-button>
90         </el-col>
91         <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
92       </el-row>
93       <el-descriptions class="margin-top" :column="4" :size="size" border>
94         <el-descriptions-item :span="1">
95           <template slot="label">
96             <i class="el-icon-user"></i>
97             工艺流程编码
98           </template>
99           {{headerInformationData.routeCode}}
100         </el-descriptions-item>
101         <el-descriptions-item :span="1">
102           <template slot="label">
103             <i class="el-icon-mobile-phone"></i>
104             工艺流程名称
105           </template>
106           {{headerInformationData.routeName}}
107         </el-descriptions-item>
108         <el-descriptions-item :span="1">
109           <template slot="label">
110             <i class="el-icon-location-outline"></i>
111             产品编码
112           </template>
113           {{headerInformationData.productCode}}
114         </el-descriptions-item>
115         <el-descriptions-item :span="1">
116           <template slot="label">
117             <i class="el-icon-tickets"></i>
118             产品名称
119           </template>
120           {{headerInformationData.productName}}
121         </el-descriptions-item>
122       </el-descriptions>
123       <el-table v-loading="loading" :width="tableWidth" style="width: auto;" border :data="technologyRouteChildList" @selection-change="handleSelectionChange" v-if="technologyRouteChildList.length > 0">
124         <el-table-column type="selection" width="55" align="center" />
125         <el-table-column label="主键id" align="center" prop="id" />
126         <el-table-column label="工序编码" align="center" prop="processesCode">
127         </el-table-column>
128         <el-table-column label="工序名称" align="center" prop="processesName">
129         </el-table-column>
130         <el-table-column label="加工顺序" align="center" prop="stepNo">
131         </el-table-column>
132         <el-table-column label="是否关键工序" align="center" prop="keyProcessesFlag">
133           <template slot-scope="scope">
134             <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.keyProcessesFlag"/>
135           </template>
136         </el-table-column>
137         <el-table-column label="创建用户" align="center" prop="createUser">
138         </el-table-column>
139         <el-table-column width="160" :show-overflow-tooltip='true' label="创建时间" align="center" prop="createTime">
140         </el-table-column>
141         <el-table-column label="更改用户" align="center" prop="updateUser">
142         </el-table-column>
143         <el-table-column width="160" :show-overflow-tooltip='true' label="更改时间" align="center" prop="updateTime">
144         </el-table-column>
145         <el-table-column label="备注" align="center" prop="remark">
146         </el-table-column>
147         <el-table-column width="130" :show-overflow-tooltip='true' label="工艺流程编码" align="center" prop="routeCode">
148         </el-table-column>
149         <el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width">
150           <template slot-scope="scope">
151             <el-button
152               size="mini"
153               type="success"
154               plain
155               style="width: 72px"
156               icon="el-icon-edit"
157               @click="handleUpdate(scope.row)"
158               v-hasPermi="['bs:technologyRouteChild:edit']"
159             >修改</el-button>
160             <el-button
161               size="mini"
162               plain
163               style="width: 72px"
164               type="danger"
165               icon="el-icon-delete"
166               @click="handleDelete(scope.row)"
167               v-hasPermi="['bs:technologyRouteChild:remove']"
168             >删除</el-button>
169           </template>
170         </el-table-column>
171       </el-table>
172       <el-empty v-else>
173         <span slot="description">暂无数据</span>
174       </el-empty>
175     </el-card>
176
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     <!-- 添加或修改工艺路线子信息对话框 -->
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="80px">
193         <el-form-item label="流程编码">
194           <el-input v-model="queryRouteCode" :disabled="true" />
195         </el-form-item>
1c7f83 196         <el-form-item label="工序编码" prop="processesCode">
fd2207 197 <!--          <el-input v-model="form.processesCode" placeholder="请输入工序编码" />-->
1c7f83 198           <el-select style="width: 100%" @change="handleSelectChange(form.processesCode)" v-model="form.processesCode" placeholder="请选择">
fd2207 199             <el-option
200               v-for="item in options"
201               :key="item.processesCode"
1c7f83 202               :label="item.processesCode"
fd2207 203               :value="item.processesCode">
204             </el-option>
205           </el-select>
1c7f83 206         </el-form-item>
H 207         <el-form-item label="工序名称" prop="processesName">
208           <el-input disabled v-model="form.processesName" placeholder="请输入工序编码" />
209 <!--          <el-select style="width: 100%" v-model="form.processesCode" placeholder="请选择">-->
210 <!--            <el-option-->
211 <!--              v-for="item in options"-->
212 <!--              :key="item.processesCode"-->
213 <!--              :label="item.processesName"-->
214 <!--              :value="item.processesCode">-->
215 <!--            </el-option>-->
216 <!--          </el-select>-->
fd2207 217         </el-form-item>
218         <el-form-item label="加工顺序" prop="stepNo">
219           <el-input v-model="form.stepNo" placeholder="请输入加工顺序" />
220         </el-form-item>
221 <!--        <el-form-item label="下一道工序" prop="nextProcess">-->
222 <!--          <el-input v-model="form.nextProcess" placeholder="请输入下一道工序" />-->
223 <!--        </el-form-item>-->
224 <!--        <el-form-item label="下一道工序" prop="nextProcess">-->
225 <!--          <el-select style="width: 100%" v-model="form.processesCode" placeholder="请选择">-->
226 <!--            <el-option-->
227 <!--              v-for="item in options"-->
228 <!--              :key="item.processesCode"-->
229 <!--              :label="item.processesName"-->
230 <!--              :value="item.processesCode">-->
231 <!--            </el-option>-->
232 <!--          </el-select>-->
233 <!--        </el-form-item>-->
234 <!--        <el-form-item label="与下一道工序关系" prop="nextProcessBond">-->
235 <!--          <el-input v-model="form.nextProcessBond" placeholder="请输入与下一道工序关系" />-->
236 <!--        </el-form-item>-->
237
238         <el-form-item label="是否关键工序" prop="keyProcessesFlag" label-width="180">
239           <el-radio-group v-model="form.keyProcessesFlag">
240             <el-radio
241               v-for="dict in dict.type.sys_yes_no"
242               :key="dict.value"
243               :label="dict.value"
244             >{{dict.label}}</el-radio>
245           </el-radio-group>
246         </el-form-item>
247 <!--        <el-form-item label="准备时间" prop="preparationTime">-->
248 <!--          <el-input v-model="form.preparationTime" placeholder="请输入准备时间" />-->
249 <!--        </el-form-item>-->
250 <!--        <el-form-item label="等待时间" prop="waitTime">-->
251 <!--          <el-input v-model="form.waitTime" placeholder="请输入等待时间" />-->
252 <!--        </el-form-item>-->
253         <el-form-item label="备注" prop="remark">
254           <el-input v-model="form.remark" placeholder="请输入备注" />
255         </el-form-item>
256       </el-form>
257       <div slot="footer" class="dialog-footer">
258         <el-button type="primary" @click="submitForm">确 定</el-button>
259         <el-button @click="cancel">取 消</el-button>
260       </div>
261     </el-dialog>
262   </div>
263 </template>
264
265 <script>
266 import { listProcesses} from "@/api/main/bs/processes/processes";
267 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
268 import { listTechnologyRouteChild, getTechnologyRouteChild, delTechnologyRouteChild, addTechnologyRouteChild, updateTechnologyRouteChild } from "@/api/main/bs/technologyRouteChild/technologyRouteChild";
1c7f83 269 import {listProductBom} from "@/api/main/bs/ProductBom/ProductBom";
fd2207 270
271 export default {
272   name: "TechnologyRouteChild",
273   dicts: ['sys_yes_no'],
274   data() {
275     return {
276       tableWidth: '100%', // 初始宽度设置为100%
277       options: [],
278       // 遮罩层
279       loading: true,
280       titleName: 'test',
281       // 选中数组
282       ids: [],
283       // 非单个禁用
284       single: true,
285       // 非多个禁用
286       multiple: true,
287       // 显示搜索条件
288       showSearch: true,
289       // 总条数
290       total: 0,
291       // 工艺路线子信息表格数据
292       technologyRouteChildList: [],
293       // 弹出层标题
294       title: "",
295       queryRouteCode: "",
296       queryRouteId: "",
297       // 是否显示弹出层
298       open: false,
299       // 查询参数
300       queryParams: {
301         pageNum: 1,
302         pageSize: 10,
303         processesCode: null,
304         processesName: null,
305         keyProcessesFlag: null,
306         routeCode: undefined,
307       },
1c7f83 308       ProcessesqueryParams: {
H 309         pageNum: 1,
310         pageSize: 10,
311         processesCode: null,
312         processesName: null,
313         keyProcessesFlag: null,
314         routeCode: undefined,
315       },
fd2207 316       headerInformationData:{
317         routeCode: "",
318         routeName: "",
319         productCode: "",
320         productName: ""
321       },
322       // 表单参数
323       form: {},
324       // 表单校验
325       rules: {
326         id: [
327           { required: true, message: "主键id不能为空", trigger: "blur" }
328         ],
329         stepNo: [
330           { required: true, message: "加工工序不能为空", trigger: "blur" }
331         ],
332       }
333     };
334   },
335   created() {
336     let routeCode = this.$route.query.routeCode;
337     let routeId = this.$route.query.routeId;
338     this.queryParams.routeCode = routeCode
339     this.queryRouteCode = routeCode
340     this.queryRouteId = routeId
341     this.getList();
342     this.headerInformation();
343     this.getProcesses();
1c7f83 344     this.initProcesses();
fd2207 345   },
346   methods: {
1c7f83 347
H 348     handleSelectChange(selectedOption) {
349       this.ProcessesqueryParams.processesCode = selectedOption;
350       listProcesses(this.ProcessesqueryParams).then(response => {
351         this.form.processesName = response.rows[0].processesName;
352       });
353     },
354
fd2207 355     getProcesses() {
356       listProcesses(null).then(response => {
357         this.options = response.rows;
358       });
359     },
360     /** 工艺流程表头信息 */
361     headerInformation() {
362       listTechnologyRoute(this.queryParams).then(response => {
363         this.headerInformationData = response.rows[0];
364       });
365     },
366     /** 返回按钮操作 */
367     handleClose() {
368       const obj = { path: "/main/pm/technologyRoute" };
369       this.$tab.closeOpenPage(obj);
370     },
371     /** 查询工艺路线子信息列表 */
372     getList() {
373       this.loading = true;
374       listTechnologyRouteChild(this.queryParams).then(response => {
375         this.technologyRouteChildList = response.rows;
376         this.total = response.total;
377         this.loading = false;
378       });
379     },
380     // 取消按钮
381     cancel() {
382       this.open = false;
383       this.reset();
384     },
385     // 表单重置
386     reset() {
387       this.form = {
388         id: null,
389         processesCode: null,
390         processesName: null,
391         stepNo: null,
392         nextProcess: null,
393         nextProcessBond: null,
394         keyProcessesFlag: 'Y',
395         preparationTime: null,
396         waitTime: null,
397         createUser: null,
398         createTime: null,
399         updateUser: null,
400         updateTime: null,
401         remark: null,
402         routeId: null,
403         routeCode: 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       getTechnologyRouteChild(id).then(response => {
438         this.form = response.data;
439         this.open = true;
440         this.titleName = "修改工艺路线子信息";
441       });
442     },
443     /** 提交按钮 */
444     submitForm() {
445       this.form.routeCode = this.queryRouteCode;
446       this.form.routeId =  this.queryRouteId;
447       this.$refs["form"].validate(valid => {
448         if (valid) {
449           if (this.form.id != null) {
450             updateTechnologyRouteChild(this.form).then(response => {
451               this.$modal.msgSuccess("修改成功");
452               this.open = false;
453               this.getList();
454             });
455           } else {
456             addTechnologyRouteChild(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 delTechnologyRouteChild(ids);
470       }).then(() => {
471         this.getList();
472         this.$modal.msgSuccess("删除成功");
473       }).catch(() => {});
474     },
475     /** 导出按钮操作 */
476     handleExport() {
477       this.download('bs/technologyRouteChild/export', {
478         ...this.queryParams
479       }, `technologyRouteChild_${new Date().getTime()}.xlsx`)
480     }
481   }
482 };
483 </script>