|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[425],{33770:function(me,O,e){"use strict";e.r(O),e.d(O,{default:function(){return ue}});var ve=e(57338),U=e(25084),h=e(3182),pe=e(57663),E=e(71577),ye=e(62350),k=e(75443),ge=e(34792),c=e(48086),F=e(2824),J=e(94043),l=e.n(J),K=e(49101),y=e(67294),N=e(78009),z=e(85224),H=e(16894),Q=e(12826),xe=e(71194),X=e(50146),Ce=e(9715),g=e(86835),Ze=e(47673),P=e(4107),je=e(43358),x=e(34041),t=e(85893),b=function(s){var m=x.Z.Option,n=x.Z.OptGroup;return(0,t.jsx)(X.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)(g.Z,{layout:"vertical",preserve:!1,initialValues:s.values,onFinish:s.onFinish,children:[(0,t.jsx)(g.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(P.Z,{})}),(0,t.jsx)(g.Z.Item,{name:"name",label:"\u5546\u54C1\u5355\u4F4D\u540D\u79F0",rules:[{required:!0,max:64}],children:(0,t.jsx)(P.Z,{placeholder:"\u5546\u54C1\u5355\u4F4D\u540D\u79F0"})}),(0,t.jsx)(g.Z.Item,{name:"status",label:"\u72B6\u6001",defaultValue:s.values.status,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001"}],children:(0,t.jsx)(x.Z,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",children:(0,t.jsxs)(n,{children:[(0,t.jsx)(x.Z.Option,{value:"0",children:"\u6B63\u5E38"}),(0,t.jsx)(x.Z.Option,{value:"1",children:"\u505C\u7528"})]})})}),(0,t.jsx)(g.Z.Item,{children:(0,t.jsx)(E.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},q=b,C=e(48971);function _(i){return R.apply(this,arguments)}function R(){return R=(0,h.Z)(l().mark(function i(s){return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,C.WY)("/kitchen/api/goods-unit/type",{method:"Post",data:s}));case 1:case"end":return n.stop()}},i)})),R.apply(this,arguments)}function ee(i){return D.apply(this,arguments)}function D(){return D=(0,h.Z)(l().mark(function i(s){return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,C.WY)("/kitchen/api/goods-unit",{method:"POST",data:s}));case 1:case"end":return n.stop()}},i)})),D.apply(this,arguments)}function te(i){return I.apply(this,arguments)}function I(){return I=(0,h.Z)(l().mark(function i(s){return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,C.WY)("/kitchen/api/goods-unit",{method:"PUT",data:s}));case 1:case"end":return n.stop()}},i)})),I.apply(this,arguments)}function ne(i){return $.apply(this,arguments)}function $(){return $=(0,h.Z)(l().mark(function i(s){return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return console.log(s),n.abrupt("return",(0,C.WY)("/kitchen/api/goods-unit",{method:"DELETE",data:s}));case 2:case"end":return n.stop()}},i)})),$.apply(this,arguments)}function re(i){return B.apply(this,arguments)}function B(){return B=(0,h.Z)(l().mark(function i(s){return l().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",(0,C.WY)("/kitchen/api/goods-unit/".concat(s),{method:"DELETE"}));case 1:case"end":return n.stop()}},i)})),B.apply(this,arguments)}var ae=function(){var s=(0,y.useState)(!1),m=(0,F.Z)(s,2),n=m[0],Z=m[1],se=(0,y.useState)(!1),w=(0,F.Z)(se,2),le=w[0],A=w[1],v=(0,y.useRef)(),ie=(0,y.useState)(),W=(0,F.Z)(ie,2),d=W[0],j=W[1],oe=(0,y.useState)([]),M=(0,F.Z)(oe,2),p=M[0],V=M[1];function ce(r){c.default.loading("\u6B63\u5728\u6DFB\u52A0");try{return ee(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 de(r){try{return te({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 fe(){try{return ne(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 he(r){try{return re(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(){Z(!0),j(u)},children:"\u66F4\u65B0"},"config"),(0,t.jsx)(k.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){he(u.id)},onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,t.jsxs)(N.ZP,{children:[(0,t.jsx)(H.ZP,{headerTitle:"\u5546\u54C1\u5355\u4F4D",actionRef:v,rowKey:"id",search:{labelWidth:120},columns:Y,toolBarRender:function(){return[(0,t.jsxs)(E.Z,{type:"primary",onClick:function(){Z(!0),j({})},children:[(0,t.jsx)(K.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var r=(0,h.Z)(l().mark(function a(u){var o,T;return l().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return o=[],T=0,S.next=4,_(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)(z.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)(E.Z,{onClick:function(){var a,u;fe(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)(q,{onFinish:function(){var r=(0,h.Z)(l().mark(function a(u){var o;return l().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(o=!1,!u.id){f.next=7;break}return f.next=4,de(u);case 4:o=f.sent,f.next=10;break;case 7:return f.next=9,ce(u);case 9:o=f.sent;case 10:o&&(Z(!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),Z(!1)},createModalVisible:n,values:d||{}}),(0,t.jsx)(U.Z,{width:600,visible:le,onClose:function(){j(void 0),A(!1)},closable:!1,children:(d==null?void 0:d.name)&&(0,t.jsx)(Q.ZP,{column:2,title:d==null?void 0:d.name,request:(0,h.Z)(l().mark(function r(){return l().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})})]})},ue=ae}}]);
|