1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
webpackJsonp([449],{PPaE:function(t,e){},YSFb:function(t,e,a){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=a("bzuE"),n={data:function(){return{search_data:{pageno:1,pagesize:10,auditSign:179,startTime:"",endTime:""},summary:{},time:"",config:i.a,btnOtherDisabled:!0,formData:{},typeList:[],purchaseInStockIds:[],inOutTime:"",tableData:[],pictLoading:!1,isEdit:!0,total:0,pageSizes:[10,20,50,100]}},created:function(){var t=this;document.onkeydown=function(e){"Enter"===e.key&&t.startList(!0)}},watch:{time:function(t){t?(this.search_data.startTime=t[0],this.search_data.endTime=t[1]):(this.search_data.startTime="",this.search_data.endTime="")}},mounted:function(){this.initDate(),this.getList()},methods:{save:function(){var t=this,e=[];this.tableData.forEach(function(t){var a={id:t.stockInItemId,unitPrice:t.unitPrice,amount:t.amount};e.push(a)}),this.$api.advertiseInfoAPI.edit(e).then(function(e){0==e.code?(t.$message({message:e.msg,type:"success"}),t.isEdit=!0,t.getList()):t.$message({message:e.msg,type:"error"})})},changeAmount:function(t,e){t.unitPrice=t.unitPrice.toFixed(t.priceAccuracy),t.amount=(t.unitPrice*t.inCount).toFixed(i.a.amountFixedTo)},changeUnitPrice:function(t){t.amount=t.amount.toFixed(i.a.amountFixedTo),t.unitPrice=(t.amount/t.inCount).toFixed(t.priceAccuracy)},edit:function(){this.isEdit=!1},initDate:function(){var t=this;this.$api.salesAPI.listContractType({type:"cost_allocation_criteria"}).then(function(e){t.typeList=e.datas})},check:function(){var t=this,e=[];this.tableData.forEach(function(t){e.push(t.id)}),this.$api.stockInAccountingAPI.purchaseBusinessAccounting({stockInIds:e}).then(function(e){0==e.code?(t.$message({message:e.msg,type:"success"}),t.getList()):t.$message({message:e.msg,type:"error"})})},allocation:function(){var t=this;if(this.formData.distributionType){var e=[];this.tableData.forEach(function(t){e.push(t.id)}),this.$api.stockInAccountingAPI.purchaseInStockAllocation({distributionType:this.formData.distributionType,detailAccounting:e}).then(function(e){0==e.code?(t.$message({message:e.msg,type:"success"}),t.getList()):t.$message({message:e.msg,type:"error"})})}else this.$message({message:"请先选择采购费用分配标准再进行分配",type:"error"})},search:function(){this.search_data.pageno=1,this.getList()},getList:function(){var t=this;this.pictLoading=!0,this.$api.gylPurchaseAPI.purchaseInStockList(this.search_data).then(function(e){t.pictLoading=!1,e.data?(t.summary=e.data,t.total=e.data.totalRows,t.tableData=e.data.datas?e.data.datas:[],t.tableData.forEach(function(t){t.inOutTime=/\d{4}-\d{1,2}-\d{1,2}/g.exec(t.inOutTime)}),e.data.datas&&e.data.datas.forEach(function(t){0==t.purchaseType?t.purchaseType="现购":1==t.purchaseType&&(t.purchaseType="赊购")})):(t.total=0,t.tableData=[])}).catch(function(t){console.log(t)})},handleSelectionChange:function(t){console.log(t),this.purchaseInStockIds=t,this.setBtn(t)},setBtn:function(t){var e=!0,a=!0;t.length>0?(a=!1,1==t.length&&(e=!1)):(e=!0,a=!0),this.btnOtherDisabled=a,this.btnDelDisabled=e},getSummaries:function(t){var e=this,a=t.columns,i=t.data,n=[];return a.forEach(function(t,a){if(0!==a)if("count"==t.property||"amount"==t.property||"expense"==t.property||"inCount"==t.property){var s=i.map(function(e){return Number(e[t.property])});s.every(function(t){return isNaN(t)})?n[a]="":n[a]=s.reduce(function(t,e){var a=Number(e);return isNaN(a)?t:t+e},0),"count"!=t.property?"amount"!=t.property?"expense"!=t.property?"inCount"!=t.property||n[a]&&(n[a]=e.summary.totalInCount):n[a]&&(n[a]=e.summary.totalExpense):n[a]&&(n[a]=e.summary.toatalAmount):n[a]&&(n[a]=e.summary.toatalCount)}else n[a]="";else n[a]="合计"}),n},handleCurrentChange:function(t){this.search_data.pageno=t,this.getList()},handleSizeChange:function(t){this.search_data.pagesize=t,this.getList()}}},s={render:function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"sys-box"},[a("div",{staticClass:"sys-form"},[a("el-form",{ref:"form",attrs:{"label-width":"120px","inline-message":!0,model:t.formData}},[a("el-form-item",{staticClass:"form-inline1",attrs:{label:"采购费用分配标准",prop:"distributionType"}},[a("el-select",{attrs:{clearable:"",placeholder:"请选择"},model:{value:t.formData.distributionType,callback:function(e){t.$set(t.formData,"distributionType",e)},expression:"formData.distributionType"}},t._l(t.typeList,function(t){return a("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1),t._v(" "),1==t.isEdit?a("el-button",{directives:[{name:"has",rawName:"v-has",value:"finance:purchaseInStock:allocation",expression:"'finance:purchaseInStock:allocation'"}],attrs:{type:"primary"},on:{click:t.allocation}},[t._v("分配")]):t._e(),t._v(" "),1==t.isEdit?a("el-button",{directives:[{name:"has",rawName:"v-has",value:"finance:purchaseInStock:check",expression:"'finance:purchaseInStock:check'"}],attrs:{type:"primary"},on:{click:t.check}},[t._v("核算")]):t._e(),t._v(" "),1==t.isEdit?a("el-button",{directives:[{name:"has",rawName:"v-has",value:"finance:purchaseInStock:edit",expression:"'finance:purchaseInStock:edit'"}],attrs:{type:"primary"},on:{click:function(e){return t.edit()}}},[t._v("编辑")]):t._e(),t._v(" "),0==t.isEdit?a("el-button",{directives:[{name:"has",rawName:"v-has",value:"finance:purchaseInStock:save",expression:"'finance:purchaseInStock:save'"}],attrs:{type:"primary"},on:{click:function(e){return t.save()}}},[t._v("保存")]):t._e()],1)],1)],1),t._v(" "),a("div",{staticClass:"sys-search"},[a("el-form",{staticClass:"form_item_search_out",attrs:{inline:""}},[a("div",{staticClass:"form_item_input_out"},[a("el-form-item",{staticClass:"form_item-inline",staticStyle:{width:"22%"},attrs:{label:"单据编号"}},[a("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:t.search_data.inheadCode,callback:function(e){t.$set(t.search_data,"inheadCode",e)},expression:"search_data.inheadCode"}})],1),t._v(" "),a("el-form-item",{staticClass:"form_item-inline",staticStyle:{width:"22%"},attrs:{label:"供应商"}},[a("el-input",{attrs:{placeholder:"模糊查询",clearable:""},model:{value:t.search_data.supplierName,callback:function(e){t.$set(t.search_data,"supplierName",e)},expression:"search_data.supplierName"}})],1),t._v(" "),a("el-form-item",{staticClass:"form_item-inline",staticStyle:{width:"22%"},attrs:{label:"物料"}},[a("el-input",{attrs:{placeholder:"模糊查询",clearable:""},model:{value:t.search_data.materielName,callback:function(e){t.$set(t.search_data,"materielName",e)},expression:"search_data.materielName"}})],1),t._v(" "),a("el-form-item",{staticClass:"form_item-inline",staticStyle:{width:"34%"},attrs:{label:"入库日期"}},[a("el-date-picker",{attrs:{type:"month",format:"yyyy-MM","value-format":"yyyy-MM-dd HH:mm:ss",placeholder:"请选择"},model:{value:t.search_data.periodTime,callback:function(e){t.$set(t.search_data,"periodTime",e)},expression:"search_data.periodTime"}})],1)],1),t._v(" "),a("div",{staticClass:"form_item_btn_out"},[a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.search()}}},[t._v("查询")])],1)],1)])],1),t._v(" "),a("div",{staticClass:"sys-table"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.pictLoading,expression:"pictLoading"}],ref:"tb",attrs:{border:"",id:"out-table","show-summary":"","summary-method":t.getSummaries,data:t.tableData,"header-cell-style":{fontWeight:"normal",textAlign:"center",backgroundColor:"#eceff4",color:"#222"}},on:{"selection-change":t.handleSelectionChange}},[a("el-table-column",{attrs:{prop:"inOutTime",label:"入库日期",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"sourceCompanyName",label:"供应商",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"purchaseType",label:"采购类型",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"inheadCode",label:"采购入库单号",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"serialno",label:"物料代码",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"materielName",label:"物料名称",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"specification",label:"规格型号",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"unitName",label:"主计量单位",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"count",label:"数量(主单位)",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"supportUomName",label:"辅助单位",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"inCount",label:"数量(辅助单位)",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"unitPrice",width:"180",label:"单价(元)",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input-number",{staticClass:"inputClass",staticStyle:{width:"100%"},attrs:{min:0,size:"small","controls-position":"right",disabled:t.isEdit},on:{change:function(a){return t.changeAmount(e.row,e.$index)}},model:{value:e.row.unitPrice,callback:function(a){t.$set(e.row,"unitPrice",a)},expression:"scope.row.unitPrice"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"amount",width:"180",label:"金额(元)",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input-number",{staticClass:"inputClass",staticStyle:{width:"100%"},attrs:{min:0,size:"small","controls-position":"right",disabled:t.isEdit},on:{change:function(a){return t.changeUnitPrice(e.row,e.$index)}},model:{value:e.row.amount,callback:function(a){t.$set(e.row,"amount",a)},expression:"scope.row.amount"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{prop:"expense",label:"采购费用(元)",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"auditSignName",label:"审核状态",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"sourceTypeName",label:"源单类型",align:"center","show-overflow-tooltip":""}}),t._v(" "),a("el-table-column",{attrs:{prop:"sourceCode",label:"源单单号",align:"center","show-overflow-tooltip":""}})],1),t._v(" "),a("div",{staticClass:"sys-pagination"},[a("el-pagination",{attrs:{"current-page":t.search_data.pageno,"page-sizes":t.pageSizes,"page-size":t.search_data.pagesize,layout:"total, sizes, prev, pager, next, jumper",total:t.total},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange}})],1)],1)])},staticRenderFns:[]};var o=a("VU/8")(n,s,!1,function(t){a("PPaE")},"data-v-1758f6bb",null);e.default=o.exports}}); |