You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2 lines
9.6 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5380],{28266:function(te,b,a){"use strict";a.r(b),a.d(b,{default:function(){return ue}});var I=a(71194),F=a(50146),v=a(39428),B=a(3182),W=a(57663),j=a(71577),c=a(34792),f=a(48086),d=a(2824),h=a(49101),r=a(67294),T=a(53779),A=a(77576),R=a(12028),k=a(77883),P=a(85986),G=a(9715),m=a(55843),M=a(47673),ne=a(4107),Ee=a(43358),O=a(34041),s=a(85893),ae=function(o){var U=O.Z.Option,K=O.Z.OptGroup;return(0,s.jsx)(F.Z,{title:o.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:o.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){o.onCancel()},destroyOnClose:!0,children:(0,s.jsxs)(m.Z,{layout:"vertical",preserve:!1,initialValues:o.values,onFinish:o.onFinish,children:[(0,s.jsx)(m.Z.Item,{name:"id",hidden:!0,children:(0,s.jsx)(ne.Z,{})}),(0,s.jsx)(m.Z.Item,{name:"stockGoodsCode",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,s.jsx)(O.Z,{placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",children:o.stockGoodsData.map(function(Z,E){return(0,s.jsx)(O.Z.Option,{index:E,value:Z.id,children:Z.name},Z.id)})})}),(0,s.jsx)(m.Z.Item,{name:"bomQty",label:"\u914D\u65B9\u7528\u91CF",defaultValue:o.values.bomQty,children:(0,s.jsx)(P.Z,{placeholder:"\u914D\u65B9\u7528\u91CF",min:0})}),(0,s.jsx)(m.Z.Item,{name:"isMain",label:"\u4E3B\u8981\u539F\u6599",children:(0,s.jsx)(R.Z,{checkedChildren:"\u5426",unCheckedChildren:"\u662F",defaultChecked:!0})}),(0,s.jsx)(m.Z.Item,{name:"isReplace",label:"\u662F\u5426\u53EF\u4EE5\u66FF\u6362",children:(0,s.jsx)(R.Z,{checkedChildren:"\u5426",unCheckedChildren:"\u662F",defaultChecked:!0})}),(0,s.jsx)(m.Z.Item,{children:(0,s.jsx)(j.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},se=ae,x=a(48971),S={goodsBoms:function(o){return(0,x.WY)("/kitchen/api/goods-bom/goods-boms",{method:"Post",data:o})},GetDicList:function(o){return(0,x.WY)("/kitchen/api/dict-data/dic-list/".concat(o),{method:"Get"})},updateGoodsBom:function(o){return(0,x.WY)("/kitchen/api/goods-bom",{method:"PUT",data:o})},addGoodsBom:function(o){return(0,x.WY)("/kitchen/api/goods-bom",{method:"POST",data:o})},removeGoodsBom:function(o){return(0,x.WY)("/kitchen/api/goods-bom",{method:"DELETE",data:o})},goodList:function(o){return(0,x.WY)("/kitchen/api/goods/goodss",{method:"Post",data:o})},postStockGoods:function(){return(0,x.WY)("/kitchen/api/frachisee-stock-adjust/product-list",{method:"Get"})}},oe=function(o){var U=(0,r.useState)(!1),K=(0,d.Z)(U,2),Z=K[0],E=K[1],re=(0,r.useState)(!1),Y=(0,d.Z)(re,2),ie=Y[0],L=Y[1],de=(0,r.useState)([]),w=(0,d.Z)(de,2),le=w[0],ce=w[1],fe=(0,r.useState)([]),Q=(0,d.Z)(fe,2),he=Q[0],me=Q[1],ve=(0,r.useState)(!1),N=(0,d.Z)(ve,2),De=N[0],ye=N[1],C=(0,r.useRef)(),Ce=(0,r.useState)(),$=(0,d.Z)(Ce,2),z=$[0],p=$[1],ge=(0,r.useState)([]),H=(0,d.Z)(ge,2),J=H[0],Ie=H[1],xe=(0,r.useState)([]),X=(0,d.Z)(xe,2),Fe=X[0],Se=X[1],pe=(0,r.useState)([]),q=(0,d.Z)(pe,2),V=q[0],ke=q[1];(0,r.useEffect)(function(){function n(){S.goodList({current:1,pageSize:20,status:"0"}).then(function(u){var l=u.data.data;l.forEach(function(t){t.text=t.name,t.goodsId=t.id}),Se(l)})}n();function i(){S.postStockGoods().then(function(u){var l=u.data;l.forEach(function(t){t.text=t.name,t.stockGoodsId=t.value}),ke(l)})}i();function e(){S.GetDicList("BatchingType").then(function(u){var l=u.data,t={};u.succeeded&&l.forEach(function(g){t[g.value]={text:g.remark}}),me(t),console.log(l),ce(l)})}e()},[]);function _(n){try{return S.addGoodsBom(JSON.stringify(n)).then(function(i){i.data?(f.default.success("\u6DFB\u52A0\u6210\u529F"),C.current.reload()):f.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(i){return f.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function D(n){console.log(n);try{return S.updateGoodsBom({id:n.id,goodsID:n.goods_Id,stockGoodsCode:n.stockGoodsCode,remark:n.remark,status:n.status,batchingType:n.batchingType,isReplace:n.isReplace,isMain:n.isMain,bomQty:n.bomQty}).then(function(i){i.data?f.default.success("\u914D\u7F6E\u6210\u529F"):f.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),C.current.reload()}),!0}catch(i){return f.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function Be(){if(!J)return!0;try{return S.removeGoodsBom(J.map(function(n){return n.id})).then(function(n){n.data?f.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):f.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),C.current.reload()}),!0}catch(n){return f.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),!1}}var Ze=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(i,e){return(0,s.jsx)("a",{onClick:function(){p(e),ye(!0)},children:i})}},{title:"\u539F\u6599\u540D\u79F0",dataIndex:"stockGoodsName",hideInForm:!0,hideInSearch:!0},{title:"\u539F\u6599\u540D\u79F0",dataIndex:"stockGoodsCode",hideInForm:!0,hideInTable:!0,valueType:"select",valueEnum:V},{title:"\u914D\u6599\u7C7B\u578B",dataIndex:"batchingType",hideInForm:!0,valueEnum:he},{title:"\u72B6\u6001",dataIndex:"status",hideInForm:!0,valueEnum:{0:{text:"\u6B63\u5E38",status:"Processing"},1:{text:"\u505C\u7528",status:"Error"},2:{text:"\u5220\u9664",status:"Error"}}},{title:"\u4E3B\u8981\u539F\u6599",dataIndex:"isMain",hideInForm:!0,valueEnum:{false:{text:"\u8F85\u6599",status:"Processing"},true:{text:"\u4E3B\u6599",status:"Success"}}},{title:"\u914D\u65B9\u7528\u91CF",dataIndex:"bomQty",hideInSearch:!0,width:120},{title:"\u662F\u5426\u53EF\u4EE5\u66FF\u6362",dataIndex:"isReplace",hideInForm:!0,valueEnum:{false:{text:"\u4E0D\u53EF\u66FF\u6362",status:"Processing"},true:{text:"\u53EF\u66FF\u6362",status:"Success"}}},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",valueType:"date"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(i,e){return[e.status==="0"&&(0,s.jsx)("a",{onClick:function(){e.status="1",D(e)},children:"\u505C\u7528"},"link"),(e.status==="1"||e.status==="2")&&(0,s.jsx)("a",{onClick:function(){e.status="0",D(e)},children:"\u542F\u7528"},"warn"),e.status==="0"&&e.isReplace&&(0,s.jsx)("a",{onClick:function(){e.isReplace=!1,D(e)},children:"\u4E0D\u542F\u7528"},"link"),e.status==="0"&&!e.isReplace&&(0,s.jsx)("a",{onClick:function(){e.isReplace=!0,D(e)},children:"\u542F\u7528\u66FF\u6362"},"warn"),e.status==="0"&&e.isReplace&&(0,s.jsx)("a",{onClick:function(){L(!0),p(e)},children:"\u66FF\u6362\u7269\u6599"},"link"),(0,s.jsx)("a",{onClick:function(){E(!0),p(e)},children:"\u4FEE\u6539"},"link")]}}];return(0,s.jsxs)(F.Z,{width:1200,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u5546\u54C1\u914D\u65B9",visible:o.setGoodsBomModalVisible,footer:!1,onCancel:function(){return o.onCancel()},maskClosable:!1,children:[(0,s.jsx)(T.ZP,{headerTitle:"\u5546\u54C1\u914D\u65B9\u4FE1\u606F\u67E5\u8BE2",actionRef:C,rowKey:"id",pagination:{defaultPageSize:20},search:!1,toolBarRender:function(){return[(0,s.jsxs)(j.Z,{type:"primary",onClick:function(){return E(!0)},children:[(0,s.jsx)(h.Z,{})," \u65B0\u589E\u5546\u54C1\u914D\u65B9"]},"create")]},request:function(){var n=(0,B.Z)((0,v.Z)().mark(function i(e){var u,l;return(0,v.Z)().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return u=[],l=0,o.values.id!=null&&(e.goodsId=o.values.id),g.next=5,S.goodsBoms(e).then(function(ee){u=ee.data.data,l=ee.data.total});case 5:return g.abrupt("return",{data:u,success:!0,total:l});case 6:case"end":return g.stop()}},i)}));return function(i){return n.apply(this,arguments)}}(),columns:Ze}),(0,s.jsx)(se,{dicData:le,stockGoodsData:V,onFinish:function(){var n=(0,B.Z)((0,v.Z)().mark(function i(e){var u;return(0,v.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(u=!1,e.goodsId=o.values.id,e.goods_Id=o.values.id,!e.id){t.next=9;break}return t.next=6,D(e);case 6:u=t.sent,t.next=12;break;case 9:return t.next=11,_(e);case 11:u=t.sent;case 12:u&&(E(!1),p(void 0),C.current&&C.current.reload());case 13:case"end":return t.stop()}},i)}));return function(i){return n.apply(this,arguments)}}(),onCancel:function(){E(!1),p(void 0)},createModalVisible:Z,values:z||{}}),(0,s.jsx)(GoodsBomReplace,{stockGoodsData:V,onFinish:function(){var n=(0,B.Z)((0,v.Z)().mark(function i(e){var u;return(0,v.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(u=!1,e.goodsId=o.values.id,!e.id){t.next=8;break}return t.next=5,D(e);case 5:u=t.sent,t.next=11;break;case 8:return t.next=10,_(e);case 10:u=t.sent;case 11:u&&(L(!1),p(void 0),C.current&&C.current.reload());case 12:case"end":return t.stop()}},i)}));return function(i){return n.apply(this,arguments)}}(),onCancel:function(){L(!1),p(void 0)},createModalVisible:ie,values:z||{}})]})},ue=oe},34952:function(te,b,a){"use strict";var I=a(22122),F=a(15105),v=a(67294),B=function(c,f){var d={};for(var h in c)Object.prototype.hasOwnProperty.call(c,h)&&f.indexOf(h)<0&&(d[h]=c[h]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,h=Object.getOwnPropertySymbols(c);r<h.length;r++)f.indexOf(h[r])<0&&Object.prototype.propertyIsEnumerable.call(c,h[r])&&(d[h[r]]=c[h[r]]);return d},W={border:0,background:"transparent",padding:0,lineHeight:"inherit",display:"inline-block"},j=v.forwardRef(function(c,f){var d=function(G){var m=G.keyCode;m===F.Z.ENTER&&G.preventDefault()},h=function(G){var m=G.keyCode,M=c.onClick;m===F.Z.ENTER&&M&&M()},r=c.style,T=c.noStyle,A=c.disabled,R=B(c,["style","noStyle","disabled"]),k={};return T||(k=(0,I.Z)({},W)),A&&(k.pointerEvents="none"),k=(0,I.Z)((0,I.Z)({},k),r),v.createElement("div",(0,I.Z)({role:"button",tabIndex:0,ref:f},R,{onKeyDown:d,onKeyUp:h,style:k}))});b.Z=j}}]);