From 07dec3350fb97ace2683f38b6f85a968d72225bc Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 29 Jun 2022 18:37:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/resource.js | 14 ++++ .../components/department/departmentExtend.js | 4 +- .../components/fieldDefinedSet/FieldDef.js | 22 +++--- .../components/import/datasImport.js | 1 - .../components/resource/resource.js | 38 ++++++++-- pc4mobx/organization/stores/companyextend.js | 3 + .../organization/stores/departmentextend.js | 6 +- pc4mobx/organization/stores/fieldDefined.js | 70 +++++++++---------- pc4mobx/organization/stores/jobextend.js | 15 ++-- pc4mobx/organization/stores/resource.js | 8 +++ pc4mobx/organization/stores/resourceExtend.js | 2 +- pc4mobx/organization/util/index.js | 23 ++++++ 12 files changed, 143 insertions(+), 63 deletions(-) diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js index 9f64dcf..6199217 100644 --- a/pc4mobx/organization/apis/resource.js +++ b/pc4mobx/organization/apis/resource.js @@ -38,3 +38,17 @@ export const editResource = (params) => { export const getResourceExtendForm = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getBaseForm', 'GET', params); } + + + +export const exportResource = (ids) => { + fetch('/api/bs/hrmorganization/common/resource/export?ids='+ids).then(res => res.blob().then(blob => { + var filename=`人员档案.xlsx` + var a = document.createElement('a'); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + })) +} diff --git a/pc4mobx/organization/components/department/departmentExtend.js b/pc4mobx/organization/components/department/departmentExtend.js index d31b86c..33a6ee0 100644 --- a/pc4mobx/organization/components/department/departmentExtend.js +++ b/pc4mobx/organization/components/department/departmentExtend.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-06-02 09:20:03 - * @LastEditTime: 2022-06-22 16:54:39 + * @LastEditTime: 2022-06-29 17:42:27 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js */ @@ -238,7 +238,7 @@ export default class DepartmentExtendStore extends React.Component { datas={this.getRightMenu()} > } iconBgcolor='#217346' diff --git a/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js b/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js index 1bf4129..5a01160 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js +++ b/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js @@ -91,17 +91,17 @@ export default class FieldDef extends Component { } } //人员卡片字段定义页面 - if (moduleName === 'resourcefielddefined') { - if ((window.e9_locale.userLanguage == 7)) { //系统语言为中文 - Object.assign(tableProps.scroll, { - x: 1200 - }); - } else { - Object.assign(tableProps.scroll, { - x: isJobTreeNode ? 1400 : 1900 - }); - } - } + // if (moduleName === 'resourcefielddefined') { + // if ((window.e9_locale.userLanguage == 7)) { //系统语言为中文 + // Object.assign(tableProps.scroll, { + // x: 1200 + // }); + // } else { + // Object.assign(tableProps.scroll, { + // x: isJobTreeNode ? 1400 : 1900 + // }); + // } + // } } const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)] diff --git a/pc4mobx/organization/components/import/datasImport.js b/pc4mobx/organization/components/import/datasImport.js index 74de4cf..7683122 100644 --- a/pc4mobx/organization/components/import/datasImport.js +++ b/pc4mobx/organization/components/import/datasImport.js @@ -269,7 +269,6 @@ export default class DatasImport extends React.Component { } render() { - debugger const { datasImport, mainTitle, diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js index 8e5e4e5..2496424 100644 --- a/pc4mobx/organization/components/resource/resource.js +++ b/pc4mobx/organization/components/resource/resource.js @@ -11,6 +11,7 @@ import { WeaRightMenu, WeaLeftRightLayout, WeaOrgTree, + WeaDropdown } from 'ecCom' import { Row, @@ -34,14 +35,14 @@ import '../../style/common.less'; import NewAndEditDialog from '../NewAndEditDialog'; import { renderNoright } from '../../util'; -import DatasImport from '../import/datasImport'; +import DatasImport from '../import/datasImport'; const toJS = mobx.toJS; const confirm = Modal.confirm; const WeaTable = WeaTableNew.WeaTable; - +const { ButtonSelect } = WeaDropdown; @inject('resource') @inject('datasImport') @@ -125,6 +126,28 @@ export default class Resource extends React.Component { }); + const datas = [ + { + key: "1", show: (全部导出), text: "全部导出", selected: true + }, + + { + key: "2", show: (批量导出), text: "批量导出" + } + ]; + btns.push( { + if (key == "1") { + resource.export(); + } + if(key == "2") { + tableStore.selectedRowKeys.length > 0 ? resource.export() : message.error("请选择需要导出的数据") + } + }} + //menuOnClick={(key, e) => console.log("选择了按钮:", e)} + />) + return btns; } @@ -161,6 +184,7 @@ export default class Resource extends React.Component { datasImport.getImportForm(); } + batchDelete() { const { resource @@ -334,7 +358,7 @@ export default class Resource extends React.Component { } handleSaveAndSetting() { - + } getPanelComponents() { @@ -402,8 +426,8 @@ export default class Resource extends React.Component { resource } = this.props; const { - isPanelShow, form2, schemeName, conditionNum, tableStore, nEdialogTitle, visible, condition, - form, dialogLoading, isEdit, date, hasRight,defaultShowLeft + isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition, + form, dialogLoading, isEdit, date, hasRight, defaultShowLeft } = resource; if (hasRight === false) { @@ -431,7 +455,7 @@ export default class Resource extends React.Component { resource.setPanelStatus(bool)} hideSearchAd={() => resource.setPanelStatus(false)} searchsAd={isPanelShow ? this.getPanelComponents() :
} @@ -463,7 +487,7 @@ export default class Resource extends React.Component { conditionLen={3} save={() => this.handleSave()} onCancel={() => resource.setVisible(false)} - saveAndSetting = {() => this.handleSaveAndSetting()} + saveAndSetting={() => this.handleSaveAndSetting()} /> diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 6d15ee8..95dea9a 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -233,5 +233,8 @@ export class CompanyExtendStore { this.buttons = buttons; } + setDate(date) { + this.date = date; + } } diff --git a/pc4mobx/organization/stores/departmentextend.js b/pc4mobx/organization/stores/departmentextend.js index 3595bab..01639d6 100644 --- a/pc4mobx/organization/stores/departmentextend.js +++ b/pc4mobx/organization/stores/departmentextend.js @@ -53,9 +53,9 @@ export class DepartmentExtendStore { 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 @@ -231,5 +231,9 @@ export class DepartmentExtendStore { this.buttons = buttons; } + setDate(date) { + this.date = date; + } + } diff --git a/pc4mobx/organization/stores/fieldDefined.js b/pc4mobx/organization/stores/fieldDefined.js index 3f22ea6..6c8affa 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-27 15:32:03 + * @LastEditTime: 2022-06-29 17:23:37 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/stores/fieldDefined.js */ @@ -300,40 +300,40 @@ export class FieldDefinedStore extends HrmBaseStore { }]; //人员卡片字段定义-添加【允许个人修改】列 - if (this.moduleName === 'resourcefielddefined') { - if (this.isJobTreeNode) {//【工作信息】列表不添加【允许个人修改】列 - } else { - columns.push({ - title: getLabel(510359, '允许个人修改'), - dataIndex: 'isModify', - key: 'isModify', - checkType: 'checkbox', - colSpan: 1, - width: '11%' - }); - } - } - this.encryptEnable && columns.push({ - title: getLabel('526997', '加密设置'), - dataIndex: 'canEncrypt', - key: 'canEncrypt', - com: [ - { - type: 'custom', - key: 'custom', - render: (text, record, index, onEdit) => { - const { canEncrypt } = record; - if (canEncrypt == '1') - return ( - this.onEncryptHandle(record)}>{getLabel('526997', '加密设置')} - ) - return null; - } - } - ], - colSpan: 1, - width: '8%' - }); + // if (this.moduleName === 'resourcefielddefined') { + // if (this.isJobTreeNode) {//【工作信息】列表不添加【允许个人修改】列 + // } else { + // columns.push({ + // title: getLabel(510359, '允许个人修改'), + // dataIndex: 'isModify', + // key: 'isModify', + // checkType: 'checkbox', + // colSpan: 1, + // width: '11%' + // }); + // } + // } + // this.encryptEnable && columns.push({ + // title: getLabel('526997', '加密设置'), + // dataIndex: 'canEncrypt', + // key: 'canEncrypt', + // com: [ + // { + // type: 'custom', + // key: 'custom', + // render: (text, record, index, onEdit) => { + // const { canEncrypt } = record; + // if (canEncrypt == '1') + // return ( + // this.onEncryptHandle(record)}>{getLabel('526997', '加密设置')} + // ) + // return null; + // } + // } + // ], + // colSpan: 1, + // width: '8%' + // }); return columns; } diff --git a/pc4mobx/organization/stores/jobextend.js b/pc4mobx/organization/stores/jobextend.js index 1c6f8c3..ba32c8b 100644 --- a/pc4mobx/organization/stores/jobextend.js +++ b/pc4mobx/organization/stores/jobextend.js @@ -56,9 +56,9 @@ export class JobExtendStore { 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 @@ -80,7 +80,8 @@ export class JobExtendStore { editResource = () => { let pDatas = this.form.getFormParams(); - Api.editResource({ ...{ + Api.editResource({ + ...{ id: this.id }, ...pDatas, @@ -124,7 +125,7 @@ export class JobExtendStore { let params = { viewAttr: this.isEditor ? 2 : 1, id: this.id, - viewCondition:this.selectedKey + viewCondition: this.selectedKey } Api.getJobExtendForm(params).then((res) => { if (res.code === 200) { @@ -144,7 +145,7 @@ export class JobExtendStore { message.warning(error.msg); }) - + } @@ -183,7 +184,7 @@ export class JobExtendStore { this.tabKey = key; } - updateDetailSelectedKey =(key) => { + updateDetailSelectedKey = (key) => { this.detailSelectedKey = key; } @@ -235,5 +236,9 @@ export class JobExtendStore { this.buttons = buttons; } + setDate(date) { + this.date = date; + } + } diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js index 2eba6ae..25ec5b3 100644 --- a/pc4mobx/organization/stores/resource.js +++ b/pc4mobx/organization/stores/resource.js @@ -17,6 +17,7 @@ import { import { i18n } from '../public/i18n'; +import {getSecondPath} from '../util/index' const toJS = mobx.toJS; const { @@ -173,6 +174,13 @@ const { }) } + @action export(){ + const params = { + ...this.form.getFormParams() + } + Api.exportResource(toJS(this.tableStore.selectedRowKeys).toString()); + } + updateFields(val) { this.form2.updateFields({ schemeName: { diff --git a/pc4mobx/organization/stores/resourceExtend.js b/pc4mobx/organization/stores/resourceExtend.js index 4faa146..a07aa4d 100644 --- a/pc4mobx/organization/stores/resourceExtend.js +++ b/pc4mobx/organization/stores/resourceExtend.js @@ -54,9 +54,9 @@ export class ResourceExtendStore { 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/util/index.js b/pc4mobx/organization/util/index.js index ea6320b..f1e4790 100644 --- a/pc4mobx/organization/util/index.js +++ b/pc4mobx/organization/util/index.js @@ -148,4 +148,27 @@ export const validDBKeys = (value) => { isValid: true, value }; +} + +//二级路径加前缀 +export const getSecondPath=(url)=>{ + const ecologyContentPath = window.ecologyContentPath||"";//二级路径 + if(ecologyContentPath!="" && url && url!=""){ + if(url.startsWith("/")){ + if(!url.startsWith(ecologyContentPath)){ + url = ecologyContentPath+url; + } + }else if(url.startsWith("http")){ + let origin = window.location.origin; + if(!origin){ + origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); + } + if(url.startsWith(origin) && !url.startsWith(origin+ecologyContentPath)){ + url = url.replace(origin,origin+ecologyContentPath); + } + }else { + url = ecologyContentPath+"/"+url; + } + } + return url; } \ No newline at end of file