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 rivejä
8.9 KiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8688],{82746:function(fe,V,a){"use strict";a.r(V),a.d(V,{default:function(){return ne}});var he=a(57338),k=a(273),ve=a(57663),R=a(71577),pe=a(62350),L=a(24565),x=a(2824),l=a(39428),me=a(34792),h=a(48086),y=a(3182),K=a(49101),D=a(67294),z=a(78009),H=a(85224),J=a(53779),Q=a(12826),Ze=a(71194),X=a(50146),ye=a(9715),j=a(55843),De=a(47673),E=a(4107),je=a(43358),C=a(34041),e=a(85893),q=function(n){var f=C.Z.Option,p=C.Z.OptGroup;return(0,e.jsx)(X.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,{layout:"vertical",preserve:!1,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"})})]})})},_=q,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"})}},ee=function(){var v=(0,y.Z)((0,l.Z)().mark(function n(f){return(0,l.Z)().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)}}(),te=function(){var v=(0,y.Z)((0,l.Z)().mark(function n(f){return(0,l.Z)().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)}}(),ae=function(){var v=(0,y.Z)((0,l.Z)().mark(function n(f){var p;return(0,l.Z)().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)}}(),re=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),ue=F[0],A=F[1],ie=(0,D.useState)(),w=(0,x.Z)(ie,2),le=w[0],G=w[1],S=(0,D.useRef)(),se=(0,D.useState)(),W=(0,x.Z)(se,2),m=W[0],$=W[1],de=(0,D.useState)(),M=(0,x.Z)(de,2),B=M[0],U=M[1],ce=(0,D.useState)([]),N=(0,x.Z)(ce,2),O=N[0],oe=N[1];(0,D.useEffect)(function(){var s=function(){var i=(0,y.Z)((0,l.Z)().mark(function r(d){var c,o,Z;return(0,l.Z)().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:return T.next=2,I.getDictTypeList();case 2:c=T.sent,o=[];for(Z in c.data)o.push({typeId:Z.toString(),text:c.data[Z.toString()]});oe(o);case 6:case"end":return T.stop()}},r)}));return function(d){return i.apply(this,arguments)}}();s()},[]);var Y=[{title:"\u4E3B\u952E",dataIndex:"id",tip:"key",hideInSearch:!0,hideInTable:!0,render:function(i,r){return(0,e.jsx)("a",{onClick:function(){$(r),G(!0)},children:i})}},{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(i,r){return[(0,e.jsxs)("a",{onClick:function(){t(!0),A(r)},children:[" ","\u66F4\u65B0"]}),(0,e.jsx)(L.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)(z.ZP,{children:[(0,e.jsx)(J.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,y.Z)((0,l.Z)().mark(function i(r){var d,c;return(0,l.Z)().wrap(function(Z){for(;;)switch(Z.prev=Z.next){case 0:return d=[],c=0,r.typeId!=null&&(r.typeId=O[r.typeId].typeId),Z.next=5,I.GetDictData(r).then(function(P){d=P.data.data,c=P.data.total});case 5:return Z.abrupt("return",{data:d,success:!0,total:c});case 6:case"end":return Z.stop()}},i)}));return function(i){return s.apply(this,arguments)}}(),columns:Y,rowSelection:{onChange:function(i,r){U(r)}}}),(B==null?void 0:B.length)>0&&(0,e.jsx)(H.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,y.Z)((0,l.Z)().mark(function s(){var i,r;return(0,l.Z)().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,ae(B);case 2:U([]),(i=S.current)===null||i===void 0||(r=i.reloadAndRest)===null||r===void 0||r.call(i);case 4:case"end":return c.stop()}},s)})),children:"\u6279\u91CF\u5220\u9664"})}),(0,e.jsx)(_,{typeNameData:O,onFinish:function(){var s=(0,y.Z)((0,l.Z)().mark(function i(r){var d;return(0,l.Z)().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(d=!1,!r.id){o.next=7;break}return o.next=4,te(r);case 4:d=o.sent,o.next=10;break;case 7:return o.next=9,ee(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()}},i)}));return function(i){return s.apply(this,arguments)}}(),onCancel:function(){t(!1),A({})},createModalVisible:p,values:ue||{}}),(0,e.jsx)(k.Z,{width:600,visible:le,onClose:function(){$(void 0),G(!1)},closable:!1,children:(m==null?void 0:m.name)&&(0,e.jsx)(Q.ZP,{column:2,title:m==null?void 0:m.name,request:(0,y.Z)((0,l.Z)().mark(function s(){return(0,l.Z)().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})})]})},ne=re}}]);