| <template> | 
|   <div ref="container" class="page-list-container"> | 
|     <!--数据Table--> | 
|     <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" :on-delete-before="onDeleteBefore" :on-stop-before="onStopBefore"> | 
|       <template slot="common-column-slot" slot-scope="{row, col}"> | 
|         <template v-if="col.prop=='statusText'"> | 
|           <state-flow :load-options="stateLoadOptions" :where="{order_Id: row[dataOptions.idField]}"> | 
|             <template slot="content"> | 
|               <el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])"> | 
|                 {{ row[col.prop] }} | 
|               </el-tag> | 
|             </template> | 
|           </state-flow> | 
|         </template> | 
|         <!--审核字段--> | 
|         <template v-else-if="col.prop=='auditing'"> | 
|           <template> | 
|             <el-tag v-if="row[col.prop]==0" color="#ffff33" style="color:black;border:0"> | 
|               {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }} | 
|             </el-tag> | 
|             <el-tag v-else-if="row[col.prop]==1" color="#ff0033" style="color:white;border:0"> | 
|               {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }} | 
|             </el-tag> | 
|             <el-tag v-else-if="row[col.prop]==2" color="#33cc33" style="color:black;border:0;color:#fff;"> | 
|               {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }} | 
|             </el-tag> | 
|             <span v-else> | 
|               {{ row[col.prop] }} | 
|             </span> | 
|           </template> | 
|         </template> | 
|         <!--连接字段--> | 
|         <template v-else-if="col.prop==dataOptions.linkColumn"> | 
|           <el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link> | 
|         </template> | 
|         <template v-else-if="col.dropdown_Id>0"> | 
|           {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }} | 
|         </template> | 
|         <template v-else> | 
|           <template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter"> | 
|             {{ common.formatDate(row[col.prop], col.formatter) }} | 
|           </template> | 
|           <template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter"> | 
|             {{ common.formatNumber(row[col.prop], col.formatter) }} | 
|           </template> | 
|           <template v-else> | 
|             {{ row[col.prop] }} | 
|           </template> | 
|         </template> | 
|       </template> | 
|     </yrt-data-list> | 
|   | 
|     <!-- 待返修 --> | 
|     <!-- <order-add ref="addDialog" :visible.sync="addVisible"></order-add> --> | 
|   | 
|     <el-dialog :visible.sync="dialogFormVisible" title="返修管理" width="30%"> | 
|       <el-form :label-width="formLabelWidth"> | 
|         <!-- <el-form-item label="返修类型"> --> | 
|         <!-- <el-col :span="11"> --> | 
|         <!-- <el-input v-model="taskForm.destinationName"></el-input> --> | 
|         <!-- <el-select v-model="taskForm.repairType" placeholder="焊装待返修" @change="destinationChange"> --> | 
|         <!-- <el-option v-for="item in destinationList" :key="item.repairType" :label="item.destinationName" :value="item.destination_Id"> --> | 
|         <!-- </el-option> --> | 
|         <!-- </el-select> --> | 
|         <!-- </el-col> --> | 
|         <!-- </el-form-item> --> | 
|         <el-form-item label="返修类型"> | 
|           <el-col :span="11"> | 
|             <el-input :disabled="true" v-model="taskForm.repairType" placeholder="焊装待返修" value="焊装待返修"></el-input> | 
|           </el-col> | 
|         </el-form-item> | 
|         <el-form-item label="器具编号"> | 
|           <el-col :span="11"> | 
|             <el-select v-model="taskForm.plate_Id" placeholder="请选择器具编号" @change="plateChange"> | 
|               <el-option v-for="item in plateList" :key="item.plate_Id" :label="item.plateCode" :value="item.plate_Id"> | 
|               </el-option> | 
|             </el-select> | 
|           </el-col> | 
|           <!-- <el-input v-model="name"></el-input> --> | 
|         </el-form-item> | 
|         <el-form-item label="物料号"> | 
|           <el-col :span="11"> | 
|             <el-select v-model="taskForm.product_Id" placeholder="请选择物料号" @change="productChange"> | 
|               <el-option v-for="item in productList" :key="item.product_Id" :label="item.productCode" :value="item.product_Id"> | 
|               </el-option> | 
|             </el-select> | 
|           </el-col> | 
|           <!-- <el-input v-model="name"></el-input> --> | 
|         </el-form-item> | 
|         <el-form-item label="返修件数量"> | 
|           <el-col :span="11"> | 
|             <el-input v-model="taskForm.totalQuantity"></el-input> | 
|           </el-col> | 
|         </el-form-item> | 
|         <!-- <el-form-item label="制件状态"> --> | 
|         <!-- <el-col :span="11"> --> | 
|         <!-- <el-select v-model="taskForm.statusText" placeholder="焊装待返修" @change="productChange"> --> | 
|         <!-- <el-option v-for="item in productList" :key="item.statusText" :label="item.statusText" :value="item.statusText"> --> | 
|         <!-- </el-option> --> | 
|         <!-- </el-select> --> | 
|         <!-- </el-col> --> | 
|         <!-- <el-input v-model="name"></el-input> --> | 
|         <!-- </el-form-item> --> | 
|         <el-form-item label="制件状态"> | 
|           <el-col :span="11"> | 
|             <el-input :disabled="true" v-model="taskForm.statusText" placeholder="焊装待返修" value="焊装待返修"></el-input> | 
|           </el-col> | 
|         </el-form-item> | 
|   | 
|       </el-form> | 
|       <div slot="footer" class="dialog-footer"> | 
|         <el-button @click="dialogFormVisible = false">取 消</el-button> | 
|         <el-button type="primary" @click="addNewOrder">确 定</el-button> | 
|       </div> | 
|     </el-dialog> | 
|   | 
|     <!--数据编辑器Editor--> | 
|     <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" :fields="editorOptions.fields" :config="editorOptions.config" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :use-detail-slot="[ 'images']" :auth-nodes="authNodes" :btn-read-only="btnReadOnly" :default-value="defaultValue" :edit-button-click="editButtonClick" :before-close="beforeClose" :on-stop-before="onStopBefore" :on-save-before="onSaveBefore" :use-label-slot="useLabelSlot" @on-edit-load-after="onEditLoadAfter" @on-detail-change="onDetailChange" @on-add-load-after="onEditLoadAfter" @on-row-change="onRowChange" @on-item-click="(ref, val, itemData, field, formData)=>{onChange(ref, val, field, formData, itemData)}" @on-change="onChange"> | 
|       <!--自定义标签插槽--> | 
|       <template slot="label-feeItem_Ids"> | 
|         一次性收费项 | 
|         <a href="javascript:;" style="color:blue;" @click="showFeeTtemPopup()">修改</a> | 
|       </template> | 
|       <!--自定义按钮插槽--> | 
|       <!-- <template slot="footer-button-region" slot-scope="{ formData, details }"> --> | 
|       <!--打印条码按钮--> | 
|       <!-- <el-button :disabled="btnReadOnly.printBarcode" type="success" icon="el-icon-yrt-print" @click.native="printBarcode(formData, details)">打印条码</el-button> --> | 
|       <!--打印中条码按钮--> | 
|       <!-- <el-button :disabled="btnReadOnly.printBarcode" type="success" icon="el-icon-yrt-print" @click.native="printBarcode(formData, details, 'middleBarcode')">打印中条码</el-button> --> | 
|       <!--打印大条码按钮--> | 
|       <!-- <el-button :disabled="btnReadOnly.printBarcode" type="success" icon="el-icon-yrt-print" @click.native="printBarcode(formData, details, 'bigBarcode')">打印大条码</el-button> --> | 
|       <!-- </template> --> | 
|       <template slot="detail-column-slot" slot-scope="{ row, col, formData }"> | 
|         <template v-if="col.prop === 'images'"> | 
|           <el-image :src="row.images" :fit="fit" style="width: 140px; height: 100px"></el-image> | 
|         </template> | 
|       </template> | 
|     </yrt-editor> | 
|   | 
|     <!--物料选择器--> | 
|     <yrt-selector ref="selector-dialog" :config="selectorConfig" :visible.sync="selectorConfig.visible" @on-selected="onSelected"></yrt-selector> | 
|     <!--物料库存选择器--> | 
|     <yrt-selector ref="selector-position-dialog" :config="selectorPositionConfig" :visible.sync="selectorPositionConfig.visible" :url="selectorPositionConfig.url" @on-selected="onPositionSelected"></yrt-selector> | 
|     <!--打印条码弹出页面--> | 
|     <order-barcode ref="barcode-dialog" :visible.sync="barcodeVisible"></order-barcode> | 
|     <!--明细转移页面--> | 
|     <detail-transfer ref="detailtransfer-dialog" :visible.sync="detailtransferVisible"></detail-transfer> | 
|     <!--批量拆分--> | 
|     <batch-transfer ref="batchtransfer-dialog" :visible.sync="batchtransferVisible"></batch-transfer> | 
|     <!--批量更改折扣率页面--> | 
|     <batch-update ref="batchupdate-dialog" :visible.sync="batchupdateVisible"></batch-update> | 
|     <!--批量拆分导入--> | 
|     <batch-import ref="batchimport-dialog" :visible.sync="batchimportVisible"></batch-import> | 
|     <!--明细拆分单据--> | 
|     <order-detail-split ref="detailsplitDialog" :visible.sync="detailsplitimportVisible"></order-detail-split> | 
|     <!-- 一键确认入库 --> | 
|     <quick-enter-dialog ref="checkEnterDialog" :visible.sync="checkEnterVisible"></quick-enter-dialog> | 
|     <!-- 一次性收费项 --> | 
|     <order-one-charge ref="feeTtemPopupDialog" :visible.sync="isFeeTtemPopupVisible"></order-one-charge> | 
|     <!--明细导入--> | 
|     <import-dialog :visible.sync="orderImportConfig.isShowDialog" :import-config="orderImportConfig" :before-import-submit="beforeImportSubmit" @on-close="onCloseOrderDetail"> | 
|     </import-dialog> | 
|   </div> | 
| </template> | 
|   | 
| <script> | 
| import baseLayout from "@/components/common/base-layout.vue"; | 
| import yrtSelector from "@/components/common/yrtSelector.vue"; | 
| import orderBarcode from "./components/order-barcode.vue"; | 
| import detailTransfer from "./components/detail-transfer.vue"; | 
| import batchUpdate from "./components/batch-update.vue"; | 
| import batchTransfer from "./components/batch-transfer.vue"; | 
| import batchImport from "./components/batch-import.vue"; | 
| import stateFlow from "@/components/common/components/stateflow.vue"; | 
| import quickEnterDialog from "./components/quick-enter-dialog.vue"; | 
| import ImportDialog from "@/components/common/components/import-common-dialog"; | 
| import orderDetailSplit from "./components/order-detail-split.vue"; | 
| import orderOneCharge from "./components/order-one-charge.vue"; | 
|   | 
| import orderMixinButton from "./components/order-mixin-button.vue"; | 
| import orderMixinStatus from "./components/order-mixin-status.vue"; | 
| var moment = require("moment"); | 
|   | 
| export default { | 
|   name: "inbound-purchase-order-fx", | 
|   components: { | 
|     yrtSelector, | 
|     orderBarcode, | 
|     detailTransfer, | 
|     batchUpdate, | 
|     batchTransfer, | 
|     batchImport, | 
|     stateFlow, | 
|     quickEnterDialog, | 
|     ImportDialog, | 
|     orderDetailSplit, | 
|     orderOneCharge | 
|   }, | 
|   mixins: [baseLayout, orderMixinButton, orderMixinStatus], | 
|   // 自定义处理权限函数 | 
|   doAuth(the) { | 
|     // 判断当前版本是否拥有导入权限 | 
|     var authList = [ | 
|       { name: "预到货单批量导入", auth: "allImport" }, | 
|       { name: "打印预到货单", auth: "print" } | 
|       // { name: "确认在途中", auth: "inTransit" } | 
|     ]; | 
|     const names = authList.map(item => { | 
|       return item.name; | 
|     }); | 
|     the.common.isSaaSAuth(names, res => { | 
|       res = the.common.objectToCase(res); | 
|       authList.forEach(node => { | 
|         let hasAuth = res.result; | 
|         if (hasAuth) { | 
|           hasAuth = res.data.some(item => { | 
|             return item.moduleName === node.name; | 
|           }); | 
|         } | 
|         the.authNodes[node.auth] = hasAuth; | 
|       }); | 
|     }); | 
|   }, | 
|   data() { | 
|     return { | 
|       productList: [], | 
|       ALLproductList: [], | 
|       plateList: [], | 
|       taskForm: {}, | 
|       dialogFormVisible: false, | 
|       formLabelWidth: "120px", | 
|       fileList: [], | 
|       // 条码对话框是否显示 | 
|       barcodeVisible: false, | 
|       // 表单默认值,新建时用 | 
|       defaultValue: { | 
|         statusID: 1, | 
|         statusText: "待返修" | 
|       }, | 
|       // 配置参数 | 
|       config: { | 
|         // 预到货单明细自动生成批次号 | 
|         in_autoGenerateBatchCode: false, | 
|         // 预到货单明细自动生成唯一码 | 
|         in_autoSingleSignCode: false | 
|       }, | 
|       orderImportConfig: { | 
|         // 显示导入对话框 | 
|         isShowDialog: false, | 
|         title: "入库单批量导入", | 
|         // 导入地址 | 
|         url: "api/inbound/order/importExcel", | 
|         // 模板地址 | 
|         templateUrl: "https://auod-beijing.oss-cn-beijing.aliyuncs.com/node-wms/template/预到货单明细导入模板.xlsx" | 
|         // templateUrl: this.common.templateDomain + "/node-wms/template/预到货单明细导入模板.xlsx" | 
|       }, | 
|       // 明细拆分是否显示 | 
|       detailsplitimportVisible: false, | 
|       // 一次性收费项弹框 | 
|       isFeeTtemPopupVisible: false | 
|     }; | 
|   }, | 
|   mounted() { | 
|     this.getConfig(); | 
|     this.getAllproductList(); | 
|     this.plateChange(); | 
|   }, | 
|   // 自定义初始化数据 | 
|   init(the) { | 
|     var userInfo = the.common.getUserInfo(); | 
|     // 设置经手人不是超级管理员,不允许编辑 | 
|     if (!userInfo.isAdministrator) { | 
|       the.editorOptions.fields.forEach(cols => { | 
|         cols.columns && | 
|           cols.columns.forEach(col => { | 
|             col.fields.forEach(item => { | 
|               if (item.options.prop === "UserTrueName") { | 
|                 item.options.disabled = true; | 
|               } | 
|             }); | 
|           }); | 
|       }); | 
|     } | 
|   }, | 
|   activated() { | 
|     // SaaS模块权限 | 
|     this.common.hasSaaSAuth("预到货单", this.$refs.container); | 
|   }, | 
|   methods: { | 
|     // 新建确认事件 | 
|     addNewOrder() { | 
|       const url = "api/inbound/order/addNewOrder"; | 
|       this.taskForm.repairType = "焊装待返修"; | 
|       const params = { | 
|         taskForm: this.taskForm | 
|       }; | 
|       var callback = res => { | 
|         this.common.showMsg(res); | 
|         if (res.result) { | 
|           this.dataList.reload(); | 
|           this.dialogFormVisible = false; | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|     // 获取所有商品信息 | 
|     getAllproductList() { | 
|       const url = "api/basicInfo/base/productInfo/getList"; | 
|       const params = {}; | 
|       var callback = res => { | 
|         if (res.result) { | 
|           this.ALLproductList = res.data; | 
|           this.productList = res.data; | 
|           console.log(this.productList); | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|     // 新建器具编号触发事件 | 
|     plateChange() { | 
|       const url = "api/basicInfo/base/plate/getListPlate"; | 
|       const params = {}; | 
|       var callback = res => { | 
|         if (res.result) { | 
|           this.plateList = res.data; | 
|           console.log(this.productList); | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|     productChange() { | 
|       // 通过物料信息找出目的地 | 
|       var product_Id = this.taskForm.product_Id; | 
|       var productInfo = this.ALLproductList.find(v => v.product_Id === product_Id); | 
|       var destinations = productInfo.destinationName.split("/"); | 
|       var destinationList = this.ALLdestinationList.filter(v => destinations.some(x => parseInt(x) === parseInt(v.destination_Id))); | 
|       this.destinationList = destinationList; | 
|       this.taskForm.packingQuantity = productInfo.packingQuantity; | 
|       this.taskForm.orderType = productInfo.orderType; | 
|       // 合计库存数量 | 
|       this.getStockNumByProductId(); | 
|     }, | 
|     onChange(ref, val, field, formData) { | 
|       debugger; | 
|       if (field.options.prop === "plateCode") { | 
|         // this.editor.changeValue("plateType", val); | 
|         const plateCode = this.editor.formData["plateCode"]; | 
|         const url = "/api/basicInfo/base/plate/getList"; | 
|         const params = { | 
|           name: plateCode | 
|         }; | 
|         const _ref = this.dataList; | 
|         const callback = res => { | 
|           this.common.showMsg(res); | 
|           if (res.result) { | 
|             this.editor.changeValue("plateType", res.data[0].plateType); | 
|             this.editor.changeValue("plateType_Id", res.data[0].plateType_Id); | 
|             this.editor.changeValue("storageCode", res.data[0].storageCode); | 
|             this.editor.changeValue("storageName", res.data[0].storageName); | 
|             this.loadProductDropDown(); | 
|           } else { | 
|             this.editor.changeValue("plateType", null); | 
|           } | 
|         }; | 
|         this.common.ajax(url, params, callback, _ref); | 
|       } | 
|     }, | 
|     // 加载明细商品下拉框 | 
|     loadProductDropDown() { | 
|       debugger; | 
|       var plateType = this.masterData.plateType; | 
|       var plateType_Id = this.masterData.plateType_Id; | 
|       const url = "/api/basicInfo/base/productInfo/getListByPlateType"; | 
|       const params = { | 
|         plateType_Id: plateType_Id, | 
|         plateType: plateType | 
|       }; | 
|       var callback = res => { | 
|         if (res.result) { | 
|           this.editor.setDropdownData(34, res.data); | 
|         } | 
|       }; | 
|       this.common.ajax(url, params, callback, true); | 
|     }, | 
|     // 将选择器选择中的数据填充到明细表中 | 
|     onPositionSelected(rows) { | 
|       rows.forEach(item => { | 
|         if (!item.originPlace) { | 
|           if (this.detailRows.length) { | 
|             item.originPlace = this.detailRows[this.detailRows.length - 1].originPlace; | 
|           } | 
|         } | 
|       }); | 
|       this.editor.addDetailDataRow(rows); | 
|       this.selectorPositionConfig.visible = false; | 
|     }, | 
|     // 将选择器选择中的数据填充到明细表中 | 
|     onSelected(rows) { | 
|       // 设置默认值 | 
|       const lastRow = this.detailRows[this.detailRows.length - 1]; | 
|       let originPlace = lastRow ? lastRow.originPlace : ""; | 
|       rows.forEach(row => { | 
|         row.originPlace = row.originPlace; | 
|   | 
|         if (originPlace && !row.originPlace) { | 
|           row.originPlace = originPlace; | 
|         } | 
|         if (row.originPlace) { | 
|           originPlace = row.originPlace; | 
|         } | 
|       }); | 
|       this.editor.addDetailDataRow(rows); | 
|       this.selectorConfig.visible = false; | 
|     }, | 
|     // 获得配置参数 | 
|     getConfig() { | 
|       var keys = Object.keys(this.config).join(","); | 
|       var url = "/api/sys/param/getConfig"; | 
|       var params = { | 
|         openNodeApi: true, | 
|         keys: keys | 
|       }; | 
|       var callback = res => { | 
|         this.common.showMsg(res); | 
|         this.valueList = res.data; | 
|         // 获得参数值列表,将数字转换为对象 | 
|         res.data.forEach(item => { | 
|           var value03 = item.value03; | 
|           if (this.common.isNumber(item.value03)) { | 
|             value03 = parseInt(item.value03); | 
|           } | 
|           this.$set(this.config, item.value02, !!value03); | 
|         }); | 
|       }; | 
|       this.common.ajax(url, params, callback, this.$refs.container); | 
|     }, | 
|     // 上传前事件 | 
|     beforeUpload() {}, | 
|     // 数据加载后 | 
|     onEditLoadAfter(formData) { | 
|       // var statusID = formData.statusID; | 
|       // if (statusID === 1) { | 
|       //   // 待返修 | 
|       //   this.btnReadOnly.auditing = false; | 
|       //   this.btnReadOnly.stop = false; | 
|       //   this.btnReadOnly.open = true; | 
|       //   this.btnReadOnly.save = false; | 
|       //   this.btnReadOnly.inTransit = false; | 
|       //   this.editorOptions.config.disabled = false; // 整个对话框可编辑 | 
|       // } else if (statusID === 2) { | 
|       //   // 返修合格 | 
|       //   this.btnReadOnly.auditing = true; | 
|       //   this.btnReadOnly.stop = false; | 
|       //   this.btnReadOnly.open = true; | 
|       //   this.btnReadOnly.save = true; | 
|       //   this.btnReadOnly.inTransit = false; | 
|       //   this.editorOptions.config.disabled = true; // 整个对话框可编辑 | 
|       // } else if (statusID === 4) { | 
|       //   // 4-完成交货 | 
|       //   this.btnReadOnly.auditing = true; | 
|       //   this.btnReadOnly.stop = false; | 
|       //   this.btnReadOnly.open = true; | 
|       //   this.btnReadOnly.save = true; | 
|       //   this.btnReadOnly.inTransit = true; | 
|       //   this.editorOptions.config.disabled = true; // 整个对话框可编辑 | 
|       // } else if (statusID === 8) { | 
|       //   // 8-完全交货 | 
|       //   this.btnReadOnly.auditing = true; | 
|       //   this.btnReadOnly.stop = true; | 
|       //   this.btnReadOnly.open = true; | 
|       //   this.btnReadOnly.save = true; | 
|       //   this.btnReadOnly.inTransit = true; | 
|       //   this.editorOptions.config.disabled = true; // 整个对话框可编辑 | 
|       // } else if (statusID === 14) { | 
|       //   // 已合并 | 
|       //   this.btnReadOnly.auditing = true; | 
|       //   this.btnReadOnly.stop = true; | 
|       //   this.btnReadOnly.open = true; | 
|       //   this.btnReadOnly.save = true; | 
|       //   this.btnReadOnly.inTransit = true; | 
|       //   this.editorOptions.config.disabled = true; // 整个对话框可编辑 | 
|       // } else if (statusID === 9) { | 
|       //   // 9-终止 | 
|       //   this.btnReadOnly.auditing = true; | 
|       //   this.btnReadOnly.stop = true; | 
|       //   this.btnReadOnly.open = false; | 
|       //   this.btnReadOnly.save = true; | 
|       //   this.btnReadOnly.inTransit = true; | 
|       //   this.editorOptions.config.disabled = true; // 整个对话框可编辑 | 
|       // } else { | 
|       //   // 3-部分交货,9-终止 | 
|       //   this.btnReadOnly.auditing = true; | 
|       //   this.btnReadOnly.stop = true; | 
|       //   this.btnReadOnly.open = true; | 
|       //   this.btnReadOnly.save = true; | 
|       //   this.btnReadOnly.inTransit = true; | 
|       //   this.editorOptions.config.disabled = true; // 整个对话框可编辑 | 
|       // } | 
|   | 
|       if (formData && formData.order_Id) { | 
|         let totalQuantity = 0; | 
|         let totalMoney = 0; | 
|         let totalRateMoney = 0; | 
|         var detailRows = formData["Purchase_OrderList"].rows; | 
|         detailRows.forEach(item => { | 
|           totalQuantity += item.quantity; | 
|           totalMoney += item.purchaseMoney; | 
|           totalRateMoney += item.taxAmount; | 
|         }); | 
|         this.editor.changeValue("totalQuantity", totalQuantity); | 
|         this.editor.changeValue("totalMoney", totalMoney); | 
|         this.editor.changeValue("totalRateMoney", totalRateMoney); | 
|       } | 
|     }, | 
|     // 明细字段改变 | 
|     onDetailChange(ref, val, row, field) { | 
|       this.setTotal(ref, val, row, field); | 
|       if (!row.quantity || !row.unitConvert) { | 
|         row.bigUnitRounding = 0; | 
|       } else { | 
|         row.bigQty = Math.Round(row.quantity / row.unitConvert, 4); | 
|         row.bigUnitRounding = Math.ceil(row.quantity / row.unitConvert, 4); | 
|       } | 
|       if (row.produceDate) { | 
|         row.effectivedate = moment(row.produceDate) | 
|           .add(row.shelfLifeDay || 0, "days") | 
|           .format("YYYY-MM-DD"); | 
|       } | 
|     }, | 
|     // 求和 | 
|     setTotal(ref, val, row, field) { | 
|       var detailRows = this.detailRows; | 
|       // 合计数量求和 | 
|       let totalQuantity = 0; | 
|       let totalMoney = 0.0; | 
|       let totalRateMoney = 0.0; | 
|       let totalWeight = 0.0; | 
|       detailRows.forEach(item => { | 
|         item.ratePrice = Math.Round((item.purchasePrice || 0) * (1 + (item.rate || 0)), 2); | 
|         // 明细不含税金额 = 数量 * 不含税单价; | 
|         item.purchaseMoney = Math.Round((item.quantity || 0) * (item.purchasePrice || 0), 2); | 
|         // 含税金额 = 数量 * 含税单价; | 
|         item.taxAmount = Math.Round((item.quantity || 0) * (item.ratePrice || 0), 2); | 
|         item.rateMoney = item.taxAmount; | 
|         // 行小计重量 | 
|         if (field) { | 
|           // weight 单位毛重  /   totalWeight 小计毛重 quantity 数量 | 
|           if (field.prop === "quantity" || field.prop === "weight") { | 
|             // 小计  =  数量 * 单位毛重 | 
|             this.$set(item, "totalWeight", Math.Round((item.quantity || 0) * (item.weight || 0), 4)); | 
|           } else if (field && field.prop === "totalWeight") { | 
|             // 修改合计重量,计算出单位重量 | 
|             if (item.quantity) { | 
|               this.$set(item, "weight", Math.Round((item.totalWeight || 0) / (item.quantity || 0), 4)); | 
|             } else { | 
|               item.weight = 0; | 
|             } | 
|           } | 
|         } | 
|         item.unitPackage = Math.ceil(item.unitPackage); | 
|         if (field) { | 
|           if (field.prop === "quantity") { | 
|             // 总数量同步于数量 | 
|             item.totalPackageQty = item.quantity; | 
|           } | 
|           if (field.prop === "totalPackageQty") { | 
|             this.$set(item, "totalPackageQty", item.totalPackageQty); | 
|           } | 
|           if (field.prop === "paiQty") { | 
|             item.paiQty = Math.ceil(item.paiQty); | 
|           } else { | 
|             item.paiQty = item.unitPackage ? Math.ceil(item.totalPackageQty / item.unitPackage) : 0; | 
|           } | 
|         } | 
|         // item.totalPackageQty = item.quantity; | 
|         // 建议拍数 = 总件数 / 打包配置 | 
|         // item.paiQty = item.unitPackage ? Math.ceil(item.totalPackageQty || 0 / item.unitPackage || 0) : 0; | 
|   | 
|         totalQuantity += item.quantity || 0; | 
|         totalMoney += item.purchaseMoney || 0; | 
|         totalRateMoney += item.taxAmount || 0; | 
|         totalWeight += item.totalWeight || 0; | 
|         // debugger; | 
|         if (item.unitPackageType === "按数量") { | 
|           item.totalPackageQty = item.quantity; | 
|         } else if (item.unitPackageType === "按毛重") { | 
|           item.totalPackageQty = item.totalWeight; | 
|         } else if (item.unitPackageType === "按大单位数量") { | 
|           item.totalPackageQty = item.bigUnitRounding; | 
|         } | 
|       }); | 
|       this.editor.changeValue("totalQuantity", totalQuantity); | 
|       this.editor.changeValue("totalMoney", Math.Round(totalMoney, 2)); | 
|       this.editor.changeValue("totalRateMoney", Math.Round(totalRateMoney, 2)); | 
|       this.editor.changeValue("totalWeight", Math.Round(totalWeight, 4)); | 
|       // this.editor.changeValue("totalWeight", totalWeight); | 
|       // this.editor.changeValue("weight", Math.Round(weight, 2)); | 
|     }, | 
|     // 保存前事件 | 
|     onSaveBefore() { | 
|       this.setTotal(); | 
|       var partStatus = this.masterData.partStatus; | 
|       debugger; | 
|       if (partStatus === "冲压待返修") { | 
|         this.masterData.statusText = "冲压待返修"; | 
|         this.masterData.repairType = "冲压待返修"; | 
|       } | 
|       // 生成数据 | 
|       this.detailRows.forEach((row, index) => { | 
|         const currentDate = moment(new Date()); | 
|         if (this.config.in_autoGenerateBatchCode && !row.batchNumber) { | 
|           row.batchNumber = currentDate.format("YYYYMMDD") + "-" + (index + 1); | 
|           row.__ischange__ = true; | 
|         } | 
|         if (this.config.in_autoSingleSignCode && !row.singleSignCode) { | 
|           row.singleSignCode = this.common.getGUID(); | 
|           row.__ischange__ = true; | 
|         } | 
|       }); | 
|     }, | 
|     // 删除前事件 | 
|     onDeleteBefore(rows) { | 
|       let statusText = true; | 
|       rows.forEach(rowData => { | 
|         statusText = rowData.statusText; | 
|         if (statusText !== "待返修") { | 
|           statusText = false; | 
|         } | 
|       }); | 
|       if (statusText === false) { | 
|         this.$message.error("仅可删除新建预到货单!"); | 
|         return false; | 
|       } | 
|       return true; | 
|     }, | 
|     // 终止前事件 | 
|     onStopBefore(rows) { | 
|       const statusList = ["待返修", "返修合格", "完成交货"]; | 
|       for (const row of rows) { | 
|         const statusText = row.statusText; | 
|   | 
|         if (statusList.indexOf(statusText) < 0) { | 
|           this.$message.error(`只有["待返修", "返修合格", "完成交货"]状态时才可以做终止动作!`); | 
|           return false; | 
|         } | 
|         return true; | 
|       } | 
|     }, | 
|     // 关闭窗口前钩子函数, return true关闭窗口 | 
|     beforeClose() { | 
|       const detailList = this.editor.formData["Purchase_OrderList"].rows.filter(item => { | 
|         return !item.orderList_Id; | 
|       }); | 
|       if (this.editor.formData.statusText === "待返修" && detailList.length) { | 
|         this.$confirm("数据未保存,是否关闭?", { | 
|           confirmButtonText: "确定", | 
|           cancelButtonText: "取消", | 
|           type: "warning" | 
|         }) | 
|           .then(() => { | 
|             this.editor.config.visible = false; | 
|           }) | 
|           .catch(() => { | 
|             this.$message({ | 
|               type: "info", | 
|               message: "已取消" | 
|             }); | 
|             this.editor.config.visible = true; | 
|           }); | 
|       } else { | 
|         this.editor.config.visible = false; | 
|       } | 
|     }, | 
|     // 表格下拉框字段改变事件 | 
|     onRowChange(ref, val, field) { | 
|       // 货主和仓库改变 | 
|       if (["consignorName", "storageName"].indexOf(field.options.prop) >= 0) { | 
|         window.setTimeout(() => { | 
|           this.getDefaultItems(); | 
|         }, 200); | 
|       } | 
|     }, | 
|     // 获取一次性收费项默认值 | 
|     getDefaultItems() { | 
|       const formData = this.editor.formData; | 
|       if (formData.feeItem_Ids && this.editorOptions.config.action !== "add") return; // 已经有值了不在设置默认值 | 
|   | 
|       const url = "/api/finance/baseOneCharge/getDefaultItems"; | 
|       const params = { | 
|         associatedTasks: "入库单", | 
|         consignor_Id: formData.consignor_Id, | 
|         storage_Id: formData.storage_Id | 
|       }; | 
|       this.common.ajax(url, params, res => { | 
|         this.common.showMsg(res); | 
|         if (res.result) { | 
|           this.$set(formData, "feeItem_Ids", res.data); | 
|         } | 
|       }); | 
|     }, | 
|     // 预到货明细批量导入前事件 | 
|     beforeImportSubmit() { | 
|       const order_Id = this.editor.formData["order_Id"]; | 
|       // 自定义参数 | 
|       this.orderImportConfig.params = { | 
|         order_Id: order_Id | 
|       }; | 
|     }, | 
|     // 明细导入窗口关闭时事件 | 
|     onCloseOrderDetail() { | 
|       this.editor.reload(); | 
|     }, | 
|     // 打印 | 
|     print() { | 
|       this.dataList.print(); | 
|       // 获取选择框选中的长度 | 
|       const rowInfo = this.dataListSelections[0]; | 
|       debugger; | 
|       if (rowInfo.statusText === "完全交货") { | 
|         this.$message.error("已完全交货"); | 
|         return false; | 
|       } | 
|       if (rowInfo.statusText === "返修合格") { | 
|         this.$message.error("已返修合格"); | 
|         return false; | 
|       } | 
|       var url = "api/inbound/order/updateSatus"; | 
|       debugger; | 
|       var parsms = { | 
|         orderCode: rowInfo.orderCode, | 
|         order_Id: rowInfo.order_Id | 
|       }; | 
|       const ref = this.dataList; | 
|       this.common.ajax(url, parsms, res => { | 
|         this.common.showMsg(res); | 
|         if (res.result) { | 
|           ref.loadData(); | 
|         } | 
|       }); | 
|     } | 
|   } | 
| }; | 
| </script> |