(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7985],{55478:function(ot,ue,a){"use strict";a.r(ue),a.d(ue,{default:function(){return mt}});var De=a(20228),p=a(11382),D=a(57338),E=a(273),F=a(71194),se=a(50146),le=a(43358),oe=a(34041),R=a(11849),it=a(22385),W=a(45777),dt=a(43185),G=a(93009),Oe=a(62350),M=a(24565),Le=a(57663),S=a(71577),g=a(39428),ie=a(34792),v=a(48086),j=a(3182),Z=a(2824),N=a(49101),de=a(90631),Y=a(1870),ce=a(84391),f=a(67294),We=a(28790),J=a(16894),Fe=a(12826),O=a(48971),Me=a(77576),Q=a(12028),Ne=a(77883),X=a(85986),Ye=a(49111),q=a(19650),Ke=a(48736),_=a(27049),He=a(62999),ee=a(54680),ze=a(9715),x=a(55843),Ve=a(47673),U=a(4107),s=a(73171),l=a(82539),c=a(19755),n=a.n(c),r=a(85893),ct=U.Z.TextArea,pt=function(B){var pe=(0,f.useState)(),he=(0,Z.Z)(pe,2),Xe=he[0],Te=he[1],fe=(0,f.useState)([]),me=(0,Z.Z)(fe,2),K=me[0],Be=me[1],ge=(0,f.useState)(),ve=(0,Z.Z)(ge,2),ye=ve[0],I=ve[1],Ie=(0,f.useRef)(),Ze=(0,f.useState)(""),T=(0,Z.Z)(Ze,2),$=T[0],Ce=T[1],we=(0,f.useState)(B.values?B.values.imgUrl:null),L=(0,Z.Z)(we,2),te=L[0],H=L[1],Se=(0,f.useState)(!1),be=(0,Z.Z)(Se,2),ne=be[0],Ee=be[1];(0,f.useEffect)(function(){re(),Ae(),B.values?H(B.values.imgUrl):H(null)},[B.values]);function re(){(0,l.d9)().then(function(C){var m=[];C.data.length>0&&C.data.forEach(function(y){m.push({text:y.name,value:y.id,label:y.name})}),console.log("list",m),Be(m)})}function Ae(){(0,l.wm)().then(function(C){Te(C.data)})}var k=function(m){Ce(m.target.value)},Re=function(m){if(m.preventDefault(),$.length==0)v.default.error("\u8BF7\u8F93\u5165\u540D\u79F0");else{var y={name:$};(0,l.Gw)(y).then(function(h){h.succeeded?(v.default.success("\u6DFB\u52A0\u6210\u529F"),re(),Ce("")):v.default.error(h.errors)})}},je=function(m){I(m)},Ge=function(m,y){var h;return((h=y==null?void 0:y.title)!==null&&h!==void 0?h:"").toLowerCase().includes(m.toLowerCase())},ae={customRequest:function(m){var y=m.file;(0,l.HC)({directory:"hkerp/test/goods",buildUniqueDirectory:!1}).then(function(h){if(h.success_Action_Status==200){var b=new FormData;b.append("name",y.name),b.append("key",h.key),b.append("ossAccessKeyId",h.ossAccessKeyId),b.append("policy",h.policy),b.append("signature",h.signature),b.append("file",y),b.append("success_Action_Status",200),b.append("host",h.host),n().ajax({url:h.host,type:"POST",data:b,cache:!1,contentType:!1,processData:!1,success:function(xe){H(h.host+"/"+h.key.replace("${filename}",y.name))},error:function(xe){console.log(xe)}})}})}},Ue=function(){H(null)};return(0,r.jsx)(se.Z,{title:B.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:B.createModalVisible,bodyStyle:{padding:"32px 40px 1px 48px"},footer:null,onCancel:function(){B.onCancel()},maskClosable:!1,destroyOnClose:!0,children:(0,r.jsxs)(x.Z,{labelCol:{span:4},layout:"horizontal",preserve:!1,initialValues:B.values,onFinish:B.onFinish,children:[(0,r.jsx)(x.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(U.Z,{})}),(0,r.jsx)(x.Z.Item,{name:"goodsTypeId",label:"\u5546\u54C1\u5206\u7C7B",rules:[{required:!0}],children:(0,r.jsx)(ee.Z,{allowClear:!0,showSearch:!0,style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:Xe,onChange:je,filterTreeNode:Ge,value:ye,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u7C7B\u578B",treeDefaultExpandAll:!0})}),(0,r.jsx)(x.Z.Item,{name:"name",label:"\u5546\u54C1\u540D\u79F0",rules:[{required:!0}],children:(0,r.jsx)(U.Z,{})}),(0,r.jsx)(x.Z.Item,{name:"goodsUintId",label:"\u5546\u54C1\u5355\u4F4D",rules:[{required:!0}],children:(0,r.jsx)(oe.Z,{style:{width:"100%"},placeholder:"\u8BF7\u9009\u62E9\u5355\u4F4D",showSearch:!0,allowClear:!0,options:K,optionFilterProp:"children",filterOption:function(m,y){var h;return((h=y==null?void 0:y.label)!==null&&h!==void 0?h:"").includes(m)},filterSort:function(m,y){var h,b;return((h=m==null?void 0:m.label)!==null&&h!==void 0?h:"").toLowerCase().localeCompare(((b=y==null?void 0:y.label)!==null&&b!==void 0?b:"").toLowerCase())},dropdownRender:function(m){return(0,r.jsxs)(r.Fragment,{children:[m,(0,r.jsx)(_.Z,{style:{margin:"8px 0"}}),(0,r.jsxs)(q.Z,{style:{padding:"0 8px 4px"},children:[(0,r.jsx)(U.Z,{placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D",ref:Ie,value:$,onChange:k,onKeyDown:function(h){return h.stopPropagation()}}),(0,r.jsx)(S.Z,{type:"text",icon:(0,r.jsx)(N.Z,{}),onClick:Re,children:"\u65B0\u589E"})]})]})}})}),(0,r.jsx)(x.Z.Item,{name:"price",label:"\u5546\u54C1\u4EF7\u683C",rules:[{required:!0}],children:(0,r.jsx)(X.Z,{style:{width:"100%"},placeholder:"\u4EF7\u683C",min:0})}),(0,r.jsx)(x.Z.Item,{name:"isWeigh",label:"\u662F\u5426\u79F0\u91CD",valuePropName:"checked",children:(0,r.jsx)(Q.Z,{checkedChildren:"\u662F",unCheckedChildren:"\u5426",defaultChecked:!1})}),(0,r.jsx)(x.Z.Item,{name:"descritption",label:"\u5907\u6CE8",children:(0,r.jsx)(ct,{rows:4})}),(0,r.jsx)(x.Z.Item,{name:"imgUrl",hidden:!0,children:(0,r.jsx)(U.Z,{})}),(0,r.jsx)(x.Z.Item,{name:"imgUrl1",label:"\u5546\u54C1\u56FE\u7247",children:(0,r.jsx)(G.Z,(0,R.Z)((0,R.Z)({},ae),{},{showUploadList:!1,children:(0,r.jsx)("div",{style:{position:"relative",display:"inline-block",cursor:"pointer"},onMouseEnter:function(){return Ee(!0)},onMouseLeave:function(){return Ee(!1)},children:te?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("img",{src:te,alt:"",style:{maxWidth:"100%",maxHeight:"150px",height:"auto",borderRadius:"4px",transition:"opacity 0.3s ease",opacity:ne?.5:1,backgroundColor:ne?"rgba(0, 0, 0, 0.5)":"transparent"}}),ne&&(0,r.jsx)(S.Z,{type:"link",danger:!0,onClick:function(m){m.stopPropagation(),Ue()},icon:(0,r.jsx)(s.Z,{}),style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}})]}):(0,r.jsx)(S.Z,{icon:(0,r.jsx)(ce.Z,{}),children:"\u4E0A\u4F20"})})}))}),(0,r.jsxs)(x.Z.Item,{children:[(0,r.jsx)(S.Z,{htmlType:"button",style:{float:"right",left:10},onClick:B.onCancel,children:"\u53D6\u6D88"}),(0,r.jsx)(S.Z,{type:"primary",htmlType:"submit",style:{float:"right"},children:"\u4FDD\u5B58"})]})]})})},ht=pt,Je=a(96690),Qe="https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods/",ft=function(){var B=(0,f.useState)([]),pe=(0,Z.Z)(B,2),he=pe[0],Xe=pe[1],Te=(0,f.useState)(!1),fe=(0,Z.Z)(Te,2),me=fe[0],K=fe[1],Be=(0,f.useState)(!1),ge=(0,Z.Z)(Be,2),ve=ge[0],ye=ge[1],I=(0,f.useRef)(),Ie=(0,f.useState)(),Ze=(0,Z.Z)(Ie,2),T=Ze[0],$=Ze[1],Ce=(0,f.useState)([]),we=(0,Z.Z)(Ce,2),L=we[0],te=we[1],H=(0,f.useState)(),Se=(0,Z.Z)(H,2),be=Se[0],ne=Se[1],Ee=(0,f.useState)(!1),re=(0,Z.Z)(Ee,2),Ae=re[0],k=re[1],Re=(0,f.useState)(!1),je=(0,Z.Z)(Re,2),Ge=je[0],ae=je[1],Ue=(0,f.useState)([]),C=(0,Z.Z)(Ue,2),m=C[0],y=C[1],h=(0,f.useState)([]),b=(0,Z.Z)(h,2),$e=b[0],xe=b[1],vt=(0,f.useState)(""),qe=(0,Z.Z)(vt,2),_e=qe[0],Pe=qe[1],yt=(0,f.useState)(""),et=(0,Z.Z)(yt,2),Zt=et[0],ke=et[1],Ct=(0,f.useState)([]),tt=(0,Z.Z)(Ct,2),wt=tt[0],nt=tt[1];(0,f.useEffect)(function(){(0,l.FM)().then(function(i){ne(i.data)}),St(),rt()},[]);var St=function(){(0,l.bn)().then(function(t){var e=t.data;if(t.succeeded){var u=[];e.forEach(function(o){u.push({value:o.id,label:o.deviceName})}),y(u)}})},rt=function(){(0,l.Dz)().then(function(t){var e=t.data;if(t.succeeded){var u=[];e.forEach(function(o){u.push({value:o.id,label:o.name})}),xe(u)}})},bt=function(){var i=(0,j.Z)((0,g.Z)().mark(function t(e){return(0,g.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return e.createBy="admin",e.isAttrubute=!0,e.ImgUrl=e.imgUrl1?Qe+e.imgUrl1.file.name:null,o.next=5,(0,l.Rq)(JSON.stringify(e)).then(function(d){d.succeeded?(v.default.success("\u6DFB\u52A0\u6210\u529F"),I.current.reload()):v.default.error(d.errors)});case 5:return o.abrupt("return",!0);case 6:case"end":return o.stop()}},t)}));return function(e){return i.apply(this,arguments)}}(),Et=function(){var i=(0,j.Z)((0,g.Z)().mark(function t(e){var u;return(0,g.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return u=v.default.loading("\u6B63\u5728\u4FEE\u6539"),d.prev=1,d.next=4,(0,l.e3)({id:e.id,goodsTypeId:e.goodsTypeId,name:e.name,goodsUintId:e.goodsUintId,price:e.price,isWeigh:e.isWeigh,descritption:e.descritption,imgUrl:e.imgUrl1?Qe+e.imgUrl1.file.name:null}).then(function(A){A.succeeded?(v.default.success("\u4FEE\u6539\u6210\u529F"),I.current.reload()):v.default.error(A.errors)});case 4:return u(),d.abrupt("return",!0);case 8:return d.prev=8,d.t0=d.catch(1),u(),v.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),d.abrupt("return",!1);case 13:case"end":return d.stop()}},t,null,[[1,8]])}));return function(e){return i.apply(this,arguments)}}(),jt=function(){return(L==null?void 0:L.length)>0&&(0,r.jsx)(M.Z,{title:"\u786E\u8BA4\u5220\u9664\u5417?",onConfirm:xt,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,r.jsx)(S.Z,{type:"primary",children:"\u6279\u91CF\u5220\u9664"})})},xt=function(){var t,e;Dt(L),te([]),(t=I.current)===null||t===void 0||(e=t.reloadAndRest)===null||e===void 0||e.call(t)},at=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(t,e){return(0,r.jsx)("a",{onClick:function(){$(e),ye(!0)},children:t})}},{title:"\u56FE\u7247\u5730\u5740",dataIndex:"imgUrl",hideInTable:!0,hideInSearch:!0},{title:"\u540D\u79F0",dataIndex:"name",valueType:"textarea"},{title:"\u5546\u54C1\u4EF7\u683C",dataIndex:"price",hideInForm:!0,renderText:function(t){return"".concat(t,"\xA5")},hideInSearch:!0},{title:"\u5546\u54C1\u7C7B\u578B",dataIndex:"goodsTypeName",valueType:"treeSelect",fieldProps:{showSearch:!0,allowClear:!0,options:be}},{title:"\u5907\u6CE8",dataIndex:"descritption",ellipsis:!0,tip:"\u6807\u9898\u8FC7\u957F\u4F1A\u81EA\u52A8\u6536\u7F29"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:350,render:function(t,e){return[(0,r.jsx)("a",{type:"primary",onClick:function(){K(!0),$(e)},children:"\u66F4\u65B0"},"primary"),(0,r.jsx)("a",{type:"primary",onClick:function(){O.m8.push({pathname:"/database/goods/goodsbom",query:{isAdd:!1,values:e,tabStatus:"goodsbom"}})},children:"\u914D\u65B9\u914D\u7F6E"},"primary"),(0,r.jsx)("a",{type:"primary",onClick:function(){O.m8.push({pathname:"/database/goods/goodstechnology",query:{isAdd:!1,values:e,tabStatus:"goodstechnologymaken"}})},children:"\u5DE5\u827A\u914D\u7F6E"},"primary"),(0,r.jsx)("a",{type:"primary",onClick:function(){O.m8.push({pathname:"/database/goods/goodsattributeprice",query:{isAdd:!1,values:e}})},children:"\u4EF7\u683C\u914D\u7F6E"},"primary"),(0,r.jsx)(M.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){(0,l.yR)(e.id).then(function(o){o.succeeded?(v.default.success("\u5220\u9664\u6210\u529F"),I.current.reload()):v.default.error(o.errors)})},onCancel:function(){},children:(0,r.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],Dt=function(){var i=(0,j.Z)((0,g.Z)().mark(function t(e){return(0,g.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(e){o.next=2;break}return o.abrupt("return",!0);case 2:return o.next=4,(0,l.yR)(e.map(function(d){return d.id})).then(function(d){d.data?(v.default.success("\u5220\u9664\u6210\u529F"),I.current.reload()):v.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")});case 4:return o.abrupt("return",!0);case 5:case"end":return o.stop()}},t)}));return function(e){return i.apply(this,arguments)}}(),Ft={beforeUpload:function(t){return k(!0),t.type!=="application/vnd.ms-excel"&&t.type!=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&v.default.error("".concat(t.name," \u4E0D\u662F exelce \u6587\u4EF6")),t.type=="application/vnd.ms-excel"||t.type=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?!0:G.Z.LIST_IGNORE},name:"file",action:(0,Je.w)()+"/api/goods/GoodsImport",headers:{Authorization:"Bearer "+localStorage.getItem("token")},onChange:function(t){t.file.status!=="uploading"&&console.log(t.file,t.fileList),t.file.status==="done"?(k(!1),v.default.success("".concat(t.file.name,"\u5BFC\u5165\u6210\u529F")),I.current.reload()):t.file.status==="error"&&(k(!1),v.default.error("".concat(t.file.name,":").concat(t.file.response," ")))}},Tt={beforeUpload:function(t){return t.type!=="application/vnd.ms-excel"&&t.type!=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&v.default.error("".concat(t.name," \u4E0D\u662F exelce \u6587\u4EF6")),t.type=="application/vnd.ms-excel"||t.type=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?!0:G.Z.LIST_IGNORE},name:"file",action:(0,Je.w)()+"/api/goods/goodsTechnologyImport",headers:{Authorization:"Bearer "+localStorage.getItem("token")},onChange:function(t){k(!0),t.file.status!=="uploading"&&console.log(t.file,t.fileList),t.file.status==="done"?(k(!1),v.default.success("".concat(t.file.name,"\u5BFC\u5165\u6210\u529F")),I.current.reload()):t.file.status==="error"&&(k(!1),v.default.error("".concat(t.file.name,":").concat(t.file.response," ")))}},Bt=function(t,e){Pe(e==null?void 0:e.value),ke(e==null?void 0:e.label)},It=function(t,e){nt(t)},At=function(){var i=(0,j.Z)((0,g.Z)().mark(function t(){var e,u,o,d,A,z,P,ut,st,V,lt;return(0,g.Z)().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(Zt!=""){w.next=3;break}return v.default.error("\u5FC5\u987B\u9009\u62E9\u4E00\u4E2A\u8BBE\u5907\uFF01"),w.abrupt("return");case 3:return w.prev=3,w.next=6,(0,l.Hk)(_e);case 6:if(e=w.sent,e){w.next=10;break}return v.default.error("\u672A\u80FD\u83B7\u53D6\u7B2C\u4E00\u4E2A\u6587\u4EF6\u4E0B\u8F7D\u94FE\u63A5"),w.abrupt("return");case 10:return u=e.substring(e.lastIndexOf("/")+1),o=document.createElement("a"),o.href=e,o.setAttribute("download",u),document.body.appendChild(o),o.click(),document.body.removeChild(o),w.next=19,(0,l.We)({goodsId:wt,deviceId:_e,fileName:u});case 19:if(d=w.sent,d){w.next=23;break}return v.default.error("\u672A\u80FD\u83B7\u53D6\u7B2C\u4E8C\u4E2A\u6587\u4EF6Base64\u6570\u636E"),w.abrupt("return");case 23:for(A=atob(d),z=new Uint8Array(A.length),P=0;P