From 67ccf9cbba13c73b6a54573cf5c6aee6b0ce5fca Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 26 Aug 2022 15:28:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=BF=A1=E6=81=AF=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/apis/resourceBasicInfo.js | 68 +++++++++++ .../components/resource/ResourceBasicInfo.js | 103 +++++++--------- pc4mobx/organization/public/i18n.js | 4 +- .../organization/stores/reserouseBasicInfo.js | 110 +++++++----------- 4 files changed, 150 insertions(+), 135 deletions(-) diff --git a/pc4mobx/organization/apis/resourceBasicInfo.js b/pc4mobx/organization/apis/resourceBasicInfo.js index e69de29..f827f6d 100644 --- a/pc4mobx/organization/apis/resourceBasicInfo.js +++ b/pc4mobx/organization/apis/resourceBasicInfo.js @@ -0,0 +1,68 @@ + +import { + WeaTools +} from 'ecCom' + +export const getSearchList = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getTable', 'GET', params); +} + +export const deleteTableData = (params) => { + return fetch('/api/bs/hrmorganization/resourceBasicInfo/delete', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const recoverData = (params) => { + return fetch('/api/bs/hrmorganization/resourceBasicInfo/recover', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getAdvanceSearchCondition = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getSearchCondition', 'GET', params); +} + +export const add = (params) => { + return fetch('/api/bs/hrmorganization/resourceBasicInfo/save', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const edit = (params) => { + return fetch('/api/bs/hrmorganization/resourceBasicInfo/update', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getForm = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getForm', 'GET', params); +} + +export const getHasRight = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getHasRight', 'GET', params); +} + +export const getTree = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/resourceBasicInfo/getTreeData', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/resource/ResourceBasicInfo.js b/pc4mobx/organization/components/resource/ResourceBasicInfo.js index 1dbb5b7..8be6c00 100644 --- a/pc4mobx/organization/components/resource/ResourceBasicInfo.js +++ b/pc4mobx/organization/components/resource/ResourceBasicInfo.js @@ -19,7 +19,8 @@ import { Modal, Button, message, - Switch + Switch, + Tag } from 'antd' import { WeaSwitch, @@ -111,7 +112,7 @@ export default class ResourceBasicInfo extends React.Component { resourceBasicInfo } = this.props; - resourceBasicInfo.setNeDialogTitle(i18n.label.newJobLevel()); + resourceBasicInfo.setNeDialogTitle(i18n.label.newResourceBasicInfo()); resourceBasicInfo.setIsNew(true); resourceBasicInfo.setVisible(true); resourceBasicInfo.getForm(); @@ -129,6 +130,7 @@ export default class ResourceBasicInfo extends React.Component { resourceBasicInfo.setIds(keys); this.showConfirm('batchDel'); } + showConfirm(v) { let _this = this; confirm({ @@ -144,6 +146,7 @@ export default class ResourceBasicInfo extends React.Component { }, }); } + onOk() { const { resourceBasicInfo @@ -216,60 +219,27 @@ export default class ResourceBasicInfo extends React.Component { !this.isEmptyObject(form2.getFormParams()) && resourceBasicInfo.updateFields(val); } - changeData(key) { - const { - resourceBasicInfo - } = this.props; - resourceBasicInfo.changeData(key); - } reRenderColumns(columns) { let _this = this; columns.forEach((c, index) => { - if (c.dataIndex == 'forbidden_tag') { + if (c.dataIndex == 'fdelete') { c.render = function (text, record) { - return _this.updateForbiddenTag(checked, record.id)} /> + return record.fdelete == '0' ? 正常 : 停用 } }; }) } - updateForbiddenTag(checked, id) { - const { - resourceBasicInfo - } = this.props; - confirm({ - title: i18n.confirm.defaultTitle(), - content: (checked == true) ? i18n.confirm.enableTag() : i18n.confirm.forbiddenTag(), - okText: i18n.button.ok(), - cancelText: i18n.button.cancel(), - onOk() { - resourceBasicInfo.updateForbiddenTag(checked, id); - }, - onCancel() { - return false; - }, - }); - } - onOperatesClick(record, rowIndex, operate) { const { index } = operate; (index == '0') && this.doEdit(record.randomFieldId); (index == '1') && this.doDel(record.randomFieldId); + (index == '2') && this.doRecover(record.randomFieldId); } - custom = () => { - const { - resourceBasicInfo - } = this.props, { - tableStore, - } = resourceBasicInfo; - - tableStore.setColSetVisible(true); - tableStore.tableColSet(true); - } doEdit(id) { const { @@ -277,7 +247,7 @@ export default class ResourceBasicInfo extends React.Component { } = this.props; resourceBasicInfo.setNeDialogTitle(i18n.label.editJobLevel()); - resourceBasicInfo.setLevelId(id); + resourceBasicInfo.setFId(id); resourceBasicInfo.setIsNew(false); resourceBasicInfo.setVisible(true); resourceBasicInfo.getForm(); @@ -291,6 +261,33 @@ export default class ResourceBasicInfo extends React.Component { this.showConfirm('del'); } + doRecover(id) { + const { + resourceBasicInfo + } = this.props; + this.showRecoverConfirm(id); + } + + showRecoverConfirm(id) { + const { + resourceBasicInfo + } = this.props; + confirm({ + title: i18n.confirm.defaultTitle(), + content: i18n.confirm.recoverConfirm(), + okText: i18n.button.ok(), + cancelText: i18n.button.cancel(), + onOk() { + resourceBasicInfo.recover(id); + }, + onCancel() { + return false; + }, + }); + } + + + handleSave() { const { @@ -363,7 +360,7 @@ export default class ResourceBasicInfo extends React.Component { log = () => { window.setLogViewProp({ - logMoudleType: 2, + logMoudleType: 11, keys: new Date().getTime(), }); } @@ -375,8 +372,8 @@ export default class ResourceBasicInfo extends React.Component { resourceBasicInfo } = this.props; const { - isPanelShow, form2, levelName, conditionNum, tableStore, nEdialogTitle, visible, condition, - form, dialogLoading, isEdit, selectedKey, topTab, topTabCount, date, hasRight, treeConfig, treeLoading + isPanelShow, form2, fname, conditionNum, tableStore, nEdialogTitle, visible, condition, + form, dialogLoading, isEdit, date, hasRight, treeConfig, treeLoading } = resourceBasicInfo; if (hasRight === false) { @@ -393,7 +390,7 @@ export default class ResourceBasicInfo extends React.Component { const treeCom = ( this.handleMenuClick(e)} > - - resourceBasicInfo.setPanelStatus(bool)} - hideSearchAd={() => resourceBasicInfo.setPanelStatus(false)} - searchsAd={isPanelShow ? this.getPanelComponents() :
} - advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} - hasMask={false} - buttonsAd={this.getTabBtn()} - onSearch={() => resourceBasicInfo.getTableInfo()} - onSearchChange={val => this.onSearchChange(val)} - /> getLabel(386246, '新建人员'), resourceMange: () => getLabel(386246, '人员管理'), resourceBasicInfo: () => getLabel(386246, '人员信息'), + newResourceBasicInfo: () => getLabel(386246, '新建人员资料'), + authorizationGroup: () => getLabel(492, '权限组'), @@ -951,7 +953,7 @@ export const i18n = { confirm: { forbiddenTag: () => getLabel(-131329, '确定禁用该记录吗'), enableTag: () => getLabel(-131328, '确定启用该记录吗'), - + recoverConfirm: () => getLabel(-131310, '确定恢复该记录吗'), defaultTitle: () => getLabel(131329, '信息确认'), removeGroupInfo: () => getLabel(383053, '删除分组,该分组下的字段将显示到“基本信息”分组中,确定要删除吗?'), diff --git a/pc4mobx/organization/stores/reserouseBasicInfo.js b/pc4mobx/organization/stores/reserouseBasicInfo.js index 5078808..5fa9ab0 100644 --- a/pc4mobx/organization/stores/reserouseBasicInfo.js +++ b/pc4mobx/organization/stores/reserouseBasicInfo.js @@ -3,7 +3,7 @@ import { action } from 'mobx'; import * as mobx from 'mobx'; -import * as Api from '../apis/joblevel'; // 引入API接口文件 +import * as Api from '../apis/resourceBasicInfo'; // 引入API接口文件 import { WeaForm } from 'comsMobx'; @@ -32,21 +32,17 @@ export class ResourceBasicInfoStore { @observable isEdit = true; @observable isNew = true; @observable isPanelShow = false; //高级搜索面板 - @observable form2 = new WeaForm(); - @observable form = new WeaForm(); - @observable form1 = new WeaForm(); - @observable levelName = ''; + @observable form2 = new WeaForm(); //高级搜索 + @observable form = new WeaForm(); //新增编辑 + @observable fname = ''; @observable conditionNum = 2; @observable ids = ''; //选择行id @observable searchConditionLoading = true; @observable nEdialogTitle = ''; @observable visible = false; @observable dialogLoading = true; - @observable levelId = ''; + @observable fId = ''; @observable date = ''; - @observable selectedKey = -1; - @observable topTab = []; - @observable topTabCount = {}; @observable hasRight = ''; @observable treeLoading = true; @@ -89,13 +85,13 @@ export class ResourceBasicInfoStore { @action getTableInfo() { let params = { - schemeId: this.selectedTreeNodeInfo && this.selectedTreeNodeInfo.domid, + fclassid: this.selectedTreeNodeInfo && this.selectedTreeNodeInfo.domid, } this.tableStore = new TableStore(); if (this.isEmptyObject(this.form2.getFormParams())) { params = { ...params, - levelName: this.levelName, + fname: this.fname, }; } else { params = { @@ -135,6 +131,25 @@ export class ResourceBasicInfoStore { }) } + //恢复 + recover(id){ + let params = { + ids: id + }; + Api.recoverData(params).then(response => { + return response.json() + }).then(data => { + if (data.code === 200) { + message.success(i18n.message.opSuccess()); + this.getTableInfo(); + } else { + message.warning(data.msg); + } + }).catch(error => { + message.warning(error.msg); + }) + } + save() { let params = { ...this.form.getFormParams() @@ -162,7 +177,7 @@ export class ResourceBasicInfoStore { } edit() { - let params = { ...this.form.getFormParams(), id: this.levelId }; + let params = { ...this.form.getFormParams(), fid: this.fId }; this.form.validateForm().then(f => { if (f.isValid) { Api.edit(params).then(response => { @@ -185,40 +200,19 @@ export class ResourceBasicInfoStore { }); } - changeData(key) { - this.setSelectedKey(key); - this.getTableInfo(); - } - - updateForbiddenTag(checked, id) { - let params = { - forbiddenTag: checked, - id: id - } - Api.updateForbiddenTag(params).then(response => { - return response.json() - }).then(data => { - if (data.code === 200) { - message.success(data.msg); - this.getTableInfo(); - } else { - message.warning(data.msg); - } - }).catch(error => { - message.warning(error.msg); - }) - } getForm() { - let params = this.isNew ? {} : { - id: this.levelId + let params = this.isNew ? { + fclassid: this.selectedTreeNodeInfo.domid + } : { + fid: this.fId } this.setDialogLoadingStatus(true); - Api.getLevelForm(params).then(res => { + Api.getForm(params).then(res => { if (res.code === 200) { this.setDialogLoadingStatus(false); - res.data.condition && this.setCondition(res.data.condition); - res.data.condition && this.form.initFormFields(res.data.condition); + res.data && this.setCondition(res.data); + res.data && this.form.initFormFields(res.data); } else { message.warning(res.msg); } @@ -243,21 +237,6 @@ export class ResourceBasicInfoStore { }) } - @action - getTabInfo() { - Api.getTabInfo().then(res => { - if (res.code === 200) { - res.data.topTabs && this.setTopTab(res.data.topTabs); - res.data.topTabCount && this.setTopTabCount(res.data.topTabCount); - } else { - message.warning(res.msg); - } - }, error => { - message.warning(error.msg); - }) - } - - @action getHasRight() { Api.getHasRight().then(res => { @@ -274,7 +253,7 @@ export class ResourceBasicInfoStore { updateFields(val) { this.form2.updateFields({ - levelName: { + fname: { value: val } }); @@ -296,8 +275,8 @@ export class ResourceBasicInfoStore { } } - setLevelName(val) { - this.levelName = val; + setFName(val) { + this.fname = val; } isEmptyObject(obj) { @@ -346,25 +325,14 @@ export class ResourceBasicInfoStore { this.condition = condition; } - setLevelId(levelId) { - this.levelId = levelId; + setFId(fId) { + this.fId = fId; } setDate(date) { this.date = date; } - setSelectedKey(selectedKey) { - this.selectedKey = selectedKey; - } - - setTopTab(topTab) { - this.topTab = topTab; - } - - setTopTabCount(topTabCount) { - this.topTabCount = topTabCount; - } setTopMenu(topMenu) { this.topMenu = topMenu;