|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[4424],{58211:function(we,q,n){"use strict";n.r(q),n.d(q,{default:function(){return Ae}});var be=n(71194),_=n(50146),ee=n(11849),Ie=n(57663),I=n(71577),Oe=n(71153),te=n(60331),Be=n(43185),ae=n(93349),$e=n(9715),D=n(55843),C=n(2824),i=n(39428),Ge=n(34792),f=n(48086),g=n(3182),y=n(67294),se=n(28790),ue=n(85224),le=n(49101),ie=n(16894),Ue=n(47673),ne=n(4107),Ve=n(43358),O=n(34041),F=n(48971);function oe(l){return M.apply(this,arguments)}function M(){return M=(0,g.Z)((0,i.Z)().mark(function l(a){return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,F.WY)("/saasbase/api/devicevesion/page",{method:"POST",data:a}));case 1:case"end":return t.stop()}},l)})),M.apply(this,arguments)}function de(l){return W.apply(this,arguments)}function W(){return W=(0,g.Z)((0,i.Z)().mark(function l(a){return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,F.WY)("/saasbase/api/devicevesion/add",{method:"POST",data:a}));case 1:case"end":return t.stop()}},l)})),W.apply(this,arguments)}function ce(l){return L.apply(this,arguments)}function L(){return L=(0,g.Z)((0,i.Z)().mark(function l(a){return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,F.WY)("\u200B/saasbase/api/devicevesion/delete",{method:"POST",data:a}));case 1:case"end":return t.stop()}},l)})),L.apply(this,arguments)}function fe(l){return Y.apply(this,arguments)}function Y(){return Y=(0,g.Z)((0,i.Z)().mark(function l(a){return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,F.WY)("\u200B/saasbase/api/devicevesion/update",{method:"POST",data:a}));case 1:case"end":return t.stop()}},l)})),Y.apply(this,arguments)}function pe(l){return k.apply(this,arguments)}function k(){return k=(0,g.Z)((0,i.Z)().mark(function l(a){return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,F.WY)("\u200B/saasbase/api/devicevesion/updatestatus",{method:"POST",data:a}));case 1:case"end":return t.stop()}},l)})),k.apply(this,arguments)}function he(){return N.apply(this,arguments)}function N(){return N=(0,g.Z)((0,i.Z)().mark(function l(){return(0,i.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",(0,F.WY)("/saasbase/api/product/list",{method:"Get"}));case 1:case"end":return c.stop()}},l)})),N.apply(this,arguments)}function ve(l){return K.apply(this,arguments)}function K(){return K=(0,g.Z)((0,i.Z)().mark(function l(a){return(0,i.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,F.WY)("/saasbase/api/systemconfig/GetCosRequestSignURL",{method:"POST",data:a}));case 1:case"end":return t.stop()}},l)})),K.apply(this,arguments)}var me=n(9669),ge=n.n(me),r=n(85893),Ze=function(a){a.form.setFieldsValue(a.values);var c=O.Z.Option,t=O.Z.OptGroup,u={name:"file",showUploadList:!1,multiple:!1,accept:".xlsx, .xls",headers:{"Content-Type":"application/octet-stream"},customRequest:function(h){var w=h.action,x=h.file,z=h.headers,J=h.onError,B=h.onProgress,Z=h.onSuccess,A=h.withCredentials;console.log("\u4E0A\u4F20\u56FE\u7247",x);var H=x.name.lastIndexOf("."),$=x.name.substr(H+1),S=null;return ve({directory:"goods",fileExtension:$,method:"PUT"}).then(function(E){w=E.allUrl;var G=new FileReader;G.readAsArrayBuffer(x),G.onload=function(U){S=U.target.result,ge().put(w,S,{withCredentials:A,headers:z,onUploadProgress:function(j){var Q=j.total,V=j.loaded;B({percent:Math.round(V/Q*100).toFixed(2)},x)}}).then(function(P){console.log("onSuccess",P,x),(P.status==200||P.statusText=="OK")&&a.form.setFieldsValue({templatePath:E.seeUrl})}).catch(J)}}),{abort:function(){console.log("upload progress is aborted.")}}}};return(0,r.jsx)(_.Z,{title:a.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:a.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){a.onCancel()},destroyOnClose:!0,children:(0,r.jsxs)(D.Z,{layout:"vertical",preserve:!1,form:a.form,onFinish:a.onFinish,children:[(0,r.jsx)(D.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(ne.Z,{})}),(0,r.jsx)(D.Z.Item,{label:"\u7248\u672C\u53F7",name:"vesion",rules:[{required:!0,max:50}],children:(0,r.jsx)(ne.Z,{})}),(0,r.jsx)(D.Z.Item,{label:"\u6240\u5C5E\u4EA7\u54C1",name:"productId",rules:[{required:!0,max:50}],children:(0,r.jsx)(O.Z,{children:a.dicData.map(function(o,h){return(0,r.jsx)(O.Z.Option,{index:h,value:o.id,children:o.label},o.id)})})}),(0,r.jsx)(D.Z.Item,{children:(0,r.jsx)(I.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},ye=Ze,R="message",xe=function(){var l=(0,g.Z)((0,i.Z)().mark(function a(c){return(0,i.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.prev=0,f.default.loading("\u6B63\u5728\u6DFB\u52A0",R),u.next=4,de(JSON.stringify(c)).then(function(o){return f.default.destroy(R),o.data?(f.default.success("\u6DFB\u52A0\u6210\u529F"),!0):(f.default.error("\u6DFB\u52A0\u5931\u8D25"),!1)});case 4:u.next=10;break;case 6:return u.prev=6,u.t0=u.catch(0),f.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.abrupt("return",!1);case 10:case"end":return u.stop()}},a,null,[[0,6]])}));return function(c){return l.apply(this,arguments)}}(),Se=function(){var l=(0,g.Z)((0,i.Z)().mark(function a(c){return(0,i.Z)().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.prev=0,f.default.loading("\u6B63\u5728\u4FEE\u6539",R),f.default.destroy(R),u.next=5,fe(JSON.stringify(c)).then(function(o){return f.default.destroy(R),o.data?(f.default.success("\u4FEE\u6539\u6210\u529F"),!0):(f.default.success("\u4FEE\u6539\u5931\u8D25"),!1)});case 5:u.next=11;break;case 7:return u.prev=7,u.t0=u.catch(0),f.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),u.abrupt("return",!1);case 11:case"end":return u.stop()}},a,null,[[0,7]])}));return function(c){return l.apply(this,arguments)}}(),Ce=function(){var l=(0,g.Z)((0,i.Z)().mark(function a(c){var t;return(0,i.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,f.default.loading("\u6B63\u5728\u5220\u9664"),t=[],c.forEach(function(h){t.push(h.id)}),o.next=6,ce(t).then(function(h){return h.data?(f.default.success("\u5220\u9664\u6210\u529F"),!0):(f.default.error(h.errors),!1)});case 6:o.next=12;break;case 8:return o.prev=8,o.t0=o.catch(0),f.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),o.abrupt("return",!1);case 12:case"end":return o.stop()}},a,null,[[0,8]])}));return function(c){return l.apply(this,arguments)}}(),Fe=function(){var a=(0,y.useState)(!1),c=(0,C.Z)(a,2),t=c[0],u=c[1],o=(0,y.useRef)(),h=(0,y.useState)([]),w=(0,C.Z)(h,2),x=w[0],z=w[1],J=(0,y.useState)(),B=(0,C.Z)(J,2),Z=B[0],A=B[1],H=(0,y.useState)([]),$=(0,C.Z)(H,2),S=$[0],E=$[1],G=(0,y.useState)(!1),U=(0,C.Z)(G,2),P=U[0],j=U[1],Q=(0,y.useState)(!1),V=(0,C.Z)(Q,2),je=V[0],X=V[1],De=D.Z.useForm(),Ee=(0,C.Z)(De,1),Pe=Ee[0],Te={beforeUpload:function(s){return s.type!=="application/vnd.ms-excel"&&s.type!=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&&f.default.error("".concat(s.name," \u4E0D\u662F exelce \u6587\u4EF6")),s.type=="application/vnd.ms-excel"||s.type=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?!0:ae.Z.LIST_IGNORE},name:"file",data:{id:Z==null?void 0:Z.id,deviceClientType:Z==null?void 0:Z.deviceTypeKey,version:Z==null?void 0:Z.vesion,isAddGoodsTemplate:je},action:"/saasbase/api/goods/goodstemplateexport",headers:{Authorization:"Bearer "+localStorage.getItem("token")},onChange:function(s){s.file.status!=="uploading"&&console.log(s.file,s.fileList),X(!1),s.file.status==="done"?(j(!1),o.current.reload(),f.default.success("".concat(s.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F."))):s.file.status==="error"&&f.default.error("".concat(s.file.name," \u6587\u4EF6\u4E0A\u8F7D\u5931\u8D25."))}},Re=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u7248\u672C\u53F7",dataIndex:"vesion",valueType:"textarea"},{title:"\u6240\u5C5E\u4EA7\u54C1",dataIndex:"productName",valueType:"textarea"},{title:"\u72B6\u6001",dataIndex:"status",valueEnum:{0:{text:"\u542F\u7528",status:"Processing"},1:{text:"\u7981\u7528",status:"Success"}},hideInSearch:!0},{title:"\u662F\u5426\u5B58\u5728\u6A21\u677F",dataIndex:"templatePath",valueType:"textarea",render:function(s,d){return[(0,r.jsxs)("div",{children:[(0,r.jsx)(te.Z,{color:"#f50",style:{textAlign:"center",display:d.templatePath==null||d.templatePath==""?"none":"block"},children:"\u5B58\u5728\u6A21\u677F"}),(0,r.jsx)(te.Z,{style:{textAlign:"center",display:d.templatePath==null||d.templatePath==""?"block":"none"},color:"#2db7f5",children:"\u65E0\u6A21\u677F"})]})]}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:700,render:function(s,d){return[(0,r.jsx)("a",{onClick:function(){u(!0),A(d)},children:" \u66F4\u65B0"},"config"),(0,r.jsxs)("a",{onClick:function(){var p={id:d.id,status:d.status==0?1:0};pe(p).then(function(T){T.succeeded?(f.default.success("\u64CD\u4F5C\u6210\u529F"),o.current.reload()):f.default.error(e.error)})},children:[" ",d.status==0?"\u7981\u7528":"\u542F\u7528"]},"primary"),(0,r.jsx)("a",{onClick:function(){A(d),j(!0),X(!1)},children:" \u4E0A\u4F20\u8BBE\u5907\u5DE5\u827A\u6A21\u578B"},"config"),(0,r.jsx)("a",{onClick:function(){A(d),j(!0),X(!0)},children:" \u4E0A\u4F20\u5546\u54C1\u5DE5\u827A\u6A21\u7248"},"config"),(0,r.jsx)("a",{href:d.templatePath,children:" \u4E0B\u8F7D\u5DE5\u827A\u6A21\u677F"},"config")]}}];return(0,y.useEffect)(function(){he().then(function(v){var s=v.data,d={};if(v.succeeded){var m=[];s.forEach(function(p){d[p.code]={text:p.code},m.push({label:p.name,text:p.name,id:p.id})}),z(m)}})},[]),(0,r.jsxs)(se.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,r.jsx)(ie.ZP,{headerTitle:"\u8BBE\u5907\u7248\u672C",actionRef:o,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,r.jsxs)(I.Z,{type:"primary",onClick:function(){u(!0)},children:[(0,r.jsx)(le.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var v=(0,g.Z)((0,i.Z)().mark(function s(d){var m,p;return(0,i.Z)().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return m=[],p=0,b.next=4,oe(d).then(function(re){m=re.data.data,p=re.data.total});case 4:return b.abrupt("return",{data:m,success:!0,total:p});case 5:case"end":return b.stop()}},s)}));return function(s){return v.apply(this,arguments)}}(),columns:Re,rowSelection:{onChange:function(s,d){E(d)}}}),(S==null?void 0:S.length)>0&&(0,r.jsx)(ue.Z,{extra:(0,r.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,r.jsx)("a",{style:{fontWeight:600},children:S.length})," ","\u9879 \xA0\xA0"]}),children:(0,r.jsx)(I.Z,{onClick:(0,g.Z)((0,i.Z)().mark(function v(){var s,d;return(0,i.Z)().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,Ce(S);case 2:E([]),(s=o.current)===null||s===void 0||(d=s.reloadAndRest)===null||d===void 0||d.call(s);case 4:case"end":return p.stop()}},v)})),children:"\u5220\u9664"})}),(0,r.jsx)(ye,{onFinish:function(){var v=(0,g.Z)((0,i.Z)().mark(function s(d){var m;return(0,i.Z)().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:m=!1,d.id?m=Se(d):m=xe(d),m&&(u(!1),A(void 0)),o.current.reload();case 4:case"end":return T.stop()}},s)}));return function(s){return v.apply(this,arguments)}}(),onCancel:function(){u(!1),A(void 0)},createModalVisible:t,values:Z||{},form:Pe,dicData:x}),(0,r.jsx)(_.Z,{title:"\u4E0A\u4F20\u5DE5\u827A\u6A21\u7248",open:P,footer:null,onCancel:function(){j(!1)},children:(0,r.jsx)(ae.Z,(0,ee.Z)((0,ee.Z)({},Te),{},{maxCount:1,children:(0,r.jsx)(I.Z,{children:"\u5BFC\u5165\u5DE5\u827A\u6A21\u7248"})}))})]})},Ae=Fe}}]);
|