|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[2324],{40919:function(Le,K,n){"use strict";n.r(K),n.d(K,{default:function(){return pe}});var We=n(58024),te=n(91894),Ge=n(57663),E=n(71577),Ye=n(77883),ae=n(85986),Ke=n(88983),O=n(47933),Oe=n(71153),re=n(60331),ne=n(86582),ze=n(62350),ue=n(24565),c=n(39428),Me=n(34792),p=n(48086),m=n(3182),y=n(2824),se=n(6700),g=n(67294),ie=n(28790),le=n(85224),oe=n(16894),C=n(48971),x=n(96690);function de(h){return w.apply(this,arguments)}function w(){return w=(0,m.Z)((0,c.Z)().mark(function h(v){return(0,c.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,C.WY)((0,x.w)()+"/api/goodsattributeprice/getpage",{method:"POST",data:v}));case 1:case"end":return u.stop()}},h)})),w.apply(this,arguments)}function ce(h){return A.apply(this,arguments)}function A(){return A=(0,m.Z)((0,c.Z)().mark(function h(v){return(0,c.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,C.WY)((0,x.w)()+"/api/goodsattributeprice/add",{method:"POST",data:v}));case 1:case"end":return u.stop()}},h)})),A.apply(this,arguments)}function fe(h){return R.apply(this,arguments)}function R(){return R=(0,m.Z)((0,c.Z)().mark(function h(v){return(0,c.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,C.WY)((0,x.w)()+"/api/goodsattributeprice/update",{method:"POST",data:v}));case 1:case"end":return u.stop()}},h)})),R.apply(this,arguments)}function z(h){return D.apply(this,arguments)}function D(){return D=(0,m.Z)((0,c.Z)().mark(function h(v){return(0,c.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,C.WY)((0,x.w)()+"/api/goodsattributeprice/delete?id="+v,{method:"GET"}));case 1:case"end":return u.stop()}},h)})),D.apply(this,arguments)}function he(h){return T.apply(this,arguments)}function T(){return T=(0,m.Z)((0,c.Z)().mark(function h(v){return(0,c.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,C.WY)((0,x.w)()+"/api/goodsattribute/getbygoodsidattribute?id="+v,{method:"Get"}));case 1:case"end":return u.stop()}},h)})),T.apply(this,arguments)}var t=n(85893),ve=function(v){var b=(0,g.useState)(!1),u=(0,y.Z)(b,2),Ne=u[0],He=u[1],ge=(0,g.useState)([]),M=(0,y.Z)(ge,2),me=M[0],ye=M[1],Ze=(0,g.useState)(""),N=(0,y.Z)(Ze,2),Ce=N[0],V=N[1],Se=(0,g.useState)([]),H=(0,y.Z)(Se,2),$=H[0],I=H[1],j=(0,g.useRef)(),be=(0,g.useState)(),J=(0,y.Z)(be,2),Je=J[0],je=J[1],xe=(0,g.useState)([]),Q=(0,y.Z)(xe,2),F=Q[0],U=Q[1],Fe=(0,g.useState)(0),X=(0,y.Z)(Fe,2),k=X[0],P=X[1],Ee=(0,g.useState)([]),q=(0,y.Z)(Ee,2),S=q[0],B=q[1],we=(0,g.useState)([]),_=(0,y.Z)(we,2),Qe=_[0],Ae=_[1];(0,g.useEffect)(function(){Re()},[]);function Re(){he(v.location.query.values.id).then(function(s){s.data&&s.data.length>0&&B(s.data)})}var De=function(){var s=(0,m.Z)((0,c.Z)().mark(function a(e){var i;return(0,c.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(i=p.default.loading("\u6B63\u5728\u5220\u9664"),e){o.next=3;break}return o.abrupt("return",!0);case 3:return o.next=5,z(e.map(function(d){return d.id})).then(function(d){d.succeeded?(p.default.success("\u5220\u9664\u6210\u529F"),j.current.reload()):p.default.error(d.errors)});case 5:return i(),o.abrupt("return",!0);case 7:case"end":return o.stop()}},a)}));return function(e){return s.apply(this,arguments)}}(),Te=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(a,e){return(0,t.jsx)("a",{onClick:function(){je(e),setShowDetail(!0)},children:a})}},{title:"\u5C5E\u6027",dataIndex:"goodsattributeValue",valueType:"textarea",ellipsis:!0,readonly:!0},{title:"\u4EF7\u683C",dataIndex:"price",hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(a,e,i,l){return[(0,t.jsx)("a",{onClick:function(){var d;l==null||(d=l.startEditable)===null||d===void 0||d.call(l,e.id)},children:"\u66F4\u65B0"},"config"),(0,t.jsx)(ue.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,m.Z)((0,c.Z)().mark(function o(){return(0,c.Z)().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,z([e.id]).then(function(Z){Z.succeeded?(p.default.success("\u5220\u9664\u6210\u529F"),j.current.reload()):p.default.error(Z.errors)});case 2:case"end":return f.stop()}},o)})),onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],Ve=function(a){for(var e=a.target,i=e.name,l=e.value,o="",d=(0,ne.Z)($),f=0;f<S.length;f++)i==="radiogroup"+f&&(d[f]=l);S.forEach(function(Z){for(var Pe=function(ee){var Y;W=(Y=Z.goodsAttributeValueList.find(function(Be){return Be.goodsAttributeValuId==d[ee]}))===null||Y===void 0?void 0:Y.attributeValue,W&&(o=o+W,ee<d.length-1&&(o=o+"-"))},L=0;L<d.length;L++){var W;Pe(L)}Z.goodsAttributeValueList.forEach(function(G){l==G.goodsAttributeValuId&&(G.check=!0,Z.defalutvalue=l)})}),V(o),I(d)},$e=function(a){P(a)},Ie=function(){var a=!0;if($.length==0?(a=!1,p.default.error("\u8BF7\u9009\u62E9\u5C5E\u6027")):k<=0&&(a=!1,p.default.error("\u4EF7\u683C\u4E0D\u80FD\u5C0F\u4E8E0")),a){var e={goodsId:v.location.query.values.id,goodsattributeValueId:$.join(","),Price:k,goodsattributeValue:Ce};ce(e).then(function(i){if(i.succeeded){p.default.success("\u4FDD\u5B58\u6210\u529F"),j.current.reload(),I([]),V(""),P(0);var l=S.map(function(o){return o.goodsAttributeValueList.forEach(function(d){d.check=!1,o.defalutvalue=""}),o});B(l)}else p.default.error(i.errors)})}},ke=function(){I([]),V(""),P(0);var a=S.map(function(e){return e.goodsAttributeValueList.forEach(function(i){i.check=!1,e.defalutvalue=""}),e});B(a)};return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(ie.ZP,{host:!0,header:{title:[(0,t.jsxs)("a",{onClick:function(){C.m8.push({pathname:"/database/goods/newgoods"})},children:[(0,t.jsx)(se.Z,{}),"\u8FD4\u56DE"]},"back")],breadcrumb:{}},children:[(0,t.jsxs)(te.Z,{children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u5546\u54C1\u5C5E\u6027"]}),S==null||S.length==0?(0,t.jsxs)("div",{style:{fontSize:"12px",marginLeft:10},children:["\u5F53\u524D\u5546\u54C1\u7684\u5DE5\u827A\u5206\u7C7B\u8FD8\u672A\u914D\u7F6E\u5C5E\u6027\u70B9\u51FB\u8DF3\u8F6C ",(0,t.jsx)("a",{type:"primary",onClick:function(){C.m8.push({pathname:"/database/goods/goodstypemanage"})},children:"\u6DFB\u52A0\u5C5E\u6027"},"primary")]}):S.map(function(s,a){return(0,t.jsx)("div",{style:{marginLeft:80,marginBottom:10},children:(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{style:{marginRight:10},children:[" ",(0,t.jsx)(re.Z,{color:"blue",children:s.attributeName}),"\uFF1A"]}),(0,t.jsx)("span",{children:(0,t.jsx)(O.ZP.Group,{name:"radiogroup"+a,buttonStyle:"solid",size:"small",value:s.defalutvalue,onChange:Ve,children:s.goodsAttributeValueList.map(function(e,i){return(0,t.jsx)(O.ZP.Button,{name:i,defaultChecked:e.check,checked:e.check,value:e.goodsAttributeValuId,style:{marginRight:22,marginTop:16},children:e.attributeValue})})})})]})})}),(0,t.jsxs)("div",{style:{marginTop:10},children:[(0,t.jsxs)("span",{style:{marginRight:"3%"},children:[(0,t.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u4EF7\u683C:"]}),(0,t.jsx)(ae.Z,{value:k,style:{width:"20%"},onChange:$e,placeholder:"\u8BF7\u8F93\u5165\u4EF7\u683C"})]}),(0,t.jsxs)("div",{style:{float:"right",position:"absolute",top:"70%",left:"88%",width:"200px"},children:[(0,t.jsx)(E.Z,{htmlType:"submit",style:{marginRight:"2%"},onClick:ke,children:" \u91CD\u7F6E"}),(0,t.jsx)(E.Z,{type:"primary",htmlType:"submit",onClick:Ie,children:"\u4FDD\u5B58"})]})]}),(0,t.jsx)(oe.ZP,{headerTitle:"\u5C5E\u6027\u4EF7\u683C\u5217\u8868",actionRef:j,rowKey:"id",pagination:{defaultPageSize:10},search:!1,recordCreatorProps:!1,request:function(){var s=(0,m.Z)((0,c.Z)().mark(function a(e){var i,l;return(0,c.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return i=[],e.goodsId=v.location.query.values.id,l=0,d.next=5,de(e).then(function(f){i=f.data.data,l=f.data.total});case 5:return d.abrupt("return",{data:i,success:!0,total:l});case 6:case"end":return d.stop()}},a)}));return function(a){return s.apply(this,arguments)}}(),columns:Te,onChange:Ae,editable:{type:"multiple",editableKeys:me,actionRender:function(a,e,i){return[i.save,i.cancel]},onSave:function(){var s=(0,m.Z)((0,c.Z)().mark(function e(i,l,o){return(0,c.Z)().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:console.log(i,l,o),fe(l).then(function(Z){Z.succeeded?(p.default.success("\u4FDD\u5B58\u6210\u529F"),j.current.reload()):p.default.error(r.errors)});case 2:case"end":return f.stop()}},e)}));function a(e,i,l){return s.apply(this,arguments)}return a}(),onChange:ye},rowSelection:{onChange:function(a,e){U(e)}}}),(F==null?void 0:F.length)>0&&(0,t.jsx)(le.Z,{extra:(0,t.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,t.jsx)("a",{style:{fontWeight:600},children:F.length})," ","\u9879 \xA0\xA0"]}),children:(0,t.jsx)(E.Z,{onClick:(0,m.Z)((0,c.Z)().mark(function s(){var a,e;return(0,c.Z)().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,De(F);case 2:U([]),(a=j.current)===null||a===void 0||(e=a.reloadAndRest)===null||e===void 0||e.call(a);case 4:case"end":return l.stop()}},s)})),children:"\u5220\u9664"})})]})})},pe=ve}}]);
|