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