花名册快捷搜索

This commit is contained in:
Chengliang 2023-08-08 14:28:49 +08:00
parent 72a3d27b16
commit 37e6757110
5 changed files with 408 additions and 238 deletions

View File

@ -1,7 +1,7 @@
/**
* @Author: 程亮
* @Date: 2022-05-18 16:23:32
* @LastEditTime: 2023-07-26 18:41:11
* @LastEditTime: 2023-08-08 11:23:40
* @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js
*/
@ -26,7 +26,7 @@ import {
Button,
message,
Switch,
Menu, Dropdown, Icon,Tooltip
Menu, Dropdown, Icon, Tooltip
} from 'antd'
import {
WeaSwitch,
@ -43,7 +43,7 @@ import NewAndEditDialog from '../NewAndEditDialog';
import NewWeaTable from '../NewWeaTableDialog';
import { renderNoright } from '../../util';
import {
CompanyExtendStore
CompanyExtendStore
} from '../../stores/companyextend';
const companyExtend = new CompanyExtendStore();
@ -343,9 +343,9 @@ export default class Company extends React.Component {
c.className = "wea-table-indent"
c.render = function (text, record) {
return <a onClick={() => {
window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank")
}}>{text}</a>
window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank")
}}>{text}</a>
}
}
if (c.dataIndex == 'operate') {
@ -354,25 +354,25 @@ export default class Company extends React.Component {
c.render = function (text, record) {
const menu = (
<Menu>
<Menu.Item key="1" disabled={record.isUsed === 0 ? false : true} style={record.isUsed === 0 ?{display:'block'} :{display:'none'}}>
<Menu.Item key="1" disabled={record.isUsed === 0 ? false : true} style={record.isUsed === 0 ? { display: 'block' } : { display: 'none' }}>
<a href='javascript:void(0);' onClick={() => {
_this.doDel(record.id)
}}>删除</a>
_this.doDel(record.id)
}}>删除</a>
</Menu.Item>
<Menu.Item key="2">
<a href='javascript:void(0);' onClick={() => {
_this.select(record.id)
}}>联查部门</a>
_this.select(record.id)
}}>联查部门</a>
</Menu.Item>
<Menu.Item key="3">
<a href='javascript:void(0);' onClick={() => {
_this.view(record.id)
}}>查看</a>
_this.view(record.id)
}}>查看</a>
</Menu.Item>
<Menu.Item key="4">
<a href='javascript:void(0);' onClick={() => {
_this.transfer(record.id)
}}>转移</a>
_this.transfer(record.id)
}}>转移</a>
</Menu.Item>
{/* <Menu.Item key="5">
<a href='javascript:void(0);' onClick={() => { _this.version(record) }}>另存为版本</a>
@ -431,7 +431,7 @@ export default class Company extends React.Component {
} = this.props;
company.setSaveAndSetting(true);
company.save();
}
getTabBtn() {
@ -444,8 +444,8 @@ export default class Company extends React.Component {
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => {
company.setCurrent(1); company.setPageSize(10); company.getTableInfo(); company.setPanelStatus(false)
}}>{i18n.button.search()}</Button>),
company.setCurrent(1); company.setPageSize(10); company.getTableInfo(); company.setPanelStatus(false)
}}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => company.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
];
@ -519,7 +519,7 @@ export default class Company extends React.Component {
const {
isPanelShow, companyName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init,hasRight
form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init, hasRight
} = company;
if (hasRight === false) {
@ -527,7 +527,7 @@ export default class Company extends React.Component {
}
const rowSelection = {
selectedRowKeys:selectedRowKeys,
selectedRowKeys: selectedRowKeys,
type: "checkbox",
onChange(selectedRowKeys, selectedRows) {
company.setSelectedRowKeys(selectedRowKeys);
@ -629,7 +629,7 @@ export default class Company extends React.Component {
conditionLen={1}
save={() => this.handleSave()}
onCancel={() => company.setNewVisible(false)}
saveAndSetting = {() => this.handleSaveAndSetting()}
saveAndSetting={() => this.handleSaveAndSetting()}
/>
</div>
)

View File

@ -0,0 +1,39 @@
import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {WeaRadioGroup, WeaLocaleProvider} from 'ecCom';
import classnames from 'classnames';
@observer
export default class GroupList extends Component{
render(){
const {store} = this.props;
const {setDomRef,radioGroupConfig, showRadioGroup} = store;
const displayClassName = classnames({
radioGroupShow: true,
radioGroupHide: !showRadioGroup
})
const iconClassName = classnames({
'icon-coms-down-001': !showRadioGroup,
'icon-coms-up-001': showRadioGroup
})
const label = showRadioGroup ? '隐藏条件' : '显示条件';
return (
<div ref={dom => setDomRef(dom, 'tab')}>
<div className='searchGroup'>
<div className={displayClassName} onClick={() => store.showRadioGroup = !showRadioGroup}>
<span>{label}</span>
<span>
<i className={iconClassName} />
</span>
</div>
<div style={{display: showRadioGroup ? 'block' : 'none'}}>
<WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@6w8eqc`} {...radioGroupConfig} />
</div>
</div>
</div>
)
}
}

View File

@ -36,12 +36,14 @@ import {
} from '../../public/i18n';
//import '../../style/common.less';
import '../../style/resource.less';
import NewAndEditDialog from '../NewAndEditDialog';
import { renderNoright } from '../../util';
import DatasImport from '../import/datasImport';
import SearchCustomDialog from './SearchCustomDialog';
import NewWeaTableEditDialog from '../NewWeaTableEditDialog';
import GroupList from './GroupList';
@ -301,7 +303,7 @@ export default class Resource extends React.Component {
confirm({
title: "存为模板",
content:
content:
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@62kt85`}
label="搜索模板名称"
labelCol={{ span: 10 }}
@ -329,8 +331,8 @@ export default class Resource extends React.Component {
const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => {
resource.getTableInfo(); resource.setPanelStatus(false)
}}>{i18n.button.search()}</Button>),
resource.getTableInfo(); resource.setPanelStatus(false)
}}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} type="primary" onClick={() => this.saveTemplate()}>{i18n.button.saveTemplate()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju7`} type="primary" onClick={() => resource.openSearchDialog(true)}>{i18n.button.conditionSet()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju8`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
@ -501,13 +503,12 @@ export default class Resource extends React.Component {
render() {
const {
resource,
resource: store
} = this.props;
const {
isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition,
form, dialogLoading, isEdit, date, hasRight, defaultShowLeft
} = resource;
} = store;
if (hasRight === false) {
return renderNoright();
@ -535,15 +536,16 @@ export default class Resource extends React.Component {
showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? lastName : form2.getFormParams().lastName}
searchsBasePlaceHolder='请输入姓名'
setShowSearchAd={bool => resource.setPanelStatus(bool)}
hideSearchAd={() => resource.setPanelStatus(false)}
setShowSearchAd={bool => store.setPanelStatus(bool)}
hideSearchAd={() => store.setPanelStatus(false)}
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => resource.getTableInfo()}
onSearch={() => store.getTableInfo()}
onSearchChange={val => this.onSearchChange(val)}
/>
<GroupList ecId={`${this && this.props && this.props.ecId || ''}_GroupList@2le78y`} store={store} />
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore}
hasOrder={true}
@ -570,9 +572,9 @@ export default class Resource extends React.Component {
/>
<DatasImport ecId={`${this && this.props && this.props.ecId || ''}_DatasImport@q4rrwm`} />
<SearchCustomDialog ecId={`${this && this.props && this.props.ecId || ''}_SearchCustomDialog@q4rrwm`}
store={store}/>
store={store} />
<NewWeaTableEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewWeaTableEditDialog@q4rrwm`}
store={store}/>
store={store} />
</div>
)
}

View File

@ -23,7 +23,7 @@ import {
i18n
} from '../public/i18n';
import { getSecondPath } from '../util/index'
import {cloneDeep,isEmpty,trim} from 'lodash';
import { cloneDeep, isEmpty, trim } from 'lodash';
const toJS = mobx.toJS;
const {
@ -59,6 +59,117 @@ export class ResourceStore {
@observable selectTreeNodeInfo;
@observable _showRadioGroup = true;
@computed get showRadioGroup() { return this._showRadioGroup }
set showRadioGroup(v) {
this._showRadioGroup = v;
setTimeout(() => {
this.reCalculateTableHeight = new Date().getTime();
}, 0)
}
domRef = {};
@observable _reCalculateTableHeight = new Date().getTime();
@computed get reCalculateTableHeight() { return this._reCalculateTableHeight }
set reCalculateTableHeight(v) { this._reCalculateTableHeight = v }
@computed get tableHeihgt() {
this.reCalculateTableHeight;
const topHeight = this.domRef.top && this.domRef.top.refs.content ? this.domRef.top.refs.content.clientHeight : 0;
const tabHeight = this.domRef.tab ? $(this.domRef.tab)[0].clientHeight : 0;
const h = topHeight - tabHeight;
return h <= 0 ? 0 : h;
}
@action setDomRef = (dom, type) => {
dom && Object.assign(this.domRef, { [type]: dom }) && setTimeout(() => this.reCalculateTableHeight = new Date().getTime(), 500);
}
rangeConditions = [
{
label: '联动类型',
options: [
{key:'0',showname:'全部'},
{key:'1',showname:'今天', selected: true},
{key:'2',showname:'本周'},
{key:'3',showname: '时间'},
{key:'5',showname:'本年'},
{key:'7',showname:'上个月'},
{key:'8',showname:'数值区间'},
{key:'6',showname:'指定日期范围'},
],
domkey: ['dateFrom'],
selectLinkageDatas: {
'1': {
conditionType: 'INPUT',
domkey: ['INPUT'],
},
'3': {
conditionType: 'DATEPICKER',
domkey: ['INPUT111111121'],
viewAttr: 3,
format: 'YYYY',
},
'2': {
conditionType: 'CHECKBOX',
domkey: ['CHECKBOX'],
},
'8': {
conditionType: 'SCOPE',
domkey: ['CHECKBOX1', 'CHECKBOX2'],
},
'6': {
conditionType: 'RANGEPICKER',
domkey: ['start', 'end'],
}
},
labelcol: 6,
fieldcol: 18,
},
{
label: '不联动类型',
options: [
{key:'0',showname:'全部', selected: true},
{key:'1',showname:'外勤签到'},
{key:'2',showname:'考勤签到/签退'},
],
domkey: ['checking'],
labelcol: 6,
fieldcol: 18,
},
{
label: '只读类型',
viewAttr: '1',
options: [
{key:'0',showname:'全部'},
{key:'1',showname:'外勤签到'},
{key:'2',showname:'考勤签到/签退'},
],
labelcol: 6,
fieldcol: 18,
},
{
label: '自定义类型',
com: <div>自定义组件<Button>自定义</Button></div>,
labelcol: 6,
fieldcol: 18,
}
];
@observable refreshRadioGroup = new Date().getTime();
@computed get radioGroupConfig(){
this.refreshRadioGroup;
return {
config: [
...this.rangeConditions
],
key: new Date().getTime(),
onChange: this.onRadioGroupChangeHandle
}
}
@action onRadioGroupChangeHandle = params => {
console.log(params);
}
@action("列表") getTableInfo() {
let params;
@ -250,24 +361,24 @@ export class ResourceStore {
}
@action("列定制保存") saveCustomDefine = () => {
if(this.customTemplateId == '-1') {
if (this.customTemplateId == '-1') {
message.error("默认模板不能修改,将返回默认模板列");
}
const params = {
columns:this.transfer.transferKeys,
templateId:this.customTemplateId
columns: this.transfer.transferKeys,
templateId: this.customTemplateId
}
Api.saveColumnsCustomTemplate(params).then(res => {
if (res.code === 200) {
this.searchDialog.visible = false;
this.getTableInfo();
}
}
}, error => {
message.warning(error.msg);
})
}
@action("高级搜索模板切换") changeSearchTemplate(v) {
@ -315,7 +426,7 @@ export class ResourceStore {
}
@action("常用条件定制模板切换") getTemplateSelectKeys = v => {
if(!this.search){
if (!this.search) {
this.customTemplateId = v;
}
@ -515,7 +626,7 @@ export class ResourceStore {
@action("模板") getSearchTemplate = (bool) => {
Api.getSearchTemplate({ type: bool ? 'search' : 'custom' }).then(res => {
if (res.code === 200) {
if(res.data.templateId) {
if (res.data.templateId) {
this.customTemplateId = res.data.templateId;
}
bool ? this.setTemplates(res.data.templates) : this.setCustomTemplates(res.data.templates);
@ -595,218 +706,218 @@ export class ResourceStore {
}).catch(error => {
message.error(error);
});
}
@action("列定制") getCustomTransferData() {
Api.getCustomTransferData(this.customTemplateId).then(result => {
if (result.code === 200) {
const { transferDatas, transferKeys, transferOptions } = result.data;
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
this.searchDialog.visible = true;
this.searchDialog.loading = false;
} else {
message.warning(result.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action updateTransferleftIptVal = (v) => {
this.transfer.transferleftIptVal = v;
}
@action updateTransferSelectedKey = (v) => {
this.transfer.transferSelectedKey = v;
}
@action updateTransferKeys = (v) => {
this.transfer.transferKeys = v;
}
@action updateTransferRightptVal = (v) => {
this.transfer.transferRightIptVal = v;
}
@action openSearchDialog = (bool) => {
this.search = bool;
this.searchDialog.loading = false;
this.formatTransfer();
}
@action openCustomDialog = (bool) => {
this.search = bool;
this.searchDialog.loading = true;
this.getSearchTemplate(bool);
this.getCustomTransferData();
}
@action closeSearchDialog = () => {
this.searchDialog.visible = false;
}
@action closeTemlateManageDialog = () => {
this.temlateManageDialog.visible = false;
}
setTableEditDatas(e) {
e.map(item => {
for (let key in item) {
if (key == "undefined") {
delete item[key];
}
if (!item["isused"]) {
item["isused"] = "";
}
}
});
extendObservable(this.relatedData, {
datas: e
});
}
setEnableRows(e) {
extendObservable(this.relatedData, {
selectedData: {
isused: e
}
});
}
updateFields(val) {
this.form2.updateFields({
lastname: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setDefaultCondition(defaultcondition) {
this.defaultCondition = defaultcondition;
}
setTemplates(datas) {
this.templates = datas;
}
setCustomTemplates(datas) {
this.customTemplates = datas;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
this.search = true;
this.searchDialog.loading = true;
this.getSearchTemplate(bool);
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
arrToJson(arr, rows, rowKey = "isused") {
let json = {};
const _rows = isEmpty(arr) ? [] : rows;
_rows && _rows.map(index => {
arr[index][rowKey] = "1";
});
arr.map((item, index) => {
if (!item[rowKey]) item[rowKey] = "0";
for (let key in item) {
json[key + "_" + index] = item[key];
}
});
return json;
}
setLastName(val) {
this.lastName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
@action("列定制") getCustomTransferData() {
Api.getCustomTransferData(this.customTemplateId).then(result => {
if (result.code === 200) {
const { transferDatas, transferKeys, transferOptions } = result.data;
this.transfer.transferDatas = transferDatas;
this.transfer.transferKeys = transferKeys;
this.transfer.transferOptions = transferOptions;
this.searchDialog.visible = true;
this.searchDialog.loading = false;
} else {
message.warning(result.msg);
}
}, error => {
message.warning(error.msg);
})
}
return true;
}
setIds(ids) {
this.ids = ids;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form = new WeaForm();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
@action updateTransferleftIptVal = (v) => {
this.transfer.transferleftIptVal = v;
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
@action updateTransferSelectedKey = (v) => {
this.transfer.transferSelectedKey = v;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
@action updateTransferKeys = (v) => {
this.transfer.transferKeys = v;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
@action updateTransferRightptVal = (v) => {
this.transfer.transferRightIptVal = v;
}
setUserId(userId) {
this.userId = userId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
@action openSearchDialog = (bool) => {
this.search = bool;
this.searchDialog.loading = false;
this.formatTransfer();
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
@action openCustomDialog = (bool) => {
this.search = bool;
this.searchDialog.loading = true;
this.getSearchTemplate(bool);
this.getCustomTransferData();
setHasRight(bool) {
this.hasRight = bool;
}
}
@action closeSearchDialog = () => {
this.searchDialog.visible = false;
}
@action closeTemlateManageDialog = () => {
this.temlateManageDialog.visible = false;
}
setTableEditDatas(e) {
e.map(item => {
for (let key in item) {
if (key == "undefined") {
delete item[key];
}
if (!item["isused"]) {
item["isused"] = "";
}
}
});
extendObservable(this.relatedData, {
datas: e
});
}
setEnableRows(e) {
extendObservable(this.relatedData, {
selectedData: {
isused: e
}
});
}
updateFields(val) {
this.form2.updateFields({
lastname: {
value: val
}
});
}
setSearchCondition(condition) {
this.searchCondition = condition;
}
setDefaultCondition(defaultcondition) {
this.defaultCondition = defaultcondition;
}
setTemplates(datas) {
this.templates = datas;
}
setCustomTemplates(datas) {
this.customTemplates = datas;
}
setScLoadingStatus(bool) {
this.searchConditionLoading = bool;
}
setPanelStatus(bool) {
this.isPanelShow = bool;
this.search = true;
this.searchDialog.loading = true;
this.getSearchTemplate(bool);
bool && this.getSearchCondition();
if (!bool) {
this.scLoadingReset();
}
}
arrToJson(arr, rows, rowKey = "isused") {
let json = {};
const _rows = isEmpty(arr) ? [] : rows;
_rows && _rows.map(index => {
arr[index][rowKey] = "1";
});
arr.map((item, index) => {
if (!item[rowKey]) item[rowKey] = "0";
for (let key in item) {
json[key + "_" + index] = item[key];
}
});
return json;
}
setLastName(val) {
this.lastName = val;
}
isEmptyObject(obj) {
for (let key in obj) {
return false;
}
return true;
}
setIds(ids) {
this.ids = ids;
}
scLoadingReset() {
this.searchConditionLoading = true;
}
formReset() {
this.form = new WeaForm();
}
dialogLoadingReset() {
this.dialogLoading = true;
}
setVisible(bool) {
this.visible = bool;
this.formReset();
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) {
this.dialogLoading = bool;
}
setNeDialogTitle(title) {
this.nEdialogTitle = title;
}
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) {
this.condition = condition;
}
setUserId(userId) {
this.userId = userId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) {
this.topMenu = topMenu;
}
setRightMenu(rightMenu) {
this.rightMenu = rightMenu;
}
setHasRight(bool) {
this.hasRight = bool;
}
}

View File

@ -0,0 +1,18 @@
.searchGroup {
width: 100%;
padding: 8px 20px;
.radioGroupShow{
text-align: center;
line-height: 30px;
margin-bottom: 8px;
background-color: #f4f4f4;
color: #333;
span{
padding: 3px;
cursor: pointer;
}
}
}