)
@@ -1902,58 +2052,58 @@ export class FieldDefinedStore extends HrmBaseStore {
encryptParams = {};
@action onEncryptHandle = async record => {
- const {fieldname, tablename, fieldlabel, encryptId} = record;
- this.encryptParams = {fieldname, tablename, encryptId};
+ const { fieldname, tablename, fieldlabel, encryptId } = record;
+ this.encryptParams = { fieldname, tablename, encryptId };
const label = getCurrentLabel(fieldlabel);
- const data = await api.getEncryptFieldSettingForm({...this.encryptParams, ...this.opParams});
- if(data.status == '1'){
+ const data = await api.getEncryptFieldSettingForm({ ...this.encryptParams, ...this.opParams });
+ if (data.status == '1') {
this.setFormData('encryptForm', data.conditions);
- if(this.formTarget.encryptForm.isFormInit){
- this.encryptDialogTitle = `${getLabel('526997','加密设置')}(${getLabel('261','字段')}:${label})`;
+ if (this.formTarget.encryptForm.isFormInit) {
+ this.encryptDialogTitle = `${getLabel('526997', '加密设置')}(${getLabel('261', '字段')}:${label})`;
this.encryptDialogVisible = true;
}
- }else{
+ } else {
message.error(data.message);
}
}
@observable needInitData = '1';
- get encrypt(){
- const {isencrypt} = this.formTarget.encryptForm.getFormParams();
+ get encrypt() {
+ const { isencrypt } = this.formTarget.encryptForm.getFormParams();
const fields = this.formTarget.encryptFormFields;
- const col = find(fields[0].items, {domkey: ['isencrypt']});
- const {otherParams} = col || {};
- const {disabled} = otherParams || {};
+ const col = find(fields[0].items, { domkey: ['isencrypt'] });
+ const { otherParams } = col || {};
+ const { disabled } = otherParams || {};
return isencrypt == '1' && !disabled;
}
@action saveEncryptFieldSettingForm = async () => {
const f = await this.formTarget.encryptForm.validateForm();
if (f.isValid) {
- if(this.encrypt){
+ if (this.encrypt) {
this.confirmInfo({
width: 500,
content: (
-
1.{getLabel('524355','提示: 字段一旦加密后无法取消,同时加密后的字段不支持查询,请谨慎操作!')}
+
1.{getLabel('524355', '提示: 字段一旦加密后无法取消,同时加密后的字段不支持查询,请谨慎操作!')}
- 2.{getLabel('531157','历史数据量可能较大, 此操作可能需要较长时间,对系统性能也可能会造成一定影响,请确认是否处理历史数据:')}
+ 2.{getLabel('531157', '历史数据量可能较大, 此操作可能需要较长时间,对系统性能也可能会造成一定影响,请确认是否处理历史数据:')}
- {
+ onChange={(v, showname) => {
this.needInitData = v;
}}
/>
@@ -1963,7 +2113,7 @@ export class FieldDefinedStore extends HrmBaseStore {
),
onOk: this.doSaveEncryptFieldSettingForm
})
- }else{
+ } else {
this.needInitData = '0';
this.doSaveEncryptFieldSettingForm();
}
@@ -1974,243 +2124,243 @@ export class FieldDefinedStore extends HrmBaseStore {
}
@action doSaveEncryptFieldSettingForm = async () => {
- if(this.spinning)
+ if (this.spinning)
return;
this.spinning = true;
- const params = {...this.formTarget.encryptForm.getFormParams(), ...this.encryptParams, needInitData: this.needInitData, ...this.opParams}
+ const params = { ...this.formTarget.encryptForm.getFormParams(), ...this.encryptParams, needInitData: this.needInitData, ...this.opParams }
if (this.selectedTreeNodeInfo != null) {
Object.assign(params, {
scopeid: this.selectedTreeNodeInfo.key
})
}
- try{
+ try {
const data = await api.saveEncryptFieldSettingForm(params);
- if(data.status == '1'){
+ if (data.status == '1') {
this.encryptDialogVisible = false;
message.success(i18n.message.saveSuccess());
- if (this.moduleName.indexOf('resource') >= 0)
- this.getTabInfoByTreeNode();
- else
- this.initData();
- }else{
+ // if (this.moduleName.indexOf('resource') >= 0)
+ this.getTabInfoByTreeNode();
+ // else
+ // this.initData();
+ } else {
message.error(data.message);
}
this.spinning = false;
- }catch(e){
+ } catch (e) {
this.spinning = false;
}
}
//#region 查看范围设置
- target = {};
- @observable dialogVisible = false;
- @observable table = new TableStore();
- @observable canAdd = false;
- @observable canDel = false;
+ target = {};
+ @observable dialogVisible = false;
+ @observable table = new TableStore();
+ @observable canAdd = false;
+ @observable canDel = false;
- @computed get tableMultiDelete() {
- return this.table.selectedRowKeys.length === 0 || !this.canDel;
- }
-
- @computed get rangeViewTabProps(){
- return {
- datas: [],
- buttons: [
- ,
- ,
- ]
- }
- }
-
- @action onDialogCancleHandle = () => this.dialogVisible = false;
-
- get dialogButtons(){
- const buttonDef = [
- {
- content: getLabel(30986, '保存'),
- icon: 'icon-coms-Preservation',
- onClickHandle: this.saveViewRange
- }
- ]
- const buttons = [], moreBtnData = [];
- buttonDef.map((btn, index) => {
- const {content, icon, onClickHandle} = btn;
- buttons.push(
- ()
- );
-
- moreBtnData.push({
- key: index.toString(),
- content,
- icon: ,
- onClick: onClickHandle
- });
- })
-
- const {scopeId} = this.opParams;
- let arr = [];
- if(scopeId == '-1'){
- arr = this.generateLogMenu('38', 'HRM_RSOURCE_RESOURCEBASE', this.encryptParams.encryptId);
- }else if(scopeId == '1'){
- arr = this.generateLogMenu('38', 'HRM_RSOURCE_RESOURCEPERSONAL', this.encryptParams.encryptId);
- }else if(scopeId == '3'){
- arr = this.generateLogMenu('38', 'HRM_RSOURCE_RESOURCEWORK', this.encryptParams.encryptId);
- }else if(scopeId == 'subcompany'){
- arr = this.generateLogMenu('38', 'HRM_RSOURCE_SUBCOMPANY', this.encryptParams.encryptId);
- }else if(scopeId == 'department'){
- arr = this.generateLogMenu('38', 'HRM_RSOURCE_DEPARTEMENT', this.encryptParams.encryptId);
- }else if(scopeId == 'salary'){
- arr = this.generateLogMenu('38', 'HRM_RSOURCE_SALARY');
- }else{}
- moreBtnData.push(...arr);
- return {buttons, moreBtn: {datas: moreBtnData}};
- }
-
- @computed get dialogProps(){
- return {
- title: getLabel('125012','查看范围设置'),
- style: {
- width: 800,
- height: 600
- },
- ...ecCom.WeaTools.getIconBGC('currency'),
- ...this.dialogButtons,
- visible: this.dialogVisible,
- onCancel: this.onDialogCancleHandle,
- }
- }
-
- @computed get rangeViewTableProps(){
- return {
- comsWeaTableStore: this.table,
- hasOrder: true,
- needScroll: true,
- scroll: {
- y: 550
- },
- onOperatesClick: this.onOperatesClickHandle
- }
- }
-
- @action showSettingDialog = async () => {
- if(this.encryptParams.encryptId == null || this.encryptParams.encryptId == ''){
- this.confirmInfo({
- content: getLabel('524355','提示: 字段一旦加密后无法取消,同时加密后的字段不支持查询,请谨慎操作!'),
- onOk: async () => {
- const rs = await api.saveEncryptFieldSettingForm({...this.formTarget.encryptForm.getFormParams(), ...this.encryptParams, ...this.opParams});
- if(rs.status == '1'){
- this.encryptParams.encryptId = rs.encryptId;
- if (this.moduleName.indexOf('resource') >= 0)
- this.getTabInfoByTreeNode();
- else
- this.initData();
- this.dialogVisible = this.getEncryptFieldScopeList();
- }else{
- message.error(data.message);
- }
- }
- });
- }else
- this.dialogVisible = this.getEncryptFieldScopeList();
- }
-
- @action getEncryptFieldScopeList = async () => {
- const d = await api.getEncryptFieldScopeList({id: this.encryptParams.encryptId});
- if(d.status == '1'){
- const {canAdd, canDel, sessionkey} = d;
- this.canAdd = canAdd;
- this.canDel = canDel;
- this.table = new TableStore();
- this.table.getDatas(sessionkey);
- return true;
- }else{
- message.error(d.message);
- return false;
- }
- }
-
- @action onOperatesClickHandle = (record, index, operate) => {
- const func = operate.href ? operate.href.split(':')[1].split('(')[0] : '';
- const id = record.id || '';
- this[func] && this[func](id, record);
- }
-
- @action doMultiDel = () => this.doDel();
-
- @action doDel = ids => {
- const params = {
- fieldid: this.encryptParams.encryptId,
- ids: ids || this.table.selectedRowKeys
- };
- let content = isEmpty(ids) ? getLabel(385625, '确定要删除选择的记录吗?') : getLabel(83877, '确定要删除吗?');
- this.confirmInfo({
- content,
- onOk: async () => {
- const data = await api.delEncryptFieldScopeSetting({...params, ...this.opParams});
- if (data.status === "1") {
- message.success(getLabel(83472, '删除成功!'));
- this.table.getDatas(null, 1);
- }else{
- message.error(data.message);
- }
- }
- });
- }
-
- @action saveViewRange = async () => {
- this.onDialogCancleHandle();
- }
- //#endregion
-
- //#region 范围form
- @observable conditions = [];
-
- @observable viewRangeAuthVisible = false;
-
- @computed get viewRangeAuthProps(){
- return {
- title: getLabel('383694','添加人员'),
- conditions: this.toJS(this.conditions),
- ...ecCom.WeaTools.getIconBGC('currency'),
- visible: this.viewRangeAuthVisible,
- onOk: this.onOKHandle,
- onCancel: this.onViewRangeAuthCancleHandle,
- }
- }
-
- @action getViewRangeForm = async () => {
- const data = await api.getEncryptFieldScopeForm();
- if(data.status == "1"){
- this.conditions = data.conditions;
- this.viewRangeAuthVisible = true;
- }
- }
-
- @action onOKHandle = async data => {
- const d = await api.saveEncryptFieldScopeSetting({id: this.encryptParams.encryptId, ...data, ...this.opParams});
- if(d.status == '1'){
- message.success(getLabel(83551, '保存成功!'));
- this.getEncryptFieldScopeList();
- }else{
- message.error(d.message);
- }
- this.viewRangeAuthVisible = false;
- }
-
- @action onViewRangeAuthCancleHandle = () => {
- this.viewRangeAuthVisible = !this.viewRangeAuthVisible;
+ @computed get tableMultiDelete() {
+ return this.table.selectedRowKeys.length === 0 || !this.canDel;
}
-
- get opParams(){
+
+ @computed get rangeViewTabProps() {
+ return {
+ datas: [],
+ buttons: [
+ ,
+ ,
+ ]
+ }
+ }
+
+ @action onDialogCancleHandle = () => this.dialogVisible = false;
+
+ get dialogButtons() {
+ const buttonDef = [
+ {
+ content: getLabel(30986, '保存'),
+ icon: 'icon-coms-Preservation',
+ onClickHandle: this.saveViewRange
+ }
+ ]
+ const buttons = [], moreBtnData = [];
+ buttonDef.map((btn, index) => {
+ const { content, icon, onClickHandle } = btn;
+ buttons.push(
+ ()
+ );
+
+ moreBtnData.push({
+ key: index.toString(),
+ content,
+ icon: ,
+ onClick: onClickHandle
+ });
+ })
+
+ const { scopeId } = this.opParams;
+ let arr = [];
+ if (scopeId == '-1') {
+ arr = this.generateLogMenu('38', 'HRM_RSOURCE_RESOURCEBASE', this.encryptParams.encryptId);
+ } else if (scopeId == '1') {
+ arr = this.generateLogMenu('38', 'HRM_RSOURCE_RESOURCEPERSONAL', this.encryptParams.encryptId);
+ } else if (scopeId == '3') {
+ arr = this.generateLogMenu('38', 'HRM_RSOURCE_RESOURCEWORK', this.encryptParams.encryptId);
+ } else if (scopeId == 'subcompany') {
+ arr = this.generateLogMenu('38', 'HRM_RSOURCE_SUBCOMPANY', this.encryptParams.encryptId);
+ } else if (scopeId == 'department') {
+ arr = this.generateLogMenu('38', 'HRM_RSOURCE_DEPARTEMENT', this.encryptParams.encryptId);
+ } else if (scopeId == 'salary') {
+ arr = this.generateLogMenu('38', 'HRM_RSOURCE_SALARY');
+ } else { }
+ moreBtnData.push(...arr);
+ return { buttons, moreBtn: { datas: moreBtnData } };
+ }
+
+ @computed get dialogProps() {
+ return {
+ title: getLabel('125012', '查看范围设置'),
+ style: {
+ width: 800,
+ height: 600
+ },
+ ...ecCom.WeaTools.getIconBGC('currency'),
+ ...this.dialogButtons,
+ visible: this.dialogVisible,
+ onCancel: this.onDialogCancleHandle,
+ }
+ }
+
+ @computed get rangeViewTableProps() {
+ return {
+ comsWeaTableStore: this.table,
+ hasOrder: true,
+ needScroll: true,
+ scroll: {
+ y: 550
+ },
+ onOperatesClick: this.onOperatesClickHandle
+ }
+ }
+
+ @action showSettingDialog = async () => {
+ if (this.encryptParams.encryptId == null || this.encryptParams.encryptId == '') {
+ this.confirmInfo({
+ content: getLabel('524355', '提示: 字段一旦加密后无法取消,同时加密后的字段不支持查询,请谨慎操作!'),
+ onOk: async () => {
+ const rs = await api.saveEncryptFieldSettingForm({ ...this.formTarget.encryptForm.getFormParams(), ...this.encryptParams, ...this.opParams });
+ if (rs.status == '1') {
+ this.encryptParams.encryptId = rs.encryptId;
+ // if (this.moduleName.indexOf('resource') >= 0)
+ this.getTabInfoByTreeNode();
+ // else
+ // this.initData();
+ this.dialogVisible = this.getEncryptFieldScopeList();
+ } else {
+ message.error(data.message);
+ }
+ }
+ });
+ } else
+ this.dialogVisible = this.getEncryptFieldScopeList();
+ }
+
+ @action getEncryptFieldScopeList = async () => {
+ const d = await api.getEncryptFieldScopeList({ id: this.encryptParams.encryptId });
+ if (d.status == '1') {
+ const { canAdd, canDel, sessionkey } = d;
+ this.canAdd = canAdd;
+ this.canDel = canDel;
+ this.table = new TableStore();
+ this.table.getDatas(sessionkey);
+ return true;
+ } else {
+ message.error(d.message);
+ return false;
+ }
+ }
+
+ @action onOperatesClickHandle = (record, index, operate) => {
+ const func = operate.href ? operate.href.split(':')[1].split('(')[0] : '';
+ const id = record.id || '';
+ this[func] && this[func](id, record);
+ }
+
+ @action doMultiDel = () => this.doDel();
+
+ @action doDel = ids => {
+ const params = {
+ fieldid: this.encryptParams.encryptId,
+ ids: ids || this.table.selectedRowKeys
+ };
+ let content = isEmpty(ids) ? getLabel(385625, '确定要删除选择的记录吗?') : getLabel(83877, '确定要删除吗?');
+ this.confirmInfo({
+ content,
+ onOk: async () => {
+ const data = await api.delEncryptFieldScopeSetting({ ...params, ...this.opParams });
+ if (data.status === "1") {
+ message.success(getLabel(83472, '删除成功!'));
+ this.table.getDatas(null, 1);
+ } else {
+ message.error(data.message);
+ }
+ }
+ });
+ }
+
+ @action saveViewRange = async () => {
+ this.onDialogCancleHandle();
+ }
+ //#endregion
+
+ //#region 范围form
+ @observable conditions = [];
+
+ @observable viewRangeAuthVisible = false;
+
+ @computed get viewRangeAuthProps() {
+ return {
+ title: getLabel('383694', '添加人员'),
+ conditions: this.toJS(this.conditions),
+ ...ecCom.WeaTools.getIconBGC('currency'),
+ visible: this.viewRangeAuthVisible,
+ onOk: this.onOKHandle,
+ onCancel: this.onViewRangeAuthCancleHandle,
+ }
+ }
+
+ @action getViewRangeForm = async () => {
+ const data = await api.getEncryptFieldScopeForm();
+ if (data.status == "1") {
+ this.conditions = data.conditions;
+ this.viewRangeAuthVisible = true;
+ }
+ }
+
+ @action onOKHandle = async data => {
+ const d = await api.saveEncryptFieldScopeSetting({ id: this.encryptParams.encryptId, ...data, ...this.opParams });
+ if (d.status == '1') {
+ message.success(getLabel(83551, '保存成功!'));
+ this.getEncryptFieldScopeList();
+ } else {
+ message.error(d.message);
+ }
+ this.viewRangeAuthVisible = false;
+ }
+
+ @action onViewRangeAuthCancleHandle = () => {
+ this.viewRangeAuthVisible = !this.viewRangeAuthVisible;
+ }
+
+ get opParams() {
const obj = {
fieldname: this.encryptParams.fieldname
}
const name = (this.moduleName || '').toLocaleLowerCase();
- if(name.indexOf('subcompany') > -1){
+ if (name.indexOf('subcompany') > -1) {
Object.assign(obj, {
scopeId: 'subcompany'
});
- }else if(name.indexOf('department') > -1){
+ } else if (name.indexOf('department') > -1) {
Object.assign(obj, {
scopeId: 'department'
});
@@ -2224,5 +2374,5 @@ export class FieldDefinedStore extends HrmBaseStore {
//#endregion
/********************* action list *********************/
-
+
}
\ No newline at end of file
diff --git a/pc4mobx/organization/util/index.js b/pc4mobx/organization/util/index.js
index ebe5892..b6482dd 100644
--- a/pc4mobx/organization/util/index.js
+++ b/pc4mobx/organization/util/index.js
@@ -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
+ };
}
\ No newline at end of file