1 line
130 KiB
JavaScript
1 line
130 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["c"],{"0498":function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"buy bill"},[t("el-form",{ref:"form",staticStyle:{height:"100%"},attrs:{model:e.form,rules:e.rules,inline:!0,"hide-required-asterisk":!0}},[t("el-form-item",{attrs:{label:"供应商",prop:"supplier"}},[t("template",{slot:"label"},[t("span",{on:{click:function(t){return e.switchPage("supplier")}}},[e._v("供应商")])]),t("nodList",{attrs:{placeholder:"请选择供应商",action:"service/supplierRecord",scene:"supplier"},on:{change:e.supplierChange},model:{value:e.form.supplier,callback:function(t){e.$set(e.form,"supplier",t)},expression:"form.supplier"}})],2),t("el-form-item",{attrs:{label:"单据日期",prop:"time"}},[t("el-date-picker",{attrs:{"value-format":"yyyy-MM-dd",type:"date",placeholder:"请选择单据日期"},model:{value:e.form.time,callback:function(t){e.$set(e.form,"time",t)},expression:"form.time"}})],1),t("el-form-item",{attrs:{label:"单据编号",prop:"number"}},[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.form.number,callback:function(t){e.$set(e.form,"number",t)},expression:"form.number"}})],1),t("el-divider",{staticClass:"fistDivider"}),t("ag-grid-vue",{directives:[{name:"madeAgGrid",rawName:"v-madeAgGrid"}],staticClass:"ag-theme-balham",staticStyle:{height:"calc(100% - 256px)"},attrs:{context:e.grid.context,defaultColDef:e.grid.coldef,gridOptions:e.grid.options,columnDefs:e.grid.column,getRowNodeId:e.grid.getRowNodeId,frameworkComponents:e.grid.components,tabToNextCell:e.$grid.gridTabToNextCell},on:{setter:function(t){e.goods.dialog=!0},schemeChange:e.schemeChange,quickEnter:e.quickEnter}}),t("Status",{attrs:{config:e.grid.status,source:e.info}},[1==e.form.examine?t("img",{staticClass:"billExamine",attrs:{src:"/static/images/lib/examine.png"}}):e._e()]),t("el-divider"),t("LineFeed",{attrs:{tag:".el-form-item",rule:3}},[t("el-form-item",{attrs:{label:"单据金额"}},[t("el-input",{attrs:{placeholder:"请输入单据金额",disabled:!0},model:{value:e.form.total,callback:function(t){e.$set(e.form,"total",t)},expression:"form.total"}})],1),t("el-form-item",{attrs:{label:"实际金额",prop:"actual"}},[t("el-input",{attrs:{placeholder:"请输入实际金额",clearable:""},model:{value:e.form.actual,callback:function(t){e.$set(e.form,"actual",t)},expression:"form.actual"}},[t("template",{slot:"suffix"},[t("i",{staticClass:"el-icon-copy-document",on:{click:function(t){e.form.actual=e.form.total}}})])],2)],1),t("el-form-item",{attrs:{label:"实付金额",prop:"money"}},[t("el-input",{attrs:{placeholder:"请输入实付金额",clearable:""},model:{value:e.form.money,callback:function(t){e.$set(e.form,"money",t)},expression:"form.money"}},[t("template",{slot:"suffix"},[t("i",{staticClass:"el-icon-copy-document",on:{click:function(t){e.form.money=e.form.actual}}})])],2)],1),t("el-form-item",{attrs:{label:"单据费用"}},[t("NodIet",{attrs:{type:"out"},on:{change:e.costChange},model:{value:e.cost,callback:function(t){e.cost=t},expression:"cost"}})],1),t("el-form-item",{attrs:{label:"结算账户"}},[t("nodList",{attrs:{placeholder:"请选择结算账户",action:"service/accountRecord",scene:"account"},model:{value:e.form.account,callback:function(t){e.$set(e.form,"account",t)},expression:"form.account"}})],1),t("el-form-item",{attrs:{label:"关联人员"}},[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.form.people,callback:function(t){e.$set(e.form,"people",t)},expression:"form.people"}})],1),t("el-form-item",{attrs:{label:"物流信息"}},[t("Logistics",{attrs:{more:e.supplier.more},model:{value:e.form.logistics,callback:function(t){e.$set(e.form,"logistics",t)},expression:"form.logistics"}})],1),t("el-form-item",{attrs:{label:"单据附件"}},[t("NodUpload",{attrs:{action:e.$base.web+"buy/upload"},model:{value:e.form.file,callback:function(t){e.$set(e.form,"file",t)},expression:"form.file"}})],1),t("FieldForm",{staticStyle:{display:"initial"},attrs:{rule:"buy",prefix:"more."},model:{value:e.form.more,callback:function(t){e.$set(e.form,"more",t)},expression:"form.more"}}),t("el-form-item",{attrs:{label:"备注信息"}},[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.form.data,callback:function(t){e.$set(e.form,"data",t)},expression:"form.data"}})],1)],1)],1),t("div",{staticClass:"layerBtn"},[t("el-button-group",[0==e.form.id||0==e.form.examine&&e.$lib.getUserRoot(e.store.root,"buy","edit")?[t("el-button",{attrs:{type:"info"},on:{click:e.save}},[e._v("保存")])]:e._e(),0!=e.form.id?[e.$lib.getUserRoot(e.store.root,"bre","add")&&1==e.form.examine?[t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"left","popper-class":"blockPopover",trigger:"click"}},[t("el-button",{attrs:{slot:"reference",type:"info"},slot:"reference"},[e._v("生成")]),t("ul",[t("li",{on:{click:e.buildBre}},[e._v("采购退货单")])])],1)]:e._e(),e.$lib.getUserRoot(e.store.root,"buy","examine")?[t("el-button",{attrs:{type:"info"},on:{click:e.examine}},[e._v(e._s(0==e.form.examine?"审核":"反审核"))])]:e._e(),t("el-button",{attrs:{type:"info"},on:{click:e.check}},[e._v(e._s(0==e.form.check?"核对":"反核对"))])]:e._e(),null==e.source?[t("el-button",{attrs:{type:"info"},on:{click:e.reload}},[e._v("刷新")])]:e._e()],2)],1),e.goods.dialog?t("GoodsList",{attrs:{parm:e.goods.parm},on:{destroy:e.goodsDestroy,choice:e.pushGrid}}):e._e()],1)},i=[],o=a("b85c"),r=(a("d9e2"),a("99af"),a("7db0"),a("d81d"),a("14d9"),a("a434"),a("b0c0"),a("b64b"),a("d3b7"),a("159b"),a("401b")),l=a("a389"),n=a("60f6"),c=a("fc0a"),u=a("9cf9"),d=a("326d"),m=a("56d9"),p=a("2ff6"),h=a("aac3"),f=a("b232"),g=a("5a8a"),b=a("09a0"),y=a("6b69"),v=a("6e60"),x=a("94ab"),$=a("b786"),w=a("c3e3"),k=a("a447"),_=a("ddf5"),C=a("5549"),R=a("b8a6"),D=a("5fb4"),F=a("1d84"),E={name:"Buy",components:{AgGridVue:r["AgGridVue"],Status:$["a"],LineFeed:w["a"],NodList:k["a"],NodIet:_["a"],NodUpload:C["a"],Logistics:R["a"],FieldForm:D["a"],GoodsList:F["a"]},props:{source:{default:null}},data:function(){var e=this;return{form:{id:0,source:0,supplier:null,time:"",number:"",total:0,actual:"",money:"",cost:0,account:null,people:null,logistics:{key:"auto",name:"自动识别",number:""},file:[],data:"",examine:0,check:0,more:{}},rules:{supplier:{required:!0,message:"请选择供应商",trigger:"change"},time:{required:!0,message:"请选择单据日期",trigger:"change"},number:{required:!0,message:"请输入单据编号",trigger:"blur"},actual:[{required:!0,message:"请输入实际金额",trigger:"blur"},{validator:function(t,a,s){e.$lib.synValidate("money",a)?s():s(new Error("实际金额不正确"))},trigger:"blur"}],money:[{required:!0,message:"请输入实付金额",trigger:"blur"},{validator:function(t,a,s){e.$lib.synValidate("money",a)?s():s(new Error("实付金额不正确"))},trigger:"blur"}]},supplier:{rate:0,more:[]},info:[],cost:[],grid:{options:{onGridReady:function(){e.$grid.addGridRow(e.grid.options)},onCellEditingStopped:function(e){e.context.runHandleGrid()}},context:{row:{uniqid:this.$lib.getUniqid(),key:null},runHandleGrid:function(){if(null==e.grid.options.api)return!1;e.handleGrid()}},coldef:{suppressMenu:!1,resizable:!0,singleClickEdit:!0,suppressMovable:!0},components:{dispose:l["a"],scheme:n["a"],storeroom:c["a"],allowance:u["a"],taxRate:d["a"],setter:m["a"],quickInput:p["a"],company:h["a"],depot:f["a"],storehouse:g["a"],batch:b["a"],validity:y["a"],price:v["a"],serial:x["a"]},getRowNodeId:function(e){return e.uniqid},column:[{headerName:"序号",width:50,field:"sequence",headerComponent:"dispose",headerComponentParams:{dispose:{key:"buy"}},valueGetter:function(e){return e.node.rowIndex+1},hide:!1,dispose:!1},{headerName:"操作",width:50,field:"setter",cellRenderer:"setter",hide:!1,dispose:!1},{headerName:"商品名称",width:150,field:"name",headerComponent:"scheme",headerComponentParams:{dispose:{title:"商品名称"}},editable:!0,cellEditor:"quickInput",hide:!1,dispose:!0},{headerName:"商品编号",width:120,field:"number",hide:!1,dispose:!0},{headerName:"规格型号",width:120,field:"spec",hide:!1,dispose:!0},{headerName:"辅助属性",width:120,field:"attr",hide:!1,dispose:!0},{headerName:"单位",width:120,field:"unit",editable:!0,cellEditor:"company",hide:!1,dispose:!0},{headerName:"仓库",width:120,field:"warehouse",headerComponent:"storeroom",headerComponentParams:{dispose:{title:"仓库",key:"warehouseId",text:"warehouse"}},cellRenderer:"depot",cellRendererParams:{dispose:{key:"warehouseId",text:"warehouse"}},editable:!0,cellEditor:"storehouse",cellEditorParams:{dispose:{key:"warehouseId",text:"warehouse"}},hide:!1,dispose:!0},{headerName:"批次号",width:120,field:"batch",editable:!0,cellEditor:"batch",hide:!0,dispose:!1},{headerName:"生产日期",width:120,field:"mfd",editable:!0,cellEditor:"validity",hide:!0,dispose:!1},{headerName:"单价",width:90,field:"price",editable:!0,cellEditor:"price",cellEditorParams:{dispose:{model:"buy",source:function(){return e.form.supplier}}},hide:!1,dispose:!0},{headerName:"数量",width:90,field:"nums",editable:!0,cellEditor:"serial",cellEditorParams:{dispose:{record:{show:!1}}},hide:!1,dispose:!0},{headerName:"退货数量",width:90,field:"retreat",hide:!0,dispose:!1},{headerName:"折扣率(%)",width:90,field:"discount",headerComponent:"allowance",headerComponentParams:{dispose:{title:"折扣率(%)",key:"discount"}},editable:!0,hide:!0,dispose:!0},{headerName:"折扣额",width:90,field:"dsc",hide:!0,dispose:!0},{headerName:"金额",width:120,field:"total",hide:!1,dispose:!0},{headerName:"税率(%)",width:90,field:"tax",headerComponent:"taxRate",headerComponentParams:{dispose:{title:"税率(%)",key:"tax"}},editable:!0,hide:!0,dispose:!1},{headerName:"税额",width:90,field:"tat",hide:!0,dispose:!1},{headerName:"价税合计",width:120,field:"tpt",hide:!0,dispose:!1},{headerName:"备注信息",width:120,field:"data",editable:!0,hide:!1,dispose:!0}],status:[{text:"总条数",type:"count"},{text:"总合计",type:"sum",key:"tpt"}]},scan:!1,goods:{dialog:!1,parm:{}}}},computed:{store:function(){return this.$store.state}},created:function(){this.init(),this.$bus.on("buildBuy",this.buildBuy)},methods:{init:function(){var e=this;null==this.source?(this.form.time=this.$moment().format("YYYY-MM-DD"),this.form.number="CGD"+this.$moment().format("YYMMDDHHmmssS")):this.$axios.post("buy/get",{parm:this.source}).then((function(t){"success"==t.state?(e.form=t.info.class,e.pushGrid(t.info.info,!1),e.cost=t.info.cost):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},save:function(){var e=this,t=this.$refs["form"];this.$lib.aloneValidate(t,["supplier","time","number"]).then((function(){var a=e.handleGrid();1==a?0==e.info.length?e.$message({type:"warning",message:"商品信息不可为空!"}):e.$lib.aloneValidate(t,["actual","money"]).then((function(){if(e.form.actual-0>e.form.total-0)e.$message({type:"warning",message:"实际金额不可大于单据金额!"});else if(e.form.money-0>e.form.actual-0)e.$message({type:"warning",message:"实付金额不可大于实际金额!"});else if(0!=e.form.money&&null==e.form.account)e.$message({type:"warning",message:"结算账户不可为空!"});else{var a=e.handleCost();1==a?t.validate((function(t){t?e.$axios.post("buy/save",{class:e.form,info:e.info,cost:e.cost}).then((function(t){"success"==t.state?e.store.sys.fun.examine&&0==e.form.id?(e.form.id=t.info,e.$message({type:"success",message:"审核单据中..."}),setTimeout((function(){e.examine()}),996)):(e.form.id=t.info,e.$message({type:"success",message:"单据保存成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})})):e.$message({type:"warning",message:"表单验证错误,请检查并修正!"})})):e.$message({type:"warning",message:a})}})).catch((function(t){e.$message({type:"warning",message:t})})):e.$message({type:"warning",message:a})})).catch((function(t){e.$message({type:"warning",message:t})}))},examine:function(){var e=this;this.$axios.post("buy/examine",{parm:[this.form.id]}).then((function(t){"success"==t.state?(e.form.examine=0==e.form.examine?1:0,e.$message({type:"success",message:(0==e.form.examine?"反审核":"审核")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},check:function(){var e=this;this.$axios.post("buy/check",{parm:[this.form.id]}).then((function(t){"success"==t.state?(e.form.check=0==e.form.check?1:0,e.$message({type:"success",message:(0==e.form.check?"反核对":"核对")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},buildBre:function(){var e=this;this.$axios.post("buy/buildBre",{id:this.form.id}).then((function(t){"success"==t.state?(e.$emit("destroy"),e.$bus.emit("switchPage","bre",!0),setTimeout((function(){e.$bus.emit("buildBre",t.info)}),600)):"warning"==t.state||"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},supplierChange:function(e){if(this.supplier.rate=0,this.supplier.more=[],e){this.supplier.rate=parseFloat(e.rate);var t=JSON.parse(e.contacts);if(t.length>0){var a=t.find((function(e){return e.main}));this.supplier.more.push("姓名:"+a.name),this.supplier.more.push("电话:"+a.tel),this.supplier.more.push("地址:"+a.add)}}},schemeChange:function(e){this.scan=e,this.$grid.startEditingLastCell(this.grid.options,"name")},quickEnter:function(e,t){var a=this,s=this.grid.options.api;if(!this.$lib.validate("empty",e)){var i=this.scan?{code:e}:{mate:e},o=Object.assign({page:1,limit:1},i);this.$axios.post("service/goodsRecord",o).then((function(e){if("success"==e.state)if(0==e.count)s.startEditingCell({rowIndex:t,colKey:"name"}),a.$message({type:"warning",message:"未匹配到商品数据!"});else if(1==e.count){var o=e.info[0];if(o.attr.length>1)a.goods.parm=i,a.goods.dialog=!0;else{if(0==o.attr.length)o.attr="",o.nums=1;else{var r=o.attr[0];o=Object.assign({},o,{attr:r.name,buy:r.buy,sell:r.sell,retail:r.retail,code:r.code,nums:1})}a.pushGrid([o]),a.scan&&s.startEditingCell({rowIndex:t+1,colKey:"name"})}}else a.goods.parm=i,a.goods.dialog=!0;else"error"==e.state?a.$message({type:"warning",message:e.info}):a.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))}},pushGrid:function(e){var t,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=[],i="buy",r=Object(o["a"])(e);try{for(r.s();!(t=r.n()).done;){var l=t.value,n=a?l:l.goodsData,c={uniqid:this.$lib.getUniqid(),source:l.hasOwnProperty("source")?l.source:0,key:n.id,goodsType:n.type,unitData:n.units,unitRelation:{valence:n[i],multiple:a?1:null},warehouseId:a?null:l.warehouse,batchType:n.batch,validityType:n.validity,serialType:n.serial,name:n.name,number:n.number,spec:n.spec,attr:l.attr,unit:a?"-1"==n.unit?"点击选择":n.unit:l.unit,warehouse:a?0==n.type?"点击选择":"":this.$lib.objectSeek(l,"warehouseData|name"),batch:a?"":l.batch,mfd:a?"":l.mfd,price:a?n[i]:l.price,nums:l.nums,serial:a?[]:l.serial,retreat:a?0:l.retreat,discount:a?0:l.discount,dsc:a?0:l.dsc,total:a?null:l.total,tax:a?this.supplier.rate:l.tax,tat:a?null:l.tat,tpt:a?null:l.tpt,data:a?"":l.data};if(a)c.total=this.$calc.chain(c.price).multiply(c.nums).round(this.store.sys.fun.digit.money).done(),0==c.tax?(c.tat=0,c.tpt=c.total):(c.tat=this.$calc.chain(c.total).divide(100).multiply(c.tax).round(2).done(),c.tpt=this.$calc.chain(c.total).add(c.tat).done());else if(c.unitData.length>0){var u=this.$lib.unitRelation(c.unit,c.unitData,this);c.unitRelation.multiple=u.multiple}s.push(c)}}catch(d){r.e(d)}finally{r.f()}this.$grid.pushGridData(this.grid.options,s),this.handleGrid()},handleGrid:function(){var e=!0,t=this.$grid.getGridData(this.grid.options);this.grid.options.columnApi.setColumnsVisible(["batch","mfd","retreat"],!1),void 0==t.find((function(e){return e.key&&e.batchType}))||this.grid.options.columnApi.setColumnVisible("batch",!0),void 0==t.find((function(e){return e.key&&e.validityType}))||this.grid.options.columnApi.setColumnVisible("mfd",!0),void 0==t.find((function(e){return e.key&&0!=e.retreat}))||this.grid.options.columnApi.setColumnVisible("retreat",!0);for(var a=[],s=0;s<t.length;s++)if(null==t[s].key)t.splice(s,1);else{if(t[s].unitData.length>0&&"点击选择"==t[s].unit){1==e&&(e="商品信息第"+(s+1)+"行单位不可为空!");continue}if(0==t[s].goodsType&&null==t[s].warehouseId){1==e&&(e="商品信息第"+(s+1)+"行仓库不可为空!");continue}if(t[s].batchType&&this.$lib.validate("empty",t[s].batch)){1==e&&(e="商品信息第"+(s+1)+"行批次号不可为空!");continue}if(t[s].validityType&&this.$lib.validate("empty",t[s].mfd)){1==e&&(e="商品信息第"+(s+1)+"行生产日期不可为空!");continue}if(!this.$lib.synValidate("money",t[s].price)){1==e&&(e="商品信息第"+(s+1)+"行单价不正确!");continue}if(!this.$lib.synValidate("nums",t[s].nums)){1==e&&(e="商品信息第"+(s+1)+"行数量不正确!");continue}if(t[s].serialType&&0==t[s].serial.length){1==e&&(e="商品信息第"+(s+1)+"行序列号不可为空!");continue}if(!this.$lib.validate("percentage",t[s].discount)){1==e&&(e="商品信息第"+(s+1)+"行折扣率不正确!");continue}if(!this.$lib.validate("percentage",t[s].tax)){1==e&&(e="商品信息第"+(s+1)+"行税率不正确!");continue}var i=this.$calc.chain(t[s].price).multiply(t[s].nums).round(this.store.sys.fun.digit.money).done();t[s].dsc=this.$calc.chain(i).divide(100).multiply(t[s].discount).round(this.store.sys.fun.digit.money).done(),t[s].total=this.$calc.chain(i).subtract(t[s].dsc).done(),t[s].tat=this.$calc.chain(t[s].total).divide(100).multiply(t[s].tax).round(2).done(),t[s].tpt=this.$calc.chain(t[s].total).add(t[s].tat).done(),this.grid.options.api.applyTransaction({update:[t[s]]}),a=a.concat(t[s].serial)}return 1==e&&(a.length!=this.$lib.distinct(a).length&&1==e&&(e="商品信息中存在重复序列号!"),this.$set(this,"info",t.map((function(e){return{source:e.source,goods:e.key,attr:e.attr,unit:e.unit,warehouse:e.warehouseId,batch:e.batch,mfd:e.mfd,price:e.price,nums:e.nums,serial:e.serial,discount:e.discount,dsc:e.dsc,total:e.total,tax:e.tax,tat:e.tat,tpt:e.tpt,data:e.data}}))),this.summary()),e},handleCost:function(){for(var e=!0,t=this.cost,a=0;a<t.length;a++)if(!this.$lib.synValidate("numerical",t[a].money)){e="单据费用第"+(a+1)+"行金额不正确!";break}return e},costChange:function(e){this.form.cost=e},summary:function(){var e=this.$calc.chain(0);this.info.forEach((function(t){e.add(t.tpt)})),this.form.total=e.done()},buildBuy:function(e){this.form.source=e.class.source,this.form.number="Z"+this.form.number,this.form.supplier=e.class.supplier,this.form.total=e.class.total,this.pushGrid(e.info,!1)},goodsDestroy:function(){this.goods.dialog=!1,this.goods.parm={},this.$grid.startEditingLastCell(this.grid.options,"name")},switchPage:function(e){this.$bus.emit("switchPage",e,!0)},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}},mounted:function(){this.store.sys.fun.tax&&this.grid.options.columnApi.setColumnsVisible(["tax","tat","tpt"],!0)},beforeDestroy:function(){this.$bus.off("buildBuy",this.buildBuy)}},N=E,P=a("2877"),T=Object(P["a"])(N,s,i,!1,null,null,null);t["default"]=T.exports},"06dc":function(e,t,a){"use strict";a("fb23")},"08d4":function(e,t,a){},"0ec7":function(e,t,a){},"2c3d":function(e,t,a){},"2cc5":function(e,t,a){"use strict";a("6ec3")},"2ddf":function(e,t,a){},"2f60":function(e,t,a){"use strict";a.r(t);a("b0c0");var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"breForm area"},[t("div",{staticClass:"layout"},[t("el-popover",{ref:"searchPopover",attrs:{"popper-class":"searchPopover",placement:"bottom-start"}},[t("el-form",{ref:"searchFrom",staticClass:"searchFrom",attrs:{inline:""}},[t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入商品名称",clearable:""},model:{value:e.searchFrom.goods,callback:function(t){e.$set(e.searchFrom,"goods",t)},expression:"searchFrom.goods"}})],1),t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.searchFrom.number,callback:function(t){e.$set(e.searchFrom,"number",t)},expression:"searchFrom.number"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择供应商",action:"service/supplierRecord",scene:"supplier"},model:{value:e.searchFrom.supplier,callback:function(t){e.$set(e.searchFrom,"supplier",t)},expression:"searchFrom.supplier"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择制单人",action:"service/userRecord",scene:"user"},model:{value:e.searchFrom.user,callback:function(t){e.$set(e.searchFrom,"user",t)},expression:"searchFrom.user"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"请输入开始日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.startTime,callback:function(t){e.$set(e.searchFrom,"startTime",t)},expression:"searchFrom.startTime"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"请输入结束日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.endTime,callback:function(t){e.$set(e.searchFrom,"endTime",t)},expression:"searchFrom.endTime"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.searchFrom.people,callback:function(t){e.$set(e.searchFrom,"people",t)},expression:"searchFrom.people"}})],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择审核状态",clearable:""},model:{value:e.searchFrom.examine,callback:function(t){e.$set(e.searchFrom,"examine",t)},expression:"searchFrom.examine"}},[t("el-option",{attrs:{label:"未审核",value:1}}),t("el-option",{attrs:{label:"已审核",value:2}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择核销状态",clearable:""},model:{value:e.searchFrom.nucleus,callback:function(t){e.$set(e.searchFrom,"nucleus",t)},expression:"searchFrom.nucleus"}},[t("el-option",{attrs:{label:"未核销",value:1}}),t("el-option",{attrs:{label:"部分核销",value:2}}),t("el-option",{attrs:{label:"已核销",value:3}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择费用状态",clearable:""},model:{value:e.searchFrom.cse,callback:function(t){e.$set(e.searchFrom,"cse",t)},expression:"searchFrom.cse"}},[t("el-option",{attrs:{label:"未结算",value:1}}),t("el-option",{attrs:{label:"部分结算",value:2}}),t("el-option",{attrs:{label:"已结算",value:3}}),t("el-option",{attrs:{label:"无需结算",value:4}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择发票状态",clearable:""},model:{value:e.searchFrom.invoice,callback:function(t){e.$set(e.searchFrom,"invoice",t)},expression:"searchFrom.invoice"}},[t("el-option",{attrs:{label:"未开具",value:1}}),t("el-option",{attrs:{label:"部分开具",value:2}}),t("el-option",{attrs:{label:"已开具",value:3}}),t("el-option",{attrs:{label:"无需开具",value:4}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择核对状态",clearable:""},model:{value:e.searchFrom.check,callback:function(t){e.$set(e.searchFrom,"check",t)},expression:"searchFrom.check"}},[t("el-option",{attrs:{label:"未核对",value:1}}),t("el-option",{attrs:{label:"已核对",value:2}})],1)],1),t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.searchFrom.data,callback:function(t){e.$set(e.searchFrom,"data",t)},expression:"searchFrom.data"}})],1),t("el-divider"),t("el-button",{staticClass:"searchBtn",attrs:{icon:"el-icon-search"},on:{click:function(t){return e.record(1)}}})],1),t("el-button",{attrs:{slot:"reference",icon:"el-icon-more"},slot:"reference"})],1),t("el-button-group",[0!=e.tableSelection.length?[t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"center","popper-class":"blockPopover",trigger:"click"}},[t("el-button",{attrs:{slot:"reference",type:"info"},slot:"reference"},[e._v("操作")]),t("ul",[e.$lib.getUserRoot(e.store.root,"bre","examine")?[t("li",{on:{click:function(t){return e.examine(0)}}},[e._v("审核")]),t("li",{on:{click:function(t){return e.examine(1)}}},[e._v("反审核")])]:e._e(),t("li",{on:{click:function(t){return e.check(0)}}},[e._v("核对")]),t("li",{on:{click:function(t){return e.check(1)}}},[e._v("反核对")])],2)],1),e.$lib.getUserRoot(e.store.root,"bre","del")?[t("el-button",{attrs:{type:"info"},on:{click:function(t){return e.del(e.tableSelection)}}},[e._v("删除")])]:e._e()]:e._e(),e.$lib.getUserRoot(e.store.root,"bre","batch")?[t("el-button",{on:{click:function(t){e.batch.dialog=!0}}},[e._v("批量")])]:e._e(),t("el-button",{on:{click:e.reload}},[e._v("刷新")])],2)],1),t("el-divider"),t("el-table",{directives:[{name:"madeTable",rawName:"v-madeTable"}],attrs:{data:e.tableData,height:"calc(100% - 90px)",border:""},on:{"selection-change":e.selectionChange}},[t("el-table-column",{attrs:{type:"selection",align:"center",width:"39px",fixed:"left"}}),t("el-table-column",{attrs:{prop:"frameData.name",label:"所属组织",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"supplierData.name",label:"供应商",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"number",label:"单据编号",align:"center",width:"200px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.relation.length?[t("span",{on:{click:function(t){return e.billShow(a.row.id)}}},[e._v(e._s(a.row.number))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",{on:{click:function(t){return e.billShow(a.row.id)}}},[e._v(e._s(a.row.number))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.relation,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"type",label:"单据类型",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"number",label:"单据编号",align:"center",width:"160px"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",{on:{click:function(t){return e.open(a.row)}}},[e._v(e._s(a.row.number))])]}}],null,!0)})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"total",label:"单据金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"actual",label:"实际金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"money",label:"单据收款",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"extension.amount",label:"核销金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"cost",label:"单据费用",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"peopleData.name",label:"关联人员",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"extension.examine",label:"审核状态",align:"center",width:"100px"}}),t("el-table-column",{attrs:{prop:"nucleus",label:"核销状态",align:"center",width:"100px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.billData.length?[t("span",[e._v(e._s(a.row.extension.nucleus))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(a.row.extension.nucleus))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.billData,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"extension.type",label:"单据类型",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"sourceData.number",label:"单据编号",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"money",label:"核销金额",align:"center",width:"90px"}})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"cse",label:"费用状态",align:"center",width:"100px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.costData.length?[t("span",[e._v(e._s(a.row.extension.cse))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(a.row.extension.cse))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.costData,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"ietData.name",label:"支出类别",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"money",label:"金额",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"settle",label:"结算金额",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"extension.state",label:"结算状态",align:"center",width:"90px"}})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"invoice",label:"发票状态",align:"center",width:"100px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.invoiceData.length?[t("span",[e._v(e._s(a.row.extension.invoice))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(a.row.extension.invoice))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.invoiceData,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"time",label:"开票日期",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"number",label:"发票号码",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"title",label:"发票抬头",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"money",label:"发票金额",align:"center",width:"90px"}})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"extension.check",label:"核对状态",align:"center",width:"100px"}}),t("el-table-column",{attrs:{prop:"userData.name",label:"制单人",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"data",label:"备注信息 ",align:"center","min-width":"200px"}}),t("el-table-column",{attrs:{prop:"set",label:"相关操作",align:"center",width:"180px",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("el-button-group",[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.billShow(a.row.id)}}},[e._v("详情")]),e.$lib.getUserRoot(e.store.root,"bre","del")?[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.del([a.row.id])}}},[e._v("删除")])]:e._e(),t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"right","popper-class":"listPopover",trigger:"click",placement:"bottom-end"}},[t("el-button",{staticStyle:{padding:"7px"},attrs:{slot:"reference",icon:"el-icon-arrow-down",size:"mini"},slot:"reference"}),t("ul",[e._l(a.row.recordData,(function(a){return[t("li",[e._v(" "+e._s(a.extension.time)+" - "+e._s(a.userData.name)+" - "+e._s(a.info)+" ")])]}))],2)],1)],2)]}}])})],1),t("el-pagination",{staticClass:"tablePagination",attrs:{"current-page":e.page.current,total:e.page.total,"page-size":e.page.size,"page-sizes":e.page.sizes,"pager-count":e.page.count,layout:"prev,pager,next,jumper,sizes,total,slot"},on:{"update:currentPage":function(t){return e.$set(e.page,"current",t)},"update:current-page":function(t){return e.$set(e.page,"current",t)},"update:pageSize":function(t){return e.$set(e.page,"size",t)},"update:page-size":function(t){return e.$set(e.page,"size",t)},"size-change":function(t){return e.record(1)},"current-change":function(t){return e.record(0)}}},[t("PageStatus",{attrs:{config:e.page.status,model:e.tableData}})],1),t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bill.dialog,title:"单据详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bill,"dialog",t)},close:e.billDestroy}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bill.dialog?[t("Bre",{attrs:{source:e.bill.source},on:{destroy:function(t){e.bill.dialog=!1}}})]:e._e()],2)],1),"buy"==e.bills.type?t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bills.dialog,title:"采购单详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bills,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bills.dialog?[t("Buy",{attrs:{source:e.bills.source},on:{destroy:function(t){e.bills.dialog=!1}}})]:e._e()],2)],1):e._e(),t("el-dialog",{directives:[{name:"madeDialog",rawName:"v-madeDialog"}],staticClass:"tabsDialog",attrs:{visible:e.batch.dialog,title:"批量",width:"420px"},on:{"update:visible":function(t){return e.$set(e.batch,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.batch.dialog?[t("el-tabs",{model:{value:e.batch.active,callback:function(t){e.$set(e.batch,"active",t)},expression:"batch.active"}},[t("el-tab-pane",{attrs:{label:"导入数据",name:"import"}},[t("ul",{staticClass:"importTip"},[t("li",[e._v("1.该功能适用于Excel导入单据数据。")]),t("li",[e._v("2.录入数据时,请勿修改首行数据标题以及排序。")]),t("li",[e._v("3.字段之间存在关联关系时,将自动进行关联运算。")]),t("li",[e._v("4.请查阅使用文档获取字段格式内容以及相关导入须知。")]),t("li",[e._v("5.点击下方上传模板,选择您编辑好的模板文件即可。")])]),t("el-divider"),t("el-row",{staticStyle:{"text-align":"center"}},[t("el-col",{attrs:{span:12}},[t("el-button",{attrs:{type:"info"},on:{click:e.downTemplate}},[e._v("下载模板")])],1),t("el-col",{attrs:{span:12}},[t("el-upload",{attrs:{action:e.$base.web+"bre/import",headers:{Token:e.$store.state.token},"show-file-list":!1,"on-success":e.importCall}},[t("el-button",{attrs:{type:"primary"}},[e._v("上传模板")])],1)],1)],1)],1),t("el-tab-pane",{staticClass:"exportGroup",attrs:{label:"导出数据",name:"export"}},[t("div",{staticClass:"item",on:{click:function(t){return e.exports("simple")}}},[t("i",{staticClass:"el-icon-download"}),t("p",[e._v("简易报表")])]),t("div",{staticClass:"item",on:{click:function(t){return e.exports("detailed")}}},[t("i",{staticClass:"el-icon-download"}),t("p",[e._v("详细报表")])])])],1)]:e._e()],2)],1)],1)},i=[],o=a("b85c"),r=(a("14d9"),a("d3b7"),a("159b"),a("5946")),l=a("0498"),n=a("a447"),c=a("947e"),u={name:"BreForm",components:{Bre:r["default"],Buy:l["default"],NodList:n["a"],PageStatus:c["a"]},data:function(){return{searchFrom:{goods:"",number:"",supplier:null,user:null,people:null,startTime:"",endTime:"",examine:"",nucleus:"",cse:"",invoice:"",check:"",data:""},tableData:[],tableSelection:[],page:{current:1,total:0,size:30,sizes:[30,60,90,150,300],count:5,status:[{text:"总单据金额",type:"sum",key:"total"},{text:"总实际金额",type:"sum",key:"actual"},{text:"总单据收款",type:"sum",key:"money"},{text:"总核销金额",type:"sum",key:"extension.amount"},{text:"总单据费用",type:"sum",key:"cost"}]},bill:{dialog:!1,source:null},bills:{type:null,dialog:!1,source:null},batch:{dialog:!1,active:"import"}}},created:function(){this.init(),this.record(1)},computed:{store:function(){return this.$store.state}},methods:{init:function(){this.searchFrom.startTime=this.$moment().subtract(this.store.sys.fun.days,"days").format("YYYY-MM-DD"),this.searchFrom.endTime=this.$moment().format("YYYY-MM-DD")},record:function(e){var t=this;0==e||(this.page.current=e);var a=Object.assign({page:this.page.current,limit:this.page.size},this.searchFrom);this.$axios.post("bre/record",a).then((function(e){"success"==e.state?(t.tableData=e.info,t.page.total=e.count,t.$refs["searchPopover"].showPopper=!1):"error"==e.state?t.$message({type:"warning",message:e.info}):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},billShow:function(e){this.bill.source=e,this.bill.dialog=!0},billDestroy:function(){this.record(0)},examine:function(e){var t=this,a=[];this.tableData.forEach((function(s){-1!=t.tableSelection.indexOf(s.id)&&(0==s.examine?0==e&&a.push(s.id):1==e&&a.push(s.id))})),0==a.length?this.$message({type:"warning",message:"无可操作单据!"}):this.$axios.post("bre/examine",{parm:a}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"操作单据成功!"})):"error"==e.state?(t.record(0),t.$message({type:"warning",message:e.info})):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},check:function(e){var t=this,a=[];this.tableData.forEach((function(s){-1!=t.tableSelection.indexOf(s.id)&&(0==s.check?0==e&&a.push(s.id):1==e&&a.push(s.id))})),0==a.length?this.$message({type:"warning",message:"无可操作单据!"}):this.$axios.post("bre/check",{parm:a}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"操作单据成功!"})):"error"==e.state?(t.record(0),t.$message({type:"warning",message:e.info})):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},del:function(e){var t=this;this.$confirm("您确定要删除选中数据吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){t.$axios.post("bre/del",{parm:e}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"删除成功!"})):"error"==e.state?t.$message({type:"warning",message:e.info}):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})})).catch((function(){}))}))},downTemplate:function(){var e=this;this.$message({type:"success",message:"[ 数据模板 ] 下载请求中..."}),setTimeout((function(){window.open(e.store.base.cdnSite+"/erp/batch/采购退货单导入模板.xlsx")}),1e3)},importCall:function(e,t,a){"success"==e.state?(this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"导入单据成功!"})):"error"==e.state?this.$message({type:"warning",message:"[ "+t.name+" ]"+e.info}):this.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})},exports:function(e){var t=this;if(0==this.tableSelection.length)this.$message({type:"warning",message:"未选择导出数据内容!"});else{this.$message({type:"success",message:"[ 导出数据 ] 请求中..."});var a=this.$lib.objToParm({scene:e,parm:this.tableSelection},!0);setTimeout((function(){window.open(t.$base.web+"bre/exports?"+a)}),1e3)}},open:function(e){this.bills.type=e.types,this.bills.source=e.id,this.bills.dialog=!0},selectionChange:function(e){var t,a=[],s=Object(o["a"])(e);try{for(s.s();!(t=s.n()).done;){var i=t.value;a.push(i.id)}}catch(r){s.e(r)}finally{s.f()}this.tableSelection=a},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}}},d=u,m=(a("91d9"),a("2877")),p=Object(m["a"])(d,s,i,!1,null,null,null);t["default"]=p.exports},"326d":function(e,t,a){"use strict";var s=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"taxRate"},[t("div",{staticClass:"title"},[t("span",[e._v(e._s(e.title)+" ")]),t("el-popover",{ref:"popover",attrs:{"popper-class":"taxRatePopper"},on:{show:e.showPopper}},[t("i",{staticClass:"el-icon-sort",attrs:{slot:"reference"},slot:"reference"}),t("el-input",{ref:"taxInput",attrs:{placeholder:"税率",size:"mini",clearable:""},nativeOn:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.save.apply(null,arguments)}},model:{value:e.value,callback:function(t){e.value=t},expression:"value"}},[t("template",{slot:"append"},[t("span",{staticClass:"btn",on:{click:e.save}},[e._v("保存")])])],2)],1)],1)])},i=[],o=a("2b0e"),r=o["default"].extend({name:"TaxRate",data:function(){return{title:"",value:""}},created:function(){this.title=this.params.dispose.title},methods:{save:function(){var e=this;this.$lib.validate("percentage",this.value)?(this.params.api.forEachNode((function(t){null!=t.data.key&&e.$grid.updateGridData(e.params,t.data.uniqid,e.params.dispose.key,e.value)})),this.params.context.runHandleGrid(),this.$refs.popover.showPopper=!1,this.$message({type:"success",message:"批量设置完成!"})):this.$message({type:"warning",message:"税率不正确!"})},showPopper:function(){var e=this;this.$nextTick((function(){e.$refs.taxInput.focus()}))}}}),l=r,n=(a("ee13"),a("bfa8"),a("2877")),c=Object(n["a"])(l,s,i,!1,null,"759fdb0a",null);t["a"]=c.exports},"35a9":function(e,t,a){"use strict";a("83a1")},"398a":function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"bor bill"},[t("el-form",{ref:"form",staticStyle:{height:"100%"},attrs:{model:e.form,rules:e.rules,inline:!0,"hide-required-asterisk":!0}},[t("el-form-item",{attrs:{label:"供应商",prop:"supplier"}},[t("template",{slot:"label"},[t("span",{on:{click:function(t){return e.switchPage("supplier")}}},[e._v("供应商")])]),t("nodList",{attrs:{placeholder:"请选择供应商",action:"service/supplierRecord",scene:"supplier"},on:{change:e.supplierChange},model:{value:e.form.supplier,callback:function(t){e.$set(e.form,"supplier",t)},expression:"form.supplier"}})],2),t("el-form-item",{attrs:{label:"单据日期",prop:"time"}},[t("el-date-picker",{attrs:{"value-format":"yyyy-MM-dd",type:"date",placeholder:"请选择单据日期"},model:{value:e.form.time,callback:function(t){e.$set(e.form,"time",t)},expression:"form.time"}})],1),t("el-form-item",{attrs:{label:"单据编号",prop:"number"}},[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.form.number,callback:function(t){e.$set(e.form,"number",t)},expression:"form.number"}})],1),t("el-divider",{staticClass:"fistDivider"}),t("ag-grid-vue",{directives:[{name:"madeAgGrid",rawName:"v-madeAgGrid"}],staticClass:"ag-theme-balham",staticStyle:{height:"calc(100% - 256px)"},attrs:{context:e.grid.context,defaultColDef:e.grid.coldef,gridOptions:e.grid.options,columnDefs:e.grid.column,getRowNodeId:e.grid.getRowNodeId,frameworkComponents:e.grid.components,tabToNextCell:e.$grid.gridTabToNextCell},on:{setter:function(t){e.goods.dialog=!0},schemeChange:e.schemeChange,quickEnter:e.quickEnter}}),t("Status",{attrs:{config:e.grid.status,source:e.info}},[1==e.form.examine?t("img",{staticClass:"billExamine",attrs:{src:3==e.form.state?"/static/images/lib/close.png":"/static/images/lib/examine.png"}}):e._e()]),t("el-divider"),t("LineFeed",{attrs:{tag:".el-form-item",rule:3}},[t("el-form-item",{attrs:{label:"单据金额"}},[t("el-input",{attrs:{placeholder:"请输入单据金额",disabled:!0},model:{value:e.form.total,callback:function(t){e.$set(e.form,"total",t)},expression:"form.total"}})],1),t("el-form-item",{attrs:{label:"实际金额",prop:"actual"}},[t("el-input",{attrs:{placeholder:"请输入实际金额",clearable:""},model:{value:e.form.actual,callback:function(t){e.$set(e.form,"actual",t)},expression:"form.actual"}},[t("template",{slot:"suffix"},[t("i",{staticClass:"el-icon-copy-document",on:{click:function(t){e.form.actual=e.form.total}}})])],2)],1),t("el-form-item",{attrs:{label:"关联人员"}},[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.form.people,callback:function(t){e.$set(e.form,"people",t)},expression:"form.people"}})],1),t("el-form-item",{attrs:{label:"到货日期",prop:"arrival"}},[t("el-date-picker",{attrs:{"value-format":"yyyy-MM-dd",type:"date",placeholder:"请选择单据日期"},model:{value:e.form.arrival,callback:function(t){e.$set(e.form,"arrival",t)},expression:"form.arrival"}})],1),t("el-form-item",{attrs:{label:"物流信息"}},[t("Logistics",{attrs:{more:e.supplier.more},model:{value:e.form.logistics,callback:function(t){e.$set(e.form,"logistics",t)},expression:"form.logistics"}})],1),t("el-form-item",{attrs:{label:"单据附件"}},[t("NodUpload",{attrs:{action:e.$base.web+"bor/upload"},model:{value:e.form.file,callback:function(t){e.$set(e.form,"file",t)},expression:"form.file"}})],1),t("FieldForm",{staticStyle:{display:"initial"},attrs:{rule:"bor",prefix:"more."},model:{value:e.form.more,callback:function(t){e.$set(e.form,"more",t)},expression:"form.more"}}),t("el-form-item",{attrs:{label:"备注信息"}},[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.form.data,callback:function(t){e.$set(e.form,"data",t)},expression:"form.data"}})],1)],1)],1),t("div",{staticClass:"layerBtn"},[t("el-button-group",[0==e.form.id||0==e.form.examine&&e.$lib.getUserRoot(e.store.root,"bor","edit")?[t("el-button",{attrs:{type:"info"},on:{click:e.save}},[e._v("保存")])]:e._e(),0!=e.form.id?[!e.$lib.getUserRoot(e.store.root,"buy","add")||1!=e.form.examine||0!=e.form.state&&1!=e.form.state?e._e():[t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"left","popper-class":"blockPopover",trigger:"click"}},[t("el-button",{attrs:{slot:"reference",type:"info"},slot:"reference"},[e._v("生成")]),t("ul",[t("li",{on:{click:e.buildBuy}},[e._v("采购单")])])],1)],e.$lib.getUserRoot(e.store.root,"bor","examine")?[3!=e.form.state?[t("el-button",{attrs:{type:"info"},on:{click:e.examine}},[e._v(e._s(0==e.form.examine?"审核":"反审核"))])]:e._e(),1!=e.form.examine||1!=e.form.state&&3!=e.form.state?e._e():[t("el-button",{attrs:{type:"info"},on:{click:e.update}},[e._v(e._s(1==e.form.state?"关闭":"开启"))])]]:e._e()]:e._e(),null==e.source?[t("el-button",{attrs:{type:"info"},on:{click:e.reload}},[e._v("刷新")])]:e._e()],2)],1),e.goods.dialog?t("GoodsList",{attrs:{parm:e.goods.parm},on:{destroy:e.goodsDestroy,choice:e.pushGrid}}):e._e()],1)},i=[],o=a("b85c"),r=a("ade3"),l=(a("d9e2"),a("7db0"),a("d81d"),a("14d9"),a("a434"),a("b0c0"),a("b64b"),a("d3b7"),a("159b"),a("401b")),n=a("a389"),c=a("60f6"),u=a("fc0a"),d=a("9cf9"),m=a("326d"),p=a("56d9"),h=a("2ff6"),f=a("aac3"),g=a("b232"),b=a("5a8a"),y=a("6e60"),v=a("b786"),x=a("c3e3"),$=a("a447"),w=a("5549"),k=a("b8a6"),_=a("5fb4"),C=a("1d84"),R={name:"Bor",components:{AgGridVue:l["AgGridVue"],Status:v["a"],LineFeed:x["a"],NodList:$["a"],NodUpload:w["a"],Logistics:k["a"],FieldForm:_["a"],GoodsList:C["a"]},props:{source:{default:null}},data:function(){var e=this;return{form:{id:0,supplier:null,time:"",number:"",total:0,actual:"",people:null,arrival:"",logistics:{key:"auto",name:"自动识别",number:""},file:[],data:"",examine:0,state:0,more:{}},rules:{supplier:{required:!0,message:"请选择供应商",trigger:"change"},time:{required:!0,message:"请选择单据日期",trigger:"change"},number:{required:!0,message:"请输入单据编号",trigger:"blur"},actual:[{required:!0,message:"请输入实际金额",trigger:"blur"},{validator:function(t,a,s){e.$lib.synValidate("money",a)?s():s(new Error("实际金额不正确"))},trigger:"blur"}]},supplier:{rate:0,more:[]},info:[],grid:{options:{onGridReady:function(){e.$grid.addGridRow(e.grid.options)},onCellEditingStopped:function(e){e.context.runHandleGrid()}},context:{row:{uniqid:this.$lib.getUniqid(),key:null},runHandleGrid:function(){if(null==e.grid.options.api)return!1;e.handleGrid()}},coldef:{suppressMenu:!1,resizable:!0,singleClickEdit:!0,suppressMovable:!0},components:{dispose:n["a"],scheme:c["a"],storeroom:u["a"],allowance:d["a"],taxRate:m["a"],setter:p["a"],quickInput:h["a"],company:f["a"],depot:g["a"],storehouse:b["a"],price:y["a"]},getRowNodeId:function(e){return e.uniqid},column:[{headerName:"序号",width:50,field:"sequence",headerComponent:"dispose",headerComponentParams:{dispose:{key:"bor"}},valueGetter:function(e){return e.node.rowIndex+1},hide:!1,dispose:!1},{headerName:"操作",width:50,field:"setter",cellRenderer:"setter",hide:!1,dispose:!1},{headerName:"商品名称",width:150,field:"name",headerComponent:"scheme",headerComponentParams:{dispose:{title:"商品名称"}},editable:!0,cellEditor:"quickInput",hide:!1,dispose:!0},{headerName:"商品编号",width:120,field:"number",hide:!1,dispose:!0},{headerName:"规格型号",width:120,field:"spec",hide:!1,dispose:!0},{headerName:"辅助属性",width:120,field:"attr",hide:!1,dispose:!0},{headerName:"单位",width:120,field:"unit",editable:!0,cellEditor:"company",hide:!1,dispose:!0},{headerName:"仓库",width:120,field:"warehouse",headerComponent:"storeroom",headerComponentParams:{dispose:{title:"仓库",key:"warehouseId",text:"warehouse"}},cellRenderer:"depot",cellRendererParams:{dispose:{key:"warehouseId",text:"warehouse"}},editable:!0,cellEditor:"storehouse",cellEditorParams:{dispose:{key:"warehouseId",text:"warehouse"}},hide:!1,dispose:!0},{headerName:"单价",width:90,field:"price",editable:!0,cellEditor:"price",cellEditorParams:{dispose:{model:"bor",source:function(){return e.form.supplier}}},hide:!1,dispose:!0},{headerName:"数量",width:90,field:"nums",editable:!0,hide:!1,dispose:!0},Object(r["a"])(Object(r["a"])({headerName:"入库数量",width:90,field:"handle",hide:1},"hide",!0),"dispose",!1),{headerName:"折扣率(%)",width:90,field:"discount",headerComponent:"allowance",headerComponentParams:{dispose:{title:"折扣率(%)",key:"discount"}},editable:!0,hide:!0,dispose:!0},{headerName:"折扣额",width:90,field:"dsc",hide:!0,dispose:!0},{headerName:"金额",width:120,field:"total",hide:!1,dispose:!0},{headerName:"税率(%)",width:90,field:"tax",headerComponent:"taxRate",headerComponentParams:{dispose:{title:"税率(%)",key:"tax"}},editable:!0,hide:!0,dispose:!1},{headerName:"税额",width:90,field:"tat",hide:!0,dispose:!1},{headerName:"价税合计",width:120,field:"tpt",hide:!0,dispose:!1},{headerName:"备注信息",width:120,field:"data",editable:!0,hide:!1,dispose:!0}],status:[{text:"总条数",type:"count"},{text:"总合计",type:"sum",key:"tpt"}]},scan:!1,goods:{dialog:!1,parm:{}}}},computed:{store:function(){return this.$store.state}},created:function(){this.init(),this.$bus.on("buildBor",this.buildBor)},methods:{init:function(){var e=this;null==this.source?(this.form.time=this.$moment().format("YYYY-MM-DD"),this.form.number="CGDD"+this.$moment().format("YYMMDDHHmmssS")):this.$axios.post("bor/get",{parm:this.source}).then((function(t){"success"==t.state?(e.form=t.info.class,e.pushGrid(t.info.info,!1)):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},save:function(){var e=this,t=this.$refs["form"];this.$lib.aloneValidate(t,["supplier","time","number"]).then((function(){var a=e.handleGrid();1==a?0==e.info.length?e.$message({type:"warning",message:"商品信息不可为空!"}):e.$lib.aloneValidate(t,["actual"]).then((function(){e.form.actual-0>e.form.total-0?e.$message({type:"warning",message:"实际金额不可大于单据金额!"}):t.validate((function(t){t?e.$axios.post("bor/save",{class:e.form,info:e.info}).then((function(t){"success"==t.state?e.store.sys.fun.examine&&0==e.form.id?(e.form.id=t.info,e.$message({type:"success",message:"审核单据中..."}),setTimeout((function(){e.examine()}),996)):(e.form.id=t.info,e.$message({type:"success",message:"单据保存成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})})):e.$message({type:"warning",message:"表单验证错误,请检查并修正!"})}))})).catch((function(t){e.$message({type:"warning",message:t})})):e.$message({type:"warning",message:a})})).catch((function(t){e.$message({type:"warning",message:t})}))},examine:function(){var e=this;this.$axios.post("bor/examine",{parm:[this.form.id]}).then((function(t){"success"==t.state?(e.form.examine=0==e.form.examine?1:0,e.$message({type:"success",message:(0==e.form.examine?"反审核":"审核")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},update:function(){var e=this;this.$axios.post("bor/update",{id:this.form.id}).then((function(t){"success"==t.state?(e.form.state=1==e.form.state?3:1,e.$message({type:"success",message:(1==e.form.state?"开启":"关闭")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},buildBuy:function(){var e=this;this.$axios.post("bor/buildBuy",{id:this.form.id}).then((function(t){"success"==t.state?(e.$emit("destroy"),e.$bus.emit("switchPage","buy",!0),setTimeout((function(){e.$bus.emit("buildBuy",t.info)}),600)):"warning"==t.state||"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},supplierChange:function(e){if(this.supplier.rate=0,this.supplier.more=[],e){this.supplier.rate=parseFloat(e.rate);var t=JSON.parse(e.contacts);if(t.length>0){var a=t.find((function(e){return e.main}));this.supplier.more.push("姓名:"+a.name),this.supplier.more.push("电话:"+a.tel),this.supplier.more.push("地址:"+a.add)}}},switchPage:function(e){this.$bus.emit("switchPage",e,!0)},schemeChange:function(e){this.scan=e,this.$grid.startEditingLastCell(this.grid.options,"name")},quickEnter:function(e,t){var a=this,s=this.grid.options.api;if(!this.$lib.validate("empty",e)){var i=this.scan?{code:e}:{mate:e},o=Object.assign({page:1,limit:1},i);this.$axios.post("service/goodsRecord",o).then((function(e){if("success"==e.state)if(0==e.count)s.startEditingCell({rowIndex:t,colKey:"name"}),a.$message({type:"warning",message:"未匹配到商品数据!"});else if(1==e.count){var o=e.info[0];if(o.attr.length>1)a.goods.parm=i,a.goods.dialog=!0;else{if(0==o.attr.length)o.attr="",o.nums=1;else{var r=o.attr[0];o=Object.assign({},o,{attr:r.name,buy:r.buy,sell:r.sell,retail:r.retail,code:r.code,nums:1})}a.pushGrid([o]),a.scan&&s.startEditingCell({rowIndex:t+1,colKey:"name"})}}else a.goods.parm=i,a.goods.dialog=!0;else"error"==e.state?a.$message({type:"warning",message:e.info}):a.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))}},pushGrid:function(e){var t,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=[],i="buy",r=Object(o["a"])(e);try{for(r.s();!(t=r.n()).done;){var l=t.value,n=a?l:l.goodsData,c={uniqid:this.$lib.getUniqid(),key:n.id,goodsType:n.type,unitData:n.units,unitRelation:{valence:n[i],multiple:a?1:null},warehouseId:a?null:l.warehouse,name:n.name,number:n.number,spec:n.spec,attr:l.attr,unit:a?"-1"==n.unit?"点击选择":n.unit:l.unit,warehouse:a?0==n.type?"点击选择":"":this.$lib.objectSeek(l,"warehouseData|name"),price:a?n[i]:l.price,nums:l.nums,handle:a?0:l.handle,discount:a?0:l.discount,dsc:a?0:l.dsc,total:a?null:l.total,tax:a?this.supplier.rate:l.tax,tat:a?null:l.tat,tpt:a?null:l.tpt,data:a?"":l.data};a&&(c.total=this.$calc.chain(c.price).multiply(c.nums).round(this.store.sys.fun.digit.money).done(),0==c.tax?(c.tat=0,c.tpt=c.total):(c.tat=this.$calc.chain(c.total).divide(100).multiply(c.tax).round(2).done(),c.tpt=this.$calc.chain(c.total).add(c.tat).done())),s.push(c)}}catch(u){r.e(u)}finally{r.f()}this.$grid.pushGridData(this.grid.options,s),this.handleGrid()},handleGrid:function(){for(var e=!0,t=this.$grid.getGridData(this.grid.options),a=0;a<t.length;a++)if(null==t[a].key)t.splice(a,1);else{if(t[a].unitData.length>0&&"点击选择"==t[a].unit){1==e&&(e="商品信息第"+(a+1)+"行单位不可为空!");continue}if(0==t[a].goodsType&&null==t[a].warehouseId){1==e&&(e="商品信息第"+(a+1)+"行仓库不可为空!");continue}if(!this.$lib.synValidate("money",t[a].price)){1==e&&(e="商品信息第"+(a+1)+"行单价不正确!");continue}if(!this.$lib.synValidate("nums",t[a].nums)){1==e&&(e="商品信息第"+(a+1)+"行数量不正确!");continue}if(!this.$lib.validate("percentage",t[a].discount)){1==e&&(e="商品信息第"+(a+1)+"行折扣率不正确!");continue}if(!this.$lib.validate("percentage",t[a].tax)){1==e&&(e="商品信息第"+(a+1)+"行税率不正确!");continue}var s=this.$calc.chain(t[a].price).multiply(t[a].nums).round(this.store.sys.fun.digit.money).done();t[a].dsc=this.$calc.chain(s).divide(100).multiply(t[a].discount).round(this.store.sys.fun.digit.money).done(),t[a].total=this.$calc.chain(s).subtract(t[a].dsc).done(),t[a].tat=this.$calc.chain(t[a].total).divide(100).multiply(t[a].tax).round(2).done(),t[a].tpt=this.$calc.chain(t[a].total).add(t[a].tat).done(),this.grid.options.api.applyTransaction({update:[t[a]]})}return 1==e&&(this.$set(this,"info",t.map((function(e){return{goods:e.key,attr:e.attr,unit:e.unit,warehouse:e.warehouseId,price:e.price,nums:e.nums,discount:e.discount,dsc:e.dsc,total:e.total,tax:e.tax,tat:e.tat,tpt:e.tpt,data:e.data}}))),this.summary()),e},summary:function(){var e=this.$calc.chain(0);this.info.forEach((function(t){e.add(t.tpt)})),this.form.total=e.done()},buildBor:function(e){this.form.source=e.class.source,this.form.number="Z"+this.form.number,this.form.total=e.class.total,this.pushGrid(e.info,!1)},goodsDestroy:function(){this.goods.dialog=!1,this.goods.parm={},this.$grid.startEditingLastCell(this.grid.options,"name")},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}},mounted:function(){this.source&&this.grid.options.columnApi.setColumnVisible("handle",!0),this.store.sys.fun.tax&&this.grid.options.columnApi.setColumnsVisible(["tax","tat","tpt"],!0)},beforeDestroy:function(){this.$bus.off("buildBor",this.buildBor)}},D=R,F=a("2877"),E=Object(F["a"])(D,s,i,!1,null,null,null);t["default"]=E.exports},"42a6":function(e,t,a){"use strict";a("2c3d")},5946:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"bre bill"},[t("el-form",{ref:"form",staticStyle:{height:"100%"},attrs:{model:e.form,rules:e.rules,inline:!0,"hide-required-asterisk":!0}},[t("el-form-item",{attrs:{label:"供应商",prop:"supplier"}},[t("template",{slot:"label"},[t("span",{on:{click:function(t){return e.switchPage("supplier")}}},[e._v("供应商")])]),t("nodList",{attrs:{placeholder:"请选择供应商",action:"service/supplierRecord",scene:"supplier"},on:{change:e.supplierChange},model:{value:e.form.supplier,callback:function(t){e.$set(e.form,"supplier",t)},expression:"form.supplier"}})],2),t("el-form-item",{attrs:{label:"单据日期",prop:"time"}},[t("el-date-picker",{attrs:{"value-format":"yyyy-MM-dd",type:"date",placeholder:"请选择单据日期"},model:{value:e.form.time,callback:function(t){e.$set(e.form,"time",t)},expression:"form.time"}})],1),t("el-form-item",{attrs:{label:"单据编号",prop:"number"}},[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.form.number,callback:function(t){e.$set(e.form,"number",t)},expression:"form.number"}})],1),t("el-divider",{staticClass:"fistDivider"}),t("ag-grid-vue",{directives:[{name:"madeAgGrid",rawName:"v-madeAgGrid"}],staticClass:"ag-theme-balham",staticStyle:{height:"calc(100% - 256px)"},attrs:{context:e.grid.context,defaultColDef:e.grid.coldef,gridOptions:e.grid.options,columnDefs:e.grid.column,getRowNodeId:e.grid.getRowNodeId,frameworkComponents:e.grid.components,tabToNextCell:e.$grid.gridTabToNextCell},on:{setter:function(t){e.goods.dialog=!0},schemeChange:e.schemeChange,quickEnter:e.quickEnter}}),t("Status",{attrs:{config:e.grid.status,source:e.info}},[1==e.form.examine?t("img",{staticClass:"billExamine",attrs:{src:"/static/images/lib/examine.png"}}):e._e()]),t("el-divider"),t("LineFeed",{attrs:{tag:".el-form-item",rule:3}},[t("el-form-item",{attrs:{label:"单据金额"}},[t("el-input",{attrs:{placeholder:"请输入单据金额",disabled:!0},model:{value:e.form.total,callback:function(t){e.$set(e.form,"total",t)},expression:"form.total"}})],1),t("el-form-item",{attrs:{label:"实际金额",prop:"actual"}},[t("el-input",{attrs:{placeholder:"请输入实际金额",clearable:""},model:{value:e.form.actual,callback:function(t){e.$set(e.form,"actual",t)},expression:"form.actual"}},[t("template",{slot:"suffix"},[t("i",{staticClass:"el-icon-copy-document",on:{click:function(t){e.form.actual=e.form.total}}})])],2)],1),t("el-form-item",{attrs:{label:"实收金额",prop:"money"}},[t("el-input",{attrs:{placeholder:"请输入实收金额",clearable:""},model:{value:e.form.money,callback:function(t){e.$set(e.form,"money",t)},expression:"form.money"}},[t("template",{slot:"suffix"},[t("i",{staticClass:"el-icon-copy-document",on:{click:function(t){e.form.money=e.form.actual}}})])],2)],1),t("el-form-item",{attrs:{label:"单据费用"}},[t("NodIet",{attrs:{type:"out"},on:{change:e.costChange},model:{value:e.cost,callback:function(t){e.cost=t},expression:"cost"}})],1),t("el-form-item",{attrs:{label:"结算账户"}},[t("nodList",{attrs:{placeholder:"请选择结算账户",action:"service/accountRecord",scene:"account"},model:{value:e.form.account,callback:function(t){e.$set(e.form,"account",t)},expression:"form.account"}})],1),t("el-form-item",{attrs:{label:"关联人员"}},[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.form.people,callback:function(t){e.$set(e.form,"people",t)},expression:"form.people"}})],1),t("el-form-item",{attrs:{label:"物流信息"}},[t("Logistics",{attrs:{more:e.supplier.more},model:{value:e.form.logistics,callback:function(t){e.$set(e.form,"logistics",t)},expression:"form.logistics"}})],1),t("el-form-item",{attrs:{label:"单据附件"}},[t("NodUpload",{attrs:{action:e.$base.web+"bre/upload"},model:{value:e.form.file,callback:function(t){e.$set(e.form,"file",t)},expression:"form.file"}})],1),t("FieldForm",{staticStyle:{display:"initial"},attrs:{rule:"bre",prefix:"more."},model:{value:e.form.more,callback:function(t){e.$set(e.form,"more",t)},expression:"form.more"}}),t("el-form-item",{attrs:{label:"备注信息"}},[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.form.data,callback:function(t){e.$set(e.form,"data",t)},expression:"form.data"}})],1)],1)],1),t("div",{staticClass:"layerBtn"},[t("el-button-group",[0==e.form.id||0==e.form.examine&&e.$lib.getUserRoot(e.store.root,"bre","edit")?[t("el-button",{attrs:{type:"info"},on:{click:e.save}},[e._v("保存")])]:e._e(),0!=e.form.id?[e.$lib.getUserRoot(e.store.root,"bre","examine")?[t("el-button",{attrs:{type:"info"},on:{click:e.examine}},[e._v(e._s(0==e.form.examine?"审核":"反审核"))])]:e._e(),t("el-button",{attrs:{type:"info"},on:{click:e.check}},[e._v(e._s(0==e.form.check?"核对":"反核对"))])]:e._e(),null==e.source?[t("el-button",{attrs:{type:"info"},on:{click:e.reload}},[e._v("刷新")])]:e._e()],2)],1),e.goods.dialog?t("GoodsList",{attrs:{parm:e.goods.parm},on:{destroy:e.goodsDestroy,choice:e.pushGrid}}):e._e()],1)},i=[],o=a("b85c"),r=(a("d9e2"),a("99af"),a("7db0"),a("d81d"),a("14d9"),a("a434"),a("b0c0"),a("b64b"),a("d3b7"),a("159b"),a("401b")),l=a("a389"),n=a("60f6"),c=a("fc0a"),u=a("9cf9"),d=a("326d"),m=a("56d9"),p=a("2ff6"),h=a("aac3"),f=a("b232"),g=a("5a8a"),b=a("09a0"),y=a("6b69"),v=a("6e60"),x=a("94ab"),$=a("b786"),w=a("c3e3"),k=a("a447"),_=a("ddf5"),C=a("5549"),R=a("b8a6"),D=a("5fb4"),F=a("1d84"),E={name:"Bre",components:{AgGridVue:r["AgGridVue"],Status:$["a"],LineFeed:w["a"],NodList:k["a"],NodIet:_["a"],NodUpload:C["a"],Logistics:R["a"],FieldForm:D["a"],GoodsList:F["a"]},props:{source:{default:null}},data:function(){var e=this;return{form:{id:0,source:0,supplier:null,time:"",number:"",total:0,actual:"",money:"",cost:0,account:null,invoice:"",people:null,logistics:{key:"auto",name:"自动识别",number:""},file:[],data:"",examine:0,check:0,more:{}},rules:{supplier:{required:!0,message:"请选择供应商",trigger:"change"},time:{required:!0,message:"请选择单据日期",trigger:"change"},number:{required:!0,message:"请输入单据编号",trigger:"blur"},actual:[{required:!0,message:"请输入实际金额",trigger:"blur"},{validator:function(t,a,s){e.$lib.synValidate("money",a)?s():s(new Error("实际金额不正确"))},trigger:"blur"}],money:[{required:!0,message:"请输入实收金额",trigger:"blur"},{validator:function(t,a,s){e.$lib.synValidate("money",a)?s():s(new Error("实收金额不正确"))},trigger:"blur"}]},supplier:{rate:0,more:[]},info:[],cost:[],grid:{options:{onGridReady:function(){e.$grid.addGridRow(e.grid.options)},onCellEditingStopped:function(e){e.context.runHandleGrid()}},context:{row:{uniqid:this.$lib.getUniqid(),key:null},runHandleGrid:function(){if(null==e.grid.options.api)return!1;e.handleGrid()}},coldef:{suppressMenu:!1,resizable:!0,singleClickEdit:!0,suppressMovable:!0},components:{dispose:l["a"],scheme:n["a"],storeroom:c["a"],allowance:u["a"],taxRate:d["a"],setter:m["a"],quickInput:p["a"],company:h["a"],depot:f["a"],storehouse:g["a"],batch:b["a"],validity:y["a"],price:v["a"],serial:x["a"]},getRowNodeId:function(e){return e.uniqid},column:[{headerName:"序号",width:50,field:"sequence",headerComponent:"dispose",headerComponentParams:{dispose:{key:"bre"}},valueGetter:function(e){return e.node.rowIndex+1},hide:!1,dispose:!1},{headerName:"操作",width:50,field:"setter",cellRenderer:"setter",hide:!1,dispose:!1},{headerName:"商品名称",width:150,field:"name",headerComponent:"scheme",headerComponentParams:{dispose:{title:"商品名称"}},editable:!0,cellEditor:"quickInput",hide:!1,dispose:!0},{headerName:"商品编号",width:120,field:"number",hide:!1,dispose:!0},{headerName:"规格型号",width:120,field:"spec",hide:!1,dispose:!0},{headerName:"辅助属性",width:120,field:"attr",hide:!1,dispose:!0},{headerName:"单位",width:120,field:"unit",editable:!0,cellEditor:"company",hide:!1,dispose:!0},{headerName:"仓库",width:120,field:"warehouse",headerComponent:"storeroom",headerComponentParams:{dispose:{title:"仓库",key:"warehouseId",text:"warehouse"}},cellRenderer:"depot",cellRendererParams:{dispose:{key:"warehouseId",text:"warehouse"}},editable:!0,cellEditor:"storehouse",cellEditorParams:{dispose:{key:"warehouseId",text:"warehouse"}},hide:!1,dispose:!0},{headerName:"批次号",width:120,field:"batch",editable:!0,cellEditor:"batch",hide:!0,dispose:!1},{headerName:"生产日期",width:120,field:"mfd",editable:!0,cellEditor:"validity",hide:!0,dispose:!1},{headerName:"单价",width:90,field:"price",editable:!0,cellEditor:"price",cellEditorParams:{dispose:{model:"bre",source:function(){return e.form.supplier}}},hide:!1,dispose:!0},{headerName:"数量",width:90,field:"nums",editable:!0,cellEditor:"serial",cellEditorParams:{dispose:{record:{show:!0,parm:{state:0}}}},hide:!1,dispose:!0},{headerName:"折扣率(%)",width:90,field:"discount",headerComponent:"allowance",headerComponentParams:{dispose:{title:"折扣率(%)",key:"discount"}},editable:!0,hide:!0,dispose:!0},{headerName:"折扣额",width:90,field:"dsc",hide:!0,dispose:!0},{headerName:"金额",width:120,field:"total",hide:!1,dispose:!0},{headerName:"税率(%)",width:90,field:"tax",headerComponent:"taxRate",headerComponentParams:{dispose:{title:"税率(%)",key:"tax"}},editable:!0,hide:!0,dispose:!1},{headerName:"税额",width:90,field:"tat",hide:!0,dispose:!1},{headerName:"价税合计",width:120,field:"tpt",hide:!0,dispose:!1},{headerName:"备注信息",width:120,field:"data",editable:!0,hide:!1,dispose:!0}],status:[{text:"总条数",type:"count"},{text:"总合计",type:"sum",key:"tpt"}]},scan:!1,goods:{dialog:!1,parm:{}}}},computed:{store:function(){return this.$store.state}},created:function(){this.init(),this.$bus.on("buildBre",this.buildBre)},methods:{init:function(){var e=this;null==this.source?(this.form.time=this.$moment().format("YYYY-MM-DD"),this.form.number="CGTHD"+this.$moment().format("YYMMDDHHmmssS")):this.$axios.post("bre/get",{parm:this.source}).then((function(t){"success"==t.state?(e.form=t.info.class,e.pushGrid(t.info.info,!1),e.cost=t.info.cost):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},save:function(){var e=this,t=this.$refs["form"];this.$lib.aloneValidate(t,["supplier","time","number"]).then((function(){var a=e.handleGrid();1==a?0==e.info.length?e.$message({type:"warning",message:"商品信息不可为空!"}):e.$lib.aloneValidate(t,["actual","money"]).then((function(){if(e.form.actual-0>e.form.total-0)e.$message({type:"warning",message:"实际金额不可大于单据金额!"});else if(e.form.money-0>e.form.actual-0)e.$message({type:"warning",message:"实收金额不可大于实际金额!"});else if(0!=e.form.money&&null==e.form.account)e.$message({type:"warning",message:"结算账户不可为空!"});else{var a=e.handleCost();1==a?t.validate((function(t){t?e.$axios.post("bre/save",{class:e.form,info:e.info,cost:e.cost}).then((function(t){"success"==t.state?e.store.sys.fun.examine&&0==e.form.id?(e.form.id=t.info,e.$message({type:"success",message:"审核单据中..."}),setTimeout((function(){e.examine()}),996)):(e.form.id=t.info,e.$message({type:"success",message:"单据保存成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})})):e.$message({type:"warning",message:"表单验证错误,请检查并修正!"})})):e.$message({type:"warning",message:a})}})).catch((function(t){e.$message({type:"warning",message:t})})):e.$message({type:"warning",message:a})})).catch((function(t){e.$message({type:"warning",message:t})}))},examine:function(){var e=this;this.$axios.post("bre/examine",{parm:[this.form.id]}).then((function(t){"success"==t.state?(e.form.examine=0==e.form.examine?1:0,e.$message({type:"success",message:(0==e.form.examine?"反审核":"审核")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},check:function(){var e=this;this.$axios.post("bre/check",{parm:[this.form.id]}).then((function(t){"success"==t.state?(e.form.check=0==e.form.check?1:0,e.$message({type:"success",message:(0==e.form.check?"反核对":"核对")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},supplierChange:function(e){if(this.supplier.rate=0,this.supplier.more=[],e){this.supplier.rate=parseFloat(e.rate);var t=JSON.parse(e.contacts);if(t.length>0){var a=t.find((function(e){return e.main}));this.supplier.more.push("姓名:"+a.name),this.supplier.more.push("电话:"+a.tel),this.supplier.more.push("地址:"+a.add)}}},schemeChange:function(e){this.scan=e,this.$grid.startEditingLastCell(this.grid.options,"name")},quickEnter:function(e,t){var a=this,s=this.grid.options.api;if(!this.$lib.validate("empty",e)){var i=this.scan?{code:e}:{mate:e},o=Object.assign({page:1,limit:1},i);this.$axios.post("service/goodsRecord",o).then((function(e){if("success"==e.state)if(0==e.count)s.startEditingCell({rowIndex:t,colKey:"name"}),a.$message({type:"warning",message:"未匹配到商品数据!"});else if(1==e.count){var o=e.info[0];if(o.attr.length>1)a.goods.parm=i,a.goods.dialog=!0;else{if(0==o.attr.length)o.attr="",o.nums=1;else{var r=o.attr[0];o=Object.assign({},o,{attr:r.name,buy:r.buy,sell:r.sell,retail:r.retail,code:r.code,nums:1})}a.pushGrid([o]),a.scan&&s.startEditingCell({rowIndex:t+1,colKey:"name"})}}else a.goods.parm=i,a.goods.dialog=!0;else"error"==e.state?a.$message({type:"warning",message:e.info}):a.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))}},pushGrid:function(e){var t,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=[],i="buy",r=Object(o["a"])(e);try{for(r.s();!(t=r.n()).done;){var l=t.value,n=a?l:l.goodsData,c={uniqid:this.$lib.getUniqid(),source:l.hasOwnProperty("source")?l.source:0,key:n.id,goodsType:n.type,unitData:n.units,unitRelation:{valence:n[i],multiple:a?1:null},warehouseId:a?null:l.warehouse,batchType:n.batch,validityType:n.validity,serialType:n.serial,name:n.name,number:n.number,spec:n.spec,attr:l.attr,unit:a?"-1"==n.unit?"点击选择":n.unit:l.unit,warehouse:a?0==n.type?"点击选择":"":this.$lib.objectSeek(l,"warehouseData|name"),batch:a?"":l.batch,mfd:a?"":l.mfd,price:a?n[i]:l.price,nums:l.nums,serial:a?[]:l.serial,discount:a?0:l.discount,dsc:a?0:l.dsc,total:a?null:l.total,tax:a?this.supplier.rate:l.tax,tat:a?null:l.tat,tpt:a?null:l.tpt,data:a?"":l.data};if(a)c.total=this.$calc.chain(c.price).multiply(c.nums).round(this.store.sys.fun.digit.money).done(),0==c.tax?(c.tat=0,c.tpt=c.total):(c.tat=this.$calc.chain(c.total).divide(100).multiply(c.tax).round(2).done(),c.tpt=this.$calc.chain(c.total).add(c.tat).done());else if(c.unitData.length>0){var u=this.$lib.unitRelation(c.unit,c.unitData,this);c.unitRelation.multiple=u.multiple}s.push(c)}}catch(d){r.e(d)}finally{r.f()}this.$grid.pushGridData(this.grid.options,s),this.handleGrid()},handleGrid:function(){var e=!0,t=this.$grid.getGridData(this.grid.options);this.grid.options.columnApi.setColumnsVisible(["batch","mfd"],!1),void 0==t.find((function(e){return e.key&&e.batchType}))||this.grid.options.columnApi.setColumnVisible("batch",!0),void 0==t.find((function(e){return e.key&&e.validityType}))||this.grid.options.columnApi.setColumnVisible("mfd",!0);for(var a=[],s=0;s<t.length;s++)if(null==t[s].key)t.splice(s,1);else{if(t[s].unitData.length>0&&"点击选择"==t[s].unit){1==e&&(e="商品信息第"+(s+1)+"行单位不可为空!");continue}if(0==t[s].goodsType&&null==t[s].warehouseId){1==e&&(e="商品信息第"+(s+1)+"行仓库不可为空!");continue}if(t[s].batchType&&this.$lib.validate("empty",t[s].batch)){1==e&&(e="商品信息第"+(s+1)+"行批次号不可为空!");continue}if(t[s].validityType&&this.$lib.validate("empty",t[s].mfd)){1==e&&(e="商品信息第"+(s+1)+"行生产日期不可为空!");continue}if(!this.$lib.synValidate("money",t[s].price)){1==e&&(e="商品信息第"+(s+1)+"行单价不正确!");continue}if(!this.$lib.synValidate("nums",t[s].nums)){1==e&&(e="商品信息第"+(s+1)+"行数量不正确!");continue}if(t[s].serialType&&0==t[s].serial.length){1==e&&(e="商品信息第"+(s+1)+"行序列号不可为空!");continue}if(!this.$lib.validate("percentage",t[s].discount)){1==e&&(e="商品信息第"+(s+1)+"行折扣率不正确!");continue}if(!this.$lib.validate("percentage",t[s].tax)){1==e&&(e="商品信息第"+(s+1)+"行税率不正确!");continue}var i=this.$calc.chain(t[s].price).multiply(t[s].nums).round(this.store.sys.fun.digit.money).done();t[s].dsc=this.$calc.chain(i).divide(100).multiply(t[s].discount).round(this.store.sys.fun.digit.money).done(),t[s].total=this.$calc.chain(i).subtract(t[s].dsc).done(),t[s].tat=this.$calc.chain(t[s].total).divide(100).multiply(t[s].tax).round(2).done(),t[s].tpt=this.$calc.chain(t[s].total).add(t[s].tat).done(),this.grid.options.api.applyTransaction({update:[t[s]]}),a=a.concat(t[s].serial)}return 1==e&&(a.length!=this.$lib.distinct(a).length&&1==e&&(e="商品信息中存在重复序列号!"),this.$set(this,"info",t.map((function(e){return{source:e.source,goods:e.key,attr:e.attr,unit:e.unit,warehouse:e.warehouseId,batch:e.batch,mfd:e.mfd,price:e.price,nums:e.nums,serial:e.serial,discount:e.discount,dsc:e.dsc,total:e.total,tax:e.tax,tat:e.tat,tpt:e.tpt,data:e.data}}))),this.summary()),e},handleCost:function(){for(var e=!0,t=this.cost,a=0;a<t.length;a++)if(!this.$lib.synValidate("numerical",t[a].money)){e="单据费用第"+(a+1)+"行金额不正确!";break}return e},costChange:function(e){this.form.cost=e},summary:function(){var e=this.$calc.chain(0);this.info.forEach((function(t){e.add(t.tpt)})),this.form.total=e.done()},buildBre:function(e){this.form.source=e.class.source,this.form.number="Z"+this.form.number,this.form.supplier=e.class.supplier,this.form.total=e.class.total,this.pushGrid(e.info,!1)},goodsDestroy:function(){this.goods.dialog=!1,this.goods.parm={},this.$grid.startEditingLastCell(this.grid.options,"name")},switchPage:function(e){this.$bus.emit("switchPage",e,!0)},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}},mounted:function(){this.store.sys.fun.tax&&this.grid.options.columnApi.setColumnsVisible(["tax","tat","tpt"],!0)},beforeDestroy:function(){this.$bus.off("buildBre",this.buildBre)}},N=E,P=a("2877"),T=Object(P["a"])(N,s,i,!1,null,null,null);t["default"]=T.exports},"6e60":function(e,t,a){"use strict";var s=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"inputGroup"},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.value,expression:"value"}],ref:"input",staticClass:"ag-cell-edit-input",attrs:{type:"text"},domProps:{value:e.value},on:{input:function(t){t.target.composing||(e.value=t.target.value)}}}),t("el-popover",{staticClass:"popoverTag",attrs:{"popper-class":"agPricePopover",trigger:"click"},on:{show:e.getPrice}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("i",{staticClass:"el-icon-collection-tag",on:{click:e.showPopover}})]),t("p",{staticClass:"priceText",on:{click:e.setPrice}},[e._v("最近价格:"+e._s(e.price))])])],1)},i=[],o=a("2b0e"),r=o["default"].extend({name:"Price",data:function(){return{value:"",price:0}},created:function(){this.value=this.params.value},computed:{hasData:function(){return null!=this.params.node.data.key},modelText:function(){var e=this.params.dispose.model;return-1==["bor","buy","bre","sor","sell","sre"].indexOf(e)?"未识别的模块":-1!=["bor","buy","bre"].indexOf(e)?"供应商":"客户"}},methods:{showPopover:function(e){if(null==this.params.dispose.source())this.$message({type:"warning",message:"请先选择"+this.modelText}),e.stopPropagation();else{var t=this.params.node.data;t.unitData.length>0&&"点击选择"==t.unit&&(this.$message({type:"warning",message:"请先选择单位"}),e.stopPropagation())}},getPrice:function(){var e=this,t=this.params.dispose,a=this.params.node.data;this.$axios.post("service/recentPrice",{model:t.model,source:t.source(),goods:a.key,attr:a.attr,unit:a.unit}).then((function(t){"success"==t.state?e.price=t.info:"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},setPrice:function(){0!=this.price&&(this.value=this.price,this.$el.parentNode.focus(),this.params.api.stopEditing())},getValue:function(){return this.value},isCancelBeforeStart:function(){return!this.hasData}},mounted:function(){var e=this;this.hasData&&this.$nextTick((function(){e.$refs.input.focus(),e.$refs.input.select()}))}}),l=r,n=(a("06dc"),a("ebf2"),a("2877")),c=Object(n["a"])(l,s,i,!1,null,"371b20ac",null);t["a"]=c.exports},"6ec3":function(e,t,a){},"83a1":function(e,t,a){},"91d9":function(e,t,a){"use strict";a("2ddf")},9542:function(e,t,a){},"966d":function(e,t,a){"use strict";a("b7cb")},"9cf9":function(e,t,a){"use strict";var s=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"allowance"},[t("div",{staticClass:"title"},[t("span",[e._v(e._s(e.title)+" ")]),t("el-popover",{ref:"popover",attrs:{"popper-class":"allowancePopper"},on:{show:e.showPopper}},[t("i",{staticClass:"el-icon-sort",attrs:{slot:"reference"},slot:"reference"}),t("el-input",{ref:"taxInput",attrs:{placeholder:"折扣率",size:"mini",clearable:""},nativeOn:{keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.save.apply(null,arguments)}},model:{value:e.value,callback:function(t){e.value=t},expression:"value"}},[t("template",{slot:"append"},[t("span",{staticClass:"btn",on:{click:e.save}},[e._v("保存")])])],2)],1)],1)])},i=[],o=a("2b0e"),r=o["default"].extend({name:"Allowance",data:function(){return{title:"",value:""}},created:function(){this.title=this.params.dispose.title},methods:{save:function(){var e=this;this.$lib.validate("percentage",this.value)?(this.params.api.forEachNode((function(t){null!=t.data.key&&e.$grid.updateGridData(e.params,t.data.uniqid,e.params.dispose.key,e.value)})),this.params.context.runHandleGrid(),this.$refs.popover.showPopper=!1,this.$message({type:"success",message:"批量设置完成!"})):this.$message({type:"warning",message:"折扣率不正确!"})},showPopper:function(){var e=this;this.$nextTick((function(){e.$refs.taxInput.focus()}))}}}),l=r,n=(a("42a6"),a("35a9"),a("2877")),c=Object(n["a"])(l,s,i,!1,null,"c0e4b784",null);t["a"]=c.exports},b262:function(e,t,a){"use strict";a.r(t);a("b0c0");var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"buyForm area"},[t("div",{staticClass:"layout"},[t("el-popover",{ref:"searchPopover",attrs:{"popper-class":"searchPopover",placement:"bottom-start"}},[t("el-form",{ref:"searchFrom",staticClass:"searchFrom",attrs:{inline:""}},[t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入商品名称",clearable:""},model:{value:e.searchFrom.goods,callback:function(t){e.$set(e.searchFrom,"goods",t)},expression:"searchFrom.goods"}})],1),t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.searchFrom.number,callback:function(t){e.$set(e.searchFrom,"number",t)},expression:"searchFrom.number"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择供应商",action:"service/supplierRecord",scene:"supplier"},model:{value:e.searchFrom.supplier,callback:function(t){e.$set(e.searchFrom,"supplier",t)},expression:"searchFrom.supplier"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择制单人",action:"service/userRecord",scene:"user"},model:{value:e.searchFrom.user,callback:function(t){e.$set(e.searchFrom,"user",t)},expression:"searchFrom.user"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"请输入开始日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.startTime,callback:function(t){e.$set(e.searchFrom,"startTime",t)},expression:"searchFrom.startTime"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"请输入结束日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.endTime,callback:function(t){e.$set(e.searchFrom,"endTime",t)},expression:"searchFrom.endTime"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.searchFrom.people,callback:function(t){e.$set(e.searchFrom,"people",t)},expression:"searchFrom.people"}})],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择审核状态",clearable:""},model:{value:e.searchFrom.examine,callback:function(t){e.$set(e.searchFrom,"examine",t)},expression:"searchFrom.examine"}},[t("el-option",{attrs:{label:"未审核",value:1}}),t("el-option",{attrs:{label:"已审核",value:2}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择核销状态",clearable:""},model:{value:e.searchFrom.nucleus,callback:function(t){e.$set(e.searchFrom,"nucleus",t)},expression:"searchFrom.nucleus"}},[t("el-option",{attrs:{label:"未核销",value:1}}),t("el-option",{attrs:{label:"部分核销",value:2}}),t("el-option",{attrs:{label:"已核销",value:3}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择费用状态",clearable:""},model:{value:e.searchFrom.cse,callback:function(t){e.$set(e.searchFrom,"cse",t)},expression:"searchFrom.cse"}},[t("el-option",{attrs:{label:"未结算",value:1}}),t("el-option",{attrs:{label:"部分结算",value:2}}),t("el-option",{attrs:{label:"已结算",value:3}}),t("el-option",{attrs:{label:"无需结算",value:4}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择发票状态",clearable:""},model:{value:e.searchFrom.invoice,callback:function(t){e.$set(e.searchFrom,"invoice",t)},expression:"searchFrom.invoice"}},[t("el-option",{attrs:{label:"未开具",value:1}}),t("el-option",{attrs:{label:"部分开具",value:2}}),t("el-option",{attrs:{label:"已开具",value:3}}),t("el-option",{attrs:{label:"无需开具",value:4}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择核对状态",clearable:""},model:{value:e.searchFrom.check,callback:function(t){e.$set(e.searchFrom,"check",t)},expression:"searchFrom.check"}},[t("el-option",{attrs:{label:"未核对",value:1}}),t("el-option",{attrs:{label:"已核对",value:2}})],1)],1),t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.searchFrom.data,callback:function(t){e.$set(e.searchFrom,"data",t)},expression:"searchFrom.data"}})],1),t("el-divider"),t("el-button",{staticClass:"searchBtn",attrs:{icon:"el-icon-search"},on:{click:function(t){return e.record(1)}}})],1),t("el-button",{attrs:{slot:"reference",icon:"el-icon-more"},slot:"reference"})],1),t("el-button-group",[0!=e.tableSelection.length?[t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"center","popper-class":"blockPopover",trigger:"click"}},[t("el-button",{attrs:{slot:"reference",type:"info"},slot:"reference"},[e._v("操作")]),t("ul",[e.$lib.getUserRoot(e.store.root,"buy","examine")?[t("li",{on:{click:function(t){return e.examine(0)}}},[e._v("审核")]),t("li",{on:{click:function(t){return e.examine(1)}}},[e._v("反审核")])]:e._e(),t("li",{on:{click:function(t){return e.check(0)}}},[e._v("核对")]),t("li",{on:{click:function(t){return e.check(1)}}},[e._v("反核对")])],2)],1),e.$lib.getUserRoot(e.store.root,"buy","del")?[t("el-button",{attrs:{type:"info"},on:{click:function(t){return e.del(e.tableSelection)}}},[e._v("删除")])]:e._e()]:e._e(),e.$lib.getUserRoot(e.store.root,"buy","batch")?[t("el-button",{on:{click:function(t){e.batch.dialog=!0}}},[e._v("批量")])]:e._e(),t("el-button",{on:{click:e.reload}},[e._v("刷新")])],2)],1),t("el-divider"),t("el-table",{directives:[{name:"madeTable",rawName:"v-madeTable"}],attrs:{data:e.tableData,height:"calc(100% - 90px)",border:""},on:{"selection-change":e.selectionChange}},[t("el-table-column",{attrs:{type:"selection",align:"center",width:"39px",fixed:"left"}}),t("el-table-column",{attrs:{prop:"frameData.name",label:"所属组织",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"supplierData.name",label:"供应商",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"number",label:"单据编号",align:"center",width:"200px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.relation.length?[t("span",{on:{click:function(t){return e.billShow(a.row.id)}}},[e._v(e._s(a.row.number))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",{on:{click:function(t){return e.billShow(a.row.id)}}},[e._v(e._s(a.row.number))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.relation,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"type",label:"单据类型",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"number",label:"单据编号",align:"center",width:"160px"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",{on:{click:function(t){return e.open(a.row)}}},[e._v(e._s(a.row.number))])]}}],null,!0)})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"total",label:"单据金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"actual",label:"实际金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"money",label:"单据付款",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"extension.amount",label:"核销金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"cost",label:"单据费用",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"peopleData.name",label:"关联人员",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"extension.examine",label:"审核状态",align:"center",width:"100px"}}),t("el-table-column",{attrs:{prop:"nucleus",label:"核销状态",align:"center",width:"100px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.billData.length?[t("span",[e._v(e._s(a.row.extension.nucleus))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(a.row.extension.nucleus))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.billData,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"extension.type",label:"单据类型",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"sourceData.number",label:"单据编号",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"money",label:"核销金额",align:"center",width:"90px"}})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"cse",label:"费用状态",align:"center",width:"100px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.costData.length?[t("span",[e._v(e._s(a.row.extension.cse))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(a.row.extension.cse))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.costData,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"ietData.name",label:"支出类别",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"money",label:"金额",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"settle",label:"结算金额",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"extension.state",label:"结算状态",align:"center",width:"90px"}})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"invoice",label:"发票状态",align:"center",width:"100px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.invoiceData.length?[t("span",[e._v(e._s(a.row.extension.invoice))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",[e._v(e._s(a.row.extension.invoice))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.invoiceData,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"time",label:"开票日期",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"number",label:"发票号码",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"title",label:"发票抬头",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"money",label:"发票金额",align:"center",width:"90px"}})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"extension.check",label:"核对状态",align:"center",width:"100px"}}),t("el-table-column",{attrs:{prop:"userData.name",label:"制单人",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"data",label:"备注信息 ",align:"center","min-width":"200px"}}),t("el-table-column",{attrs:{prop:"set",label:"相关操作",align:"center",width:"180px",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("el-button-group",[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.billShow(a.row.id)}}},[e._v("详情")]),e.$lib.getUserRoot(e.store.root,"buy","del")?[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.del([a.row.id])}}},[e._v("删除")])]:e._e(),t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"right","popper-class":"listPopover",trigger:"click",placement:"bottom-end"}},[t("el-button",{staticStyle:{padding:"7px"},attrs:{slot:"reference",icon:"el-icon-arrow-down",size:"mini"},slot:"reference"}),t("ul",[e._l(a.row.recordData,(function(a){return[t("li",[e._v(" "+e._s(a.extension.time)+" - "+e._s(a.userData.name)+" - "+e._s(a.info)+" ")])]}))],2)],1)],2)]}}])})],1),t("el-pagination",{staticClass:"tablePagination",attrs:{"current-page":e.page.current,total:e.page.total,"page-size":e.page.size,"page-sizes":e.page.sizes,"pager-count":e.page.count,layout:"prev,pager,next,jumper,sizes,total,slot"},on:{"update:currentPage":function(t){return e.$set(e.page,"current",t)},"update:current-page":function(t){return e.$set(e.page,"current",t)},"update:pageSize":function(t){return e.$set(e.page,"size",t)},"update:page-size":function(t){return e.$set(e.page,"size",t)},"size-change":function(t){return e.record(1)},"current-change":function(t){return e.record(0)}}},[t("PageStatus",{attrs:{config:e.page.status,model:e.tableData}})],1),t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bill.dialog,title:"单据详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bill,"dialog",t)},close:e.billDestroy}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bill.dialog?[t("Buy",{attrs:{source:e.bill.source},on:{destroy:function(t){e.bill.dialog=!1}}})]:e._e()],2)],1),"bor"==e.bills.type?t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bills.dialog,title:"采购订单详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bills,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bills.dialog?[t("Bor",{attrs:{source:e.bills.source},on:{destroy:function(t){e.bills.dialog=!1}}})]:e._e()],2)],1):e._e(),"bre"==e.bills.type?t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bills.dialog,title:"销售退货单详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bills,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bills.dialog?[t("Bre",{attrs:{source:e.bills.source},on:{destroy:function(t){e.bills.dialog=!1}}})]:e._e()],2)],1):e._e(),t("el-dialog",{directives:[{name:"madeDialog",rawName:"v-madeDialog"}],staticClass:"tabsDialog",attrs:{visible:e.batch.dialog,title:"批量",width:"420px"},on:{"update:visible":function(t){return e.$set(e.batch,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.batch.dialog?[t("el-tabs",{model:{value:e.batch.active,callback:function(t){e.$set(e.batch,"active",t)},expression:"batch.active"}},[t("el-tab-pane",{attrs:{label:"导入数据",name:"import"}},[t("ul",{staticClass:"importTip"},[t("li",[e._v("1.该功能适用于Excel导入单据数据。")]),t("li",[e._v("2.录入数据时,请勿修改首行数据标题以及排序。")]),t("li",[e._v("3.字段之间存在关联关系时,将自动进行关联运算。")]),t("li",[e._v("4.请查阅使用文档获取字段格式内容以及相关导入须知。")]),t("li",[e._v("5.点击下方上传模板,选择您编辑好的模板文件即可。")])]),t("el-divider"),t("el-row",{staticStyle:{"text-align":"center"}},[t("el-col",{attrs:{span:12}},[t("el-button",{attrs:{type:"info"},on:{click:e.downTemplate}},[e._v("下载模板")])],1),t("el-col",{attrs:{span:12}},[t("el-upload",{attrs:{action:e.$base.web+"buy/import",headers:{Token:e.$store.state.token},"show-file-list":!1,"on-success":e.importCall}},[t("el-button",{attrs:{type:"primary"}},[e._v("上传模板")])],1)],1)],1)],1),t("el-tab-pane",{staticClass:"exportGroup",attrs:{label:"导出数据",name:"export"}},[t("div",{staticClass:"item",on:{click:function(t){return e.exports("simple")}}},[t("i",{staticClass:"el-icon-download"}),t("p",[e._v("简易报表")])]),t("div",{staticClass:"item",on:{click:function(t){return e.exports("detailed")}}},[t("i",{staticClass:"el-icon-download"}),t("p",[e._v("详细报表")])])])],1)]:e._e()],2)],1)],1)},i=[],o=a("b85c"),r=(a("14d9"),a("d3b7"),a("159b"),a("0498")),l=a("398a"),n=a("5946"),c=a("a447"),u=a("947e"),d={name:"BuyForm",components:{Buy:r["default"],Bor:l["default"],Bre:n["default"],NodList:c["a"],PageStatus:u["a"]},data:function(){return{searchFrom:{goods:"",number:"",supplier:null,user:null,people:null,startTime:"",endTime:"",examine:"",nucleus:"",cse:"",invoice:"",check:"",data:""},tableData:[],tableSelection:[],page:{current:1,total:0,size:30,sizes:[30,60,90,150,300],count:5,status:[{text:"总单据金额",type:"sum",key:"total"},{text:"总实际金额",type:"sum",key:"actual"},{text:"总单据付款",type:"sum",key:"money"},{text:"总核销金额",type:"sum",key:"extension.amount"},{text:"总单据费用",type:"sum",key:"cost"}]},bill:{dialog:!1,source:null},bills:{type:null,dialog:!1,source:null},batch:{dialog:!1,active:"import"}}},created:function(){this.init(),this.record(1)},computed:{store:function(){return this.$store.state}},methods:{init:function(){this.searchFrom.startTime=this.$moment().subtract(this.store.sys.fun.days,"days").format("YYYY-MM-DD"),this.searchFrom.endTime=this.$moment().format("YYYY-MM-DD")},record:function(e){var t=this;0==e||(this.page.current=e);var a=Object.assign({page:this.page.current,limit:this.page.size},this.searchFrom);this.$axios.post("buy/record",a).then((function(e){"success"==e.state?(t.tableData=e.info,t.page.total=e.count,t.$refs["searchPopover"].showPopper=!1):"error"==e.state?t.$message({type:"warning",message:e.info}):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},billShow:function(e){this.bill.source=e,this.bill.dialog=!0},billDestroy:function(){this.record(0)},examine:function(e){var t=this,a=[];this.tableData.forEach((function(s){-1!=t.tableSelection.indexOf(s.id)&&(0==s.examine?0==e&&a.push(s.id):1==e&&a.push(s.id))})),0==a.length?this.$message({type:"warning",message:"无可操作单据!"}):this.$axios.post("buy/examine",{parm:a}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"操作单据成功!"})):"error"==e.state?(t.record(0),t.$message({type:"warning",message:e.info})):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},check:function(e){var t=this,a=[];this.tableData.forEach((function(s){-1!=t.tableSelection.indexOf(s.id)&&(0==s.check?0==e&&a.push(s.id):1==e&&a.push(s.id))})),0==a.length?this.$message({type:"warning",message:"无可操作单据!"}):this.$axios.post("buy/check",{parm:a}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"操作单据成功!"})):"error"==e.state?(t.record(0),t.$message({type:"warning",message:e.info})):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},del:function(e){var t=this;this.$confirm("您确定要删除选中数据吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){t.$axios.post("buy/del",{parm:e}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"删除成功!"})):"error"==e.state?t.$message({type:"warning",message:e.info}):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})})).catch((function(){}))}))},downTemplate:function(){var e=this;this.$message({type:"success",message:"[ 数据模板 ] 下载请求中..."}),setTimeout((function(){window.open(e.store.base.cdnSite+"/erp/batch/采购单导入模板.xlsx")}),1e3)},importCall:function(e,t,a){"success"==e.state?(this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"导入单据成功!"})):"error"==e.state?this.$message({type:"warning",message:"[ "+t.name+" ]"+e.info}):this.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})},exports:function(e){var t=this;if(0==this.tableSelection.length)this.$message({type:"warning",message:"未选择导出数据内容!"});else{this.$message({type:"success",message:"[ 导出数据 ] 请求中..."});var a=this.$lib.objToParm({scene:e,parm:this.tableSelection},!0);setTimeout((function(){window.open(t.$base.web+"buy/exports?"+a)}),1e3)}},open:function(e){this.bills.type=e.types,this.bills.source=e.id,this.bills.dialog=!0},selectionChange:function(e){var t,a=[],s=Object(o["a"])(e);try{for(s.s();!(t=s.n()).done;){var i=t.value;a.push(i.id)}}catch(r){s.e(r)}finally{s.f()}this.tableSelection=a},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}}},m=d,p=(a("966d"),a("2877")),h=Object(p["a"])(m,s,i,!1,null,null,null);t["default"]=h.exports},b7cb:function(e,t,a){},bfa8:function(e,t,a){"use strict";a("08d4")},c8fc:function(e,t,a){"use strict";a.r(t);a("b0c0");var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"borForm area"},[t("div",{staticClass:"layout"},[t("el-popover",{ref:"searchPopover",attrs:{"popper-class":"searchPopover",placement:"bottom-start"}},[t("el-form",{ref:"searchFrom",staticClass:"searchFrom",attrs:{inline:""}},[t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入商品名称",clearable:""},model:{value:e.searchFrom.goods,callback:function(t){e.$set(e.searchFrom,"goods",t)},expression:"searchFrom.goods"}})],1),t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.searchFrom.number,callback:function(t){e.$set(e.searchFrom,"number",t)},expression:"searchFrom.number"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择供应商",action:"service/supplierRecord",scene:"supplier"},model:{value:e.searchFrom.supplier,callback:function(t){e.$set(e.searchFrom,"supplier",t)},expression:"searchFrom.supplier"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.searchFrom.people,callback:function(t){e.$set(e.searchFrom,"people",t)},expression:"searchFrom.people"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"单据开始日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.startTime,callback:function(t){e.$set(e.searchFrom,"startTime",t)},expression:"searchFrom.startTime"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"单据结束日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.endTime,callback:function(t){e.$set(e.searchFrom,"endTime",t)},expression:"searchFrom.endTime"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"到货开始日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.startArrival,callback:function(t){e.$set(e.searchFrom,"startArrival",t)},expression:"searchFrom.startArrival"}})],1),t("el-form-item",[t("el-date-picker",{attrs:{placeholder:"到货结束日期","value-format":"yyyy-MM-dd",type:"date"},model:{value:e.searchFrom.endArrival,callback:function(t){e.$set(e.searchFrom,"endArrival",t)},expression:"searchFrom.endArrival"}})],1),t("el-form-item",[t("nodList",{attrs:{placeholder:"请选择制单人",action:"service/userRecord",scene:"user"},model:{value:e.searchFrom.user,callback:function(t){e.$set(e.searchFrom,"user",t)},expression:"searchFrom.user"}})],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择审核状态",clearable:""},model:{value:e.searchFrom.examine,callback:function(t){e.$set(e.searchFrom,"examine",t)},expression:"searchFrom.examine"}},[t("el-option",{attrs:{label:"未审核",value:1}}),t("el-option",{attrs:{label:"已审核",value:2}})],1)],1),t("el-form-item",[t("el-select",{attrs:{placeholder:"请选择入库状态",clearable:""},model:{value:e.searchFrom.state,callback:function(t){e.$set(e.searchFrom,"state",t)},expression:"searchFrom.state"}},[t("el-option",{attrs:{label:"未入库",value:1}}),t("el-option",{attrs:{label:"部分入库",value:2}}),t("el-option",{attrs:{label:"已入库",value:3}}),t("el-option",{attrs:{label:"关闭",value:4}})],1)],1),t("el-form-item",[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.searchFrom.data,callback:function(t){e.$set(e.searchFrom,"data",t)},expression:"searchFrom.data"}})],1),t("el-divider"),t("el-button",{staticClass:"searchBtn",attrs:{icon:"el-icon-search"},on:{click:function(t){return e.record(1)}}})],1),t("el-button",{attrs:{slot:"reference",icon:"el-icon-more"},slot:"reference"})],1),t("el-button-group",[0!=e.tableSelection.length?[e.$lib.getUserRoot(e.store.root,"bor","examine")?[t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"center","popper-class":"blockPopover",trigger:"click"}},[t("el-button",{attrs:{slot:"reference",type:"info"},slot:"reference"},[e._v("操作")]),t("ul",[t("li",{on:{click:function(t){return e.examine(0)}}},[e._v("审核")]),t("li",{on:{click:function(t){return e.examine(1)}}},[e._v("反审核")])])],1)]:e._e(),e.$lib.getUserRoot(e.store.root,"bor","del")?[t("el-button",{attrs:{type:"info"},on:{click:function(t){return e.del(e.tableSelection)}}},[e._v("删除")])]:e._e()]:e._e(),e.$lib.getUserRoot(e.store.root,"bor","batch")?[t("el-button",{on:{click:function(t){e.batch.dialog=!0}}},[e._v("批量")])]:e._e(),t("el-button",{on:{click:e.reload}},[e._v("刷新")])],2)],1),t("el-divider"),t("el-table",{directives:[{name:"madeTable",rawName:"v-madeTable"}],attrs:{data:e.tableData,height:"calc(100% - 90px)",border:""},on:{"selection-change":e.selectionChange}},[t("el-table-column",{attrs:{type:"selection",align:"center",width:"39px",fixed:"left"}}),t("el-table-column",{attrs:{prop:"frameData.name",label:"所属组织",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"supplierData.name",label:"供应商",align:"center",width:"160px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"number",label:"单据编号",align:"center",width:"200px"},scopedSlots:e._u([{key:"default",fn:function(a){return[0==a.row.relation.length?[t("span",{on:{click:function(t){return e.billShow(a.row.id)}}},[e._v(e._s(a.row.number))])]:[t("el-popover",{attrs:{"popper-class":"tablePopover",trigger:"click"}},[t("div",{attrs:{slot:"reference"},slot:"reference"},[t("span",{on:{click:function(t){return e.billShow(a.row.id)}}},[e._v(e._s(a.row.number))]),t("i",{staticClass:"el-icon-arrow-down el-icon--right"})]),t("el-table",{attrs:{data:a.row.relation,height:"120px",size:"mini",border:""}},[t("el-table-column",{attrs:{prop:"type",label:"单据类型",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"time",label:"单据时间",align:"center",width:"90px"}}),t("el-table-column",{attrs:{prop:"number",label:"单据编号",align:"center",width:"160px"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("span",{on:{click:function(t){return e.open(a.row)}}},[e._v(e._s(a.row.number))])]}}],null,!0)})],1)],1)]]}}])}),t("el-table-column",{attrs:{prop:"total",label:"单据金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"actual",label:"实际金额",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"arrival",label:"到货日期",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"extension.examine",label:"审核状态",align:"center",width:"100px"}}),t("el-table-column",{attrs:{prop:"extension.state",label:"入库状态",align:"center",width:"100px"}}),t("el-table-column",{attrs:{prop:"peopleData.name",label:"关联人员",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"userData.name",label:"制单人",align:"center",width:"120px"}}),t("el-table-column",{attrs:{prop:"data",label:"备注信息 ",align:"center","min-width":"200px"}}),t("el-table-column",{attrs:{prop:"set",label:"相关操作",align:"center",width:"180px",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(a){return[t("el-button-group",[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.billShow(a.row.id)}}},[e._v("详情")]),e.$lib.getUserRoot(e.store.root,"bor","del")?[t("el-button",{attrs:{size:"mini"},on:{click:function(t){return e.del([a.row.id])}}},[e._v("删除")])]:e._e(),t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"right","popper-class":"listPopover",trigger:"click",placement:"bottom-end"}},[t("el-button",{staticStyle:{padding:"7px"},attrs:{slot:"reference",icon:"el-icon-arrow-down",size:"mini"},slot:"reference"}),t("ul",[e._l(a.row.recordData,(function(a){return[t("li",[e._v(" "+e._s(a.extension.time)+" - "+e._s(a.userData.name)+" - "+e._s(a.info)+" ")])]}))],2)],1)],2)]}}])})],1),t("el-pagination",{staticClass:"tablePagination",attrs:{"current-page":e.page.current,total:e.page.total,"page-size":e.page.size,"page-sizes":e.page.sizes,"pager-count":e.page.count,layout:"prev,pager,next,jumper,sizes,total,slot"},on:{"update:currentPage":function(t){return e.$set(e.page,"current",t)},"update:current-page":function(t){return e.$set(e.page,"current",t)},"update:pageSize":function(t){return e.$set(e.page,"size",t)},"update:page-size":function(t){return e.$set(e.page,"size",t)},"size-change":function(t){return e.record(1)},"current-change":function(t){return e.record(0)}}},[t("PageStatus",{attrs:{config:e.page.status,model:e.tableData}})],1),t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bill.dialog,title:"单据详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bill,"dialog",t)},close:e.billDestroy}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bill.dialog?[t("Bor",{attrs:{source:e.bill.source},on:{destroy:function(t){e.bill.dialog=!1}}})]:e._e()],2)],1),"buy"==e.bills.type?t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bills.dialog,title:"采购单详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bills,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bills.dialog?[t("Buy",{attrs:{source:e.bills.source},on:{destroy:function(t){e.bills.dialog=!1}}})]:e._e()],2)],1):e._e(),"sor"==e.bills.type?t("el-dialog",{staticClass:"billDialog",attrs:{visible:e.bills.dialog,title:"销售订单详情",fullscreen:!0},on:{"update:visible":function(t){return e.$set(e.bills,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.bills.dialog?[t("Sor",{attrs:{source:e.bills.source},on:{destroy:function(t){e.bills.dialog=!1}}})]:e._e()],2)],1):e._e(),t("el-dialog",{directives:[{name:"madeDialog",rawName:"v-madeDialog"}],staticClass:"tabsDialog",attrs:{visible:e.batch.dialog,title:"批量",width:"420px"},on:{"update:visible":function(t){return e.$set(e.batch,"dialog",t)}}},[t("transition",{attrs:{name:"el-fade-in"}},[e.batch.dialog?[t("el-tabs",{model:{value:e.batch.active,callback:function(t){e.$set(e.batch,"active",t)},expression:"batch.active"}},[t("el-tab-pane",{attrs:{label:"导入数据",name:"import"}},[t("ul",{staticClass:"importTip"},[t("li",[e._v("1.该功能适用于Excel导入单据数据。")]),t("li",[e._v("2.录入数据时,请勿修改首行数据标题以及排序。")]),t("li",[e._v("3.字段之间存在关联关系时,将自动进行关联运算。")]),t("li",[e._v("4.请查阅使用文档获取字段格式内容以及相关导入须知。")]),t("li",[e._v("5.点击下方上传模板,选择您编辑好的模板文件即可。")])]),t("el-divider"),t("el-row",{staticStyle:{"text-align":"center"}},[t("el-col",{attrs:{span:12}},[t("el-button",{attrs:{type:"info"},on:{click:e.downTemplate}},[e._v("下载模板")])],1),t("el-col",{attrs:{span:12}},[t("el-upload",{attrs:{action:e.$base.web+"bor/import",headers:{Token:e.$store.state.token},"show-file-list":!1,"on-success":e.importCall}},[t("el-button",{attrs:{type:"primary"}},[e._v("上传模板")])],1)],1)],1)],1),t("el-tab-pane",{staticClass:"exportGroup",attrs:{label:"导出数据",name:"export"}},[t("div",{staticClass:"item",on:{click:function(t){return e.exports("simple")}}},[t("i",{staticClass:"el-icon-download"}),t("p",[e._v("简易报表")])]),t("div",{staticClass:"item",on:{click:function(t){return e.exports("detailed")}}},[t("i",{staticClass:"el-icon-download"}),t("p",[e._v("详细报表")])])])],1)]:e._e()],2)],1)],1)},i=[],o=a("b85c"),r=(a("14d9"),a("d3b7"),a("159b"),a("398a")),l=a("0498"),n=a("fd54"),c=a("a447"),u=a("947e"),d={name:"BorForm",components:{Bor:r["default"],Buy:l["default"],Sor:n["default"],NodList:c["a"],PageStatus:u["a"]},data:function(){return{searchFrom:{goods:"",number:"",supplier:null,people:null,user:null,startTime:"",endTime:"",startArrival:"",endArrival:"",examine:"",state:"",data:""},tableData:[],tableSelection:[],page:{current:1,total:0,size:30,sizes:[30,60,90,150,300],count:5,status:[{text:"总单据金额",type:"sum",key:"total"},{text:"总实际金额",type:"sum",key:"actual"}]},bill:{dialog:!1,source:null},bills:{type:null,dialog:!1,source:null},batch:{dialog:!1,active:"import"}}},created:function(){this.init(),this.record(1)},computed:{store:function(){return this.$store.state}},methods:{init:function(){this.searchFrom.startTime=this.$moment().subtract(this.store.sys.fun.days,"days").format("YYYY-MM-DD"),this.searchFrom.endTime=this.$moment().format("YYYY-MM-DD")},record:function(e){var t=this;0==e||(this.page.current=e);var a=Object.assign({page:this.page.current,limit:this.page.size},this.searchFrom);this.$axios.post("bor/record",a).then((function(e){"success"==e.state?(t.tableData=e.info,t.page.total=e.count,t.$refs["searchPopover"].showPopper=!1):"error"==e.state?t.$message({type:"warning",message:e.info}):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},billShow:function(e){this.bill.source=e,this.bill.dialog=!0},billDestroy:function(){this.record(0)},examine:function(e){var t=this,a=[];this.tableData.forEach((function(s){-1!=t.tableSelection.indexOf(s.id)&&(0==s.examine?0==e&&a.push(s.id):1==e&&a.push(s.id))})),0==a.length?this.$message({type:"warning",message:"无可操作单据!"}):this.$axios.post("bor/examine",{parm:a}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"操作单据成功!"})):"error"==e.state?(t.record(0),t.$message({type:"warning",message:e.info})):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},del:function(e){var t=this;this.$confirm("您确定要删除选中数据吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){t.$axios.post("bor/del",{parm:e}).then((function(e){"success"==e.state?(t.record(0),t.$message({type:"success",message:"删除成功!"})):"error"==e.state?t.$message({type:"warning",message:e.info}):t.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))})).catch((function(){}))},downTemplate:function(){var e=this;this.$message({type:"success",message:"[ 数据模板 ] 下载请求中..."}),setTimeout((function(){window.open(e.store.base.cdnSite+"/erp/batch/采购订单导入模板.xlsx")}),1e3)},importCall:function(e,t,a){"success"==e.state?(this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"导入单据成功!"})):"error"==e.state?this.$message({type:"warning",message:"[ "+t.name+" ]"+e.info}):this.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})},exports:function(e){var t=this;if(0==this.tableSelection.length)this.$message({type:"warning",message:"未选择导出数据内容!"});else{this.$message({type:"success",message:"[ 导出数据 ] 请求中..."});var a=this.$lib.objToParm({scene:e,parm:this.tableSelection},!0);setTimeout((function(){window.open(t.$base.web+"bor/exports?"+a)}),1e3)}},open:function(e){this.bills.type=e.types,this.bills.source=e.id,this.bills.dialog=!0},selectionChange:function(e){var t,a=[],s=Object(o["a"])(e);try{for(s.s();!(t=s.n()).done;){var i=t.value;a.push(i.id)}}catch(r){s.e(r)}finally{s.f()}this.tableSelection=a},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}}},m=d,p=(a("2cc5"),a("2877")),h=Object(p["a"])(m,s,i,!1,null,null,null);t["default"]=h.exports},ebf2:function(e,t,a){"use strict";a("9542")},ee13:function(e,t,a){"use strict";a("0ec7")},fb23:function(e,t,a){},fd54:function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"sor bill"},[t("el-form",{ref:"form",staticStyle:{height:"100%"},attrs:{model:e.form,rules:e.rules,inline:!0,"hide-required-asterisk":!0}},[t("el-form-item",{attrs:{label:"客户",prop:"customer"}},[t("template",{slot:"label"},[t("span",{on:{click:function(t){return e.switchPage("customer")}}},[e._v("客户")])]),t("nodList",{attrs:{placeholder:"请选择客户",action:"service/customerRecord",scene:"customer"},on:{change:e.customerChange},model:{value:e.form.customer,callback:function(t){e.$set(e.form,"customer",t)},expression:"form.customer"}})],2),t("el-form-item",{attrs:{label:"单据日期",prop:"time"}},[t("el-date-picker",{attrs:{"value-format":"yyyy-MM-dd",type:"date",placeholder:"请选择单据日期"},model:{value:e.form.time,callback:function(t){e.$set(e.form,"time",t)},expression:"form.time"}})],1),t("el-form-item",{attrs:{label:"单据编号",prop:"number"}},[t("el-input",{attrs:{placeholder:"请输入单据编号",clearable:""},model:{value:e.form.number,callback:function(t){e.$set(e.form,"number",t)},expression:"form.number"}})],1),t("el-divider",{staticClass:"fistDivider"}),t("ag-grid-vue",{directives:[{name:"madeAgGrid",rawName:"v-madeAgGrid"}],staticClass:"ag-theme-balham",staticStyle:{height:"calc(100% - 256px)"},attrs:{context:e.grid.context,defaultColDef:e.grid.coldef,gridOptions:e.grid.options,columnDefs:e.grid.column,getRowNodeId:e.grid.getRowNodeId,frameworkComponents:e.grid.components,tabToNextCell:e.$grid.gridTabToNextCell},on:{setter:function(t){e.goods.dialog=!0},schemeChange:e.schemeChange,quickEnter:e.quickEnter}}),t("Status",{attrs:{config:e.grid.status,source:e.info}},[1==e.form.examine?t("img",{staticClass:"billExamine",attrs:{src:3==e.form.state?"/static/images/lib/close.png":"/static/images/lib/examine.png"}}):e._e()]),t("el-divider"),t("LineFeed",{attrs:{tag:".el-form-item",rule:3}},[t("el-form-item",{attrs:{label:"单据金额"}},[t("el-input",{attrs:{placeholder:"请输入单据金额",disabled:!0},model:{value:e.form.total,callback:function(t){e.$set(e.form,"total",t)},expression:"form.total"}})],1),t("el-form-item",{attrs:{label:"实际金额",prop:"actual"}},[t("el-input",{attrs:{placeholder:"请输入实际金额",clearable:""},model:{value:e.form.actual,callback:function(t){e.$set(e.form,"actual",t)},expression:"form.actual"}},[t("template",{slot:"suffix"},[t("i",{staticClass:"el-icon-copy-document",on:{click:function(t){e.form.actual=e.form.total}}})])],2)],1),t("el-form-item",{attrs:{label:"关联人员"}},[t("nodList",{attrs:{placeholder:"请选择关联人员",action:"service/peopleRecord",scene:"people"},model:{value:e.form.people,callback:function(t){e.$set(e.form,"people",t)},expression:"form.people"}})],1),t("el-form-item",{attrs:{label:"到货日期",prop:"arrival"}},[t("el-date-picker",{attrs:{"value-format":"yyyy-MM-dd",type:"date",placeholder:"请选择单据日期"},model:{value:e.form.arrival,callback:function(t){e.$set(e.form,"arrival",t)},expression:"form.arrival"}})],1),t("el-form-item",{attrs:{label:"物流信息"}},[t("Logistics",{attrs:{more:e.customer.more},model:{value:e.form.logistics,callback:function(t){e.$set(e.form,"logistics",t)},expression:"form.logistics"}})],1),t("el-form-item",{attrs:{label:"单据附件"}},[t("NodUpload",{attrs:{action:e.$base.web+"sor/upload"},model:{value:e.form.file,callback:function(t){e.$set(e.form,"file",t)},expression:"form.file"}})],1),t("FieldForm",{staticStyle:{display:"initial"},attrs:{rule:"sor",prefix:"more."},model:{value:e.form.more,callback:function(t){e.$set(e.form,"more",t)},expression:"form.more"}}),t("el-form-item",{attrs:{label:"备注信息"}},[t("el-input",{attrs:{placeholder:"请输入备注信息",clearable:""},model:{value:e.form.data,callback:function(t){e.$set(e.form,"data",t)},expression:"form.data"}})],1)],1)],1),t("div",{staticClass:"layerBtn"},[t("el-button-group",[0==e.form.id||0==e.form.examine&&e.$lib.getUserRoot(e.store.root,"sor","edit")?[t("el-button",{attrs:{type:"info"},on:{click:e.save}},[e._v("保存")])]:e._e(),0!=e.form.id?[1!=e.form.examine||0!=e.form.state&&1!=e.form.state?e._e():[t("el-popover",{staticClass:"btnGroupPopover",attrs:{type:"left","popper-class":"blockPopover",trigger:"click"}},[t("el-button",{attrs:{slot:"reference",type:"info"},slot:"reference"},[e._v("生成")]),t("ul",[e.$lib.getUserRoot(e.store.root,"sell","add")?t("li",{on:{click:e.buildSell}},[e._v(" 销售单 ")]):e._e(),e.$lib.getUserRoot(e.store.root,"bor","add")?t("li",{on:{click:e.buildBor}},[e._v(" 采购订单 ")]):e._e()])],1)],e.$lib.getUserRoot(e.store.root,"sor","examine")?[3!=e.form.state?[t("el-button",{attrs:{type:"info"},on:{click:e.examine}},[e._v(e._s(0==e.form.examine?"审核":"反审核"))])]:e._e(),1!=e.form.examine||1!=e.form.state&&3!=e.form.state?e._e():[t("el-button",{attrs:{type:"info"},on:{click:e.update}},[e._v(e._s(1==e.form.state?"关闭":"开启"))])]]:e._e()]:e._e(),null==e.source?[t("el-button",{attrs:{type:"info"},on:{click:e.reload}},[e._v("刷新")])]:e._e()],2)],1),e.goods.dialog?t("GoodsList",{attrs:{parm:e.goods.parm},on:{destroy:e.goodsDestroy,choice:e.pushGrid}}):e._e()],1)},i=[],o=a("b85c"),r=(a("d9e2"),a("7db0"),a("d81d"),a("14d9"),a("a434"),a("b0c0"),a("b64b"),a("d3b7"),a("159b"),a("401b")),l=a("a389"),n=a("60f6"),c=a("fc0a"),u=a("9cf9"),d=a("326d"),m=a("56d9"),p=a("2ff6"),h=a("aac3"),f=a("b232"),g=a("5a8a"),b=a("6e60"),y=a("b786"),v=a("c3e3"),x=a("a447"),$=a("5549"),w=a("b8a6"),k=a("5fb4"),_=a("1d84"),C={name:"Sor",components:{AgGridVue:r["AgGridVue"],Status:y["a"],LineFeed:v["a"],NodList:x["a"],NodUpload:$["a"],Logistics:w["a"],FieldForm:k["a"],GoodsList:_["a"]},props:{source:{default:null}},data:function(){var e=this;return{form:{id:0,customer:null,time:"",number:"",total:0,actual:"",people:null,arrival:"",logistics:{key:"auto",name:"自动识别",number:""},file:[],data:"",examine:0,state:0,more:{}},rules:{customer:{required:!0,message:"请选择客户",trigger:"change"},time:{required:!0,message:"请选择单据日期",trigger:"change"},number:{required:!0,message:"请输入单据编号",trigger:"blur"},actual:[{required:!0,message:"请输入实际金额",trigger:"blur"},{validator:function(t,a,s){e.$lib.synValidate("money",a)?s():s(new Error("实际金额不正确"))},trigger:"blur"}]},customer:{grade:"",more:[]},info:[],grid:{options:{onGridReady:function(){e.$grid.addGridRow(e.grid.options)},onCellEditingStopped:function(e){e.context.runHandleGrid()}},context:{row:{uniqid:this.$lib.getUniqid(),key:null},runHandleGrid:function(){if(null==e.grid.options.api)return!1;e.handleGrid()}},coldef:{suppressMenu:!1,resizable:!0,singleClickEdit:!0,suppressMovable:!0},components:{dispose:l["a"],scheme:n["a"],storeroom:c["a"],allowance:u["a"],taxRate:d["a"],setter:m["a"],quickInput:p["a"],company:h["a"],depot:f["a"],storehouse:g["a"],price:b["a"]},getRowNodeId:function(e){return e.uniqid},column:[{headerName:"序号",width:50,field:"sequence",headerComponent:"dispose",headerComponentParams:{dispose:{key:"sor"}},valueGetter:function(e){return e.node.rowIndex+1},hide:!1,dispose:!1},{headerName:"操作",width:50,field:"setter",cellRenderer:"setter",hide:!1,dispose:!1},{headerName:"商品名称",width:150,field:"name",headerComponent:"scheme",headerComponentParams:{dispose:{title:"商品名称"}},editable:!0,cellEditor:"quickInput",hide:!1,dispose:!0},{headerName:"商品编号",width:120,field:"number",hide:!1,dispose:!0},{headerName:"规格型号",width:120,field:"spec",hide:!1,dispose:!0},{headerName:"辅助属性",width:120,field:"attr",hide:!1,dispose:!0},{headerName:"单位",width:120,field:"unit",editable:!0,cellEditor:"company",hide:!1,dispose:!0},{headerName:"仓库",width:120,field:"warehouse",headerComponent:"storeroom",headerComponentParams:{dispose:{title:"仓库",key:"warehouseId",text:"warehouse"}},cellRenderer:"depot",cellRendererParams:{dispose:{key:"warehouseId",text:"warehouse"}},editable:!0,cellEditor:"storehouse",cellEditorParams:{dispose:{key:"warehouseId",text:"warehouse"}},hide:!1,dispose:!0},{headerName:"单价",width:90,field:"price",editable:!0,cellEditor:"price",cellEditorParams:{dispose:{model:"sor",source:function(){return e.form.customer}}},hide:!1,dispose:!0},{headerName:"数量",width:90,field:"nums",editable:!0,hide:!1,dispose:!0},{headerName:"出库数量",width:90,field:"handle",hide:!0,dispose:!1},{headerName:"折扣率(%)",width:90,field:"discount",headerComponent:"allowance",headerComponentParams:{dispose:{title:"折扣率(%)",key:"discount"}},editable:!0,hide:!0,dispose:!0},{headerName:"折扣额",width:90,field:"dsc",hide:!0,dispose:!0},{headerName:"金额",width:120,field:"total",hide:!1,dispose:!0},{headerName:"税率(%)",width:90,field:"tax",headerComponent:"taxRate",headerComponentParams:{dispose:{title:"税率(%)",key:"tax"}},editable:!0,hide:!0,dispose:!1},{headerName:"税额",width:90,field:"tat",hide:!0,dispose:!1},{headerName:"价税合计",width:120,field:"tpt",hide:!0,dispose:!1},{headerName:"备注信息",width:120,field:"data",editable:!0,hide:!1,dispose:!0}],status:[{text:"总条数",type:"count"},{text:"总合计",type:"sum",key:"tpt"}]},scan:!1,goods:{dialog:!1,parm:{}}}},computed:{store:function(){return this.$store.state}},created:function(){this.init()},methods:{init:function(){var e=this;null==this.source?(this.form.time=this.$moment().format("YYYY-MM-DD"),this.form.number="XSDD"+this.$moment().format("YYMMDDHHmmssS")):this.$axios.post("sor/get",{parm:this.source}).then((function(t){"success"==t.state?(e.form=t.info.class,e.pushGrid(t.info.info,!1)):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},save:function(){var e=this,t=this.$refs["form"];this.$lib.aloneValidate(t,["customer","time","number"]).then((function(){var a=e.handleGrid();1==a?0==e.info.length?e.$message({type:"warning",message:"商品信息不可为空!"}):e.$lib.aloneValidate(t,["actual"]).then((function(){e.form.actual-0>e.form.total-0?e.$message({type:"warning",message:"实际金额不可大于单据金额!"}):t.validate((function(t){t?e.$axios.post("sor/save",{class:e.form,info:e.info}).then((function(t){"success"==t.state?e.store.sys.fun.examine&&0==e.form.id?(e.form.id=t.info,e.$message({type:"success",message:"审核单据中..."}),setTimeout((function(){e.examine()}),996)):(e.form.id=t.info,e.$message({type:"success",message:"单据保存成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})})):e.$message({type:"warning",message:"表单验证错误,请检查并修正!"})}))})).catch((function(t){e.$message({type:"warning",message:t})})):e.$message({type:"warning",message:a})})).catch((function(t){e.$message({type:"warning",message:t})}))},examine:function(){var e=this;this.$axios.post("sor/examine",{parm:[this.form.id]}).then((function(t){"success"==t.state?(e.form.examine=0==e.form.examine?1:0,e.$message({type:"success",message:(0==e.form.examine?"反审核":"审核")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},update:function(){var e=this;this.$axios.post("sor/update",{id:this.form.id}).then((function(t){"success"==t.state?(e.form.state=1==e.form.state?3:1,e.$message({type:"success",message:(1==e.form.state?"开启":"关闭")+"单据成功!"})):"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},buildSell:function(){var e=this;this.$axios.post("sor/buildSell",{id:this.form.id}).then((function(t){"success"==t.state?(e.$emit("destroy"),e.$bus.emit("switchPage","sell",!0),setTimeout((function(){e.$bus.emit("buildSell",t.info)}),600)):"warning"==t.state||"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},buildBor:function(){var e=this;this.$axios.post("sor/buildBor",{id:this.form.id}).then((function(t){"success"==t.state?(e.$emit("destroy"),e.$bus.emit("switchPage","bor",!0),setTimeout((function(){e.$bus.emit("buildBor",t.info)}),600)):"warning"==t.state||"error"==t.state?e.$message({type:"warning",message:t.info}):e.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))},customerChange:function(e){if(this.customer.grade="",this.customer.more=[],e){this.customer.grade=e.grade;var t=JSON.parse(e.contacts);if(t.length>0){var a=t.find((function(e){return e.main}));this.customer.more.push("姓名:"+a.name),this.customer.more.push("电话:"+a.tel),this.customer.more.push("地址:"+a.add)}}},schemeChange:function(e){this.scan=e,this.$grid.startEditingLastCell(this.grid.options,"name")},quickEnter:function(e,t){var a=this,s=this.grid.options.api;if(!this.$lib.validate("empty",e)){var i=this.scan?{code:e}:{mate:e},o=Object.assign({page:1,limit:1},i);this.$axios.post("service/goodsRecord",o).then((function(e){if("success"==e.state)if(0==e.count)s.startEditingCell({rowIndex:t,colKey:"name"}),a.$message({type:"warning",message:"未匹配到商品数据!"});else if(1==e.count){var o=e.info[0];if(o.attr.length>1)a.goods.parm=i,a.goods.dialog=!0;else{if(0==o.attr.length)o.attr="",o.nums=1;else{var r=o.attr[0];o=Object.assign({},o,{attr:r.name,buy:r.buy,sell:r.sell,retail:r.retail,code:r.code,nums:1})}a.pushGrid([o]),a.scan&&s.startEditingCell({rowIndex:t+1,colKey:"name"})}}else a.goods.parm=i,a.goods.dialog=!0;else"error"==e.state?a.$message({type:"warning",message:e.info}):a.$message({type:"error",message:"[ ERROR ] 服务器响应超时!"})}))}},pushGrid:function(e){var t,a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=[],i="sell",r=Object(o["a"])(e);try{for(r.s();!(t=r.n()).done;){var l=t.value,n=a?l:l.goodsData,c={uniqid:this.$lib.getUniqid(),key:n.id,goodsType:n.type,unitData:n.units,unitRelation:{valence:n[i],multiple:a?1:null},warehouseId:a?null:l.warehouse,name:n.name,number:n.number,spec:n.spec,attr:l.attr,unit:a?"-1"==n.unit?"点击选择":n.unit:l.unit,warehouse:a?0==n.type?"点击选择":"":this.$lib.objectSeek(l,"warehouseData|name"),price:a?n[i]:l.price,nums:l.nums,handle:a?0:l.handle,discount:a?this.$lib.gradeDiscount(this.customer.grade,l.strategy):l.discount,dsc:a?0:l.dsc,total:a?null:l.total,tax:a?this.store.sys.fun.rate:l.tax,tat:a?null:l.tat,tpt:a?null:l.tpt,data:a?"":l.data};if(a){var u=this.$calc.chain(c.price).multiply(c.nums).round(this.store.sys.fun.digit.money).done();c.dsc=this.$calc.chain(u).divide(100).multiply(c.discount).round(this.store.sys.fun.digit.money).done(),c.total=this.$calc.chain(u).subtract(c.dsc).done(),c.tat=this.$calc.chain(c.total).divide(100).multiply(c.tax).round(2).done(),c.tpt=this.$calc.chain(c.total).add(c.tat).done()}else if(c.unitData.length>0){var d=this.$lib.unitRelation(c.unit,c.unitData,this);c.unitRelation.multiple=d.multiple}s.push(c)}}catch(m){r.e(m)}finally{r.f()}this.$grid.pushGridData(this.grid.options,s),this.handleGrid()},handleGrid:function(){for(var e=!0,t=this.$grid.getGridData(this.grid.options),a=0;a<t.length;a++)if(null==t[a].key)t.splice(a,1);else{if(t[a].unitData.length>0&&"点击选择"==t[a].unit){1==e&&(e="商品信息第"+(a+1)+"行单位不可为空!");continue}if(0==t[a].goodsType&&null==t[a].warehouseId){1==e&&(e="商品信息第"+(a+1)+"行仓库不可为空!");continue}if(!this.$lib.synValidate("money",t[a].price)){1==e&&(e="商品信息第"+(a+1)+"行单价不正确!");continue}if(!this.$lib.synValidate("nums",t[a].nums)){1==e&&(e="商品信息第"+(a+1)+"行数量不正确!");continue}if(!this.$lib.validate("percentage",t[a].discount)){1==e&&(e="商品信息第"+(a+1)+"行折扣率不正确!");continue}if(!this.$lib.validate("percentage",t[a].tax)){1==e&&(e="商品信息第"+(a+1)+"行税率不正确!");continue}var s=this.$calc.chain(t[a].price).multiply(t[a].nums).round(this.store.sys.fun.digit.money).done();t[a].dsc=this.$calc.chain(s).divide(100).multiply(t[a].discount).round(this.store.sys.fun.digit.money).done(),t[a].total=this.$calc.chain(s).subtract(t[a].dsc).done(),t[a].tat=this.$calc.chain(t[a].total).divide(100).multiply(t[a].tax).round(2).done(),t[a].tpt=this.$calc.chain(t[a].total).add(t[a].tat).done(),this.grid.options.api.applyTransaction({update:[t[a]]})}return 1==e&&(this.$set(this,"info",t.map((function(e){return{goods:e.key,attr:e.attr,unit:e.unit,warehouse:e.warehouseId,price:e.price,nums:e.nums,discount:e.discount,dsc:e.dsc,total:e.total,tax:e.tax,tat:e.tat,tpt:e.tpt,data:e.data}}))),this.summary()),e},summary:function(){var e=this.$calc.chain(0);this.info.forEach((function(t){e.add(t.tpt)})),this.form.total=e.done()},goodsDestroy:function(){this.goods.dialog=!1,this.goods.parm={},this.$grid.startEditingLastCell(this.grid.options,"name")},switchPage:function(e){this.$bus.emit("switchPage",e,!0)},reload:function(){this.$bus.emit("homeReload",this.$options.name),this.$message({type:"success",message:"页面刷新成功!"})}},mounted:function(){this.source&&this.grid.options.columnApi.setColumnVisible("handle",!0),this.store.sys.fun.tax&&this.grid.options.columnApi.setColumnsVisible(["tax","tat","tpt"],!0)}},R=C,D=a("2877"),F=Object(D["a"])(R,s,i,!1,null,null,null);t["default"]=F.exports}}]); |