)
@@ -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
From 88dd830ce35898a43a7578147a1a7b0c57120d7d Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Mon, 13 Jun 2022 17:35:34 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/stores/fieldDefined.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index 8ada3bd..d034da6 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-13 15:06:29
+ * @LastEditTime: 2022-06-13 16:55:34
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -1501,14 +1501,14 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tableEditConfig.childInfoSetting.showTitle = true;
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
- this.selectedTreeNodeInfo.domid != '-1' && t.topButtonDef.push({
- comType: 'button',
- type: 'primary',
- onClickHandle: this.doChildInfoSetting,
- label: i18n.button.childInfoMaintain(),
- icon: this.menuIconCollection.setting,
- checkAction: 'childInfoOperability'
- });
+ // this.selectedTreeNodeInfo.domid != '-1' && t.topButtonDef.push({
+ // comType: 'button',
+ // type: 'primary',
+ // onClickHandle: this.doChildInfoSetting,
+ // label: i18n.button.childInfoMaintain(),
+ // icon: this.menuIconCollection.setting,
+ // checkAction: 'childInfoOperability'
+ // });
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
From 2d1c75698524c496bb7f5d829d7ff56782c621a6 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 16 Jun 2022 08:43:36 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E6=A0=91=E5=92=8Ctab=E6=8E=A5=E5=8F=A3=E5=AF=B9?=
=?UTF-8?q?=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/fieldDefined.js | 29 +-
.../fieldDefinedSet/FieldDefined.js | 10 +-
pc4mobx/organization/public/i18n.js | 1 +
pc4mobx/organization/stores/companyextend.js | 2 +-
pc4mobx/organization/stores/fieldDefined.js | 272 +++++++-----------
5 files changed, 137 insertions(+), 177 deletions(-)
diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js
index 5a5a66a..a642d7d 100644
--- a/pc4mobx/organization/apis/fieldDefined.js
+++ b/pc4mobx/organization/apis/fieldDefined.js
@@ -7,7 +7,7 @@ import {
* @param {Object} params [description]
* @return {[type]} [description]
*/
-export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/getTabInfo?is_multilang_set=true`, 'GET', params)
+export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi('/api/bs/hrmorganization/fieldDefined/getTabInfo', 'GET', params)
export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/getFieldDefinedInfo?is_multilang_set=true`, 'GET', params)
@@ -15,11 +15,34 @@ export const saveFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callAp
export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
-export const saveGroupInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/saveGroup`, 'POST', params)
+export const saveGroupInfo = (moduleName,params) => {
+ return fetch('/api/bs/hrmorganization/fieldDefined/saveTitle', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
+export const changeTypeInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
export const removeGroupInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/delGroup`, 'POST', params)
-export const getTree = (params = {}) => WeaTools.callApi(`/api/hrm/resourcefielddefined/getTree`, 'GET', params)
+export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params)
export const saveTree = (params = {}) => WeaTools.callApi(`/api/hrm/resourcefielddefined/saveTree`, 'POST', params)
diff --git a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
index d835966..698ff79 100644
--- a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
+++ b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
@@ -56,13 +56,15 @@ export default class FieldDefined extends Component {
let moduleName, logSmallType;
if (moduleType === 'subCompany') {
moduleName = 'subcompanyfielddefined';
- logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
+ //logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
} else if (moduleType === 'department') {
moduleName = 'departmentfielddefined';
- logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
- } else {
+ //logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
+ } else if(moduleType === 'job') {
+ moduleName = 'jobfielddefined';
+ }else {
moduleName = 'resourcefielddefined';
- logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
+ //logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
}
// let callbackFunc = () => initData(false, true, moduleName);
// if (moduleType === 'resource')
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 567877f..fad5e61 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -843,6 +843,7 @@ export const i18n = {
button: {
back: () => getLabel(1290, '返回'),
createType: () => getLabel(30131, '新建类型'),
+ editTypeInfo: () => getLabel(32732, '编辑类型'),
batchOpen: () => getLabel(534249, '批量解锁'),
collect: () => getLabel(28111, '收藏'),
diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js
index 95ba257..8079896 100644
--- a/pc4mobx/organization/stores/companyextend.js
+++ b/pc4mobx/organization/stores/companyextend.js
@@ -56,9 +56,9 @@ export class CompanyExtendStore {
save = () => {
if (this.loading)
return;
- this.loading = true;
this.form.validateForm().then(f => {
if (f.isValid) {
+ this.loading = true;
if (this.personalEditTables) {
const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index d034da6..e64f25f 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-13 16:55:34
+ * @LastEditTime: 2022-06-15 18:47:39
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -67,7 +67,9 @@ export class FieldDefinedStore extends HrmBaseStore {
}, {
comType: 'button',
type: 'primary',
- onClickHandle: () => this.editType(),
+ onClickHandle: () => this.editTypeInfo(true, {
+ name: this.selectedTreeNodeInfo.name,
+ }),
label: i18n.button.createType,
icon: this.menuIconCollection.create
}, {
@@ -504,7 +506,7 @@ export class FieldDefinedStore extends HrmBaseStore {
"items": [{
"colSpan": 2,
"conditionType": "INPUT",
- "domkey": ["typeName"],
+ "domkey": ["name"],
"fieldcol": 12,
"isQuickSearch": false,
"label": i18n.label.typeName,
@@ -513,59 +515,6 @@ export class FieldDefinedStore extends HrmBaseStore {
"rules": "required|string",
"value": "",
"viewAttr": 3,
- }, {
- "belong": "PC",
- "checkbox": false,
- "checkboxValue": false,
- "colSpan": 2,
- "conditionType": "SELECT",
- "dateGroup": false,
- "defaultDisplayInBar": false,
- "detailtype": 3,
- "domkey": [
- "tableType"
- ],
- "entSearch": false,
- "fieldcol": 16,
- "hasBorder": false,
- "helpfulTipProps": {},
- "hide": false,
- "isBase64": false,
- "isQuickSearch": false,
- "label": "新增到",
- "labelcol": 6,
- "length": 0,
- "maxFilesNumber": 0,
- "maxUploadSize": 0,
- "multiSelection": false,
- "multiple": false,
- "options": [
- {
- "disabled": false,
- "key": "0",
- "selected": false,
- "showname": "主表",
- "visible": true
- },
- {
- "disabled": false,
- "key": "1",
- "selected": false,
- "showname": "明细表",
- "visible": true
- }
- ],
- "precision": 0,
- "secretLimit": false,
- "showOrder": 0,
- "showTime": false,
- "stringLength": 0,
- "supportCancel": false,
- "tipPosition": "bottom",
- "value": "0",
- "valueList": [],
- "rules": "required|string",
- "viewAttr": 3
}],
"defaultshow": true
}]
@@ -821,7 +770,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.dialogParams.childInfoSetting.visible && this.doSaveChildInfoSetting();
}
- @action editGroup = (group, moveToGroup = false) => {
+ @action("新建分组") editGroup = (group, moveToGroup = false) => {
this.moveToGroup = moveToGroup;
this.editGroupInfoFormFields.map(f => {
if (typeof (f.title) == 'function')
@@ -851,7 +800,9 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('editGroupInfo', true, dialogTitle);
}
- @action editType = () => {
+ isCreateTypeInfo = false;
+ @action("新增或创建类型") editTypeInfo = (create = true, data = {}) => {
+ this.isCreateTypeInfo = create;
this.editTypeInfoFormFields.map(f => {
if (typeof (f.title) == 'function')
f.title = f.title();
@@ -862,17 +813,20 @@ export class FieldDefinedStore extends HrmBaseStore {
})
})
let fields = [...this.editTypeInfoFormFields],
- dialogTitle = '';
+ dialogTitle = create ? i18n.button.createType() : i18n.button.editTypeInfo();
this.setFormData('typeInfoFrom', fields);
- // this.formTarget.typeInfoFrom.updateFields({
- // typeName: { value: '' }
- // });
- // this.opId = null;
- dialogTitle = i18n.button.createType();
+ if (!create) {
+ this.formTarget.typeInfoFrom.updateFields({
+ name: { value: data.name }
+ });
+ }else {
+ this.selectedTreeNodeInfo.domid = null;
+ }
+
this.setDialogVisible('editTypeInfo', true, dialogTitle);
}
- @action doGroupSetting = () => {
+ @action("分组维护") doGroupSetting = () => {
this.tableEditConfig.groupSetting.datas.length = 0;
let arr = [];
this.tabRecord.map(tabInfo => {
@@ -920,36 +874,27 @@ export class FieldDefinedStore extends HrmBaseStore {
}
- @action doSaveTypeInfo = () => {
+ @action("保存类型") doSaveTypeInfo = () => {
this.formTarget.typeInfoFrom.validateForm().then(f => {
if (f.isValid) {
- let record = {
- ...this.formTarget.typeInfoFrom.getFormParams(),
- }
+ debugger
let params = {
- data: JSON.stringify({
- record: record
- })
+ ... this.formTarget.typeInfoFrom.getFormParams(),
+ id: this.selectedTreeNodeInfo.domid
}
- // api.saveTypeInfo(this.moduleName, params).then(data => {
- // if (data.status === '1') {
- // this.setDialogVisible('editGroupInfo', false, '');
- // if (this.moveToGroup) {
- // const ids = data.groupid.split(',');
- // this.changeGroup(null, ids[ids.length - 1]);
- // } else {
- // //if (this.moduleName.indexOf('resource') >= 0)
- // this.getTabInfoByTreeNode();
- // // else
- // // this.initData(this.opId == null);
- // message.success(i18n.message.saveSuccess());
- // }
- // } else
- // message.error(data.message);
- // }, error => {
- // message.error(i18n.message.actionError());
- // });
- this.getTree()
+ api.changeTypeInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ this.setDialogVisible('editTypeInfo', false, '');
+ this.getTree()
+ message.success(i18n.message.saveSuccess());
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
} else {
f.showErrors();
this.showError = new Date().getTime();
@@ -957,7 +902,7 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- doSaveGroupInfo = () => {
+ @action("分组保存") doSaveGroupInfo = () => {
this.formTarget.groupInfoFrom.validateForm().then(f => {
if (f.isValid) {
let record = {
@@ -972,51 +917,33 @@ export class FieldDefinedStore extends HrmBaseStore {
this.showError = new Date().getTime();
return;
}
- let found = false,
- records = [];
- this.opId != null && Object.assign(record, {
- id: this.opId,
- isShow: this.activeTabInfo.tabInfo.isShow
- });
- this.tabConfig.tabs.map(tabInfo => {
- if (tabInfo.groupid === this.opId) {
- found = true;
- records.push(record)
- } else {
- records.push({
- id: tabInfo.groupid,
- isShow: tabInfo.isShow,
- groupName: tabInfo.title
- })
- }
- });
- !found && records.push(record);
let params = {
- data: JSON.stringify({
- records: records
- })
+ ...this.formTarget.groupInfoFrom.getFormParams(),
+ isShow: 1
}
+
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key
- api.saveGroupInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.saveGroupInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
this.setDialogVisible('editGroupInfo', false, '');
if (this.moveToGroup) {
- const ids = data.groupid.split(',');
+ const ids = data.data.groupid.split(',');
this.changeGroup(null, ids[ids.length - 1]);
} else {
- //if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode();
- // else
- // this.initData(this.opId == null);
message.success(i18n.message.saveSuccess());
}
- } else
- message.error(data.message);
- }, error => {
- message.error(i18n.message.actionError());
- });
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
} else {
f.showErrors();
this.showError = new Date().getTime();
@@ -1341,7 +1268,8 @@ export class FieldDefinedStore extends HrmBaseStore {
dataObj.groupType = this.selectedTreeNodeInfo.key;
params.groupType = this.selectedTreeNodeInfo.key;
}
- params.data = JSON.stringify(dataObj);
+ params.data = dataObj;
+
api.saveGroupInfo(this.moduleName, params).then(data => {
if (data.status === '1') {
this.setDialogVisible('groupInfoSetting', false, '');
@@ -1355,6 +1283,7 @@ export class FieldDefinedStore extends HrmBaseStore {
}, error => {
message.error(i18n.message.actionError());
});
+
} else {
message.error(i18n.confirm.groupNameExist());
}
@@ -1446,27 +1375,21 @@ export class FieldDefinedStore extends HrmBaseStore {
this.selectedTreeNodeInfo = null;
this.dropdownSelectedKey = '1';
this.moduleName = module;
- // let columns = cloneDeep(this.fieldDefColumns())
- // columns.splice(1, 1);
- // columns[1].width = '65%';
- // this.tableEditConfig.fieldDef.columns = this.getColumns();
this.treeConfig.treeExpandKeys.length = 0;
- api.getTree().then(data => {
- if (data.status === '1') {
+ api.getTree(this.moduleName).then(res => {
+ if (res.code === 200) {
this.containerInitFinished = {
...this.containerInitFinished,
init: true
}
-
- // this.setTableEditColTitle();
- if (data.treejson.length > 0) {
- this.treeConfig.data = data.treejson;
- this.treeConfig.selectedKeys = [data.treejson[0].key];
- this.selectedTreeNodeInfo = data.treejson[0];
+ if (res.data.length > 0) {
+ this.treeConfig.data = res.data;
+ this.treeConfig.selectedKeys = [res.data[0].key];
+ this.selectedTreeNodeInfo = res.data[0];
this.getTabInfoByTreeNode(null, true);
}
} else {
- message.error(data.message);
+ message.error(res.msg);
}
}, error => { })
}
@@ -1474,9 +1397,9 @@ export class FieldDefinedStore extends HrmBaseStore {
getTree = (callback) => {
this.treeConfig.data.length = 0;
this.refreshTree = new Date().getTime();
- api.getTree().then(data => {
- if (data.status === '1') {
- this.treeConfig.data = data.treejson;
+ api.getTree(this.moduleName).then(res => {
+ if (res.code === 200) {
+ this.treeConfig.data = res.data;
this.treeConfig.data.map(p => {
if (p.domid === this.treeConfig.selectedKeys[0])
this.selectedTreeNodeInfo = p;
@@ -1487,7 +1410,7 @@ export class FieldDefinedStore extends HrmBaseStore {
})
callback && callback();
} else {
- message.error(data.message);
+ message.error(res.msg);
}
this.refreshTree = new Date().getTime();
}, error => { })
@@ -1497,38 +1420,46 @@ export class FieldDefinedStore extends HrmBaseStore {
if (!this.selectedTreeNodeInfo.hasGroup) {
t.topButtonDef.splice(1, 3);
}
- if (this.selectedTreeNodeInfo.addChild) {
+ t.topButtonDef.push({
+ comType: 'button',
+ type: 'primary',
+ onClickHandle: () => this.editTypeInfo(false, {
+ name: this.selectedTreeNodeInfo.name,
+ }),
+ label: i18n.button.editTypeInfo(),
+ icon: this.menuIconCollection.setting
+ })
+ if (this.selectedTreeNodeInfo.addChild) { //非子节点
this.tableEditConfig.childInfoSetting.showTitle = true;
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
- // this.selectedTreeNodeInfo.domid != '-1' && t.topButtonDef.push({
- // comType: 'button',
- // type: 'primary',
- // onClickHandle: this.doChildInfoSetting,
- // label: i18n.button.childInfoMaintain(),
- // icon: this.menuIconCollection.setting,
- // checkAction: 'childInfoOperability'
- // });
+ let domid = this.selectedTreeNodeInfo.domid;
+ //非基本类型()
+ (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
+ comType: 'button',
+ type: 'primary',
+ onClickHandle: this.doChildInfoSetting,
+ label: i18n.button.childInfoMaintain(),
+ icon: this.menuIconCollection.setting,
+ checkAction: 'childInfoOperability'
+ }) && t.topButtonDef.push({
+ comType: 'button',
+ type: 'primary',
+ onClickHandle: this.removeTypeInfo,
+ label: i18n.button.delete(),
+ icon: this.menuIconCollection.setting
+ });
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
this.tableEditConfig.childInfoSetting.showDelete = false;
- this.selectedTreeNodeInfo.domid != '-1' && t.topButtonDef.push({
+ t.topButtonDef.push({
comType: 'button',
type: 'primary',
- onClickHandle: () => this.createChildInfo(false, {
- name: this.selectedTreeNodeInfo.name,
- multiName: this.selectedTreeNodeInfo.multiName
- }),
- label: i18n.button.editChildInfo(),
- icon: this.menuIconCollection.setting
- }) && t.topButtonDef.push({
- comType: 'button',
- type: 'primary',
- onClickHandle: this.removeChildInfo,
+ onClickHandle: this.removeTypeInfo,
label: i18n.button.delete(),
icon: this.menuIconCollection.setting
- });
+ })
}
if (this.selectedTreeNodeInfo.domid === '-1' || this.selectedTreeNodeInfo.addChild) {
@@ -1553,12 +1484,12 @@ export class FieldDefinedStore extends HrmBaseStore {
@action getTabInfoByTreeNode = (create = false, init = false, isLeaf) => {
api.getTabInfo(this.moduleName, {
groupType: this.treeConfig.selectedKeys[0]
- }).then(data => {
- if (data.status === '1') {
- this._groupInfoOperability = data.tabs.length === 0;
+ }).then(res => {
+ if (res.code === 200) {
+ this._groupInfoOperability = res.data.tabs.length === 0;
let tabArr = [];
- this.tabRecord = data.tabs;
- data.tabs && data.tabs.map((tabInfo, index) => {
+ this.tabRecord = res.data.tabs;
+ res.data.tabs && res.data.tabs.map((tabInfo, index) => {
let t = cloneDeep(this.tabDef);
this.setBtn(t);
tabArr.push({
@@ -1616,6 +1547,9 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('createChildInfo', true, dialogTitle);
}
+
+
+
@action doSaveChildInfo = () => {
this.formTarget.childInfoForm.validateForm().then(f => {
if (f.isValid) {
From 19e1d07e3c4153b3bf801d9aec9b990a63078e93 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 16 Jun 2022 18:35:17 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/fieldDefined.js | 59 ++++--
.../fieldDefinedSet/FieldDefined.js | 15 +-
pc4mobx/organization/stores/baseStore.js | 3 +-
pc4mobx/organization/stores/fieldDefined.js | 180 ++++++++++--------
4 files changed, 155 insertions(+), 102 deletions(-)
diff --git a/pc4mobx/organization/apis/fieldDefined.js b/pc4mobx/organization/apis/fieldDefined.js
index a642d7d..8306fbb 100644
--- a/pc4mobx/organization/apis/fieldDefined.js
+++ b/pc4mobx/organization/apis/fieldDefined.js
@@ -7,16 +7,12 @@ import {
* @param {Object} params [description]
* @return {[type]} [description]
*/
-export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi('/api/bs/hrmorganization/fieldDefined/getTabInfo', 'GET', params)
+export const getTabInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTabInfo`, 'GET', params)
-export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/getFieldDefinedInfo?is_multilang_set=true`, 'GET', params)
+export const getFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getFieldDefinedInfo`, 'GET', params)
-export const saveFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/save`, 'POST', params)
-
-export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
-
-export const saveGroupInfo = (moduleName,params) => {
- return fetch('/api/bs/hrmorganization/fieldDefined/saveTitle', {
+export const saveFieldDefinedInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
method: 'POST',
mode: 'cors',
headers: {
@@ -26,6 +22,30 @@ export const saveGroupInfo = (moduleName,params) => {
})
}
+export const removeFieldDefinedInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/del`, 'POST', params)
+
+export const saveGroupInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTitle`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
+export const saveGroupSettingInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveGroup`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
export const changeTypeInfo = (moduleName,params) => {
return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/changeTree`, {
@@ -38,13 +58,30 @@ export const changeTypeInfo = (moduleName,params) => {
})
}
+export const removeGroupInfo = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/deleteTitle`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
-export const removeGroupInfo = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/delGroup`, 'POST', params)
-
export const getTree = (moduleName,params = {}) => WeaTools.callApi(`/api/bs/hrmorganization/fieldDefined/${moduleName}/getTree`, 'GET', params)
-export const saveTree = (params = {}) => WeaTools.callApi(`/api/hrm/resourcefielddefined/saveTree`, 'POST', params)
+export const saveTree = (moduleName,params) => {
+ return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveTree`, {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
export const changeGroup = (moduleName, params = {}) => WeaTools.callApi(`/api/hrm/${moduleName}/changeGroup`, 'POST', params)
diff --git a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
index 698ff79..c2812e6 100644
--- a/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
+++ b/pc4mobx/organization/components/fieldDefinedSet/FieldDefined.js
@@ -56,20 +56,18 @@ export default class FieldDefined extends Component {
let moduleName, logSmallType;
if (moduleType === 'subCompany') {
moduleName = 'subcompanyfielddefined';
- //logSmallType = 'HRM_ENGINE_SUBCOMPANYFIELDDEFINED';
} else if (moduleType === 'department') {
moduleName = 'departmentfielddefined';
- //logSmallType = 'HRM_ENGINE_DEPARTMENTFIELDDEFINED';
} else if(moduleType === 'job') {
moduleName = 'jobfielddefined';
}else {
moduleName = 'resourcefielddefined';
- //logSmallType = 'HRM_ENGINE_RESOURCEFIELDDEFINED';
}
// let callbackFunc = () => initData(false, true, moduleName);
// if (moduleType === 'resource')
- let callbackFunc = () => initResourceData(moduleName);
- checkAuthorized(moduleName, null, callbackFunc);
+ //let callbackFunc = () => initResourceData(moduleName);
+ //checkAuthorized(moduleName, null, callbackFunc);
+ initResourceData(moduleName);
this.setState({ logSmallType })
}
@@ -87,7 +85,7 @@ export default class FieldDefined extends Component {
fieldDefined: store,
params
} = this.props, {
- containerInitFinished,
+ //containerInitFinished,//权限验证
refreshMainTabComponent,
spinning
} = store, {
@@ -145,7 +143,8 @@ export default class FieldDefined extends Component {
}
}
let children = [];
- if (containerInitFinished.init && containerInitFinished.authorized) {
+ const hasRight = true;//todo
+ if (hasRight) {
const {
data,
onSelectedTreeNode,
@@ -176,7 +175,7 @@ export default class FieldDefined extends Component {
)
]
- } else if (containerInitFinished.init && !containerInitFinished.authorized) {
+ } else {
children = [
(
diff --git a/pc4mobx/organization/stores/baseStore.js b/pc4mobx/organization/stores/baseStore.js
index 0a23a00..fe5b741 100644
--- a/pc4mobx/organization/stores/baseStore.js
+++ b/pc4mobx/organization/stores/baseStore.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:14:20
- * @LastEditTime: 2022-06-13 14:50:36
+ * @LastEditTime: 2022-06-16 18:26:17
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/baseStore.js
*/
@@ -540,6 +540,7 @@ export default class HrmBaseStore {
return otherParams;
}
+ //重新计算列
convertData = (datas, target) => {
let tData = [],
selectedData = this.generateTableSelectedData(target);
diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js
index e64f25f..c2950f2 100644
--- a/pc4mobx/organization/stores/fieldDefined.js
+++ b/pc4mobx/organization/stores/fieldDefined.js
@@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-06-09 10:16:00
- * @LastEditTime: 2022-06-15 18:47:39
+ * @LastEditTime: 2022-06-16 18:34:18
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js
*/
@@ -648,10 +648,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tabConfig.tabs = [...tabArr];
// this.setTableEditColTitle();
this.setActiveTab(this.tabConfig, init ? '1' : !create ? this.tabConfig.activeTabKey : `${tabArr.length}`);
- this.containerInitFinished = {
- ...this.containerInitFinished,
- init: true
- }
+ // this.containerInitFinished = {
+ // ...this.containerInitFinished,
+ // init: true
+ // }
}
} else {
message.error(data.message);
@@ -696,38 +696,38 @@ export class FieldDefinedStore extends HrmBaseStore {
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key
this.spinning = true;
- api.getFieldDefinedInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+
+ api.getFieldDefinedInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(res => {
+ if (res.code === 200) {
const {
datas,
selectedData
- } = this.convertData(data.data, 'fieldDef');
- this.encryptEnable = data.encryptEnable;
+ } = this.convertData(res.data.data, 'fieldDef');
+ this.encryptEnable = res.data.encryptEnable;
this.tableEditConfig.fieldDef.datas = datas;
this.tableEditConfig.fieldDef.columns = this.getColumns();
-
- //人员卡片字段定义columns是动态的,因此需要重新计算得出selectedData
- if (this.moduleName === 'resourcefielddefined') {
- const {
- selectedData
- } = this.convertData(data.data, 'fieldDef');
- this.tableEditConfig.fieldDef.selectedData = selectedData;
- } else {
- this.tableEditConfig.fieldDef.selectedData = selectedData;
- }
+ this.tableEditConfig.fieldDef.selectedData = selectedData;
if (this.tabRecord.length > 0) {
- this.tabRecord[this.activeTabInfo.activeTabIndex].editable = (data.data.length === 0);
- this.activeTabInfo.tabInfo.editable = (data.data.length === 0);
+ this.tabRecord[this.activeTabInfo.activeTabIndex].editable = (res.data.data.length === 0);
+ this.activeTabInfo.tabInfo.editable = (res.data.data.length === 0);
}
- } else
- message.error(data.message);
+ } else {
+ message.warning(res.msg);
+ }
this.spinning = false;
this.refreshMainTabComponent = new Date().getTime();
- }, error => { this.spinning = false; })
+ }).catch(error => {
+ this.spinning = false;
+ message.warning(error.msg);
+ })
+
+
}
- @action onTabEdit = (targetKey, action) => {
+ @action("分组tab删除") onTabEdit = (targetKey, action) => {
const tabIndex = this.getTabIndex(this.tabConfig.tabs, targetKey);
if (tabIndex < 0) return;
const tabInfo = this.tabConfig.tabs[tabIndex];
@@ -741,18 +741,19 @@ export class FieldDefinedStore extends HrmBaseStore {
}
if (this.selectedTreeNodeInfo != null)
params.groupType = this.selectedTreeNodeInfo.key
- api.removeGroupInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+
+ api.removeGroupInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
this.tabConfig.activeTabKey = '1';
- // if (this.moduleName.indexOf('resource') >= 0)
- // this.getTabInfoByTreeNode();
- // else
- // this.initData();
this.getTabInfoByTreeNode();
} else {
- message.error(data.message);
+ message.warning(data.msg);
}
+ }).catch(error => {
+ message.warning(error.msg);
})
}
});
@@ -819,10 +820,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.formTarget.typeInfoFrom.updateFields({
name: { value: data.name }
});
- }else {
+ } else {
this.selectedTreeNodeInfo.domid = null;
}
-
+
this.setDialogVisible('editTypeInfo', true, dialogTitle);
}
@@ -877,7 +878,6 @@ export class FieldDefinedStore extends HrmBaseStore {
@action("保存类型") doSaveTypeInfo = () => {
this.formTarget.typeInfoFrom.validateForm().then(f => {
if (f.isValid) {
- debugger
let params = {
... this.formTarget.typeInfoFrom.getFormParams(),
id: this.selectedTreeNodeInfo.domid
@@ -1019,18 +1019,20 @@ export class FieldDefinedStore extends HrmBaseStore {
return;
}
- api.saveFieldDefinedInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.saveFieldDefinedInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
message.success(i18n.message.saveSuccess());
- // if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode();
- // else
- // this.initData();
} else {
- message.error(data.message);
+ message.warning(data.msg);
}
this.spinning = false;
- }, error => { this.spinning = false; })
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
} else {
message.error(i18n.confirm.displayOrDBFieldExist());
this.spinning = false;
@@ -1243,7 +1245,7 @@ export class FieldDefinedStore extends HrmBaseStore {
return sel;
}
- doSaveGroupSetting = () => {
+ @action("分组维护保存") doSaveGroupSetting = () => {
this.recordOP(this.editTable['groupSetting'], 'valid');
let groupNameArr = [],
tabArr = [];
@@ -1270,26 +1272,27 @@ export class FieldDefinedStore extends HrmBaseStore {
}
params.data = dataObj;
- api.saveGroupInfo(this.moduleName, params).then(data => {
- if (data.status === '1') {
+ api.saveGroupSettingInfo(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
this.setDialogVisible('groupInfoSetting', false, '');
- // if (this.moduleName.indexOf('resource') >= 0)
this.getTabInfoByTreeNode(false, true);
- // else
- // this.initData(false, true);
message.success(i18n.message.saveSuccess());
- } else
- message.error(data.message);
- }, error => {
- message.error(i18n.message.actionError());
- });
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
} else {
message.error(i18n.confirm.groupNameExist());
}
}
- @action onGroupSettingDeleteOpr = (ks, ds, type) => {
+ @action("分组维护中删除") onGroupSettingDeleteOpr = (ks, ds, type) => {
+ debugger
let ids = [];
ds.map(d => {
if (has(d, 'id'))
@@ -1315,7 +1318,7 @@ export class FieldDefinedStore extends HrmBaseStore {
} else { }
}
- //人员卡片字段定义部分
+ //字段定义部分
@observable refreshTree = new Date().getTime();
@observable treeConfig = {
data: [],
@@ -1330,7 +1333,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.getTabInfoByTreeNode(null, true);
}
}
- //人员卡片字段定义-选中树节点的信息
+ //选中树节点的信息
@observable selectedTreeNodeInfo;
//计算【工作信息】树节点以及子节点的domid
@@ -1378,10 +1381,10 @@ export class FieldDefinedStore extends HrmBaseStore {
this.treeConfig.treeExpandKeys.length = 0;
api.getTree(this.moduleName).then(res => {
if (res.code === 200) {
- this.containerInitFinished = {
- ...this.containerInitFinished,
- init: true
- }
+ // this.containerInitFinished = {
+ // ...this.containerInitFinished,
+ // init: true
+ // }
if (res.data.length > 0) {
this.treeConfig.data = res.data;
this.treeConfig.selectedKeys = [res.data[0].key];
@@ -1434,21 +1437,23 @@ export class FieldDefinedStore extends HrmBaseStore {
this.tableEditConfig.childInfoSetting.showAdd = true;
this.tableEditConfig.childInfoSetting.showDelete = true;
let domid = this.selectedTreeNodeInfo.domid;
- //非基本类型()
- (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
+ t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.doChildInfoSetting,
label: i18n.button.childInfoMaintain(),
- icon: this.menuIconCollection.setting,
- checkAction: 'childInfoOperability'
- }) && t.topButtonDef.push({
+ icon: this.menuIconCollection.setting
+ //checkAction: 'childInfoOperability'
+ });
+ //非基本类型()
+ (domid != '-1' && domid != '-2' && domid != '-3' && domid != '-4') && t.topButtonDef.push({
comType: 'button',
type: 'primary',
onClickHandle: this.removeTypeInfo,
label: i18n.button.delete(),
icon: this.menuIconCollection.setting
});
+
} else {
this.tableEditConfig.childInfoSetting.showTitle = false;
this.tableEditConfig.childInfoSetting.showAdd = false;
@@ -1462,6 +1467,8 @@ export class FieldDefinedStore extends HrmBaseStore {
})
}
+
+
if (this.selectedTreeNodeInfo.domid === '-1' || this.selectedTreeNodeInfo.addChild) {
this.tableEditConfig.fieldDef.columns[2].com[0].options = remove(this.tableEditConfig.fieldDef.columns[1].com[0].options, (v) => v != 'upload');
} else {
@@ -1550,7 +1557,7 @@ export class FieldDefinedStore extends HrmBaseStore {
- @action doSaveChildInfo = () => {
+ @action("编辑子信息保存(f)") doSaveChildInfo = () => {
this.formTarget.childInfoForm.validateForm().then(f => {
if (f.isValid) {
let record = {
@@ -1625,7 +1632,8 @@ export class FieldDefinedStore extends HrmBaseStore {
}, error => {
message.error(i18n.message.actionError());
});
- // }
+
+
} else {
f.showErrors();
this.showError = new Date().getTime();
@@ -1633,7 +1641,7 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- @action doChildInfoSetting = () => {
+ @action("子信息维护") doChildInfoSetting = () => {
this.tableEditConfig.childInfoSetting.datas.length = 0;
let arr = [];
if (!this.selectedTreeNodeInfo.addChild) {
@@ -1653,6 +1661,7 @@ export class FieldDefinedStore extends HrmBaseStore {
}
})
} else {
+ this.selectedTreeNodeInfo.childs = this.selectedTreeNodeInfo.childs ? this.selectedTreeNodeInfo.childs : [];
this.selectedTreeNodeInfo.childs.map(child => {
let viewAttr = child.viewAttr;
if (viewAttr != 1 && has(child, 'editable')) {
@@ -1698,6 +1707,7 @@ export class FieldDefinedStore extends HrmBaseStore {
this.setDialogVisible('childInfoSetting', true, i18n.button.childInfoMaintain());
}
+
convertAttr = (cloneTree) => {
let arr = [];
cloneTree.map(root => {
@@ -1763,7 +1773,8 @@ export class FieldDefinedStore extends HrmBaseStore {
});
}
- doSaveChildInfoSetting = () => {
+ @action("保存子信息维护") doSaveChildInfoSetting = () => {
+ debugger
this.recordOP(this.editTable['childInfoSetting'], 'valid');
let infoNameArr = [],
infoArr = [];
@@ -1772,7 +1783,7 @@ export class FieldDefinedStore extends HrmBaseStore {
infoArr.push({
id: group.id,
isShow: group.isShow == null ? '0' : group.isShow,
- name: group.name
+ groupName: group.name
})
return group.name === '';
})
@@ -1802,30 +1813,35 @@ export class FieldDefinedStore extends HrmBaseStore {
})
})
}
-
const params = {
- data: JSON.stringify({
- records: this.convertAttr(cloneTree)
- }),
+ // data: JSON.stringify({
+ // records: this.convertAttr(cloneTree)
+ // }),
+ data: JSON.stringify(infoArr),
parentId
}
- api.saveTree(params).then(data => {
- if (data.status === '1') {
+
+ api.saveTree(this.moduleName, params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
this.setDialogVisible('childInfoSetting', false, '');
this.getTree();
this.getTabInfoByTreeNode(null, true);
message.success(i18n.message.saveSuccess());
- } else
- message.error(data.message);
- }, error => {
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
message.error(i18n.message.actionError());
- });
+ })
+
} else {
message.error(i18n.confirm.groupNameExist());
}
}
- //移动到组
- @action dropdownClick = (e) => {
+
+ @action("移动到组") dropdownClick = (e) => {
switch (e.key) {
case 'createAndMove':
this.editGroup(null, true);