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.

p__goods__newgoods.df2f1c85.async.js 13 KiB

преди 1 година
1
  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[816],{53571:function(se,k,n){"use strict";n.r(k),n.d(k,{default:function(){return ce}});var E=n(57338),M=n(25084),h=n(57663),y=n(71577),T=n(2824),$=n(34792),v=n(48086),Z=n(3182),Y=n(94043),d=n.n(Y),L=n(49101),m=n(67294),W=n(78009),G=n(85224),U=n(16894),R=n(12826),N=n(71194),F=n(50146),z=n(9715),f=n(86835),J=n(47673),j=n(4107),ie=n(43358),I=n(34041),e=n(85893),s=function(o){var u=I.Z.Option,c=I.Z.OptGroup;return(0,e.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,e.jsxs)(f.Z,{labelCol:{span:4},layout:"horizontal",preserve:!1,initialValues:o.values,onFinish:o.onFinish,children:[(0,e.jsx)(f.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(j.Z,{})}),(0,e.jsx)(f.Z.Item,{name:"code",label:"\u5546\u54C1\u7F16\u7801",hidden:!0,rules:[{required:!0}],children:(0,e.jsx)(j.Z,{})}),(0,e.jsx)(f.Z.Item,{name:"name",label:"\u5546\u54C1\u540D\u79F0",rules:[{required:!0}],children:(0,e.jsx)(j.Z,{})}),(0,e.jsx)(f.Z.Item,{name:"price",label:"\u5546\u54C1\u4EF7\u683C",rules:[{required:!0}],children:(0,e.jsx)(j.Z,{})}),(0,e.jsx)(f.Z.Item,{name:"imgUrl",label:"\u5546\u54C1\u56FE\u7247\u5730\u5740",rules:[{required:!0}],children:(0,e.jsx)(j.Z,{})}),(0,e.jsx)(f.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{required:!0}],children:(0,e.jsx)(j.Z,{})}),(0,e.jsx)(f.Z.Item,{name:"goodsTypeId",label:"\u5546\u54C1\u7C7B\u578B",rules:[{required:!0}],children:(0,e.jsx)(I.Z,{children:o.goodsTypaData==null?"":o.goodsTypaData.map(function(x,r){return(0,e.jsx)(I.Z.Option,{index:r,value:x.id,children:x.goodsType_Name},x.id)})})}),(0,e.jsx)(f.Z.Item,{name:"status",label:"\u72B6\u6001",defaultValue:o.values.status,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001"}],children:(0,e.jsx)(I.Z,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",children:(0,e.jsxs)(c,{children:[(0,e.jsx)(I.Z.Option,{value:0,children:"\u6B63\u5E38"}),(0,e.jsx)(I.Z.Option,{value:1,children:"\u505C\u7528"})]})})}),(0,e.jsx)(f.Z.Item,{children:(0,e.jsx)(y.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},C=s,t=n(48971),P=n(4795),oe=function(){var w=(0,Z.Z)(d().mark(function o(u){var c;return d().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return console.log("fields",u),c=v.default.loading("\u6B63\u5728\u6DFB\u52A0"),u.createBy="admin",r.prev=3,r.next=6,(0,P.Rq)(JSON.stringify(u)).then(function(S){S.data?v.default.success("\u6DFB\u52A0\u6210\u529F"):v.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 6:return c(),r.abrupt("return",!0);case 10:return r.prev=10,r.t0=r.catch(3),c(),v.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),r.abrupt("return",!1);case 15:case"end":return r.stop()}},o,null,[[3,10]])}));return function(u){return w.apply(this,arguments)}}(),K=function(){var w=(0,Z.Z)(d().mark(function o(u){var c;return d().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return c=v.default.loading("\u6B63\u5728\u914D\u7F6E"),r.prev=1,r.next=4,(0,P.e3)({id:u.id,code:u.code,name:u.name,price:u.price,imgUrl:u.imgUrl,remark:u.remark,status:u.status,goodsTypeId:u.goodsTypeId}).then(function(S){S.data?v.default.success("\u914D\u7F6E\u6210\u529F"):v.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 4:return r.abrupt("return",!0);case 7:return r.prev=7,r.t0=r.catch(1),c(),r.abrupt("return",!1);case 11:case"end":return r.stop()}},o,null,[[1,7]])}));return function(u){return w.apply(this,arguments)}}(),le=function(){var w=(0,Z.Z)(d().mark(function o(u){var c;return d().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(c=v.default.loading("\u6B63\u5728\u5220\u9664"),u){r.next=3;break}return r.abrupt("return",!0);case 3:return r.prev=3,r.next=6,(0,P.yR)(u.map(function(S){return S.id})).then(function(S){c(),S.data?v.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):v.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")});case 6:return r.abrupt("return",!0);case 9:return r.prev=9,r.t0=r.catch(3),c(),v.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),r.abrupt("return",!1);case 14:case"end":return r.stop()}},o,null,[[3,9]])}));return function(u){return w.apply(this,arguments)}}(),de=function(){var o=(0,m.useState)([]),u=(0,T.Z)(o,2),c=u[0],x=u[1],r=(0,m.useState)(!1),S=(0,T.Z)(r,2),pe=S[0],H=S[1],he=(0,m.useState)(!1),Q=(0,T.Z)(he,2),me=Q[0],fe=Q[1],A=(0,m.useRef)(),ge=(0,m.useState)(),X=(0,T.Z)(ge,2),b=X[0],V=X[1],ve=(0,m.useState)([]),q=(0,T.Z)(ve,2),D=q[0],_=q[1],ye=(0,m.useState)(),ee=(0,T.Z)(ye,2),be=ee[0],je=ee[1],Te=(0,m.useState)(),te=(0,T.Z)(Te,2),Se=te[0],Be=te[1],Ze=(0,m.useState)(),re=(0,T.Z)(Ze,2),xe=re[0],Ie=re[1],Ce=(0,m.useState)(),ne=(0,T.Z)(Ce,2),Ee=ne[0],we=ne[1];(0,m.useEffect)(function(){function p(){(0,P.GT)({current:1,pageSize:1e7}).then(function(a){var l=a.data.data;Ie(l)})}p();function i(){(0,P.fA)({current:1,pageSize:1e3}).then(function(a){var l=a.data.data;l.forEach(function(g){g.text=g.goodsType_Name,g.goodsTypeId=g.id}),x(l)})}i()},[]);var ae=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0},{title:"\u56FE\u7247\u5730\u5740",dataIndex:"imgUrl",hideInTable:!0,hideInSearch:!0},{title:"\u7F16\u7801",dataIndex:"code",valueType:"textarea"},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea"},{title:"\u57FA\u7840\u4EF7\u683C",dataIndex:"price",hideInForm:!0,renderText:function(i){return"".concat(i,"\xA5")},hideInSearch:!0},{title:"\u4F1A\u5458\u4EF7",dataIndex:"vipPrice",hideInForm:!0,renderText:function(i){return"".concat(i,"\xA5")},hideInSearch:!0},{title:"\u5546\u54C1\u5C0F\u7C7B",dataIndex:"goodsTypeName",hideInForm:!0,hideInSearch:!0},{title:"\u5546\u54C1\u7C7B\u578B",dataIndex:"goodsTypeId",hideInForm:!0,hideInTable:!0,valueEnum:c},{title:"\u5546\u54C1\u5C5E\u6027",dataIndex:"goodsAttribute",hideInForm:!0,valueEnum:{0:{text:"\u5355\u54C1"},1:{text:"\u5957\u9910"}}},{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:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",valueType:"date"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(i,a){return[(0,e.jsx)("a",{type:"primary",onClick:function(){t.m8.push({pathname:"/goods/goodsInfo",query:{isAdd:!1,values:a,tabStatus:"basis"}})},children:"\u66F4\u65B0"},"primary"),(0,e.jsx)("a",{type:"primary",onClick:function(){t.m8.push({pathname:"/goods/goodsInfo",query:{isAdd:!1,values:a,tabStatus:"goodsbom"}})},children:"\u5546\u54C1\u914D\u65B9\u8BBE\u7F6E"},"primary"),a.status===0&&(0,e.jsx)("a",{onClick:function(){a.status="1",K(a),A.current.reload()},children:"\u505C\u7528"},"link"),(a.status===1||a.status===2)&&(0,e.jsx)("a",{onClick:function(){a.status="0",K(a),A.current.reload()},children:"\u542F\u7528"},"warn"),(0,e.jsx)("a",{onClick:function(){t.m8.push({pathname:"/bom/cookingentry",query:{isAdd:!1,values:a}})},children:"\u5C0F\u7092\u914D\u7F6E"},"config")]}}];return(0,e.jsxs)(W.ZP,{children:[(0,e.jsx)(U.ZP,{headerTitle:"\u67E5\u8BE2\u8868\u683C",actionRef:A,rowKey:"id",search:{labelWidth:120},toolBarRender:function(){return[(0,e.jsxs)(y.Z,{type:"primary",onClick:function(){t.m8.push({pathname:"/goods/goodsInfo",query:{isAdd:!0,values:null,tabStatus:"basis"}})},children:[(0,e.jsx)(L.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var p=(0,Z.Z)(d().mark(function i(a){var l,g;return d().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:return l=[],a.goodsTypeId!=null&&(a.goodsTypeId=c[a.goodsTypeId].goodsTypeId),g=0,O.next=5,(0,P.lO)(a).then(function(ue){l=ue.data.data,g=ue.data.total});case 5:return O.abrupt("return",{data:l,success:!0,total:g});case 6:case"end":return O.stop()}},i)}));return function(i){return p.apply(this,arguments)}}(),columns:ae,rowSelection:{onChange:function(i,a){_(a)}}}),(D==null?void 0:D.length)>0&&(0,e.jsx)(G.Z,{extra:(0,e.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,e.jsx)("a",{style:{fontWeight:600},children:D.length})," ","\u9879 \xA0\xA0"]}),children:(0,e.jsx)(y.Z,{onClick:(0,Z.Z)(d().mark(function p(){var i,a;return d().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,le(D);case 2:_([]),(i=A.current)===null||i===void 0||(a=i.reloadAndRest)===null||a===void 0||a.call(i);case 4:case"end":return g.stop()}},p)})),children:"\u5220\u9664"})}),(0,e.jsx)(C,{goodsTypaData:c,onFinish:function(){var p=(0,Z.Z)(d().mark(function i(a){var l;return d().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:if(l=!1,!a.id){B.next=7;break}return B.next=4,K(a);case 4:l=B.sent,B.next=10;break;case 7:return B.next=9,oe(a);case 9:l=B.sent;case 10:l&&(H(!1),V(void 0),A.current&&A.current.reload()),A.current.reload();case 12:case"end":return B.stop()}},i)}));return function(i){return p.apply(this,arguments)}}(),onCancel:function(){H(!1),V(void 0)},createModalVisible:pe,values:b||{}}),(0,e.jsx)(M.Z,{width:600,visible:me,onClose:function(){V(void 0),fe(!1)},closable:!1,children:(b==null?void 0:b.name)&&(0,e.jsx)(R.ZP,{column:2,title:b==null?void 0:b.name,request:(0,Z.Z)(d().mark(function p(){return d().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",{data:b||{}});case 1:case"end":return a.stop()}},p)})),params:{id:b==null?void 0:b.name},columns:ae})})]})},ce=de},4795:function(se,k,n){"use strict";n.d(k,{lO:function(){return T},GT:function(){return v},Rq:function(){return W},e3:function(){return U},yR:function(){return N},fA:function(){return z},se:function(){return J}});var E=n(3182),M=n(94043),h=n.n(M),y=n(48971);function T(e){return $.apply(this,arguments)}function $(){return $=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,y.WY)("/kitchen/api/goods/goodss",{method:"Post",data:s}));case 1:case"end":return t.stop()}},e)})),$.apply(this,arguments)}function v(e){return Z.apply(this,arguments)}function Z(){return Z=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,y.WY)("/kitchen/api/bom/getpage",{method:"Post",data:s}));case 1:case"end":return t.stop()}},e)})),Z.apply(this,arguments)}function Y(e){return d.apply(this,arguments)}function d(){return d=_asyncToGenerator(_regeneratorRuntime.mark(function e(s){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",request("/kitchen/api/GoodsBom/AddBom",{method:"Post",data:s}));case 1:case"end":return t.stop()}},e)})),d.apply(this,arguments)}function L(e){return m.apply(this,arguments)}function m(){return m=_asyncToGenerator(_regeneratorRuntime.mark(function e(s){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",request("/kitchen/api/GoodsBom/getBomInfo",{method:"Post",data:s}));case 1:case"end":return t.stop()}},e)})),m.apply(this,arguments)}function W(e){return G.apply(this,arguments)}function G(){return G=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,y.WY)("/kitchen/api/goods",{method:"POST",data:s}));case 1:case"end":return t.stop()}},e)})),G.apply(this,arguments)}function U(e){return R.apply(this,arguments)}function R(){return R=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("\u5546\u54C1\u6570\u636E\u4FEE\u6539",s),t.abrupt("return",(0,y.WY)("/kitchen/api/goods",{method:"PUT",data:s}));case 2:case"end":return t.stop()}},e)})),R.apply(this,arguments)}function N(e){return F.apply(this,arguments)}function F(){return F=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,y.WY)("/kitchen/api/goods",{method:"DELETE",data:s}));case 1:case"end":return t.stop()}},e)})),F.apply(this,arguments)}function z(e){return f.apply(this,arguments)}function f(){return f=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,y.WY)("/kitchen/api/goods-type/goods-types",{method:"POST",data:s}));case 1:case"end":return t.stop()}},e)})),f.apply(this,arguments)}function J(e){return j.apply(this,arguments)}function j(){return j=(0,E.Z)(h().mark(function e(s){return h().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,y.WY)("/kitchen/api/goods-type/big-goods-types",{method:"POST",data:s}));case 1:case"end":return t.stop()}},e)})),j.apply(this,arguments)}function ie(e){return I.apply(this,arguments)}function I(){return I=_asyncToGenerator(_regeneratorRuntime.mark(function e(s){return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",request("/kitchen/api/goodstaste/getlist"));case 1:case"end":return t.stop()}},e)})),I.apply(this,arguments)}}}]);