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 extraFile_1 = require("../../../utils/extraFile");
|
||||||
var antd_1 = require("antd");
|
var antd_1 = require("antd");
|
||||||
var icons_1 = require("@ant-design/icons");
|
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"));
|
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||||
function extraFileToUploadFile(extraFile, systemConfig) {
|
function extraFileToUploadFile(extraFile, systemConfig) {
|
||||||
return Object.assign({}, extraFile, {
|
return Object.assign({}, extraFile, {
|
||||||
url: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
|
url: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
|
||||||
name: extraFile.filename,
|
|
||||||
thumbUrl: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
|
thumbUrl: (0, extraFile_1.composeFileUrl)(extraFile, systemConfig),
|
||||||
|
name: extraFile.filename,
|
||||||
|
uid: extraFile.uid || extraFile.id, //upload 组件需要uid来维护fileList
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getListType(theme) {
|
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.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) {
|
: (files === null || files === void 0 ? void 0 : files.length)
|
||||||
|
? files.map(function (ele) {
|
||||||
return extraFileToUploadFile(ele, systemConfig);
|
return extraFileToUploadFile(ele, systemConfig);
|
||||||
}), onChange: function (_a) {
|
})
|
||||||
|
: null, onChange: function (_a) {
|
||||||
var file = _a.file, fileList = _a.fileList, event = _a.event;
|
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; })) || [];
|
var arr = (fileList === null || fileList === void 0 ? void 0 : fileList.filter(function (ele) { return !ele.id; })) || [];
|
||||||
_this.setState({
|
_this.setState({
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
|
.oak-upload {
|
||||||
|
&__tips {
|
||||||
|
|
||||||
.oak-upload__tips {
|
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--oak-text-color-placeholder);
|
color: var(--oak-text-color-placeholder);
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,11 +5,14 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
||||||
var antd_1 = require("antd");
|
var antd_1 = require("antd");
|
||||||
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
var web_module_less_1 = tslib_1.__importDefault(require("./web.module.less"));
|
||||||
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
|
var index_1 = tslib_1.__importDefault(require("../onUser/index"));
|
||||||
|
var pageHeader_1 = tslib_1.__importDefault(require("../../../../components/common/pageHeader"));
|
||||||
function render() {
|
function render() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var _a = this.props, relations = _a.relations, entity = _a.entity, entityId = _a.entityId;
|
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 () {
|
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();
|
_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 })] })));
|
} }, { 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;
|
exports.default = render;
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ function render() {
|
||||||
if (oakId) {
|
if (oakId) {
|
||||||
return (0, jsx_runtime_1.jsx)("div", { children: 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: [
|
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,
|
required: true,
|
||||||
message: '请选择一个权限',
|
message: '请选择一个权限',
|
||||||
|
|
@ -23,7 +23,7 @@ function render() {
|
||||||
}, options: relations.map(function (ele) { return ({
|
}, options: relations.map(function (ele) { return ({
|
||||||
value: ele,
|
value: ele,
|
||||||
label: (_this.t && _this.t(entity + ':r.' + ele)) || 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: [
|
}); }) }) })), type === 'grant' && ((0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u4EBA\u6570", rules: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择分享的目标人数',
|
message: '请选择分享的目标人数',
|
||||||
|
|
@ -34,8 +34,8 @@ function render() {
|
||||||
_this.setNumber(value);
|
_this.setNumber(value);
|
||||||
}, options: [
|
}, options: [
|
||||||
{ value: 1, label: '单次' },
|
{ value: 1, label: '单次' },
|
||||||
{ value: 10000, label: '不限次' }
|
{ value: 10000, label: '不限次' },
|
||||||
] }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u65F6\u6548", rules: [
|
] }) }))), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u65F6\u6548", rules: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请选择一个时效',
|
message: '请选择一个时效',
|
||||||
|
|
@ -44,10 +44,10 @@ function render() {
|
||||||
_this.setState({
|
_this.setState({
|
||||||
period: value,
|
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 () {
|
}, 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();
|
_this.confirm();
|
||||||
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
} }, { children: "\u63D0\u4EA4" })), (0, jsx_runtime_1.jsx)(antd_1.Button, tslib_1.__assign({ onClick: function () {
|
||||||
_this.onBack();
|
_this.onBack();
|
||||||
} }, { children: "\u8FD4\u56DE" }))] }))] }) }))] })));
|
} }, { children: "\u8FD4\u56DE" }))] }) }))] }))] })));
|
||||||
}
|
}
|
||||||
exports.default = render;
|
exports.default = render;
|
||||||
|
|
|
||||||
|
|
@ -4,56 +4,62 @@ var tslib_1 = require("tslib");
|
||||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||||
var antd_1 = require("antd");
|
var antd_1 = require("antd");
|
||||||
var mobile_module_less_1 = tslib_1.__importDefault(require("./mobile.module.less"));
|
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() {
|
function render() {
|
||||||
var _this = this;
|
var _a = this.props, entity = _a.entity, entityId = _a.entityId, relations = _a.relations;
|
||||||
var _a = this.props, relations = _a.relations, entity = _a.entity;
|
var _b = this.state, grantByUserEntityGrant = _b.grantByUserEntityGrant, grantByEmail = _b.grantByEmail, grantByMobile = _b.grantByMobile, grantMethodCount = _b.grantMethodCount;
|
||||||
var _b = this.state, name = _b.name, mobile = _b.mobile, password = _b.password, relationArr = _b.relationArr;
|
var SubPart = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
||||||
var relationArr2 = typeof relations === 'object'
|
if (grantMethodCount === 0) {
|
||||||
? relations
|
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" })));
|
||||||
: 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: [
|
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 = [
|
||||||
{
|
{
|
||||||
required: true,
|
label: 'Email',
|
||||||
message: '姓名不能为空',
|
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" })),
|
||||||
] }, { 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,
|
label: '手机号',
|
||||||
message: '请输入11位手机号',
|
key: 'item-2',
|
||||||
|
children: ((0, jsx_runtime_1.jsx)(index_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: "$userRelationUpsert/upsert-byMobile", oakAutoUnmount: true })),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
max: 11,
|
label: '二维码',
|
||||||
message: '请输入11位手机号',
|
key: 'item-3',
|
||||||
|
children: ((0, jsx_runtime_1.jsx)(byUserEntityGrant_1.default, { entity: entity, entityId: entityId, relations: relations, oakPath: "$userRelationUpsert/upsert-byUserEntityGrant", oakAutoUnmount: true })),
|
||||||
},
|
},
|
||||||
] }, { 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;
|
var items2 = [];
|
||||||
_this.setUpdateData('mobile$user.0.mobile', strValue.replace(/[^\d\-\d]/g, ''));
|
if (grantByEmail) {
|
||||||
}, 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: [
|
items2.push(items[0]);
|
||||||
{
|
}
|
||||||
required: true,
|
if (grantByMobile) {
|
||||||
message: '密码不能为空',
|
items2.push(items[1]);
|
||||||
},
|
}
|
||||||
] }, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(antd_1.Input, { value: password, onChange: function (e) {
|
if (grantByUserEntityGrant) {
|
||||||
_this.setUpdateData('password', e.target.value);
|
items2.push(items[2]);
|
||||||
}, placeholder: "\u4E0D\u5C11\u4E8E\u516B\u4F4D" }) }) })), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, tslib_1.__assign({ label: "\u6743\u9650", rules: [
|
}
|
||||||
{
|
SubPart = (0, jsx_runtime_1.jsx)(antd_1.Tabs, { items: items2 });
|
||||||
required: true,
|
}
|
||||||
message: '请至少选择一个权限',
|
return SubPart;
|
||||||
},
|
|
||||||
], 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" }))] }) }))] })) })));
|
|
||||||
}
|
}
|
||||||
exports.default = render;
|
exports.default = render;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
|
.oak-upload {
|
||||||
|
&__tips {
|
||||||
|
|
||||||
.oak-upload__tips {
|
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--oak-text-color-placeholder);
|
color: var(--oak-text-color-placeholder);
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,14 +3,16 @@ import { composeFileUrl, bytesToSize } from '../../../utils/extraFile';
|
||||||
|
|
||||||
import { Space, Upload, UploadFile, Tag, Button, Table, UploadProps } from 'antd';
|
import { Space, Upload, UploadFile, Tag, Button, Table, UploadProps } from 'antd';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
|
import classNames from 'classnames';
|
||||||
import Style from './web.module.less';
|
import Style from './web.module.less';
|
||||||
|
|
||||||
|
|
||||||
function extraFileToUploadFile(extraFile: any, systemConfig: any) {
|
function extraFileToUploadFile(extraFile: any, systemConfig: any) {
|
||||||
return Object.assign({}, extraFile, {
|
return Object.assign({}, extraFile, {
|
||||||
url: composeFileUrl(extraFile, systemConfig),
|
url: composeFileUrl(extraFile, systemConfig),
|
||||||
name: extraFile.filename,
|
|
||||||
thumbUrl: composeFileUrl(extraFile, systemConfig),
|
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 (
|
return (
|
||||||
<Space direction="vertical">
|
<Space direction="vertical" className={Style['oak-upload']}>
|
||||||
<Upload
|
<Upload
|
||||||
className={className}
|
className={classNames(Style['oak-upload__upload'], className)}
|
||||||
style={style}
|
style={style}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
directory={directory}
|
directory={directory}
|
||||||
showUploadList={showUploadList}
|
showUploadList={showUploadList}
|
||||||
beforeUpload={beforeUpload}
|
beforeUpload={async (file) => {
|
||||||
|
if (typeof beforeUpload === 'function') {
|
||||||
|
const result = await beforeUpload(file);
|
||||||
|
if (result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}}
|
||||||
multiple={multiple}
|
multiple={multiple}
|
||||||
maxCount={maxNumber}
|
maxCount={maxNumber}
|
||||||
accept={accept}
|
accept={accept}
|
||||||
|
|
@ -84,9 +94,11 @@ export default function render(this: any) {
|
||||||
fileList={
|
fileList={
|
||||||
theme === 'custom'
|
theme === 'custom'
|
||||||
? []
|
? []
|
||||||
: (files || []).map((ele: any) =>
|
: files?.length
|
||||||
|
? files.map((ele: any) =>
|
||||||
extraFileToUploadFile(ele, systemConfig)
|
extraFileToUploadFile(ele, systemConfig)
|
||||||
)
|
)
|
||||||
|
: null
|
||||||
}
|
}
|
||||||
onChange={({ file, fileList, event }) => {
|
onChange={({ file, fileList, event }) => {
|
||||||
const arr =
|
const arr =
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
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 Style from './web.module.less';
|
||||||
import OnUser from '../onUser/index';
|
import OnUser from '../onUser/index';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,3 @@
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
padding: 30px 32px;
|
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,10 +2,13 @@ import React from 'react';
|
||||||
import { Form, Input, Checkbox, Button, Space, Card } from 'antd';
|
import { Form, Input, Checkbox, Button, Space, Card } from 'antd';
|
||||||
import Style from './web.module.less';
|
import Style from './web.module.less';
|
||||||
import OnUser from '../onUser/index';
|
import OnUser from '../onUser/index';
|
||||||
|
import PageHeader from '../../../../components/common/pageHeader';
|
||||||
|
|
||||||
|
|
||||||
export default function render(this: any) {
|
export default function render(this: any) {
|
||||||
const { relations, entity, entityId } = this.props;
|
const { relations, entity, entityId } = this.props;
|
||||||
return (
|
return (
|
||||||
|
<PageHeader showBack={true} title="编辑权限">
|
||||||
<div className={Style.container}>
|
<div className={Style.container}>
|
||||||
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
<Form colon labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||||
<Form.Item wrapperCol={{ offset: 4 }}>
|
<Form.Item wrapperCol={{ offset: 4 }}>
|
||||||
|
|
@ -30,12 +33,17 @@ export default function render(this: any) {
|
||||||
</Form>
|
</Form>
|
||||||
<OnUser
|
<OnUser
|
||||||
oakAutoUnmount={true}
|
oakAutoUnmount={true}
|
||||||
oakPath={this.state.oakFullpath ? `${this.state.oakFullpath}.user` : undefined}
|
oakPath={
|
||||||
|
this.state.oakFullpath
|
||||||
|
? `${this.state.oakFullpath}.user`
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
entity={entity}
|
entity={entity}
|
||||||
entityId={entityId}
|
entityId={entityId}
|
||||||
relations={relations}
|
relations={relations}
|
||||||
oakId={this.props.oakId}
|
oakId={this.props.oakId}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</PageHeader>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
.formContainer {
|
|
||||||
padding-top: 32px;
|
.container {
|
||||||
width: 676px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.pageWithPadding {
|
|
||||||
padding: 30px 32px;
|
padding: 30px 32px;
|
||||||
background: var(--oak-bg-color-container);
|
background: var(--oak-bg-color-container);
|
||||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
|
// box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
|
||||||
border-radius: 3px;
|
// border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
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';
|
import Style from './web.module.less';
|
||||||
|
|
||||||
export default function render(this: any) {
|
export default function render(this: any) {
|
||||||
|
|
@ -10,10 +10,14 @@ export default function render(this: any) {
|
||||||
return <div>{oakId}</div>;
|
return <div>{oakId}</div>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className={Style.pageWithPadding}>
|
<div className={Style.container}>
|
||||||
<Alert message="提交权限后,请将二维码发给待分享权限的用户扫描" type="success" />
|
<Alert
|
||||||
<div className={Style.formContainer}>
|
showIcon
|
||||||
<Form>
|
message="提交权限后,请将二维码发给待分享权限的用户扫描"
|
||||||
|
type="info"
|
||||||
|
style={{ marginBottom: 16 }}
|
||||||
|
/>
|
||||||
|
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 8 }}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="权限"
|
label="权限"
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -36,7 +40,8 @@ export default function render(this: any) {
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{type === 'grant' && <Form.Item
|
{type === 'grant' && (
|
||||||
|
<Form.Item
|
||||||
label="人数"
|
label="人数"
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
|
|
@ -53,10 +58,11 @@ export default function render(this: any) {
|
||||||
}}
|
}}
|
||||||
options={[
|
options={[
|
||||||
{ value: 1, label: '单次' },
|
{ value: 1, label: '单次' },
|
||||||
{ value: 10000, label: '不限次' }
|
{ value: 10000, label: '不限次' },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Form.Item>}
|
</Form.Item>
|
||||||
|
)}
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="时效"
|
label="时效"
|
||||||
rules={[
|
rules={[
|
||||||
|
|
@ -78,10 +84,10 @@ export default function render(this: any) {
|
||||||
addonAfter="分钟"
|
addonAfter="分钟"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item style={{ marginLeft: 100 }}>
|
<Form.Item wrapperCol={{ offset: 4 }}>
|
||||||
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
style={{ marginRight: 10 }}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.confirm();
|
this.confirm();
|
||||||
}}
|
}}
|
||||||
|
|
@ -95,9 +101,9 @@ export default function render(this: any) {
|
||||||
>
|
>
|
||||||
返回
|
返回
|
||||||
</Button>
|
</Button>
|
||||||
|
</Space>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,12 @@
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
background: var(--oak-bg-color-container);
|
background: var(--oak-bg-color-container);
|
||||||
box-shadow: 0 2px 3px #0000001a;
|
// box-shadow: 0 2px 3px #0000001a;
|
||||||
border-radius: 3px;
|
// border-radius: 3px;
|
||||||
padding: 30px 32px;
|
padding: 30px 32px;
|
||||||
}
|
}
|
||||||
.formContainer {
|
|
||||||
padding-top: 32px;
|
|
||||||
width: 676px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.tip {
|
.tip {
|
||||||
font-size: var(--oak-font-size-mark-small);
|
font-size: var(--oak-font-size-mark-small);
|
||||||
color: var(--oak-warning-color-7);
|
color: var(--oak-warning-color-7);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Form, Input, Checkbox, Button, Space } from 'antd';
|
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) {
|
export default function render(this: any) {
|
||||||
return <div>尚未实现</div>
|
return <div>尚未实现</div>
|
||||||
|
|
|
||||||
|
|
@ -1,131 +1,103 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Form, Input, Checkbox, Button, Space } from 'antd';
|
import { Tabs } from 'antd';
|
||||||
import Style from './mobile.module.less';
|
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) {
|
export default function render(this: any) {
|
||||||
const { relations, entity } = this.props;
|
const { entity, entityId, relations } = this.props;
|
||||||
const { name, mobile, password, relationArr } = this.state;
|
const {
|
||||||
const relationArr2: string[] =
|
grantByUserEntityGrant,
|
||||||
typeof relations === 'object'
|
grantByEmail,
|
||||||
? relations
|
grantByMobile,
|
||||||
: relations && JSON.parse(relations);
|
grantMethodCount,
|
||||||
return (
|
} = this.state;
|
||||||
|
let SubPart: JSX.Element = <></>;
|
||||||
|
if (grantMethodCount === 0) {
|
||||||
|
SubPart = (
|
||||||
<div className={Style.container}>
|
<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>
|
</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