You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2 lines
7.5 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[229],{55006:function(je,K,a){"use strict";a.r(K),a.d(K,{default:function(){return ve}});var Re=a(57663),k=a(71577),be=a(58024),Q=a(91894),Te=a(32157),X=a(7573),p=a(2824),n=a(39428),b=a(11849),Oe=a(34792),m=a(48086),v=a(3182),q=a(49101),f=a(67294),_=a(78009),ee=a(85224),L=a(53779),Me=a(71194),te=a(50146),T=a(48971);function ae(u,r){return I.apply(this,arguments)}function I(){return I=(0,v.Z)((0,n.Z)().mark(function u(r,i){return(0,n.Z)().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(0,T.WY)("/kitchen/api/Device/GetDeviceBOM",{method:"POST",data:(0,b.Z)({},r)}));case 1:case"end":return d.stop()}},u)})),I.apply(this,arguments)}function re(u){return E.apply(this,arguments)}function E(){return E=(0,v.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("/kitchen/api/Device/AddDeviceBOM",{method:"POST",data:(0,b.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),E.apply(this,arguments)}function ne(u){return x.apply(this,arguments)}function x(){return x=(0,v.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("\u200B/kitchen/api/Device/DelDeviceBOM",{method:"POST",data:r}));case 1:case"end":return e.stop()}},u)})),x.apply(this,arguments)}function ue(u){return A.apply(this,arguments)}function A(){return A=(0,v.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("/kitchen/api/Device/StoreDeviceTree?isTMC=true",{data:(0,b.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),A.apply(this,arguments)}function se(u){return P.apply(this,arguments)}function P(){return P=(0,v.Z)((0,n.Z)().mark(function u(r){return(0,n.Z)().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,T.WY)("/kitchen/api/bom/getpage",{method:"POST",data:(0,b.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),P.apply(this,arguments)}var s=a(85893),le=function(r){var i=(0,f.useState)([]),e=(0,p.Z)(i,2),d=e[0],t=e[1],Z=(0,f.useState)([]),O=(0,p.Z)(Z,2),F=O[0],V=O[1],W=[{title:"\u914D\u65B9id",dataIndex:"id",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name"}];return(0,s.jsx)(te.Z,{width:700,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u9009\u62E9\u914D\u65B9",visible:r.modalVisible,onCancel:function(){return r.onCancel()},onOk:function(){F.length>100?m.default.error("\u914D\u65B9\u5FC5\u987B\u5C11\u4E8E100\u4E2A"):r.onSubmit(d)},maskClosable:!1,children:(0,s.jsx)(L.ZP,{headerTitle:"\u914D\u65B9\u4FE1\u606F",rowKey:"id",pagination:{defaultPageSize:5e3},search:!1,toolBarRender:!1,params:{DeviceId:r.values},request:function(){var C=(0,v.Z)((0,n.Z)().mark(function g(D){var M,j;return(0,n.Z)().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return M=[],j=0,D.pertains=[2],B.next=5,se(D).then(function(Y){M=Y.data.data,j=1});case 5:return B.abrupt("return",{data:M,success:!0,total:j});case 6:case"end":return B.stop()}},g)}));return function(g){return C.apply(this,arguments)}}(),columns:W,rowSelection:{onChange:function(g,D){t(D),V(D)}}})})},ie=le,ce=a(28267),de=function(){var u=(0,v.Z)((0,n.Z)().mark(function r(i){var e;return(0,n.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return e=m.default.loading("\u6B63\u5728\u6DFB\u52A0"),t.prev=1,t.next=4,re((0,b.Z)({},i)).then(function(Z){if(!Z.succeeded)return m.default.error(Z.errors),!1});case 4:return e(),m.default.success("\u6DFB\u52A0\u6210\u529F"),t.abrupt("return",!0);case 9:return t.prev=9,t.t0=t.catch(1),e(),m.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),t.abrupt("return",!1);case 14:case"end":return t.stop()}},r,null,[[1,9]])}));return function(i){return u.apply(this,arguments)}}(),oe=function(){var u=(0,v.Z)((0,n.Z)().mark(function r(i){var e;return(0,n.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,m.default.loading("\u6B63\u5728\u5220\u9664"),e=[],i.forEach(function(Z){e.push(Z.id)}),t.next=6,ne(e).then(function(Z){return Z.data?(m.default.success("\u5220\u9664\u6210\u529F"),!0):(m.default.error("\u5220\u9664\u5931\u8D25"),!1)});case 6:t.next=12;break;case 8:return t.prev=8,t.t0=t.catch(0),m.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),t.abrupt("return",!1);case 12:case"end":return t.stop()}},r,null,[[0,8]])}));return function(i){return u.apply(this,arguments)}}(),fe=function(){var r=(0,f.useState)(),i=(0,p.Z)(r,2),e=i[0],d=i[1],t=(0,f.useRef)(),Z=(0,f.useState)(),O=(0,p.Z)(Z,2),F=O[0],V=O[1],W=(0,f.useState)(),C=(0,p.Z)(W,2),g=C[0],D=C[1],M=(0,f.useState)(!1),j=(0,p.Z)(M,2),z=j[0],B=j[1],Y=(0,f.useState)(),U=(0,p.Z)(Y,2),he=U[0],pe=U[1],me=(0,f.useState)(),H=(0,p.Z)(me,2),$=H[0],Ze=H[1],Se=(0,f.useState)(),J=(0,p.Z)(Se,2),G=J[0],ye=J[1],ge=(0,f.useState)([]),N=(0,p.Z)(ge,2),De=N[0],Be=N[1];(0,f.useEffect)(function(){function c(){ue().then(function(l){V(l.data)})}c()},[]);var Ce=[{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name",search:!1}];return(0,s.jsxs)(_.ZP,{children:[(0,s.jsx)(L.ZP,{headerTitle:"\u914D\u65B9\u5217\u8868",actionRef:t,rowKey:"id",search:{labelWidth:120},tableRender:function(l,h){return(0,s.jsxs)("div",{style:{display:"flex",width:"100%"},children:[(0,s.jsx)(Q.Z,{title:"\u5E97\u94FA\u8BBE\u5907\u5217\u8868",children:(0,s.jsx)(X.Z,{defaultExpandAll:!0,onSelect:function(o,w){return[Ze(o[0]),ye(w.node.type),pe(w.node)]},treeData:F})}),(0,s.jsx)("div",{style:{flex:1},children:h})]})},toolBarRender:function(){return[(0,s.jsxs)(k.Z,{type:"primary",onClick:function(){d(!0)},children:[(0,s.jsx)(q.Z,{})," \u4E0A\u67B6\u914D\u65B9"]},"primary"),(0,s.jsx)(k.Z,{type:"primary",onClick:function(){B(!0)},children:"\u8BBE\u5907\u5E93\u5B58\u7BA1\u7406"},"primary")]},params:{DeviceId:$,type:G},request:function(){var c=(0,v.Z)((0,n.Z)().mark(function l(h){var S,o;return(0,n.Z)().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return S=[],o=0,R.next=4,ae(h).then(function(y){S=y.data.data,Be(S),o=y.data.total});case 4:return R.abrupt("return",{data:S,success:!0,total:o});case 5:case"end":return R.stop()}},l)}));return function(l){return c.apply(this,arguments)}}(),columns:Ce,rowSelection:{onChange:function(l,h){D(h)}}}),(g==null?void 0:g.length)>0&&(0,s.jsx)(ee.Z,{extra:(0,s.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,s.jsx)("a",{style:{fontWeight:600},children:g.length})," ","\u9879 \xA0\xA0"]}),children:(0,s.jsx)(k.Z,{onClick:(0,v.Z)((0,n.Z)().mark(function c(){var l,h;return(0,n.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,oe(g);case 2:D([]),(l=t.current)===null||l===void 0||(h=l.reloadAndRest)===null||h===void 0||h.call(l);case 4:case"end":return o.stop()}},c)})),children:"\u6279\u91CF\u5220\u9664"})}),(0,s.jsx)(ie,{onSubmit:function(){var c=(0,v.Z)((0,n.Z)().mark(function l(h){var S,o,w;return(0,n.Z)().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if($!=null){y.next=5;break}m.default.error("\u8BF7\u9009\u62E9\u8BBE\u5907"),d(!1),y.next=13;break;case 5:return S=[],h.map(function(we){S.push({BOMId:we.id})}),o={DeviceId:$,type:G,Boms:S},w=!1,y.next=11,de(o);case 11:w=y.sent,w&&(d(!1),t.current&&t.current.reload());case 13:case"end":return y.stop()}},l)}));return function(l){return c.apply(this,arguments)}}(),onCancel:function(){d(!1)},modalVisible:e,values:$,type:G}),(0,s.jsx)(ce.default,{onCancel:function(){B(!1)},stockModalVisible:z,values:he,isbom:!0,bomIds:De.map(function(c){return c.id})})]})},ve=fe}}]);