25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

2 satır
7.5 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[425],{33770:function(he,O,e){"use strict";e.r(O),e.d(O,{default:function(){return ae}});var me=e(57338),k=e(273),i=e(39428),h=e(3182),ve=e(57663),R=e(71577),pe=e(62350),U=e(24565),ye=e(34792),c=e(48086),F=e(2824),J=e(49101),y=e(67294),K=e(78009),N=e(85224),b=e(16894),z=e(12826),Ze=e(71194),H=e(50146),ge=e(9715),Z=e(55843),xe=e(47673),w=e(4107),Ce=e(43358),g=e(34041),t=e(85893),Q=function(s){var m=g.Z.Option,n=g.Z.OptGroup;return(0,t.jsx)(H.Z,{title:s.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:s.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){s.onCancel()},destroyOnClose:!0,maskClosable:!1,children:(0,t.jsxs)(Z.Z,{layout:"vertical",preserve:!1,initialValues:s.values,onFinish:s.onFinish,children:[(0,t.jsx)(Z.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(w.Z,{})}),(0,t.jsx)(Z.Z.Item,{name:"name",label:"\u5546\u54C1\u5355\u4F4D\u540D\u79F0",rules:[{required:!0,max:64}],children:(0,t.jsx)(w.Z,{placeholder:"\u5546\u54C1\u5355\u4F4D\u540D\u79F0"})}),(0,t.jsx)(Z.Z.Item,{name:"status",label:"\u72B6\u6001",defaultValue:s.values.status,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001"}],children:(0,t.jsx)(g.Z,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",children:(0,t.jsxs)(n,{children:[(0,t.jsx)(g.Z.Option,{value:"0",children:"\u6B63\u5E38"}),(0,t.jsx)(g.Z.Option,{value:"1",children:"\u505C\u7528"})]})})}),(0,t.jsx)(Z.Z.Item,{children:(0,t.jsx)(R.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},X=Q,x=e(48971);function q(l){return E.apply(this,arguments)}function E(){return E=(0,h.Z)((0,i.Z)().mark(function l(s){return(0,i.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,x.WY)("/kitchen/api/goods-unit/type",{method:"Post",data:s}));case 1:case"end":return n.stop()}},l)})),E.apply(this,arguments)}function _(l){return D.apply(this,arguments)}function D(){return D=(0,h.Z)((0,i.Z)().mark(function l(s){return(0,i.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,x.WY)("/kitchen/api/goods-unit",{method:"POST",data:s}));case 1:case"end":return n.stop()}},l)})),D.apply(this,arguments)}function ee(l){return I.apply(this,arguments)}function I(){return I=(0,h.Z)((0,i.Z)().mark(function l(s){return(0,i.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,x.WY)("/kitchen/api/goods-unit",{method:"PUT",data:s}));case 1:case"end":return n.stop()}},l)})),I.apply(this,arguments)}function te(l){return $.apply(this,arguments)}function $(){return $=(0,h.Z)((0,i.Z)().mark(function l(s){return(0,i.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return console.log(s),n.abrupt("return",(0,x.WY)("/kitchen/api/goods-unit",{method:"DELETE",data:s}));case 2:case"end":return n.stop()}},l)})),$.apply(this,arguments)}function ne(l){return B.apply(this,arguments)}function B(){return B=(0,h.Z)((0,i.Z)().mark(function l(s){return(0,i.Z)().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,x.WY)("/kitchen/api/goods-unit/".concat(s),{method:"DELETE"}));case 1:case"end":return n.stop()}},l)})),B.apply(this,arguments)}var re=function(){var s=(0,y.useState)(!1),m=(0,F.Z)(s,2),n=m[0],C=m[1],ue=(0,y.useState)(!1),P=(0,F.Z)(ue,2),se=P[0],A=P[1],v=(0,y.useRef)(),ie=(0,y.useState)(),W=(0,F.Z)(ie,2),d=W[0],j=W[1],le=(0,y.useState)([]),M=(0,F.Z)(le,2),p=M[0],V=M[1];function oe(r){c.default.loading("\u6B63\u5728\u6DFB\u52A0");try{return _(JSON.stringify(r)),c.default.success("\u6DFB\u52A0\u6210\u529F"),v.current.reload(),!0}catch(a){return c.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function ce(r){try{return ee({id:r.id,name:r.name,status:r.status}).then(function(a){a.data?(c.default.success("\u4FEE\u6539\u6210\u529F"),v.current.reload()):c.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")}),!0}catch(a){return c.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),!1}}function de(){try{return te(p.map(function(r,a){return r.id})).then(function(r){r.data?c.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"):c.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}),v.current.reload(),!0}catch(r){c.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}}function fe(r){try{return ne(r).then(function(a){a.data?(c.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"),v.current.reload()):c.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}),!0}catch(a){c.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}}var Y=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0,render:function(a,u){return(0,t.jsx)("a",{onClick:function(){j(u),A(!0)},children:a})}},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea",ellipsis:!0},{title:"\u72B6\u6001",dataIndex:"status",hideInForm:!0,valueEnum:{0:{text:"\u6B63\u5E38",status:"Processing"},1:{text:"\u505C\u7528",status:"Success"}}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(a,u){return[(0,t.jsx)("a",{onClick:function(){C(!0),j(u)},children:"\u66F4\u65B0"},"config"),(0,t.jsx)(U.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){fe(u.id)},onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,t.jsxs)(K.ZP,{children:[(0,t.jsx)(b.ZP,{headerTitle:"\u5546\u54C1\u5355\u4F4D",actionRef:v,rowKey:"id",search:{labelWidth:120},columns:Y,toolBarRender:function(){return[(0,t.jsxs)(R.Z,{type:"primary",onClick:function(){C(!0),j({})},children:[(0,t.jsx)(J.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var r=(0,h.Z)((0,i.Z)().mark(function a(u){var o,T;return(0,i.Z)().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return o=[],T=0,S.next=4,q(u).then(function(L){o=L.data.data,o.forEach(function(G){G.status=G.status.toString()}),T=L.data.total});case 4:return S.abrupt("return",{data:o,success:!0,total:T});case 5:case"end":return S.stop()}},a)}));return function(a){return r.apply(this,arguments)}}(),rowSelection:{onChange:function(a,u){V(u)}}}),(p==null?void 0:p.length)>0&&(0,t.jsx)(N.Z,{extra:(0,t.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,t.jsx)("a",{style:{fontWeight:600},children:p.length})," ","\u9879 \xA0\xA0"]}),children:(0,t.jsx)(R.Z,{onClick:function(){var a,u;de(p),V([]),(a=v.current)===null||a===void 0||(u=a.reloadAndRest)===null||u===void 0||u.call(a)},type:"primary",children:"\u6279\u91CF\u5220\u9664"},"primary")}),(0,t.jsx)(X,{onFinish:function(){var r=(0,h.Z)((0,i.Z)().mark(function a(u){var o;return(0,i.Z)().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(o=!1,!u.id){f.next=7;break}return f.next=4,ce(u);case 4:o=f.sent,f.next=10;break;case 7:return f.next=9,oe(u);case 9:o=f.sent;case 10:o&&(C(!1),v.current&&v.current.reload());case 11:case"end":return f.stop()}},a)}));return function(a){return r.apply(this,arguments)}}(),onCancel:function(){j(void 0),C(!1)},createModalVisible:n,values:d||{}}),(0,t.jsx)(k.Z,{width:600,visible:se,onClose:function(){j(void 0),A(!1)},closable:!1,children:(d==null?void 0:d.name)&&(0,t.jsx)(z.ZP,{column:2,title:d==null?void 0:d.name,request:(0,h.Z)((0,i.Z)().mark(function r(){return(0,i.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",{data:d||{}});case 1:case"end":return u.stop()}},r)})),params:{id:d==null?void 0:d.name},columns:Y})})]})},ae=re}}]);