admin
2024-06-15 8cfe20288690f2ba46c804f41f39e8aa48c2dea0
提交 | 用户 | 时间
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>
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>
196 <!--        <el-form-item label="工序编码" prop="processesCode">-->
197 <!--          <el-input v-model="form.processesCode" placeholder="请输入工序编码" />-->
198 <!--        </el-form-item>-->
199 <!--        <el-form-item label="工序名称" prop="processesName">-->
200 <!--          <el-input v-model="form.processesName" placeholder="请输入工序名称" />-->
201 <!--        </el-form-item>-->
202         <el-form-item label="工序名称" prop="processesName">
203           <el-select style="width: 100%" v-model="form.processesCode" placeholder="请选择">
204             <el-option
205               v-for="item in options"
206               :key="item.processesCode"
207               :label="item.processesName"
208               :value="item.processesCode">
209             </el-option>
210           </el-select>
211         </el-form-item>
212         <el-form-item label="加工顺序" prop="stepNo">
213           <el-input v-model="form.stepNo" placeholder="请输入加工顺序" />
214         </el-form-item>
215 <!--        <el-form-item label="下一道工序" prop="nextProcess">-->
216 <!--          <el-input v-model="form.nextProcess" placeholder="请输入下一道工序" />-->
217 <!--        </el-form-item>-->
218 <!--        <el-form-item label="下一道工序" prop="nextProcess">-->
219 <!--          <el-select style="width: 100%" v-model="form.processesCode" placeholder="请选择">-->
220 <!--            <el-option-->
221 <!--              v-for="item in options"-->
222 <!--              :key="item.processesCode"-->
223 <!--              :label="item.processesName"-->
224 <!--              :value="item.processesCode">-->
225 <!--            </el-option>-->
226 <!--          </el-select>-->
227 <!--        </el-form-item>-->
228 <!--        <el-form-item label="与下一道工序关系" prop="nextProcessBond">-->
229 <!--          <el-input v-model="form.nextProcessBond" placeholder="请输入与下一道工序关系" />-->
230 <!--        </el-form-item>-->
231
232         <el-form-item label="是否关键工序" prop="keyProcessesFlag" label-width="180">
233           <el-radio-group v-model="form.keyProcessesFlag">
234             <el-radio
235               v-for="dict in dict.type.sys_yes_no"
236               :key="dict.value"
237               :label="dict.value"
238             >{{dict.label}}</el-radio>
239           </el-radio-group>
240         </el-form-item>
241 <!--        <el-form-item label="准备时间" prop="preparationTime">-->
242 <!--          <el-input v-model="form.preparationTime" placeholder="请输入准备时间" />-->
243 <!--        </el-form-item>-->
244 <!--        <el-form-item label="等待时间" prop="waitTime">-->
245 <!--          <el-input v-model="form.waitTime" placeholder="请输入等待时间" />-->
246 <!--        </el-form-item>-->
247         <el-form-item label="备注" prop="remark">
248           <el-input v-model="form.remark" placeholder="请输入备注" />
249         </el-form-item>
250       </el-form>
251       <div slot="footer" class="dialog-footer">
252         <el-button type="primary" @click="submitForm">确 定</el-button>
253         <el-button @click="cancel">取 消</el-button>
254       </div>
255     </el-dialog>
256   </div>
257 </template>
258
259 <script>
260 import { listProcesses} from "@/api/main/bs/processes/processes";
261 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
262 import { listTechnologyRouteChild, getTechnologyRouteChild, delTechnologyRouteChild, addTechnologyRouteChild, updateTechnologyRouteChild } from "@/api/main/bs/technologyRouteChild/technologyRouteChild";
263
264 export default {
265   name: "TechnologyRouteChild",
266   dicts: ['sys_yes_no'],
267   data() {
268     return {
269       tableWidth: '100%', // 初始宽度设置为100%
270       options: [],
271       // 遮罩层
272       loading: true,
273       titleName: 'test',
274       // 选中数组
275       ids: [],
276       // 非单个禁用
277       single: true,
278       // 非多个禁用
279       multiple: true,
280       // 显示搜索条件
281       showSearch: true,
282       // 总条数
283       total: 0,
284       // 工艺路线子信息表格数据
285       technologyRouteChildList: [],
286       // 弹出层标题
287       title: "",
288       queryRouteCode: "",
289       queryRouteId: "",
290       // 是否显示弹出层
291       open: false,
292       // 查询参数
293       queryParams: {
294         pageNum: 1,
295         pageSize: 10,
296         processesCode: null,
297         processesName: null,
298         keyProcessesFlag: null,
299         routeCode: undefined,
300       },
301       headerInformationData:{
302         routeCode: "",
303         routeName: "",
304         productCode: "",
305         productName: ""
306       },
307       // 表单参数
308       form: {},
309       // 表单校验
310       rules: {
311         id: [
312           { required: true, message: "主键id不能为空", trigger: "blur" }
313         ],
314         stepNo: [
315           { required: true, message: "加工工序不能为空", trigger: "blur" }
316         ],
317       }
318     };
319   },
320   created() {
321     let routeCode = this.$route.query.routeCode;
322     let routeId = this.$route.query.routeId;
323     this.queryParams.routeCode = routeCode
324     this.queryRouteCode = routeCode
325     this.queryRouteId = routeId
326     this.getList();
327     this.headerInformation();
328     this.getProcesses();
329   },
330   methods: {
331     getProcesses() {
332       listProcesses(null).then(response => {
333         this.options = response.rows;
334       });
335     },
336     /** 工艺流程表头信息 */
337     headerInformation() {
338       listTechnologyRoute(this.queryParams).then(response => {
339         this.headerInformationData = response.rows[0];
340       });
341     },
342     /** 返回按钮操作 */
343     handleClose() {
344       const obj = { path: "/main/pm/technologyRoute" };
345       this.$tab.closeOpenPage(obj);
346     },
347     /** 查询工艺路线子信息列表 */
348     getList() {
349       this.loading = true;
350       listTechnologyRouteChild(this.queryParams).then(response => {
351         this.technologyRouteChildList = response.rows;
352         this.total = response.total;
353         this.loading = false;
354       });
355     },
356     // 取消按钮
357     cancel() {
358       this.open = false;
359       this.reset();
360     },
361     // 表单重置
362     reset() {
363       this.form = {
364         id: null,
365         processesCode: null,
366         processesName: null,
367         stepNo: null,
368         nextProcess: null,
369         nextProcessBond: null,
370         keyProcessesFlag: 'Y',
371         preparationTime: null,
372         waitTime: null,
373         createUser: null,
374         createTime: null,
375         updateUser: null,
376         updateTime: null,
377         remark: null,
378         routeId: null,
379         routeCode: null,
380         spareField1: null,
381         spareField2: null,
382         spareField3: null,
383         spareField4: null
384       };
385       this.resetForm("form");
386     },
387     /** 搜索按钮操作 */
388     handleQuery() {
389       this.queryParams.pageNum = 1;
390       this.getList();
391     },
392     /** 重置按钮操作 */
393     resetQuery() {
394       this.resetForm("queryForm");
395       this.handleQuery();
396     },
397     // 多选框选中数据
398     handleSelectionChange(selection) {
399       this.ids = selection.map(item => item.id)
400       this.single = selection.length!==1
401       this.multiple = !selection.length
402     },
403     /** 新增按钮操作 */
404     handleAdd() {
405       this.reset();
406       this.open = true;
407       this.titleName = "添加工艺路线子信息";
408     },
409     /** 修改按钮操作 */
410     handleUpdate(row) {
411       this.reset();
412       const id = row.id || this.ids
413       getTechnologyRouteChild(id).then(response => {
414         this.form = response.data;
415         this.open = true;
416         this.titleName = "修改工艺路线子信息";
417       });
418     },
419     /** 提交按钮 */
420     submitForm() {
421       this.form.routeCode = this.queryRouteCode;
422       this.form.routeId =  this.queryRouteId;
423       this.$refs["form"].validate(valid => {
424         if (valid) {
425           if (this.form.id != null) {
426             updateTechnologyRouteChild(this.form).then(response => {
427               this.$modal.msgSuccess("修改成功");
428               this.open = false;
429               this.getList();
430             });
431           } else {
432             addTechnologyRouteChild(this.form).then(response => {
433               this.$modal.msgSuccess("新增成功");
434               this.open = false;
435               this.getList();
436             });
437           }
438         }
439       });
440     },
441     /** 删除按钮操作 */
442     handleDelete(row) {
443       const ids = row.id || this.ids;
444       this.$modal.confirm('是否确认删除工艺路线子信息编号为"' + ids + '"的数据项?').then(function() {
445         return delTechnologyRouteChild(ids);
446       }).then(() => {
447         this.getList();
448         this.$modal.msgSuccess("删除成功");
449       }).catch(() => {});
450     },
451     /** 导出按钮操作 */
452     handleExport() {
453       this.download('bs/technologyRouteChild/export', {
454         ...this.queryParams
455       }, `technologyRouteChild_${new Date().getTime()}.xlsx`)
456     }
457   }
458 };
459 </script>