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