cl
2024-08-14 14c14e667512e859fc33554339171417028f2e09
提交 | 用户 | 时间
b78728 1 <template>
A 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="productCode">
14         <el-input
15           v-model="queryParams.productCode"
16           placeholder="请输入产品编码"
17           clearable
18           @keyup.enter.native="handleQuery"
19         />
20       </el-form-item>
21       <el-form-item label-width="80" label="PACK码" prop="productNum">
22         <el-input
23           v-model="queryParams.productNum"
24           placeholder="请输入PACK码"
25           clearable
26           @keyup.enter.native="handleQuery"
27         />
28       </el-form-item>
29       <el-form-item label="小车码" prop="trolleyYard">
30         <el-input
31           v-model="queryParams.trolleyYard"
32           placeholder="请输入小车码"
33           clearable
34           @keyup.enter.native="handleQuery"
35         />
36       </el-form-item>
37       <el-form-item label-width="1" label="上线报工状态" prop="onlineCompletionMark">
38         <el-select v-model="queryParams.onlineCompletionMark" placeholder="请选择上线报工状态" clearable>
39           <el-option
40             v-for="dict in dict.type.work_reporting_status"
41             :key="dict.value"
42             :label="dict.label"
43             :value="dict.value"
44           />
45         </el-select>
46       </el-form-item>
47       <el-form-item label-width="1" label="下线报工状态" prop="sfResult">
48         <el-select v-model="queryParams.sfResult" placeholder="请选择下线报工状态" clearable>
49           <el-option
50             v-for="dict in dict.type.work_reporting_status"
51             :key="dict.value"
52             :label="dict.label"
53             :value="dict.value"
54           />
55         </el-select>
56       </el-form-item>
57
58       <div style="display: none">
59         <div id="printMe" style="width: 500px;">
60           <div ref="canvasWrapper" id="canvasWrapper" style="display: flex;justify-content: center;"></div>
61           <p style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;">{{packCode}}</p>
62         </div>
63         <el-button @click="print">打印</el-button>
64         <el-button @click="test1">生成二维码</el-button>
65       </div>
66       <el-form-item style="float: right">
67         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
68         <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
69         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
70       </el-form-item>
71     </el-form>
72     <el-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px">
73       <el-form-item style="margin-left: 14px" label="产品编号" prop="productCode">
74         <el-input
75           v-model="queryParams.productCode"
76           placeholder="请输入产品序列号"
77           clearable
78           @keyup.enter.native="handleQuery"
79         />
80       </el-form-item>
81       <el-form-item label="订单编号" prop="salesOrderCode">
82         <el-input
83           v-model="queryParams.salesOrderCode"
84           placeholder="请输入订单编号"
85           clearable
86           @keyup.enter.native="handleQuery"
87         />
88       </el-form-item>
89       <el-form-item label="工厂编号" prop="siteCode">
90         <el-input
91           v-model="queryParams.siteCode"
92           placeholder="请输入工厂编号"
93           clearable
94           @keyup.enter.native="handleQuery"
95         />
96       </el-form-item>
97       <el-form-item label="工站编号" prop="stationCode">
98         <el-input
99           v-model="queryParams.stationCode"
100           placeholder="请输入工站编号"
101           clearable
102           @keyup.enter.native="handleQuery"
103         />
104       </el-form-item>
105     </el-form>
106     </el-card>
107
108     <el-card style="margin-top: 10px" class="box-card">
109     <el-row :gutter="10" class="mb8">
110 <!--      <el-col :span="1.5">-->
111 <!--        <el-button-->
112 <!--          type="primary"-->
113 <!--          plain-->
114 <!--          icon="el-icon-plus"-->
115 <!--          size="mini"-->
116 <!--          @click="handleAdd"-->
117 <!--          v-hasPermi="['om:productionOrde:add']"-->
118 <!--        >新增</el-button>-->
119 <!--      </el-col>-->
120 <!--      <el-col :span="1.5">-->
121 <!--        <el-button-->
122 <!--          type="success"-->
123 <!--          plain-->
124 <!--          icon="el-icon-edit"-->
125 <!--          size="mini"-->
126 <!--          :disabled="single"-->
127 <!--          @click="handleUpdate"-->
128 <!--          v-hasPermi="['om:productionOrde:edit']"-->
129 <!--        >修改</el-button>-->
130 <!--      </el-col>-->
131 <!--      <el-col :span="1.5">-->
132 <!--&lt;!&ndash;        <el-button&ndash;&gt;-->
133 <!--&lt;!&ndash;          type="danger"&ndash;&gt;-->
134 <!--&lt;!&ndash;          plain&ndash;&gt;-->
135 <!--&lt;!&ndash;          icon="el-icon-delete"&ndash;&gt;-->
136 <!--&lt;!&ndash;          size="mini"&ndash;&gt;-->
137 <!--&lt;!&ndash;          :disabled="multiple"&ndash;&gt;-->
138 <!--&lt;!&ndash;          @click="handleDelete"&ndash;&gt;-->
139 <!--&lt;!&ndash;          v-hasPermi="['om:productionOrde:remove']"&ndash;&gt;-->
140 <!--&lt;!&ndash;        >删除</el-button>&ndash;&gt;-->
141 <!--        <el-button-->
142 <!--          type="info"-->
143 <!--          icon="el-icon-upload2"-->
144 <!--          size="mini"-->
145 <!--          @click="handleImport"-->
146 <!--        >导入</el-button>-->
147 <!--      </el-col>-->
148 <!--      <el-col :span="1.5">-->
149 <!--        <el-button-->
150 <!--          type="warning"-->
151 <!--          plain-->
152 <!--          icon="el-icon-download"-->
153 <!--          size="mini"-->
154 <!--          @click="handleExport"-->
155 <!--          v-hasPermi="['om:productionOrde:export']"-->
156 <!--        >导出</el-button>-->
157 <!--      </el-col>-->
158       <el-col :span="1.5">
159         <el-button
160           type="warning"
161           plain
162           icon="el-icon-download"
163           size="mini"
164           @click="getWorkOrders"
165         >接收</el-button>
166       </el-col>
167       <el-col :span="1.5">
168         <el-button
169           type="warning"
170           plain
171           icon="el-icon-download"
172           size="mini"
173           :disabled="single"
174           @click="patchwork"
175         >补打</el-button>
176       </el-col>
177       <el-col :span="1.5">
178         <el-button
179           type="warning"
180           plain
181           icon="el-icon-download"
182           size="mini"
183           :disabled="onlineSingle"
184           @click="onlineWorkReporting"
185         >上线报工</el-button>
186       </el-col>
187       <el-col :span="1.5">
188         <el-button
189           type="warning"
190           plain
191           icon="el-icon-download"
192           size="mini"
193           :disabled="offlineSingle"
194           @click="offlineWorkReporting"
195         >下线报工</el-button>
196       </el-col>
197 <!--      <el-col :span="1.5">-->
198 <!--        <el-button-->
199 <!--          type="warning"-->
200 <!--          plain-->
201 <!--          icon="el-icon-download"-->
202 <!--          size="mini"-->
203 <!--          :disabled="single"-->
204 <!--          @click="jieBang"-->
205 <!--        >解绑</el-button>-->
206 <!--      </el-col>-->
207       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
208     </el-row>
209
210       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
211         <el-table-column type="selection" width="55" align="center" />
212 <!--        <el-table-column label="生产工单号" width="160" align="center">-->
213 <!--          <template slot-scope="scope">-->
214 <!--            <router-link :to="{path: '/main/workReport-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">-->
215 <!--              <span>{{ scope.row.workOrderNo }}</span>-->
216 <!--            </router-link>-->
217 <!--          </template>-->
218 <!--        </el-table-column>-->
8bab65 219
b78728 220 <!--        <el-table-column label="订单编号" width="140" align="center" prop="salesOrderCode">-->
A 221 <!--        </el-table-column>-->
14c14e 222         <el-table-column :show-overflow-tooltip='true' label="产品序列号" width="200" align="center" prop="productNum">
b78728 223         </el-table-column>
8bab65 224         <el-table-column label="生产工单号" width="160" align="center" prop="workOrderNo">
b78728 225         </el-table-column>
14c14e 226         <el-table-column :show-overflow-tooltip='true' label="壳体条码" width="250" align="center" prop="trolleyYard">
8bab65 227         </el-table-column>
C 228         <el-table-column label="产品编码" width="110" align="center" prop="productCode">
229         </el-table-column>
230         <el-table-column label="物料编码" width="110" align="center" prop="materialCode">
231         </el-table-column>
232         <el-table-column  label="工单状态" align="center" prop="orderStatus">
b78728 233         </el-table-column>
A 234         <el-table-column label="产品名称" width="120" align="center" prop="productName">
235         </el-table-column>
14c14e 236         <el-table-column label="开始时间" width="160" align="center" prop="actualStartTime">
8bab65 237         </el-table-column>
14c14e 238         <el-table-column label="结束时间" width="160" align="center" prop="actualEndTime">
8bab65 239         </el-table-column>
14c14e 240 <!--        <el-table-column label="上线是否报工" align="center" width="120">
b78728 241           <template slot-scope="scope">
8bab65 242             <dict-tag :options="dict.type.work_reporting_status" :value="scope.row.onlineCompletionMark"/>
b78728 243           </template>
A 244         </el-table-column>
245         <el-table-column label="下线是否报工" width="120" align="center">
246           <template slot-scope="scope">
247             <dict-tag :options="dict.type.work_reporting_status" :value="scope.row.sfResult"/>
248           </template>
14c14e 249         </el-table-column>-->
8bab65 250         <el-table-column label="创建时间" width="160" align="center" prop="createTime">
C 251         </el-table-column>
b78728 252 <!--        <el-table-column width="240" fixed="right" label="操作" align="center" class-name="small-padding fixed-width">-->
A 253 <!--          <template slot-scope="scope">-->
254 <!--            <el-button-->
255 <!--              size="mini"-->
256 <!--              type="success"-->
257 <!--              plain-->
258 <!--              style="width: 72px"-->
259 <!--              @click="onlineWorkReporting(scope.row)"-->
260 <!--              :disabled="isEditDisabled(scope.row.onlineCompletionMark)"-->
261 <!--            >上线报工</el-button>-->
262 <!--            <el-button-->
263 <!--              size="mini"-->
264 <!--              plain-->
265 <!--              style="width: 72px"-->
266 <!--              type="danger"-->
267 <!--              @click="offlineWorkReporting(scope.row)"-->
268 <!--              :disabled="isEditDisabled(scope.row.sfResult)"-->
269 <!--            >下线报工</el-button>-->
270 <!--          </template>-->
271 <!--        </el-table-column>-->
272       </el-table>
273     </el-card>
274
275
276     <pagination
277       v-show="total>0"
278       :total="total"
279       :page.sync="queryParams.pageNum"
280       :limit.sync="queryParams.pageSize"
281       @pagination="getList"
282     />
283
284     <!-- 添加或修改生产工单对话框 -->
285     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
286        <span slot="title">
287         <i class="el-icon-s-order"></i>
288         {{titleName}}
289       </span>
290       <el-form ref="form" inline :model="form" :rules="rules" label-width="100px">
291         <el-form-item label="生产工单号" prop="workOrderNo">
292           <el-input style="width: 265px" v-model="form.workOrderNo" placeholder="请输入生产工单号" />
293         </el-form-item>
294         <el-form-item label="订单编号" prop="salesOrderCode">
295           <el-input style="width: 265px" v-model="form.salesOrderCode" placeholder="请输入订单编号" />
296         </el-form-item>
297         <el-form-item label="产品序列号" prop="productNum">
298           <el-input v-model="form.productCode" placeholder="请选择产品" >
299             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
300           </el-input>
301           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
302         </el-form-item>
303         <el-form-item label="产品名称" prop="productName">
304           <el-input style="width: 265px" v-model="form.productName" disabled placeholder="请输入产品名称" />
305         </el-form-item>
306         <el-form-item label="产品型号" prop="productModel">
307           <el-input v-model="form.productModel" placeholder="请输入产品型号" />
308         </el-form-item>
309         <el-form-item label="工厂编号" prop="siteCode">
310           <el-input style="width: 265px" v-model="form.siteCode" placeholder="请输入工厂编号" />
311         </el-form-item>
312         <el-form-item label="工站编号" prop="stationCode">
313           <el-input style="width: 265px"v-model="form.stationCode" placeholder="请输入工站编号" />
314         </el-form-item>
315         <el-form-item label="备注" prop="remarks">
316           <el-input style="width: 265px" v-model="form.remarks" placeholder="请输入备注" />
317         </el-form-item>
318
319       </el-form>
320       <div slot="footer" class="dialog-footer">
321         <el-button type="primary" @click="submitForm">确 定</el-button>
322         <el-button @click="cancel">取 消</el-button>
323       </div>
324     </el-dialog>
325
326     <!-- 用户导入对话框 -->
327     <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
328       <el-upload
329         ref="upload"
330         :limit="1"
331         accept=".xlsx, .xls"
332         :headers="upload.headers"
333         :action="upload.url + '?updateSupport=' + upload.updateSupport"
334         :disabled="upload.isUploading"
335         :on-progress="handleFileUploadProgress"
336         :on-success="handleFileSuccess"
337         :auto-upload="false"
338         drag
339       >
340         <i class="el-icon-upload"></i>
341         <div class="el-upload__text">
342           将文件拖到此处,或
343           <em>点击上传</em>
344         </div>
345         <div class="el-upload__tip" slot="tip">
346           <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
347           <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
348         </div>
349         <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
350       </el-upload>
351       <div slot="footer" class="dialog-footer">
352         <el-button type="primary" @click="submitFileForm">确 定</el-button>
353         <el-button @click="upload.open = false">取 消</el-button>
354       </div>
355     </el-dialog>
356
357   </div>
358 </template>
359
360 <script>
361 import { getToken } from "@/utils/auth";
362 import { listLineInfo } from "@/api/main/bs/lineInfo/lineInfo";
363 import { listWorkshop } from "@/api/main/bs/workshop/workshop";
364 import {getProductBom, listProductBom} from "@/api/main/bs/ProductBom/ProductBom";
365 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
366 import ItemSelect  from "@/components/itemSelect/single.vue";
367 import {
368   importTemplate,
369   upDownMove,
370   listProductionOrde,
371   getProductionOrde,
372   delProductionOrde,
373   addProductionOrde,
374   updateProductionOrde,
375   receivingWorkOrders, jieBang, workReportingByStation
376 } from "@/api/main/om/productionOrde/productionOrde";
377 import QRCode from "qrcodejs2";
378
379 export default {
380   name: "ProductionOrde",
381   dicts: ['order_state','work_reporting_status'],
382   components: {
383     ItemSelect ,
384   },
385   data() {
386     return {
387       // packCode: '0RSPB001139E3AE4X0000011',
388       packCode: 'test111',
389       titleName: '',
390       options: [],
391       lineOptions: [],
392       showFlag:false,
393       advancedShowSearch: false,
394       workOrder: {
395         status: 'ss'
396       },
397       // 遮罩层
398       loading: true,
399       // 选中数组
400       ids: [],
401       // 非单个禁用
402       single: true,
403       onlineSingle: true,
404       offlineSingle: true,
405       // 非多个禁用
406       multiple: true,
407       move: true,
408       selectedRowIndex: -1, // 存储选中行的索引
409       // 显示搜索条件
410       showSearch: true,
411       // 总条数
412       total: 0,
413       // 生产工单表格数据
414       productionOrdeList: [],
415       // 弹出层标题
416       title: "",
417       // 是否显示弹出层
418       open: false,
419       // 查询参数
420       queryParams: {
421         pageNum: 1,
422         pageSize: 10,
423         workOrderNo: null,
424         salesOrderCode: null,
425         productCode: null,
426         productName: null,
427         workshopCode: null,
428         lineCode: null,
429         routeCode: null,
430         bomCode: null,
431         recipeCode: null,
432         orderStatus: null,
433         custom: null,
434         marketAreaCode: null,
435         softwareVersionCode: null,
436         productCompanyCode: null,
437         frontEndId: 0,
438         idNums: null,
439         flag: null,
440         siteCode: null,
441         productNum: null,
442         stationCode: null,
443         resultText: null,
444         resultCode: null,
445         sfResult: null,
446         productModel: null
447
448       },
449       // 表单参数
450       form: {},
451       updateStatusParameter: {
452         id: null,
453         orderStatus: null
454       },
455       // 表单校验
456       rules: {
457         id: [
458           { required: true, message: "ID不能为空", trigger: "blur" }
459         ],
460       },
461       // 用户导入参数
462       upload: {
463         // 是否显示弹出层(用户导入)
464         open: false,
465         // 弹出层标题(用户导入)
466         title: "",
467         // 是否禁用上传
468         isUploading: false,
469         // 是否更新已经存在的用户数据
470         updateSupport: 0,
471         // 设置上传的请求头部
472         headers: { Authorization: "Bearer " + getToken() },
473         // 上传的地址
474         url: process.env.VUE_APP_BASE_API + "/om/productionOrde/importData"
475       },
476     };
477   },
478   created() {
479     this.getList();
480     this.initWorkshop();
481   },
482   mounted() {
483     this.test1()
484   },
485   methods: {
486     onlineWorkReporting(row){
487       const id = row.id || this.ids
488       const stationCode = "OP230"
489       workReportingByStation(id,stationCode).then(response => {
490         this.getList()
491       });
492     },
493     offlineWorkReporting(row){
494       const id = row.id || this.ids
495       const stationCode = "OP500"
496       workReportingByStation(id,stationCode).then(response => {
497         this.getList()
498       });
499     },
500     jieBang(row){
501       const id = row.id || this.ids
502       jieBang(id).then(response => {
503         this.getList()
504         this.$modal.msgSuccess("解绑成功");
505       });
506     },
507     patchwork(row){
508       const id = row.id || this.ids
509       getProductionOrde(id).then(response => {
510         console.log(response.data)
511         this.packCode = response.data.productNum
512         console.log(this.packCode)
513         this.test1()
514         setTimeout(() => {
515           this.print()
516         },50)
517       });
518     },
519     async getWorkOrders(){
520       await receivingWorkOrders().then(response => {
521         this.getList()
522         this.packCode = response.msg;
523         this.test1()
524       });
525       setTimeout(() => {
526         this.print()
527       },50)
528     },
529      print() {
530       // 本页面直接打印(有bug单岁先不要删)
531       // let oldStr = window.document.body.innerHTML;
532       // let newStr = document.getElementById('printMe').innerHTML;
533       // document.body.innerHTML = newStr;
534       // window.print();
535       // document.body.innerHTML = oldStr;
536       // return false;
537
538       // 新开页面打印
539       //  document.getElementById('canvasWrapper').innerHTML = '';
540       let newStr = document.getElementById('printMe').innerHTML;
541       let newWin = window.open('', '_blank');
542       newWin.document.body.innerHTML = newStr;
543       newWin.print();
544       return false;
545     },
546     test1(){
547       document.getElementById('canvasWrapper').innerHTML = ''
548       this.$nextTick(() => {
549         let qrCode = new QRCode('canvasWrapper',{
550           width: 80,
551           height: 80,
552           padding: 0,
553           margin: 0,
554           text: this.packCode,
555           colorDark: '#000',
556           colorLight: '#fff'
557         })
558       })
559       // console.log(this.packCode)
560       // this.print()
561     },
562     /** 导入按钮操作 */
563     handleImport() {
564       this.upload.title = "订单信息导入";
565       this.upload.open = true;
566     },
567     /** 下载模板操作 */
568     importTemplate() {
569       this.download('om/productionOrde/importTemplate', {
570       }, `productionOrde_template_${new Date().getTime()}.xlsx`)
571     },
572 // 文件上传中处理
573     handleFileUploadProgress(event, file, fileList) {
574       this.upload.isUploading = true;
575     },
576 // 文件上传成功处理
577     handleFileSuccess(response, file, fileList) {
578       this.upload.open = false;
579       this.upload.isUploading = false;
580       this.$refs.upload.clearFiles();
581       this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
582       this.getList();
583     },
584 // 提交上传文件
585     submitFileForm() {
586       this.$refs.upload.submit();
587     },
588     initWorkshop(){
589       listWorkshop(this.queryParams).then(response => {
590         this.options = response.rows;
591       });
592     },
593     // 在这里编写处理选中事件的逻辑
594     handleSelectChange(selectedOption) {
595       this.form.lineCode = null;
596       let params = {
597         workshopCode: selectedOption
598       };
599       listLineInfo(params).then(response => {
600         this.lineOptions = response.rows;
601       });
602     },
603     //物料选择弹出框
604     onItemSelected(obj){
605       if(obj !== undefined && obj !== null){
606         let productCode = obj.materialCode;
607         this.form.productCode = productCode;
608         this.form.productName = obj.materialName;
609         this.queryParams.productCode = productCode
610         listTechnologyRoute(this.queryParams).then(response => {
611           this.form.routeCode = response.rows[0].routeCode;
612         });
613         listProductBom(this.queryParams).then(response => {
614           this.form.bomCode = response.rows[0].bomCode;
615         });
616       }
617     },
618     handleSelectProduct(){
619       this.$refs.itemSelect.showFlag = true;
620     },
621     advancedQuery(){
622       this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true;
623     },
624     handleCommand(status,id) {
625       console.log(status)
626       this.updateStatusParameter.id = id;
627       this.updateStatusParameter.orderStatus = status;
628       updateProductionOrde(this.updateStatusParameter).then(response => {
629         this.$modal.msgSuccess("修改成功");
630         this.open = false;
631         this.getList();
632       });
633     },
634     /** 查询生产工单列表 */
635     getList() {
636       this.loading = true;
637       listProductionOrde(this.queryParams).then(response => {
638         this.productionOrdeList = response.rows;
639         this.total = response.total;
640         this.loading = false;
641       });
642     },
643     // 取消按钮
644     cancel() {
645       this.open = false;
646       this.reset();
647     },
648     // 表单重置
649     reset() {
650       this.form = {
651         id: null,
652         workOrderNo: null,
653         salesOrderCode: null,
654         productCode: null,
655         productName: null,
656         workshopCode: null,
657         lineCode: null,
658         routeCode: null,
659         bomCode: null,
660         recipeCode: null,
661         planQty: null,
662         actualQty: null,
663         badQty: null,
664         scrapQty: null,
665         repairQty: null,
666         actualOnlineQty: null,
667         onlineCompletionMark: null,
668         demandDate: null,
669         planStartTime: null,
670         planEndTime: null,
671         actualStartTime: null,
672         actualEndTime: null,
673         serialNumber: null,
674         orderStatus: null,
675         createTime: null,
676         updateTime: null,
677         createUser: null,
678         updateUser: null,
679         remarks: null,
680         streamNumber: null,
681         custom: null,
682         marketAreaCode: null,
683         softwareVersionCode: null,
684         productCompanyCode: null,
685         trolleyYard: null,
686         spareField2: null,
687         spareField3: null,
688         spareField4: null,
689         siteCode: null,
690         productNum: null,
691         stationCode: null,
692         resultText: null,
693         resultCode: null,
694         sfResult: null
695       };
696       this.resetForm("form");
697     },
698     /** 搜索按钮操作 */
699     handleQuery() {
700       this.queryParams.pageNum = 1;
701       this.getList();
702     },
703     /** 重置按钮操作 */
704     resetQuery() {
705       this.resetForm("queryForm");
706       this.handleQuery();
707     },
708     // 多选框选中数据
709     // handleSelectionChange(selection) {
710     //   this.ids = selection.map(item => item.id)
711     //   this.move = selection.length!==1
712     //   if(!selection.length){
713     //     this.single = true
714     //     this.multiple = true
715     //   }else {
716     //     if(selection[0].orderStatus === '1' && selection.length === 1){
717     //       this.single = false
718     //       this.multiple = false
719     //     }
720     //   }
721     //
722     // },
723     // 多选框选中数据
724     handleSelectionChange(selection) {
725       this.ids = selection.map(item => item.id)
726       this.single = selection.length!==1
727       this.multiple = !selection.length
728       this.onlineSingle = selection.length!==1
729       this.offlineSingle = selection.length!==1
730
731       if(selection.length === 0){
732         this.onlineSingle = true
733         this.offlineSingle = true
734       }
735       if(selection.length === 1){
736         if(selection[0].onlineCompletionMark === '2'){
737           this.onlineSingle = false
738         }else {
739           this.onlineSingle = true
740         }
741         if(selection[0].sfResult === '2'){
742           this.offlineSingle = false
743         }else {
744           this.offlineSingle = true
745         }
746       }
747     },
748     /** 新增按钮操作 */
749     handleAdd() {
750       this.initWorkshop();
751       this.reset();
752       this.open = true;
753       this.titleName = "添加生产工单";
754     },
755     /** 修改按钮操作 */
756     handleUpdate(row) {
757       this.initWorkshop();
758       this.reset();
759       const id = row.id || this.ids
760       getProductionOrde(id).then(response => {
761         console.log(response.data)
762         this.form = response.data;
763         this.open = true;
764         this.titleName = "修改生产工单";
765       });
766     },
767     /** 提交按钮 */
768     submitForm() {
769       this.$refs["form"].validate(valid => {
770         if (valid) {
771           if (this.form.id != null) {
772             updateProductionOrde(this.form).then(response => {
773               this.$modal.msgSuccess("修改成功");
774               this.open = false;
775               this.getList();
776             });
777           } else {
778             addProductionOrde(this.form).then(response => {
779               this.$modal.msgSuccess("新增成功");
780               this.open = false;
781               this.getList();
782             });
783           }
784         }
785       });
786     },
787     /** 删除按钮操作 */
788     handleDelete(row) {
789       const ids = row.id || this.ids;
790       this.$modal.confirm('是否确认删除生产工单编号为"' + ids + '"的数据项?').then(function() {
791         return delProductionOrde(ids);
792       }).then(() => {
793         this.getList();
794         this.$modal.msgSuccess("删除成功");
795       }).catch(() => {});
796     },
797     /** 导出按钮操作 */
798     handleExport() {
799       this.download('om/productionOrde/export', {
800         ...this.queryParams
801       }, `productionOrde_${new Date().getTime()}.xlsx`)
802     }
803   }
804 };
805 </script>
806 <style lang="scss" scoped>
807 //::v-deep .el-dialog__header{
808 //  /*background-color: #f8f8f8;*/
809 //  background-color: #f8f8f9;
810 //}
811 </style>