hdy
2023-12-25 f2a092218ece0821351440331c90064c8cbd5241
提交 | 用户 | 时间
83806e 1 <template>
2   <div class="app-container">
79a2ad 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">
f8b108 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>
79a2ad 30         </el-form-item>
10bfb5 31         <el-form-item style="float: right">
79a2ad 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>
83806e 37
79a2ad 38     <el-card style="margin-top: 10px" class="box-card">
39       <el-row :gutter="10" class="mb8">
40         <el-col :span="1.5">
83806e 41           <el-button
79a2ad 42             type="primary"
43             plain
44             icon="el-icon-plus"
83806e 45             size="mini"
79a2ad 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
83806e 54             icon="el-icon-edit"
79a2ad 55             size="mini"
56             :disabled="single"
57             @click="handleUpdate"
83806e 58             v-hasPermi="['bs:technologyRouteChild:edit']"
59           >修改</el-button>
79a2ad 60         </el-col>
61         <el-col :span="1.5">
83806e 62           <el-button
79a2ad 63             type="danger"
64             plain
83806e 65             icon="el-icon-delete"
79a2ad 66             size="mini"
67             :disabled="multiple"
68             @click="handleDelete"
83806e 69             v-hasPermi="['bs:technologyRouteChild:remove']"
70           >删除</el-button>
79a2ad 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>
a04319 123       <el-table v-loading="loading" :width="tableWidth" style="width: auto;" border :data="technologyRouteChildList" @selection-change="handleSelectionChange" v-if="technologyRouteChildList.length > 0">
79a2ad 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">
a04319 133           <template slot-scope="scope">
H 134             <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.keyProcessesFlag"/>
135           </template>
79a2ad 136         </el-table-column>
137         <el-table-column label="创建用户" align="center" prop="createUser">
138         </el-table-column>
10bfb5 139         <el-table-column width="160" :show-overflow-tooltip='true' label="创建时间" align="center" prop="createTime">
79a2ad 140         </el-table-column>
141         <el-table-column label="更改用户" align="center" prop="updateUser">
142         </el-table-column>
10bfb5 143         <el-table-column width="160" :show-overflow-tooltip='true' label="更改时间" align="center" prop="updateTime">
79a2ad 144         </el-table-column>
145         <el-table-column label="备注" align="center" prop="remark">
146         </el-table-column>
10bfb5 147         <el-table-column width="130" :show-overflow-tooltip='true' label="工艺流程编码" align="center" prop="routeCode">
79a2ad 148         </el-table-column>
6f148b 149         <el-table-column fixed="right" label="操作" width="200" align="center" class-name="small-padding fixed-width">
79a2ad 150           <template slot-scope="scope">
151             <el-button
152               size="mini"
a04319 153               type="success"
H 154               plain
155               style="width: 72px"
79a2ad 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"
a04319 162               plain
H 163               style="width: 72px"
164               type="danger"
79a2ad 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>
a04319 172       <el-empty v-else>
H 173         <span slot="description">暂无数据</span>
174       </el-empty>
79a2ad 175     </el-card>
176
83806e 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     <!-- 添加或修改工艺路线子信息对话框 -->
45a2ee 187     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
a04319 188       <span slot="title">
H 189         <i class="el-icon-s-order"></i>
190         {{titleName}}
191       </span>
83806e 192       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
79a2ad 193         <el-form-item label="流程编码">
194           <el-input v-model="queryRouteCode" :disabled="true" />
83806e 195         </el-form-item>
79a2ad 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>-->
83806e 202         <el-form-item label="工序名称" prop="processesName">
79a2ad 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>
83806e 211         </el-form-item>
212         <el-form-item label="加工顺序" prop="stepNo">
213           <el-input v-model="form.stepNo" placeholder="请输入加工顺序" />
214         </el-form-item>
26d131 215 <!--        <el-form-item label="下一道工序" prop="nextProcess">-->
216 <!--          <el-input v-model="form.nextProcess" placeholder="请输入下一道工序" />-->
217 <!--        </el-form-item>-->
10bfb5 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>-->
a04319 231
H 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>
83806e 240         </el-form-item>
10bfb5 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>-->
83806e 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>
79a2ad 260 import { listProcesses} from "@/api/main/bs/processes/processes";
261 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
83806e 262 import { listTechnologyRouteChild, getTechnologyRouteChild, delTechnologyRouteChild, addTechnologyRouteChild, updateTechnologyRouteChild } from "@/api/main/bs/technologyRouteChild/technologyRouteChild";
263
264 export default {
265   name: "TechnologyRouteChild",
a04319 266   dicts: ['sys_yes_no'],
83806e 267   data() {
268     return {
900ee1 269       tableWidth: '100%', // 初始宽度设置为100%
79a2ad 270       options: [],
83806e 271       // 遮罩层
272       loading: true,
a04319 273       titleName: 'test',
83806e 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: "",
79a2ad 288       queryRouteCode: "",
03bb7a 289       queryRouteId: "",
83806e 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,
79a2ad 300       },
301       headerInformationData:{
302         routeCode: "",
303         routeName: "",
304         productCode: "",
305         productName: ""
83806e 306       },
307       // 表单参数
308       form: {},
309       // 表单校验
310       rules: {
311         id: [
312           { required: true, message: "主键id不能为空", trigger: "blur" }
313         ],
a04319 314         stepNo: [
H 315           { required: true, message: "加工工序不能为空", trigger: "blur" }
83806e 316         ],
317       }
318     };
319   },
320   created() {
79a2ad 321     let routeCode = this.$route.query.routeCode;
03bb7a 322     let routeId = this.$route.query.routeId;
79a2ad 323     this.queryParams.routeCode = routeCode
324     this.queryRouteCode = routeCode
03bb7a 325     this.queryRouteId = routeId
83806e 326     this.getList();
79a2ad 327     this.headerInformation();
328     this.getProcesses();
83806e 329   },
330   methods: {
79a2ad 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     },
83806e 342     /** 返回按钮操作 */
343     handleClose() {
c8a732 344       const obj = { path: "/main/pm/technologyRoute" };
83806e 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,
a04319 370         keyProcessesFlag: 'Y',
83806e 371         preparationTime: null,
372         waitTime: null,
373         createUser: null,
374         createTime: null,
375         updateUser: null,
376         updateTime: null,
377         remark: null,
03bb7a 378         routeId: null,
83806e 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;
a04319 407       this.titleName = "添加工艺路线子信息";
83806e 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;
a04319 416         this.titleName = "修改工艺路线子信息";
83806e 417       });
418     },
419     /** 提交按钮 */
420     submitForm() {
79a2ad 421       this.form.routeCode = this.queryRouteCode;
03bb7a 422       this.form.routeId =  this.queryRouteId;
83806e 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>