包含后厨 团餐 门店分支
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
17 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[7491],{50727:function(xe,fe,a){"use strict";var _e=a(9715),he=a(55843),s=a(57663),T=a(71577),be=a(96156),Ze=a(28481),ye=a(81253),p=a(55507),w=a(92137),g=a(28991),C=a(85893),b=a(49101),Ee=a(97462),Ce=a(952),Pe=a(78775),Re=a(26369),pe=a(22270),De=a(48171),Ie=a(60249),Te=a(21770),Se=a(88306),ie=a(8880),I=a(67294),H=a(77153),Oe=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],h=["record","position","creatorButtonText","newRecordType","parentKey","style"],me=I.createContext(void 0);function ge(e){var S=e.children,z=e.record,Q=e.position,ue=e.newRecordType,F=e.parentKey,X=(0,I.useContext)(me);return I.cloneElement(S,(0,g.Z)((0,g.Z)({},S.props),{},{onClick:function(){var V=(0,w.Z)((0,p.Z)().mark(function k(oe){var U,N,G,Y;return(0,p.Z)().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,(U=(N=S.props).onClick)===null||U===void 0?void 0:U.call(N,oe);case 2:if(Y=P.sent,Y!==!1){P.next=5;break}return P.abrupt("return");case 5:X==null||(G=X.current)===null||G===void 0||G.addEditRecord(z,{position:Q,newRecordType:ue,parentKey:F});case 6:case"end":return P.stop()}},k)}));function L(k){return V.apply(this,arguments)}return L}()}))}function K(e){var S,z,Q=(0,Pe.YB)(),ue=e.onTableChange,F=e.maxLength,X=e.formItemProps,V=e.recordCreatorProps,L=e.rowKey,k=e.controlled,oe=e.defaultValue,U=e.onChange,N=e.editableFormRef,G=(0,ye.Z)(e,Oe),Y=(0,Re.Z)(e.value),te=(0,I.useRef)(),P=(0,I.useRef)();(0,I.useImperativeHandle)(G.actionRef,function(){return te.current});var R=(0,Te.Z)(function(){return e.value||oe||[]},{value:e.value,onChange:e.onChange}),d=(0,Ze.Z)(R,2),i=d[0],m=d[1],D=I.useMemo(function(){return typeof L=="function"?L:function(Z,l){return Z[L]||l}},[L]),j=function(l){if(typeof l=="number"&&!e.name){if(l>=i.length)return l;var r=i&&i[l];return D==null?void 0:D(r,l)}if((typeof l=="string"||l>=i.length)&&e.name){var n=i.findIndex(function(t,u){var v;return(D==null||(v=D(t,u))===null||v===void 0?void 0:v.toString())===(l==null?void 0:l.toString())});return n}return l};(0,I.useImperativeHandle)(N,function(){var Z=function(n){var t,u;if(n==null)throw new Error("rowIndex is required");var v=j(n),O=[e.name,(t=v==null?void 0:v.toString())!==null&&t!==void 0?t:""].flat(1).filter(Boolean);return(u=P.current)===null||u===void 0?void 0:u.getFieldValue(O)},l=function(){var n,t=[e.name].flat(1).filter(Boolean);if(Array.isArray(t)&&t.length===0){var u,v=(u=P.current)===null||u===void 0?void 0:u.getFieldsValue();return Array.isArray(v)?v:Object.keys(v).map(function(O){return v[O]})}return(n=P.current)===null||n===void 0?void 0:n.getFieldValue(t)};return(0,g.Z)((0,g.Z)({},P.current),{},{getRowData:Z,getRowsData:l,setRowData:function(n,t){var u,v,O,ce;if(n==null)throw new Error("rowIndex is required");var ve=j(n),Me=[e.name,(u=ve==null?void 0:ve.toString())!==null&&u!==void 0?u:""].flat(1).filter(Boolean),y=((v=P.current)===null||v===void 0||(O=v.getFieldsValue)===null||O===void 0?void 0:O.call(v))||{},c=(0,ie.Z)(y,Me,(0,g.Z)((0,g.Z)({},Z(n)),t||{}));return(ce=P.current)===null||ce===void 0?void 0:ce.setFieldsValue(c)}})}),(0,I.useEffect)(function(){!e.controlled||i.forEach(function(Z,l){var r;(r=P.current)===null||r===void 0||r.setFieldsValue((0,be.Z)({},D(Z,l),Z))},{})},[i,e.controlled]),(0,I.useEffect)(function(){if(e.name){var Z;P.current=e==null||(Z=e.editable)===null||Z===void 0?void 0:Z.form}},[(S=e.editable)===null||S===void 0?void 0:S.form,e.name]);var x=V||{},J=x.record,A=x.position,ae=x.creatorButtonText,ne=x.newRecordType,re=x.parentKey,_=x.style,le=(0,ye.Z)(x,h),q=A==="top",B=(0,I.useMemo)(function(){return F&&F<=(i==null?void 0:i.length)?!1:V!==!1&&(0,C.jsx)(ge,{record:(0,pe.h)(J,i==null?void 0:i.length,i)||{},position:A,parentKey:(0,pe.h)(re,i==null?void 0:i.length,i),newRecordType:ne,children:(0,C.jsx)(T.Z,(0,g.Z)((0,g.Z)({type:"dashed",style:(0,g.Z)({display:"block",margin:"10px 0",width:"100%"},_),icon:(0,C.jsx)(b.Z,{})},le),{},{children:ae||Q.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[V,F,i==null?void 0:i.length]),de=(0,I.useMemo)(function(){return B?q?{components:{header:{wrapper:function(l){var r,n=l.className,t=l.children;return(0,C.jsxs)("thead",{className:n,children:[t,(0,C.jsxs)("tr",{style:{position:"relative"},children:[(0,C.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:B}),(0,C.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(r=G.columns)===null||r===void 0?void 0:r.length,children:B})]})]})}}}}:{tableViewRender:function(l,r){var n,t;return(0,C.jsxs)(C.Fragment,{children:[(n=(t=e.tableViewRender)===null||t===void 0?void 0:t.call(e,l,r))!==null&&n!==void 0?n:r,B]})}}:{}},[q,B]),ee=(0,g.Z)({},e.editable),se=(0,De.J)(function(Z,l){var r,n,t;if((r=e.editable)===null||r===void 0||(n=r.onValuesChange)===null||n===void 0||n.call(r,Z,l),(t=e.onValuesChange)===null||t===void 0||t.call(e,l,Z),e.controlled){var u;e==null||(u=e.onChange)===null||u===void 0||u.call(e,l)}});return((e==null?void 0:e.onValuesChange)||((z=e.editable)===null||z===void 0?void 0:z.onValuesChange)||e.controlled&&(e==null?void 0:e.onChange))&&(ee.onValuesChange=se),(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(me.Provider,{value:te,children:(0,C.jsx)(H.Z,(0,g.Z)((0,g.Z)((0,g.Z)({search:!1,options:!1,pagination:!1,rowKey:L,revalidateOnFocus:!1},G),de),{},{tableLayout:"fixed",actionRef:te,onChange:ue,editable:(0,g.Z)((0,g.Z)({},ee),{},{formProps:(0,g.Z)({formRef:P},ee.formProps)}),dataSource:i,onDataSourceChange:function(l){if(m(l),e.name&&A==="top"){var r,n=(0,ie.Z)({},[e.name].flat(1).filter(Boolean),l);(r=P.current)===null||r===void 0||r.setFieldsValue(n)}}}))}),e.name?(0,C.jsx)(Ee.Z,{name:[e.name],children:function(l){var r,n,t=(0,Se.Z)(l,[e.name].flat(1)),u=t==null?void 0:t.find(function(v,O){return!(0,Ie.Z)(v,Y==null?void 0:Y[O])});return u&&Y&&(e==null||(r=e.editable)===null||r===void 0||(n=r.onValuesChange)===null||n===void 0||n.call(r,u,t)),null}}):null]})}function $(e){var S=Ce.ZP.useFormInstance();return e.name?(0,C.jsx)(he.Z.Item,(0,g.Z)((0,g.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,children:(0,C.jsx)(K,(0,g.Z)((0,g.Z)({},e),{},{editable:(0,g.Z)((0,g.Z)({},e.editable),{},{form:S})}))})):(0,C.jsx)(K,(0,g.Z)({},e))}$.RecordCreator=ge,fe.Z=$},44598:function(xe,fe,a){"use strict";a.r(fe),a.d(fe,{default:function(){return P}});var _e=a(57663),he=a(71577),s=a(39428),T=a(3182),be=a(62350),Ze=a(24565),ye=a(34792),p=a(48086),w=a(2824),g=a(402),C=a(56256),b=a(67294),Ee=a(28790),Ce=a(85224),Pe=a(49101),Re=a(16894),pe=a(71194),De=a(50146),Ie=a(43358),Te=a(34041),Se=a(47673),ie=a(4107),I=a(9715),H=a(55843),Oe=a(50727),h=a(85893),me=function(d){var i=H.Z.useForm(),m=(0,w.Z)(i,1),D=m[0],j=(0,b.useState)([]),x=(0,w.Z)(j,2),J=x[0],A=x[1],ae=(0,b.useState)([]),ne=(0,w.Z)(ae,2),re=ne[0],_=ne[1],le=(0,b.useState)([]),q=(0,w.Z)(le,2),B=q[0],de=q[1];(0,b.useEffect)(function(){var l;if(console.log("props.values",d.values),d.values.id){D.setFieldsValue({id:d.values.id,templateName:d.values.templateName,deviceId:d.values.deviceId});var r=d.values.warehousePostion.map(function(t){return{id:t.id,code:t.code,batchingId:t.batchingId}});_(r.map(function(t){return t.id})),A(r)}var n=(l=d.devicedata)===null||l===void 0?void 0:l.map(function(t,u){return{value:t.id,label:t.name}});de(n)},[d]);var ee=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u4ED3\u4F4D\u7F16\u7801",dataIndex:"code"},{title:"\u7269\u6599",dataIndex:"batchingId",formItemProps:function(r,n){var t=n.rowIndex;return{rules:t>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:d.matedata.map(function(l,r){return{label:l.name,value:l.id}})},width:"45%"}],se=function(r){var n=d.devicedata.find(function(v){return v.id==r});if(console.log("device",n),n){for(var t=[],u=0;u<n.productNumber;u++)t.push({id:u,code:"LC000"+(u+1),batchingId:""});console.log("ary",t),_(t.map(function(v){return v.id})),A(t)}},Z=function(){D.validateFields().then(function(r){var n=!0;J.length==0&&(n=!1,message.error("\u8BF7\u9009\u62E9\u7269\u6599")),n&&(r.warehousePostionData=J,d.handleAdd(r))})};return(0,h.jsxs)(De.Z,{title:d.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:d.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:Z,onCancel:function(){d.onCancel(),A([]),_([])},maskClosable:!1,destroyOnClose:!0,children:[(0,h.jsxs)(H.Z,{layout:"vertical",preserve:!1,form:D,children:[(0,h.jsx)(H.Z.Item,{name:"id",hidden:!0,children:(0,h.jsx)(ie.Z,{})}),(0,h.jsx)(H.Z.Item,{label:"\u6A21\u677F\u540D\u79F0",name:"templateName",rules:[{required:!0,max:50}],children:(0,h.jsx)(ie.Z,{})}),(0,h.jsx)(H.Z.Item,{label:"\u9009\u62E9\u8BBE\u5907",name:"deviceId",rules:[{required:!0,max:50}],children:(0,h.jsx)(Te.Z,{style:{width:"100%"},allowClear:!0,showSearch:!0,optionFilterProp:"children",filterOption:function(r,n){var t;return((t=n==null?void 0:n.label)!==null&&t!==void 0?t:"").includes(r)},filterSort:function(r,n){var t,u;return((t=r==null?void 0:r.label)!==null&&t!==void 0?t:"").toLowerCase().localeCompare(((u=n==null?void 0:n.label)!==null&&u!==void 0?u:"").toLowerCase())},onChange:se,options:B})})]}),(0,h.jsx)(Oe.Z,{headerTitle:(0,h.jsxs)("span",{children:[(0,h.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u4ED3\u4F4D\u8BE6\u60C5"]}),columns:ee,rowKey:"id",value:J,onChange:A,recordCreatorProps:!1,editable:{type:"multiple",editableKeys:re,actionRender:function(r,n,t){return[]},onValuesChange:function(r,n){A(n)},onDelete:function(){var l=(0,T.Z)((0,s.Z)().mark(function n(t,u){return(0,s.Z)().wrap(function(O){for(;;)switch(O.prev=O.next){case 0:console.log(t),console.log(u);case 2:case"end":return O.stop()}},n)}));function r(n,t){return l.apply(this,arguments)}return r}(),onChange:_}})]})},ge=me,K=a(48971),$=a(96690);function e(R){return S.apply(this,arguments)}function S(){return S=(0,T.Z)((0,s.Z)().mark(function R(d){return(0,s.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.abrupt("return",(0,K.WY)((0,$.w)()+"/api/warehousetemplate/page",{method:"POST",data:d}));case 1:case"end":return m.stop()}},R)})),S.apply(this,arguments)}function z(R){return Q.apply(this,arguments)}function Q(){return Q=(0,T.Z)((0,s.Z)().mark(function R(d){return(0,s.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.abrupt("return",(0,K.WY)((0,$.w)()+"/api/warehousetemplate/add",{method:"POST",data:d}));case 1:case"end":return m.stop()}},R)})),Q.apply(this,arguments)}function ue(R){return F.apply(this,arguments)}function F(){return F=(0,T.Z)((0,s.Z)().mark(function R(d){return(0,s.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.abrupt("return",(0,K.WY)((0,$.w)()+"/api/warehousetemplate/update",{method:"POST",data:d}));case 1:case"end":return m.stop()}},R)})),F.apply(this,arguments)}function X(R){return V.apply(this,arguments)}function V(){return V=(0,T.Z)((0,s.Z)().mark(function R(d){return(0,s.Z)().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.abrupt("return",(0,K.WY)((0,$.w)()+"/api/warehousetemplate/del",{method:"POST",data:d}));case 1:case"end":return m.stop()}},R)})),V.apply(this,arguments)}function L(){return k.apply(this,arguments)}function k(){return k=(0,T.Z)((0,s.Z)().mark(function R(){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,K.WY)((0,$.w)()+"/api/device/list",{method:"Get"}));case 1:case"end":return i.stop()}},R)})),k.apply(this,arguments)}function oe(){return U.apply(this,arguments)}function U(){return U=(0,T.Z)((0,s.Z)().mark(function R(){return(0,s.Z)().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",(0,K.WY)((0,$.w)()+"/api/batching/getbatchingselectlist",{method:"Get"}));case 1:case"end":return i.stop()}},R)})),U.apply(this,arguments)}var N="message",G=C.Z.Paragraph,Y=C.Z.Text,te=function(){var d=(0,b.useState)(!1),i=(0,w.Z)(d,2),m=i[0],D=i[1],j=(0,b.useRef)(),x=(0,b.useState)(),J=(0,w.Z)(x,2),A=J[0],ae=J[1],ne=(0,b.useState)([]),re=(0,w.Z)(ne,2),_=re[0],le=re[1],q=(0,b.useState)([]),B=(0,w.Z)(q,2),de=B[0],ee=B[1],se=(0,b.useState)([]),Z=(0,w.Z)(se,2),l=Z[0],r=Z[1],n=(0,b.useState)([]),t=(0,w.Z)(n,2),u=t[0],v=t[1];(0,b.useEffect)(function(){L().then(function(y){var c={};y.data.forEach(function(f){c[f.id]={text:f.name}}),r(c),ee(y.data)}),oe().then(function(y){v(y.data)})},[]);var O=[{title:"\u4E3B\u952E",dataIndex:"id",hideInSearch:!0,hideInTable:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u6A21\u677F\u540D\u79F0",dataIndex:"templateName",valueType:"textarea"},{title:"\u8BBE\u5907\u540D\u79F0",dataIndex:"deviceName",valueEnum:l},{title:"\u4ED3\u4F4D\u6570",dataIndex:"productNumber",valueType:"textarea",hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",fixed:"right",width:450,render:function(c,f){return[(0,h.jsx)("a",{onClick:function(){D(!0),ae(f)},children:" \u66F4\u65B0"},"config"),(0,h.jsx)(Ze.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){X([f.id]).then(function(o){p.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"),j.current.reloadAndRest()})},onCancel:function(){},children:(0,h.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],ce=function(){var y=(0,T.Z)((0,s.Z)().mark(function c(f){return(0,s.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,o.next=3,z(JSON.stringify(f)).then(function(E){E.succeeded?(p.default.success("\u6DFB\u52A0\u6210\u529F"),j.current.reload(),D(!1)):p.default.error(E.errors)});case 3:o.next=8;break;case 5:o.prev=5,o.t0=o.catch(0),p.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01");case 8:case"end":return o.stop()}},c,null,[[0,5]])}));return function(f){return y.apply(this,arguments)}}(),ve=function(){var y=(0,T.Z)((0,s.Z)().mark(function c(f){return(0,s.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,p.default.loading("\u6B63\u5728\u4FEE\u6539",N),p.default.destroy(N),o.next=5,ue(JSON.stringify(f)).then(function(E){p.default.destroy(N),E.succeeded?(p.default.success("\u4FEE\u6539\u6210\u529F"),j.current.reload(),D(!1)):p.default.error(E.errors)});case 5:o.next=10;break;case 7:o.prev=7,o.t0=o.catch(0),p.default.error("\u4FEE\u6539\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01");case 10:case"end":return o.stop()}},c,null,[[0,7]])}));return function(f){return y.apply(this,arguments)}}(),Me=function(){var y=(0,T.Z)((0,s.Z)().mark(function c(f){var M;return(0,s.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.prev=0,p.default.loading("\u6B63\u5728\u5220\u9664"),M=[],f.forEach(function(W){M.push(W.id)}),E.next=6,X(M).then(function(W){return W.data?(p.default.success("\u5220\u9664\u6210\u529F"),j.current.reload(),!0):(p.default.error(W.errors),!1)});case 6:E.next=12;break;case 8:return E.prev=8,E.t0=E.catch(0),p.default.error("\u5220\u9664\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),E.abrupt("return",!1);case 12:case"end":return E.stop()}},c,null,[[0,8]])}));return function(f){return y.apply(this,arguments)}}();return(0,h.jsxs)(Ee.ZP,{host:!0,header:{title:"",breadcrumb:{}},children:[(0,h.jsx)(Re.ZP,{actionRef:j,rowKey:"id",pagination:{defaultPageSize:10},search:{labelWidth:120},toolBarRender:function(){return[(0,h.jsxs)(he.Z,{type:"primary",onClick:function(){D(!0)},children:[(0,h.jsx)(Pe.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var y=(0,T.Z)((0,s.Z)().mark(function c(f){var M,o;return(0,s.Z)().wrap(function(W){for(;;)switch(W.prev=W.next){case 0:return M=[],o=0,W.next=4,e(f).then(function(we){M=we.data.data,o=we.data.total});case 4:return W.abrupt("return",{data:M,success:!0,total:o});case 5:case"end":return W.stop()}},c)}));return function(c){return y.apply(this,arguments)}}(),columns:O,rowSelection:{onChange:function(c,f){le(f)}}}),(_==null?void 0:_.length)>0&&(0,h.jsx)(Ce.Z,{extra:(0,h.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,h.jsx)("a",{style:{fontWeight:600},children:_.length})," ","\u9879 \xA0\xA0"]}),children:(0,h.jsx)(he.Z,{onClick:(0,T.Z)((0,s.Z)().mark(function y(){var c,f;return(0,s.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Me(_);case 2:le([]),(c=j.current)===null||c===void 0||(f=c.reloadAndRest)===null||f===void 0||f.call(c);case 4:case"end":return o.stop()}},y)})),children:"\u5220\u9664"})}),(0,h.jsx)(ge,{handleAdd:function(){var y=(0,T.Z)((0,s.Z)().mark(function c(f){var M;return(0,s.Z)().wrap(function(E){for(;;)switch(E.prev=E.next){case 0:M=!1,f.id?ve(f):ce(f);case 2:case"end":return E.stop()}},c)}));return function(c){return y.apply(this,arguments)}}(),onCancel:function(){D(!1),ae(void 0)},createModalVisible:m,values:A||{},devicedata:de,matedata:u})]})},P=te}}]);