webpackJsonp([119],{CXCb: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_System_dialogChooseParts_vue__=__webpack_require__("CdUU"),__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_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_System_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},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:""},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"}]},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,advanceQueryDialogVisible:!0,chooseUserVisible:!1,chooseSupplierVisible:!1,btnDelDisabled:!0,btnDelDisabled2:!0,headDetail:{},printDetail:{unit_name0:"",address0:"",company_phone0:"",unit_name:"",address:"",company_phone:"",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 t=this,e=Object(__WEBPACK_IMPORTED_MODULE_17__utils_tools__.e)("scalesPurMsg");Object(__WEBPACK_IMPORTED_MODULE_17__utils_tools__.j)("scalesPurMsg"),e&&(this.fromScale=!0,this.scalesPurMsg=JSON.parse(e),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(e){0===e.code&&(t.printDetail.unit_name0=e.result.name,t.printDetail.address0=e.result.address,t.printDetail.company_phone0=e.result.mobile)})},methods:__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_extends___default()({},Object(__WEBPACK_IMPORTED_MODULE_7_vuex__.d)({removeTagNav:"tagNav/removeTagNav"}),{getPrintTypeList:function(){var t=this;this.$api.dictAPI.getDictsByType("print_type").then(function(e){0===e.code&&(t.printTypeList=e.datas)}).catch(function(t){})},getMsgFormScale:function(){this.formData.supplierId=this.scalesPurMsg.companyId,this.formData.supplierName=this.scalesPurMsg.company,this.scalesPurMsg.list.forEach(function(t){t.materielName=t.matterName,t.materielId=t.matterId,t.serialNo=t.matterNo,t.unitUomName=t.matterUnit,t.taxUnitPrice=t.matterPrice/t.convCoefficient,t.subQuoteCount=t.matterNum/t.convCoefficient,t.specification=t.matterSpecs,t.taxRate=t.taxPercent,t.count=t.matterNum,t.taxAmount=t.matterPrice*t.matterNum,t.unitPrice=t.matterPrice*(100-t.taxRate)/100,t.amount=t.taxAmount*(100-t.taxRate)/100}),this.model.childList=this.scalesPurMsg.list},submitApprove:function(){var t=this;if(this.$route.query.id){var e={mainId:this.editId,dataType:2};__WEBPACK_IMPORTED_MODULE_18__api_sendBeanApi__.a.submitApprove(e).then(function(e){0===e.code?t.$message.success("操作成功!"):t.$message.error(e.msg),t.getDetail()}).catch(function(t){console.log(t)})}},closeLine:function(){this.itemIds=[],this.formData1={},this.dialogVisible=!0,void 0!==this.$refs.form1&&this.$refs.form1.resetFields()},save1:function(t){var e=this;this.$refs[t].validate(function(t){if(t){if(e.chooseParts){var a=[];e.chooseParts.forEach(function(t){a.push(t.id);var i=e.model.childList.findIndex(function(e){if(e.id==t.id)return!0});e.model.childList.splice(i,1),e.itemIds=a})}e.$api.gylPurchaseAPI.closeLine({ids:e.itemIds,closeReason:e.formData1.closeReason}).then(function(t){0===t.code?(e.$message({message:t.msg,type:"success"}),e.dialogVisible=!1,e.getDetail()):e.$message({message:t.msg,type:"error"})}).catch(function(t){e.$message({message:res.msg,type:"success"})})}})},changeCount:function(t){if(t.taxAmount=parseFloat((parseFloat(t.subQuoteCount)*parseFloat(t.taxUnitPrice)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.amountFixedTo)),t.error_count){for(var e=0,a=0;a=e&&this.model.childList.forEach(function(e){e.sourceId==t.sourceId&&delete e.error_count})}},changeTaxAmount:function(t){t.subQuoteCount?(t.taxUnitPrice=parseFloat((parseFloat(t.taxAmount)/parseFloat(t.subQuoteCount)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.priceFixedTo)),t.unitPrice=parseFloat((parseFloat(t.taxUnitPrice)/(1+t.taxRate/100)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.priceFixedTo))):(t.taxUnitPrice=0,t.unitPrice=0)},changeTaxUnitPrice:function(t){t.unitPrice=parseFloat((t.taxUnitPrice/(1+t.taxRate/100)).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.priceFixedTo)),t.subQuoteCount?t.taxAmount=parseFloat((t.subQuoteCount*t.taxUnitPrice).toFixed(__WEBPACK_IMPORTED_MODULE_13__utils_config_js__.a.amountFixedTo)):t.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 t=this;this.childListLoading=!0,this.$nextTick().then(function(){t.$api.gylPurchaseAPI.purchaseContractDetail({id:t.editId}).then(function(e){if(t.childListLoading=!1,0===e.code){if(t.totalOfPay=e.data.totalOfPay,t.formData=__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_assign___default()({},e.data.detailOfHead),t.formData.InvoicedAmount=e.data.detailOfHead.InvoicedAmount?e.data.detailOfHead.InvoicedAmount:0,t.auditStatus=t.formData.auditSign,t.initiate_auditStatus=t.formData.auditSign,t.closeStatus=t.formData.closeStatus,t.$set(t.headDetail,"createByName",e.data.detailOfHead.createByName),t.$set(t.headDetail,"createTime",e.data.detailOfHead.createTime),t.$set(t.headDetail,"auditorName",e.data.detailOfHead.auditorName),t.$set(t.headDetail,"auditTime",e.data.detailOfHead.auditTime),t.$set(t.headDetail,"contractCode",e.data.detailOfHead.contractCode),t.$set(t.headDetail,"closeStatusName",e.data.detailOfHead.closeStatusName),t.model.childList=e.data.detailOfBody,t.approveState=e.data.detailOfHead.approveState,0!==t.approveState&&(t.progressList=e.data.progressList),e.data.uploadAttachment&&e.data.uploadAttachment.length>0){t.fileDocList=[];for(var a=0;a0){var o=[];t.uploadAttachment.forEach(function(t){var e={fileName:t.fileName,filePath:t.filePath};o.push(e)}),t.contentAssocList=__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(o),console.log(t.contentAssocList)}if(0!=t.model.childList.length)if(0!=t.model2.childList.length)if(e&&a){var s=!0;if(t.model.childList.forEach(function(t){t.count<=0&&(s=!1)}),s){var r=!0,n=0;if(t.model2.childList.forEach(function(t){n+=t.payAmount,t.payAmount0),this.btnDelDisabled=e},setBtn2:function(t){var e=!0;e=!(t.length>0),this.btnDelDisabled2=e},handlePartChange:function(t){this.chooseParts=t,this.setBtn(t)},handlePartChange2:function(t){this.chooseParts2=t,this.setBtn2(t)},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 t=document.getElementById("print_content").innerHTML;return document.body.innerHTML="打印"+t+"",window.print(),window.location.reload(),!1})},printNew:function(t){var e=void 0;10184===t.id?(this.printDirection=0,e=""):10185===t.id?(this.printDirection=1,e=""):10186===t.id&&(this.printDirection=2,e=""),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 t=document.getElementById("print_content").innerHTML;return document.body.innerHTML="打印"+t+e,window.print(),window.location.reload(),!1})}}),watch:{closeStatus:function(t){0==t&&179==this.auditStatus?this.canChange=!0:1==t&&(this.canChange=!1)},auditStatus:function(t,e){if(179==t&&0==this.closeStatus){var a=new Date;if(178==e){var i=a.getFullYear()+"-"+(a.getMonth()+1)+"-"+a.getDate()+" "+a.getHours()+":"+a.getMinutes()+":"+a.getSeconds();this.headDetail.auditorName=this.userInfo.name,this.headDetail.auditTime=i}this.canChange=!0}else 178==t&&(this.canChange=!1)},formData:{handler:function(t,e){if(t.remarks)for(var a=t.remarks.split("\n"),i=0;i