懒羊羊
2024-04-08 42cfe3f13b09d8b06935fb371fe327387292abc9
提交 | 用户 | 时间
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-width="80" label="生产工单号" prop="workOrderNo">
6         <el-input
7           v-model="queryParams.workOrderNo"
8           placeholder="请输入生产工单号"
9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
13       <el-form-item label="产品名称" prop="productName">
14         <el-input
15           v-model="queryParams.productName"
16           placeholder="请输入产品名称"
17           clearable
18           @keyup.enter.native="handleQuery"
19         />
20       </el-form-item>
21       <el-form-item label="工单状态" prop="orderStatus">
22         <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
23           <el-option
24             v-for="dict in dict.type.order_state"
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 type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
34         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
35       </el-form-item>
36     </el-form>
37     <el-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px">
38       <el-form-item style="margin-left: 14px" label="产品编号" prop="productCode">
39         <el-input
40           v-model="queryParams.productCode"
648160 41           placeholder="请输入产品序列号"
e57a89 42           clearable
43           @keyup.enter.native="handleQuery"
44         />
45       </el-form-item>
46       <el-form-item label="订单编号" prop="salesOrderCode">
47         <el-input
48           v-model="queryParams.salesOrderCode"
49           placeholder="请输入订单编号"
50           clearable
51           @keyup.enter.native="handleQuery"
52         />
53       </el-form-item>
648160 54       <el-form-item label="工厂编号" prop="siteCode">
e57a89 55         <el-input
648160 56           v-model="queryParams.siteCode"
H 57           placeholder="请输入工厂编号"
e57a89 58           clearable
59           @keyup.enter.native="handleQuery"
60         />
61       </el-form-item>
648160 62       <el-form-item label="工站编号" prop="stationCode">
e57a89 63         <el-input
648160 64           v-model="queryParams.stationCode"
H 65           placeholder="请输入工站编号"
e57a89 66           clearable
67           @keyup.enter.native="handleQuery"
68         />
69       </el-form-item>
70     </el-form>
71     </el-card>
72
73     <el-card style="margin-top: 10px" class="box-card">
74     <el-row :gutter="10" class="mb8">
75       <el-col :span="1.5">
76         <el-button
77           type="primary"
78           plain
79           icon="el-icon-plus"
80           size="mini"
81           @click="handleAdd"
82           v-hasPermi="['om:productionOrde:add']"
83         >新增</el-button>
84       </el-col>
85       <el-col :span="1.5">
86         <el-button
87           type="success"
88           plain
89           icon="el-icon-edit"
90           size="mini"
91           :disabled="single"
92           @click="handleUpdate"
93           v-hasPermi="['om:productionOrde:edit']"
94         >修改</el-button>
95       </el-col>
96       <el-col :span="1.5">
97         <el-button
98           type="danger"
99           plain
100           icon="el-icon-delete"
101           size="mini"
102           :disabled="multiple"
103           @click="handleDelete"
104           v-hasPermi="['om:productionOrde:remove']"
105         >删除</el-button>
42cfe3 106         <el-button
107           type="info"
108           icon="el-icon-upload2"
109           size="mini"
110           @click="handleImport"
111         >导入</el-button>
e57a89 112       </el-col>
42cfe3 113       <el-col :span="1.5">
114         <el-button
115           type="warning"
116           plain
117           icon="el-icon-download"
118           size="mini"
119           @click="handleExport"
120           v-hasPermi="['om:productionOrde:export']"
121         >导出</el-button>
122       </el-col>
e57a89 123       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
124     </el-row>
125
126       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
127         <el-table-column type="selection" width="55" align="center" />
128         <el-table-column label="生产工单号" width="160" align="center">
129           <template slot-scope="scope">
130             <router-link :to="{path: '/main/workReport-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
131               <span>{{ scope.row.workOrderNo }}</span>
132             </router-link>
133           </template>
134         </el-table-column>
42cfe3 135 <!--        <el-table-column label="订单编号" width="140" align="center" prop="salesOrderCode">-->
136 <!--        </el-table-column>-->
49c784 137         <el-table-column label="产品编号" width="110" align="center" prop="productCode">
e57a89 138         </el-table-column>
648160 139         <el-table-column label="产品名称" width="120" align="center" prop="productName">
e57a89 140         </el-table-column>
49c784 141         <el-table-column label="产品序列号" width="110" align="center" prop="productNum">
142         </el-table-column>
b64ed2 143         <el-table-column label="产品型号" align="center" prop="productModel">
144         </el-table-column>
648160 145         <el-table-column label="工单状态" width="100" align="center" prop="orderStatus">
e57a89 146           <template slot-scope="scope">
147             <dict-tag :options="dict.type.order_state" :value="scope.row.orderStatus"/>
148           </template>
149         </el-table-column>
42cfe3 150 <!--        <el-table-column label="工厂编号" align="center" prop="siteCode">-->
151 <!--        </el-table-column>-->
648160 152         <el-table-column label="工站编号" align="center" prop="stationCode">
e57a89 153         </el-table-column>
648160 154         <el-table-column label="报工信息结果" width="110" align="center" prop="resultText">
e57a89 155         </el-table-column>
648160 156         <el-table-column label="报工结果代码" width="110" align="center" prop="resultCode">
e57a89 157         </el-table-column>
648160 158         <el-table-column label="是否报工" width="80" align="center" prop="sfResult">
e57a89 159         </el-table-column>
160         <el-table-column label="实际开始时间" width="160" align="center" prop="actualStartTime">
161         </el-table-column>
648160 162         <el-table-column label="当前站点报工时间" width="160" align="center" prop="actualEndTime">
e57a89 163         </el-table-column>
164         <el-table-column label="创建人" width="80" align="center" prop="createUser">
165         </el-table-column>
166         <el-table-column label="备注" width="100" align="center" prop="remarks">
167         </el-table-column>
168       </el-table>
169     </el-card>
170
171
172     <pagination
173       v-show="total>0"
174       :total="total"
175       :page.sync="queryParams.pageNum"
176       :limit.sync="queryParams.pageSize"
177       @pagination="getList"
178     />
179
180     <!-- 添加或修改生产工单对话框 -->
648160 181     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
e57a89 182        <span slot="title">
183         <i class="el-icon-s-order"></i>
184         {{titleName}}
185       </span>
648160 186       <el-form ref="form" inline :model="form" :rules="rules" label-width="100px">
H 187         <el-form-item label="生产工单号" prop="workOrderNo">
188           <el-input style="width: 265px" v-model="form.workOrderNo" placeholder="请输入生产工单号" />
e57a89 189         </el-form-item>
190         <el-form-item label="订单编号" prop="salesOrderCode">
648160 191           <el-input style="width: 265px" v-model="form.salesOrderCode" placeholder="请输入订单编号" />
e57a89 192         </el-form-item>
648160 193         <el-form-item label="产品序列号" prop="productNum">
e57a89 194           <el-input v-model="form.productCode" placeholder="请选择产品" >
195             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
196           </el-input>
197           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
198         </el-form-item>
199         <el-form-item label="产品名称" prop="productName">
648160 200           <el-input style="width: 265px" v-model="form.productName" disabled placeholder="请输入产品名称" />
e57a89 201         </el-form-item>
b64ed2 202         <el-form-item label="产品型号" prop="productModel">
203           <el-input v-model="form.productModel" placeholder="请输入产品型号" />
204         </el-form-item>
648160 205         <el-form-item label="工厂编号" prop="siteCode">
H 206           <el-input style="width: 265px" v-model="form.siteCode" placeholder="请输入工厂编号" />
e57a89 207         </el-form-item>
648160 208         <el-form-item label="工站编号" prop="stationCode">
H 209           <el-input style="width: 265px"v-model="form.stationCode" placeholder="请输入工站编号" />
e57a89 210         </el-form-item>
648160 211         <el-form-item label="备注" prop="remarks">
H 212           <el-input style="width: 265px" v-model="form.remarks" placeholder="请输入备注" />
e57a89 213         </el-form-item>
214
215       </el-form>
216       <div slot="footer" class="dialog-footer">
217         <el-button type="primary" @click="submitForm">确 定</el-button>
218         <el-button @click="cancel">取 消</el-button>
219       </div>
220     </el-dialog>
221
42cfe3 222     <!-- 用户导入对话框 -->
223     <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
224       <el-upload
225         ref="upload"
226         :limit="1"
227         accept=".xlsx, .xls"
228         :headers="upload.headers"
229         :action="upload.url + '?updateSupport=' + upload.updateSupport"
230         :disabled="upload.isUploading"
231         :on-progress="handleFileUploadProgress"
232         :on-success="handleFileSuccess"
233         :auto-upload="false"
234         drag
235       >
236         <i class="el-icon-upload"></i>
237         <div class="el-upload__text">
238           将文件拖到此处,或
239           <em>点击上传</em>
240         </div>
241         <div class="el-upload__tip" slot="tip">
242           <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
243           <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
244         </div>
245         <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
246       </el-upload>
247       <div slot="footer" class="dialog-footer">
248         <el-button type="primary" @click="submitFileForm">确 定</el-button>
249         <el-button @click="upload.open = false">取 消</el-button>
250       </div>
251     </el-dialog>
252
e57a89 253   </div>
254 </template>
255
256 <script>
42cfe3 257 import { getToken } from "@/utils/auth";
e57a89 258 import { listLineInfo } from "@/api/main/bs/lineInfo/lineInfo";
259 import { listWorkshop } from "@/api/main/bs/workshop/workshop";
260 import { listProductBom } from "@/api/main/bs/ProductBom/ProductBom";
261 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
262 import ItemSelect  from "@/components/itemSelect/single.vue";
42cfe3 263 import { importTemplate, upDownMove, listProductionOrde, getProductionOrde, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
e57a89 264
265 export default {
266   name: "ProductionOrde",
267   dicts: ['order_state'],
268   components: {
269     ItemSelect ,
270   },
271   data() {
272     return {
273       titleName: '',
274       options: [],
275       lineOptions: [],
276       showFlag:false,
277       advancedShowSearch: false,
278       workOrder: {
279         status: 'ss'
280       },
281       // 遮罩层
282       loading: true,
283       // 选中数组
284       ids: [],
285       // 非单个禁用
286       single: true,
287       // 非多个禁用
288       multiple: true,
289       move: true,
290       selectedRowIndex: -1, // 存储选中行的索引
291       // 显示搜索条件
292       showSearch: true,
293       // 总条数
294       total: 0,
295       // 生产工单表格数据
296       productionOrdeList: [],
297       // 弹出层标题
298       title: "",
299       // 是否显示弹出层
300       open: false,
301       // 查询参数
302       queryParams: {
303         pageNum: 1,
304         pageSize: 10,
305         workOrderNo: null,
306         salesOrderCode: null,
307         productCode: null,
308         productName: null,
309         workshopCode: null,
310         lineCode: null,
311         routeCode: null,
312         bomCode: null,
313         recipeCode: null,
314         orderStatus: null,
315         custom: null,
316         marketAreaCode: null,
317         softwareVersionCode: null,
318         productCompanyCode: null,
319         frontEndId: 0,
320         idNums: null,
321         flag: null,
b64ed2 322         siteCode: null,
323         productNum: null,
324         stationCode: null,
325         resultText: null,
326         resultCode: null,
327         sfResult: null,
328         productModel: null
329
e57a89 330       },
331       // 表单参数
332       form: {},
333       updateStatusParameter: {
334         id: null,
335         orderStatus: null
336       },
337       // 表单校验
338       rules: {
339         id: [
340           { required: true, message: "ID不能为空", trigger: "blur" }
341         ],
42cfe3 342       },
343       // 用户导入参数
344       upload: {
345         // 是否显示弹出层(用户导入)
346         open: false,
347         // 弹出层标题(用户导入)
348         title: "",
349         // 是否禁用上传
350         isUploading: false,
351         // 是否更新已经存在的用户数据
352         updateSupport: 0,
353         // 设置上传的请求头部
354         headers: { Authorization: "Bearer " + getToken() },
355         // 上传的地址
356         url: process.env.VUE_APP_BASE_API + "/om/productionOrde/importData"
357       },
e57a89 358     };
359   },
360   created() {
361     this.getList();
362     this.initWorkshop();
363   },
364   methods: {
42cfe3 365     /** 导入按钮操作 */
366     handleImport() {
367       this.upload.title = "订单信息导入";
368       this.upload.open = true;
369     },
370     /** 下载模板操作 */
371     importTemplate() {
372       this.download('om/productionOrde/importTemplate', {
373       }, `productionOrde_template_${new Date().getTime()}.xlsx`)
374     },
375 // 文件上传中处理
376     handleFileUploadProgress(event, file, fileList) {
377       this.upload.isUploading = true;
378     },
379 // 文件上传成功处理
380     handleFileSuccess(response, file, fileList) {
381       this.upload.open = false;
382       this.upload.isUploading = false;
383       this.$refs.upload.clearFiles();
384       this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
385       this.getList();
386     },
387 // 提交上传文件
388     submitFileForm() {
389       this.$refs.upload.submit();
e57a89 390     },
391     initWorkshop(){
392       listWorkshop(this.queryParams).then(response => {
393         this.options = response.rows;
394       });
395     },
396     // 在这里编写处理选中事件的逻辑
397     handleSelectChange(selectedOption) {
398       this.form.lineCode = null;
399       let params = {
400         workshopCode: selectedOption
401       };
402       listLineInfo(params).then(response => {
403         this.lineOptions = response.rows;
404       });
405     },
406     //物料选择弹出框
407     onItemSelected(obj){
408       if(obj !== undefined && obj !== null){
409         let productCode = obj.materialCode;
410         this.form.productCode = productCode;
411         this.form.productName = obj.materialName;
412         this.queryParams.productCode = productCode
413         listTechnologyRoute(this.queryParams).then(response => {
414           this.form.routeCode = response.rows[0].routeCode;
415         });
416         listProductBom(this.queryParams).then(response => {
417           this.form.bomCode = response.rows[0].bomCode;
418         });
419       }
420     },
421     handleSelectProduct(){
422       this.$refs.itemSelect.showFlag = true;
423     },
424     advancedQuery(){
425       this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true;
426     },
427     handleCommand(status,id) {
428       console.log(status)
429       this.updateStatusParameter.id = id;
430       this.updateStatusParameter.orderStatus = status;
431       updateProductionOrde(this.updateStatusParameter).then(response => {
432         this.$modal.msgSuccess("修改成功");
433         this.open = false;
434         this.getList();
435       });
436     },
437     /** 查询生产工单列表 */
438     getList() {
439       this.loading = true;
440       listProductionOrde(this.queryParams).then(response => {
441         this.productionOrdeList = response.rows;
442         this.total = response.total;
443         this.loading = false;
444       });
445     },
446     // 取消按钮
447     cancel() {
448       this.open = false;
449       this.reset();
450     },
451     // 表单重置
452     reset() {
453       this.form = {
454         id: null,
455         workOrderNo: null,
456         salesOrderCode: null,
457         productCode: null,
458         productName: null,
459         workshopCode: null,
460         lineCode: null,
461         routeCode: null,
462         bomCode: null,
463         recipeCode: null,
464         planQty: null,
465         actualQty: null,
466         badQty: null,
467         scrapQty: null,
468         repairQty: null,
469         actualOnlineQty: null,
470         onlineCompletionMark: null,
471         demandDate: null,
472         planStartTime: null,
473         planEndTime: null,
474         actualStartTime: null,
475         actualEndTime: null,
476         serialNumber: null,
477         orderStatus: null,
478         createTime: null,
479         updateTime: null,
480         createUser: null,
481         updateUser: null,
482         remarks: null,
483         streamNumber: null,
484         custom: null,
485         marketAreaCode: null,
486         softwareVersionCode: null,
487         productCompanyCode: null,
488         spareField1: null,
489         spareField2: null,
490         spareField3: null,
648160 491         spareField4: null,
H 492         siteCode: null,
493         productNum: null,
494         stationCode: null,
495         resultText: null,
496         resultCode: null,
497         sfResult: null
e57a89 498       };
499       this.resetForm("form");
500     },
501     /** 搜索按钮操作 */
502     handleQuery() {
503       this.queryParams.pageNum = 1;
504       this.getList();
505     },
506     /** 重置按钮操作 */
507     resetQuery() {
508       this.resetForm("queryForm");
509       this.handleQuery();
510     },
511     // 多选框选中数据
512     handleSelectionChange(selection) {
513       this.ids = selection.map(item => item.id)
514       this.move = selection.length!==1
515       if(!selection.length){
516         this.single = true
517         this.multiple = true
518       }else {
519         if(selection[0].orderStatus === '1' && selection.length === 1){
520           this.single = false
521           this.multiple = false
522         }
523       }
524
525     },
526     /** 新增按钮操作 */
527     handleAdd() {
528       this.initWorkshop();
529       this.reset();
530       this.open = true;
531       this.titleName = "添加生产工单";
532     },
533     /** 修改按钮操作 */
534     handleUpdate(row) {
535       this.initWorkshop();
536       this.reset();
537       const id = row.id || this.ids
538       getProductionOrde(id).then(response => {
539         console.log(response.data)
540         this.form = response.data;
541         this.open = true;
542         this.titleName = "修改生产工单";
543       });
544     },
545     /** 提交按钮 */
546     submitForm() {
547       this.$refs["form"].validate(valid => {
548         if (valid) {
549           if (this.form.id != null) {
550             updateProductionOrde(this.form).then(response => {
551               this.$modal.msgSuccess("修改成功");
552               this.open = false;
553               this.getList();
554             });
555           } else {
556             addProductionOrde(this.form).then(response => {
557               this.$modal.msgSuccess("新增成功");
558               this.open = false;
559               this.getList();
560             });
561           }
562         }
563       });
564     },
565     /** 删除按钮操作 */
566     handleDelete(row) {
567       const ids = row.id || this.ids;
568       this.$modal.confirm('是否确认删除生产工单编号为"' + ids + '"的数据项?').then(function() {
569         return delProductionOrde(ids);
570       }).then(() => {
571         this.getList();
572         this.$modal.msgSuccess("删除成功");
573       }).catch(() => {});
574     },
575     /** 导出按钮操作 */
576     handleExport() {
577       this.download('om/productionOrde/export', {
578         ...this.queryParams
579       }, `productionOrde_${new Date().getTime()}.xlsx`)
580     }
581   }
582 };
583 </script>
584 <style lang="scss" scoped>
585 //::v-deep .el-dialog__header{
586 //  /*background-color: #f8f8f8;*/
587 //  background-color: #f8f8f9;
588 //}
589 </style>