Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-general-business into dev
This commit is contained in:
commit
89a534326e
|
|
@ -5,12 +5,14 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|||
var extraFile_1 = require("../../../utils/extraFile");
|
||||
var antd_1 = require("antd");
|
||||
var icons_1 = require("@ant-design/icons");
|
||||
var classnames_1 = tslib_1.__importDefault(require("classnames"));
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
function extraFileToUploadFile(extraFile, systemConfig) {
|
||||
return Object.assign({}, extraFile, {
|
||||
url: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
|
||||
name: extraFile.filename,
|
||||
thumbUrl: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
|
||||
name: extraFile.filename,
|
||||
uid: extraFile.uid || extraFile.id, //upload 组件需要uid来维护fileList
|
||||
});
|
||||
}
|
||||
function getListType(theme) {
|
||||
|
|
@ -37,11 +39,29 @@ function render() {
|
|||
}
|
||||
return (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "default" }, { children: "\u9009\u62E9\u6587\u4EF6" }));
|
||||
};
|
||||
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical" }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Upload, tslib_1.__assign({ className: className, style: style, disabled: disabled, directory: directory, showUploadList: showUploadList, beforeUpload: beforeUpload, multiple: multiple, maxCount: maxNumber, accept: accept, listType: listType, fileList: theme === 'custom'
|
||||
return ((0, jsx_runtime_1.jsxs)(antd_1.Space, tslib_1.__assign({ direction: "vertical", className: web_module_less_1.default['oak-upload'] }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Upload, tslib_1.__assign({ className: (0, classnames_1.default)(web_module_less_1.default['oak-upload__upload'], className), style: style, disabled: disabled, directory: directory, showUploadList: showUploadList, beforeUpload: function (file) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
||||
var result;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!(typeof beforeUpload === 'function')) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, beforeUpload(file)];
|
||||
case 1:
|
||||
result = _a.sent();
|
||||
if (result) {
|
||||
return [2 /*return*/, false];
|
||||
}
|
||||
_a.label = 2;
|
||||
case 2: return [2 /*return*/, false];
|
||||
}
|
||||
});
|
||||
}); }, multiple: multiple, maxCount: maxNumber, accept: accept, listType: listType, fileList: theme === 'custom'
|
||||
? []
|
||||
: (files || []).map(function (ele) {
|
||||
return extraFileToUploadFile(ele, systemConfig);
|
||||
}), onChange: function (_a) {
|
||||
: (files === null || files === void 0 ? void 0 : files.length)
|
||||
? files.map(function (ele) {
|
||||
return extraFileToUploadFile(ele, systemConfig);
|
||||
})
|
||||
: null, onChange: function (_a) {
|
||||
var file = _a.file, fileList = _a.fileList, event = _a.event;
|
||||
var arr = (fileList === null || fileList === void 0 ? void 0 : fileList.filter(function (ele) { return !ele.id; })) || [];
|
||||
_this.setState({
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
|
||||
|
||||
.oak-upload__tips {
|
||||
display: block;
|
||||
color: var(--oak-text-color-placeholder);
|
||||
margin-top: 8px;
|
||||
.oak-upload {
|
||||
&__tips {
|
||||
display: block;
|
||||
color: var(--oak-text-color-placeholder);
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,14 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|||
var antd_1 = require("antd");
|
||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
|
||||
var pageHeader_1 = tslib_1.__importDefault(require("../../../../components/common/pageHeader"));
|
||||
function render() {
|
||||
var _this = this;
|
||||
var _a = this.props, relations = _a.relations, entity = _a.entity, entityId = _a.entityId;
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ disabled: !this.state.legal, type: "primary", onClick: function () {
|
||||
_this.onConfirm();
|
||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { return _this.onReset(); } }, { children: "\u91CD\u7F6E" }))] }) })) })), (0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: this.state.oakFullpath ? "".concat(this.state.oakFullpath, ".user") : undefined, entity: entity, entityId: entityId, relations: relations, oakId: this.props.oakId })] })));
|
||||
return ((0, jsx_runtime_1.jsx)(pageHeader_1.default, tslib_1.__assign({ showBack: true, title: "\u7F16\u8F91\u6743\u9650" }, { children: (0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ disabled: !this.state.legal, type: "primary", onClick: function () {
|
||||
_this.onConfirm();
|
||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset", onClick: function () { return _this.onReset(); } }, { children: "\u91CD\u7F6E" }))] }) })) })), (0, jsx_runtime_1.jsx)(index_1.default, { oakAutoUnmount: true, oakPath: this.state.oakFullpath
|
||||
? "".concat(this.state.oakFullpath, ".user")
|
||||
: undefined, entity: entity, entityId: entityId, relations: relations, oakId: this.props.oakId })] })) })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -11,43 +11,43 @@ function render() {
|
|||
if (oakId) {
|
||||
return (0, jsx_runtime_1.jsx)("div", { children: oakId });
|
||||
}
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.pageWithPadding }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Alert, { message: "\u63D0\u4EA4\u6743\u9650\u540E\uFF0C\u8BF7\u5C06\u4E8C\u7EF4\u7801\u53D1\u7ED9\u5F85\u5206\u4EAB\u6743\u9650\u7684\u7528\u6237\u626B\u63CF", type: "success" }), (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: web_module_less_1.default.formContainer }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6743\u9650", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个权限',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: relation, onChange: function (_a) {
|
||||
var target = _a.target;
|
||||
var value = target.value;
|
||||
_this.setRelation(value);
|
||||
}, options: relations.map(function (ele) { return ({
|
||||
value: ele,
|
||||
label: (_this.t && _this.t(entity + ':r.' + ele)) || ele,
|
||||
}); }) }) })), type === 'grant' && (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u4EBA\u6570", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择分享的目标人数',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: number, onChange: function (_a) {
|
||||
var target = _a.target;
|
||||
var value = target.value;
|
||||
_this.setNumber(value);
|
||||
}, options: [
|
||||
{ value: 1, label: '单次' },
|
||||
{ value: 10000, label: '不限次' }
|
||||
] }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u65F6\u6548", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个时效',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: 15, value: period, onChange: function (value) {
|
||||
_this.setState({
|
||||
period: value,
|
||||
});
|
||||
}, addonAfter: "\u5206\u949F" }) })), (0, jsx_runtime_1.jsxs)(antd_1.Form.Item, tslib_1.__assign({ style: { marginLeft: 100 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", style: { marginRight: 10 }, onClick: function () {
|
||||
return ((0, jsx_runtime_1.jsxs)("div", tslib_1.__assign({ className: web_module_less_1.default.container }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Alert, { showIcon: true, message: "\u63D0\u4EA4\u6743\u9650\u540E\uFF0C\u8BF7\u5C06\u4E8C\u7EF4\u7801\u53D1\u7ED9\u5F85\u5206\u4EAB\u6743\u9650\u7684\u7528\u6237\u626B\u63CF", type: "info", style: { marginBottom: 16 } }), (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6743\u9650", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个权限',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: relation, onChange: function (_a) {
|
||||
var target = _a.target;
|
||||
var value = target.value;
|
||||
_this.setRelation(value);
|
||||
}, options: relations.map(function (ele) { return ({
|
||||
value: ele,
|
||||
label: (_this.t && _this.t(entity + ':r.' + ele)) || ele,
|
||||
}); }) }) })), type === 'grant' && ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u4EBA\u6570", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择分享的目标人数',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { value: number, onChange: function (_a) {
|
||||
var target = _a.target;
|
||||
var value = target.value;
|
||||
_this.setNumber(value);
|
||||
}, options: [
|
||||
{ value: 1, label: '单次' },
|
||||
{ value: 10000, label: '不限次' },
|
||||
] }) }))), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u65F6\u6548", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个时效',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { min: 1, max: 15, value: period, onChange: function (value) {
|
||||
_this.setState({
|
||||
period: value,
|
||||
});
|
||||
}, addonAfter: "\u5206\u949F" }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", onClick: function () {
|
||||
_this.confirm();
|
||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||
_this.onBack();
|
||||
} }, { children: "\u8FD4\u56DE" }))] }))] }) }))] })));
|
||||
} }, { children: "\u8FD4\u56DE" }))] }) }))] }))] })));
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -4,56 +4,62 @@ var tslib_1 = require("tslib");
|
|||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less"));
|
||||
var index_1 = tslib_1.__importDefault(require("./byMobile/index"));
|
||||
var byUserEntityGrant_1 = tslib_1.__importDefault(require("./byUserEntityGrant"));
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
function render() {
|
||||
var _this = this;
|
||||
var _a = this.props, relations = _a.relations, entity = _a.entity;
|
||||
var _b = this.state, name = _b.name, mobile = _b.mobile, password = _b.password, relationArr = _b.relationArr;
|
||||
var relationArr2 = typeof relations === 'object'
|
||||
? relations
|
||||
: relations && JSON.parse(relations);
|
||||
return ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Form, tslib_1.__assign({ colon: true, labelCol: { span: 4 }, wrapperCol: { span: 8 } }, { children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u59D3\u540D", name: "name", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '姓名不能为空',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { onChange: function (e) {
|
||||
_this.setUpdateData('name', e.target.value);
|
||||
}, value: name, placeholder: "\u8BF7\u8F93\u5165\u59D3\u540D" }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u624B\u673A\u53F7\u7801", name: "mobile", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '手机号不能为空',
|
||||
},
|
||||
{
|
||||
min: 11,
|
||||
message: '请输入11位手机号',
|
||||
},
|
||||
{
|
||||
max: 11,
|
||||
message: '请输入11位手机号',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { maxLength: 11, value: mobile, onChange: function (e) {
|
||||
var strValue = e.target.value;
|
||||
_this.setUpdateData('mobile$user.0.mobile', strValue.replace(/[^\d\-\d]/g, ''));
|
||||
}, placeholder: "\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u7801", type: "tel" }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u5BC6\u7801", name: "mobile", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '密码不能为空',
|
||||
},
|
||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { value: password, onChange: function (e) {
|
||||
_this.setUpdateData('password', e.target.value);
|
||||
}, placeholder: "\u4E0D\u5C11\u4E8E\u516B\u4F4D" }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6743\u9650", rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请至少选择一个权限',
|
||||
},
|
||||
], name: "relation" }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Checkbox.Group, { value: relationArr, onChange: function (value) {
|
||||
_this.setRelationValue(value);
|
||||
}, options: relationArr2.map(function (ele) { return ({
|
||||
value: ele,
|
||||
label: (_this.t && _this.t(entity + ':r.' + ele)) ||
|
||||
ele,
|
||||
}); }) }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ wrapperCol: { offset: 4 } }, { children: (0, jsx_runtime_1.jsxs)(antd_1.Space, { children: [(0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ type: "primary", htmlType: "submit", onClick: function () {
|
||||
_this.onConfirm();
|
||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ htmlType: "reset" }, { children: "\u91CD\u7F6E" }))] }) }))] })) })));
|
||||
var _a = this.props, entity = _a.entity, entityId = _a.entityId, relations = _a.relations;
|
||||
var _b = this.state, grantByUserEntityGrant = _b.grantByUserEntityGrant, grantByEmail = _b.grantByEmail, grantByMobile = _b.grantByMobile, grantMethodCount = _b.grantMethodCount;
|
||||
var SubPart = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
||||
if (grantMethodCount === 0) {
|
||||
SubPart = ((0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: "\u5E94\u7528\u6CA1\u6709\u5B9A\u4E49\u6388\u6743\u65B9\u5F0F\uFF0C\u8BF7\u7BA1\u7406\u5458\u5728\u63A7\u5236\u53F0\u4E2D\u5B9A\u4E49" })));
|
||||
}
|
||||
else if (grantMethodCount === 1) {
|
||||
if (grantByEmail) {
|
||||
SubPart = (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: "\u5C1A\u672A\u5B9E\u73B0" }));
|
||||
}
|
||||
else if (grantByMobile) {
|
||||
SubPart = ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: this.state.oakFullpath
|
||||
? "".concat(this.state.oakFullpath, ".mobile")
|
||||
: undefined, oakAutoUnmount: true }));
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(grantByUserEntityGrant === true);
|
||||
SubPart = ((0, jsx_runtime_1.jsx)(byUserEntityGrant_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: this.state.oakFullpath
|
||||
? "".concat(this.state.oakFullpath, ".userEntityGrant")
|
||||
: undefined, oakAutoUnmount: true }));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var items = [
|
||||
{
|
||||
label: 'Email',
|
||||
key: 'item-1',
|
||||
children: (0, jsx_runtime_1.jsx)("div", tslib_1.__assign({ className: mobile_module_less_1.default.container }, { children: "\u5C1A\u672A\u5B9E\u73B0" })),
|
||||
},
|
||||
{
|
||||
label: '手机号',
|
||||
key: 'item-2',
|
||||
children: ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: "$userRelationUpsert/upsert-byMobile", oakAutoUnmount: true })),
|
||||
},
|
||||
{
|
||||
label: '二维码',
|
||||
key: 'item-3',
|
||||
children: ((0, jsx_runtime_1.jsx)(byUserEntityGrant_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: "$userRelationUpsert/upsert-byUserEntityGrant", oakAutoUnmount: true })),
|
||||
},
|
||||
];
|
||||
var items2 = [];
|
||||
if (grantByEmail) {
|
||||
items2.push(items[0]);
|
||||
}
|
||||
if (grantByMobile) {
|
||||
items2.push(items[1]);
|
||||
}
|
||||
if (grantByUserEntityGrant) {
|
||||
items2.push(items[2]);
|
||||
}
|
||||
SubPart = (0, jsx_runtime_1.jsx)(antd_1.Tabs, { items: items2 });
|
||||
}
|
||||
return SubPart;
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
|
||||
|
||||
.oak-upload__tips {
|
||||
display: block;
|
||||
color: var(--oak-text-color-placeholder);
|
||||
margin-top: 8px;
|
||||
.oak-upload {
|
||||
&__tips {
|
||||
display: block;
|
||||
color: var(--oak-text-color-placeholder);
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,14 +3,16 @@ import { composeFileUrl, bytesToSize } from '../../../utils/extraFile';
|
|||
|
||||
import { Space, Upload, UploadFile, Tag, Button, Table, UploadProps } from 'antd';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import classNames from 'classnames';
|
||||
import Style from './web.module.less';
|
||||
|
||||
|
||||
function extraFileToUploadFile(extraFile: any, systemConfig: any) {
|
||||
return Object.assign({}, extraFile, {
|
||||
url: composeFileUrl(extraFile, systemConfig),
|
||||
name: extraFile.filename,
|
||||
thumbUrl: composeFileUrl(extraFile, systemConfig),
|
||||
name: extraFile.filename,
|
||||
uid: extraFile.uid || extraFile.id, //upload 组件需要uid来维护fileList
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -69,14 +71,22 @@ export default function render(this: any) {
|
|||
};
|
||||
|
||||
return (
|
||||
<Space direction="vertical">
|
||||
<Space direction="vertical" className={Style['oak-upload']}>
|
||||
<Upload
|
||||
className={className}
|
||||
className={classNames(Style['oak-upload__upload'], className)}
|
||||
style={style}
|
||||
disabled={disabled}
|
||||
directory={directory}
|
||||
showUploadList={showUploadList}
|
||||
beforeUpload={beforeUpload}
|
||||
beforeUpload={async (file) => {
|
||||
if (typeof beforeUpload === 'function') {
|
||||
const result = await beforeUpload(file);
|
||||
if (result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}}
|
||||
multiple={multiple}
|
||||
maxCount={maxNumber}
|
||||
accept={accept}
|
||||
|
|
@ -84,9 +94,11 @@ export default function render(this: any) {
|
|||
fileList={
|
||||
theme === 'custom'
|
||||
? []
|
||||
: (files || []).map((ele: any) =>
|
||||
: files?.length
|
||||
? files.map((ele: any) =>
|
||||
extraFileToUploadFile(ele, systemConfig)
|
||||
)
|
||||
: null
|
||||
}
|
||||
onChange={({ file, fileList, event }) => {
|
||||
const arr =
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Form, Input, Checkbox, Button, Space, Card } from 'antd';
|
||||
import { Form, Input, Button, Space } from 'antd';
|
||||
import Style from './web.module.less';
|
||||
import OnUser from '../onUser/index';
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,4 @@
|
|||
box-shadow: 0 2px 3px #0000001a;
|
||||
border-radius: 3px;
|
||||
padding: 30px 32px;
|
||||
}
|
||||
.formContainer {
|
||||
padding-top: 32px;
|
||||
width: 676px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.tip {
|
||||
font-size: var(--oak-font-size-mark-small);
|
||||
color: var(--oak-warning-color-7);
|
||||
}
|
||||
|
|
@ -2,40 +2,48 @@ import React from 'react';
|
|||
import { Form, Input, Checkbox, Button, Space, Card } from 'antd';
|
||||
import Style from './web.module.less';
|
||||
import OnUser from '../onUser/index';
|
||||
import PageHeader from '../../../../components/common/pageHeader';
|
||||
|
||||
|
||||
export default function render(this: any) {
|
||||
const { relations, entity, entityId } = this.props;
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||
<Form.Item wrapperCol={{ offset: 4 }}>
|
||||
<Space>
|
||||
<Button
|
||||
disabled={!this.state.legal}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
this.onConfirm();
|
||||
}}
|
||||
>
|
||||
提交
|
||||
</Button>
|
||||
<Button
|
||||
htmlType="reset"
|
||||
onClick={() => this.onReset()}
|
||||
>
|
||||
重置
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<OnUser
|
||||
oakAutoUnmount={true}
|
||||
oakPath={this.state.oakFullpath ? `${this.state.oakFullpath}.user` : undefined}
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
relations={relations}
|
||||
oakId={this.props.oakId}
|
||||
/>
|
||||
</div>
|
||||
<PageHeader showBack={true} title="编辑权限">
|
||||
<div className={Style.container}>
|
||||
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||
<Form.Item wrapperCol={{ offset: 4 }}>
|
||||
<Space>
|
||||
<Button
|
||||
disabled={!this.state.legal}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
this.onConfirm();
|
||||
}}
|
||||
>
|
||||
提交
|
||||
</Button>
|
||||
<Button
|
||||
htmlType="reset"
|
||||
onClick={() => this.onReset()}
|
||||
>
|
||||
重置
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<OnUser
|
||||
oakAutoUnmount={true}
|
||||
oakPath={
|
||||
this.state.oakFullpath
|
||||
? `${this.state.oakFullpath}.user`
|
||||
: undefined
|
||||
}
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
relations={relations}
|
||||
oakId={this.props.oakId}
|
||||
/>
|
||||
</div>
|
||||
</PageHeader>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
|
||||
|
||||
.formContainer {
|
||||
padding-top: 32px;
|
||||
width: 676px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.pageWithPadding {
|
||||
|
||||
.container {
|
||||
padding: 30px 32px;
|
||||
background: var(--oak-bg-color-container);
|
||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 3px;
|
||||
// box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
|
||||
// border-radius: 3px;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { Form, Radio, Button, Alert, InputNumber } from 'antd';
|
||||
import { Form, Radio, Button, Alert, InputNumber, Space } from 'antd';
|
||||
import Style from './web.module.less';
|
||||
|
||||
export default function render(this: any) {
|
||||
|
|
@ -10,33 +10,38 @@ export default function render(this: any) {
|
|||
return <div>{oakId}</div>;
|
||||
}
|
||||
return (
|
||||
<div className={Style.pageWithPadding}>
|
||||
<Alert message="提交权限后,请将二维码发给待分享权限的用户扫描" type="success" />
|
||||
<div className={Style.formContainer}>
|
||||
<Form>
|
||||
<div className={Style.container}>
|
||||
<Alert
|
||||
showIcon
|
||||
message="提交权限后,请将二维码发给待分享权限的用户扫描"
|
||||
type="info"
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||
<Form.Item
|
||||
label="权限"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个权限',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Radio.Group
|
||||
value={relation}
|
||||
onChange={({ target }) => {
|
||||
const { value } = target;
|
||||
this.setRelation(value);
|
||||
}}
|
||||
options={relations.map((ele: string) => ({
|
||||
value: ele,
|
||||
label:
|
||||
(this.t && this.t(entity + ':r.' + ele)) || ele,
|
||||
}))}
|
||||
/>
|
||||
</Form.Item>
|
||||
{type === 'grant' && (
|
||||
<Form.Item
|
||||
label="权限"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个权限',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Radio.Group
|
||||
value={relation}
|
||||
onChange={({ target }) => {
|
||||
const { value } = target;
|
||||
this.setRelation(value);
|
||||
}}
|
||||
options={relations.map((ele: string) => ({
|
||||
value: ele,
|
||||
label:
|
||||
(this.t && this.t(entity + ':r.' + ele)) || ele,
|
||||
}))}
|
||||
/>
|
||||
</Form.Item>
|
||||
{type === 'grant' && <Form.Item
|
||||
label="人数"
|
||||
rules={[
|
||||
{
|
||||
|
|
@ -53,35 +58,36 @@ export default function render(this: any) {
|
|||
}}
|
||||
options={[
|
||||
{ value: 1, label: '单次' },
|
||||
{ value: 10000, label: '不限次' }
|
||||
{ value: 10000, label: '不限次' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>}
|
||||
<Form.Item
|
||||
label="时效"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个时效',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={15}
|
||||
value={period}
|
||||
onChange={(value) => {
|
||||
this.setState({
|
||||
period: value,
|
||||
});
|
||||
}}
|
||||
addonAfter="分钟"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item style={{ marginLeft: 100 }}>
|
||||
)}
|
||||
<Form.Item
|
||||
label="时效"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请选择一个时效',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={15}
|
||||
value={period}
|
||||
onChange={(value) => {
|
||||
this.setState({
|
||||
period: value,
|
||||
});
|
||||
}}
|
||||
addonAfter="分钟"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item wrapperCol={{ offset: 4 }}>
|
||||
<Space>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginRight: 10 }}
|
||||
onClick={() => {
|
||||
this.confirm();
|
||||
}}
|
||||
|
|
@ -95,9 +101,9 @@ export default function render(this: any) {
|
|||
>
|
||||
返回
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,12 @@
|
|||
|
||||
.container {
|
||||
background: var(--oak-bg-color-container);
|
||||
box-shadow: 0 2px 3px #0000001a;
|
||||
border-radius: 3px;
|
||||
// box-shadow: 0 2px 3px #0000001a;
|
||||
// border-radius: 3px;
|
||||
padding: 30px 32px;
|
||||
}
|
||||
.formContainer {
|
||||
padding-top: 32px;
|
||||
width: 676px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
.tip {
|
||||
font-size: var(--oak-font-size-mark-small);
|
||||
color: var(--oak-warning-color-7);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
import { Form, Input, Checkbox, Button, Space } from 'antd';
|
||||
import Style from './web.module.less';
|
||||
import Style from './mobile.module.less';
|
||||
|
||||
export default function render(this: any) {
|
||||
return <div>尚未实现</div>
|
||||
|
|
|
|||
|
|
@ -1,131 +1,103 @@
|
|||
import React from 'react';
|
||||
import { Form, Input, Checkbox, Button, Space } from 'antd';
|
||||
import { Tabs } from 'antd';
|
||||
import Style from './mobile.module.less';
|
||||
import ByMobile from './byMobile/index';
|
||||
import ByUserEntityGrant from './byUserEntityGrant';
|
||||
import assert from 'assert';
|
||||
|
||||
export default function render(this: any) {
|
||||
const { relations, entity } = this.props;
|
||||
const { name, mobile, password, relationArr } = this.state;
|
||||
const relationArr2: string[] =
|
||||
typeof relations === 'object'
|
||||
? relations
|
||||
: relations && JSON.parse(relations);
|
||||
return (
|
||||
<div className={Style.container}>
|
||||
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||
<Form.Item
|
||||
label="姓名"
|
||||
name="name"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '姓名不能为空',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<>
|
||||
<Input
|
||||
onChange={(e) => {
|
||||
this.setUpdateData('name', e.target.value);
|
||||
}}
|
||||
value={name}
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="手机号码"
|
||||
name="mobile"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '手机号不能为空',
|
||||
},
|
||||
{
|
||||
min: 11,
|
||||
message: '请输入11位手机号',
|
||||
},
|
||||
{
|
||||
max: 11,
|
||||
message: '请输入11位手机号',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<>
|
||||
<Input
|
||||
maxLength={11}
|
||||
value={mobile}
|
||||
onChange={(e) => {
|
||||
const strValue = e.target.value;
|
||||
this.setUpdateData(
|
||||
'mobile$user.0.mobile',
|
||||
strValue.replace(/[^\d\-\d]/g, '')
|
||||
);
|
||||
}}
|
||||
placeholder="请输入手机号码"
|
||||
type="tel"
|
||||
/>
|
||||
</>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="密码"
|
||||
name="mobile"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '密码不能为空',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<>
|
||||
<Input
|
||||
value={password}
|
||||
onChange={(e) => {
|
||||
this.setUpdateData('password', e.target.value);
|
||||
}}
|
||||
placeholder="不少于八位"
|
||||
/>
|
||||
</>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="权限"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请至少选择一个权限',
|
||||
},
|
||||
]}
|
||||
name="relation"
|
||||
>
|
||||
<>
|
||||
<Checkbox.Group
|
||||
value={relationArr}
|
||||
onChange={(value) => {
|
||||
this.setRelationValue(value);
|
||||
}}
|
||||
options={relationArr2.map((ele) => ({
|
||||
value: ele,
|
||||
label:
|
||||
(this.t && this.t(entity + ':r.' + ele)) ||
|
||||
ele,
|
||||
}))}
|
||||
></Checkbox.Group>
|
||||
</>
|
||||
</Form.Item>
|
||||
<Form.Item wrapperCol={{ offset: 4 }}>
|
||||
<Space>
|
||||
<Button
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
onClick={() => {
|
||||
this.onConfirm();
|
||||
}}
|
||||
>
|
||||
提交
|
||||
</Button>
|
||||
<Button htmlType="reset">重置</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
const { entity, entityId, relations } = this.props;
|
||||
const {
|
||||
grantByUserEntityGrant,
|
||||
grantByEmail,
|
||||
grantByMobile,
|
||||
grantMethodCount,
|
||||
} = this.state;
|
||||
let SubPart: JSX.Element = <></>;
|
||||
if (grantMethodCount === 0) {
|
||||
SubPart = (
|
||||
<div className={Style.container}>
|
||||
应用没有定义授权方式,请管理员在控制台中定义
|
||||
</div>
|
||||
);
|
||||
} else if (grantMethodCount === 1) {
|
||||
if (grantByEmail) {
|
||||
SubPart = <div className={Style.container}>尚未实现</div>;
|
||||
} else if (grantByMobile) {
|
||||
SubPart = (
|
||||
<ByMobile
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
relations={relations}
|
||||
oakPath={
|
||||
this.state.oakFullpath
|
||||
? `${this.state.oakFullpath}.mobile`
|
||||
: undefined
|
||||
}
|
||||
oakAutoUnmount={true}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
assert(grantByUserEntityGrant === true);
|
||||
SubPart = (
|
||||
<ByUserEntityGrant
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
relations={relations}
|
||||
oakPath={
|
||||
this.state.oakFullpath
|
||||
? `${this.state.oakFullpath}.userEntityGrant`
|
||||
: undefined
|
||||
}
|
||||
oakAutoUnmount={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} else {
|
||||
const items = [
|
||||
{
|
||||
label: 'Email',
|
||||
key: 'item-1',
|
||||
children: <div className={Style.container}>尚未实现</div>,
|
||||
},
|
||||
{
|
||||
label: '手机号',
|
||||
key: 'item-2',
|
||||
children: (
|
||||
<ByMobile
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
relations={relations}
|
||||
oakPath="$userRelationUpsert/upsert-byMobile"
|
||||
oakAutoUnmount={true}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: '二维码',
|
||||
key: 'item-3',
|
||||
children: (
|
||||
<ByUserEntityGrant
|
||||
entity={entity}
|
||||
entityId={entityId}
|
||||
relations={relations}
|
||||
oakPath="$userRelationUpsert/upsert-byUserEntityGrant"
|
||||
oakAutoUnmount={true}
|
||||
/>
|
||||
),
|
||||
},
|
||||
];
|
||||
const items2: typeof items = [];
|
||||
if (grantByEmail) {
|
||||
items2.push(items[0]);
|
||||
}
|
||||
if (grantByMobile) {
|
||||
items2.push(items[1]);
|
||||
}
|
||||
if (grantByUserEntityGrant) {
|
||||
items2.push(items[2]);
|
||||
}
|
||||
SubPart = <Tabs items={items2} />;
|
||||
}
|
||||
return SubPart;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue