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 line
8.8 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8688],{82746:function(he,V,a){"use strict";a.r(V),a.d(V,{default:function(){return ue}});var ve=a(57338),L=a(25084),pe=a(57663),R=a(71577),me=a(62350),k=a(75443),x=a(2824),ye=a(34792),h=a(48086),Z=a(3182),z=a(94043),i=a.n(z),K=a(49101),D=a(67294),H=a(78009),J=a(85224),Q=a(16894),X=a(12826),Ze=a(71194),q=a(50146),De=a(9715),j=a(86835),je=a(47673),E=a(4107),Ce=a(43358),C=a(34041),e=a(85893),_=function(n){var f=C.Z.Option,p=C.Z.OptGroup;return(0,e.jsx)(q.Z,{title:n.values.id?"\u7F16\u8F91":"\u65B0\u5EFA",width:640,visible:n.createModalVisible,bodyStyle:{padding:"32px 40px 48px"},footer:null,onCancel:function(){n.onCancel()},destroyOnClose:!0,maskClosable:!1,children:(0,e.jsxs)(j.Z,{preserve:!1,layout:"horizontal",labelCol:{span:4},initialValues:n.values,onFinish:n.onFinish,children:[(0,e.jsx)(j.Z.Item,{name:"id",hidden:!0,children:(0,e.jsx)(E.Z,{})}),(0,e.jsx)(j.Z.Item,{name:"value",label:"\u5B57\u5178\u503C",rules:[{required:!0,max:64}],children:(0,e.jsx)(E.Z,{placeholder:"\u8BF7\u8F93\u5165\u5B57\u5178\u503C"})}),(0,e.jsx)(j.Z.Item,{name:"code",label:"\u5B57\u5178\u7F16\u7801",rules:[{required:!0,max:64}],children:(0,e.jsx)(E.Z,{placeholder:"\u8BF7\u8F93\u5165\u5B57\u5178\u7F16\u7801"})}),(0,e.jsx)(j.Z.Item,{name:"typeId",label:"\u5B57\u5178\u7C7B\u578B",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B57\u5178\u7C7B\u578B"}],children:(0,e.jsx)(C.Z,{children:n.typeNameData.map(function(t,u){return(0,e.jsx)(C.Z.Option,{index:u,value:t.typeId,children:t.text},t.typeId)})})}),(0,e.jsx)(j.Z.Item,{name:"status",label:"\u72B6\u6001",defaultValue:n.values.status,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001"}],children:(0,e.jsx)(C.Z,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",children:(0,e.jsxs)(p,{children:[(0,e.jsx)(C.Z.Option,{value:"0",children:"\u6B63\u5E38"}),(0,e.jsx)(C.Z.Option,{value:"1",children:"\u505C\u7528"})]})})}),(0,e.jsx)(j.Z.Item,{name:"remark",label:"\u5907\u6CE8",rules:[{required:!0,max:200}],children:(0,e.jsx)(E.Z,{placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"})}),(0,e.jsx)(j.Z.Item,{children:(0,e.jsx)(R.Z,{type:"primary",htmlType:"submit",children:"\u4FDD\u5B58"})})]})})},ee=_,b=a(11849),g=a(48971),I={GetDictData:function(n){return(0,g.WY)("/kitchen/api/dict-data/dict-data",{method:"Post",data:n})},AddDictData:function(n){return(0,g.WY)("/kitchen/api/dict-data",{method:"POST",data:(0,b.Z)({},n)})},UpdateDictData:function(n){return(0,g.WY)("/kitchen/api/dict-data",{method:"PUT",data:(0,b.Z)({},n)})},removeDictData:function(n){return(0,g.WY)("/kitchen/api/dict-data",{method:"DELETE",data:n})},getDictTypeList:function(){return(0,g.WY)("/kitchen/api/select/dicttype",{method:"Get"})}},te=function(){var v=(0,Z.Z)(i().mark(function n(f){return i().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,I.AddDictData(f).then(function(u){u.data?h.default.success("\u6DFB\u52A0\u6210\u529F"):h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 3:return t.abrupt("return",!0);case 6:return t.prev=6,t.t0=t.catch(0),h.default.error("\u6DFB\u52A0\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),t.abrupt("return",!1);case 10:case"end":return t.stop()}},n,null,[[0,6]])}));return function(f){return v.apply(this,arguments)}}(),ae=function(){var v=(0,Z.Z)(i().mark(function n(f){return i().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,I.UpdateDictData(f).then(function(u){u.data?h.default.success("\u914D\u7F6E\u6210\u529F"):h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01")});case 3:return t.abrupt("return",!0);case 6:return t.prev=6,t.t0=t.catch(0),h.default.error("\u914D\u7F6E\u5931\u8D25\u8BF7\u91CD\u8BD5\uFF01"),t.abrupt("return",!1);case 10:case"end":return t.stop()}},n,null,[[0,6]])}));return function(f){return v.apply(this,arguments)}}(),re=function(){var v=(0,Z.Z)(i().mark(function n(f){var p;return i().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(p=h.default.loading("\u6B63\u5728\u5220\u9664\u6570\u636E\u5B57\u5178"),f){u.next=3;break}return u.abrupt("return",!0);case 3:return u.prev=3,u.next=6,I.removeDictData(f.map(function(F){return F.id})).then(function(F){if(F.data)return p(),h.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"),!0;p(),h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")});case 6:return u.abrupt("return",!0);case 9:return u.prev=9,u.t0=u.catch(3),p(),h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"),u.abrupt("return",!1);case 14:case"end":return u.stop()}},n,null,[[3,9]])}));return function(f){return v.apply(this,arguments)}}(),ne=function(){var n=(0,D.useState)(),f=(0,x.Z)(n,2),p=f[0],t=f[1],u=(0,D.useState)({}),F=(0,x.Z)(u,2),le=F[0],A=F[1],ie=(0,D.useState)(),G=(0,x.Z)(ie,2),se=G[0],W=G[1],S=(0,D.useRef)(),de=(0,D.useState)(),w=(0,x.Z)(de,2),m=w[0],$=w[1],ce=(0,D.useState)(),M=(0,x.Z)(ce,2),B=M[0],U=M[1],oe=(0,D.useState)([]),N=(0,x.Z)(oe,2),O=N[0],fe=N[1];(0,D.useEffect)(function(){var s=function(){var l=(0,Z.Z)(i().mark(function r(d){var c,o,y;return i().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,I.getDictTypeList();case 2:c=T.sent,o=[];for(y in c.data)o.push({typeId:y.toString(),text:c.data[y.toString()]});fe(o);case 6:case"end":return T.stop()}},r)}));return function(d){return l.apply(this,arguments)}}();s()},[]);var Y=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"key",hideInSearch:!0,hideInTable:!0,render:function(l,r){return(0,e.jsx)("a",{onClick:function(){$(r),W(!0)},children:l})}},{title:"\u5B57\u5178\u503C",dataIndex:"value"},{title:"\u5B57\u5178\u7F16\u7801",dataIndex:"code"},{title:"\u5B57\u5178\u7C7B\u578B",dataIndex:"typeName",hideInForm:!0,hideInSearch:!0},{title:"\u5B57\u5178\u7C7B\u578B",dataIndex:"typeId",hideInForm:!0,hideInTable:!0,valueEnum:O},{title:"\u5907\u6CE8",dataIndex:"remark",hideInSearch:!0},{title:"\u72B6\u6001",dataIndex:"status",hideInForm:!0,valueEnum:{0:{text:"\u6B63\u5E38",status:"Processing"},1:{text:"\u505C\u7528",status:"Success"}}},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createAt",valueType:"dateTime",hideInForm:!0,hideInSearch:!0},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(l,r){return[(0,e.jsxs)("a",{onClick:function(){t(!0),A(r)},children:[" ","\u66F4\u65B0"]}),(0,e.jsx)(k.Z,{type:"primary",title:"\u786E\u8BA4\u5220\u9664\u5417\uFF1F",okText:"\u662F",cancelText:"\u5426",onConfirm:function(){I.removeDictData([r.id]).then(function(c){c.data?(h.default.success("\u5220\u9664\u6210\u529F\uFF0C\u5373\u5C06\u5237\u65B0"),S.current.reload()):h.default.error("\u5220\u9664\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")})},onCancel:function(){},children:(0,e.jsx)("a",{href:"#",children:"\u5220\u9664"})},"primary")]}}];return(0,e.jsxs)(H.ZP,{children:[(0,e.jsx)(Q.ZP,{headerTitle:"\u5B57\u5178\u4FE1\u606F\u5217\u8868",actionRef:S,rowKey:"id",search:{labelWidth:120},toolBarRender:function(){return[(0,e.jsxs)(R.Z,{type:"primary",onClick:function(){t(!0)},children:[(0,e.jsx)(K.Z,{})," \u65B0\u5EFA"]},"primary")]},request:function(){var s=(0,Z.Z)(i().mark(function l(r){var d,c;return i().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return d=[],c=0,r.typeId!=null&&(r.typeId=O[r.typeId].typeId),y.next=5,I.GetDictData(r).then(function(P){d=P.data.data,c=P.data.total});case 5:return y.abrupt("return",{data:d,success:!0,total:c});case 6:case"end":return y.stop()}},l)}));return function(l){return s.apply(this,arguments)}}(),columns:Y,rowSelection:{onChange:function(l,r){U(r)}}}),(B==null?void 0:B.length)>0&&(0,e.jsx)(J.Z,{extra:(0,e.jsxs)("div",{children:["\u5DF2\u9009\u62E9"," ",(0,e.jsx)("a",{style:{fontWeight:600},children:B.length})," ","\u9879 \xA0\xA0"]}),children:(0,e.jsx)(R.Z,{type:"primary",onClick:(0,Z.Z)(i().mark(function s(){var l,r;return i().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,re(B);case 2:U([]),(l=S.current)===null||l===void 0||(r=l.reloadAndRest)===null||r===void 0||r.call(l);case 4:case"end":return c.stop()}},s)})),children:"\u6279\u91CF\u5220\u9664"})}),(0,e.jsx)(ee,{typeNameData:O,onFinish:function(){var s=(0,Z.Z)(i().mark(function l(r){var d;return i().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(d=!1,!r.id){o.next=7;break}return o.next=4,ae(r);case 4:d=o.sent,o.next=10;break;case 7:return o.next=9,te(r);case 9:d=o.sent;case 10:d&&(t(!1),A({}),$(void 0),S.current&&S.current.reload()),S.current.reload();case 12:case"end":return o.stop()}},l)}));return function(l){return s.apply(this,arguments)}}(),onCancel:function(){t(!1),A({})},createModalVisible:p,values:le||{}}),(0,e.jsx)(L.Z,{width:600,visible:se,onClose:function(){$(void 0),W(!1)},closable:!1,children:(m==null?void 0:m.name)&&(0,e.jsx)(X.ZP,{column:2,title:m==null?void 0:m.name,request:(0,Z.Z)(i().mark(function s(){return i().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",{data:m||{}});case 1:case"end":return r.stop()}},s)})),params:{id:m==null?void 0:m.name},columns:Y})})]})},ue=ne}}]);