|
- (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7657,1322],{17997:function(tt,me,s){"use strict";s.r(me),s.d(me,{default:function(){return Pt}});var ne=s(57663),W=s(71577),k=s(2824),N=s(34792),f=s(48086),c=s(3182),ie=s(94043),n=s.n(ie),ae=s(49101),v=s(67294),se=s(78009),Ze=s(85224),ee=s(16894),Ue=s(71194),X=s(50146),rt=s(77883),ue=s(85482),Ne=s(62999),ce=s(54680),F=s(9715),p=s(86835),te=s(47673),d=s(4107),le=s(43358),$=s(34041),r=s(85893),nt=function(t){var u=$.Z.Option,e=$.Z.OptGroup;return(0,r.jsx)(X.Z,{title:t.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:t.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){t.onCancel()},destroyOnClose:!0,children:(0,r.jsxs)(p.Z,{layout:"Horizontal",labelCol:{span:4},preserve:!1,initialValues:t.values,onFinish:t.onFinish,children:[(0,r.jsx)(p.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(d.Z,{})}),(0,r.jsx)(p.Z.Item,{label:"\u8BBE\u5907\u540D\u79F0",name:"deviceName",rules:[{required:!0,max:50}],children:(0,r.jsx)(d.Z,{})}),(0,r.jsx)(p.Z.Item,{label:"\u8BBE\u5907\u7C7B\u578B",name:"deviceTypeKey",rules:[{required:!0}],children:(0,r.jsx)($.Z,{children:t.dicData.map(function(i,l){return(0,r.jsx)($.Z.Option,{index:l,value:i.code,children:i.value},i.code)})})}),(0,r.jsx)(p.Z.Item,{name:"orgId",label:"\u5F52\u5C5E\u95E8\u5E97",rules:[{required:!0}],children:(0,r.jsx)(ce.Z,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:t.OrgData,placeholder:"\u5F52\u5C5E\u95E8\u5E97",treeDefaultExpandAll:!0})}),(0,r.jsx)(p.Z.Item,{label:"\u8BBE\u5907\u5206\u7C7B",name:"deviceTypeId",rules:[{required:!0}],children:(0,r.jsx)($.Z,{children:t.storeType.map(function(i,l){return(0,r.jsx)($.Z.Option,{index:l,value:i.id,children:i.text},i.id)})})}),(0,r.jsx)(p.Z.Item,{noStyle:!0,shouldUpdate:function(l,D){return l.deviceTypeKey!==D.deviceTypeKey},children:function(l){var D,z=l.getFieldValue;return z("deviceTypeKey")==="TMC"?(0,r.jsx)(p.Z.Item,{name:"deviceVersion",label:"\u8BBE\u5907\u7248\u672C",initialValue:"WorryFreeEdition",children:(0,r.jsx)($.Z,{children:(D=t.deviceVersions)===null||D===void 0?void 0:D.map(function(G,J){return(0,r.jsx)($.Z.Option,{index:J,value:G.code,children:G.name},G.code)})})}):null}}),(0,r.jsx)(p.Z.Item,{label:"\u8BBE\u5907\u5750\u6807",name:"deviceLoc",children:(0,r.jsx)(d.Z,{placeholder:"104.070734,30.575041"})}),(0,r.jsx)(p.Z.Item,{label:"\u72B6\u6001",name:"status",rules:[{required:!0}],children:(0,r.jsx)($.Z,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",children:(0,r.jsxs)(e,{children:[(0,r.jsx)($.Z.Option,{value:0,children:"\u6B63\u5E38"}),(0,r.jsx)($.Z.Option,{value:1,children:"\u505C\u7528"})]})})}),(0,r.jsx)(p.Z.Item,{label:"\u8BBE\u5907\u901A\u9053\u6570\u91CF",name:"materialQuantity",children:(0,r.jsx)(ue.Z,{})}),(0,r.jsx)(p.Z.Item,{label:"\u8BBE\u5907\u8BE6\u7EC6\u5730\u5740",name:"deviceAddr",children:(0,r.jsx)(d.Z,{placeholder:"\u6210\u90FD\u5E02\u6B66\u4FAF\u533A\u6842\u6EAA\u8857\u9053\u73AF\u7403\u4E2D\u5FC3N5-9111C"})}),(0,r.jsx)(p.Z.Item,{children:(0,r.jsx)(W.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},at=nt,oe=s(11849),j=s(48971);function ut(a){return De.apply(this,arguments)}function De(){return De=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/GetDeviceInfoPage",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),De.apply(this,arguments)}function it(a){return ke.apply(this,arguments)}function ke(){return ke=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/dict-data/dic-list/".concat(t),{method:"Get"}));case 1:case"end":return e.stop()}},a)})),ke.apply(this,arguments)}function st(a){return we.apply(this,arguments)}function we(){return we=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/AddDeviceInfo",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),we.apply(this,arguments)}function _e(a){return Ce.apply(this,arguments)}function Ce(){return Ce=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/UpdateDeviceInfo",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),Ce.apply(this,arguments)}function ct(a){return Fe.apply(this,arguments)}function Fe(){return Fe=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/CopyDevice",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),Fe.apply(this,arguments)}function lt(a){return je.apply(this,arguments)}function je(){return je=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("\u200B\u200B/kitchen/api/Device/DelDeviceInfo",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),je.apply(this,arguments)}function ot(a){return Ie.apply(this,arguments)}function Ie(){return Ie=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("\u200B/kitchen/api/Device/GetDeviceType",{method:"GET"}));case 1:case"end":return e.stop()}},a)})),Ie.apply(this,arguments)}function dt(){return be.apply(this,arguments)}function be(){return be=(0,c.Z)(n().mark(function a(){return n().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",(0,j.WY)("\u200B/kitchen/api/Device/GetDeviceVersions",{method:"post"}));case 1:case"end":return u.stop()}},a)})),be.apply(this,arguments)}function Kt(a,t){return Ee.apply(this,arguments)}function Ee(){return Ee=_asyncToGenerator(_regeneratorRuntime.mark(function a(t,u){return _regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",request("/kitchen/api/Device/GetDeviceGoods",{method:"POST",data:_objectSpread({},t)}));case 1:case"end":return i.stop()}},a)})),Ee.apply(this,arguments)}function ft(a){return Oe.apply(this,arguments)}function Oe(){return Oe=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/AddDeviceGood",{method:"POST",data:(0,oe.Z)({},t)}));case 1:case"end":return e.stop()}},a)})),Oe.apply(this,arguments)}function Vt(a){return Te.apply(this,arguments)}function Te(){return Te=_asyncToGenerator(_regeneratorRuntime.mark(function a(t){return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",request("/kitchen/\u200Bapi/Device/GetGoods",{method:"POST",data:_objectSpread({},t)}));case 1:case"end":return e.stop()}},a)})),Te.apply(this,arguments)}function pt(a){return xe.apply(this,arguments)}function xe(){return xe=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/\u200Bapi/Device/GetByDeviceGoods",{method:"POST",data:(0,oe.Z)({},t)}));case 1:case"end":return e.stop()}},a)})),xe.apply(this,arguments)}function ht(a){return Ae.apply(this,arguments)}function Ae(){return Ae=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/GetDeviceStorePage",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),Ae.apply(this,arguments)}function vt(a){return Be.apply(this,arguments)}function Be(){return Be=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/DelStockAdjust?Id=".concat(t),{method:"DELETE"}));case 1:case"end":return e.stop()}},a)})),Be.apply(this,arguments)}function mt(a){return Pe.apply(this,arguments)}function Pe(){return Pe=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/AddUpdateDeviceStocAsync",{method:"POST",data:t}));case 1:case"end":return e.stop()}},a)})),Pe.apply(this,arguments)}function yt(a){return $e.apply(this,arguments)}function $e(){return $e=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/AddUpdateDeviceStocAsync",{method:"put",data:t}));case 1:case"end":return e.stop()}},a)})),$e.apply(this,arguments)}function gt(a){return Ge.apply(this,arguments)}function Ge(){return Ge=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/deviceconfig/getlocs?Code=".concat(t),{method:"GET"}));case 1:case"end":return e.stop()}},a)})),Ge.apply(this,arguments)}function St(a){return Me.apply(this,arguments)}function Me(){return Me=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/GetProductList",{method:"post",data:t}));case 1:case"end":return e.stop()}},a)})),Me.apply(this,arguments)}function Zt(a){return Re.apply(this,arguments)}function Re(){return Re=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/\u200Bapi/FoodMenu/tree",{data:(0,oe.Z)({},t)}));case 1:case"end":return e.stop()}},a)})),Re.apply(this,arguments)}function Dt(a){return We.apply(this,arguments)}function We(){return We=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/PushDevice?DeviceId=".concat(t),{method:"post"}));case 1:case"end":return e.stop()}},a)})),We.apply(this,arguments)}function kt(a){return Le.apply(this,arguments)}function Le(){return Le=(0,c.Z)(n().mark(function a(t){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,j.WY)("/kitchen/api/Device/CheckStockAdjust?DeviceId=".concat(t),{method:"POST"}));case 1:case"end":return e.stop()}},a)})),Le.apply(this,arguments)}var wt=s(3408),Ut=s(49111),Ct=s(19650),Nt=s(62350),de=s(75443),ye=s(86582),Ft=function(t){var u=(0,v.useRef)(),e=(0,v.useState)([]),i=(0,k.Z)(e,2),l=i[0],D=i[1],z=(0,v.useState)(!0),G=(0,k.Z)(z,2),J=G[0],Q=G[1],q=(0,v.useState)([]),H=(0,k.Z)(q,2),re=H[0],x=H[1],A=(0,v.useState)(""),w=(0,k.Z)(A,2),o=w[0],h=w[1],m=[{title:"\u83DC\u8C31\u5217\u8868",dataIndex:"foodMenuId",valueType:"treeSelect",hideInTable:!0,fieldProps:{options:re,value:o,onChange:function(O){h(O)}}},{title:"\u5546\u54C1id",dataIndex:"goodsId",tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",hideInSearch:!0,hideInTable:!0},{title:"\u5546\u54C1\u540D\u79F0",dataIndex:"goodsName"}],V=function(){var I=(0,c.Z)(n().mark(function O(){var T,b,S;return n().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:if((T=t.device)!==null&&T!==void 0&&T.id){P.next=2;break}return P.abrupt("return");case 2:return b=[],l.forEach(function(_){b.push({foodId:_})}),P.next=6,ft({foodss:b,deviceId:t.device.id});case 6:S=P.sent,S.data?(f.default.success("\u8BBE\u5907\u5546\u54C1\u66F4\u65B0\u6210\u529F\uFF01"),t.onOk()):f.default.error(JSON.stringify(S.errors)||"\u4E0A\u67B6\u5931\u8D25");case 8:case"end":return P.stop()}},O)}));return function(){return I.apply(this,arguments)}}(),B=function(){var I=(0,c.Z)(n().mark(function O(){var T;return n().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,Zt();case 2:T=S.sent,T.statusCode===200&&T.data.length>0&&(h(T.data[0].value),x(T.data));case 4:case"end":return S.stop()}},O)}));return function(){return I.apply(this,arguments)}}();return(0,v.useEffect)(function(){B()},[]),(0,v.useEffect)(function(){u.current&&u.current.reload()},[o]),(0,r.jsx)(X.Z,{width:900,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"\u3010".concat(t.device.deviceName,"\u3011\u7ED1\u5B9A\u5546\u54C1"),visible:t.open,onCancel:function(){return t.onCancel()},onOk:V,maskClosable:!1,children:(0,r.jsx)(ee.ZP,{actionRef:u,rowKey:"goodsId",pagination:{defaultPageSize:10},toolBarRender:!1,params:{deviceId:t.device.id},request:function(){var I=(0,c.Z)(n().mark(function O(T){var b,S,L,P,_;return n().wrap(function(K){for(;;)switch(K.prev=K.next){case 0:if(o){K.next=2;break}return K.abrupt("return",[]);case 2:return K.next=4,pt((0,oe.Z)((0,oe.Z)({},T),{},{foolMenuId:o,storeId:t.device.orgId,foodName:T.goodsName||""}));case 4:if(b=K.sent,b.statusCode!==200){K.next=10;break}return J&&(P=new Set([].concat((0,ye.Z)(l),(0,ye.Z)(b.data.data.checkedIds))),_=[],P.forEach(function(fe){_.push(fe)}),D(_),Q(!1)),K.abrupt("return",{data:((S=b.data)===null||S===void 0||(L=S.data)===null||L===void 0?void 0:L.data)||[],success:!0,total:b.data.total});case 10:return K.abrupt("return",[]);case 11:case"end":return K.stop()}},O)}));return function(O){return I.apply(this,arguments)}}(),columns:m,rowSelection:{type:"checkbox",selectedRowKeys:l,onSelect:function(O,T){var b=(0,ye.Z)(l),S=b.findIndex(function(L){return L===O.goodsId});T?S<0&&b.push(O.goodsId):S>-1&&b.splice(S,1),D(b)},onSelectAll:function(O,T,b){var S=(0,ye.Z)(l);O?T.forEach(function(L){if(!!L){var P=S.findIndex(function(_){return _===L.goodsId});P<0&&S.push(L.goodsId)}}):b.forEach(function(L){var P=S.findIndex(function(_){return _===L.goodsId});P>-1&&S.splice(P,1)}),D(S)}},tableAlertOptionRender:function(){return(0,r.jsx)(Ct.Z,{size:16,children:(0,r.jsx)(de.Z,{title:"\u6B64\u64CD\u4F5C\u4F1A\u53D6\u6D88\u6240\u6709\u9009\u4E2D\u9879\uFF0C\u786E\u5B9A\u8981\u53D6\u6D88\u5417\uFF1F",onConfirm:function(){return D([])},okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,r.jsx)("a",{children:"\u53D6\u6D88\u9009\u62E9"})})})}})})},jt=Ft,ze="message",It=function(t){var u,e=p.Z.useForm(),i=(0,k.Z)(e,1),l=i[0],D=(0,v.useState)([]),z=(0,k.Z)(D,2),G=z[0],J=z[1],Q=(0,v.useState)([]),q=(0,k.Z)(Q,2),H=q[0],re=q[1],x=function(){var o=(0,c.Z)(n().mark(function h(){var m;return n().wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return B.next=2,l.validateFields();case 2:if(m=B.sent,m.DeviceId=t.device.id,!m.id){B.next=9;break}return B.next=7,yt(m).then(function(I){f.default.destroy(ze),I.data?(f.default.success("\u4FEE\u6539\u6210\u529F"),t.onOk()):f.default.error("\u4FEE\u6539\u5931\u8D25"+I.errors)});case 7:B.next=11;break;case 9:return B.next=11,mt(m).then(function(I){f.default.destroy(ze),I.data?(f.default.success("\u6DFB\u52A0\u6210\u529F"),t.onOk()):f.default.error("\u6DFB\u52A0\u5931\u8D25"+I.errors)});case 11:case"end":return B.stop()}},h)}));return function(){return o.apply(this,arguments)}}(),A=function(){var o=(0,c.Z)(n().mark(function h(){return n().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:gt(t.device.deviceTypeKey).then(function(B){J(B.data)});case 1:case"end":return V.stop()}},h)}));return function(){return o.apply(this,arguments)}}(),w=function(){var o=(0,c.Z)(n().mark(function h(){return n().wrap(function(V){for(;;)switch(V.prev=V.next){case 0:St({DeviceId:t.device.id}).then(function(B){re(B.data)});case 1:case"end":return V.stop()}},h)}));return function(){return o.apply(this,arguments)}}();return(0,v.useEffect)(function(){var o;(o=t.stockMaterial)!==null&&o!==void 0&&o.id&&l.setFieldsValue(t.stockMaterial),A(),w()},[]),(0,r.jsx)(X.Z,{width:700,destroyOnClose:!0,title:"".concat((u=t.stockMaterial)!==null&&u!==void 0&&u.id?"\u7F16\u8F91"+t.stockMaterial.batching_Name:"\u65B0\u589E"),visible:t.open,onCancel:t.onCancel,onOk:x,footer:[(0,r.jsx)(W.Z,{onClick:t.onCancel,children:"\u53D6\u6D88"},"back"),(0,r.jsx)(de.Z,{title:"\u70B9\u51FB\u540C\u6B65\u5E93\u5B58\u6216\u91CD\u542F\u8BBE\u5907\u540E\u751F\u6548\uFF01\uFF01\uFF01",onConfirm:x,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,r.jsx)(W.Z,{type:"primary",children:"\u786E\u5B9A"},"submit")})],children:(0,r.jsxs)(p.Z,{layout:"vertical",preserve:!1,form:l,children:[(0,r.jsx)(p.Z.Item,{name:"id",hidden:!0,children:(0,r.jsx)(d.Z,{})}),(0,r.jsx)(p.Z.Item,{name:"batching_Id",label:"\u539F\u6599\u540D\u79F0",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0"}],children:(0,r.jsx)($.Z,{placeholder:"\u8BF7\u9009\u62E9\u539F\u6599\u540D\u79F0",showSearch:!0,optionFilterProp:"children",filterOption:function(h,m){return m.children.toLowerCase().indexOf(h.toLowerCase())>=0},children:H==null?void 0:H.map(function(o,h){return(0,r.jsx)($.Z.Option,{index:h,value:o.id,children:o.name},o.id)})})}),(0,r.jsx)(p.Z.Item,{name:"batching_Loc",label:"\u5E93\u5B58\u4F4D\u7F6E",rules:[{required:!0}],defaultValue:"0",children:(0,r.jsx)($.Z,{placeholder:"\u8BF7\u9009\u62E9\u5E93\u5B58\u4F4D\u7F6E",children:G==null?void 0:G.map(function(o,h){return(0,r.jsx)($.Z.Option,{index:h,value:o.loc,children:o.loc},o.loc)})})}),(0,r.jsx)(p.Z.Item,{name:"batching_Count",label:"\u539F\u6599\u6570\u91CF",rules:[{required:!0}],defaultValue:"0",children:(0,r.jsx)(ue.Z,{style:{width:"100%"},min:0,placeholder:"\u8BF7\u8F93\u5165\u539F\u6599\u6570\u91CF"})})]})})},bt=It,Et=function(t){var u=(0,v.useRef)(),e=(0,v.useState)(!1),i=(0,k.Z)(e,2),l=i[0],D=i[1],z=(0,v.useState)(),G=(0,k.Z)(z,2),J=G[0],Q=G[1],q=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u7269\u6599",dataIndex:"batching_Name",valueType:"textarea"},{title:"\u6570\u91CF",dataIndex:"batching_Count",valueType:"textarea"},{title:"\u5E93\u4F4D",dataIndex:"batching_Loc"},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(A,w){return[(0,r.jsx)("a",{onClick:function(){Q(w),D(!0)},children:"\u4FEE\u6539"},"config"),(0,r.jsx)(de.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){return re(w)},children:(0,r.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],H=function(){t.onOk()},re=function(){var x=(0,c.Z)(n().mark(function A(w){var o;return n().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,vt(w.id);case 2:o=m.sent,o.data?(f.default.success("\u5220\u9664\u6210\u529F"),u.current.reload()):f.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5");case 4:case"end":return m.stop()}},A)}));return function(w){return x.apply(this,arguments)}}();return(0,v.useEffect)(function(){},[]),(0,r.jsxs)(X.Z,{width:700,destroyOnClose:!0,title:"\u3010".concat(t.device.deviceName,"\u3011\u5E93\u5B58\u539F\u6599"),visible:t.open,onCancel:function(){return t.onCancel()},onOk:H,maskClosable:!1,children:[(0,r.jsx)(ee.ZP,{actionRef:u,rowKey:"id",search:!1,params:{deviceId:t.device.id},toolBarRender:function(){return[(0,r.jsx)(de.Z,{type:"primary",title:"\u83B7\u53D6\u5B9E\u65F6\u5E93\u5B58\u4F1A\u8986\u76D6\u672C\u6B21\u8865\u8D27\u6570\u636E",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,c.Z)(n().mark(function A(){var w;return n().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,kt(t.device.id);case 2:w=h.sent,w.data?(f.default.success("\u83B7\u53D6\u5B9E\u65F6\u5E93\u5B58\u4F1A\u6210\u529F\uFF01"),u.current.reload()):f.default.error(w.errors||"\u83B7\u53D6\u5B9E\u65F6\u5E93\u5B58\u4F1A\u5931\u8D25\uFF01");case 4:case"end":return h.stop()}},A)})),children:(0,r.jsx)(W.Z,{type:"primary",children:"\u83B7\u53D6\u5B9E\u65F6\u5E93\u5B58"},"primary")},"primary-async-time"),(0,r.jsx)(de.Z,{type:"primary",title:"\u786E\u8BA4\u540C\u6B65\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,c.Z)(n().mark(function A(){var w;return n().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,Dt(t.device.id);case 2:w=h.sent,w.data?(f.default.success("\u540C\u6B65\u6210\u529F\uFF01"),u.current.reload()):f.default.error(w.errors||"\u540C\u6B65\u5931\u8D25\uFF01");case 4:case"end":return h.stop()}},A)})),children:(0,r.jsx)(W.Z,{type:"primary",children:"\u540C\u6B65\u5E93\u5B58"},"primary")},"primary-async"),(0,r.jsxs)(W.Z,{type:"primary",onClick:function(){Q(void 0),D(!0)},children:[(0,r.jsx)(ae.Z,{})," \u65B0\u589E\u5E93\u5B58\u539F\u6599"]},"primary")]},request:function(){var x=(0,c.Z)(n().mark(function A(w){var o;return n().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,ht(w);case 2:if(o=m.sent,o.statusCode!==200){m.next=5;break}return m.abrupt("return",{data:o.data.data,success:!0,total:o.data.total});case 5:return m.abrupt("return",[]);case 6:case"end":return m.stop()}},A)}));return function(A){return x.apply(this,arguments)}}(),columns:q}),l&&(0,r.jsx)(bt,{device:t.device,stockMaterial:J,open:l,onOk:function(){D(!1),u.current.reload()},onCancel:function(){return D(!1)}})]})},Ot=Et,ge="message",Tt=function(){var a=(0,c.Z)(n().mark(function t(u){return n().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,f.default.loading("\u6B63\u5728\u6DFB\u52A0",ge),i.next=4,st(JSON.stringify(u)).then(function(l){return f.default.destroy(ge),l.data?(f.default.success("\u6DFB\u52A0\u6210\u529F"),!0):(f.default.error("\u6DFB\u52A0\u5931\u8D25"),!1)});case 4:i.next=10;break;case 6:return i.prev=6,i.t0=i.catch(0),f.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),i.abrupt("return",!1);case 10:case"end":return i.stop()}},t,null,[[0,6]])}));return function(u){return a.apply(this,arguments)}}(),xt=function(){var a=(0,c.Z)(n().mark(function t(u){return n().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,f.default.loading("\u6B63\u5728\u4FEE\u6539",ge),i.next=4,_e(JSON.stringify(u)).then(function(l){return f.default.destroy(ge),l.data?(f.default.success("\u4FEE\u6539\u6210\u529F"),!0):(f.default.success("\u4FEE\u6539\u5931\u8D25"),!1)});case 4:i.next=10;break;case 6:return i.prev=6,i.t0=i.catch(0),f.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),i.abrupt("return",!1);case 10:case"end":return i.stop()}},t,null,[[0,6]])}));return function(u){return a.apply(this,arguments)}}(),At=function(){var a=(0,c.Z)(n().mark(function t(u){var e;return n().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,f.default.loading("\u6B63\u5728\u5220\u9664"),e=[],u.forEach(function(D){e.push(D.id)}),l.next=6,lt(e).then(function(D){return D.data?(f.default.success("\u5220\u9664\u6210\u529F"),!0):(f.default.success("\u5220\u9664\u5931\u8D25"),!1)});case 6:l.next=12;break;case 8:return l.prev=8,l.t0=l.catch(0),f.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),l.abrupt("return",!1);case 12:case"end":return l.stop()}},t,null,[[0,8]])}));return function(u){return a.apply(this,arguments)}}(),Bt=function(){var t=(0,v.useState)(),u=(0,k.Z)(t,2),e=u[0],i=u[1],l=(0,v.useState)([]),D=(0,k.Z)(l,2),z=D[0],G=D[1],J=(0,v.useState)([]),Q=(0,k.Z)(J,2),q=Q[0],H=Q[1],re=(0,v.useState)([]),x=(0,k.Z)(re,2),A=x[0],w=x[1],o=(0,v.useState)([]),h=(0,k.Z)(o,2),m=h[0],V=h[1],B=(0,v.useState)([]),I=(0,k.Z)(B,2),O=I[0],T=I[1],b=(0,v.useState)([]),S=(0,k.Z)(b,2),L=S[0],P=S[1],_=(0,v.useState)(),Ye=(0,k.Z)(_,2),K=Ye[0],fe=Ye[1],$t=(0,v.useState)(!1),He=(0,k.Z)($t,2),Je=He[0],Ke=He[1];(0,v.useEffect)(function(){var M=function(){ot().then(function(C){var E={},Y=[];C.data.forEach(function(g){Y.push({text:g.name,id:g.id}),E[g.id]={text:g.name}}),G(Y),i(E)})};function R(){(0,wt.FM)().then(function(Z){C(Z.data);function C(g){for(var U in g)g[U].type==2||g[U].type==3?g[U].disabled=!1:g[U].disabled=!0,g[U].children&&C(g[U].children)}H(Z.data);var E={};Y(Z.data);function Y(g){for(var U in g)E[g[U].disabled]=!0,E[g[U].value]={text:g[U].title},g[U].children&&Y(g[U].children)}w(E)})}R(),M();function y(){it("DeviceClientType").then(function(Z){var C=Z.data,E={};if(Z.succeeded){var Y=[];C.forEach(function(g){E[g.code]={text:g.code},Y.push({code:g.code,value:g.code})}),V(E),T(Y)}})}y(),Gt()},[]);var Gt=function(){var M=(0,c.Z)(n().mark(function R(){var y;return n().wrap(function(C){for(;;)switch(C.prev=C.next){case 0:return C.next=2,dt();case 2:y=C.sent,y.statusCode==200?P(y.data):f.default.error("\u83B7\u53D6\u8BBE\u5907\u7248\u672C\u5931\u8D25");case 4:case"end":return C.stop()}},R)}));return function(){return M.apply(this,arguments)}}(),Mt=(0,v.useState)(!1),Qe=(0,k.Z)(Mt,2),Rt=Qe[0],Se=Qe[1],pe=(0,v.useRef)(),Wt=(0,v.useState)(),Xe=(0,k.Z)(Wt,2),Ve=Xe[0],he=Xe[1],Lt=(0,v.useState)([]),qe=(0,k.Z)(Lt,2),ve=qe[0],et=qe[1],Yt=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u8BBE\u5907\u540D\u79F0",dataIndex:"deviceName",valueType:"textarea"},{title:"\u8BBE\u5907\u7C7B\u578B",dataIndex:"deviceTypeKey",valueEnum:m,hideInSearch:!0},{title:"\u5F52\u5C5E\u95E8\u5E97",dataIndex:"orgId",search:!1,valueEnum:A},{title:"\u8BBE\u5907\u5206\u7C7B",dataIndex:"deviceTypeId",valueEnum:e},{title:"\u72B6\u6001",dataIndex:"status",valueEnum:{0:{text:"\u6B63\u5E38",status:"Processing"},1:{text:"\u505C\u7528",status:"Success"}},hideInSearch:!0},{title:"\u8BBE\u5907\u901A\u9053\u6570\u91CF",dataIndex:"materialQuantity",valueType:"textarea",search:!1},{title:"\u8BBE\u5907\u552F\u4E00key",dataIndex:"autoKey",search:!1},{title:"\u5F52\u5C5E\u95E8\u5E97\u552F\u4E00key",dataIndex:"orgKey",search:!1},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:400,render:function(R,y){return[(0,r.jsx)("a",{onClick:function(){Se(!0),he(y)},children:"\u66F4\u65B0"},"update"),(0,r.jsx)("a",{onClick:function(){y.status=y.status==0?1:0,_e(y).then(function(C){C.data&&pe.current.reload()})},children:y.status==0?"\u505C\u7528":"\u6B63\u5E38"},"status"),(0,r.jsx)("a",{onClick:function(){ct({id:y.id}).then(function(C){C.data&&pe.current.reload()})},children:"\u590D\u5236"},"copy"),(0,r.jsx)("a",{onClick:function(){he(y),fe(!0)},children:"\u7ED1\u5B9A\u5546\u54C1"},"upload-goods"),(0,r.jsx)("a",{onClick:function(){he(y),Ke(!0)},children:"\u5E93\u5B58\u539F\u6599"},"add")]}}];return(0,r.jsxs)(se.ZP,{children:[(0,r.jsx)(ee.ZP,{headerTitle:"\u8BBE\u5907\u4FE1\u606F",actionRef:pe,rowKey:"id",search:{labelWidth:120},scroll:{x:2e3},toolBarRender:function(){return[(0,r.jsxs)(W.Z,{type:"primary",onClick:function(){Se(!0)},children:[(0,r.jsx)(ae.Z,{})," \u65B0\u5EFA"]},"primary"),(0,r.jsx)(W.Z,{onClick:(0,c.Z)(n().mark(function R(){var y,Z;return n().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,At(ve);case 2:et([]),(y=pe.current)===null||y===void 0||(Z=y.reloadAndRest)===null||Z===void 0||Z.call(y);case 4:case"end":return E.stop()}},R)})),children:"\u5220\u9664"})]},request:function(){var M=(0,c.Z)(n().mark(function R(y){var Z,C;return n().wrap(function(Y){for(;;)switch(Y.prev=Y.next){case 0:return Z=[],C=0,Y.next=4,ut(y).then(function(g){Z=g.data.data,C=g.data.total});case 4:return Y.abrupt("return",{data:Z,success:!0,total:C});case 5:case"end":return Y.stop()}},R)}));return function(R){return M.apply(this,arguments)}}(),columns:Yt,rowSelection:{onChange:function(R,y){et(y)}}}),(ve==null?void 0:ve.length)>0&&(0,r.jsx)(Ze.Z,{extra:(0,r.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,r.jsx)("a",{style:{fontWeight:600},children:ve.length})," ","\u9879 \xA0\xA0"]})}),(0,r.jsx)(at,{storeType:z,OrgData:q,dicData:O,onFinish:function(){var M=(0,c.Z)(n().mark(function R(y){var Z;return n().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:Z=!1,y.id?Z=xt(y):Z=Tt(y),Z&&(Se(!1),he(void 0),pe.current.reload());case 3:case"end":return E.stop()}},R)}));return function(R){return M.apply(this,arguments)}}(),onCancel:function(){Se(!1),he(void 0)},createModalVisible:Rt,deviceVersions:L,values:Ve||{}}),K&&(0,r.jsx)(jt,{open:K,device:Ve,onOk:function(){return fe(!1)},onCancel:function(){return fe(!1)}}),Je&&(0,r.jsx)(Ot,{open:Je,device:Ve,onOk:function(){return Ke(!1)},onCancel:function(){return Ke(!1)}})]})},Pt=Bt},3408:function(tt,me,s){"use strict";s.d(me,{lM:function(){return c},IH:function(){return n},mm:function(){return Ze},eP:function(){return Ue},FM:function(){return Ne}});var ne=s(11849),W=s(3182),k=s(94043),N=s.n(k),f=s(48971);function c(F,p){return ie.apply(this,arguments)}function ie(){return ie=(0,W.Z)(N().mark(function F(p,te){return N().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return le.abrupt("return",(0,f.WY)("/kitchen/api/sysOrg\u200B/page",{method:"GET",params:(0,ne.Z)({},p)}));case 1:case"end":return le.stop()}},F)})),ie.apply(this,arguments)}function n(F){return ae.apply(this,arguments)}function ae(){return ae=(0,W.Z)(N().mark(function F(p){return N().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(0,f.WY)("/kitchen/api/sysOrg/add",{method:"POST",data:(0,ne.Z)({},p)}));case 1:case"end":return d.stop()}},F)})),ae.apply(this,arguments)}function v(F){return se.apply(this,arguments)}function se(){return se=_asyncToGenerator(_regeneratorRuntime.mark(function F(p){return _regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",request("\u200B/kitchen/api\u200B/sysOrg\u200B/list",{method:"POST",data:_objectSpread({},p)}));case 1:case"end":return d.stop()}},F)})),se.apply(this,arguments)}function Ze(F){return ee.apply(this,arguments)}function ee(){return ee=(0,W.Z)(N().mark(function F(p){return N().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(0,f.WY)("\u200B/kitchen/api\u200B/sysOrg\u200B/delete",{method:"POST",data:(0,ne.Z)({},p)}));case 1:case"end":return d.stop()}},F)})),ee.apply(this,arguments)}function Ue(F){return X.apply(this,arguments)}function X(){return X=(0,W.Z)(N().mark(function F(p){return N().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(0,f.WY)("\u200B/kitchen/api\u200B/sysOrg\u200B/edit",{method:"POST",data:(0,ne.Z)({},p)}));case 1:case"end":return d.stop()}},F)})),X.apply(this,arguments)}function rt(F){return ue.apply(this,arguments)}function ue(){return ue=_asyncToGenerator(_regeneratorRuntime.mark(function F(p){return _regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",request("/kitchen\u200B/api\u200B/sysOrg\u200B/detail",{method:"POST",data:_objectSpread({},p)}));case 1:case"end":return d.stop()}},F)})),ue.apply(this,arguments)}function Ne(F){return ce.apply(this,arguments)}function ce(){return ce=(0,W.Z)(N().mark(function F(p){return N().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return d.abrupt("return",(0,f.WY)("\u200B/kitchen/api\u200B/sysOrg\u200B/tree",{data:(0,ne.Z)({},p)}));case 1:case"end":return d.stop()}},F)})),ce.apply(this,arguments)}}}]);
|