xydata-tools 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/components/aaa/security-layout/index.js +1 -1
- package/dist/components/aaa/setting/permission/components/UpdateForm.js +1 -1
- package/dist/components/aaa/setting/permission/index.js +1 -1
- package/dist/components/aaa/setting/permission/service.js +1 -1
- package/dist/components/aaa/setting/requesturl/components/UpdateForm.js +1 -1
- package/dist/components/aaa/setting/requesturl/index.js +1 -1
- package/dist/components/aaa/setting/requesturl/service.js +1 -1
- package/dist/components/aaa/setting/role/components/UpdateForm.js +1 -1
- package/dist/components/aaa/setting/role/index.js +1 -1
- package/dist/components/aaa/setting/role/service.js +1 -1
- package/dist/components/aaa/setting/user/components/UpdateForm.js +1 -1
- package/dist/components/aaa/setting/user/index.js +1 -1
- package/dist/components/aaa/setting/user/service.js +1 -1
- package/dist/components/both/security-layout/index.js +1 -1
- package/dist/components/dictionary/components/UpdateForm.js +1 -1
- package/dist/components/dictionary/index.js +1 -1
- package/dist/components/dictionary/service.js +1 -1
- package/dist/components/downloadFile/index.js +9 -1
- package/dist/components/organization/components/CreatePeopleForm.js +1 -1
- package/dist/components/organization/components/CreateSubStoreForm.js +1 -1
- package/dist/components/organization/components/OrgTree.js +1 -1
- package/dist/components/organization/index.js +1 -1
- package/dist/components/organization/service.js +1 -1
- package/dist/components/sso/security-layout/index.js +1 -1
- package/dist/components/sso/setting/permRole/index.js +1 -1
- package/dist/components/sso/setting/permission/index.js +1 -1
- package/dist/components/sso/setting/role/index.js +1 -1
- package/dist/components/sso/setting/service.js +1 -1
- package/dist/components/sso/setting/user/index.js +1 -1
- package/dist/components/uploadFile/index.js +24 -1
- package/dist/index.js +1 -1
- package/dist/services/service.js +1 -1
- package/dist/utils/downloadFile.js +1 -1
- package/dist/utils/request.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a,i,u=[],c=!0,s=!1;try{if(a=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(s)throw o}}return u}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function l(e,r,t,n){var a=r&&r.prototype instanceof v?r:v,i=Object.create(a.prototype),u=new E(n||[]);return o(i,"_invoke",{value:L(e,t,u)}),i}function f(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function _(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(A([])));w&&w!==t&&n.call(w,i)&&(b=w);var j=_.prototype=v.prototype=Object.create(b);function R(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function O(e,r){function t(o,a,i,u){var c=f(e[o],e,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?r.resolve(l.__await).then((function(e){t("next",e,i,u)}),(function(e){t("throw",e,i,u)})):r.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return t("throw",e,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new r((function(r,o){t(e,n,r,o)}))}return a=a?a.then(o,o):o()}})}function L(r,t,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=S(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(r,t,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(r,t){var n=t.method,o=r.iterator[n];if(o===e)return t.delegate=null,"throw"===n&&r.iterator.return&&(t.method="return",t.arg=e,S(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,r.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,y;var i=a.arg;return i?i.done?(t[r.resultName]=i.value,t.next=r.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,y):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function k(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function T(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function A(r){if(r||""===r){var t=r[i];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function t(){for(;++o<r.length;)if(n.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(_typeof(r)+" is not iterable")}return g.prototype=_,o(j,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,c,"GeneratorFunction")),e.prototype=Object.create(j),e},r.awrap=function(e){return{__await:e}},R(O.prototype),s(O.prototype,u,(function(){return this})),r.AsyncIterator=O,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new O(l(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},R(j),s(j,c,"Generator"),s(j,i,(function(){return this})),s(j,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=A,E.prototype={constructor:E,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function o(n,o){return u.type="throw",u.arg=r,t.next=n,o&&(t.method="next",t.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),y},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),T(t),y}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;T(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={iterator:A(r),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function asyncGeneratorStep(e,r,t,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)}))}}import{PlusOutlined,ExclamationCircleOutlined}from"@ant-design/icons";import{Button,Divider,message,Modal,Checkbox,Col,Row}from"antd";import React,{useState,useRef,useEffect}from"react";import ProTable from"@ant-design/pro-table";import Auth from"../../auth";import UpdateForm from"./components/UpdateForm";import{queryRole,updateRole,addRole,removeRole,assignPerm,getRolePerms,getPermList}from"./service";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var handleAdd=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在添加"),n=!1,e.prev=2,e.next=5,addRole(_objectSpread({},r));case 5:"000000"===(o=e.sent).rspCode?(message.success("添加成功"),n=!0):message.error(o.rspMsg),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),message.error("添加失败请重试!");case 12:return t(),e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),handleUpdate=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在更新"),n=!1,e.prev=2,e.next=5,updateRole({roleName:r.roleName,roleCode:r.roleCode,id:r.id});case 5:"000000"===(o=e.sent).rspCode?(message.success("更新成功"),n=!0):message.error(o.rspMsg),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),message.error("更新失败请重试!");case 12:return t(),e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),handleRemove=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在删除"),n=!1,e.prev=2,e.next=5,removeRole(r);case 5:"000000"===(o=e.sent).rspCode?(message.success("删除成功"),n=!0):message.error(o.rspMsg),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),t(),message.error("删除失败,请重试");case 13:return t(),e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),RoleList=function(){var e=_slicedToArray(useState(!1),2),r=e[0],t=e[1],n=_slicedToArray(useState(!1),2),o=n[0],a=n[1],i=_slicedToArray(useState(!1),2),u=i[0],c=i[1],s=_slicedToArray(useState([]),2),l=s[0],f=s[1],p=_slicedToArray(useState([]),2),h=p[0],d=p[1],m=_slicedToArray(useState({}),2),y=m[0],v=m[1],g=useRef();useEffect((function(){_()}),[]);var _=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r,t,n,o,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,getPermList({});case 3:"000000"===(r=e.sent).rspCode?(t=r.data,n=[],t.forEach((function(e,r){e.moduleName?n.unshift(e.moduleName):n.push("其他")})),o=_toConsumableArray(new Set(n)),a=[],o.map((function(e){var r={moduleName:e,permList:t.filter((function(r){return r.moduleName===e||null===r.moduleName&&"其他"===e}))};a.push(r)})),d(a)):message.error(r.rspMsg),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.log(e.t0),message.error("获取权限列表失败");case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),b=[{title:"角色代码",dataIndex:"roleCode",rules:[{required:!0,message:"角色代码为必填项"}]},{title:"角色名称",dataIndex:"roleName",valueType:"textarea"},{title:"操作",dataIndex:"option",valueType:"option",render:function(e,r,t,n){return _jsxs(_Fragment,{children:[_jsxs(Auth,{code:"ROLE_EDIT",children:[_jsx("a",{onClick:function(){a(!0),v(r)},children:"编辑"}),_jsx(Divider,{type:"vertical"})]}),_jsxs(Auth,{code:"ROLE_DEL",children:[_jsx("a",{onClick:function(){var e;Modal.confirm({title:"确定删除吗?",icon:_jsx(ExclamationCircleOutlined,{}),content:"",onOk:(e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,handleRemove(r);case 2:if(!e.sent||!n){e.next=8;break}return e.next=6,n.reset();case 6:return e.next=8,n.reload();case 8:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)}),onCancel:function(){}})},children:"删除"}),_jsx(Divider,{type:"vertical"})]}),_jsx(Auth,{code:"ROLE_PERM",children:_jsx("a",{onClick:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在获取权限信息"),e.prev=1,e.next=4,getRolePerms({roleId:r.id});case 4:"000000"===(n=e.sent).rspCode?(o=n.data.map((function(e){return e.permId})),console.log(178,o),f(o),v(r),c(!0)):message.error(n.rspMsg),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),message.error("获取角色权限失败");case 11:t();case 12:case"end":return e.stop()}}),e,null,[[1,8]])}))),children:"权限"})})]})}}];return _jsxs(_Fragment,{children:[_jsx(ProTable,{headerTitle:"角色列表",actionRef:g,rowKey:"id",toolBarRender:function(){return[_jsx(Auth,{code:"ROLE_ADD",children:_jsxs(Button,{type:"primary",onClick:function(){return t(!0)},children:[_jsx(PlusOutlined,{})," 新建"]})})]},beforeSearchSubmit:function(e){return{searchObject:_objectSpread({},e)}},params:{},request:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,queryRole(r);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),columns:b,rowSelection:!1}),r?_jsx(UpdateForm,{onSubmit:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,handleAdd(r);case 2:if(!e.sent){e.next=10;break}if(t(!1),!g.current){e.next=10;break}return e.next=8,g.current.reset();case 8:return e.next=10,g.current.reload();case 10:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),onCancel:function(){t(!1)},type:"C",updateModalVisible:r,values:{}}):null,o?_jsx(UpdateForm,{onSubmit:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,handleUpdate(r);case 2:if(!e.sent){e.next=10;break}if(a(!1),!g.current){e.next=10;break}return e.next=8,g.current.reset();case 8:return e.next=10,g.current.reload();case 10:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),onCancel:function(){a(!1)},type:"U",updateModalVisible:o,values:y}):null,u?_jsx(Modal,{title:"设置权限",width:1100,open:u,onCancel:function(){c(!1)},onOk:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,assignPerm({roleId:y.id,permIds:l.join()});case 3:"000000"===(r=e.sent).rspCode?(message.success("设置成功"),c(!1)):message.error(r.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("设置权限失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),children:h.map((function(e,r){return _jsxs(Row,{style:{marginBottom:16},children:[_jsx(Col,{span:6,children:e.moduleName},r),_jsx(Col,{span:18,children:_jsx(Row,{children:e.permList.map((function(e){return _jsx(Col,{span:6,children:_jsx(Checkbox,{onChange:function(e){var r,t=e.target.value;1==e.target.checked?(r=l).push(t):r=l.filter((function(e){return e!==t})),f(r)},value:e.id,defaultChecked:!(null==l||!l.includes(e.id)),children:e.permName},e.id)},e.id)}))},e.permModule)},e.permModule)]},r)}))}):null]})};export default RoleList;
|
|
1
|
+
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,a,i,u=[],c=!0,s=!1;try{if(a=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=a.call(t)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(s)throw o}}return u}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function l(e,r,t,n){var a=r&&r.prototype instanceof v?r:v,i=Object.create(a.prototype),u=new E(n||[]);return o(i,"_invoke",{value:L(e,t,u)}),i}function f(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=l;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function _(){}var b={};s(b,i,(function(){return this}));var x=Object.getPrototypeOf,w=x&&x(x(A([])));w&&w!==t&&n.call(w,i)&&(b=w);var j=_.prototype=v.prototype=Object.create(b);function R(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function O(e,r){function t(o,a,i,u){var c=f(e[o],e,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?r.resolve(l.__await).then((function(e){t("next",e,i,u)}),(function(e){t("throw",e,i,u)})):r.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return t("throw",e,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new r((function(r,o){t(e,n,r,o)}))}return a=a?a.then(o,o):o()}})}function L(r,t,n){var o=p;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=S(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(r,t,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===y)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function S(r,t){var n=t.method,o=r.iterator[n];if(o===e)return t.delegate=null,"throw"===n&&r.iterator.return&&(t.method="return",t.arg=e,S(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var a=f(o,r.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,y;var i=a.arg;return i?i.done?(t[r.resultName]=i.value,t.next=r.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,y):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function k(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function T(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function A(r){if(r||""===r){var t=r[i];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function t(){for(;++o<r.length;)if(n.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(_typeof(r)+" is not iterable")}return g.prototype=_,o(j,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,c,"GeneratorFunction")),e.prototype=Object.create(j),e},r.awrap=function(e){return{__await:e}},R(O.prototype),s(O.prototype,u,(function(){return this})),r.AsyncIterator=O,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new O(l(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},R(j),s(j,c,"Generator"),s(j,i,(function(){return this})),s(j,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=A,E.prototype={constructor:E,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function o(n,o){return u.type="throw",u.arg=r,t.next=n,o&&(t.method="next",t.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),y},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),T(t),y}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;T(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={iterator:A(r),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function asyncGeneratorStep(e,r,t,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var a=e.apply(r,t);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)}))}}import{PlusOutlined,ExclamationCircleOutlined}from"@ant-design/icons";import{Button,Divider,message,Modal,Checkbox,Col,Row}from"antd";import React,{useState,useRef,useEffect}from"react";import ProTable from"@ant-design/pro-table";import Auth from"../../auth";import UpdateForm from"./components/UpdateForm";import{queryRole,updateRole,addRole,removeRole,assignPerm,getRolePerms,getPermList}from"./service";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var handleAdd=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在添加"),n=!1,e.prev=2,e.next=5,addRole(_objectSpread({},r));case 5:"000000"===(o=e.sent).rspCode?(message.success("添加成功"),n=!0):message.error(o.rspMsg),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),message.error("添加失败请重试!");case 12:return t(),e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),handleUpdate=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在更新"),n=!1,e.prev=2,e.next=5,updateRole({roleName:r.roleName,roleCode:r.roleCode,id:r.id});case 5:"000000"===(o=e.sent).rspCode?(message.success("更新成功"),n=!0):message.error(o.rspMsg),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),message.error("更新失败请重试!");case 12:return t(),e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),handleRemove=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在删除"),n=!1,e.prev=2,e.next=5,removeRole(r);case 5:"000000"===(o=e.sent).rspCode?(message.success("删除成功"),n=!0):message.error(o.rspMsg),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),t(),message.error("删除失败,请重试");case 13:return t(),e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[2,9]])})));return function(r){return e.apply(this,arguments)}}(),RoleList=function(){var e=_slicedToArray(useState(!1),2),r=e[0],t=e[1],n=_slicedToArray(useState(!1),2),o=n[0],a=n[1],i=_slicedToArray(useState(!1),2),u=i[0],c=i[1],s=_slicedToArray(useState([]),2),l=s[0],f=s[1],p=_slicedToArray(useState([]),2),h=p[0],d=p[1],m=_slicedToArray(useState({}),2),y=m[0],v=m[1],g=useRef();useEffect((function(){_()}),[]);var _=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r,t,n,o,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,getPermList({});case 3:"000000"===(r=e.sent).rspCode?(t=r.data,n=[],t.forEach((function(e,r){e.moduleName?n.unshift(e.moduleName):n.push("其他")})),o=_toConsumableArray(new Set(n)),a=[],o.map((function(e){var r={moduleName:e,permList:t.filter((function(r){return r.moduleName===e||null===r.moduleName&&"其他"===e}))};a.push(r)})),d(a)):message.error(r.rspMsg),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.log(e.t0),message.error("获取权限列表失败");case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),b=[{title:"角色代码",dataIndex:"roleCode",rules:[{required:!0,message:"角色代码为必填项"}]},{title:"角色名称",dataIndex:"roleName",valueType:"textarea"},{title:"操作",dataIndex:"option",valueType:"option",render:function(e,r,t,n){return _jsxs(_Fragment,{children:[_jsxs(Auth,{code:"ROLE_EDIT",children:[_jsx("a",{onClick:function(){a(!0),v(r)},children:"编辑"}),_jsx(Divider,{type:"vertical"})]}),_jsxs(Auth,{code:"ROLE_DEL",children:[_jsx("a",{onClick:function(){var e;Modal.confirm({title:"确定删除吗?",icon:_jsx(ExclamationCircleOutlined,{}),content:"",onOk:(e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,handleRemove(r);case 2:if(!e.sent||!n){e.next=8;break}return e.next=6,n.reset();case 6:return e.next=8,n.reload();case 8:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)}),onCancel:function(){}})},children:"删除"}),_jsx(Divider,{type:"vertical"})]}),_jsx(Auth,{code:"ROLE_PERM",children:_jsx("a",{onClick:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在获取权限信息"),e.prev=1,e.next=4,getRolePerms({roleId:r.id});case 4:"000000"===(n=e.sent).rspCode?(o=n.data.map((function(e){return e.permId})),console.log(178,o),f(o),v(r),c(!0)):message.error(n.rspMsg),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),message.error("获取角色权限失败");case 11:t();case 12:case"end":return e.stop()}}),e,null,[[1,8]])}))),children:"权限"})})]})}}];return _jsxs(_Fragment,{children:[_jsx(ProTable,{headerTitle:"角色列表",actionRef:g,rowKey:"id",toolBarRender:function(){return[_jsx(Auth,{code:"ROLE_ADD",children:_jsxs(Button,{type:"primary",onClick:function(){return t(!0)},children:[_jsx(PlusOutlined,{})," 新建"]})})]},beforeSearchSubmit:function(e){return{searchObject:_objectSpread({},e)}},params:{},request:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,queryRole(r);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),columns:b,rowSelection:!1}),r?_jsx(UpdateForm,{onSubmit:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,handleAdd(r);case 2:if(!e.sent){e.next=10;break}if(t(!1),!g.current){e.next=10;break}return e.next=8,g.current.reset();case 8:return e.next=10,g.current.reload();case 10:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),onCancel:function(){t(!1)},type:"C",updateModalVisible:r,values:{}}):null,o?_jsx(UpdateForm,{onSubmit:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,handleUpdate(r);case 2:if(!e.sent){e.next=10;break}if(a(!1),!g.current){e.next=10;break}return e.next=8,g.current.reset();case 8:return e.next=10,g.current.reload();case 10:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),onCancel:function(){a(!1)},type:"U",updateModalVisible:o,values:y}):null,u?_jsx(Modal,{title:"设置权限",width:1100,open:u,onCancel:function(){c(!1)},onOk:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,assignPerm({roleId:y.id,permIds:l.join()});case 3:"000000"===(r=e.sent).rspCode?(message.success("设置成功"),c(!1)):message.error(r.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("设置权限失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),children:h.map((function(e,r){return _jsxs(Row,{style:{marginBottom:16},children:[_jsx(Col,{span:6,children:e.moduleName},r),_jsx(Col,{span:18,children:_jsx(Row,{children:e.permList.map((function(e){return _jsx(Col,{span:6,children:_jsx(Checkbox,{onChange:function(e){var r,t=e.target.value;1==e.target.checked?(r=l).push(t):r=l.filter((function(e){return e!==t})),f(r)},value:e.id,defaultChecked:!(null==l||!l.includes(e.id)),children:e.permName},e.id)},e.id)}))},e.permModule)},e.permModule)]},r)}))}):null]})};export default RoleList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),u=new G(n||[]);return o(i,"_invoke",{value:E(t,r,u)}),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",d={};function v(){}function g(){}function _(){}var w={};s(w,i,(function(){return this}));var R=Object.getPrototypeOf,b=R&&R(R(k([])));b&&b!==r&&n.call(b,i)&&(w=b);var x=_.prototype=v.prototype=Object.create(w);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,a,i,u){var c=l(t[o],t,a);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==_typeof(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,i,u)}),(function(t){r("throw",t,i,u)})):e.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function E(e,r,n){var o=p;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=l(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,d;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(_typeof(e)+" is not iterable")}return g.prototype=_,o(x,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},L(P.prototype),s(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new P(f(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(x),s(x,c,"Generator"),s(x,i,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=k,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){asyncGeneratorStep(a,n,o,i,u,"next",t)}function u(t){asyncGeneratorStep(a,n,o,i,u,"throw",t)}i(void 0)}))}}import doRequest from"../../../../utils/request.js";export function queryRole(t){return _queryRole.apply(this,arguments)}function _queryRole(){return(_queryRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/list","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function removeRole(t){return _removeRole.apply(this,arguments)}function _removeRole(){return(_removeRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/del","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function addRole(t){return _addRole.apply(this,arguments)}function _addRole(){return(_addRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/add","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function updateRole(t){return _updateRole.apply(this,arguments)}function _updateRole(){return(_updateRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/update","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function assignPerm(t){return _assignPerm.apply(this,arguments)}function _assignPerm(){return(_assignPerm=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/assign","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getRolePerms(t){return _getRolePerms.apply(this,arguments)}function _getRolePerms(){return(_getRolePerms=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/rolePerms","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getPermList(t){return _getPermList.apply(this,arguments)}function _getPermList(){return(_getPermList=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/perm/listNotPage","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}
|
|
1
|
+
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),u=new G(n||[]);return o(i,"_invoke",{value:E(t,r,u)}),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",d={};function v(){}function g(){}function _(){}var w={};s(w,i,(function(){return this}));var R=Object.getPrototypeOf,b=R&&R(R(k([])));b&&b!==r&&n.call(b,i)&&(w=b);var x=_.prototype=v.prototype=Object.create(w);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,a,i,u){var c=l(t[o],t,a);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==_typeof(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,i,u)}),(function(t){r("throw",t,i,u)})):e.resolve(f).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function E(e,r,n){var o=p;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?m:h,s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=l(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,d;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(_typeof(e)+" is not iterable")}return g.prototype=_,o(x,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:g,configurable:!0}),g.displayName=s(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},L(P.prototype),s(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new P(f(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(x),s(x,c,"Generator"),s(x,i,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=k,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){asyncGeneratorStep(a,n,o,i,u,"next",t)}function u(t){asyncGeneratorStep(a,n,o,i,u,"throw",t)}i(void 0)}))}}import doRequest from"../../../../utils/request.js";export function queryRole(t){return _queryRole.apply(this,arguments)}function _queryRole(){return(_queryRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/list","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function removeRole(t){return _removeRole.apply(this,arguments)}function _removeRole(){return(_removeRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/del","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function addRole(t){return _addRole.apply(this,arguments)}function _addRole(){return(_addRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/add","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function updateRole(t){return _updateRole.apply(this,arguments)}function _updateRole(){return(_updateRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/update","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function assignPerm(t){return _assignPerm.apply(this,arguments)}function _assignPerm(){return(_assignPerm=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/assign","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getRolePerms(t){return _getRolePerms.apply(this,arguments)}function _getRolePerms(){return(_getRolePerms=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/rolePerms","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getPermList(t){return _getPermList.apply(this,arguments)}function _getPermList(){return(_getPermList=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/perm/listNotPage","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:L(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",d={};function v(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(I([])));x&&x!==r&&n.call(x,a)&&(w=x);var j=b.prototype=v.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==_typeof(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,r,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?m:h,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(_typeof(e)+" is not iterable")}return g.prototype=b,o(j,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},O(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(j),l(j,u,"Generator"),l(j,a,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(F),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;F(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach((function(e){_defineProperty(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,c,"next",t)}function c(t){asyncGeneratorStep(i,n,o,a,c,"throw",t)}a(void 0)}))}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}import React from"react";import{Form,DatePicker,Input,Modal,Select}from"antd";import moment from"moment";import"moment/locale/zh-cn";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var FormItem=Form.Item,formLayout={labelCol:{span:7},wrapperCol:{span:13}},UpdateForm=function(t){var e=_slicedToArray(Form.useForm(),1)[0],r=t.onAdd,n=t.onUpdate,o=t.onCancel,i=t.modalVisible,a=t.type,c=t.currentItem,u=t.action;c.expired&&(c.expired=moment(c.expired,"YYYY-MM-DD HH:mm:ss"));var l=function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var i;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.validateFields();case 2:(i=t.sent).expired&&(i.expired=new Date(i.expired.format("YYYY-MM-DD HH:mm:ss")).getTime()),"U"===a&&n(_objectSpread(_objectSpread({},c),i),u.current,o),"C"===a&&(i.password="123",r(i,u.current,o));case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return _jsx(Modal,{width:640,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"C"===a?"新增用户":"编辑用户",open:i,onOk:function(){return l()},onCancel:o,children:_jsx(Form,_objectSpread(_objectSpread({},formLayout),{},{form:e,initialValues:c,children:_jsxs(_Fragment,{children:[_jsx(FormItem,{name:"username",label:"用户名",rules:[{required:!0,message:"请输入用户名!",whitespace:!0}],children:_jsx(Input,{placeholder:"请输入用户名"})}),_jsx(FormItem,{name:"expired",label:"过期时间",rules:[],children:_jsx(DatePicker,{style:{width:"100%"},showTime:!0,placeholder:"请输入过期时间"})}),_jsx(FormItem,{name:"enabled",label:"是否启用",rules:[{required:!0,message:"请选择是否启用"}],children:_jsxs(Select,{placeholder:"请选择是否启用",children:[_jsx(Select.Option,{value:1,children:"是"},1),_jsx(Select.Option,{value:0,children:"否"},0)]})}),_jsx(FormItem,{name:"locked",label:"是否锁定",rules:[{required:!0,message:"请选择是否锁定"}],children:_jsxs(Select,{placeholder:"请选择是否锁定",children:[_jsx(Select.Option,{value:1,children:"是"},1),_jsx(Select.Option,{value:0,children:"否"},0)]})})]})}))})};export default UpdateForm;
|
|
1
|
+
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:L(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",h="suspendedYield",y="executing",m="completed",d={};function v(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,x=_&&_(_(I([])));x&&x!==r&&n.call(x,a)&&(w=x);var j=b.prototype=v.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==_typeof(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,r,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=P(c,n);if(u){if(u===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?m:h,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(_typeof(e)+" is not iterable")}return g.prototype=b,o(j,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},O(S.prototype),l(S.prototype,c,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new S(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(j),l(j,u,"Generator"),l(j,a,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(F),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;F(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function ownKeys(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach((function(e){_defineProperty(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,c,"next",t)}function c(t){asyncGeneratorStep(i,n,o,a,c,"throw",t)}a(void 0)}))}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _iterableToArrayLimit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}import React from"react";import{Form,DatePicker,Input,Modal,Select}from"antd";import moment from"moment";import"moment/locale/zh-cn";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var FormItem=Form.Item,formLayout={labelCol:{span:7},wrapperCol:{span:13}},UpdateForm=function(t){var e=_slicedToArray(Form.useForm(),1)[0],r=t.onAdd,n=t.onUpdate,o=t.onCancel,i=t.modalVisible,a=t.type,c=t.currentItem,u=t.action;c.expired&&(c.expired=moment(c.expired,"YYYY-MM-DD HH:mm:ss"));var l=function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var i;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.validateFields();case 2:(i=t.sent).expired&&(i.expired=new Date(i.expired.format("YYYY-MM-DD HH:mm:ss")).getTime()),"U"===a&&n(_objectSpread(_objectSpread({},c),i),u.current,o),"C"===a&&(i.password="123",r(i,u.current,o));case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return _jsx(Modal,{width:640,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"C"===a?"新增用户":"编辑用户",open:i,onOk:function(){return l()},onCancel:o,children:_jsx(Form,_objectSpread(_objectSpread({},formLayout),{},{form:e,initialValues:c,children:_jsxs(_Fragment,{children:[_jsx(FormItem,{name:"username",label:"用户名",rules:[{required:!0,message:"请输入用户名!",whitespace:!0}],children:_jsx(Input,{placeholder:"请输入用户名"})}),_jsx(FormItem,{name:"expired",label:"过期时间",rules:[],children:_jsx(DatePicker,{style:{width:"100%"},showTime:!0,placeholder:"请输入过期时间"})}),_jsx(FormItem,{name:"enabled",label:"是否启用",rules:[{required:!0,message:"请选择是否启用"}],children:_jsxs(Select,{placeholder:"请选择是否启用",children:[_jsx(Select.Option,{value:1,children:"是"},1),_jsx(Select.Option,{value:0,children:"否"},0)]})}),_jsx(FormItem,{name:"locked",label:"是否锁定",rules:[{required:!0,message:"请选择是否锁定"}],children:_jsxs(Select,{placeholder:"请选择是否锁定",children:[_jsx(Select.Option,{value:1,children:"是"},1),_jsx(Select.Option,{value:0,children:"否"},0)]})})]})}))})};export default UpdateForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,o,s,i=[],c=!0,u=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=o.call(t)).done)&&(i.push(n.value),i.length!==r);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw a}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(e,r,t){e[r]=t.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function l(e,r,t,n){var o=r&&r.prototype instanceof g?r:g,s=Object.create(o.prototype),i=new L(n||[]);return a(s,"_invoke",{value:R(e,t,i)}),s}function p(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=l;var f="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function g(){}function v(){}function x(){}var b={};u(b,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(A([])));w&&w!==t&&n.call(w,s)&&(b=w);var j=x.prototype=g.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function S(e,r){function t(a,o,s,i){var c=p(e[a],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?r.resolve(l.__await).then((function(e){t("next",e,s,i)}),(function(e){t("throw",e,s,i)})):r.resolve(l).then((function(e){u.value=e,s(u)}),(function(e){return t("throw",e,s,i)}))}i(c.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new r((function(r,a){t(e,n,r,a)}))}return o=o?o.then(a,a):a()}})}function R(r,t,n){var a=f;return function(o,s){if(a===h)throw new Error("Generator is already running");if(a===m){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var i=n.delegate;if(i){var c=E(i,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===f)throw a=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=h;var u=p(r,t,n);if("normal"===u.type){if(a=n.done?m:d,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(a=m,n.method="throw",n.arg=u.arg)}}}function E(r,t){var n=t.method,a=r.iterator[n];if(a===e)return t.delegate=null,"throw"===n&&r.iterator.return&&(t.method="return",t.arg=e,E(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=p(a,r.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var s=o.arg;return s?s.done?(t[r.resultName]=s.value,t.next=r.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,y):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function O(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function T(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function A(r){if(r||""===r){var t=r[s];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var a=-1,o=function t(){for(;++a<r.length;)if(n.call(r,a))return t.value=r[a],t.done=!1,t;return t.value=e,t.done=!0,t};return o.next=o}}throw new TypeError(_typeof(r)+" is not iterable")}return v.prototype=x,a(j,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:v,configurable:!0}),v.displayName=u(x,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,u(e,c,"GeneratorFunction")),e.prototype=Object.create(j),e},r.awrap=function(e){return{__await:e}},k(S.prototype),u(S.prototype,i,(function(){return this})),r.AsyncIterator=S,r.async=function(e,t,n,a,o){void 0===o&&(o=Promise);var s=new S(l(e,t,n,a),o);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},k(j),u(j,c,"Generator"),u(j,s,(function(){return this})),u(j,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=A,L.prototype={constructor:L,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function a(n,a){return i.type="throw",i.arg=r,t.next=n,a&&(t.method="next",t.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],i=s.completion;if("root"===s.tryLoc)return a("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return a(s.catchLoc,!0);if(this.prev<s.finallyLoc)return a(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return a(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return a(s.finallyLoc)}}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=r,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),y},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),T(t),y}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var a=n.arg;T(t)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={iterator:A(r),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function asyncGeneratorStep(e,r,t,n,a,o,s){try{var i=e[o](s),c=i.value}catch(e){return void t(e)}i.done?r(c):Promise.resolve(c).then(n,a)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,a){var o=e.apply(r,t);function s(e){asyncGeneratorStep(o,n,a,s,i,"next",e)}function i(e){asyncGeneratorStep(o,n,a,s,i,"throw",e)}s(void 0)}))}}import{PlusOutlined,ExclamationCircleOutlined}from"@ant-design/icons";import{Button,Divider,message,Modal,Select,Space}from"antd";import React,{useState,useRef,useEffect}from"react";import Auth from"../../auth";import ProTable from"@ant-design/pro-table";import UpdateForm from"./components/UpdateForm";import{queryUser,updateUser,addUser,removeUser,resetPassword,assignRole,lock,unlock,enable,disable,getRoleList,getUserRoles,createGitAccount}from"./service.js";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var handleAssignRole=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在更新角色"),e.prev=1,e.next=4,assignRole(_objectSpread({},r));case 4:if(o=e.sent,a(),"000000"!==o.rspCode){e.next=15;break}return message.success("操作成功"),n&&n(),e.next=11,t.reset();case 11:return e.next=13,t.reload();case 13:e.next=16;break;case 15:message.error(o.rspMsg);case 16:return e.abrupt("return",!0);case 19:return e.prev=19,e.t0=e.catch(1),a(),message.error("操作失败请重试!"),e.abrupt("return",!1);case 24:case"end":return e.stop()}}),e,null,[[1,19]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleUpdateEnable=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n,a){var o,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=message.loading("正在更新状态"),e.prev=1,s={},!t){e.next=9;break}return e.next=6,enable(_objectSpread({},r));case 6:s=e.sent,e.next=12;break;case 9:return e.next=11,disable(_objectSpread({},r));case 11:s=e.sent;case 12:if(o(),"000000"!==s.rspCode){e.next=22;break}return message.success("操作成功"),a&&a(),e.next=18,n.reset();case 18:return e.next=20,n.reload();case 20:e.next=23;break;case 22:message.error(s.rspMsg);case 23:return e.abrupt("return",!0);case 26:return e.prev=26,e.t0=e.catch(1),o(),message.error("操作失败请重试!"),e.abrupt("return",!1);case 31:case"end":return e.stop()}}),e,null,[[1,26]])})));return function(r,t,n,a){return e.apply(this,arguments)}}(),handleUpdateLock=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n,a){var o,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=message.loading("正在更新状态"),e.prev=1,s={},!t){e.next=9;break}return e.next=6,lock(_objectSpread({},r));case 6:s=e.sent,e.next=12;break;case 9:return e.next=11,unlock(_objectSpread({},r));case 11:s=e.sent;case 12:if(s.rspCode){e.next=16;break}return e.next=15,s.json();case 15:s=e.sent;case 16:if(o(),"000000"!==s.rspCode){e.next=26;break}return message.success("操作成功"),a&&a(),e.next=22,n.reset();case 22:return e.next=24,n.reload();case 24:e.next=27;break;case 26:message.error(s.rspMsg);case 27:return e.abrupt("return",!0);case 30:return e.prev=30,e.t0=e.catch(1),o(),message.error("操作失败请重试!"),e.abrupt("return",!1);case 35:case"end":return e.stop()}}),e,null,[[1,30]])})));return function(r,t,n,a){return e.apply(this,arguments)}}(),handleAdd=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在添加"),e.prev=1,e.next=4,addUser(_objectSpread({},r));case 4:if((o=e.sent).rspCode){e.next=9;break}return e.next=8,o.json();case 8:o=e.sent;case 9:if(a(),"000000"!==o.rspCode){e.next=19;break}return message.success("添加成功"),n&&n(),e.next=15,t.reset();case 15:return e.next=17,t.reload();case 17:e.next=20;break;case 19:message.error(o.rspMsg);case 20:return e.abrupt("return",!0);case 23:return e.prev=23,e.t0=e.catch(1),a(),message.error("添加失败请重试!"),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleUpdate=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在更新"),e.prev=1,e.next=4,updateUser(_objectSpread({},r));case 4:if((o=e.sent).rspCode){e.next=9;break}return e.next=8,o.json();case 8:o=e.sent;case 9:if(a(),"000000"!==o.rspCode){e.next=19;break}return message.success("更新成功"),n&&n(),e.next=15,t.reset();case 15:return e.next=17,t.reload();case 17:e.next=20;break;case 19:message.error(o.rspMsg);case 20:return e.abrupt("return",!0);case 23:return e.prev=23,e.t0=e.catch(1),a(),message.error("更新失败请重试!"),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleRemove=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在删除"),e.prev=1,e.next=4,removeUser(r);case 4:if((o=e.sent).rspCode){e.next=9;break}return e.next=8,o.json();case 8:o=e.sent;case 9:if(a(),"000000"!==o.rspCode){e.next=19;break}return message.success("删除成功"),n&&n(),e.next=15,t.reset();case 15:return e.next=17,t.reload();case 17:e.next=20;break;case 19:message.error(o.rspMsg);case 20:return e.abrupt("return",!0);case 23:return e.prev=23,e.t0=e.catch(1),a(),message.error("删除失败,请重试"),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleResetPassword=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在重置密码"),e.prev=1,e.next=4,resetPassword(r);case 4:if((n=e.sent).rspCode){e.next=9;break}return e.next=8,n.json();case 8:n=e.sent;case 9:return t(),"000000"===n.rspCode?message.success("重置密码成功"):message.error(n.rspMsg),e.abrupt("return",!0);case 14:return e.prev=14,e.t0=e.catch(1),t(),message.error("重置密码失败,请重试"),e.abrupt("return",!1);case 19:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(r){return e.apply(this,arguments)}}(),UserList=function(e){var r=_slicedToArray(useState(!1),2),t=r[0],n=r[1],a=_slicedToArray(useState(!1),2),o=a[0],s=a[1],i=_slicedToArray(useState([]),2),c=i[0],u=i[1],l=_slicedToArray(useState({}),2),p=l[0],f=l[1],d=_slicedToArray(useState("C"),2),h=d[0],m=d[1],y=_slicedToArray(useState([]),2),g=y[0],v=y[1],x=useRef();useEffect((function(){_()}),[]);var b=[{title:"用户名",dataIndex:"username"},{title:"姓名",dataIndex:"realName"},{title:"是否启用",dataIndex:"enabled",valueEnum:{0:{text:"否",enabled:0},1:{text:"是",enabled:1}},fieldProps:{getPopupContainer:function(e){return e.parentNode}},filters:!1},{title:"过期时间",dataIndex:"expired",valueType:"dateTime"},{title:"是否锁定",dataIndex:"locked",valueEnum:{0:{text:"否",locked:0},1:{text:"是",locked:1}},fieldProps:{getPopupContainer:function(e){return e.parentNode}},filters:!1},{title:"操作",dataIndex:"option",valueType:"option",render:function(e,r,t,a){return _jsxs(Space,{split:_jsx(Divider,{type:"vertical"}),size:2,children:[_jsx(Auth,{code:"USER_EDIT",children:_jsx("a",{onClick:function(){n(!0),f(r),m("U")},children:"编辑"})}),_jsx(Auth,{code:"USER_LOCK",children:_jsx("a",{onClick:function(){var e=!1;0===r.locked&&(e=!0),handleUpdateLock({id:r.id},e,a,(function(){}))},children:0===r.locked?"锁定":"解锁"})}),_jsx(Auth,{code:"USER_ENABLE",children:_jsx("a",{onClick:function(){var e=!1;0===r.enabled&&(e=!0),handleUpdateEnable({id:r.id},e,a,(function(){}))},children:0===r.enabled?"启用":"停用"})}),_jsx(Auth,{code:"USER_DEL",children:_jsx("a",{onClick:function(){Modal.confirm({title:"确定删除吗?",icon:_jsx(ExclamationCircleOutlined,{}),content:"",onOk:function(){"1"!==r.id?handleRemove(r,a):message.error("超级管理员无法被删除")},onCancel:function(){}})},children:"删除"})}),_jsx(Auth,{code:"RESET_PASSWORD",children:_jsx("a",{onClick:function(){Modal.confirm({title:"确定重置密码吗?",icon:_jsx(ExclamationCircleOutlined,{}),content:"",onOk:function(){handleResetPassword(r)},onCancel:function(){}})},children:"重置密码"})}),_jsx(Auth,{code:"USER_ROLE",children:_jsx("a",{onClick:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在获取角色信息"),e.prev=1,e.next=4,getUserRoles({userId:r.id});case 4:"000000"===(n=e.sent).rspCode?(a=n.data.map((function(e){return e.roleId})),u(a),f(r),s(!0)):message.error(n.rspMsg),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),message.error("获取用户角色失败");case 11:t();case 12:case"end":return e.stop()}}),e,null,[[1,8]])}))),children:"角色"})}),_jsx(Auth,{code:"CREATE_GIT",children:_jsx("a",{onClick:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,createGitAccount({userId:r.id});case 3:"000000"===(t=e.sent).rspCode?message.success("创建成功!"):message.error(t.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("创建失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),children:"创建git账号"})})]})}}],_=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,getRoleList({});case 3:"000000"===(r=e.sent).rspCode?v(r.data):message.error(r.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("获取角色列表失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();return _jsxs(_Fragment,{children:[_jsx(ProTable,{headerTitle:"用户列表",actionRef:x,rowKey:"id",toolBarRender:function(){return[_jsx(Auth,{code:"USER_ADD",children:_jsxs(Button,{type:"primary",onClick:function(){n(!0),f({}),m("C")},children:[_jsx(PlusOutlined,{})," 新建"]})})]},beforeSearchSubmit:function(e){return e.expired&&(e.expired=new Date(e.expired).getTime()),{searchObject:_objectSpread({},e)}},params:{},request:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,queryUser(r);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),pagination:{showSizeChanger:!0},columns:b,rowSelection:!1}),t?_jsx(UpdateForm,{onAdd:handleAdd,onUpdate:handleUpdate,onCancel:function(){n(!1)},type:h,modalVisible:t,currentItem:p,action:x}):null,o?_jsx(Modal,{title:"设置角色",open:o,onCancel:function(){s(!1)},onOk:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,assignRole({userId:p.id,roleIds:c.join()});case 3:"000000"===(r=e.sent).rspCode?(message.success("设置成功"),s(!1)):message.error(r.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("设置角色失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),children:_jsx(Select,{value:c,onChange:function(e){u(e)},mode:"multiple",style:{width:"100%"},children:g.map((function(e){return _jsx(Select.Option,{value:e.id,children:e.roleName},e.id)}))})}):null]})};export default UserList;
|
|
1
|
+
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,a,o,s,i=[],c=!0,u=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=o.call(t)).done)&&(i.push(n.value),i.length!==r);c=!0);}catch(e){u=!0,a=e}finally{try{if(!c&&null!=t.return&&(s=t.return(),Object(s)!==s))return}finally{if(u)throw a}}return i}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return r};var e,r={},t=Object.prototype,n=t.hasOwnProperty,a=Object.defineProperty||function(e,r,t){e[r]=t.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function l(e,r,t,n){var o=r&&r.prototype instanceof g?r:g,s=Object.create(o.prototype),i=new L(n||[]);return a(s,"_invoke",{value:R(e,t,i)}),s}function p(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}r.wrap=l;var f="suspendedStart",d="suspendedYield",h="executing",m="completed",y={};function g(){}function v(){}function x(){}var b={};u(b,s,(function(){return this}));var _=Object.getPrototypeOf,w=_&&_(_(A([])));w&&w!==t&&n.call(w,s)&&(b=w);var j=x.prototype=g.prototype=Object.create(b);function k(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function S(e,r){function t(a,o,s,i){var c=p(e[a],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==_typeof(l)&&n.call(l,"__await")?r.resolve(l.__await).then((function(e){t("next",e,s,i)}),(function(e){t("throw",e,s,i)})):r.resolve(l).then((function(e){u.value=e,s(u)}),(function(e){return t("throw",e,s,i)}))}i(c.arg)}var o;a(this,"_invoke",{value:function(e,n){function a(){return new r((function(r,a){t(e,n,r,a)}))}return o=o?o.then(a,a):a()}})}function R(r,t,n){var a=f;return function(o,s){if(a===h)throw new Error("Generator is already running");if(a===m){if("throw"===o)throw s;return{value:e,done:!0}}for(n.method=o,n.arg=s;;){var i=n.delegate;if(i){var c=E(i,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===f)throw a=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=h;var u=p(r,t,n);if("normal"===u.type){if(a=n.done?m:d,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(a=m,n.method="throw",n.arg=u.arg)}}}function E(r,t){var n=t.method,a=r.iterator[n];if(a===e)return t.delegate=null,"throw"===n&&r.iterator.return&&(t.method="return",t.arg=e,E(r,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=p(a,r.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,y;var s=o.arg;return s?s.done?(t[r.resultName]=s.value,t.next=r.nextLoc,"return"!==t.method&&(t.method="next",t.arg=e),t.delegate=null,y):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function O(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function T(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function A(r){if(r||""===r){var t=r[s];if(t)return t.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var a=-1,o=function t(){for(;++a<r.length;)if(n.call(r,a))return t.value=r[a],t.done=!1,t;return t.value=e,t.done=!0,t};return o.next=o}}throw new TypeError(_typeof(r)+" is not iterable")}return v.prototype=x,a(j,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:v,configurable:!0}),v.displayName=u(x,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,u(e,c,"GeneratorFunction")),e.prototype=Object.create(j),e},r.awrap=function(e){return{__await:e}},k(S.prototype),u(S.prototype,i,(function(){return this})),r.AsyncIterator=S,r.async=function(e,t,n,a,o){void 0===o&&(o=Promise);var s=new S(l(e,t,n,a),o);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},k(j),u(j,c,"Generator"),u(j,s,(function(){return this})),u(j,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=A,L.prototype={constructor:L,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!r)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var t=this;function a(n,a){return i.type="throw",i.arg=r,t.next=n,a&&(t.method="next",t.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],i=s.completion;if("root"===s.tryLoc)return a("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return a(s.catchLoc,!0);if(this.prev<s.finallyLoc)return a(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return a(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return a(s.finallyLoc)}}}},abrupt:function(e,r){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=r,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),y},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),T(t),y}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var a=n.arg;T(t)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(r,t,n){return this.delegate={iterator:A(r),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(e,r){if("object"!=_typeof(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function asyncGeneratorStep(e,r,t,n,a,o,s){try{var i=e[o](s),c=i.value}catch(e){return void t(e)}i.done?r(c):Promise.resolve(c).then(n,a)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,a){var o=e.apply(r,t);function s(e){asyncGeneratorStep(o,n,a,s,i,"next",e)}function i(e){asyncGeneratorStep(o,n,a,s,i,"throw",e)}s(void 0)}))}}import{PlusOutlined,ExclamationCircleOutlined}from"@ant-design/icons";import{Button,Divider,message,Modal,Select,Space}from"antd";import React,{useState,useRef,useEffect}from"react";import Auth from"../../auth";import ProTable from"@ant-design/pro-table";import UpdateForm from"./components/UpdateForm";import{queryUser,updateUser,addUser,removeUser,resetPassword,assignRole,lock,unlock,enable,disable,getRoleList,getUserRoles,createGitAccount}from"./service.js";import{jsx as _jsx}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";var handleAssignRole=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在更新角色"),e.prev=1,e.next=4,assignRole(_objectSpread({},r));case 4:if(o=e.sent,a(),"000000"!==o.rspCode){e.next=15;break}return message.success("操作成功"),n&&n(),e.next=11,t.reset();case 11:return e.next=13,t.reload();case 13:e.next=16;break;case 15:message.error(o.rspMsg);case 16:return e.abrupt("return",!0);case 19:return e.prev=19,e.t0=e.catch(1),a(),message.error("操作失败请重试!"),e.abrupt("return",!1);case 24:case"end":return e.stop()}}),e,null,[[1,19]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleUpdateEnable=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n,a){var o,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=message.loading("正在更新状态"),e.prev=1,s={},!t){e.next=9;break}return e.next=6,enable(_objectSpread({},r));case 6:s=e.sent,e.next=12;break;case 9:return e.next=11,disable(_objectSpread({},r));case 11:s=e.sent;case 12:if(o(),"000000"!==s.rspCode){e.next=22;break}return message.success("操作成功"),a&&a(),e.next=18,n.reset();case 18:return e.next=20,n.reload();case 20:e.next=23;break;case 22:message.error(s.rspMsg);case 23:return e.abrupt("return",!0);case 26:return e.prev=26,e.t0=e.catch(1),o(),message.error("操作失败请重试!"),e.abrupt("return",!1);case 31:case"end":return e.stop()}}),e,null,[[1,26]])})));return function(r,t,n,a){return e.apply(this,arguments)}}(),handleUpdateLock=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n,a){var o,s;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=message.loading("正在更新状态"),e.prev=1,s={},!t){e.next=9;break}return e.next=6,lock(_objectSpread({},r));case 6:s=e.sent,e.next=12;break;case 9:return e.next=11,unlock(_objectSpread({},r));case 11:s=e.sent;case 12:if(s.rspCode){e.next=16;break}return e.next=15,s.json();case 15:s=e.sent;case 16:if(o(),"000000"!==s.rspCode){e.next=26;break}return message.success("操作成功"),a&&a(),e.next=22,n.reset();case 22:return e.next=24,n.reload();case 24:e.next=27;break;case 26:message.error(s.rspMsg);case 27:return e.abrupt("return",!0);case 30:return e.prev=30,e.t0=e.catch(1),o(),message.error("操作失败请重试!"),e.abrupt("return",!1);case 35:case"end":return e.stop()}}),e,null,[[1,30]])})));return function(r,t,n,a){return e.apply(this,arguments)}}(),handleAdd=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在添加"),e.prev=1,e.next=4,addUser(_objectSpread({},r));case 4:if((o=e.sent).rspCode){e.next=9;break}return e.next=8,o.json();case 8:o=e.sent;case 9:if(a(),"000000"!==o.rspCode){e.next=19;break}return message.success("添加成功"),n&&n(),e.next=15,t.reset();case 15:return e.next=17,t.reload();case 17:e.next=20;break;case 19:message.error(o.rspMsg);case 20:return e.abrupt("return",!0);case 23:return e.prev=23,e.t0=e.catch(1),a(),message.error("添加失败请重试!"),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleUpdate=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在更新"),e.prev=1,e.next=4,updateUser(_objectSpread({},r));case 4:if((o=e.sent).rspCode){e.next=9;break}return e.next=8,o.json();case 8:o=e.sent;case 9:if(a(),"000000"!==o.rspCode){e.next=19;break}return message.success("更新成功"),n&&n(),e.next=15,t.reset();case 15:return e.next=17,t.reload();case 17:e.next=20;break;case 19:message.error(o.rspMsg);case 20:return e.abrupt("return",!0);case 23:return e.prev=23,e.t0=e.catch(1),a(),message.error("更新失败请重试!"),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleRemove=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r,t,n){var a,o;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=message.loading("正在删除"),e.prev=1,e.next=4,removeUser(r);case 4:if((o=e.sent).rspCode){e.next=9;break}return e.next=8,o.json();case 8:o=e.sent;case 9:if(a(),"000000"!==o.rspCode){e.next=19;break}return message.success("删除成功"),n&&n(),e.next=15,t.reset();case 15:return e.next=17,t.reload();case 17:e.next=20;break;case 19:message.error(o.rspMsg);case 20:return e.abrupt("return",!0);case 23:return e.prev=23,e.t0=e.catch(1),a(),message.error("删除失败,请重试"),e.abrupt("return",!1);case 28:case"end":return e.stop()}}),e,null,[[1,23]])})));return function(r,t,n){return e.apply(this,arguments)}}(),handleResetPassword=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在重置密码"),e.prev=1,e.next=4,resetPassword(r);case 4:if((n=e.sent).rspCode){e.next=9;break}return e.next=8,n.json();case 8:n=e.sent;case 9:return t(),"000000"===n.rspCode?message.success("重置密码成功"):message.error(n.rspMsg),e.abrupt("return",!0);case 14:return e.prev=14,e.t0=e.catch(1),t(),message.error("重置密码失败,请重试"),e.abrupt("return",!1);case 19:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(r){return e.apply(this,arguments)}}(),UserList=function(e){var r=_slicedToArray(useState(!1),2),t=r[0],n=r[1],a=_slicedToArray(useState(!1),2),o=a[0],s=a[1],i=_slicedToArray(useState([]),2),c=i[0],u=i[1],l=_slicedToArray(useState({}),2),p=l[0],f=l[1],d=_slicedToArray(useState("C"),2),h=d[0],m=d[1],y=_slicedToArray(useState([]),2),g=y[0],v=y[1],x=useRef();useEffect((function(){_()}),[]);var b=[{title:"用户名",dataIndex:"username"},{title:"姓名",dataIndex:"realName"},{title:"是否启用",dataIndex:"enabled",valueEnum:{0:{text:"否",enabled:0},1:{text:"是",enabled:1}},fieldProps:{getPopupContainer:function(e){return e.parentNode}},filters:!1},{title:"过期时间",dataIndex:"expired",valueType:"dateTime"},{title:"是否锁定",dataIndex:"locked",valueEnum:{0:{text:"否",locked:0},1:{text:"是",locked:1}},fieldProps:{getPopupContainer:function(e){return e.parentNode}},filters:!1},{title:"操作",dataIndex:"option",valueType:"option",render:function(e,r,t,a){return _jsxs(Space,{split:_jsx(Divider,{type:"vertical"}),size:2,children:[_jsx(Auth,{code:"USER_EDIT",children:_jsx("a",{onClick:function(){n(!0),f(r),m("U")},children:"编辑"})}),_jsx(Auth,{code:"USER_LOCK",children:_jsx("a",{onClick:function(){var e=!1;0===r.locked&&(e=!0),handleUpdateLock({id:r.id},e,a,(function(){}))},children:0===r.locked?"锁定":"解锁"})}),_jsx(Auth,{code:"USER_ENABLE",children:_jsx("a",{onClick:function(){var e=!1;0===r.enabled&&(e=!0),handleUpdateEnable({id:r.id},e,a,(function(){}))},children:0===r.enabled?"启用":"停用"})}),_jsx(Auth,{code:"USER_DEL",children:_jsx("a",{onClick:function(){Modal.confirm({title:"确定删除吗?",icon:_jsx(ExclamationCircleOutlined,{}),content:"",onOk:function(){"1"!==r.id?handleRemove(r,a):message.error("超级管理员无法被删除")},onCancel:function(){}})},children:"删除"})}),_jsx(Auth,{code:"RESET_PASSWORD",children:_jsx("a",{onClick:function(){Modal.confirm({title:"确定重置密码吗?",icon:_jsx(ExclamationCircleOutlined,{}),content:"",onOk:function(){handleResetPassword(r)},onCancel:function(){}})},children:"重置密码"})}),_jsx(Auth,{code:"USER_ROLE",children:_jsx("a",{onClick:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=message.loading("正在获取角色信息"),e.prev=1,e.next=4,getUserRoles({userId:r.id});case 4:"000000"===(n=e.sent).rspCode?(a=n.data.map((function(e){return e.roleId})),u(a),f(r),s(!0)):message.error(n.rspMsg),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),message.error("获取用户角色失败");case 11:t();case 12:case"end":return e.stop()}}),e,null,[[1,8]])}))),children:"角色"})}),_jsx(Auth,{code:"CREATE_GIT",children:_jsx("a",{onClick:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,createGitAccount({userId:r.id});case 3:"000000"===(t=e.sent).rspCode?message.success("创建成功!"):message.error(t.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("创建失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),children:"创建git账号"})})]})}}],_=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,getRoleList({});case 3:"000000"===(r=e.sent).rspCode?v(r.data):message.error(r.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("获取角色列表失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();return _jsxs(_Fragment,{children:[_jsx(ProTable,{headerTitle:"用户列表",actionRef:x,rowKey:"id",toolBarRender:function(){return[_jsx(Auth,{code:"USER_ADD",children:_jsxs(Button,{type:"primary",onClick:function(){n(!0),f({}),m("C")},children:[_jsx(PlusOutlined,{})," 新建"]})})]},beforeSearchSubmit:function(e){return e.expired&&(e.expired=new Date(e.expired).getTime()),{searchObject:_objectSpread({},e)}},params:{},request:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,queryUser(r);case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),pagination:{showSizeChanger:!0},columns:b,rowSelection:!1}),t?_jsx(UpdateForm,{onAdd:handleAdd,onUpdate:handleUpdate,onCancel:function(){n(!1)},type:h,modalVisible:t,currentItem:p,action:x}):null,o?_jsx(Modal,{title:"设置角色",open:o,onCancel:function(){s(!1)},onOk:_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,assignRole({userId:p.id,roleIds:c.join()});case 3:"000000"===(r=e.sent).rspCode?(message.success("设置成功"),s(!1)):message.error(r.rspMsg),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),message.error("设置角色失败");case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),children:_jsx(Select,{value:c,onChange:function(e){u(e)},mode:"multiple",style:{width:"100%"},children:g.map((function(e){return _jsx(Select.Option,{value:e.id,children:e.roleName},e.id)}))})}):null]})};export default UserList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var a=e&&e.prototype instanceof m?e:m,i=Object.create(a.prototype),u=new S(n||[]);return o(i,"_invoke",{value:k(t,r,u)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var l="suspendedStart",h="suspendedYield",y="executing",d="completed",g={};function m(){}function _(){}function v(){}var w={};s(w,i,(function(){return this}));var b=Object.getPrototypeOf,R=b&&b(b(E([])));R&&R!==r&&n.call(R,i)&&(w=R);var x=v.prototype=m.prototype=Object.create(w);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(o,a,i,u){var c=f(t[o],t,a);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==_typeof(p)&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,i,u)}),(function(t){r("throw",t,i,u)})):e.resolve(p).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function k(e,r,n){var o=l;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=G(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?d:h,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function G(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,G(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function E(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(_typeof(e)+" is not iterable")}return _.prototype=v,o(x,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:_,configurable:!0}),_.displayName=s(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},L(T.prototype),s(T.prototype,u,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new T(p(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(x),s(x,c,"Generator"),s(x,i,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:E(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){asyncGeneratorStep(a,n,o,i,u,"next",t)}function u(t){asyncGeneratorStep(a,n,o,i,u,"throw",t)}i(void 0)}))}}import doRequest from"../../../../utils/request.js";export function queryUser(t){return _queryUser.apply(this,arguments)}function _queryUser(){return(_queryUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/list","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function removeUser(t){return _removeUser.apply(this,arguments)}function _removeUser(){return(_removeUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/del","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function resetPassword(t){return _resetPassword.apply(this,arguments)}function _resetPassword(){return(_resetPassword=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/resetPassword","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function addUser(t){return _addUser.apply(this,arguments)}function _addUser(){return(_addUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/add","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function updateUser(t){return _updateUser.apply(this,arguments)}function _updateUser(){return(_updateUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/update","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function assignRole(t){return _assignRole.apply(this,arguments)}function _assignRole(){return(_assignRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/assign","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function lock(t){return _lock.apply(this,arguments)}function _lock(){return(_lock=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/lock","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function unlock(t){return _unlock.apply(this,arguments)}function _unlock(){return(_unlock=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/unlock","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function enable(t){return _enable.apply(this,arguments)}function _enable(){return(_enable=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/enable","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function disable(t){return _disable.apply(this,arguments)}function _disable(){return(_disable=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/disable","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getRoleList(t){return _getRoleList.apply(this,arguments)}function _getRoleList(){return(_getRoleList=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/listNotPage","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getUserRoles(t){return _getUserRoles.apply(this,arguments)}function _getUserRoles(){return(_getUserRoles=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/userRoles","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function createGitAccount(t){return _createGitAccount.apply(this,arguments)}function _createGitAccount(){return(_createGitAccount=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/userLoc/createGitAccount","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}
|
|
1
|
+
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var a=e&&e.prototype instanceof m?e:m,i=Object.create(a.prototype),u=new S(n||[]);return o(i,"_invoke",{value:k(t,r,u)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var l="suspendedStart",h="suspendedYield",y="executing",d="completed",g={};function m(){}function _(){}function v(){}var w={};s(w,i,(function(){return this}));var b=Object.getPrototypeOf,R=b&&b(b(E([])));R&&R!==r&&n.call(R,i)&&(w=R);var x=v.prototype=m.prototype=Object.create(w);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(o,a,i,u){var c=f(t[o],t,a);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==_typeof(p)&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,i,u)}),(function(t){r("throw",t,i,u)})):e.resolve(p).then((function(t){s.value=t,i(s)}),(function(t){return r("throw",t,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function k(e,r,n){var o=l;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=G(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?d:h,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function G(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,G(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function E(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(_typeof(e)+" is not iterable")}return _.prototype=v,o(x,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:_,configurable:!0}),_.displayName=s(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},L(T.prototype),s(T.prototype,u,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new T(p(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(x),s(x,c,"Generator"),s(x,i,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=E,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:E(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function asyncGeneratorStep(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){asyncGeneratorStep(a,n,o,i,u,"next",t)}function u(t){asyncGeneratorStep(a,n,o,i,u,"throw",t)}i(void 0)}))}}import doRequest from"../../../../utils/request.js";export function queryUser(t){return _queryUser.apply(this,arguments)}function _queryUser(){return(_queryUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/list","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function removeUser(t){return _removeUser.apply(this,arguments)}function _removeUser(){return(_removeUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/del","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function resetPassword(t){return _resetPassword.apply(this,arguments)}function _resetPassword(){return(_resetPassword=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/resetPassword","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function addUser(t){return _addUser.apply(this,arguments)}function _addUser(){return(_addUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/add","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function updateUser(t){return _updateUser.apply(this,arguments)}function _updateUser(){return(_updateUser=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/update","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function assignRole(t){return _assignRole.apply(this,arguments)}function _assignRole(){return(_assignRole=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/assign","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function lock(t){return _lock.apply(this,arguments)}function _lock(){return(_lock=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/lock","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function unlock(t){return _unlock.apply(this,arguments)}function _unlock(){return(_unlock=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/unlock","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function enable(t){return _enable.apply(this,arguments)}function _enable(){return(_enable=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/enable","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function disable(t){return _disable.apply(this,arguments)}function _disable(){return(_disable=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/disable","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getRoleList(t){return _getRoleList.apply(this,arguments)}function _getRoleList(){return(_getRoleList=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/role/listNotPage","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function getUserRoles(t){return _getUserRoles.apply(this,arguments)}function _getUserRoles(){return(_getUserRoles=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/aaa/user/userRoles","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}export function createGitAccount(t){return _createGitAccount.apply(this,arguments)}function _createGitAccount(){return(_createGitAccount=_asyncToGenerator(_regeneratorRuntime().mark((function t(e){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",doRequest("/api/userLoc/createGitAccount","POST",e));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict"
|
|
1
|
+
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),c=new G(n||[]);return o(a,"_invoke",{value:j(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",p="suspendedYield",y="executing",d="completed",g={};function v(){}function m(){}function w(){}var S={};u(S,a,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(P([])));_&&_!==r&&n.call(_,a)&&(S=_);var b=w.prototype=v.prototype=Object.create(S);function L(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,a,c){var s=l(t[o],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==_typeof(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function j(e,r,n){var o=h;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=k(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=l(e,r,n);if("normal"===u.type){if(o=n.done?d:p,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=d,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function P(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(_typeof(e)+" is not iterable")}return m.prototype=w,o(b,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:m,configurable:!0}),m.displayName=u(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,s,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},L(E.prototype),u(E.prototype,c,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(b),u(b,s,"Generator"),u(b,a,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=P,G.prototype={constructor:G,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function asyncGeneratorStep(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function _asyncToGenerator(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){asyncGeneratorStep(i,n,o,a,c,"next",t)}function c(t){asyncGeneratorStep(i,n,o,a,c,"throw",t)}a(void 0)}))}}import React,{useEffect}from"react";import{getSessionStorage,setSessionStorage}from"../../../utils/token.js";import{message,Spin}from"antd";import{queryAaaCurrent}from"../../../services/service.js";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsx as _jsx}from"react/jsx-runtime";var BothSecurityLayout=function(t){var e=t.children,r=t.envData,n=t.service,o=getSessionStorage(),i="true"===r.aaaLogin,a=i?"".concat(window.publicPath,"user/login"):"".concat(window.publicPath),c=window.location.pathname;useEffect((function(){console.error("构建参数,开发完成,记得删除!"),console.log("ENV_DATA:",r),console.log("service:",n),o?s():"new"===r.sso_type?u():l()}),[]);var s=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,queryAaaCurrent();case 2:"000000"===(r=e.sent).rspCode&&t.getUserOk(r.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),u=function(){fetch("/auth/login",{headers:{SID:"".concat(SID),service:n},method:"POST"}).then((function(t){t.json().then((function(t){if("000000"===t.rspCode)setSessionStorage("Token",t.data),null!=getSessionStorage("r")&&null!=getSessionStorage("r")?window.location.href=getSessionStorage("r"):window.location.href=a;else if(message.error(t.rspMsg),t.data){var e=t.data+"?callback="+window.location.href;setTimeout((function(){window.location.href=e}),1e3)}else"999000"===t.rspCode&&location.reload()}))}))},f=function(){fetch("/auth/sso",{headers:{SID:SID,service:n}}).then((function(t){200===t.status?t.text().then((function(t){window.location.href=t})):window.location.href=a})).catch((function(t){window.location.href=a}))},l=function(){if(c.indexOf("/sso")>=0||!i){var t=window.location.search.substr(1).split("&");if(t.length>0&&""!==t[0]){var e=t[0].split("=");e.length>1&&"code"===e[0]?fetch("/auth/token?code="+e[1],{headers:{SID:"".concat(SID),service:n}}).then((function(t){t.json().then((function(t){if(t.access_token)console.log(58585858,t.access_token),setSessionStorage("Token",t.access_token);else{if("000000"!==t.rspCode)return void message.error(t.rspMsg);setSessionStorage("Token",t.data)}null!=getSessionStorage("r")&&null!=getSessionStorage("r")?window.location.href=getSessionStorage("r"):window.location.href=a}))})):f()}else f()}};return _jsx("div",{children:o?_jsx(_Fragment,{children:e}):_jsx("div",{style:{textAlign:"center",paddingTop:100},children:_jsx(Spin,{size:"large"})})})};export default BothSecurityLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var i=r&&r.prototype instanceof v?r:v,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:S(t,e,c)}),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var p="suspendedStart",y="suspendedYield",h="executing",d="completed",m={};function v(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,j=_&&_(_(F([])));j&&j!==e&&n.call(j,a)&&(w=j);var x=b.prototype=v.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,r){function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==_typeof(s)&&n.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function S(r,e,n){var o=p;return function(i,a){if(o===h)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=E(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var l=f(r,e,n);if("normal"===l.type){if(o=n.done?d:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function E(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,E(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function I(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function F(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(_typeof(r)+" is not iterable")}return g.prototype=b,o(x,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},r.awrap=function(t){return{__await:t}},O(L.prototype),l(L.prototype,c,(function(){return this})),r.AsyncIterator=L,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new L(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(x),l(x,u,"Generator"),l(x,a,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=F,T.prototype={constructor:T,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),I(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;I(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:F(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function ownKeys(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(e),!0).forEach((function(r){_defineProperty(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function _defineProperty(t,r,e){return(r=_toPropertyKey(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function _toPropertyKey(t){var r=_toPrimitive(t,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){asyncGeneratorStep(i,n,o,a,c,"next",t)}function c(t){asyncGeneratorStep(i,n,o,a,c,"throw",t)}a(void 0)}))}}function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function _iterableToArrayLimit(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}import{Form,Input,Modal,TreeSelect}from"antd";import React from"react";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var FormItem=Form.Item,formLayout={labelCol:{span:7},wrapperCol:{span:13}},UpdateForm=function(t){var r=_slicedToArray(Form.useForm(),1)[0],e=t.onSubmit,n=t.onCancel,o=t.updateModalVisible,i=t.values,a=t.type,c=t.treeData,u=function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var n;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.validateFields();case 2:n=t.sent,e("U"===a?_objectSpread(_objectSpread({},i),n):n);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return _jsx(Modal,{getContainer:function(){return top.document.body},maskClosable:!1,width:640,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"C"===a?"新增数据字典":"编辑数据字典",open:o,onOk:function(){return u()},onCancel:function(){return n()},children:_jsx(Form,_objectSpread(_objectSpread({},formLayout),{},{form:r,initialValues:{parentId:(null==i?void 0:i.parentId)||"-1",dictName:null==i?void 0:i.dictName,dictCode:null==i?void 0:i.dictCode,remark:null==i?void 0:i.remark},children:_jsxs(_Fragment,{children:[_jsx(FormItem,{name:"parentId",label:"父级",children:_jsx(TreeSelect,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:c,treeDefaultExpandedKeys:[i.parentId||"-1"],showSearch:!0,filterTreeNode:function(t,r){return r.dictName.includes(t)}})}),_jsx(FormItem,{name:"dictName",label:"字典名称",rules:[{required:!0,message:"请输入字典表名!",whitespace:!0}],children:_jsx(Input,{})}),_jsx(FormItem,{name:"dictCode",label:"字典编码",rules:[{required:!0,message:"请输入字典值!",whitespace:!0}],children:_jsx(Input,{disabled:"U"===a})}),_jsx(FormItem,{name:"remark",label:"备注",children:_jsx(Input,{})})]})}))})};export default UpdateForm;
|
|
1
|
+
function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var i=r&&r.prototype instanceof v?r:v,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:S(t,e,c)}),a}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var p="suspendedStart",y="suspendedYield",h="executing",d="completed",m={};function v(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var _=Object.getPrototypeOf,j=_&&_(_(F([])));j&&j!==e&&n.call(j,a)&&(w=j);var x=b.prototype=v.prototype=Object.create(w);function O(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,r){function e(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==_typeof(s)&&n.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function S(r,e,n){var o=p;return function(i,a){if(o===h)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=E(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=h;var l=f(r,e,n);if("normal"===l.type){if(o=n.done?d:y,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=d,n.method="throw",n.arg=l.arg)}}}function E(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,E(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function I(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function F(r){if(r||""===r){var e=r[a];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(_typeof(r)+" is not iterable")}return g.prototype=b,o(x,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},r.awrap=function(t){return{__await:t}},O(L.prototype),l(L.prototype,c,(function(){return this})),r.AsyncIterator=L,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new L(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(x),l(x,u,"Generator"),l(x,a,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=F,T.prototype={constructor:T,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),I(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;I(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:F(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function ownKeys(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function _objectSpread(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(e),!0).forEach((function(r){_defineProperty(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ownKeys(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function _defineProperty(t,r,e){return(r=_toPropertyKey(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function _toPropertyKey(t){var r=_toPrimitive(t,"string");return"symbol"==_typeof(r)?r:String(r)}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function asyncGeneratorStep(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){asyncGeneratorStep(i,n,o,a,c,"next",t)}function c(t){asyncGeneratorStep(i,n,o,a,c,"throw",t)}a(void 0)}))}}function _slicedToArray(t,r){return _arrayWithHoles(t)||_iterableToArrayLimit(t,r)||_unsupportedIterableToArray(t,r)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function _iterableToArrayLimit(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}function _arrayWithHoles(t){if(Array.isArray(t))return t}import{Form,Input,Modal,TreeSelect}from"antd";import React from"react";import{jsx as _jsx}from"react/jsx-runtime";import{Fragment as _Fragment}from"react/jsx-runtime";import{jsxs as _jsxs}from"react/jsx-runtime";var FormItem=Form.Item,formLayout={labelCol:{span:7},wrapperCol:{span:13}},UpdateForm=function(t){var r=_slicedToArray(Form.useForm(),1)[0],e=t.onSubmit,n=t.onCancel,o=t.updateModalVisible,i=t.values,a=t.type,c=t.treeData,u=function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){var n;return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.validateFields();case 2:n=t.sent,e("U"===a?_objectSpread(_objectSpread({},i),n):n);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return _jsx(Modal,{getContainer:function(){return top.document.body},maskClosable:!1,width:640,bodyStyle:{padding:"32px 40px 48px"},destroyOnClose:!0,title:"C"===a?"新增数据字典":"编辑数据字典",open:o,onOk:function(){return u()},onCancel:function(){return n()},children:_jsx(Form,_objectSpread(_objectSpread({},formLayout),{},{form:r,initialValues:{parentId:(null==i?void 0:i.parentId)||"-1",dictName:null==i?void 0:i.dictName,dictCode:null==i?void 0:i.dictCode,remark:null==i?void 0:i.remark},children:_jsxs(_Fragment,{children:[_jsx(FormItem,{name:"parentId",label:"父级",children:_jsx(TreeSelect,{style:{width:"100%"},dropdownStyle:{maxHeight:400,overflow:"auto"},treeData:c,treeDefaultExpandedKeys:[i.parentId||"-1"],showSearch:!0,filterTreeNode:function(t,r){return r.dictName.includes(t)}})}),_jsx(FormItem,{name:"dictName",label:"字典名称",rules:[{required:!0,message:"请输入字典表名!",whitespace:!0}],children:_jsx(Input,{})}),_jsx(FormItem,{name:"dictCode",label:"字典编码",rules:[{required:!0,message:"请输入字典值!",whitespace:!0}],children:_jsx(Input,{disabled:"U"===a})}),_jsx(FormItem,{name:"remark",label:"备注",children:_jsx(Input,{})})]})}))})};export default UpdateForm;
|