您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

p__device__deviceBom.ef24babf.async.js 7.4 KiB

1
  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[229],{55006:function(Re,K,a){"use strict";a.r(K),a.d(K,{default:function(){return he}});var Te=a(57663),I=a(71577),be=a(58024),Q=a(91894),Oe=a(32157),X=a(7573),p=a(2824),T=a(11849),Me=a(34792),m=a(48086),v=a(3182),q=a(94043),n=a.n(q),_=a(49101),f=a(67294),ee=a(78009),te=a(85224),L=a(16894),$e=a(71194),ae=a(50146),b=a(48971);function re(u,r){return k.apply(this,arguments)}function k(){return k=(0,v.Z)(n().mark(function u(r,i){return n().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(0,b.WY)("/kitchen/api/Device/GetDeviceBOM",{method:"POST",data:(0,T.Z)({},r)}));case 1:case"end":return d.stop()}},u)})),k.apply(this,arguments)}function ne(u){return E.apply(this,arguments)}function E(){return E=(0,v.Z)(n().mark(function u(r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("/kitchen/api/Device/AddDeviceBOM",{method:"POST",data:(0,T.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),E.apply(this,arguments)}function ue(u){return x.apply(this,arguments)}function x(){return x=(0,v.Z)(n().mark(function u(r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("\u200B/kitchen/api/Device/DelDeviceBOM",{method:"POST",data:r}));case 1:case"end":return e.stop()}},u)})),x.apply(this,arguments)}function se(u){return A.apply(this,arguments)}function A(){return A=(0,v.Z)(n().mark(function u(r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("/kitchen/api/Device/StoreDeviceTree?isTMC=true",{data:(0,T.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),A.apply(this,arguments)}function le(u){return P.apply(this,arguments)}function P(){return P=(0,v.Z)(n().mark(function u(r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,b.WY)("/kitchen/api/bom/getpage",{method:"POST",data:(0,T.Z)({},r)}));case 1:case"end":return e.stop()}},u)})),P.apply(this,arguments)}var s=a(85893),ie=function(r){var i=(0,f.useState)([]),e=(0,p.Z)(i,2),d=e[0],t=e[1],S=(0,f.useState)([]),O=(0,p.Z)(S,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)(ae.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)(n().mark(function Z(D){var M,w;return n().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return M=[],w=0,D.pertains=[2],B.next=5,le(D).then(function(Y){M=Y.data.data,w=1});case 5:return B.abrupt("return",{data:M,success:!0,total:w});case 6:case"end":return B.stop()}},Z)}));return function(Z){return C.apply(this,arguments)}}(),columns:W,rowSelection:{onChange:function(Z,D){t(D),V(D)}}})})},ce=ie,de=a(28267),oe=function(){var u=(0,v.Z)(n().mark(function r(i){var e;return n().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,ne((0,T.Z)({},i)).then(function(S){if(!S.succeeded)return m.default.error(S.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)}}(),fe=function(){var u=(0,v.Z)(n().mark(function r(i){var e;return n().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(S){e.push(S.id)}),t.next=6,ue(e).then(function(S){return S.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)}}(),ve=function(){var r=(0,f.useState)(),i=(0,p.Z)(r,2),e=i[0],d=i[1],t=(0,f.useRef)(),S=(0,f.useState)(),O=(0,p.Z)(S,2),F=O[0],V=O[1],W=(0,f.useState)(),C=(0,p.Z)(W,2),Z=C[0],D=C[1],M=(0,f.useState)(!1),w=(0,p.Z)(M,2),z=w[0],B=w[1],Y=(0,f.useState)(),U=(0,p.Z)(Y,2),pe=U[0],me=U[1],Se=(0,f.useState)(),H=(0,p.Z)(Se,2),$=H[0],ye=H[1],ge=(0,f.useState)(),J=(0,p.Z)(ge,2),G=J[0],Ze=J[1],De=(0,f.useState)([]),N=(0,p.Z)(De,2),Be=N[0],Ce=N[1];(0,f.useEffect)(function(){function c(){se().then(function(l){V(l.data)})}c()},[]);var je=[{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name",search:!1}];return(0,s.jsxs)(ee.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,j){return[ye(o[0]),Ze(j.node.type),me(j.node)]},treeData:F})}),(0,s.jsx)("div",{style:{flex:1},children:h})]})},toolBarRender:function(){return[(0,s.jsxs)(I.Z,{type:"primary",onClick:function(){d(!0)},children:[(0,s.jsx)(_.Z,{})," \u4E0A\u67B6\u914D\u65B9"]},"primary"),(0,s.jsx)(I.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)(n().mark(function l(h){var y,o;return n().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return y=[],o=0,R.next=4,re(h).then(function(g){y=g.data.data,Ce(y),o=g.data.total});case 4:return R.abrupt("return",{data:y,success:!0,total:o});case 5:case"end":return R.stop()}},l)}));return function(l){return c.apply(this,arguments)}}(),columns:je,rowSelection:{onChange:function(l,h){D(h)}}}),(Z==null?void 0:Z.length)>0&&(0,s.jsx)(te.Z,{extra:(0,s.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,s.jsx)("a",{style:{fontWeight:600},children:Z.length})," ","\u9879 \xA0\xA0"]}),children:(0,s.jsx)(I.Z,{onClick:(0,v.Z)(n().mark(function c(){var l,h;return n().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,fe(Z);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)(ce,{onSubmit:function(){var c=(0,v.Z)(n().mark(function l(h){var y,o,j;return n().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if($!=null){g.next=5;break}m.default.error("\u8BF7\u9009\u62E9\u8BBE\u5907"),d(!1),g.next=13;break;case 5:return y=[],h.map(function(we){y.push({BOMId:we.id})}),o={DeviceId:$,type:G,Boms:y},j=!1,g.next=11,oe(o);case 11:j=g.sent,j&&(d(!1),t.current&&t.current.reload());case 13:case"end":return g.stop()}},l)}));return function(l){return c.apply(this,arguments)}}(),onCancel:function(){d(!1)},modalVisible:e,values:$,type:G}),(0,s.jsx)(de.default,{onCancel:function(){B(!1)},stockModalVisible:z,values:pe,isbom:!0,bomIds:Be.map(function(c){return c.id})})]})},he=ve}}]);