WangHan
2025-04-03 a1b85ef72062ca80db35546e4216dd564f3e0f57
1
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-e12d3f04"],{"433d":function(e,t,r){"use strict";var o=r("c559"),n={ftpUrl:o["a"].ftpUrl,apiBaseURL:o["a"].apiBaseURL};t["a"]=n},5688:function(e,t,r){"use strict";r.d(t,"i",(function(){return n})),r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"c",(function(){return s})),r.d(t,"f",(function(){return u})),r.d(t,"h",(function(){return c})),r.d(t,"e",(function(){return l})),r.d(t,"d",(function(){return d})),r.d(t,"g",(function(){return f}));var o=r("b775");function n(e){return Object(o["a"])({url:"/pc/base/warehouse/select/tenant_warehouse",method:"get",params:e})}function a(e){return Object(o["a"])({url:"/pc/base/goods/template/query/goodsTemplate",method:"get",params:e})}function i(e){return Object(o["a"])({url:"/pc/base/goods/models/query/goodsModel",method:"get",params:e})}function s(e){return Object(o["a"])({url:"/pc/whForm/procure/add",method:"post",data:e})}function u(e){return Object(o["a"])({url:"/pc/whForm/procure/edit",method:"post",data:e})}function c(e){return Object(o["a"])({url:"/pc/whForm/procure/list",method:"get",params:e})}function l(e){return Object(o["a"])({url:"/pc/whForm/procure/detail",method:"get",params:e})}function d(e){return Object(o["a"])({url:"/pc/whForm/procure/del",method:"delete",params:e})}function f(e){return Object(o["a"])({url:"/pc/whForm/procure/income",method:"post",params:e})}},"6b6f":function(e,t,r){"use strict";r.r(t);var o=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("win-md",{staticClass:"stock-edit",attrs:{title:e.setting.title+"采购入库",width:"800px",loading:e.loading},on:{close:e.close}},[r("el-form",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"ruleForm",staticClass:"form",attrs:{model:e.formData,rules:e.rules,"label-width":"120px"}},[r("div",{staticClass:"main-w"},[r("el-row",{staticClass:"headerHeight",attrs:{gutter:24}},[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"入库仓库",prop:"warehouseId"}},[r("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择",clearable:""},model:{value:e.formData.warehouseId,callback:function(t){e.$set(e.formData,"warehouseId",t)},expression:"formData.warehouseId"}},e._l(e.warehouses,(function(e){return r("el-option",{key:e.id,attrs:{label:e.warehouseName,value:e.id}})})),1)],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"采购时间",prop:"procureTime"}},[r("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"datetime",clearable:"",value:"yyyy-MM-dd HH:mm:ss","value-format":"yyyyMMddHHmmss",placeholder:"请选择日期"},model:{value:e.formData.procureTime,callback:function(t){e.$set(e.formData,"procureTime",t)},expression:"formData.procureTime"}})],1)],1)],1),e._v(" "),r("el-row",{staticClass:"headerHeight",attrs:{gutter:24}},[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"采购类型",prop:"buyType"}},[r("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择"},model:{value:e.formData.buyType,callback:function(t){e.$set(e.formData,"buyType",t)},expression:"formData.buyType"}},e._l(e.buyTypeOptions,(function(e){return r("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1)],1)],1),e._v(" "),r("el-row",{staticClass:"headerHeight",attrs:{gutter:24}},[r("el-col",{attrs:{span:24}},[r("el-form-item",{attrs:{label:"采购入库手续",prop:"procureDoc"}},[r("upload",{ref:"uploadRef",attrs:{values:e.fileList,settings:e.uploadSettings},on:{"on-change":e.uploadChange}})],1)],1)],1),e._v(" "),e._l(e.formData.procureGoods,(function(t,o){return r("div",{key:o,staticClass:"goods-card"},[r("el-row",{attrs:{gutter:24}},[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"物品分类",prop:"procureGoods."+o+".baseCategoryId",rules:{required:!0,message:"请选择物品分类",trigger:"change"}}},[r("el-cascader",{staticStyle:{width:"100%"},attrs:{options:e.categoryOptions,props:{value:"id",emitPath:!1},"show-all-levels":!1,filterable:"",clearable:""},on:{change:function(t){return e.categoryChange(t,o)}},model:{value:t.baseCategoryId,callback:function(r){e.$set(t,"baseCategoryId",r)},expression:"goodsItem.baseCategoryId"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"物品名称",prop:"procureGoods."+o+".baseGoodsTemplateId",rules:e.rules.baseGoodsTemplateId}},[r("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:t.baseCategoryId?"请选择物品":"请先选择物品分类",filterable:"",clearable:"",disabled:!t.baseCategoryId},on:{change:function(t){return e.goodsTemplateChange(t,o)}},model:{value:t.baseGoodsTemplateId,callback:function(r){e.$set(t,"baseGoodsTemplateId",r)},expression:"goodsItem.baseGoodsTemplateId"}},e._l(t.goodsOptions,(function(e){return r("el-option",{key:e.id,attrs:{label:e.goodsName,value:e.id}})})),1)],1)],1)],1),e._v(" "),r("el-row",{attrs:{gutter:24}},[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"规格型号",prop:"procureGoods."+o+".modelsIds",rules:{required:!0,message:"请选择规格型号",trigger:"change"}}},[r("el-select",{staticStyle:{width:"100%"},attrs:{multiple:"",clearable:"",placeholder:t.baseGoodsTemplateId?"请选择规格型号":"请先选择物品名称",disabled:!t.baseGoodsTemplateId},on:{change:function(t){return e.modelChange(t,o)},"remove-tag":function(t){return e.modelRemoveTag(t,o)},clear:function(t){return e.modelRemoveTag(-1,o)}},model:{value:t.modelsIds,callback:function(r){e.$set(t,"modelsIds",r)},expression:"goodsItem.modelsIds"}},e._l(t.modelsOptions,(function(e){return r("el-option",{key:e.id,attrs:{label:e.modelName,value:e.id}})})),1)],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"供货商",prop:"supplier"}},[r("el-input",{attrs:{clearable:"",maxlength:"20","show-word-limit":""},model:{value:t.supplier,callback:function(r){e.$set(t,"supplier",r)},expression:"goodsItem.supplier"}})],1)],1)],1),e._v(" "),r("el-table",{attrs:{data:t.models,stripe:!0}},[r("el-table-column",{attrs:{prop:"baseGoodsModelsId",label:"规格型号",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n              "+e._s(e.getGoodsModelsName(t.row.baseGoodsModelsId))+"\n            ")]}}],null,!0)}),e._v(" "),r("el-table-column",{attrs:{label:"单位",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n              "+e._s(t.row.unit)+"\n            ")]}}],null,!0)}),e._v(" "),r("el-table-column",{attrs:{prop:"priceYuan",label:"单价(元)",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-form-item",{staticStyle:{"margin-bottom":"0"},attrs:{"label-width":"0",prop:"procureGoods["+o+"].models["+t.$index+"].priceYuan",rules:e.rules.priceYuan}},[r("el-input",{attrs:{type:"number"},on:{change:function(r){return e.priceChange(r,o,t.$index)}},model:{value:t.row.priceYuan,callback:function(r){e.$set(t.row,"priceYuan",e._n(r))},expression:"scope.row.priceYuan"}})],1)]}}],null,!0)}),e._v(" "),r("el-table-column",{attrs:{prop:"counts",label:"采购数量",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-form-item",{staticStyle:{"margin-bottom":"0"},attrs:{"label-width":"0",prop:"procureGoods["+o+"].models["+t.$index+"].counts",rules:e.rules.counts}},[r("el-input",{model:{value:t.row.counts,callback:function(r){e.$set(t.row,"counts",e._n(r))},expression:"scope.row.counts"}})],1)]}}],null,!0)})],1),e._v(" "),r("div",{staticClass:"btn-group"},[e.formData.procureGoods.length>1?r("el-button",{attrs:{name:"移除",type:"danger",plain:"",size:"mini"},on:{click:function(t){return e.removeGoods(o)}}},[e._v("移除\n          ")]):e._e(),e._v(" "),e.formData.procureGoods.length-1==o?r("el-button",{attrs:{name:"新增物品",type:"primary",plain:"",size:"mini"},on:{click:e.addGoods}},[e._v("新增物品\n          ")]):e._e()],1)],1)}))],2)]),e._v(" "),r("div",{staticClass:"dialog-footer",attrs:{slot:"footer",align:"center"},slot:"footer"},[r("my-button",{attrs:{name:"取消",site:"form"},on:{click:e.close}}),e._v(" "),r("my-button",{attrs:{name:"保存",site:"form"},on:{click:e.handleSubmit}})],1)],1)},n=[],a=r("5688"),i=r("c56b"),s=r("f6e8"),u=r("f76d"),c=r("decf"),l=r("dee4"),d=r("ed08"),f=r("2f62"),p=r("6f7e");function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function h(e){return b(e)||v(e)||y(e)||g()}function g(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){if(e){if("string"==typeof e)return w(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}function v(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e){if(Array.isArray(e))return w(e)}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o}function D(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */D=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function l(e,t,r,o){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),s=new L(o||[]);return n(i,"_invoke",{value:j(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",p="suspendedYield",h="executing",g="completed",y={};function v(){}function b(){}function w(){}var I={};c(I,i,(function(){return this}));var O=Object.getPrototypeOf,G=O&&O(O(M([])));G&&G!==r&&o.call(G,i)&&(I=G);var x=w.prototype=v.prototype=Object.create(I);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(n,a,i,s){var u=d(e[n],e,a);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==m(l)&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(l).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(e,o){function n(){return new t((function(t,n){r(e,o,t,n)}))}return a=a?a.then(n,n):n()}})}function j(t,r,o){var n=f;return function(a,i){if(n===h)throw Error("Generator is already running");if(n===g){if("throw"===a)throw i;return{value:e,done:!0}}for(o.method=a,o.arg=i;;){var s=o.delegate;if(s){var u=_(s,o);if(u){if(u===y)continue;return u}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(n===f)throw n=g,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n=h;var c=d(t,r,o);if("normal"===c.type){if(n=o.done?g:p,c.arg===y)continue;return{value:c.arg,done:o.done}}"throw"===c.type&&(n=g,o.method="throw",o.arg=c.arg)}}}function _(t,r){var o=r.method,n=t.iterator[o];if(n===e)return r.delegate=null,"throw"===o&&t.iterator.return&&(r.method="return",r.arg=e,_(t,r),"throw"===r.method)||"return"!==o&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+o+"' method")),y;var a=d(n,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function M(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(m(t)+" is not iterable")}return b.prototype=w,n(x,"constructor",{value:w,configurable:!0}),n(w,"constructor",{value:b,configurable:!0}),b.displayName=c(w,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},S(T.prototype),c(T.prototype,s,(function(){return this})),t.AsyncIterator=T,t.async=function(e,r,o,n,a){void 0===a&&(a=Promise);var i=new T(l(e,r,o,n),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(x),c(x,u,"Generator"),c(x,i,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var o in t)r.push(o);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=M,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(k),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(o,n){return s.type="throw",s.arg=t,r.next=o,n&&(r.method="next",r.arg=e),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),k(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var o=r.completion;if("throw"===o.type){var n=o.arg;k(r)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,r,o){return this.delegate={iterator:M(t),resultName:r,nextLoc:o},"next"===this.method&&(this.arg=e),y}},t}function I(e,t,r,o,n,a,i){try{var s=e[a](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(o,n)}function O(e){return function(){var t=this,r=arguments;return new Promise((function(o,n){var a=e.apply(t,r);function i(e){I(a,o,n,i,s,"next",e)}function s(e){I(a,o,n,i,s,"throw",e)}i(void 0)}))}}function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return(t=T(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function T(e){var t=j(e,"string");return"symbol"==m(t)?t:t+""}function j(e,t){if("object"!=m(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=m(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var _={components:{MyButton:s["a"],winMd:u["a"],upload:c["a"]},props:{setting:{type:Object,default:function(){}}},data:function(){var e=this,t=function(t,r,o){if(!r)return o(new Error("请选择"));var n=e.formData.procureGoods.filter((function(e){return e.baseGoodsTemplateId==r}));if(!n||1!=n.length)return o(new Error("已选过此物品"));o()},r=function(t,r,o){return r?0==r?(e.$message.warning("数字值不能为0"),o(new Error("数字值不能为0"))):void o():o(new Error("请输入"))},o=function(t,r,o){return r?Number.isInteger(r)?0==r?(e.$message.warning("数字值不能为0"),o(new Error("数字值不能为0"))):void o():(e.$message.warning("请输入数字值"),o(new Error("请输入数字值"))):o(new Error("请输入"))};return{loading:!0,buyTypeOptions:[{label:"集采",value:"1"},{label:"自采",value:"2"}],fileList:[],warehouses:[],categoryOptions:[],modelList:[],formData:{procureDoc:"",warehouseId:"",procureTime:p["formatDate"](new Date,"yyyyMMddhhmmss"),buyType:"2",procureGoods:[]},goodsItem:{baseCategoryIds:"",baseCategoryId:"",baseGoodsTemplateId:"",goodsTemplateName:"",supplier:"",sort:"",goodsOptions:[],modelsOptions:[],models:[],modelsIds:[]},modelsItem:{baseGoodsModelsId:"",priceYuan:null,price:null,counts:null,unit:null},rules:{warehouseId:[{required:!0,message:"请选择",trigger:"change"}],procureTime:[{required:!0,message:"请选择",trigger:"change"}],buyType:[{required:!0,message:"请选择",trigger:"change"}],procureDoc:[{required:!0,message:"请上传",trigger:"change"}],baseCategoryIds:[{required:!0,message:"请选择",trigger:"change"}],baseGoodsTemplateId:[{required:!0,message:"请选择",trigger:"change"},{validator:t,trigger:["blur","change"]}],modelsIds:[{required:!0,message:"请选择",trigger:"change"}],priceYuan:[{validator:r,trigger:"blur"}],counts:[{validator:o,trigger:"blur"}]},uploadSettings:{title:"上传",max:20,num:10,tip:"",uploadUrl:Object(l["d"])(),multiple:!0}}},computed:x({},Object(f["b"])(["userInfo"])),created:function(){this.init()},methods:{init:function(){var e=O(D().mark((function e(){var t,r,o=this;return D().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.getWarehouseList();case 2:return e.next=4,this.getgoodsTemplate();case 4:return e.next=6,this.getgoodsModel();case 6:return e.next=8,Object(i["b"])();case 8:if(t=e.sent,this.categoryOptions=this.removeEmptyChildren(t),!this.setting.id){e.next=19;break}return e.next=13,Object(a["e"])({id:this.setting.id});case 13:r=e.sent,this.formData=Object.assign(this.formData,r),this.formData.procureDoc&&(this.fileList=JSON.parse(this.formData.procureDoc)),this.$set(this.formData,"buyType",this.formData.buyType.toString()),this.formData.procureTime=this.formData.procureTime.toString(),this.formData.procureGoods.map(function(){var e=O(D().mark((function e(t,r){return D().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.baseCategoryIds=Object(d["a"])(o.categoryOptions,t.baseCategoryId),o.$set(o.formData.procureGoods[r],"modelsIds",t.models.map((function(e){return e.baseGoodsModelsId}))),e.next=4,o.getgoodsTemplate(t.baseCategoryId,r);case 4:return e.next=6,o.getgoodsModel(t.baseGoodsTemplateId,r);case 6:return e.next=8,t.models.forEach((function(e,t){o.$set(o.formData.procureGoods[r].models[t],"priceYuan",e.price/100)}));case 8:return e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}());case 19:this.loading=!1;case 20:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),getWarehouseList:function(){var e=O(D().mark((function e(){var t=this;return D().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(a["i"])({agencyId:this.userInfo.tenantId}).then((function(e){t.warehouses=e,!t.setting.id&&e.length&&t.formData.procureGoods.push(JSON.parse(JSON.stringify(t.goodsItem))),t.warehouses.length&&!t.formData.warehouseId&&(t.formData.warehouseId=t.warehouses[0].id)})).catch((function(e){console.log("err",e)}));case 2:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),removeEmptyChildren:function(e){var t=this;return e.forEach((function(e){e.children&&e.children.length?t.removeEmptyChildren(e.children):delete e.children})),e},getgoodsTemplate:function(){var e=O(D().mark((function e(t,r){var o=this;return D().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(a["b"])({agencyId:this.userInfo.tenantId,categoryId:t||""}).then((function(e){r||0==r?o.$set(o.formData.procureGoods[r],"goodsOptions",e):o.goodsTemplatelAll=e}));case 2:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}(),getgoodsModel:function(){var e=O(D().mark((function e(t,r){var o=this;return D().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(a["a"])({goodsTemplatesId:t||""}).then((function(e){r||0==r?o.$set(o.formData.procureGoods[r],"modelsOptions",e):o.goodsModelAll=e}));case 2:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}(),getGoodsTemplateName:function(e){var t=this.goodsTemplatelAll.find((function(t){return t.id==e}));if(t)return t.goodsName},getGoodsModelsName:function(e){var t=this.goodsModelAll.find((function(t){return t.id==e}));if(t)return t.modelName},categoryChange:function(e,t){this.formData.procureGoods[t].goodsOptions=[],this.formData.procureGoods[t].baseGoodsTemplateId="",this.formData.procureGoods[t].goodsTemplateName="",this.formData.procureGoods[t].modelsOptions=[],this.formData.procureGoods[t].modelsIds=[],this.formData.procureGoods[t].models=[],this.getgoodsTemplate(e,t)},goodsTemplateChange:function(e,t){this.formData.procureGoods[t].modelsOptions=[],this.formData.procureGoods[t].modelsIds=[],this.formData.procureGoods[t].models=[],this.formData.procureGoods[t].goodsTemplateName=this.getGoodsTemplateName(e),this.getgoodsModel(e,t)},modelChange:function(e,t){var r=this,o=h(this.formData.procureGoods[t].models),n=JSON.stringify(o);e.forEach((function(e){if(-1==n.indexOf(e)){var t=r.goodsModelAll.find((function(t){return t.id==e}));o.push(x(x({},r.modelsItem),{},{baseGoodsModelsId:e,unit:t.unit}))}})),this.formData.procureGoods[t].models=o},modelRemoveTag:function(e,t){if(-1!==e){var r=this.formData.procureGoods[t].models,o=r.findIndex((function(t){return t.baseGoodsModelsId==e}));this.formData.procureGoods[t].models.splice(o,1)}else this.formData.procureGoods[t].models=[]},priceChange:function(e,t,r){this.formData.procureGoods[t].models[r].price=100*e},uploadChange:function(){var e=this.$refs.uploadRef.fileList;this.formData.procureDoc=JSON.stringify(e)},addGoods:function(){this.formData.procureGoods.push(JSON.parse(JSON.stringify(this.goodsItem)))},removeGoods:function(e){this.formData.procureGoods.splice(e,1)},handleSubmit:function(){var e=this;this.$refs["ruleForm"].validate((function(t){if(t){if(e.loading)return;e.loading=!0,e.setting.id?Object(a["f"])(e.formData).then((function(t){e.$message.success("保存成功!"),e.close(),e.$emit("search")})).catch((function(t){e.loading=!1,e.$message.error("保存失败")})):Object(a["c"])(e.formData).then((function(t){e.$message.success("保存成功!"),e.close(),e.$emit("search")})).catch((function(t){e.loading=!1,e.$message.error("保存失败")}))}else e.$message.error("校验未通过,请检查。")}))},close:function(){this.formData={warehouseId:"",procureTime:"",procureGoods:[]},this.$emit("close")}}},E=_,k=(r("e3fa"),r("2877")),L=Object(k["a"])(E,o,n,!1,null,"55130d7a",null);t["default"]=L.exports},"6f7e":function(e,t,r){"use strict";function o(e){if(null==e||void 0==e||""==e||"null"==e||"undefined"==e)return!0;var t=e.toString().replace(/\s/g,"").replace(/-/g,"").replace(/:/g,"");return t}function n(e){return("00"+e).substr(e.length)}function a(e){if(null==e||void 0==e||""==e||"null"==e||"undefined"==e)return!0;var t=e.toString(),r=t.slice(0,4),o=t.slice(4,6),n=t.slice(6,8),a=t.slice(8,10),i=t.slice(10,12),s=t.slice(12,14),u=r+"-"+o+"-"+n+" "+a+":"+i+":"+s;return u}function i(e){if(null==e||void 0==e||""==e||"null"==e||"undefined"==e)return!0;var t=e.toString(),r=t.slice(0,4),o=t.slice(4,6),n=t.slice(6,8),a=r+"-"+o+"-"+n;return a}function s(e,t){try{e instanceof Date||(e=new Date(e)),void 0!=t&&""!=t||(t="yyyy-MM-dd hh:mm:ss"),/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));var r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds()};for(var o in r)if(new RegExp("(".concat(o,")")).test(t)){var a=r[o]+"";t=t.replace(RegExp.$1,1===RegExp.$1.length?a:n(a))}return t}catch(i){return"-"}}function u(){var e=new Date,t=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),o=e.getDate().toString().padStart(2,"0"),n=e.getHours().toString().padStart(2,"0"),a=e.getMinutes().toString().padStart(2,"0"),i=e.getSeconds().toString().padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(o," ").concat(n,":").concat(a,":").concat(i)}function c(){var e=new Date,t=e.getFullYear(),r=(e.getMonth()+1).toString().padStart(2,"0"),o=e.getDate().toString().padStart(2,"0");return"".concat(t,"-").concat(r,"-").concat(o)}function l(e){if(e){e instanceof Date||(e=new Date(e.replace(/-/g,"/")));var t=e.getTime(),r=6e4,o=60*r,n=24*o,a=7*n,i=30*n,s=(new Date).getTime(),u=s-t;if(!(u<0)){var c=u/r,l=u/o,d=u/n,f=u/a,p=u/i,m="";if(p>=1&&p<=3)m=" "+parseInt(p)+"月前";else if(f>=1&&f<=3)m=" "+parseInt(f)+"周前";else if(d>=1&&d<=6)m=" "+parseInt(d)+"天前";else if(l>=1&&l<=23)m=" "+parseInt(l)+"小时前";else if(c>=1&&c<=59)m=" "+parseInt(c)+"分钟前";else if(u>=0&&u<=r)m="刚刚";else{var h=new Date;h.setTime(t);var g=h.getFullYear(),y=h.getMonth()+1<10?"0"+(h.getMonth()+1):h.getMonth()+1,v=h.getDate()<10?"0"+h.getDate():h.getDate();h.getHours()<10?h.getHours():h.getHours(),h.getMinutes()<10?h.getMinutes():h.getMinutes(),h.getSeconds()<10?h.getSeconds():h.getSeconds();m=g+"-"+y+"-"+v}return m}}}r.r(t),r.d(t,"DateToLong",(function(){return o})),r.d(t,"LongToDateTime",(function(){return a})),r.d(t,"LongToDate",(function(){return i})),r.d(t,"formatDate",(function(){return s})),r.d(t,"formattedDate",(function(){return u})),r.d(t,"formattedDateDuan",(function(){return c})),r.d(t,"timeago",(function(){return l}))},c56b:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var o=r("b775"),n=r("433d");function a(e){return o["a"].get(n["a"].apiBaseURL+"/pc/base/category/select/tree",{params:e})}function i(e){return Object(o["a"])({url:"/pc/base/category/detail",method:"get",params:e})}},d4df:function(e,t,r){},e3fa:function(e,t,r){"use strict";r("d4df")}}]);