自定义设置增加类型

This commit is contained in:
Chengliang 2022-06-13 15:38:26 +08:00
parent aa499d7855
commit 1a35ec1bd5
6 changed files with 687 additions and 494 deletions

View File

@ -70,11 +70,14 @@ export default class FieldDef extends Component {
const {
groupInfoFrom,
groupInfoFromFields,
typeInfoFrom,
typeInfoFromFields,
childInfoForm,
childInfoFormFields
} = formTarget;
const {
editGroupInfo,
editTypeInfo,
groupInfoSetting,
createChildInfo,
childInfoSetting
@ -101,10 +104,10 @@ export default class FieldDef extends Component {
}
}
const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)]
const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)]
return (
<div className={classes} ref={dom => {this.tabDom = dom}}>
<div className={classes} ref={dom => { this.tabDom = dom }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@43qdk8`} datas={rMenu}>
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@5fu5eh`} tableProps={tableProps} viewAttr={3} rowKey={'fieldidrowKey'}
ref={(editTable) => setEditTable(editTable, 'fieldDef')}
@ -114,62 +117,76 @@ export default class FieldDef extends Component {
<EncryptSetting ecId={`${this && this.props && this.props.ecId || ''}_EncryptSetting@imlc4x`} store={store} />
<ViewRangeSetting ecId={`${this && this.props && this.props.ecId || ''}_ViewRangeSetting@2vmdra`} store={store} />
<ViewRangeForm ecId={`${this && this.props && this.props.ecId || ''}_ViewRangeForm@bg4o68`} store={store} />
{/* 新增分组 */}
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@etbstc`}
icon="icon-coms-hrm"
iconBgcolor="#217346"
style={{width: 440, height: 70}}
style={{ width: 440, height: 70 }}
title={editGroupInfo.title}
visible={editGroupInfo.visible}
onCancel={() => setDialogVisible('editGroupInfo', false)}
buttons={getDialogOpButtons()}
moreBtn={{datas:editorDialogRightMenu}}
>
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@x4akor`} center={false} form={groupInfoFrom} formFields={groupInfoFromFields} menu={editorDialogRightMenu}/>
</WeaDialog>
moreBtn={{ datas: editorDialogRightMenu }}
>
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@x4akor`} center={false} form={groupInfoFrom} formFields={groupInfoFromFields} menu={editorDialogRightMenu} />
</WeaDialog>
{/* 新增类型 */}
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@etbstc`}
icon="icon-coms-hrm"
iconBgcolor="#217346"
style={{ width: 440, height: 70 }}
title={editTypeInfo.title}
visible={editTypeInfo.visible}
onCancel={() => setDialogVisible('editTypeInfo', false)}
buttons={getDialogOpButtons()}
moreBtn={{ datas: editorDialogRightMenu }}
>
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@x4akor`} center={false} form={typeInfoFrom} formFields={typeInfoFromFields} menu={editorDialogRightMenu} />
</WeaDialog>
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@hxqf4v`}
icon="icon-coms-hrm"
iconBgcolor="#217346"
style={{width: 620, height: 450}}
style={{ width: 620, height: 450 }}
title={groupInfoSetting.title}
visible={groupInfoSetting.visible}
onCancel={() => setDialogVisible('groupInfoSetting', false, '')}
buttons={getDialogOpButtons()}
moreBtn={{datas:editorDialogRightMenu}}
moreBtn={{ datas: editorDialogRightMenu }}
>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@u3ghz1`} datas={editorDialogRightMenu}>
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@9x9otf`}
ref={(editTable) => setEditTable(editTable, 'groupSetting')}
tableProps={{scroll: {y: 360}}}
{...tableEditConfig['groupSetting']}/>
tableProps={{ scroll: { y: 360 } }}
{...tableEditConfig['groupSetting']} />
</WeaRightMenu>
</WeaDialog>
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@dirux3`}
icon="icon-coms-hrm"
iconBgcolor="#217346"
style={{width: 440, height: createChildInfo.height}}
title={createChildInfo.title}
visible={createChildInfo.visible}
onCancel={() => setDialogVisible('createChildInfo', false)}
buttons={getDialogOpButtons()}
moreBtn={{datas:editorDialogRightMenu}}
>
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@mypkxi`} center={false} form={childInfoForm} formFields={childInfoFormFields} menu={editorDialogRightMenu}/>
</WeaDialog>
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@dirux3`}
icon="icon-coms-hrm"
iconBgcolor="#217346"
style={{ width: 440, height: createChildInfo.height }}
title={createChildInfo.title}
visible={createChildInfo.visible}
onCancel={() => setDialogVisible('createChildInfo', false)}
buttons={getDialogOpButtons()}
moreBtn={{ datas: editorDialogRightMenu }}
>
<FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@mypkxi`} center={false} form={childInfoForm} formFields={childInfoFormFields} menu={editorDialogRightMenu} />
</WeaDialog>
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@k8ta6q`}
icon="icon-coms-hrm"
iconBgcolor="#217346"
style={{width: 620, height: 450}}
style={{ width: 620, height: 450 }}
title={childInfoSetting.title}
visible={childInfoSetting.visible}
onCancel={() => setDialogVisible('childInfoSetting', false, '')}
buttons={getDialogOpButtons()}
moreBtn={{datas:editorDialogRightMenu}}
moreBtn={{ datas: editorDialogRightMenu }}
>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@i9bjcx`} datas={editorDialogRightMenu}>
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@mma0l9`}
ref={(editTable) => setEditTable(editTable, 'childInfoSetting')}
tableProps={{scroll: {y: 360}}}
{...tableEditConfig['childInfoSetting']}/>
tableProps={{ scroll: { y: 360 } }}
{...tableEditConfig['childInfoSetting']} />
</WeaRightMenu>
</WeaDialog>
</div>

View File

@ -13,7 +13,7 @@ import {
WeaLeftRightLayout,
WeaDropdown
} from 'ecCom';
import {Spin} from 'antd';
import { Spin } from 'antd';
import Tabs from './Tabs';
import FieldDef from './FieldDef';
import {
@ -25,7 +25,7 @@ const { ButtonSelect } = WeaDropdown;
@inject('fieldDefined')
@observer
export default class FieldDefined extends Component {
constructor(props) {
constructor(props) {
super(props);
this.state = {
logSmallType: ''
@ -54,21 +54,21 @@ export default class FieldDefined extends Component {
type: moduleType
} = params
let moduleName, logSmallType;
if(moduleType === 'subCompany'){
if (moduleType === 'subCompany') {
moduleName = 'subcompanyfielddefined';
logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
}else if(moduleType === 'department'){
} else if (moduleType === 'department') {
moduleName = 'departmentfielddefined';
logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
}else{
} else {
moduleName = 'resourcefielddefined';
logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
}
let callbackFunc = () => initData(false, true, moduleName);
if (moduleType === 'resource')
callbackFunc = () => initResourceData(moduleName);
// let callbackFunc = () => initData(false, true, moduleName);
// if (moduleType === 'resource')
let callbackFunc = () => initResourceData(moduleName);
checkAuthorized(moduleName, null, callbackFunc);
this.setState({logSmallType})
this.setState({ logSmallType })
}
tabChangeHandle = (key) => {
@ -116,87 +116,70 @@ export default class FieldDefined extends Component {
conditionForm: form,
conditionFormFields: fields,
tabBtnDef: [
...tabBtnDef,
...tabBtnDef,
<ButtonSelect ecId={`${this && this.props && this.props.ecId || ''}_ButtonSelect@qbn2pl`}
{...dropdownProps()}
btnProps={{
style: { padding: 0, background: 'transparent', border: 'none', color: feildDefRemoveable ? '#dadada': '#34A2FF', fontSize: 20, marginTop: 2},
style: { padding: 0, background: 'transparent', border: 'none', color: feildDefRemoveable ? '#dadada' : '#34A2FF', fontSize: 20, marginTop: 2 },
disabled: feildDefRemoveable,
}}
/>
]
}, title = moduleType === 'subCompany' ? i18n.module.subCompanyFieldDef() : moduleType === 'department' ? i18n.module.departmentFieldDef() : i18n.module.resourceFieldDef(),
topProps = {
title,
icon: <i className='icon-coms-hrm'/>,
iconBgcolor: '#217346',
showDropIcon: true,
buttons: btns,
dropMenuDatas: menus
};
topProps = {
title,
icon: <i className='icon-coms-hrm' />,
iconBgcolor: '#217346',
showDropIcon: true,
buttons: btns,
dropMenuDatas: menus
};
let logType;
if(selectedTreeNodeInfo){
if(selectedTreeNodeInfo.viewAttr == 1){
if (selectedTreeNodeInfo) {
if (selectedTreeNodeInfo.viewAttr == 1) {
logType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
}else{
} else {
logType = 'HRM_ENGINE_RESOURCEFIELDDEFINED_DETAIL';
}
}
let children = [];
if (containerInitFinished.init && containerInitFinished.authorized) {
switch (moduleType) {
case 'resource':
const {
data,
onSelectedTreeNode,
selectedKeys,
onExpand,
treeExpandKeys
} = store.toJS(treeConfig);
const treeCom = (
<WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
datas={data}
onSelect={onSelectedTreeNode}
selectedKeys={selectedKeys}
onExpand={onExpand}
expandedKeys={treeExpandKeys}/>
)
children = [
(
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@hwytf7`} spinning={spinning}>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@rdv0wt`} {...topProps}>
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@q6b87k`} leftCom={treeCom}>
{
<Tabs ecId={`${this && this.props && this.props.ecId || ''}_Tabs@4k4wsi`} {...tabProps}>
<FieldDef ecId={`${this && this.props && this.props.ecId || ''}_FieldDef@pliw94`} logSmallType={logType || this.state.logSmallType} targetId={activeTabInfo.tabInfo ? activeTabInfo.tabInfo.groupid : ''} resetClass={true}/>
</Tabs>
}
</WeaLeftRightLayout>
</WeaTop>
</Spin>
)
]
break;
default:
children = [
(
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@qlfpcf`} spinning={spinning}>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@ww9tnu`} {...topProps}>
<Tabs ecId={`${this && this.props && this.props.ecId || ''}_Tabs@fwerjc`} {...tabProps}>
<FieldDef ecId={`${this && this.props && this.props.ecId || ''}_FieldDef@djaup2`} logSmallType={logType || this.state.logSmallType} targetId={activeTabInfo.tabInfo ? activeTabInfo.tabInfo.groupid : ''}/>
const {
data,
onSelectedTreeNode,
selectedKeys,
onExpand,
treeExpandKeys
} = store.toJS(treeConfig);
const treeCom = (
<WeaLeftTree ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftTree@ifgbi1`}
datas={data}
onSelect={onSelectedTreeNode}
selectedKeys={selectedKeys}
onExpand={onExpand}
expandedKeys={treeExpandKeys} />
)
children = [
(
<Spin ecId={`${this && this.props && this.props.ecId || ''}_Spin@hwytf7`} spinning={spinning}>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@rdv0wt`} {...topProps}>
<WeaLeftRightLayout ecId={`${this && this.props && this.props.ecId || ''}_WeaLeftRightLayout@q6b87k`} leftCom={treeCom}>
{
<Tabs ecId={`${this && this.props && this.props.ecId || ''}_Tabs@4k4wsi`} {...tabProps}>
<FieldDef ecId={`${this && this.props && this.props.ecId || ''}_FieldDef@pliw94`} logSmallType={logType || this.state.logSmallType} targetId={activeTabInfo.tabInfo ? activeTabInfo.tabInfo.groupid : ''} resetClass={true} />
</Tabs>
</WeaTop>
</Spin>
)
]
break;
}
}
</WeaLeftRightLayout>
</WeaTop>
</Spin>
)
]
} else if (containerInitFinished.init && !containerInitFinished.authorized) {
children = [
(
<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@z0f4dh`}>
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
</WeaAlertPage>
<div style={{ color: '#000' }}>{i18n.message.authFailed()}</div>
</WeaAlertPage>
)
];
}

View File

@ -147,7 +147,7 @@ export const i18n = {
newDept: () => getLabel(386246, '新建部门'),
mergeDept:()=> getLabel(386246, '合并部门'),
transferDept:()=> getLabel(386246, '转移部门'),
typeName: () => getLabel(129927, '类型名称'),
authorizationGroup: () => getLabel(492, '权限组'),
@ -842,6 +842,7 @@ export const i18n = {
},
button: {
back: () => getLabel(1290, '返回'),
createType: () => getLabel(30131, '新建类型'),
batchOpen: () => getLabel(534249, '批量解锁'),
collect: () => getLabel(28111, '收藏'),

View File

@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:14:20
* @LastEditTime: 2022-06-09 10:41:31
* @LastEditTime: 2022-06-13 14:50:36
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/baseStore.js
*/
@ -93,14 +93,14 @@ export default class HrmBaseStore {
}
getBasicMenus = (logTypeKey, targetId = null) => {
let arr = [];
if(logTypeKey){
arr.push({
key: '99',
content: i18n.button.log(),
icon: <i className={this.menuIconCollection.log}/>,
onClick: () => this.showLog({logSmallType: this.logTypeDef[logTypeKey], targetId})
});
}
// if(logTypeKey){
// arr.push({
// key: '99',
// content: i18n.button.log(),
// icon: <i className={this.menuIconCollection.log}/>,
// onClick: () => this.showLog({logSmallType: this.logTypeDef[logTypeKey], targetId})
// });
// }
return arr;
}

File diff suppressed because it is too large Load Diff

View File

@ -2,8 +2,36 @@ import { Spin } from 'antd';
import { WeaSwitch } from 'comsMobx';
import { WeaLocaleProvider, WeaAlertPage, WeaSearchGroup, WeaFormItem } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import {
indexOf
} from 'lodash';
import '../style/index.less'
const dbKeys = ["PERCENT", "PLAN", "PRECISION", "PRIMARY", "PRINT", "PROC", "PROCEDURE", "PUBLIC", "RAISERROR",
"READ", "READTEXT", "RECONFIGURE", "REFERENCES", "REPLICATION", "RESTORE", "RESTRICT", "RETURN", "REVOKE",
"RIGHT", "ROLLBACK", "ROWCOUNT", "ROWGUIDCOL", "RULE", "SAVE", "SCHEMA", "SELECT", "SESSION_USER", "SET",
"SETUSER", "SHUTDOWN", "SOME", "STATISTICS", "SYSTEM_USER", "TABLE", "TEXTSIZE", "THEN", "TO", "TOP", "TRAN",
"TRANSACTION", "TRIGGER", "TRUNCATE", "TSEQUAL", "UNION", "UNIQUE", "UPDATE", "UPDATETEXT", "USE", "USER",
"VALUES", "VARYING", "VIEW", "WAITFOR", "WHEN", "WHERE", "WHILE", "WITH", "WRITETEXT", "EXCEPT", "EXEC", "EXECUTE",
"EXISTS", "EXIT", "FETCH", "FILE", "FILLFACTOR", "FOR", "FOREIGN", "FREETEXT", "FREETEXTTABLE", "FROM", "FULL",
"FUNCTION", "GOTO", "GRANT", "GROUP", "HAVING", "HOLDLOCK", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", "IF", "IN",
"INDEX", "INNER", "INSERT", "INTERSECT", "INTO", "IS", "JOIN", "KEY", "KILL", "LEFT", "LIKE", "LINENO", "LOAD", "NATIONAL",
"NOCHECK", "NONCLUSTERED", "NOT", "NULL", "NULLIF", "OF", "OFF", "OFFSETS", "ON", "OPEN", "OPENDATASOURCE", "OPENQUERY",
"OPENROWSET", "OPENXML", "OPTION", "OR", "ORDER", "OUTER", "OVER", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUTHORIZATION",
"BACKUP", "BEGIN", "BETWEEN", "BREAK", "BROWSE", "BULK", "BY", "CASCADE", "CASE", "CHECK", "CHECKPOINT", "CLOSE", "CLUSTERED",
"COALESCE", "COLLATE", "COLUMN", "COMMIT", "COMPUTE", "CONSTRAINT", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONVERT", "CREATE",
"CROSS", "CURRENT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "DATABASE", "DBCC", "DEALLOCATE",
"DECLARE", "DEFAULT", "DELETE", "DENY", "DESC", "DISK", "DISTINCT", "DISTRIBUTED", "DOUBLE", "DROP", "DUMMY", "DUMP", "ELSE", "END", "ERRLVL",
"ESCAPE", "ACCESS", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUDIT", "BETWEEN", "BY", "CHAR", "CHECK", "CLUSTER", "COLUMN", "COMMENT",
"COMPRESS", "CONNECT", "CREATE", "CURRENT", "DATE", "DECIMAL", "DEFAULT", "DELETE", "DESC", "DISTINCT", "DROP", "ELSE", "EXCLUSIVE", "EXISTS",
"FILE", "FLOAT", "FOR", "FROM", "GRANT", "GROUP", "HAVING", "IDENTIFIED", "IMMEDIATE", "IN", "INCREMENT", "INDEX", "INITIAL", "INSERT", "INTEGER",
"INTERSECT", "INTO", "IS", "LEVEL", "LIKE", "LOCK", "LONG", "MAXEXTENTS", "MINUS", "MLSLABEL", "MODE", "MODIFY", "NOAUDIT", "NOCOMPRESS", "NOT",
"NOWAIT", "NULL", "NUMBER", "OF", "OFFLINE", "ON", "ONLINE", "OPTION", "OR", "ORDER", "PCTFREE", "PRIOR", "PRIVILEGES", "PUBLIC", "RAW", "RENAME",
"RESOURCE", "REVOKE", "ROW", "ROWID", "ROWNUM", "ROWS", "SELECT", "SESSION", "SET", "SHARE", "SIZE", "SMALLINT", "START", "SUCCESSFUL", "SYNONYM",
"SYSDATE", "TABLE", "THEN", "TO", "TRIGGER", "UID", "UNION", "UNIQUE", "UPDATE", "USER", "VALIDATE", "VALUES", "VARCHAR", "VARCHAR2", "VIEW", "WHENEVER",
"WHERE", "WITH"
]
// 渲染form表单: 一般对form的渲染都统一使用该方法
export const getSearchs = (form, condition, col, isCenter) => {
const { isFormInit } = form;
@ -89,4 +117,18 @@ export const calFormHeight = (groupLength, children) => {
if (height > 300)
return 300;
return height;
}
export const validDBKeys = (value) => {
if (indexOf(dbKeys, value.toUpperCase()) >= 0) {
message.error("不能使用数据库保留字作为字段名!");
return {
isValid: false,
value: ''
};
}
return {
isValid: true,
value
};
}