|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7227],{33489:function(ke,b,r){"use strict";r.r(b),r.d(b,{default:function(){return le}});var Be=r(71194),O=r(50146),$e=r(58996),H=r(77933),Te=r(62350),P=r(24565),De=r(57663),j=r(71577),s=r(39428),Ee=r(34792),h=r(48086),p=r(3182),y=r(2824),Q=r(49101),be=r(77883),X=r(85986),Oe=r(9715),g=r(55843),Pe=r(47673),R=r(4107),m=r(67294),u=r(85893),q=function(d){return(0,u.jsx)(O.Z,{title:d.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:d.goodsClassifyVisible,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){d.onCancel()},maskClosable:!1,destroyOnClose:!0,children:(0,u.jsxs)(g.Z,{labelCol:{span:4},layout:"horizontal",preserve:!1,initialValues:d.values,onFinish:d.onFinish,children:[(0,u.jsx)(g.Z.Item,{name:"id",hidden:!0,children:(0,u.jsx)(R.Z,{})}),(0,u.jsx)(g.Z.Item,{name:"name",label:"\u5206\u7C7B\u540D\u79F0",rules:[{required:!0,max:50}],children:(0,u.jsx)(R.Z,{})}),(0,u.jsx)(g.Z.Item,{name:"remark",label:"\u5907\u6CE8",children:(0,u.jsx)(R.Z,{})}),(0,u.jsx)(g.Z.Item,{name:"sort",label:"\u6392\u5E8F",children:(0,u.jsx)(X.Z,{})}),(0,u.jsxs)(g.Z.Item,{children:[(0,u.jsx)(j.Z,{htmlType:"button",style:{float:"right",left:10},onClick:d.onCancel,children:"\u53D6\u6D88"}),(0,u.jsx)(j.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},_=q,ee=r(28790),te=r(16894),Z=r(48971),C=r(96690);function ne(c){return x.apply(this,arguments)}function x(){return x=(0,p.Z)((0,s.Z)().mark(function c(d){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,Z.WY)((0,C.w)()+"/api/goodsClassify/getGoodsClassifyPage",{method:"POST",data:d}));case 1:case"end":return i.stop()}},c)})),x.apply(this,arguments)}function A(c){return k.apply(this,arguments)}function k(){return k=(0,p.Z)((0,s.Z)().mark(function c(d){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,Z.WY)((0,C.w)()+"/api/goodsClassify/updateGoodsClassify",{method:"POST",data:d}));case 1:case"end":return i.stop()}},c)})),k.apply(this,arguments)}function W(c){return B.apply(this,arguments)}function B(){return B=(0,p.Z)((0,s.Z)().mark(function c(d){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,Z.WY)((0,C.w)()+"/api/goodsClassify/deleteGoodsClassify?ids=".concat(d),{method:"Get"}));case 1:case"end":return i.stop()}},c)})),B.apply(this,arguments)}function ae(){return $.apply(this,arguments)}function $(){return $=(0,p.Z)((0,s.Z)().mark(function c(){return(0,s.Z)().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.abrupt("return",(0,Z.WY)((0,C.w)()+"/api/goods/getgoodslist",{method:"Get"}));case 1:case"end":return v.stop()}},c)})),$.apply(this,arguments)}function re(c){return T.apply(this,arguments)}function T(){return T=(0,p.Z)((0,s.Z)().mark(function c(d){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,Z.WY)((0,C.w)()+"/api/goodsClassify/getRelation?classifyId=".concat(d),{method:"Get"}));case 1:case"end":return i.stop()}},c)})),T.apply(this,arguments)}function se(c){return D.apply(this,arguments)}function D(){return D=(0,p.Z)((0,s.Z)().mark(function c(d){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,Z.WY)((0,C.w)()+"/api/goodsClassify/setRelation",{method:"POST",data:d}));case 1:case"end":return i.stop()}},c)})),D.apply(this,arguments)}var ue=function(){var d=(0,m.useState)(!1),v=(0,y.Z)(d,2),i=v[0],I=v[1],S=(0,m.useRef)(),ie=(0,m.useState)(),Y=(0,y.Z)(ie,2),oe=Y[0],F=Y[1],de=(0,m.useState)([]),M=(0,y.Z)(de,2),G=M[0],V=M[1],ce=(0,m.useState)([]),K=(0,y.Z)(ce,2),L=K[0],N=K[1],fe=(0,m.useState)(!1),z=(0,y.Z)(fe,2),he=z[0],E=z[1],pe=(0,m.useState)([]),J=(0,y.Z)(pe,2),ve=J[0],me=J[1],ye=(0,m.useState)([]),U=(0,y.Z)(ye,2),ge=U[0],Ze=U[1];(0,m.useEffect)(function(){ae().then(function(l){var n=l.data,t=[];n.forEach(function(a){t.push({key:a.id,title:a.name,description:a.name})}),me(t)})},[]);var Ce=function(){var l=(0,p.Z)((0,s.Z)().mark(function n(t){var a;return(0,s.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=h.default.loading("\u6B63\u5728\u6DFB\u52A0"),e.prev=1,e.next=4,A(JSON.stringify(t)).then(function(o){o.succeeded?h.default.success("\u6DFB\u52A0\u6210\u529F"):h.default.error(o.errors)});case 4:return a(),e.abrupt("return",!0);case 8:return e.prev=8,e.t0=e.catch(1),a(),h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 13:case"end":return e.stop()}},n,null,[[1,8]])}));return function(t){return l.apply(this,arguments)}}(),Se=function(){var l=(0,p.Z)((0,s.Z)().mark(function n(t){var a;return(0,s.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=h.default.loading("\u6B63\u5728\u4FEE\u6539"),e.prev=1,e.next=4,A(JSON.stringify(t)).then(function(o){o.succeeded?h.default.success("\u4FEE\u6539\u6210\u529F"):h.default.error(o.errors)});case 4:return a(),e.abrupt("return",!0);case 8:return e.prev=8,e.t0=e.catch(1),a(),h.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),e.abrupt("return",!1);case 13:case"end":return e.stop()}},n,null,[[1,8]])}));return function(t){return l.apply(this,arguments)}}(),we=function(){return(G==null?void 0:G.length)>0&&(0,u.jsx)(P.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417?",onConfirm:je,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,u.jsx)(j.Z,{type:"primary",children:"\u6279\u91CF\u5220\u9664"})})},je=function(){var n,t;Ie(G),V([]),(n=S.current)===null||n===void 0||(t=n.reloadAndRest)===null||t===void 0||t.call(n)},Ie=function(){var l=(0,p.Z)((0,s.Z)().mark(function n(t){return(0,s.Z)().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(t){f.next=2;break}return f.abrupt("return",!0);case 2:return f.next=4,W(t.map(function(e){return e.id})).then(function(e){e.succeeded?(h.default.success("\u5220\u9664\u6210\u529F"),S.current.reload()):h.default.error(e.errors)});case 4:return f.abrupt("return",!0);case 5:case"end":return f.stop()}},n)}));return function(t){return l.apply(this,arguments)}}(),Fe=function(){var l=(0,p.Z)((0,s.Z)().mark(function n(){var t,a;return(0,s.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=[],L.forEach(function(o,w,Ae){t.push({goodsId:o})}),a={classifyId:ge,goodsIdList:t},se(a).then(function(o){console.log(o),o.succeeded?h.default.success("\u7F16\u8F91\u6210\u529F"):h.default.error(o.errors)}),E(!1),S.current.reload();case 6:case"end":return e.stop()}},n)}));return function(){return l.apply(this,arguments)}}(),Ge=function(){var l=(0,p.Z)((0,s.Z)().mark(function n(t){var a;return(0,s.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=[],re(t).then(function(o){o.data.forEach(function(w){a.push(w.goodsId)}),N(a)});case 2:case"end":return e.stop()}},n)}));return function(t){return l.apply(this,arguments)}}(),Re=function(n){N(n)},xe=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(n,t){return(0,u.jsx)("a",{onClick:function(){F(t)},children:n})}},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea",ellipsis:!0},{title:"\u5907\u6CE8",dataIndex:"remark",ellipsis:!0,hideInForm:!0,hideInSearch:!0},{title:"\u6392\u5E8F",dataIndex:"sort",hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(n,t){return[(0,u.jsx)("a",{onClick:function(){I(!0),F(t)},children:"\u66F4\u65B0"},"config"),(0,u.jsx)(P.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,p.Z)((0,s.Z)().mark(function a(){return(0,s.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W(t.id).then(function(o){o.succeeded?(h.default.success("\u5220\u9664\u6210\u529F"),S.current.reload()):h.default.error(o.errors)});case 2:case"end":return e.stop()}},a)})),onCancel:function(){},children:(0,u.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary"),(0,u.jsx)("a",{onClick:function(){Ge(t.id),Ze(t.id),E(!0)},children:"\u8BBE\u7F6E\u8BBE\u5907\u5546\u54C1"},"edit")]}}];return(0,u.jsxs)(ee.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,u.jsx)(te.ZP,{headerTitle:"",actionRef:S,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,u.jsxs)(j.Z,{type:"primary",onClick:function(){I(!0)},children:[(0,u.jsx)(Q.Z,{})," \u65B0\u5EFA"]},"primary"),(0,u.jsx)(we,{})]},request:function(){var l=(0,p.Z)((0,s.Z)().mark(function n(t){var a,f;return(0,s.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return a=[],f=0,o.next=4,ne(t).then(function(w){a=w.data.data,f=w.data.total});case 4:return o.abrupt("return",{data:a,success:!0,total:f});case 5:case"end":return o.stop()}},n)}));return function(n){return l.apply(this,arguments)}}(),columns:xe,rowSelection:{onChange:function(n,t){V(t)}}}),(0,u.jsx)(_,{onFinish:function(){var l=(0,p.Z)((0,s.Z)().mark(function n(t){var a;return(0,s.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=!1,!t.id){e.next=7;break}return e.next=4,Se(t);case 4:a=e.sent,e.next=10;break;case 7:return e.next=9,Ce(t);case 9:a=e.sent;case 10:a&&(I(!1),F(void 0),S.current.reload());case 11:case"end":return e.stop()}},n)}));return function(n){return l.apply(this,arguments)}}(),onCancel:function(){I(!1),F(void 0)},goodsClassifyVisible:i,values:oe||{}},Date.now()),(0,u.jsx)(O.Z,{width:600,title:"\u7F16\u8F91\u8BBE\u5907\u5546\u54C1",open:he,destroyOnClose:!0,onOk:function(){Fe()},onCancel:function(){E(!1)},children:(0,u.jsx)(H.Z,{className:"tree-transfer",listStyle:{width:250,height:300},dataSource:ve,targetKeys:L,onChange:Re,onSearch:function(){},render:function(n){return n.title}})})]})},le=ue}}]);
|