Merge pull request 'feature/cl' (#42) from feature/cl into dev

Reviewed-on: http://221.226.25.34:3000/liang.cheng/trunk/pulls/42
This commit is contained in:
liang.cheng 2023-08-23 11:01:45 +08:00
commit ff482709cd
21 changed files with 1806 additions and 272 deletions

View File

@ -0,0 +1,9 @@
import { WeaTools } from 'ecCom';
export const getQtxConfigInfo = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/config/selectConfigInfo', 'GET', params);
}
export const saveQtxConfigInfo = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/config/saveConfigInfo', 'POST', params);
}

View File

@ -0,0 +1,16 @@
import {
WeaTools
} from 'ecCom';
export const saveQuickSearchInfo = (params) => {
return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchInfo`, 'POST', params);
}
export const saveQuickSearchDetailInfo = (params) => {
return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchDetailInfo`, 'POST', params);
}
export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchInfo`, 'GET', params);
export const getQuickSearchDetailInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchDetailInfo`, 'GET', params);

View File

@ -31,6 +31,11 @@ export const getHasRight = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getHasRight', 'GET', params); return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/getHasRight', 'GET', params);
} }
export const getQuickSearchCondition = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/quicksearch/getQuickSearchCondition', 'GET', params);
}
export const editResource = (params) => { export const editResource = (params) => {
return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/updateForm', 'POST', params); return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/updateForm', 'POST', params);
} }

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-18 14:52:39 * @Date: 2022-05-18 14:52:39
* @LastEditTime: 2023-07-26 18:59:02 * @LastEditTime: 2023-08-04 16:52:47
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js
*/ */
@ -28,11 +28,16 @@ import AttachToNumberField from "../NewNumberField";
export default class CompanyExtend extends React.Component { export default class CompanyExtend extends React.Component {
componentDidMount() { componentDidMount() {
this.init(); this.handleHashChange();
window.addEventListener('hashchange', this.handleHashChange);
} }
init = () => {
componentWillUnmount() {
window.removeEventListener('hashchange', this.handleHashChange);
}
handleHashChange = () => {
const { companyExtend, company } = this.props; const { companyExtend, company } = this.props;
//const {id} = company;
let { hash } = window.location; let { hash } = window.location;
hash = hash.split("?")[0]; hash = hash.split("?")[0];
let id = hash.match("[^/]+(?=/$|$)")[0]; let id = hash.match("[^/]+(?=/$|$)")[0];
@ -129,7 +134,7 @@ export default class CompanyExtend extends React.Component {
labelCol={{ span: `${field.labelcol}` }} labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}> wrapperCol={{ span: `${field.fieldcol}` }}>
<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} /> <WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@d4vaqk@${j}`} fieldConfig={field} form={form} />
{field.domkey[0] == 'subcompanycode' && <AttachToNumberField field={field} form={form} isEdit={true} />} {field.domkey[0] == 'subcompanycode' && isEditor &&<AttachToNumberField field={field} form={form} isEdit={true} />}
</WeaFormItem>), </WeaFormItem>),
colSpan: 1 colSpan: 1
}); });
@ -231,7 +236,7 @@ export default class CompanyExtend extends React.Component {
} }
backCard = () => { backCard = () => {
this.init(); this.handleHashChange();
} }
view = () => { view = () => {

View File

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

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-06-02 09:20:03 * @Date: 2022-06-02 09:20:03
* @LastEditTime: 2023-07-26 18:59:14 * @LastEditTime: 2023-08-04 16:51:56
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js
*/ */
@ -29,9 +29,15 @@ import '../../style/common.less';
export default class DepartmentExtendStore extends React.Component { export default class DepartmentExtendStore extends React.Component {
componentDidMount() { componentDidMount() {
this.init(); this.handleHashChange();
window.addEventListener('hashchange', this.handleHashChange);
} }
init = () => {
componentWillUnmount() {
window.removeEventListener('hashchange', this.handleHashChange);
}
handleHashChange = () => {
const { departmentExtend, department } = this.props; const { departmentExtend, department } = this.props;
let { hash } = window.location; let { hash } = window.location;
hash = hash.split("?")[0]; hash = hash.split("?")[0];
@ -242,7 +248,7 @@ export default class DepartmentExtendStore extends React.Component {
} }
backCard = () => { backCard = () => {
this.init(); this.handleHashChange();
} }
changeData(key) { changeData(key) {

View File

@ -105,9 +105,9 @@ export default class FieldDef extends Component {
} }
const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)] const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)]
return ( return (
<div className={classes} ref={dom => { <div className={classes} style={{"height":"calc(100% - 47px)"}} ref={dom => {
this.tabDom = dom this.tabDom = dom
}}> }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@43qdk8`} datas={rMenu}> <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@43qdk8`} datas={rMenu}>
<WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@5fu5eh`} tableProps={tableProps} viewAttr={3} rowKey={'fieldidrowKey'} <WeaTableEdit ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEdit@5fu5eh`} tableProps={tableProps} viewAttr={3} rowKey={'fieldidrowKey'}
ref={(editTable) => setEditTable(editTable, 'fieldDef')} ref={(editTable) => setEditTable(editTable, 'fieldDef')}

View File

@ -0,0 +1,178 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer
} from 'mobx-react'
import {
WeaTop, WeaFormItem, WeaTable, WeaRightMenu, WeaHelpfulTip,
WeaNewScroll, WeaSearchGroup, WeaLocaleProvider, WeaTab, WeaTableEdit
} from 'ecCom'
import {
Row, Col, Button, Modal, message, Input, Dropdown, Icon, Menu
} from 'antd'
import { WeaSwitch } from 'comsMobx'
import {
i18n
} from '../../public/i18n';
const getLabel = WeaLocaleProvider.getLabel;
const toJS = mobx.toJS;
const confirm = Modal.confirm;
@inject('qtxConfig')
@observer
export default class QtxConfig extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
const {
qtxConfig
} = this.props;
qtxConfig.initList();
}
componentWillUnmount() {
}
componentWillReceiveProps(nextProps) {
const {
qtxConfig
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
qtxConfig.initList();
}
}
getDropMenuDatas() {
const {
qtxConfig
} = this.props, {
rightMenu
} = qtxConfig
let menus = [];
toJS(rightMenu).map((item, index) => {
let obj = {
key: item.menuFun,
icon: <i className={`${item.menuIcon}`} />,
content: item.menuName,
}
menus.push(obj);
})
return menus;
}
getTopMenuBtns() {
const {
qtxConfig
} = this.props, {
topMenu
} = qtxConfig
let btns = [];
topMenu.map((item, i) => {
btns.push(<Button type='primary' onClick={() => { this[item.menuFun] && this[item.menuFun](); }}>{item.menuName}</Button>);
});
return btns;
}
save = () => {
const {
qtxConfig
} = this.props;
let result = this.tableEdit.refs.edit.doRequiredCheck();
result.pass && qtxConfig.saveQtxConfigInfo();
}
login = () => {
window.open("/api/bs/hrmorganization/config/ssoLogin", "_blank")
}
getFormItems = () => {
const { qtxConfig } = this.props;
const { configFields, configForm } = qtxConfig;
const arr = [];
const formParams = configForm.getFormParams();
const { isFormInit } = configForm;
isFormInit && configFields.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={configForm} formParams={formParams} />}
{<WeaHelpfulTip
style={{"marginLeft":"20px"}}
ecId={`${this && this.props && this.props.ecId || ""}_WeaHelpfulTip@4vdvfp@${index}`}
title="未启用的情况下,企通学配置信息将从qtx_sso_login.properties配置文件中读取" />}
</WeaFormItem>
</div>
</Col>)
})
return <Row>{arr}</Row>
}
render() {
const { qtxConfig: store } = this.props;
const { editTableData } = store, {
datas, columns, selectedData, loading
} = editTableData;
return (
<div ref='page' style={{ height: '100%' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getDropMenuDatas()}
onClick={key => { this[key] && this[key]() }}
>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
title={"企通学配置自定义"}
icon={<i className='icon-coms-hrm' />}
iconBgcolor='#217346'
loading={true}
buttons={this.getTopMenuBtns()}
showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()}
onDropMenuClick={(key) => { this[key] && this[key]() }}
>
<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@ddy3vv`} needTigger={false} showGroup={true} title={getLabel(82751, "基础设置")}>
{this.getFormItems()}
</WeaSearchGroup>
<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@s8pupj`} needTigger={false} showGroup={true} title={getLabel(-1, "数据库设置")}>
<WeaTableEdit
ecId={`${this && this.props && this.props.ecId || ""}_WeaTableEdit@7rorir`}
ref={el => {this.tableEdit = el}}
draggable
deleteConfirm
showCopy={false}
title=""
columns={toJS(columns)}
datas={toJS(datas)}
selectedData={!loading && toJS(selectedData)}
onChange={e => store.setTableEditDatas(e)}
/>
</WeaSearchGroup>
</WeaTop>
</WeaRightMenu>
</div>
)
}
}

View File

@ -0,0 +1,262 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer
} from 'mobx-react'
import {
WeaTop, WeaFormItem, WeaTable, WeaRightMenu,
WeaNewScroll, WeaSearchGroup, WeaLocaleProvider, WeaTab
} from 'ecCom'
import {
Row, Col, Button, Modal, message, Input, Dropdown, Icon, Menu
} from 'antd'
import { WeaSwitch } from 'comsMobx'
import {
i18n
} from '../../public/i18n';
import QuickSearchTableEdit from './QuickSearchTableEdit';
import QuickSearchDetail from './QuickSearchDetail';
const getLabel = WeaLocaleProvider.getLabel;
const toJS = mobx.toJS;
const confirm = Modal.confirm;
@inject('quickSearch')
@observer
export default class QuickSearch extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
}
componentDidMount() {
const {
quickSearch
} = this.props;
quickSearch.initList();
}
componentWillUnmount() {
}
componentWillReceiveProps(nextProps) {
const {
quickSearch
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
quickSearch.initList();
}
}
getDropMenuDatas() {
const {
quickSearch
} = this.props,{
rightMenu
} = quickSearch
let menus = [];
toJS(rightMenu).map((item, index) => {
let obj = {
key: item.menuFun,
icon: <i className={`${item.menuIcon}`} />,
content: item.menuName,
}
menus.push(obj);
})
return menus;
}
getTopMenuBtns() {
const {
quickSearch
} = this.props,{
topMenu
} = quickSearch
let btns = [];
topMenu.map((item, i) => {
btns.push(<Button type='primary' onClick={() => {this[item.menuFun] && this[item.menuFun]();}}>{item.menuName}</Button>);
});
return btns;
}
save = () => {
const {
quickSearch
} = this.props;
quickSearch.saveQuickSearchInfo();
}
getFormItems = () => {
const { quickSearch } = this.props;
const { quickSearchFields, quickSearchForm } = quickSearch;
const arr = [];
const formParams = quickSearchForm.getFormParams();
const { isFormInit } = quickSearchForm;
isFormInit && quickSearchFields.map((field, index) => {
arr.push(<Col ecId={`${this && this.props && this.props.ecId || ''}_Col@4cc308@${index}`} offset={1}>
<div style={{ marginTop: 20 }}>
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@u6ex85@${index}`}
label={`${field.label}`}
labelCol={{ span: `${field.labelcol}` }}
wrapperCol={{ span: `${field.fieldcol}` }}>
{<WeaSwitch ecId={`${this && this.props && this.props.ecId || ''}_WeaSwitch@p7d3td@${index}`} fieldConfig={field} form={quickSearchForm} formParams={formParams} />}
</WeaFormItem>
</div>
</Col>)
})
return <Row>{arr}</Row>
}
getSearchButton = () => {
return [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@7xw5i9@addRow`} type="primary" shape="circle" title={getLabel(611, '添加')} size="small" disabled={0} onClick={() => {
this.addRow();
}}><i className="anticon anticon-plus"></i></Button>),
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@lzrtmm@delRow`} shape="circle" title={getLabel(126371, '删除')} size="small" onClick={() => {
this.delRow();
}} ><i className="anticon anticon-minus"></i></Button>
]
}
addRow = () => {
const { quickSearch } = this.props;
let { quickSearchData } = quickSearch;
let datas = quickSearchData.datas;
if(datas.length>=8){
message.error(getLabel('387795',"最多只能添加8项"));
return;
}
let time = new Date().getTime();
let type = quickSearchData.options.length > 0 ? quickSearchData.options[0].type : '2';
let fieldid = quickSearchData.options.length > 0 ? quickSearchData.options[0].key : '';
let customname = quickSearchData.options.length > 0 ? quickSearchData.options[0].showname : '';
let isdetailtable = quickSearchData.options.length > 0 ? quickSearchData.options[0].isdetailtable : '0';
let obj = {
key: "new_" + time,
fieldid: fieldid,
customname: customname,
range: type == '1' ? getLabel('387636', "内容自定义") : getLabel('387637', "字段本身值"),
condition: type == '1' ? getLabel('68', "设置") : '',
orderid: 0,
type: type,
isdetailtable: isdetailtable
}
datas = toJS(datas);
datas.push(obj);
quickSearch.setQuickSearchData(datas);
}
delRow = () => {
const { quickSearch } = this.props;
let { qcSelectedRowKeys } = quickSearch;
if (qcSelectedRowKeys.length <= 0) {
message.error(getLabel(22346, '请选择要删除的信息', 'label'));
return;
}
const that = this;
Modal.confirm({
title: getLabel(83601, '您确认要删除选中的记录吗?'),
onOk() {
let { datas } = quickSearch.quickSearchData;
datas = toJS(datas);
datas = that.delFromArray(datas, qcSelectedRowKeys);
quickSearch.qcSelectedRowKeys = [];
quickSearch.setQuickSearchData(datas);
},
onCancel() {},
});
}
delFromArray = (array, selectRowIds) => {
for (let i = 0; i < selectRowIds.length; i++) {
let key = selectRowIds[i];
for (let j = 0; j < array.length; j++) {
if (array[j]["key"] == key) {
array.splice(j, 1);
break;
}
}
}
return array;
}
onSelectChange = (keys, rows) => {
let keyarr = [];
rows.map(row => {
keyarr.push(row.key);
});
const { quickSearch } = this.props;
quickSearch.qcSelectedRowKeys = keyarr;
}
onChange = (data) => {
const { quickSearch } = this.props;
quickSearch.setQuickSearchData(data);
}
render() {
const { quickSearch: store } = this.props;
const { qcSelectedRowKeys } = store;
const rowSelection = {
selectedRowKeys: qcSelectedRowKeys,
onChange: this.onSelectChange,
}
return (
<div ref='page' style={{ height: '100%' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getDropMenuDatas()}
onClick={key => {this[key] && this[key]()}}
>
<WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@bj98s7`}
title={"快捷搜索自定义"}
icon={<i className='icon-coms-hrm' />}
iconBgcolor='#217346'
loading={true}
buttons={this.getTopMenuBtns()}
showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()}
onDropMenuClick={(key) => {this[key] && this[key]()}}
>
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@weabdm`}>
<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@ddy3vv`} needTigger={false} showGroup={true} title={getLabel(82751, "基础设置")}>
{this.getFormItems()}
</WeaSearchGroup>
<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@s8pupj`} needTigger={false} showGroup={true} title={getLabel(384165, "条件字段")}>
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@sxnhjh`}
keyParam="key" //主键
buttons={this.getSearchButton()}
/>
<QuickSearchTableEdit ecId={`${this && this.props && this.props.ecId || ''}_QuickSearchTableEdit@1xviqu`}
datas={toJS(store.quickSearchData.datas)}
options={toJS(store.quickSearchData.options)}
onChange={this.onChange}
rowSelection={rowSelection}
ListProps={this.props}
/>
</WeaSearchGroup>
</WeaNewScroll>
<QuickSearchDetail ecId={`${this && this.props && this.props.ecId || ''}_QuickSearchDetail@plu05u`} {...this.props}/>
</WeaTop>
</WeaRightMenu>
</div>
)
}
}

View File

@ -0,0 +1,280 @@
import React from 'react';
import { observer } from 'mobx-react';
import { WeaDialog, WeaNewScroll, WeaLocaleProvider, WeaRightMenu } from 'ecCom';
import { WeaScope, WeaInput, WeaInputNumber, WeaSearchGroup, WeaTab, WeaError, WeaHelpfulTip } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import { Button, Table, Modal, message } from 'antd';
import { observable, toJS, } from "mobx";
import { WeaForm } from 'comsMobx';
import $ from 'jquery';
@observer
export default class QuickSearchDetail extends React.Component {
constructor(props) {
super(props);
}
onSelectChange = (keys, rows) => {
let keyarr = [];
rows.map(row => {
keyarr.push(row.key);
});
const { quickSearch } = this.props;
quickSearch.qcDetailRowKeys = keyarr;
}
save = () => {
const { quickSearch } = this.props;
quickSearch.saveQuickSearchDetailInfo();
}
closeDialog = () => {
const { quickSearch } = this.props;
quickSearch.quickSearchDetailVisable = false;
}
onChange = (data) => {
const { quickSearch } = this.props;
quickSearch.setQuickSearchDetailData(data);
}
getSearchButton = () => {
const { quickSearch } = this.props;
const buttons = new Array();
buttons.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@spalvu@addRow`} type="primary" shape="circle" title={getLabel(611, '添加')} size="small" disabled={0} onClick={() => {
this.addRow();
}}><i className="anticon anticon-plus"></i></Button>);
buttons.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@zz4kgt@delRow`} title={getLabel(126371, '删除')} shape="circle" size="small" onClick={() => {
this.delRow();
}} ><i className="anticon anticon-minus"></i></Button>);
return buttons;
}
addRow = () => {
const { quickSearch } = this.props;
let { quickSearchDetailData } = quickSearch;
let datas = quickSearchDetailData;
let time = new Date().getTime();
let obj = {
key: "new_" + time,
customname: '',
orderid: 0,
minnum: '',
maxnum: '',
type: quickSearch.qcData.qcType,
fieldid: quickSearch.qcData.fieldid,
customid: quickSearch.customid
}
datas = toJS(datas);
datas.push(obj);
quickSearch.setQuickSearchDetailData(datas);
}
delRow = () => {
const { quickSearch } = this.props;
let { qcDetailRowKeys } = quickSearch;
if (qcDetailRowKeys.length <= 0) {
message.error(getLabel(22346, '请选择要删除的信息', 'label'));
return;
}
const that = this;
Modal.confirm({
title: getLabel(83601, '您确认要删除选中的记录吗?'),
onOk() {
let datas = quickSearch.quickSearchDetailData;
datas = toJS(datas);
datas = that.delFromArray(datas, qcDetailRowKeys);
quickSearch.qcDetailRowKeys = [];
quickSearch.setQuickSearchDetailData(datas);
},
onCancel() { },
});
}
delFromArray = (array, selectRowIds) => {
for (let i = 0; i < selectRowIds.length; i++) {
let key = selectRowIds[i];
for (let j = 0; j < array.length; j++) {
if (array[j]["key"] == key) {
array.splice(j, 1);
break;
}
}
}
return array;
}
render() {
const { quickSearch: store } = this.props, {
qcDetailRowKeys
} = store;
const rowSelection = {
qcDetailRowKeys,
onChange: this.onSelectChange,
}
const Height = $(".wea-dialog-body")[0] && $(".wea-dialog-body")[0].style.height;
const buttons = [
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@va8uvk@save`} onClick={() => this.save()} type="primary">{getLabel(86, "保存")}</Button>,
<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@edy7ux@closeDialog`} onClick={() => { this.closeDialog() }}>{getLabel(309, "关闭")}</Button>
]
return (
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@d0kgwh`} style={{ width: 800, height: 550 }}
visible={store.quickSearchDetailVisable}
title={getLabel('387685', "自定义条件设置")}
iconBgcolor="#217346"
icon='icon-coms-hrm'
onCancel={this.closeDialog}
buttons={buttons}
>
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@x6apdm`} ref="sc" height={Height?Height:530}>
<WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@d5750t`} needTigger={false} showGroup={true} >
<WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@85m7gk`}
keyParam="key" //主键
buttons={this.getSearchButton()}
/>
<QuickSearchTableEdit ecId={`${this && this.props && this.props.ecId || ''}_QuickSearchTableEdit@immgug`}
datas={toJS(store.quickSearchDetailData)}
precision={store.precision}
onChange={this.onChange}
rowSelection={rowSelection}
ListProps={this.props}
/>
</WeaSearchGroup>
</WeaNewScroll>
</WeaDialog>
)
}
}
@observer
class QuickSearchTableEdit extends React.Component{
getColumns = () => {
let columnArray = [
{
title: getLabel(195, "名称"), dataIndex: "customname", key: "customname", width: "40%",
com: [{ label: '', type: 'INPUT', key: 'customname', viewAttr: 3, otherParams: { isBase64: true, inputType: "multilang" } }]
},
{
title: <div>
{getLabel(387588, "内容自定义条件")}&nbsp;
<WeaHelpfulTip ecId={`${this && this.props && this.props.ecId || ''}_WeaHelpfulTip@6znscx@condition`}
width = {196} //如果要自定义宽度,在这里设置
title={getLabel('526162','数值关系: 下限值 <= 数值 < 上限值') }
/>
</div>, dataIndex: "condition", key: "condition", width: "40%",
com: [{ label: '', type: 'SCOP', key: 'condition', viewAttr: 3 }]
},
{
title: getLabel(88, "顺序"), dataIndex: "orderid", key: "orderid", width: "20%",
com: [{ label: '', type: 'INPUTNUMBER', key: 'orderid', viewAttr: 2, otherParams: { max: 999, step: 1 } }]
}
];
columnArray = columnArray.map((col) => {
let _col = { ...col };
_col.render = (text, record, index) => {
return this.getColRender(_col, text, record, index);
}
return _col
});
return columnArray;
}
getColRender = (_col, text, record, index) => {
const { datas } = this.props;
const { quickSearch: { quickSearchRefObj } } = this.props.ListProps;
const { com, } = _col;
let _com = [];
com.map((c) => {
if (typeof c.props === 'object') {
_com.push(<span></span>);
} else {
const { key, viewAttr = 2, type = 'INPUT', width, otherParams = {} } = c;
const _type = type.toUpperCase();
_com.push(
<span>
{
_type === 'INPUT' &&
<WeaError ecId={`${this && this.props && this.props.ecId || ''}_WeaError@z6mgxq@${index}`}
tipPosition={(index == 0 || index+1==datas.length) ? 'top':'bottom'}
error={getLabel('385869', "此项必填")}
style={{ width: "98%" }}
ref={ref => quickSearchRefObj[`error_${key}_${index}`] = ref}
>
<WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@mz6i71@${index}`}
value={record[key]}
viewAttr={viewAttr}
onChange={(value) => this.onEdit(record, index, key, value)}
{...otherParams}
/>
</WeaError>
}
{
_type === 'SCOP' &&
<WeaError ecId={`${this && this.props && this.props.ecId || ''}_WeaError@bvnfbi@${index}`}
tipPosition={(index == 0 || index+1==datas.length) ? 'top':'bottom'}
error={getLabel('385869', "此项必填")}
ref={ref => quickSearchRefObj[`error_${key}_${index}`] = ref}
>
<div className={(record['minnum'] === '' || record['minnum'] == undefined) && (record['maxnum'] === '' || record['maxnum'] == undefined) ? "required" : ""}>
<WeaScope ecId={`${this && this.props && this.props.ecId || ''}_WeaScope@zu7wra@${index}`}
isMobx
hideOps={true}
precision={this.props.precision}
value={[record['minnum'], record['maxnum']]}
onChange={(value) => this.onEdit(record, index, key, value)}
/>
</div>
</WeaError>
}
{
_type === 'INPUTNUMBER' &&
<WeaInputNumber ecId={`${this && this.props && this.props.ecId || ''}_WeaInputNumber@chty4d@${index}`}
value={record[key]}
style={{ width, display: 'inline-block' }}
viewAttr={viewAttr}
onChange={(value1) => this.onEdit(record, index, key, value1)}
{...otherParams}
/>
}
</span>
)
}
});
return (
<div>
{_com}
</div>
)
}
onEdit = (record, index, key, value) => {
const { datas } = this.props;
let _datas = [...datas];
_datas[index][key] = value;
if (key == 'condition') {
_datas[index].minnum = value[0] === undefined ? "" : value[0];
_datas[index].maxnum = value[1] === undefined ? "" : value[1];
}
typeof this.props.onChange === 'function' && this.props.onChange(_datas);
}
render() {
const { datas, rowSelection } = this.props;
return (
<div className="wev-cube-table-inner-warp">
<Table ecId={`${this && this.props && this.props.ecId || ''}_Table@nytlcm`}
rowSelection={rowSelection}
columns={this.getColumns()}
dataSource={datas}
pagination={false}
/>
</div>
)
}
}

View File

@ -0,0 +1,233 @@
import React from 'react'
import * as mobx from 'mobx'
import {
inject,
observer
} from 'mobx-react'
import {
WeaTable, WeaLocaleProvider, WeaSelect, WeaInput, WeaInputNumber
} from 'ecCom'
import {
Row, Col, Button, Modal, message, Input, Dropdown, Icon, Menu
} from 'antd'
import {
i18n
} from '../../public/i18n';
const getLabel = WeaLocaleProvider.getLabel;
import jQuery from "jquery";
const toJS = mobx.toJS;
export default class QuickSearchTableEdit extends React.Component {
/**========================table字段类型=====================*/
getColumns = () => {
let columnArray = [
{
title: getLabel(261, "字段"), dataIndex: "fieldid", key: "fieldid", width: "18%",
com: [{ label: '', type: 'SELECT', isLink: true, key: 'fieldid', options: [] }]
},
{
title: getLabel(195, "名称"), dataIndex: "customname", key: "customname", width: "18%",
com: [{
label: '', type: 'INPUT', key: 'customname', viewAttr: 2, otherParams: { isBase64: true, inputType: "multilang" }
}]
},
{
title: getLabel(389518, "查询范围"), dataIndex: "range", key: "range", width: "8%",
com: [{ label: '', type: 'INPUT', key: 'range', viewAttr: 1 }]
},
{
title: getLabel(387588, "内容自定义条件"), dataIndex: "condition", key: "condition", width: "15%",
com: [{ label: '', type: 'BUTTON', key: 'condition', viewAttr: 1 }]
}, {
title: getLabel(21657, "显示模式"), dataIndex: "showmodel", key: "showmodel", width: "15%",
com: [{
label: '',
type: 'SELECT',
key: 'showmodel',
viewAttr: 1,
options: [ { key: '0', showname: getLabel(19852, '平铺') },]
}]
}
];
columnArray = columnArray.map((col) => {
let _col = { ...col };
_col.render = (text, record, index) => {
return this.getColRender(_col, text, record, index);
}
return _col
});
return columnArray;
}
getColRender = (_col, text, record, index) => {
const {
quickSearch: store
} = this.props;
const { com } = _col;
let _com = [];
com.map((c, idn) => {
if (typeof c.props === 'object') {
_com.push(<span></span>);
} else {
const { key, isLink = false, viewAttr = 2, type = 'INPUT', width, otherParams = {}, detailtype = 1, options = [] } = c;
const _type = type.toUpperCase();
record.range = record.type == '1' ? getLabel('387636', "内容自定义") : getLabel('387637', "字段本身值");
record.condition = record.type == '1' ? getLabel('68', "设置") : '';
if (_type === 'INPUT') {
_com.push(<WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@gedh14@${idn}`}
style={{ minWidth: 60 }}
value={record[key]}
viewAttr={viewAttr}
onChange={(value) => this.onEdit(record, index, key, value)}
{...otherParams}
length={100}
/>)
} else if (_type === 'BUTTON') {
_com.push(<a onClick={() => this.onClick(record)}
style={{ width, display: 'inline-block' }}>{record[key]}</a>);
} else if (_type === 'INPUTNUMBER') {
_com.push(<WeaInputNumber ecId={`${this && this.props && this.props.ecId || ''}_WeaInputNumber@9qqytl@${idn}`}
value={record[key]}
style={{ width, display: 'inline-block' }}
viewAttr={viewAttr}
onChange={(value) => this.onEdit(record, index, key, value)}
{...otherParams}
/>)
} else if (_type === 'SELECT') {
if (isLink) {
_com.push(<WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@h3f5u2@${idn}`}
style={{ width, display: 'inline-block', minWidth: 173 }}
options={toJS(this.props.options)}
viewAttr={viewAttr}
value={record[key]}
detailtype={detailtype}
onChange={(value) => {
this.onEdit(record, index, key, value)
}}
showSearch
filterOption={(inputValue, option) => this.selectFilterOption(inputValue, option)}
/>);
}else if (key === 'showmodel') {//可以设置平铺的类型
const opt = this.props.options.filter(item => item.fieldid === record.fieldid);
const isShowModel = opt[0] ? opt[0].isShowModel : false;
if (isShowModel) {
if (!record[key]) {
record[key] = '0'
}
_com.push(<WeaSelect ecId={`${this && this.props && this.props.ecId || ''}_WeaSelect@ffcq2z@${idn}`}
style={{ width, display: 'inline-block' }}
options={options}
viewAttr={viewAttr}
value={record[key]}
detailtype={detailtype}
onChange={(value) => {
this.onEdit(record, index, key, value)
}}
filterOption={(inputValue, option) => selectFilterOption(inputValue, option)}
/>);
}
}
}
}
});
return (
<div className="cube-quicksearch-list-form">{_com}</div>
)
};
onDropChange = (data) => {
typeof this.props.onChange === 'function' && this.props.onChange(data);
}
onClick = (record) => {
const { ListProps } = this.props;
const { quickSearch } = ListProps;
let key = record.key;
if (key.indexOf("new") >= 0 || record.fieldid != record.orifieldid) {
message.error(getLabel(82228, "请先保存再设置条件"));
return;
}
quickSearch.openQuickSearchDetail(record);
};
onEdit = (record, index, key, value, name, data) => {
const { datas } = this.props;
let _datas = [...datas];
_datas[index][key] = value;
if (key == 'fieldid') {
let opt = this.getType(value);
if (opt != null) {
_datas[index].type = opt['type'];
_datas[index].customname = opt['showname'];
_datas[index].range = _datas[index].type == '1' ? getLabel('387636', "内容自定义") : getLabel('387637', "字段本身值");
_datas[index].condition = _datas[index].type == '1' ? getLabel('68', "设置") : '';
_datas[index].isdetailtable = opt['isdetailtable'];
}
}
typeof this.props.onChange === 'function' && this.props.onChange(_datas);
}
getType = (key) => {
let option = null;
this.props.options.map(f => {
if (f.key == key) {
option = f;
}
});
return option;
}
/**
* 根据选择框的名称搜索过滤选项
* @param inputValue
* @param option
*/
selectFilterOption = (inputValue, option) => {
if (inputValue != "") {
const { children } = option["props"];
if (children) {
if ((typeof children) == "string") {
return children.toLowerCase().indexOf(inputValue.toLowerCase()) != -1;
} else if ((typeof children) == "object" && children.length > 0) {
const childrenNew = children[0]["props"]["children"];
if (childrenNew) {
return childrenNew.toLowerCase().indexOf(inputValue.toLowerCase()) != -1;
} else {
return false;
}
} else {
const childrenNew = children["props"]["children"];
if (childrenNew) {
return childrenNew.toLowerCase().indexOf(inputValue.toLowerCase()) != -1;
} else {
return false;
}
}
} else {
return false;
}
}
return true;
}
render() {
const { datas, rowSelection } = this.props;
return (
<div className="wev-cube-table-inner-warp">
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@ofga8g`}
rowSelection={rowSelection}
columns={this.getColumns()}
dataSource={datas}
pagination={false}
draggable={true}
onDrop={this.onDropChange}
/>
</div>
)
}
}

View File

@ -1,7 +1,7 @@
/** /**
* @Author: 程亮 * @Author: 程亮
* @Date: 2022-05-26 14:05:59 * @Date: 2022-05-26 14:05:59
* @LastEditTime: 2023-08-02 17:09:24 * @LastEditTime: 2023-08-14 11:39:45
* @Description: * @Description:
* @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
*/ */

View File

@ -51,7 +51,7 @@ export default class RankScheme extends React.Component {
} }
componentDidMount() { componentDidMount() {
this.init(); this.init();
} }
componentWillUnmount() { componentWillUnmount() {
@ -201,8 +201,8 @@ export default class RankScheme extends React.Component {
const btn = [ const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => {
rankScheme.getTableInfo(); rankScheme.setPanelStatus(false) rankScheme.getTableInfo(); rankScheme.setPanelStatus(false)
}}>{i18n.button.search()}</Button>), }}>{i18n.button.search()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>), (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju6`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => rankScheme.setPanelStatus(false)}>{i18n.button.cancel()}</Button>), (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@5u9mfz`} onClick={() => rankScheme.setPanelStatus(false)}>{i18n.button.cancel()}</Button>),
]; ];
@ -260,7 +260,7 @@ export default class RankScheme extends React.Component {
return false; return false;
}, },
}); });
} }
onOperatesClick(record, rowIndex, operate) { onOperatesClick(record, rowIndex, operate) {
@ -383,11 +383,11 @@ export default class RankScheme extends React.Component {
} = rankScheme; } = rankScheme;
if (hasRight === false) { if (hasRight === false) {
return renderNoright(); return renderNoright();
} }
return ( return (
hasRight && <div ref='page' style={{ height: '100%' }}> hasRight && <div ref='page' style={{ height: '100%' }}>
<WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`} <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@k6oc4u`}
datas={this.getDropMenuDatas()} datas={this.getDropMenuDatas()}
onClick={key => this.handleMenuClick(key)} onClick={key => this.handleMenuClick(key)}
@ -438,6 +438,6 @@ export default class RankScheme extends React.Component {
onCancel={() => rankScheme.setVisible(false)} onCancel={() => rankScheme.setVisible(false)}
/> />
</div> </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'; } from '../../public/i18n';
//import '../../style/common.less'; //import '../../style/common.less';
import '../../style/resource.less';
import NewAndEditDialog from '../NewAndEditDialog'; import NewAndEditDialog from '../NewAndEditDialog';
import { renderNoright } from '../../util'; import { renderNoright } from '../../util';
import DatasImport from '../import/datasImport'; import DatasImport from '../import/datasImport';
import SearchCustomDialog from './SearchCustomDialog'; import SearchCustomDialog from './SearchCustomDialog';
import NewWeaTableEditDialog from '../NewWeaTableEditDialog'; import NewWeaTableEditDialog from '../NewWeaTableEditDialog';
import GroupList from './GroupList';
@ -80,6 +82,7 @@ export default class Resource extends React.Component {
resource resource
} = this.props; } = this.props;
resource.getHasRight(); resource.getHasRight();
resource.getQuickSearchCondition();
let { hash } = window.location; let { hash } = window.location;
hash = hash.split("?")[1].split("&"); hash = hash.split("?")[1].split("&");
if (hash.length >= 2) { if (hash.length >= 2) {
@ -301,7 +304,7 @@ export default class Resource extends React.Component {
confirm({ confirm({
title: "存为模板", title: "存为模板",
content: content:
<WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@62kt85`} <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@62kt85`}
label="搜索模板名称" label="搜索模板名称"
labelCol={{ span: 10 }} labelCol={{ span: 10 }}
@ -329,8 +332,8 @@ export default class Resource extends React.Component {
const btn = [ const btn = [
(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => { (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@bx87i8`} type="primary" onClick={() => {
resource.getTableInfo(); resource.setPanelStatus(false) resource.getTableInfo(); resource.setPanelStatus(false)
}}>{i18n.button.search()}</Button>), }}>{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@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@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>), (<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@218ju8`} onClick={() => form2.reset()}>{i18n.button.reset()}</Button>),
@ -501,13 +504,12 @@ export default class Resource extends React.Component {
render() { render() {
const { const {
resource,
resource: store resource: store
} = this.props; } = this.props;
const { const {
isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition, isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition,
form, dialogLoading, isEdit, date, hasRight, defaultShowLeft form, dialogLoading, isEdit, date, hasRight, defaultShowLeft,enable
} = resource; } = store;
if (hasRight === false) { if (hasRight === false) {
return renderNoright(); return renderNoright();
@ -535,15 +537,16 @@ export default class Resource extends React.Component {
showSearchAd={isPanelShow} showSearchAd={isPanelShow}
searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? lastName : form2.getFormParams().lastName} searchsBaseValue={this.isEmptyObject(form2.getFormParams()) ? lastName : form2.getFormParams().lastName}
searchsBasePlaceHolder='请输入姓名' searchsBasePlaceHolder='请输入姓名'
setShowSearchAd={bool => resource.setPanelStatus(bool)} setShowSearchAd={bool => store.setPanelStatus(bool)}
hideSearchAd={() => resource.setPanelStatus(false)} hideSearchAd={() => store.setPanelStatus(false)}
searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>} searchsAd={isPanelShow ? this.getPanelComponents() : <div></div>}
advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
hasMask={false} hasMask={false}
buttonsAd={this.getTabBtn()} buttonsAd={this.getTabBtn()}
onSearch={() => resource.getTableInfo()} onSearch={() => {store.hideRadioGroup();store.getTableInfo();}}
onSearchChange={val => this.onSearchChange(val)} onSearchChange={val => this.onSearchChange(val)}
/> />
{enable && <GroupList ecId={`${this && this.props && this.props.ecId || ''}_GroupList@2le78y`} store={store} />}
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`} <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
comsWeaTableStore={tableStore} comsWeaTableStore={tableStore}
hasOrder={true} hasOrder={true}
@ -570,9 +573,9 @@ export default class Resource extends React.Component {
/> />
<DatasImport ecId={`${this && this.props && this.props.ecId || ''}_DatasImport@q4rrwm`} /> <DatasImport ecId={`${this && this.props && this.props.ecId || ''}_DatasImport@q4rrwm`} />
<SearchCustomDialog ecId={`${this && this.props && this.props.ecId || ''}_SearchCustomDialog@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`} <NewWeaTableEditDialog ecId={`${this && this.props && this.props.ecId || ''}_NewWeaTableEditDialog@q4rrwm`}
store={store}/> store={store} />
</div> </div>
) )
} }

View File

@ -32,11 +32,19 @@ import ResourceBasicInfo from "./components/resource/ResourceBasicInfo";
import ResourceCard from "./components/resource/ResourceCard"; import ResourceCard from "./components/resource/ResourceCard";
import ManagerDetach from "./components/detach/ManagerDetach"; import ManagerDetach from "./components/detach/ManagerDetach";
import ColumnSetting from "./components/columnSetting"; import ColumnSetting from "./components/columnSetting";
import PersonnelResume from "./components/resource/PersonnelResume" import PersonnelResume from "./components/resource/PersonnelResume";
import QuickSearch from "./components/fieldDefinedSet/QuickSearch";
import QtxConfig from "./components/fieldDefinedSet/QtxConfig";
import stores from "./stores"; import stores from "./stores";
import "./style/index"; import "./style/index";
// 全局配置
message.config({
duration: 0.8, // 默认持续时间为 3 秒
maxCount: 1, // 全局最大显示数量为 3
});
// 读取系统多语言配置 // 读取系统多语言配置
let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind( let getLocaleLabel = WeaLocaleProvider.getLocaleLabel.bind(
this, this,
@ -98,7 +106,8 @@ const Routes = (
<Route key="managerDetach" path="managerDetach" component={ManagerDetach} /> <Route key="managerDetach" path="managerDetach" component={ManagerDetach} />
<Route key="columnSetting" path="columnSetting" component={ColumnSetting} /> <Route key="columnSetting" path="columnSetting" component={ColumnSetting} />
<Route key="personnelResume" path="personnelResume/:id" component={PersonnelResume} /> <Route key="personnelResume" path="personnelResume/:id" component={PersonnelResume} />
<Route key="quickSearch" path="quickSearch" component={QuickSearch} />
<Route key="qtxConfig" path="qtxConfig" component={QtxConfig} />
</Route> </Route>
); );

View File

@ -26,7 +26,9 @@ import {ImportDialogStore} from "./importDialog";
import {ResourceCardStore} from "./resourceCard"; import {ResourceCardStore} from "./resourceCard";
import {ManagerDetachStore} from "./managerDetach"; import {ManagerDetachStore} from "./managerDetach";
import {ColumnSetting} from './columnSetting'; import {ColumnSetting} from './columnSetting';
import {PersonnelResumeStore} from './personnelResume' import {PersonnelResumeStore} from './personnelResume';
import { QuickSearchStore } from "./quickSearch";
import { QtxConfigStore } from "./qtxConfig";
module.exports = { module.exports = {
@ -58,5 +60,7 @@ module.exports = {
resourceCard:new ResourceCardStore(), resourceCard:new ResourceCardStore(),
managerDetach: new ManagerDetachStore(), managerDetach: new ManagerDetachStore(),
columnSetting: new ColumnSetting(), columnSetting: new ColumnSetting(),
personnelResume:new PersonnelResumeStore() personnelResume:new PersonnelResumeStore(),
quickSearch:new QuickSearchStore(),
qtxConfig: new QtxConfigStore()
}; };

View File

@ -0,0 +1,159 @@
import {
observable,
action,
computed, extendObservable
} from 'mobx';
import * as mobx from 'mobx';
import * as API from '../apis/qtxConfig';
import {
WeaForm
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
import { WeaLocaleProvider } from 'ecCom';
const toJS = mobx.toJS;
const getLabel = WeaLocaleProvider.getLabel;
export class QtxConfigStore {
@observable configForm = new WeaForm();
@observable editTableData = {
datas: [],
columns: [],
loading: true,
selectedData: {}
};
@observable configFields = [
{
domkey: ['isopenconfig'],
conditionType: 'SWITCH',
label: getLabel('-1', "是否开启数据库配置"),
labelcol: 5,
fieldcol: 19,
viewAttr: 3,
}
]
@action("初始化页面") initList = () => {
this.configForm.initFormFields([{ items: this.configFields.slice() }]);
this.getQtxConfigInfo();
}
@action clearConfigData = () => {
this.editTableData.datas = [];
this.editTableData.columns = [];
this.editTableData.loading = true;
}
@action("数据获取") getQtxConfigInfo = () => {
this.clearConfigData();
API.getQtxConfigInfo().then(action(({ code, data, msg }) => {
if (code == 200) {
const { columns, datas } = data;
extendObservable(this.editTableData, {
datas: datas,
columns: columns,
loading: false
});
this.configForm.updateFields({
isopenconfig: data.isopenconfig,
});
} else {
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
}
}));
}
setTableEditDatas = (e) => {
if(e.length > 1) {
e.pop();
message.error("默认只能添加一条配置数据!!!")
}
extendObservable(this.editTableData, {
datas: e
});
}
@action("保存页面") saveQtxConfigInfo = () => {
if(this.editTableData.datas.length == 0) {
return message.error("至少保存一条配置数据!!")
}
let editTable = JSON.stringify(this.editTableData.datas[0]);
API.saveQtxConfigInfo({
...this.configForm.getFormParams(),
editTable,
}).then(({ code, data, msg }) => {
if (code == 200) {
message.success(getLabel(83551, '保存成功!'));
this.getQtxConfigInfo();
} else {
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
}
});
}
arrToJson = (arr) => {
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;
}
/**===========================buttons=========================== */
rightMenu = [
{
"isBatch": "0",
"isTop": "1",
"menuFun": "save",
"menuIcon": "icon-coms-Preservation",
"menuName": "保存",
"type": "BTN_save"
},
{
"isBatch": "0",
"isTop": "0",
"menuFun": "login",
"menuIcon": "icon-coms-link",
"menuName": "单点登录",
"type": "BTN_link"
}
];
topMenu = [
{
"isBatch": "1",
"isTop": "1",
"menuFun": "save",
"menuIcon": "icon-coms-Preservation",
"menuName": "保存",
"type": "BTN_save"
},
{
"isBatch": "1",
"isTop": "1",
"menuFun": "login",
"menuIcon": "icon-coms-link",
"menuName": "单点登录",
"type": "BTN_link"
}
]
}

View File

@ -0,0 +1,232 @@
import {
observable,
action
} from 'mobx';
import * as mobx from 'mobx';
import * as API from '../apis/quickSearch';
import {
WeaForm
} from 'comsMobx';
import {
Modal,
message,
} from 'antd'
import {
i18n
} from '../public/i18n';
import { WeaLocaleProvider } from 'ecCom';
const toJS = mobx.toJS;
const getLabel = WeaLocaleProvider.getLabel;
const formatMultiLang = WeaLocaleProvider.formatMultiLang;
export class QuickSearchStore {
@observable quickSearchForm = new WeaForm();
@observable qcSelectedRowKeys = [];
@observable quickSearchData = {
datas: [],//表格记录record
setting: {},
options: [],
};
@observable quickSearchDetailVisable = false;
@observable qcData = { qcType: '', cid: '', fieldid: '' };//快速查询明细type
@observable quickSearchDetailData = [];
@observable precision = 0;
@observable qcDetailRowKeys = [];
quickSearchRefObj = {};
/**** ==============quickSearchForm ===============*/
@observable quickSearchFields = [
{
domkey: ['isquicksearch'],
conditionType: 'SWITCH',
label: getLabel('387493', "快捷搜索条件"),
labelcol: 5,
fieldcol: 19,
viewAttr: 3,
}
]
@action("初始化页面") initList = () => {
this.quickSearchForm.initFormFields([{ items: this.quickSearchFields.slice() }]);
this.getQuickSearchInfo();
}
@action clearQuciSearchData = () => {
this.quickSearchData.setting = {};
this.quickSearchData.datas = [];
this.quickSearchData.options = [];
}
@action("数据获取") getQuickSearchInfo = () => {
this.clearQuciSearchData();
API.getQuickSearchInfo().then(action(({ code, data, msg }) => {
if (code == 200) {
this.quickSearchData.setting = data.setting;
this.quickSearchData.datas = data.datas.map(d => {
return { ...d, visible: false }
});
this.quickSearchData.groupidOptions = data.groupidOptions;
this.quickSearchData.options = data.options;
this.quickSearchForm.updateFields({
isquicksearch: data.setting.isquicksearch,
});
} else {
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
}
}));
}
@action("保存页面") saveQuickSearchInfo = () => {
let datas = this.quickSearchData.datas;
datas.map((data, index) => {
data.orderid = index
});
let formparm = this.quickSearchForm.getFormParams();
if (!this.checkQuickSearchData()) {
message.error(getLabel('387954', "条件字段不能重复"));
return;
}
let id = this.quickSearchData.setting.id;
if (id == null) {
return;
}
API.saveQuickSearchInfo({
id: id,
data: JSON.stringify(datas), ...formparm
}).then(({ code, data, msg }) => {
if (code == 200) {
message.success(getLabel(83551, '保存成功!'));
this.qcSelectedRowKeys = [];
this.getQuickSearchInfo();
} else {
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
}
});
this.quickSearchData.setting.id = null;
}
checkQuickSearchData = () => {
let map = new Map();
let result = true;
this.quickSearchData.datas.map(data => {
if (map.has(data.fieldid)) {
result = false;
}
map.set(data.fieldid, data.customname);
});
return result;
}
@action setQuickSearchData = (datas) => {
this.quickSearchData.datas = datas;
}
/**============================quickdetail===================== */
@action("设置") openQuickSearchDetail = (record) => {
this.quickSearchDetailVisable = true;
this.qcData.qcType = record.type;
this.qcData.cid = record.cid;
this.qcData.fieldid = record.fieldid;
this.getQuickSearchDetailInfo(record.cid);
}
@action getQuickSearchDetailInfo = (cid) => {
API.getQuickSearchDetailInfo({ cid: cid }).then(({ code, data, msg }) => {
if (code == 200) {
this.quickSearchDetailData = data.datas;
this.precision = data.precision;
} else {
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
}
});
}
@action("明细保存") saveQuickSearchDetailInfo = () => {
let datas = this.quickSearchDetailData;
if (!this.checkQuickSearchDetailData()) {
return;
}
API.saveQuickSearchDetailInfo({
cid: this.qcData.cid,
data: JSON.stringify(datas)
}).then(({ code, data, msg }) => {
if (code == 200) {
message.success(getLabel(83551, '保存成功!'));
this.qcDetailRowKeys = [];
this.getQuickSearchDetailInfo(this.qcData.cid);
} else {
message.error(`[${getLabel(127353, "错误") + code}]:${msg}`);
}
});
}
@action setQuickSearchDetailData = (datas) => {
this.quickSearchDetailData = datas;
}
checkQuickSearchDetailData = () => {
let result = true;
for (let i = 0; i < this.quickSearchDetailData.length; i++) {
let data = this.quickSearchDetailData[i];
if (_.trim(formatMultiLang(data.customname)) == '') {
this.quickSearchRefObj[`error_customname_${i}`].showError();
result = false;
break;
}
let minnum = data.minnum + '';
let maxnum = data.maxnum + '';
if ((_.trim(formatMultiLang(minnum)) == '' || minnum == undefined) && (_.trim(formatMultiLang(maxnum)) == '' || maxnum == undefined)) {
this.quickSearchRefObj[`error_condition_${i}`].showError();
result = false;
return;
}
if ((minnum != '' && minnum != undefined)
&& (maxnum != '' && maxnum != undefined)
&& (parseFloat(minnum) > parseFloat(maxnum))) {
message.error(getLabel('382783', "请填写正确的区间"));
result = false;
return;
}
}
return result;
}
/**===========================buttons=========================== */
rightMenu = [
{
"isBatch": "0",
"isTop": "1",
"menuFun": "save",
"menuIcon": "icon-coms-Preservation",
"menuName": "保存",
"type": "BTN_save"
},
// {
// "isBatch": "0",
// "isTop": "0",
// "menuFun": "log",
// "menuIcon": "icon-coms-Print-log",
// "menuName": "日志",
// "type": "BTN_log"
// }
];
topMenu = [
{
"isBatch": "1",
"isTop": "1",
"menuFun": "save",
"menuIcon": "icon-coms-Preservation",
"menuName": "保存",
"type": "BTN_save"
}
]
}

View File

@ -23,7 +23,7 @@ import {
i18n i18n
} from '../public/i18n'; } from '../public/i18n';
import { getSecondPath } from '../util/index' import { getSecondPath } from '../util/index'
import {cloneDeep,isEmpty,trim} from 'lodash'; import { cloneDeep, isEmpty, trim } from 'lodash';
const toJS = mobx.toJS; const toJS = mobx.toJS;
const { const {
@ -59,21 +59,81 @@ export class ResourceStore {
@observable selectTreeNodeInfo; @observable selectTreeNodeInfo;
@observable enable = false;
@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);
}
@observable rangeConditions = [];
@observable radioParams = {};
@observable refreshRadioGroup = new Date().getTime();
@computed get radioGroupConfig(){
this.refreshRadioGroup;
return {
config: [
...this.rangeConditions
],
key: new Date().getTime(),
onChange: this.onRadioGroupChangeHandle
}
}
@action onRadioGroupChangeHandle = params => {
this.radioParams = params;
this.getTableInfo();
}
@action("列表") getTableInfo() { @action("列表") getTableInfo() {
let params;
this.tableStore = new TableStore(); this.tableStore = new TableStore();
if (this.isEmptyObject(this.form2.getFormParams())) { let params = {};
debugger;
if(this.isEmptyObject(this.radioParams)) {
params = { params = {
...this.selectTreeNodeInfo, ...this.selectTreeNodeInfo,
lastName: this.lastName isQuickSearch:false
}; }
} else { if (this.isEmptyObject(this.form2.getFormParams())) {
params = {
...params,
lastName: this.lastName,
};
} else {
params = {
...params,
...this.form2.getFormParams()
};
}
}else {
params = { params = {
...this.radioParams,
...this.selectTreeNodeInfo, ...this.selectTreeNodeInfo,
...this.form2.getFormParams() isQuickSearch:true
}; }
} }
this.form2.resetForm();
Api.getSearchList(params).then(res => { Api.getSearchList(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
res.data.datas && this.tableStore.getDatas(res.data.datas, 1); res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
@ -87,6 +147,7 @@ export class ResourceStore {
@action("nodetree事件") doSearch(params) { @action("nodetree事件") doSearch(params) {
this.selectTreeNodeInfo = params; this.selectTreeNodeInfo = params;
this.showRadioGroup = true;
this.getTableInfo(); this.getTableInfo();
} }
@ -100,7 +161,7 @@ export class ResourceStore {
return response.json() return response.json()
}).then(data => { }).then(data => {
if (data.code === 200) { if (data.code === 200) {
message.success(data.msg); message.success(data.msg,1);
this.getTableInfo(); this.getTableInfo();
this.setVisible(false); this.setVisible(false);
} else { } else {
@ -159,6 +220,18 @@ export class ResourceStore {
}) })
} }
@action("快捷搜索") getQuickSearchCondition() {
Api.getQuickSearchCondition().then(res => {
if (res.code === 200) {
this.rangeConditions = res.data.rangeConditions;
this.enable = res.data.enable;
} else {
message.warning(res.msg);
}
}, error => {
message.warning(error.msg);
})
}
@action("顶部按钮") getHasRight() { @action("顶部按钮") getHasRight() {
Api.getHasRight().then(res => { Api.getHasRight().then(res => {
@ -250,24 +323,24 @@ export class ResourceStore {
} }
@action("列定制保存") saveCustomDefine = () => { @action("列定制保存") saveCustomDefine = () => {
if(this.customTemplateId == '-1') { if (this.customTemplateId == '-1') {
message.error("默认模板不能修改,将返回默认模板列"); message.error("默认模板不能修改,将返回默认模板列");
} }
const params = { const params = {
columns:this.transfer.transferKeys, columns: this.transfer.transferKeys,
templateId:this.customTemplateId templateId: this.customTemplateId
} }
Api.saveColumnsCustomTemplate(params).then(res => { Api.saveColumnsCustomTemplate(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.searchDialog.visible = false; this.searchDialog.visible = false;
this.getTableInfo(); this.getTableInfo();
} }
}, error => { }, error => {
message.warning(error.msg); message.warning(error.msg);
}) })
} }
@action("高级搜索模板切换") changeSearchTemplate(v) { @action("高级搜索模板切换") changeSearchTemplate(v) {
@ -315,7 +388,7 @@ export class ResourceStore {
} }
@action("常用条件定制模板切换") getTemplateSelectKeys = v => { @action("常用条件定制模板切换") getTemplateSelectKeys = v => {
if(!this.search){ if (!this.search) {
this.customTemplateId = v; this.customTemplateId = v;
} }
@ -515,7 +588,7 @@ export class ResourceStore {
@action("模板") getSearchTemplate = (bool) => { @action("模板") getSearchTemplate = (bool) => {
Api.getSearchTemplate({ type: bool ? 'search' : 'custom' }).then(res => { Api.getSearchTemplate({ type: bool ? 'search' : 'custom' }).then(res => {
if (res.code === 200) { if (res.code === 200) {
if(res.data.templateId) { if (res.data.templateId) {
this.customTemplateId = res.data.templateId; this.customTemplateId = res.data.templateId;
} }
bool ? this.setTemplates(res.data.templates) : this.setCustomTemplates(res.data.templates); bool ? this.setTemplates(res.data.templates) : this.setCustomTemplates(res.data.templates);
@ -595,218 +668,221 @@ export class ResourceStore {
}).catch(error => { }).catch(error => {
message.error(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") { @action("列定制") getCustomTransferData() {
let json = {}; Api.getCustomTransferData(this.customTemplateId).then(result => {
const _rows = isEmpty(arr) ? [] : rows; if (result.code === 200) {
_rows && _rows.map(index => { const { transferDatas, transferKeys, transferOptions } = result.data;
arr[index][rowKey] = "1"; this.transfer.transferDatas = transferDatas;
}); this.transfer.transferKeys = transferKeys;
arr.map((item, index) => { this.transfer.transferOptions = transferOptions;
if (!item[rowKey]) item[rowKey] = "0"; this.searchDialog.visible = true;
for (let key in item) { this.searchDialog.loading = false;
json[key + "_" + index] = item[key]; } else {
} message.warning(result.msg);
}); }
}, error => {
return json; message.warning(error.msg);
} })
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) { @action updateTransferleftIptVal = (v) => {
this.visible = bool; this.transfer.transferleftIptVal = v;
this.formReset(); }
!bool && this.dialogLoadingReset();
}
setDialogLoadingStatus(bool) { @action updateTransferSelectedKey = (v) => {
this.dialogLoading = bool; this.transfer.transferSelectedKey = v;
} }
setNeDialogTitle(title) { @action updateTransferKeys = (v) => {
this.nEdialogTitle = title; this.transfer.transferKeys = v;
} }
setIsNew(bool) {
this.isNew = bool;
}
setCondition(condition) { @action updateTransferRightptVal = (v) => {
this.condition = condition; this.transfer.transferRightIptVal = v;
} }
setUserId(userId) {
this.userId = userId;
}
setDate(date) {
this.date = date;
}
setTopMenu(topMenu) { @action openSearchDialog = (bool) => {
this.topMenu = topMenu; this.search = bool;
} this.searchDialog.loading = false;
this.formatTransfer();
}
setRightMenu(rightMenu) { @action openCustomDialog = (bool) => {
this.rightMenu = rightMenu; 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
}
});
}
hideRadioGroup() {
this.radioParams = {};
this.showRadioGroup = false;
}
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;
}
}
}