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

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[3611],{50727:function(Ye,ye,n){"use strict";var ke=n(9715),se=n(55843),ze=n(57663),Re=n(71577),c=n(96156),Ve=n(28481),P=n(81253),w=n(55507),$e=n(92137),B=n(28991),O=n(85893),ue=n(49101),Le=n(97462),$=n(952),S=n(78775),ce=n(26369),I=n(22270),Ie=n(48171),Pe=n(60249),U=n(21770),W=n(88306),Ze=n(8880),_=n(67294),we=n(77153),fe=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],Be=["record","position","creatorButtonText","newRecordType","parentKey","style"],oe=_.createContext(void 0);function Ce(e){var G=e.children,J=e.record,ve=e.position,te=e.newRecordType,ae=e.parentKey,q=(0,_.useContext)(oe);return _.cloneElement(G,(0,B.Z)((0,B.Z)({},G.props),{},{onClick:function(){var ee=(0,$e.Z)((0,w.Z)().mark(function be(re){var he,Y,ne,z;return(0,w.Z)().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,(he=(Y=G.props).onClick)===null||he===void 0?void 0:he.call(Y,re);case 2:if(z=b.sent,z!==!1){b.next=5;break}return b.abrupt("return");case 5:q==null||(ne=q.current)===null||ne===void 0||ne.addEditRecord(J,{position:ve,newRecordType:te,parentKey:ae});case 6:case"end":return b.stop()}},be)}));function N(be){return ee.apply(this,arguments)}return N}()}))}function ie(e){var G,J,ve=(0,S.YB)(),te=e.onTableChange,ae=e.maxLength,q=e.formItemProps,ee=e.recordCreatorProps,N=e.rowKey,be=e.controlled,re=e.defaultValue,he=e.onChange,Y=e.editableFormRef,ne=(0,P.Z)(e,fe),z=(0,ce.Z)(e.value),ge=(0,_.useRef)(),b=(0,_.useRef)();(0,_.useImperativeHandle)(ne.actionRef,function(){return ge.current});var De=(0,U.Z)(function(){return e.value||re||[]},{value:e.value,onChange:e.onChange}),t=(0,Ve.Z)(De,2),D=t[0],Se=t[1],Q=_.useMemo(function(){return typeof N=="function"?N:function(v,u){return v[N]||u}},[N]),Ee=function(u){if(typeof u=="number"&&!e.name){if(u>=D.length)return u;var l=D&&D[u];return Q==null?void 0:Q(l,u)}if((typeof u=="string"||u>=D.length)&&e.name){var o=D.findIndex(function(i,g){var h;return(Q==null||(h=Q(i,g))===null||h===void 0?void 0:h.toString())===(u==null?void 0:u.toString())});return o}return u};(0,_.useImperativeHandle)(Y,function(){var v=function(o){var i,g;if(o==null)throw new Error("rowIndex is required");var h=Ee(o),K=[e.name,(i=h==null?void 0:h.toString())!==null&&i!==void 0?i:""].flat(1).filter(Boolean);return(g=b.current)===null||g===void 0?void 0:g.getFieldValue(K)},u=function(){var o,i=[e.name].flat(1).filter(Boolean);if(Array.isArray(i)&&i.length===0){var g,h=(g=b.current)===null||g===void 0?void 0:g.getFieldsValue();return Array.isArray(h)?h:Object.keys(h).map(function(K){return h[K]})}return(o=b.current)===null||o===void 0?void 0:o.getFieldValue(i)};return(0,B.Z)((0,B.Z)({},b.current),{},{getRowData:v,getRowsData:u,setRowData:function(o,i){var g,h,K,p;if(o==null)throw new Error("rowIndex is required");var A=Ee(o),y=[e.name,(g=A==null?void 0:A.toString())!==null&&g!==void 0?g:""].flat(1).filter(Boolean),f=((h=b.current)===null||h===void 0||(K=h.getFieldsValue)===null||K===void 0?void 0:K.call(h))||{},C=(0,Ze.Z)(f,y,(0,B.Z)((0,B.Z)({},v(o)),i||{}));return(p=b.current)===null||p===void 0?void 0:p.setFieldsValue(C)}})}),(0,_.useEffect)(function(){!e.controlled||D.forEach(function(v,u){var l;(l=b.current)===null||l===void 0||l.setFieldsValue((0,c.Z)({},Q(v,u),v))},{})},[D,e.controlled]),(0,_.useEffect)(function(){if(e.name){var v;b.current=e==null||(v=e.editable)===null||v===void 0?void 0:v.form}},[(G=e.editable)===null||G===void 0?void 0:G.form,e.name]);var X=ee||{},Fe=X.record,pe=X.position,Oe=X.creatorButtonText,m=X.newRecordType,r=X.parentKey,E=X.style,a=(0,P.Z)(X,Be),L=pe==="top",j=(0,_.useMemo)(function(){return ae&&ae<=(D==null?void 0:D.length)?!1:ee!==!1&&(0,O.jsx)(Ce,{record:(0,I.h)(Fe,D==null?void 0:D.length,D)||{},position:pe,parentKey:(0,I.h)(r,D==null?void 0:D.length,D),newRecordType:m,children:(0,O.jsx)(Re.Z,(0,B.Z)((0,B.Z)({type:"dashed",style:(0,B.Z)({display:"block",margin:"10px 0",width:"100%"},E),icon:(0,O.jsx)(ue.Z,{})},a),{},{children:Oe||ve.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[ee,ae,D==null?void 0:D.length]),M=(0,_.useMemo)(function(){return j?L?{components:{header:{wrapper:function(u){var l,o=u.className,i=u.children;return(0,O.jsxs)("thead",{className:o,children:[i,(0,O.jsxs)("tr",{style:{position:"relative"},children:[(0,O.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:j}),(0,O.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(l=ne.columns)===null||l===void 0?void 0:l.length,children:j})]})]})}}}}:{tableViewRender:function(u,l){var o,i;return(0,O.jsxs)(O.Fragment,{children:[(o=(i=e.tableViewRender)===null||i===void 0?void 0:i.call(e,u,l))!==null&&o!==void 0?o:l,j]})}}:{}},[L,j]),V=(0,B.Z)({},e.editable),k=(0,Ie.J)(function(v,u){var l,o,i;if((l=e.editable)===null||l===void 0||(o=l.onValuesChange)===null||o===void 0||o.call(l,v,u),(i=e.onValuesChange)===null||i===void 0||i.call(e,u,v),e.controlled){var g;e==null||(g=e.onChange)===null||g===void 0||g.call(e,u)}});return((e==null?void 0:e.onValuesChange)||((J=e.editable)===null||J===void 0?void 0:J.onValuesChange)||e.controlled&&(e==null?void 0:e.onChange))&&(V.onValuesChange=k),(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(oe.Provider,{value:ge,children:(0,O.jsx)(we.Z,(0,B.Z)((0,B.Z)((0,B.Z)({search:!1,options:!1,pagination:!1,rowKey:N,revalidateOnFocus:!1},ne),M),{},{tableLayout:"fixed",actionRef:ge,onChange:te,editable:(0,B.Z)((0,B.Z)({},V),{},{formProps:(0,B.Z)({formRef:b},V.formProps)}),dataSource:D,onDataSourceChange:function(u){if(Se(u),e.name&&pe==="top"){var l,o=(0,Ze.Z)({},[e.name].flat(1).filter(Boolean),u);(l=b.current)===null||l===void 0||l.setFieldsValue(o)}}}))}),e.name?(0,O.jsx)(Le.Z,{name:[e.name],children:function(u){var l,o,i=(0,W.Z)(u,[e.name].flat(1)),g=i==null?void 0:i.find(function(h,K){return!(0,Pe.Z)(h,z==null?void 0:z[K])});return g&&z&&(e==null||(l=e.editable)===null||l===void 0||(o=l.onValuesChange)===null||o===void 0||o.call(l,g,i)),null}}):null]})}function me(e){var G=$.ZP.useFormInstance();return e.name?(0,O.jsx)(se.Z.Item,(0,B.Z)((0,B.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,children:(0,O.jsx)(ie,(0,B.Z)((0,B.Z)({},e),{},{editable:(0,B.Z)((0,B.Z)({},e.editable),{},{form:G})}))})):(0,O.jsx)(ie,(0,B.Z)({},e))}me.RecordCreator=Ce,ye.Z=me},38374:function(Ye,ye,n){"use strict";n.r(ye),n.d(ye,{default:function(){return Oe}});var ke=n(49111),se=n(19650),ze=n(71153),Re=n(60331),c=n(39428),Ve=n(34792),P=n(48086),w=n(3182),$e=n(62350),B=n(24565),O=n(57663),ue=n(71577),Le=n(9715),$=n(55843),S=n(2824),ce=n(49101),I=n(67294),Ie=n(28790),Pe=n(16894),U=n(48971),W=n(96690);function Ze(m){return _.apply(this,arguments)}function _(){return _=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/BomPage",{method:"POST",data:r}));case 1:case"end":return a.stop()}},m)})),_.apply(this,arguments)}function we(m){return fe.apply(this,arguments)}function fe(){return fe=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/AddBom",{method:"POST",data:r}));case 1:case"end":return a.stop()}},m)})),fe.apply(this,arguments)}function Be(m){return oe.apply(this,arguments)}function oe(){return oe=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/addbomtype",{method:"Post",data:r}));case 1:case"end":return a.stop()}},m)})),oe.apply(this,arguments)}function Ce(m){return ie.apply(this,arguments)}function ie(){return ie=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/batching/getbatchingselectlist",{method:"Get"}));case 1:case"end":return a.stop()}},m)})),ie.apply(this,arguments)}function me(m){return e.apply(this,arguments)}function e(){return e=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/getbomtypelist",{method:"Get"}));case 1:case"end":return a.stop()}},m)})),e.apply(this,arguments)}function G(m){return J.apply(this,arguments)}function J(){return J=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/getbyidbomlist?bomId="+r,{method:"Get"}));case 1:case"end":return a.stop()}},m)})),J.apply(this,arguments)}function ve(m){return te.apply(this,arguments)}function te(){return te=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/update",{method:"Post",data:r}));case 1:case"end":return a.stop()}},m)})),te.apply(this,arguments)}function ae(m){return q.apply(this,arguments)}function q(){return q=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/updatebombatcing",{method:"Post",data:r}));case 1:case"end":return a.stop()}},m)})),q.apply(this,arguments)}function ee(m){return N.apply(this,arguments)}function N(){return N=(0,w.Z)((0,c.Z)().mark(function m(r){return(0,c.Z)().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.abrupt("return",(0,U.WY)((0,W.w)()+"/api/bom/DelBom?id=".concat(r),{method:"post"}));case 1:case"end":return a.stop()}},m)})),N.apply(this,arguments)}var be=n(71194),re=n(50146),he=n(43358),Y=n(34041),ne=n(48736),z=n(27049),ge=n(47673),b=n(4107),De=n(50727),t=n(85893),D=function(r){var E=(0,I.useRef)(null),a=(0,I.useState)(""),L=(0,S.Z)(a,2),j=L[0],M=L[1],V=(0,I.useState)([]),k=(0,S.Z)(V,2),v=k[0],u=k[1],l=(0,I.useState)([]),o=(0,S.Z)(l,2),i=o[0],g=o[1],h=function(f){M(f.target.value)},K=[{title:"\u7269\u6599\u540D\u79F0",dataIndex:"batchingId",formItemProps:function(f,C){var F=C.rowIndex;return{rules:F>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:r.matedata.map(function(y,f){return{label:y.name,value:y.id}})},width:"25%"},{title:"\u7528\u91CF",dataIndex:"dosage",valueType:"digit",width:"15%"},{title:"\u64CD\u4F5C",valueType:"option",width:"15%",render:function(){return null}}],p=function(f){if(f.preventDefault(),j.length==0)P.default.error("\u8BF7\u8F93\u5165\u540D\u79F0");else{var C={name:j};Be(C).then(function(F){F.succeeded?(P.default.success("\u6DFB\u52A0\u6210\u529F"),r.initTypeList(),M("")):P.default.error(F.errors)})}},A=function(){r.form.validateFields().then(function(f){var C=!0,F=f;v.length==0?(C=!1,P.default.error("\u8BF7\u9009\u62E9\u7269\u6599")):F.mate=v.map(function(H){return{batchingId:H.batchingId,dosage:H.dosage}}),C&&(r.form.resetFields(),r.onFinish(F),u([]))}).catch(function(f){P.default.error("\u8BF7\u586B\u5199\u5FC5\u586B\u4FE1\u606F")})};return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)(re.Z,{title:"\u65B0\u589E\u83DC\u8C31",width:600,onCancel:r.onCancel,open:r.modalVisible,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:A,children:[(0,t.jsxs)($.Z,{layout:"horizontal",preserve:!1,form:r.form,children:[(0,t.jsx)($.Z.Item,{name:"bomName",label:"\u914D\u65B9\u540D\u79F0",rules:[{required:!0,message:"\u914D\u65B9\u540D\u79F0"}],children:(0,t.jsx)(b.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u540D\u79F0"})}),(0,t.jsx)($.Z.Item,{name:"bomTypeList",rules:[{required:!0,message:"\u914D\u65B9\u5206\u7C7B"}],label:"\u914D\u65B9\u5206\u7C7B",children:(0,t.jsx)(Y.Z,{style:{width:"100%"},mode:"tags",placeholder:"\u8BF7\u9009\u914D\u65B9\u5206\u7C7B",options:r.bomTypeData,dropdownRender:function(f){return(0,t.jsxs)(t.Fragment,{children:[f,(0,t.jsx)(z.Z,{style:{margin:"8px 0"}}),(0,t.jsxs)(se.Z,{style:{padding:"0 8px 4px"},children:[(0,t.jsx)(b.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u5206\u7C7B",ref:E,value:j,onChange:h,onKeyDown:function(F){return F.stopPropagation()}}),(0,t.jsx)(ue.Z,{type:"text",icon:(0,t.jsx)(ce.Z,{}),onClick:p,children:"\u65B0\u589E"})]})]})}})})]}),(0,t.jsx)(De.Z,{headerTitle:(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{style:{color:"red",marginRight:3},children:"*"}),"\u914D\u65B9\u8BE6\u60C5"]}),columns:K,rowKey:"id",value:v,onChange:u,recordCreatorProps:{newRecordType:"dataSource",record:function(){return{id:Date.now()}}},editable:{type:"multiple",editableKeys:i,actionRender:function(f,C,F){return[F.delete,F.Button]},onValuesChange:function(f,C){u(C)},onDelete:function(){var y=(0,w.Z)((0,c.Z)().mark(function C(F,H){return(0,c.Z)().wrap(function(le){for(;;)switch(le.prev=le.next){case 0:console.log(F),console.log(H);case 2:case"end":return le.stop()}},C)}));function f(C,F){return y.apply(this,arguments)}return f}(),onChange:g}})]})})},Se=D,Q=function(r){var E=Y.Z.Option,a=Y.Z.OptGroup,L=(0,I.useState)(""),j=(0,S.Z)(L,2),M=j[0],V=j[1],k=(0,I.useRef)(null),v=function(i){V(i.target.value)},u=function(i){if(i.preventDefault(),M.length==0)P.default.error("\u8BF7\u8F93\u5165\u540D\u79F0");else{var g={name:M};Be(g).then(function(h){h.succeeded?(P.default.success("\u6DFB\u52A0\u6210\u529F"),r.initTypeList(),V("")):P.default.error(h.errors)})}},l=function(){r.onUpdateBomSave()};return(0,t.jsx)(re.Z,{title:"\u7F16\u8F91",width:640,visible:r.updateModalVisible,bodyStyle:{padding:"32px 40px 48px"},onCancel:function(){r.onCancel()},onOk:l,destroyOnClose:!0,children:(0,t.jsxs)($.Z,{layout:"vertical",preserve:!1,form:r.form,onFinish:r.onFinish,children:[(0,t.jsx)($.Z.Item,{name:"id",hidden:!0,children:(0,t.jsx)(b.Z,{})}),(0,t.jsx)($.Z.Item,{name:"name",label:"\u914D\u65B9\u540D\u79F0",children:(0,t.jsx)(b.Z,{placeholder:"\u914D\u65B9\u540D\u79F0"})}),(0,t.jsx)($.Z.Item,{name:"bomTypeList",label:"\u914D\u65B9\u5206\u7C7B",children:(0,t.jsx)(Y.Z,{style:{width:"100%"},mode:"tags",placeholder:"\u8BF7\u9009\u914D\u65B9\u5206\u7C7B",options:r.bomTypeData,dropdownRender:function(i){return(0,t.jsxs)(t.Fragment,{children:[i,(0,t.jsx)(z.Z,{style:{margin:"8px 0"}}),(0,t.jsxs)(se.Z,{style:{padding:"0 8px 4px"},children:[(0,t.jsx)(b.Z,{placeholder:"\u8BF7\u8F93\u5165\u914D\u65B9\u5206\u7C7B",ref:k,value:M,onChange:v,onKeyDown:function(h){return h.stopPropagation()}}),(0,t.jsx)(ue.Z,{type:"text",icon:(0,t.jsx)(ce.Z,{}),onClick:u,children:"\u65B0\u589E"})]})]})}})})]})})},Ee=Q,X=function(r){var E=Y.Z.Option,a=Y.Z.OptGroup,L=(0,I.useState)([]),j=(0,S.Z)(L,2),M=j[0],V=j[1],k=(0,I.useState)([]),v=(0,S.Z)(k,2),u=v[0],l=v[1],o=$.Z.useForm(),i=(0,S.Z)(o,1),g=i[0];(0,I.useEffect)(function(){var p=[];r.BomId&&G(r.BomId).then(function(A){var y=A.data;y.bomEntry.length>0&&y.bomEntry.map(function(f){var C={id:f.id,bomId:f.bomId,batchingId:f.batchingId,dosage:f.bomQty};console.log("item",C),p.push(C)}),console.log("soredata",p),p.length>0&&(l(p.map(function(f){return f.id})),V(p))})},[r]);var h=[{title:"\u4E3B\u952E",dataIndex:"id",key:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key"},{title:"\u914D\u65B9",dataIndex:"bomId",hideInTable:!0,hideInSearch:!0},{title:"\u7269\u6599\u540D\u79F0",dataIndex:"batchingId",formItemProps:function(A,y){var f=y.rowIndex;return{rules:f>1?[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]:[]}},valueType:"select",fieldProps:{showSearch:!0,options:r.matedata.map(function(p,A){return{label:p.name,value:p.id}})},width:"25%"},{title:"\u7528\u91CF",dataIndex:"dosage",valueType:"digit",width:"15%"},{title:"\u64CD\u4F5C",valueType:"option",width:"15%",render:function(){return null}}],K=function(){M.length==0?(check=!1,P.default.error("\u8BF7\u9009\u62E9\u7269\u6599")):r.onBomBatchingFinish(M)};return(0,t.jsx)(re.Z,{title:"\u914D\u65B9\u8BE6\u60C5",width:1040,visible:r.BomBatchingVisible,bodyStyle:{padding:"32px 40px 1px 48px"},okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:K,onCancel:function(){r.onBomBatchingCancel()},destroyOnClose:!0,children:(0,t.jsx)(De.Z,{columns:h,rowKey:"id",value:M,onChange:V,recordCreatorProps:{newRecordType:"dataSource",record:function(){return{id:Date.now(),bomId:r.BomId}}},editable:{type:"multiple",editableKeys:u,actionRender:function(A,y,f){return[f.delete,f.Button]},onValuesChange:function(A,y){V(y)},onDelete:function(){var p=(0,w.Z)((0,c.Z)().mark(function y(f,C){return(0,c.Z)().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:console.log(f),console.log(C);case 2:case"end":return H.stop()}},y)}));function A(y,f){return p.apply(this,arguments)}return A}(),onChange:l}})})},Fe=X,pe=function(r){var E=(0,I.useRef)(),a=(0,I.useState)(!1),L=(0,S.Z)(a,2),j=L[0],M=L[1],V=(0,I.useState)(!1),k=(0,S.Z)(V,2),v=k[0],u=k[1],l=(0,I.useState)([]),o=(0,S.Z)(l,2),i=o[0],g=o[1],h=(0,I.useState)([]),K=(0,S.Z)(h,2),p=K[0],A=K[1],y=(0,I.useState)([]),f=(0,S.Z)(y,2),C=f[0],F=f[1],H=(0,I.useState)(),je=(0,S.Z)(H,2),le=je[0],xe=je[1],He=$.Z.useForm(),Je=(0,S.Z)(He,1),Ue=Je[0],Qe=$.Z.useForm(),Xe=(0,S.Z)(Qe,1),_e=Xe[0],qe=(0,I.useState)(),We=(0,S.Z)(qe,2),en=We[0],Me=We[1],nn=(0,I.useState)(!1),Ge=(0,S.Z)(nn,2),tn=Ge[0],Ke=Ge[1];(0,I.useEffect)(function(){Ae(),an()},[]);function an(){Ce().then(function(Z){g(Z.data)})}function Ne(){Ae()}function Ae(){me().then(function(Z){var d=[];Z.data.length>0&&Z.data.forEach(function(s){d.push({text:s.name,value:s.id,label:s.name})}),A(d)})}function Ae(){me().then(function(Z){var d=[];Z.data.length>0&&Z.data.forEach(function(s){d.push({text:s.name,value:s.id,label:s.name})}),A(d)})}var rn=function(){return(C==null?void 0:C.length)>0&&(0,t.jsx)(B.Z,{title:"\u5220\u9664\u540E\u53EF\u80FD\u5F71\u54CD\u5546\u54C1\u914D\u65B9,\u786E\u8BA4\u5220\u9664\u5417\uFF1F",onConfirm:un,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",children:(0,t.jsx)(ue.Z,{type:"primary",children:"\u6279\u91CF\u5220\u9664"})})},un=function(){var d,s;on(C),F([]),(d=E.current)===null||d===void 0||(s=d.reloadAndRest)===null||s===void 0||s.call(d)},on=function(){var Z=(0,w.Z)((0,c.Z)().mark(function d(s){return(0,c.Z)().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(s){T.next=2;break}return T.abrupt("return",!0);case 2:return T.next=4,ee(s.map(function(R){return R.id})).then(function(R){R.succeeded?(P.default.success("\u5220\u9664\u6210\u529F"),E.current.reload()):P.default.error(R.errors)});case 4:return T.abrupt("return",!0);case 5:case"end":return T.stop()}},d)}));return function(s){return Z.apply(this,arguments)}}(),ln=[{title:"\u4E3B\u952E",dataIndex:"id",hideInTable:!0,hideInSearch:!0,tip:"\u89C4\u5219\u540D\u79F0\u662F\u552F\u4E00\u7684 key",render:function(d,s){return(0,t.jsx)("a",{onClick:function(){Me(s),setShowDetail(!0)},children:d})}},{title:"\u914D\u65B9\u540D\u79F0",dataIndex:"name",width:300,hideInForm:!0,hideInSearch:!1},{title:"\u914D\u65B9\u5206\u7C7B",dataIndex:"bomTypeList",search:!1,render:function(d,s){return(0,t.jsx)(se.Z,{children:p.filter(function(x){var T=s.bomTypeList.find(function(Te){return Te===x.value}),R=p.find(function(Te){return Te.value===T});return R!=null||void 0}).map(function(x){return(0,t.jsx)(Re.Z,{color:"#87d068",children:x.text},x.value)})})}},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",width:250,render:function(d,s){return[(0,t.jsx)("a",{type:"primary",onClick:function(){Me(s),_e.setFieldsValue(s),u(!0)},children:"\u66F4\u65B0"},"primary3"),(0,t.jsx)("a",{type:"primary",onClick:function(){Ke(!0),xe(s.id)},children:"\u914D\u65B9\u8BE6\u60C5"},"primary1"),(0,t.jsx)(B.Z,{type:"primary",title:"\u5220\u9664\u540E\u53EF\u80FD\u5F71\u54CD\u5546\u54C1\u914D\u65B9,\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:(0,w.Z)((0,c.Z)().mark(function x(){return(0,c.Z)().wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return R.prev=0,ee(s.id),E.current.reloadAndRest(),R.abrupt("return",!0);case 6:return R.prev=6,R.t0=R.catch(0),E.current.reloadAndRest(),R.abrupt("return",!1);case 10:case"end":return R.stop()}},x,null,[[0,6]])})),onCancel:function(){},children:(0,t.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}],dn=function(){_e.validateFields().then(function(d){console.log(d);var s={id:d.id,name:d.name,IsMain:d.bomType=="1",bomTypeIds:d.bomTypeList};ve(s).then(function(x){x.data?(P.default.success("\u4FEE\u6539\u6210\u529F"),u(!1),E.current.reload(),xe("")):P.default.error(x.errors||"\u4FEE\u6539\u5931\u8D25")})})},sn=function(){Ke(!1),xe("")},cn=function(d){console.log("form",d);var s={bomId:le,bomEntry:d};ae(s).then(function(x){x.succeeded?(P.default.success("\u4FEE\u6539\u6210\u529F"),Ke(!1),E.current.reload(),xe("")):P.default.error(x.errors)})};return(0,t.jsxs)(Ie.ZP,{header:{title:"",breadcrumb:{}},children:[(0,t.jsx)(Pe.ZP,{columns:ln,actionRef:E,pagination:{defaultPageSize:10},rowKey:"id",toolBarRender:function(){return[(0,t.jsxs)(ue.Z,{type:"primary",onClick:function(){M(!0)},children:[(0,t.jsx)(ce.Z,{})," \u65B0\u5EFA"]},"primary"),(0,t.jsx)(rn,{})]},request:function(){var Z=(0,w.Z)((0,c.Z)().mark(function d(s){var x,T,R;return(0,c.Z)().wrap(function(de){for(;;)switch(de.prev=de.next){case 0:return x=0,T=[],de.next=4,Ze(s);case 4:return R=de.sent,R.statusCode==200&&(T=R.data.data,x=R.data.total),de.abrupt("return",{data:T,success:!0,total:x});case 7:case"end":return de.stop()}},d)}));return function(d){return Z.apply(this,arguments)}}(),rowSelection:{onChange:function(d,s){return F(s)}}}),(0,t.jsx)(Se,{modalVisible:j,matedata:i,form:Ue,bomTypeData:p,initTypeList:Ne,onFinish:function(){var Z=(0,w.Z)((0,c.Z)().mark(function d(s){return(0,c.Z)().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,we(s).then(function(R){R.data?(P.default.success("\u6DFB\u52A0\u6210\u529F"),M(!1)):P.default.error("\u6DFB\u52A0\u5931\u8D25"),E.current.reloadAndRest()});case 2:case"end":return T.stop()}},d)}));return function(d){return Z.apply(this,arguments)}}(),onCancel:function(){M(!1),Ue.resetFields()}}),(0,t.jsx)(Ee,{updateModalVisible:v,onUpdateBomSave:dn,values:en||{},form:_e,initTypeList:Ne,bomTypeData:p,onFinish:function(){var Z=(0,w.Z)((0,c.Z)().mark(function d(s){return(0,c.Z)().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:case"end":return T.stop()}},d)}));return function(d){return Z.apply(this,arguments)}}(),onCancel:function(){u(!1),Me(void 0)}}),(0,t.jsx)(Fe,{BomBatchingVisible:tn,matedata:i,onBomBatchingCancel:sn,BomId:le,onBomBatchingFinish:cn})]})},Oe=pe}}]);