From a88de27c3502c68b520781bc612139b31fc3f6e7 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 5 Jan 2023 18:02:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=8A=B1=E5=90=8D=E5=86=8C=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/personnelResume.js | 12 ++++ .../components/resource/PersonnelResume.js | 19 +++++- .../components/resource/SearchCustomDialog.js | 28 +++++++++ .../components/resource/resource.js | 59 +++++++++++++++---- pc4mobx/organization/public/i18n.js | 2 + .../organization/stores/personnelResume.js | 4 ++ pc4mobx/organization/stores/resource.js | 54 ++++++++++++++--- 7 files changed, 158 insertions(+), 20 deletions(-) create mode 100644 pc4mobx/organization/components/resource/SearchCustomDialog.js diff --git a/pc4mobx/organization/apis/personnelResume.js b/pc4mobx/organization/apis/personnelResume.js index 7b3d0b4..c445ede 100644 --- a/pc4mobx/organization/apis/personnelResume.js +++ b/pc4mobx/organization/apis/personnelResume.js @@ -14,4 +14,16 @@ export const getPersonnelResume = (params) => { export const getAdvanceSearchCondition = (params) => { return WeaTools.callApi('/api/bs/hrmorganization/personnelresume/personnelScreening', 'GET', params); +} + +export const downloadPerResume = (type) => { + fetch(`/api/bs/hrmorganization/personnelresume/downloadPerResume?type=${type}`).then(res => res.blob().then(blob => { + var filename= type == 0 ? `人员简历合并导出.docx` : `全部简历.zip` + var a = document.createElement('a'); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + })) } \ No newline at end of file diff --git a/pc4mobx/organization/components/resource/PersonnelResume.js b/pc4mobx/organization/components/resource/PersonnelResume.js index 1a46fb8..63f8db2 100644 --- a/pc4mobx/organization/components/resource/PersonnelResume.js +++ b/pc4mobx/organization/components/resource/PersonnelResume.js @@ -193,6 +193,7 @@ export default class PersonnelResume extends React.Component { this[item.menuFun] && this[item.menuFun](); } + //模板修改 handleChange(value) { } @@ -268,6 +269,22 @@ export default class PersonnelResume extends React.Component { }) } + //合并导出 + MergeExport() { + const { + personnelResume + } = this.props; + personnelResume.downloadPerResume(0); + } + + //全部导出 + AllExport() { + const { + personnelResume + } = this.props; + personnelResume.downloadPerResume(1); + } + isEmptyObject(obj) { for (let key in obj) { return false; @@ -413,7 +430,7 @@ export default class PersonnelResume extends React.Component { form={form} isFormInit={form.isFormInit} loading={dialogLoading} - height={200} + height={120} conditionLen={1} search={() => this.onSelect()} onCancel={() => personnelResume.show = ! show} diff --git a/pc4mobx/organization/components/resource/SearchCustomDialog.js b/pc4mobx/organization/components/resource/SearchCustomDialog.js new file mode 100644 index 0000000..ff83614 --- /dev/null +++ b/pc4mobx/organization/components/resource/SearchCustomDialog.js @@ -0,0 +1,28 @@ +import { + observer +} from 'mobx-react'; +import { + WeaDialog, +} from 'ecCom'; + +@observer +export default class SearchCustomDialog extends React.Component { + constructor(props) { + super(props); + } + + render() { + const { + DIALOG, + dialog + } = this.props + + return ( + + + ); + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js index 78be5e6..f7de10c 100644 --- a/pc4mobx/organization/components/resource/resource.js +++ b/pc4mobx/organization/components/resource/resource.js @@ -11,7 +11,8 @@ import { WeaRightMenu, WeaLeftRightLayout, WeaOrgTree, - WeaDropdown + WeaDropdown, + WeaSelect } from 'ecCom' import { Row, @@ -21,6 +22,7 @@ import { Button, message, Switch, + Select, Menu, Dropdown, Icon } from 'antd' import { @@ -36,6 +38,7 @@ import '../../style/common.less'; import NewAndEditDialog from '../NewAndEditDialog'; import { renderNoright } from '../../util'; import DatasImport from '../import/datasImport'; +import SearchCustomDialog from './SearchCustomDialog'; @@ -74,14 +77,14 @@ export default class Resource extends React.Component { resource } = this.props; resource.getHasRight(); - let {hash} = window.location; + let { hash } = window.location; hash = hash.split("?")[1].split("&"); - if(hash.length >= 2) { + if (hash.length >= 2) { let params = {}; - let arr = hash[0].split("="); + let arr = hash[0].split("="); params[arr[0]] = arr[1]; resource.doSearch(params); - }else { + } else { resource.getTableInfo(); } } @@ -189,11 +192,11 @@ export default class Resource extends React.Component { if (key == "1") { resource.export(); } - if(key == "2") { + if (key == "2") { tableStore.selectedRowKeys.length > 0 ? resource.export() : message.error("请选择需要导出的数据") } }} - menuOnClick={(key, e) => key == '1' ? tableStore.selectedRowKeys = []: ''} + menuOnClick={(key, e) => key == '1' ? tableStore.selectedRowKeys = [] : ''} />) return btns; @@ -228,7 +231,7 @@ export default class Resource extends React.Component { // resource.setIsNew(true); // resource.setVisible(true); // resource.getForm(); - window.open("/spa/hrm/index_mobx.html#/main/hrm/add","_blank") + window.open("/spa/hrm/index_mobx.html#/main/hrm/add", "_blank") } import() { @@ -286,7 +289,9 @@ export default class Resource extends React.Component { const btn = [ (), - (), + (), + (), + (), (), ]; @@ -372,7 +377,8 @@ export default class Resource extends React.Component { !isNew && resource.edit(); } - handleSaveAndSetting() { + //高级搜索模板修改 + handleTemplateChange() { } @@ -392,6 +398,32 @@ export default class Resource extends React.Component { isFormInit } = form2; + const options002 = [ + { + key: "1", + selected: true, + showname: "简单模板" + }, + { + key: "2", + selected: false, + showname: "复杂模板" + } + ]; + arr.push( + 选择过滤模板 + + { + + }} + /> + + + ) + isFormInit && searchCondition.map(c => { c.items.map((field, index) => { arr.push( @@ -439,7 +471,7 @@ export default class Resource extends React.Component { } = this.props; const { isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition, - form, dialogLoading, isEdit, date, hasRight, defaultShowLeft + form, dialogLoading, isEdit, date, hasRight, defaultShowLeft,SEARCHDIALOG,searchDialog } = resource; if (hasRight === false) { @@ -499,9 +531,12 @@ export default class Resource extends React.Component { conditionLen={2} save={() => this.handleSave()} onCancel={() => resource.setVisible(false)} - // saveAndSetting={() => this.handleSaveAndSetting()} /> + ) } diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js index 82db8c0..49f7e74 100644 --- a/pc4mobx/organization/public/i18n.js +++ b/pc4mobx/organization/public/i18n.js @@ -875,6 +875,8 @@ export const i18n = { editTypeInfo: () => getLabel(32732, '编辑类型'), nextStep:() => getLabel(30131, '下一步'), version:() => getLabel(30131, '查看历史版本'), + saveTemplate:() => getLabel(30131, '存为模板'), + conditionSet:() => getLabel(30131, '常用条件定制'), batchOpen: () => getLabel(534249, '批量解锁'), collect: () => getLabel(28111, '收藏'), diff --git a/pc4mobx/organization/stores/personnelResume.js b/pc4mobx/organization/stores/personnelResume.js index 749d111..7ba2df5 100644 --- a/pc4mobx/organization/stores/personnelResume.js +++ b/pc4mobx/organization/stores/personnelResume.js @@ -305,6 +305,10 @@ export class PersonnelResumeStore { }) } + @action("合并导出和全部导出") downloadPerResume(type) { + Api.downloadPerResume(type); + } + setCondition(condition) { this.condition = condition; diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js index 9dfa973..de8cb09 100644 --- a/pc4mobx/organization/stores/resource.js +++ b/pc4mobx/organization/stores/resource.js @@ -13,6 +13,7 @@ import { import { Modal, message, + Button } from 'antd' import { i18n @@ -53,7 +54,7 @@ const { @observable selectTreeNodeInfo; - @action getTableInfo() { + @action("列表") getTableInfo() { let params; this.tableStore = new TableStore(); if (this.isEmptyObject(this.form2.getFormParams())) { @@ -83,7 +84,7 @@ const { this.getTableInfo(); } - save() { + @action("保存") save() { let params = { ...this.form.getFormParams() }; @@ -109,7 +110,7 @@ const { }); } - getForm() { + @action("新增表单") getForm() { let params = this.isNew ? {} : { id: this.userId } @@ -129,7 +130,7 @@ const { } - getSearchCondition() { + @action("高级搜索表单") getSearchCondition() { this.setScLoadingStatus(false); Api.getAdvanceSearchCondition().then(res => { if (res.code === 200) { @@ -145,7 +146,7 @@ const { } - @action getHasRight() { + @action("顶部按钮") getHasRight() { Api.getHasRight().then(res => { if (res.code === 200) { this.setHasRight(res.data.hasRight); @@ -159,7 +160,7 @@ const { }) } - @action export(){ + @action("导出") export(){ const params = { ...this.form.getFormParams() } @@ -177,7 +178,46 @@ const { }, error => { message.warning(error.msg); }) - } + } + + + /** ================================================================= */ + @observable searchDialog = { + visible: false, + title: '常用条件定制', + } + + SEARCHDIALOG = { + hasScroll: false, + icon: 'icon-coms-hrm', + iconBgcolor: '#217346', + onCancel: () => this.closeSearchDialog(), + style: { + width: 700, + height: 450 + }, + moreBtn: { + datas: [] + }, + buttons: [], + } + + @action("常用条件定制保存") saveHrmSearchUserDefine = () => { + + } + + + + @action openSearchDialog = () => { + this.searchDialog.visible = true; + } + + @action closeSearchDialog = () => { + this.searchDialog.visible = false; + } + + + updateFields(val) { this.form2.updateFields({ From d98f86be176f09f935e9f2c4bee0099ed558765e Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 6 Jan 2023 18:01:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=8A=B1=E5=90=8D=E5=86=8C=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/resource/Customization.js | 43 ++++ .../components/resource/PersonnelResume.js | 4 +- .../components/resource/SearchCustomDialog.js | 15 +- .../components/resource/resource.js | 63 +++--- pc4mobx/organization/stores/resource.js | 199 +++++++++++++++++- pc4mobx/organization/style/common.less | 15 ++ 6 files changed, 287 insertions(+), 52 deletions(-) create mode 100644 pc4mobx/organization/components/resource/Customization.js diff --git a/pc4mobx/organization/components/resource/Customization.js b/pc4mobx/organization/components/resource/Customization.js new file mode 100644 index 0000000..51c3b21 --- /dev/null +++ b/pc4mobx/organization/components/resource/Customization.js @@ -0,0 +1,43 @@ +import { + observer +} from 'mobx-react'; +import { + WeaTransfer, +} from 'ecCom'; +import { + toJS +} from 'mobx'; +import isEmpty from 'lodash/isEmpty' + +@observer +export default class Customization extends React.Component { + constructor(props) { + super(props); + } + + render() { + const { + store + } = this.props, { + TRANSFER, + transfer, + leftHeader, + rightHeader, + } = store, { + transferDatas, + transferKeys + } = transfer; + + return ( +
+ +
+ ); + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/resource/PersonnelResume.js b/pc4mobx/organization/components/resource/PersonnelResume.js index 63f8db2..31a1d9c 100644 --- a/pc4mobx/organization/components/resource/PersonnelResume.js +++ b/pc4mobx/organization/components/resource/PersonnelResume.js @@ -270,7 +270,7 @@ export default class PersonnelResume extends React.Component { } //合并导出 - MergeExport() { + mergeExport() { const { personnelResume } = this.props; @@ -278,7 +278,7 @@ export default class PersonnelResume extends React.Component { } //全部导出 - AllExport() { + allExport() { const { personnelResume } = this.props; diff --git a/pc4mobx/organization/components/resource/SearchCustomDialog.js b/pc4mobx/organization/components/resource/SearchCustomDialog.js index ff83614..cd8b39b 100644 --- a/pc4mobx/organization/components/resource/SearchCustomDialog.js +++ b/pc4mobx/organization/components/resource/SearchCustomDialog.js @@ -4,6 +4,7 @@ import { import { WeaDialog, } from 'ecCom'; +import Customization from './Customization'; @observer export default class SearchCustomDialog extends React.Component { @@ -13,15 +14,19 @@ export default class SearchCustomDialog extends React.Component { render() { const { - DIALOG, - dialog - } = this.props + store + } = this.props, { + SEARCHDIALOG, + searchDialog + } = store; return ( + ); } diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js index f7de10c..aa7427d 100644 --- a/pc4mobx/organization/components/resource/resource.js +++ b/pc4mobx/organization/components/resource/resource.js @@ -12,7 +12,8 @@ import { WeaLeftRightLayout, WeaOrgTree, WeaDropdown, - WeaSelect + WeaSelect, + WeaSearchGroup } from 'ecCom' import { Row, @@ -289,7 +290,7 @@ export default class Resource extends React.Component { const btn = [ (), - (), + (), (), (), (), @@ -387,9 +388,10 @@ export default class Resource extends React.Component { resource } = this.props; const { - searchCondition, + defaultCondition, form2, - searchConditionLoading + searchConditionLoading, + templates } = resource; let arr = []; @@ -398,47 +400,39 @@ export default class Resource extends React.Component { isFormInit } = form2; - const options002 = [ - { - key: "1", - selected: true, - showname: "简单模板" - }, - { - key: "2", - selected: false, - showname: "复杂模板" - } - ]; + arr.push( - 选择过滤模板 + 选择过滤模板 { }} /> - - ) + + ) - isFormInit && searchCondition.map(c => { + isFormInit && defaultCondition.map((c, i) => { + let _arr = []; c.items.map((field, index) => { - arr.push( -
+ _arr.push({ + com: ( {} -
- ) + ), + }) }) + arr.push() }) + if (searchConditionLoading) { return (
@@ -446,12 +440,12 @@ export default class Resource extends React.Component {
) } else { - return { + return
{ if (e.keyCode == 13 && e.target.tagName === "INPUT") { - resource.getTableInfo(); - resource.setPanelStatus(false) + rankScheme.getTableInfo(); + rankScheme.setPanelStatus(false) } - }}>{arr} + }}>{arr}
} } @@ -467,11 +461,12 @@ export default class Resource extends React.Component { render() { const { - resource + resource, + resource: store } = this.props; const { isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition, - form, dialogLoading, isEdit, date, hasRight, defaultShowLeft,SEARCHDIALOG,searchDialog + form, dialogLoading, isEdit, date, hasRight, defaultShowLeft } = resource; if (hasRight === false) { @@ -534,9 +529,7 @@ export default class Resource extends React.Component { /> + store={store} /> ) } diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js index de8cb09..8041274 100644 --- a/pc4mobx/organization/stores/resource.js +++ b/pc4mobx/organization/stores/resource.js @@ -1,24 +1,30 @@ import { observable, - action + action, + computed } from 'mobx'; import * as mobx from 'mobx'; import * as Api from '../apis/resource'; // 引入API接口文件 import { - WeaForm -} from 'comsMobx'; -import { - WeaTableNew + WeaForm,WeaTableNew } from 'comsMobx'; import { Modal, message, Button } from 'antd' +import { + WeaSelect, + WeaInputSearch, + WeaLocaleProvider, +} from 'ecCom'; import { i18n } from '../public/i18n'; +import trim from 'lodash/trim'; import {getSecondPath} from '../util/index' +import cloneDeep from 'lodash/cloneDeep'; + const toJS = mobx.toJS; const { @@ -32,6 +38,8 @@ const { @observable rightMenu = []; @observable condition = []; @observable searchCondition = []; + @observable defaultCondition = []; + @observable templates=[]; @observable isEdit = true; @observable isNew = true; @observable isPanelShow = false; //高级搜索面板 @@ -131,12 +139,17 @@ const { } @action("高级搜索表单") getSearchCondition() { - this.setScLoadingStatus(false); - Api.getAdvanceSearchCondition().then(res => { + this.setScLoadingStatus(true); + const params = { + selectKeys:this.transfer.transferKeys + } + Api.getAdvanceSearchCondition(params).then(res => { if (res.code === 200) { this.setScLoadingStatus(false); res.data.conditions && this.setSearchCondition(res.data.conditions); - res.data.conditions && this.form2.initFormFields(res.data.conditions); + res.data.defaultcondition && this.setDefaultCondition(res.data.defaultcondition); + res.data.defaultcondition && this.form2.initFormFields(res.data.defaultcondition); + res.data.templates && this.setTemplates(res.data.templates); } else { message.warning(res.msg); } @@ -181,7 +194,7 @@ const { } - /** ================================================================= */ + /** ====================================================================================== */ @observable searchDialog = { visible: false, title: '常用条件定制', @@ -202,14 +215,172 @@ const { buttons: [], } - @action("常用条件定制保存") saveHrmSearchUserDefine = () => { + TRANSFER = { + height: 350, + renderItem: (items) => this.renderItem(items), + filterLeft: (items) => this.filterLeft(items), + filterRight: (items) => this.filterRight(items), + onChange: (v) => this.updateTransferKeys(v) + } + + @observable transfer = { + transferDatas: [], + transferKeys: [], + transferOptions: [], + transferSelectedKey: '0', + transferleftIptVal: '', + transferRightIptVal: '' + } + + @action("常用条件定制保存") saveHrmSearchUserDefine = () => { + this.closeSearchDialog(); + this.getSearchCondition(); } + @action("常用条件定制") formatTransfer = () => { + const transferDatas = [] + const transferKeys = [] + const transferOptions = [{ + key: "", + showname: "" + }] + this.transfer.transferSelectedKey = '0'; + this.transfer.transferleftIptVal = ''; + this.transfer.transferRightIptVal = ''; + this.searchCondition.forEach((c, idx) => { + transferOptions.push({ + key: `${idx}`, + showname: c.title, + }) + c.items.forEach((i) => { + transferDatas.push({ + id: i.domkey[0], + label: i.label, + title: c.title, + idx: `${idx}` + }) + }) + }) + this.defaultCondition.forEach((c, idx) => { + c.items.forEach((i) => { + transferKeys.push(i.domkey[0]); + }) + }) + this.transfer.transferDatas = transferDatas; + this.transfer.transferKeys = transferKeys; + this.transfer.transferOptions = transferOptions; + } + + inputSearchStyle = { + width:"105px", + float:"right", + marginTop:"5px", + marginLeft:"10px" + } + selectStyle={ + marginTop:"-1px", + width:"85px", + float:"right" + } + @computed get leftHeader() { + const { + transferleftIptVal, + transferOptions, + transferSelectedKey + } = this.transfer; + return ( +
+ 待选 + + +
+ ) + } + + @computed get rightHeader() { + const { + transferRightIptVal + } = this.transfer; + return ( +
+ 已选 + +
+ ) + } + renderItem = (item) => { + const { + label, + title + } = item; + return (
+
{label}
+
{title}
+
) + }; + + filterLeft = (items) => { + let leftItems = cloneDeep(items); + const { + transferleftIptVal, + transferSelectedKey + } = this.transfer; + if (transferSelectedKey) { + leftItems = leftItems.filter((item) => item.idx == transferSelectedKey) + } + if (trim(transferleftIptVal)) { + leftItems = leftItems.filter((item) => item.label.indexOf(trim(transferleftIptVal)) > -1) + } + return leftItems + } + + filterRight = (items) => { + let rightItems = cloneDeep(items); + const { + transferRightIptVal + } = this.transfer; + if (trim(transferRightIptVal)) { + rightItems = rightItems.filter((item) => item.label.indexOf(trim(transferRightIptVal)) > -1) + } + return rightItems + } + + @action("穿梭框变化回调") updateTransferKeys = (v) => { + this.transfer.transferKeys = v; + } + + @action updateTransferleftIptVal = (v) => { + this.transfer.transferleftIptVal = v; + } + + @action updateTransferSelectedKey = (v) => { + this.transfer.transferSelectedKey = v; + } + + @action updateTransferRightptVal = (v) => { + this.transfer.transferRightIptVal = v; + } + @action openSearchDialog = () => { this.searchDialog.visible = true; + this.formatTransfer(); + } @action closeSearchDialog = () => { @@ -231,6 +402,14 @@ const { this.searchCondition = condition; } + setDefaultCondition(defaultcondition) { + this.defaultCondition = defaultcondition; + } + + setTemplates(templates) { + this.templates = templates; + } + setScLoadingStatus(bool) { this.searchConditionLoading = bool; } diff --git a/pc4mobx/organization/style/common.less b/pc4mobx/organization/style/common.less index 0b7049a..84aa123 100644 --- a/pc4mobx/organization/style/common.less +++ b/pc4mobx/organization/style/common.less @@ -95,3 +95,18 @@ text-overflow: ellipsis; white-space: nowrap;overflow: hidden; } + + //列定制 + // .trasfer-header{ + // .wea-input-focus { + // width: 105px; + // float: right; + // margin-top: 5px; + // margin-left: 10px; + // } + // .wea-select{ + // margin-top: -1px; + // width: 85px; + // float: right; + // } + // } \ No newline at end of file