WangHan
2025-04-03 a1b85ef72062ca80db35546e4216dd564f3e0f57
1
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-08b2476e","chunk-6ddcf9b0","chunk-2d0e66d0"],{"2c4d":function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"d",(function(){return a})),r.d(t,"g",(function(){return i})),r.d(t,"e",(function(){return s})),r.d(t,"f",(function(){return l})),r.d(t,"b",(function(){return c})),r.d(t,"c",(function(){return u}));var o=r("b775");function n(e){return Object(o["a"])({url:"/pc/fin/warehouse/ledger/getListExport",responseType:"blob",method:"post",params:e})}function a(e){return Object(o["a"])({url:"/pc/warehouse/warningConfig/add",method:"post",data:e})}function i(e){return Object(o["a"])({url:"/pc/warehouse/warningConfig/upd",method:"post",data:e})}function s(e){return Object(o["a"])({url:"/pc/warehouse/warningConfig/getById",method:"get",params:e})}function l(e){return Object(o["a"])({url:"/pc/warehouse/warningConfig/del",method:"delete",data:e})}function c(e){return Object(o["a"])({url:"/pc/warehouse/warning/getList",method:"get",params:e})}function u(e){return Object(o["a"])({url:"/pc/warehouse/warning/getWarningTypeNum",method:"get",params:e})}},"433d":function(e,t,r){"use strict";var o=r("c559"),n={ftpUrl:o["a"].ftpUrl,apiBaseURL:o["a"].apiBaseURL};t["a"]=n},"6ec5":function(e,t,r){"use strict";r.d(t,"l",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"g",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"j",(function(){return c})),r.d(t,"f",(function(){return u})),r.d(t,"d",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"p",(function(){return p})),r.d(t,"n",(function(){return m})),r.d(t,"m",(function(){return h})),r.d(t,"k",(function(){return g})),r.d(t,"s",(function(){return b})),r.d(t,"r",(function(){return y})),r.d(t,"q",(function(){return v})),r.d(t,"o",(function(){return w})),r.d(t,"b",(function(){return S})),r.d(t,"i",(function(){return O})),r.d(t,"h",(function(){return I}));var o=r("b775"),n=r("433d");function a(e){return o["a"].get(n["a"].apiBaseURL+"/pc/fin/sys/tenant/select/tree_fin_tenant",{params:e})}function i(e){return Object(o["a"])({url:"/pc/base/category/add",method:"post",data:e})}function s(e){return Object(o["a"])({url:"/pc/base/category/edit",method:"post",data:e})}function l(e){return Object(o["a"])({url:"/pc/base/warehouse/add",method:"post",data:e})}function c(e){return Object(o["a"])({url:"/pc/base/warehouse/edit",method:"post",data:e})}function u(e){return Object(o["a"])({url:"/pc/base/warehouse/del",method:"delete",data:e})}function d(){return Object(o["a"])({url:"/pc/base/goods/template/select/classificationCode",method:"get"})}function f(e){return Object(o["a"])({url:"/pc/base/category/del",method:"delete",data:e})}function p(e){return Object(o["a"])({url:"/pc/base/warehouse/select/tenant_warehouse",method:"get",params:e})}function m(e){return Object(o["a"])({url:"/pc/base/goods/template/query/goodsTemplate",method:"get",params:e})}function h(e){return Object(o["a"])({url:"/pc/base/goods/models/query/goodsModel",method:"get",params:e})}function g(e){return o["a"].get(n["a"].apiBaseURL+"/pc/base/category/select/tree",{params:e})}function b(e){return Object(o["a"])({url:"/pc/base/warehouse/select/number",method:"get",params:e})}function y(e){return Object(o["a"])({url:"/pc/base/warehouse/select/in/warehouse/num",method:"get",params:e})}function v(e){return Object(o["a"])({url:"/pc/fin/sys/tenant/user/query/user",method:"get",params:e})}function w(e){return Object(o["a"])({url:"/pc/base/goods/models/queryGoodsModelInfo",method:"get",params:e})}function S(e){return Object(o["a"])({url:"/pc/fin/sys/tenant/add",method:"post",data:e})}function O(e){return Object(o["a"])({url:"/pc/fin/sys/tenant/edit",method:"post",data:e})}function I(e){return Object(o["a"])({url:"/pc/fin/sys/tenant/editState",method:"post",data:e})}},9960:function(e,t,r){"use strict";r.r(t);var o=function(){var e=this,t=e.$createElement,r=e._self._c||t;return e.dialogShow?r("el-dialog",{attrs:{width:"40%",center:!0,"close-on-click-modal":!1,"close-on-press-escape":!1,title:e.dialogTitle,"before-close":e.beforeClose,modal:e.modal,visible:e.dialogShow}},[r("el-row",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{"element-loading-text":"数据导入中"}},[r("el-col",{attrs:{span:24}},[r("el-form",[null!=e.templateSettings.templateUrl?r("el-form-item",{attrs:{label:"下载模板:",prop:"lon"}},[r("a",{staticClass:"blue-txt",staticStyle:{color:"#409EFF"},attrs:{href:e.templateSettings.templateUrl,target:"_blank",rel:"noreferrer noopener"}},[e._v(e._s(e.templateSettings.templateName))])]):e._e(),e._v(" "),r("el-form-item",{attrs:{label:"选取文件:",prop:"lon"}},[r("el-upload",{ref:e.fileSettings.ref,staticClass:"upload-demo",attrs:{headers:e.headers,name:"file",data:e.fileSettings.data,action:e.fileSettings.uploadUrl,"before-upload":e.beforeAvatarUpload,"on-success":e.handleUploadSuccess,"on-change":e.file,multiple:e.fileSettings.multiple,limit:e.fileSettings.num,accept:e.fileSettings.accept,"auto-upload":e.fileSettings.autoUpload}},[r("el-button",{attrs:{size:"small",type:"primary"}},[e._v(e._s(e.fileSettings.title))]),e._v(" "),r("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v("只能上传"+e._s(e.fileSettings.num)+"个格式为"+e._s(e.fileSettings.accept)+"的文件,且不超过"+e._s(e.fileSettings.max)+"kb")])],1)],1),e._v(" "),r("el-form-item",{attrs:{label:"导入数据:",prop:"lon"}},[r("el-button",{staticStyle:{"margin-left":"10px"},attrs:{size:"small",type:"success"},on:{click:e.handleSubmit}},[e._v("开始导入")])],1)],1)],1)],1)],1):e._e()},n=[],a=r("5f87"),i=r("83d6"),s={props:{importSetting:{type:Object,default:function(){return{}}},dialogShow:{type:Boolean,default:!1},modal:{type:Boolean,default:!1},dialogTitle:{type:String,default:""}},data:function(){return{headers:{},loading:!1,fileSettings:{ref:"myFile",data:{},title:"点击上传",max:1024,num:1,accept:".xlsx",uploadUrl:"",type:"text",multiple:!1,disabled:!1,autoUpload:!1,onSuccess:null},isUpload:!1,templateSettings:{templateName:"模板下载",templateUrl:null}}},watch:{dialogShow:function(e){e&&(this.fileSettings=Object.assign(this.fileSettings,this.importSetting.fileSettings),this.templateSettings=Object.assign(this.templateSettings,this.importSetting.templateSettings),console.log(this.templateSettings),this.fileSettings.onSuccess=this.importSetting.onSuccess)}},mounted:function(){this.headers[i["sessionToken"]]=Object(a["a"])()},methods:{beforeClose:function(){var e=this;this.loading?this.$confirm("正在执行导入,确认关闭?").then((function(){e.importSetting.dialogShow=!1,e.loading=!1})).catch():this.importSetting.dialogShow=!1},beforeAvatarUpload:function(e){var t=this.fileSettings.accept.split(",").indexOf(e.name.substr(e.name.lastIndexOf("."),e.name.length).toLocaleString())>-1;t||this.$message.error("上传文件只能是 ".concat(this.fileSettings.accept," 格式!"));var r=e.size/1024<this.fileSettings.max;return r||this.$message.error("上传文件大小不能超过 "+this.fileSettings.max+"kb!"),t&&r},handleSubmit:function(){this.isUpload?this.$refs[this.fileSettings.ref].submit():this.$message.error("请上传文件")},file:function(e,t){e&&(this.isUpload=!0)},handleUploadSuccess:function(e,t,r){var o=this;this.fileSettings.onSuccess&&(this.loading=!0,this.fileSettings.onSuccess(e,(function(){o.loading=!1,o.importSetting.dialogShow=!1})))}}},l=s,c=r("2877"),u=Object(c["a"])(l,o,n,!1,null,null,null);t["default"]=u.exports},c4b0: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("div",{staticClass:"app-container"},[r("el-container",[r("el-container",[r("el-card",{staticClass:"box-card",staticStyle:{width:"100%"},attrs:{shadow:"never"}},[r("div",{staticClass:"filter-container"},[r("my-search",{ref:"searchBar",attrs:{items:e.items},on:{search:e.fifterForm}})],1),e._v(" "),r("el-row",{staticStyle:{"margin-top":"15px"}},[r("el-col",[r("my-table-v2",{ref:"myTable",attrs:{filter:e.filterFrom,table:e.table}})],1)],1),e._v(" "),e.editSetting.show?r("edit",{attrs:{setting:e.editSetting},on:{close:function(t){e.editSetting.show=!1},search:e.search}}):e._e()],1)],1)],1),e._v(" "),r("my-import",{attrs:{"import-setting":e.importSetting,"dialog-show":e.importSetting.dialogShow,"dialog-title":e.importSetting.dialogTitle}})],1)},n=[],a=r("80cb"),i=r("f6e8"),s=r("433d"),l=r("db8c"),c=r("9960"),u=r("dee4"),d=r("2c4d"),f=r("2f62");function p(e){return p="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},p(e)}function m(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 h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){g(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){var t=y(e,"string");return"symbol"==p(t)?t:t+""}function y(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=p(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var v={name:"index",components:{MyButton:i["a"],MyTableV2:a["a"],edit:l["default"],myImport:c["default"]},data:function(){var e=this;return{items:[{type:"cascader",dataIndex:"agencyId",label:"机构",placeholder:"请选择",defaultValue:"",options:[],cascader:[{key:"warehouseId",queryKey:"agencyId"},{key:"baseGoodsTemplateId",queryKey:"agencyId"}],optionsConfig:{url:"/pc/fin/sys/tenant/select/tree_fin_tenant",props:null}},{type:"select",dataIndex:"warehouseId",label:"仓库",placeholder:"请选择",defaultValue:"",options:[],optionsConfig:{label:"warehouseName",value:"id",url:s["a"].apiBaseURL+"/pc/base/warehouse/select/tenant_warehouse"}},{type:"cascader",dataIndex:"categoryId",label:"分类",placeholder:"请选择",defaultValue:"",options:[],optionsConfig:{label:"label",value:"id",url:s["a"].apiBaseURL+"/pc/base/category/select/tree",props:{checkStrictly:!1,emitPath:!1,value:"id"}},cascader:[{key:"baseGoodsTemplateId",queryKey:"categoryId"}]},{type:"select",dataIndex:"baseGoodsTemplateId",label:"物品名称",placeholder:"请输入",defaultValue:"",options:[],optionsConfig:{label:"goodsName",value:"id",url:s["a"].apiBaseURL+"/pc/base/goods/template/query/goodsTemplate"}},{type:"select",dataIndex:"costType",label:"类别",placeholder:"请选择",defaultValue:"",options:[{label:"A",value:"1"},{label:"B",value:"2"},{label:"C",value:"3"}]}],importSetting:{dialogTitle:"导入",dialogShow:!1,fileSettings:{data:{},uploadUrl:Object(u["b"])()+"/pc/warehouse/warningConfig/import",accept:".xls",type:"text",loading:!1},templateSettings:{templateName:"导入模板.xls",templateUrl:s["a"].apiBaseURL+"/pc/warehouse/warningConfig/getWarnConfImportTemplate"},onSuccess:null},filterFrom:{warehouseType:0},editSetting:{title:"",id:"",orgId:"",show:!1},table:{showIndex:!0,expand:!1,url:s["a"].apiBaseURL+"/pc/warehouse/warningConfig/getList",tools:{columnsCtrl:{show:!1},generalExport:{show:!1},custom:[{name:"新增",click:function(){e.showAdd(null)}},{name:"导入",click:function(){e.importOrg()}}]},columns:[{title:"机构",field:"agencyName",align:"left",minWidth:130},{title:"仓库",field:"warehouseName",align:"left",minWidth:130},{title:"分类",field:"categoryName",align:"left",minWidth:130},{title:"所属类别",field:"costType",align:"center",width:80},{title:"物品名称",field:"goodsName",align:"left",minWidth:130},{title:"规格型号",field:"modelName",align:"left",minWidth:130},{title:"保底库存",field:"lowerLimit",align:"center",width:100},{title:"封顶库存",field:"upperLimit",align:"center",width:100}],operation:{show:!0,width:"150",attr:[{title:"编辑",events:function(t){e.showAudit(t)}},{title:"删除",events:function(t){e.del(t)}}]},paging:{show:!0,page:{small:!1,pageNum:1,pageSize:10,total:0}}}}},computed:h({},Object(f["b"])(["userInfo"])),created:function(){},methods:{del:function(e){var t=this;this.$modal.confirm("是否确认删除此条的数据吗?").then((function(){Object(d["f"])({id:e.id}).then((function(e){t.$message.success("删除成功!"),t.search()}))}))},showAdd:function(){this.editSetting.id=null,this.editSetting.info=null,this.editSetting.title="新增",this.editSetting.show=!0},showAudit:function(e){this.editSetting.id=e.id,this.editSetting.info=JSON.stringify(e),this.editSetting.title="编辑",this.editSetting.show=!0},importOrg:function(){var e=this;this.importSetting.dialogShow=!0,this.importSetting.onSuccess=function(t,r){1===t.code?(e.$message.success(t.msg),e.search(1)):e.$message.warning(t.msg),r()}},search:function(e){void 0!=e?this.$refs.myTable.search({pageNum:e}):this.$refs.myTable.search()},fifterForm:function(e){this.filterFrom=Object.assign(this.filterFrom,e),this.filterFrom.agencyId&&this.filterFrom.agencyId.length&&(this.filterFrom.agencyId=this.filterFrom.agencyId[this.filterFrom.agencyId.length-1]),this.search(1)}}},w=v,S=r("2877"),O=Object(S["a"])(w,o,n,!1,null,"5c6e392b",null);t["default"]=O.exports},db8c: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",{attrs:{title:e.setting.title+"预警设置",width:"800px",loading:e.loading},on:{close:e.close}},[r("el-form",{ref:"ruleForm",staticClass:"demo-ruleForm",attrs:{model:e.formData,rules:e.rules,"label-width":"100px"}},[r("el-row",{attrs:{gutter:24}},[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"预警仓库",prop:"baseWarehouseId"}},[r("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择预警仓库",disabled:"edit"==e.type},model:{value:e.formData.baseWarehouseId,callback:function(t){e.$set(e.formData,"baseWarehouseId",t)},expression:"formData.baseWarehouseId"}},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:"baseCategoryId"}},[r("el-cascader",{staticStyle:{width:"100%"},attrs:{options:e.categoryOptions,props:{value:"id",emitPath:!1},"show-all-levels":!1,filterable:"",clearable:"",disabled:"edit"==e.type},on:{change:e.categoryChange},model:{value:e.formData.baseCategoryId,callback:function(t){e.$set(e.formData,"baseCategoryId",t)},expression:"formData.baseCategoryId"}})],1)],1)],1),e._v(" "),r("el-row",{attrs:{gutter:24}},[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"物品名称",prop:"baseGoodsTemplateId"}},[r("el-select",{staticStyle:{width:"100%"},attrs:{value:e.formData.baseGoodsTemplateId,placeholder:e.formData.baseCategoryId?"请选择物品":"请先选择物品分类",filterable:"",clearable:"",disabled:!e.formData.baseCategoryId||"edit"==e.type},on:{change:e.goodsTemplateChange}},e._l(e.goodsTemplatelOptions,(function(e){return r("el-option",{key:e.id,attrs:{label:e.goodsName,value:e.id}})})),1)],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"规格型号",prop:"modelsIds"}},[r("el-select",{staticStyle:{width:"100%"},attrs:{multiple:"",clearable:"",disabled:!e.formData.baseGoodsTemplateId||"edit"==e.type,placeholder:e.formData.baseCategoryId?"请选择规格型号":"请先选择物品名称"},on:{change:e.modelChange,"remove-tag":e.modelRemoveTag,clear:function(t){return e.modelRemoveTag(-1)}},model:{value:e.formData.modelsIds,callback:function(t){e.$set(e.formData,"modelsIds",t)},expression:"formData.modelsIds"}},e._l(e.modelsOptions,(function(e){return r("el-option",{key:e.id,attrs:{label:e.modelName,value:e.id}})})),1)],1)],1)],1),e._v(" "),"edit"===e.type?r("el-row",[r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"保底库存",prop:"lowerLimit"}},[r("el-input",{attrs:{placeholder:"请输入"},model:{value:e.formData.lowerLimit,callback:function(t){e.$set(e.formData,"lowerLimit",e._n(t))},expression:"formData.lowerLimit"}})],1)],1),e._v(" "),r("el-col",{attrs:{span:12}},[r("el-form-item",{attrs:{label:"封顶库存",prop:"upperLimit"}},[r("el-input",{attrs:{placeholder:"请输入"},model:{value:e.formData.upperLimit,callback:function(t){e.$set(e.formData,"upperLimit",e._n(t))},expression:"formData.upperLimit"}})],1)],1)],1):r("el-table",{attrs:{data:e.formData.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        ")]}}])}),e._v(" "),r("el-table-column",{attrs:{prop:"lowerLimit",label:"保底库存",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var o=t.row,n=t.$index;return[r("el-form-item",{attrs:{"label-width":"0",prop:"models."+n+".lowerLimit",rules:[{validator:e.checkCounts,type:1,lowerLimit:o.lowerLimit,upperLimit:o.upperLimit,trigger:["blur","change"]}]}},[r("el-input",{model:{value:o.lowerLimit,callback:function(t){e.$set(o,"lowerLimit",e._n(t))},expression:"row.lowerLimit"}})],1)]}}])}),e._v(" "),r("el-table-column",{attrs:{prop:"upperLimit",label:"封顶库存",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var o=t.row,n=t.$index;return[r("el-form-item",{attrs:{"label-width":"0",prop:"models."+n+".upperLimit",rules:[{validator:e.checkCounts,type:2,lowerLimit:o.lowerLimit,upperLimit:o.upperLimit,trigger:["blur","change"]}]}},[r("el-input",{model:{value:o.upperLimit,callback:function(t){e.$set(o,"upperLimit",e._n(t))},expression:"row.upperLimit"}})],1)]}}])})],1)],1),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.save}})],1)],1)},n=[],a=r("f76d"),i=r("f6e8"),s=r("6ec5"),l=r("2c4d"),c=r("2f62");r("ed08");function u(e){return u="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},u(e)}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",l=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 f(e,t,r,o){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),s=new E(o||[]);return n(i,"_invoke",{value:T(e,r,s)}),i}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var m="suspendedStart",h="suspendedYield",g="executing",b="completed",y={};function v(){}function w(){}function S(){}var O={};c(O,i,(function(){return this}));var I=Object.getPrototypeOf,j=I&&I(I(N([])));j&&j!==r&&o.call(j,i)&&(O=j);var L=S.prototype=v.prototype=Object.create(O);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(n,a,i,s){var l=p(e[n],e,a);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==u(d)&&o.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){c.value=e,i(c)}),(function(e){return r("throw",e,i,s)}))}s(l.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 T(t,r,o){var n=m;return function(a,i){if(n===g)throw Error("Generator is already running");if(n===b){if("throw"===a)throw i;return{value:e,done:!0}}for(o.method=a,o.arg=i;;){var s=o.delegate;if(s){var l=C(s,o);if(l){if(l===y)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(n===m)throw n=b,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n=g;var c=p(t,r,o);if("normal"===c.type){if(n=o.done?b:h,c.arg===y)continue;return{value:c.arg,done:o.done}}"throw"===c.type&&(n=b,o.method="throw",o.arg=c.arg)}}}function C(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,C(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=p(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 D(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 E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function N(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(u(t)+" is not iterable")}return w.prototype=S,n(L,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:w,configurable:!0}),w.displayName=c(S,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,c(e,l,"GeneratorFunction")),e.prototype=Object.create(L),e},t.awrap=function(e){return{__await:e}},x(_.prototype),c(_.prototype,s,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,o,n,a){void 0===a&&(a=Promise);var i=new _(f(e,r,o,n),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(L),c(L,l,"Generator"),c(L,i,(function(){return this})),c(L,"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=N,E.prototype={constructor:E,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 l=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){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:N(t),resultName:r,nextLoc:o},"next"===this.method&&(this.arg=e),y}},t}function f(e,t,r,o,n,a,i){try{var s=e[a](i),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(o,n)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(o,n){var a=e.apply(t,r);function i(e){f(a,o,n,i,s,"next",e)}function s(e){f(a,o,n,i,s,"throw",e)}i(void 0)}))}}function m(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 h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){g(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t,r){return(t=b(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e){var t=y(e,"string");return"symbol"==u(t)?t:t+""}function y(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=u(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var v={components:{winMd:a["a"],myButton:i["a"]},props:{setting:{type:Object,default:function(){}}},data:function(){return{checkCounts:function(e,t,r){var o=1===e.type?e.lowerLimit:e.upperLimit;return o?Number.isInteger(o)?o<1?r(new Error("数字值必须大于0")):e.lowerLimit&&e.upperLimit&&e.lowerLimit>=e.upperLimit?r(new Error(1===e.type?"保底库存必须小于封顶库存":"封顶库存必须大于保底库存")):void r():r(new Error("请输入数字值")):r(new Error(1===e.type?"请输入保底数量":"请输入封顶数量"))},loading:!0,type:"",warehouses:[],agencyOptions:[],categoryOptions:[],goodsTemplatelOptions:[],modelsOptions:[],formData:{warehouseType:0,baseWarehouseId:"",baseCategoryIds:"",baseCategoryId:"",baseGoodsTemplateId:"",modelsIds:[],models:[]},rules:{baseWarehouseId:[{required:!0,message:"请选择预警仓库",trigger:"change"}],baseCategoryId:[{required:!0,message:"请选择物品分类",trigger:"change"}],baseGoodsTemplateId:[{required:!0,message:"请选择物品",trigger:"change"}],modelsIds:[{required:!0,message:"请选择规格型号",trigger:"change"}],lowerLimit:[{required:!0,message:"请输入",trigger:"blur"},{type:"number",message:"请输入数字值",trigger:"blur"}],upperLimit:[{required:!0,message:"请输入",trigger:"blur"},{type:"number",message:"请输入数字值",trigger:"blur"}]}}},computed:h({},Object(c["b"])(["userInfo"])),created:function(){this.init()},methods:{init:function(){var e=p(d().mark((function e(){var t,r;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.getCategoryTree();case 4:if(!this.setting.id){e.next=18;break}return this.type="edit",e.next=8,Object(l["e"])({id:this.setting.id});case 8:return t=e.sent,e.next=11,Object(s["o"])({baseGoodsModelsId:t.baseGoodsModelsId});case 11:r=e.sent,t.baseCategoryId=r[0].categoryId,this.getgoodsTemplate(t.baseCategoryId),this.getgoodsModel(t.baseGoodsTemplateId),this.formData=Object.assign({},t),this.formData.modelsIds=[t.baseGoodsModelsId],this.getWarehouseList();case 18:this.loading=!1;case 19:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),getWarehouseList:function(){var e=this;Object(s["p"])({agencyId:this.userInfo.tenantId}).then((function(t){e.warehouses=t,e.warehouses.length&&!e.formData.baseWarehouseId&&(e.formData.baseWarehouseId=e.warehouses[0].id)})).catch((function(e){console.log("err",e)}))},getCategoryTree:function(){var e=this;return new Promise(function(){var t=p(d().mark((function t(r){var o;return d().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(s["k"])();case 2:o=t.sent,e.categoryOptions=e.removeEmptyChildren(o),r();case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},getgoodsTemplate:function(e){var t=this;Object(s["n"])({categoryId:e||"",agencyId:this.userInfo.tenantId}).then((function(e){t.goodsTemplatelOptions=e}))},getgoodsModel:function(e){var t=this;Object(s["m"])({goodsTemplatesId:e||""}).then((function(e){t.modelsOptions=e}))},getGoodsModelsName:function(e){var t=this.modelsOptions.find((function(t){return t.id==e}));if(t)return t.modelName},categoryChange:function(e){this.goodsTemplatelOptions=[],this.modelsOptions=[],this.formData.baseGoodsTemplateId="",this.formData.modelsIds=[],this.formData.models=[],this.getgoodsTemplate(e)},goodsTemplateChange:function(e){this.formData.modelsIds=[],this.formData.models=[],this.formData.baseGoodsTemplateId=e,this.getgoodsModel(e)},removeEmptyChildren:function(e){var t=this;return e.forEach((function(e){e.children&&e.children.length?t.removeEmptyChildren(e.children):delete e.children})),e},modelChange:function(e){var t=this.formData.models,r=JSON.stringify(t);e.forEach((function(e,o){r&&!r.includes(e)&&t.push({baseGoodsModelsId:e,lowerLimit:null,upperLimit:null})}))},modelRemoveTag:function(e){if(-1!==e){var t=this.formData.models.findIndex((function(t){return t.baseGoodsModelsId==e}));this.formData.models.splice(t,1)}else this.formData.models=[]},getEditInfo:function(e){},close:function(){this.$emit("close")},save:function(){var e=this;this.$refs.ruleForm.validate((function(t){if(t){if(e.loading)return;if(e.loading=!0,e.setting.id){var r={id:e.setting.id,lowerLimit:e.formData.lowerLimit,upperLimit:e.formData.upperLimit};Object(l["g"])(r).then((function(t){e.loading=!1,e.$message.success("保存成功!"),e.close(),e.$emit("search")})).catch((function(t){e.loading=!1,e.$message.error("保存失败")}))}else{var o={warehouseType:e.formData.warehouseType,baseWarehouseId:e.formData.baseWarehouseId,baseGoodsTemplateId:e.formData.baseGoodsTemplateId,modelConfigStr:JSON.stringify(e.formData.models)};Object(l["d"])(o).then((function(t){e.loading=!1,e.$message.success("保存成功!"),e.close(),e.$emit("search")})).catch((function(t){e.loading=!1,e.$message.error("保存失败")}))}}else e.$message.error("校验未通过,请检查。")}))}}},w=v,S=r("2877"),O=Object(S["a"])(w,o,n,!1,null,null,null);t["default"]=O.exports}}]);