webpackJsonp([121],{"KG/j":function(module,__webpack_exports__,__webpack_require__){"use strict";var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_slicedToArray__=__webpack_require__("d7EF"),__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_slicedToArray___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_slicedToArray__),__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_promise__=__webpack_require__("//Fk"),__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_promise___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_promise__),__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify__=__webpack_require__("mvHQ"),__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify__),__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign__=__webpack_require__("woOf"),__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign__),__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends__=__webpack_require__("Dd8w"),__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends__),__WEBPACK_IMPORTED_MODULE_5__utils_tools_js__=__webpack_require__("GKmE"),__WEBPACK_IMPORTED_MODULE_6__components_btnInput_vue__=__webpack_require__("ysqt"),__WEBPACK_IMPORTED_MODULE_7_vuex__=__webpack_require__("NYxO"),__WEBPACK_IMPORTED_MODULE_8__components_System_dialogChooseSingleUser__=__webpack_require__("3MlD"),__WEBPACK_IMPORTED_MODULE_9__components_System_dialogChooseSingleSuppliers__=__webpack_require__("FnMF"),__WEBPACK_IMPORTED_MODULE_10__components_Dialog_dialogChooseParts_vue__=__webpack_require__("5zN6"),__WEBPACK_IMPORTED_MODULE_11__contract_dialogImportPurchaseContract__=__webpack_require__("NgSJ"),__WEBPACK_IMPORTED_MODULE_12__contract_printPurchaseContract_vue__=__webpack_require__("4yVa"),__WEBPACK_IMPORTED_MODULE_13__utils_config_js__=__webpack_require__("bzuE"),__WEBPACK_IMPORTED_MODULE_14_js_cookie__=__webpack_require__("lbHh"),__WEBPACK_IMPORTED_MODULE_14_js_cookie___default=__webpack_require__.n(__WEBPACK_IMPORTED_MODULE_14_js_cookie__),__WEBPACK_IMPORTED_MODULE_15__components_System_upload__=__webpack_require__("veZ4"),__WEBPACK_IMPORTED_MODULE_16__components_UnitSelect__=__webpack_require__("Sd19"),__WEBPACK_IMPORTED_MODULE_17__utils_tools__=__webpack_require__("GKmE"),__WEBPACK_IMPORTED_MODULE_18__api_sendBeanApi__=__webpack_require__("loXm"),__WEBPACK_IMPORTED_MODULE_19__components_DetailApproveFlow__=__webpack_require__("EB+w"),__WEBPACK_IMPORTED_MODULE_20__components_Dialog_dialogChooseClause__=__webpack_require__("RFai");__webpack_exports__.a={inject:["reload"],components:{DetailApproveFlow:__WEBPACK_IMPORTED_MODULE_19__components_DetailApproveFlow__.a,btnInput:__WEBPACK_IMPORTED_MODULE_6__components_btnInput_vue__.a,dialogChooseParts:__WEBPACK_IMPORTED_MODULE_10__components_Dialog_dialogChooseParts_vue__.a,dialogChooseSingleUser:__WEBPACK_IMPORTED_MODULE_8__components_System_dialogChooseSingleUser__.a,dialogChooseSingleSupplier:__WEBPACK_IMPORTED_MODULE_9__components_System_dialogChooseSingleSuppliers__.a,printPurchaseContract:__WEBPACK_IMPORTED_MODULE_12__contract_printPurchaseContract_vue__.a,dialogImportPurchaseContract:__WEBPACK_IMPORTED_MODULE_11__contract_dialogImportPurchaseContract__.a,upload:__WEBPACK_IMPORTED_MODULE_15__components_System_upload__.a,unitSelect:__WEBPACK_IMPORTED_MODULE_16__components_UnitSelect__.a,ChooseClause:__WEBPACK_IMPORTED_MODULE_20__components_Dialog_dialogChooseClause__.a},data:function(){return{progressList:[],approveState:-1,printDirection:1,printTypeList:[],addTyp:0,userInfo:"",config:__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a,editId:"",auditStatus:"",initiate_auditStatus:"",closeStatus:"",canChange:!1,itemIds:[],payIds:[],uploadAttachment:[],formData:{InvoicedAmount:0,uninvoicedAmount:0,contractDate:Object(__WEBPACK_IMPORTED_MODULE_5__utils_tools_js__.c)(),supplierName:"",supplierId:"",remarks:"",companyPhone:""},scalesPurMsg:{},fromScale:!1,chooseParts:[],chooseParts2:[],contractTypeList:[],contentAssocList:[],formData1:{},rulesForm1:{closeReason:[{required:!0,message:"关闭原因必填",trigger:"blur"}]},totalOfPay:"",ruleForm:{supplierName:[{required:!0,message:"请选择供应商",trigger:"change"}],buyerName:[{required:!0,message:"请选择采购员",trigger:"change"}],deptName:[{required:!1,message:"请选择采购部门",trigger:"change"}],contractEffectiveDate:[{required:!0,message:"请选择合同有效期",trigger:"change"}],contractDate:[{required:!0,message:"请选择合同日期",trigger:"change"}],companyPhone:[{required:!0,message:"请填写联系电话",trigger:"blur"}]},model:{rules:{count:{required:!0,message:"采购数量必填",trigger:"change"},taxAmount:{required:!0,message:"含税金额必填",trigger:"change"},taxRate:{required:!0,message:"税率必填",trigger:"change"}},childList:[]},model2:{rules:{dueDate:{required:!0,message:"应付日期必填",trigger:"change"}},childList:[]},childListLoading:!1,dialogLoading1:!1,dialogVisible:!1,truelabel:1,falselabel:0,ChooseImport:!1,isDisabled:!1,ChooseMaterielVisible:!1,chooseClauseVisible:!1,advanceQueryDialogVisible:!0,chooseUserVisible:!1,chooseSupplierVisible:!1,btnDelDisabled:!0,btnDelDisabled2:!0,headDetail:{},printDetail:{unit_name0:"",address0:"",company_phone0:"",unit_name:"",address:"",companyPhone:"",remarks:[]},printTotal:{count:"",amount:""},printList:[],printForm:[{title:"物料代码",prop_:"serialNo"},{title:"物料名称",prop_:"materielName"},{title:"规格型号",prop_:"specification"},{title:"辅助单位",prop_:"supportUomName"},{title:"采购数量",prop_:"subQuoteCount"},{title:"单价",prop_:"taxUnitPrice"},{title:"金额",prop_:"taxAmount"},{title:"交货日期",prop_:"deliveryDatePrint"}],printTotal2:{payAmount:""},printList2:[],printForm2:[{title:"应付日期",prop_:"dueDate"},{title:"应付金额",prop_:"payAmount"},{title:"已付金额",prop_:"amountPaid"},{title:"未付金额",prop_:"unpayAmount"},{title:"备注",prop_:"remarks"}]}},computed:__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default()({},Object(__WEBPACK_IMPORTED_MODULE_7_vuex__.c)({})),mounted:function(){var e=this,t=Object(__WEBPACK_IMPORTED_MODULE_17__utils_tools__.e)("scalesPurMsg");if(Object(__WEBPACK_IMPORTED_MODULE_17__utils_tools__.j)("scalesPurMsg"),t&&(this.fromScale=!0,this.scalesPurMsg=JSON.parse(t),this.getMsgFormScale()),this.getPrintTypeList(),this.userInfo=JSON.parse(__WEBPACK_IMPORTED_MODULE_14_js_cookie___default.a.get("userInfo")),this.editId=this.$route.query.id,this.initialize(),this.editId?this.getDetail():(this.$set(this.formData,"buyerName",this.userInfo.name),this.$set(this.formData,"buyer",this.userInfo.userId),this.$set(this.formData,"deptName",this.userInfo.deptName),this.$set(this.formData,"deptId",this.userInfo.deptId)),"change"==this.$route.query.from&&(this.canChange=!0),this.$api.companyAPI.detail().then(function(t){0===t.code&&(e.printDetail.unit_name0=t.result.name,e.printDetail.address0=t.result.address,e.printDetail.company_phone0=t.result.mobile)}),this.$route.query.dataForm&&(this.formData=JSON.parse(this.$route.query.dataForm)),this.$route.query.counitsId){var a=this.$route.query.counitsId;this.$api.supplierAPI.groupDetail(a).then(function(t){if(0===t.code){var a=t.data;e.$set(e.formData,"supplierId",a.id),e.$set(e.formData,"supplierName",a.unit_name),e.$set(e.formData,"companyPhone",a.company_phone),e.$set(e.formData,"buyerName",a.belongSalesmanName?a.belongSalesmanName:e.userInfo.name),e.$set(e.formData,"buyer",a.belongSalesman?a.belongSalesman:e.userInfo.userId),e.$set(e.formData,"deptName",a.belongDeptName?a.belongDeptName:e.userInfo.deptName),e.$set(e.formData,"deptId",a.belongDept?a.belongDept:e.userInfo.deptId)}}).catch(function(e){console.log(e)})}},methods:__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default()({},Object(__WEBPACK_IMPORTED_MODULE_7_vuex__.d)({removeTagNav:"tagNav/removeTagNav"}),{associatedDocument:function(){this.$router.push({path:"/purchase/purchase_contract_associatedDocument",query:{id:this.editId,clientName:this.formData.supplierName,contractCode:this.formData.contractCode,t:Date.now()}})},getPrintTypeList:function(){var e=this;this.$api.dictAPI.getDictsByType("print_type").then(function(t){0===t.code&&(e.printTypeList=t.datas)}).catch(function(e){})},getMsgFormScale:function(){this.formData.supplierId=this.scalesPurMsg.companyId,this.formData.supplierName=this.scalesPurMsg.company,this.scalesPurMsg.list.forEach(function(e){e.id="",e.materielName=e.matterName,e.materielId=e.matterId,e.serialNo=e.matterNo,e.unitUomName=e.matterUnit,e.taxUnitPrice=e.matterPrice/e.convCoefficient,e.subQuoteCount=e.matterNum/e.convCoefficient,e.specification=e.matterSpecs,e.taxRate=e.taxPercent,e.count=e.matterNum,e.taxAmount=e.matterPrice*e.matterNum,e.unitPrice=e.matterPrice*(100-e.taxRate)/100,e.amount=e.taxAmount*(100-e.taxRate)/100}),this.model.childList=this.scalesPurMsg.list},submitApprove:function(){var e=this;if(this.$route.query.id){var t={mainId:this.editId,dataType:2};__WEBPACK_IMPORTED_MODULE_18__api_sendBeanApi__.a.submitApprove(t).then(function(t){0===t.code?e.$message.success("操作成功!"):e.$message.error(t.msg),e.getDetail()}).catch(function(e){console.log(e)})}},closeLine:function(){this.itemIds=[],this.formData1={},this.dialogVisible=!0,void 0!==this.$refs.form1&&this.$refs.form1.resetFields()},save1:function(e){var t=this;this.$refs[e].validate(function(e){if(e){if(t.chooseParts){var a=[];t.chooseParts.forEach(function(e){a.push(e.id);var o=t.model.childList.findIndex(function(t){if(t.id==e.id)return!0});t.model.childList.splice(o,1),t.itemIds=a})}t.$api.gylPurchaseAPI.closeLine({ids:t.itemIds,closeReason:t.formData1.closeReason}).then(function(e){0===e.code?(t.$message({message:e.msg,type:"success"}),t.dialogVisible=!1,t.getDetail()):t.$message({message:e.msg,type:"error"})}).catch(function(e){t.$message({message:res.msg,type:"success"})})}})},changeCount:function(e){if(e.taxAmount=parseFloat((parseFloat(e.subQuoteCount)*parseFloat(e.taxUnitPrice)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.amountFixedTo)),e.error_count){for(var t=0,a=0;a=t&&this.model.childList.forEach(function(t){t.sourceId==e.sourceId&&delete t.error_count})}},changeTaxAmount:function(e){e.subQuoteCount?(e.taxUnitPrice=parseFloat((parseFloat(e.taxAmount)/parseFloat(e.subQuoteCount)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.priceFixedTo)),e.unitPrice=parseFloat((parseFloat(e.taxUnitPrice)/(1+e.taxRate/100)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.priceFixedTo))):(e.taxUnitPrice=0,e.unitPrice=0)},changeTaxUnitPrice:function(e){e.unitPrice=parseFloat((e.taxUnitPrice/(1+e.taxRate/100)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.priceFixedTo)),e.subQuoteCount?e.taxAmount=parseFloat((e.subQuoteCount*e.taxUnitPrice).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.amountFixedTo)):e.taxAmount=0},ChooseImportShow:function(){this.ChooseImport=!0},back:function(){this.removeTagNav({path:this.$route.path,title:this.$route.meta.name}),this.$router.push({path:"/purchase/purchase_contract_index",query:{t:Date.now()}})},getDetail:function(){var e=this;this.childListLoading=!0,this.$nextTick().then(function(){e.$api.gylPurchaseAPI.purchaseContractDetail({id:e.editId}).then(function(t){if(e.childListLoading=!1,0===t.code){if(e.totalOfPay=t.data.totalOfPay,e.formData=__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign___default()({},t.data.detailOfHead),e.formData.InvoicedAmount=t.data.detailOfHead.InvoicedAmount?t.data.detailOfHead.InvoicedAmount:0,e.auditStatus=e.formData.auditSign,e.initiate_auditStatus=e.formData.auditSign,e.closeStatus=e.formData.closeStatus,e.$set(e.headDetail,"createByName",t.data.detailOfHead.createByName),e.$set(e.headDetail,"createTime",t.data.detailOfHead.createTime),e.$set(e.headDetail,"auditorName",t.data.detailOfHead.auditorName),e.$set(e.headDetail,"auditTime",t.data.detailOfHead.auditTime),e.$set(e.headDetail,"contractCode",t.data.detailOfHead.contractCode),e.$set(e.headDetail,"closeStatusName",t.data.detailOfHead.closeStatusName),e.model.childList=t.data.detailOfBody,e.approveState=t.data.detailOfHead.approveState,0!==e.approveState&&(e.progressList=t.data.progressList),t.data.uploadAttachment&&t.data.uploadAttachment.length>0){e.fileDocList=[];for(var a=0;a0){var i=[];e.uploadAttachment.forEach(function(e){var t={fileName:e.fileName,filePath:e.filePath};i.push(t)}),e.contentAssocList=__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(i),console.log(e.contentAssocList)}if(0!=e.model.childList.length)if(0!=e.model2.childList.length)if(t&&a){var s=!0;if(e.model.childList.forEach(function(e){e.count<=0&&(s=!1)}),s){var r=!0,n=0;if(e.model2.childList.forEach(function(e){n+=e.payAmount,e.payAmount0),this.btnDelDisabled=t},setBtn2:function(e){var t=!0;t=!(e.length>0),this.btnDelDisabled2=t},handlePartChange:function(e){this.chooseParts=e,this.setBtn(e)},handlePartChange2:function(e){this.chooseParts2=e,this.setBtn2(e)},print:function(){document.getElementById("print_content").style.display="block",this.printList=JSON.parse(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(this.printList)),this.printList2=JSON.parse(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(this.printList2)),this.$nextTick(function(){var e=document.getElementById("print_content").innerHTML;return document.body.innerHTML="打印"+e+"",window.print(),window.location.reload(),!1})},printNew:function(e){var t=void 0;10184===e.id?(this.printDirection=0,t=""):10185===e.id?(this.printDirection=1,t=""):10186===e.id&&(this.printDirection=2,t=""),document.getElementById("print_content").style.display="block",this.printList=JSON.parse(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(this.printList)),this.printList2=JSON.parse(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(this.printList2)),this.$nextTick(function(){var e=document.getElementById("print_content").innerHTML;return document.body.innerHTML="打印"+e+t,window.print(),window.location.reload(),!1})},goToLink:function(e){this.$router.push({path:"/purchase/purchase_apply_add",query:{id:e,t:Date.now()}})}}),watch:{closeStatus:function(e){0==e&&179==this.auditStatus?this.canChange=!0:1==e&&(this.canChange=!1)},auditStatus:function(e,t){if(179==e&&0==this.closeStatus){var a=new Date;if(178==t){var o=a.getFullYear()+"-"+(a.getMonth()+1)+"-"+a.getDate()+" "+a.getHours()+":"+a.getMinutes()+":"+a.getSeconds();this.headDetail.auditorName=this.userInfo.name,this.headDetail.auditTime=o}this.canChange=!0}else 178==e&&(this.canChange=!1)},formData:{handler:function(e,t){if(e.remarks)for(var a=e.remarks.split("\n"),o=0;o