From 37e6757110b6c45ae6fd0ed2ac911b56d494d21f Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 8 Aug 2023 14:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=B1=E5=90=8D=E5=86=8C=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/company/company.js | 42 +- .../components/resource/GroupList.js | 39 ++ .../components/resource/resource.js | 22 +- pc4mobx/organization/stores/resource.js | 525 +++++++++++------- pc4mobx/organization/style/resource.less | 18 + 5 files changed, 408 insertions(+), 238 deletions(-) create mode 100644 pc4mobx/organization/components/resource/GroupList.js create mode 100644 pc4mobx/organization/style/resource.less diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 6ea1f48..3cf53da 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -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 { - window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank") - }}>{text} - + window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank") + }}>{text} + } } if (c.dataIndex == 'operate') { @@ -354,25 +354,25 @@ export default class Company extends React.Component { c.render = function (text, record) { const menu = ( - + { - _this.doDel(record.id) -}}>删除 + _this.doDel(record.id) + }}>删除 { - _this.select(record.id) -}}>联查部门 + _this.select(record.id) + }}>联查部门 { - _this.view(record.id) -}}>查看 + _this.view(record.id) + }}>查看 { - _this.transfer(record.id) -}}>转移 + _this.transfer(record.id) + }}>转移 {/* { _this.version(record) }}>另存为版本 @@ -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 = [ (), + company.setCurrent(1); company.setPageSize(10); company.getTableInfo(); company.setPanelStatus(false) + }}>{i18n.button.search()}), (), (), ]; @@ -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()} /> ) diff --git a/pc4mobx/organization/components/resource/GroupList.js b/pc4mobx/organization/components/resource/GroupList.js new file mode 100644 index 0000000..1f0ba93 --- /dev/null +++ b/pc4mobx/organization/components/resource/GroupList.js @@ -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 ( +
setDomRef(dom, 'tab')}> +
+
store.showRadioGroup = !showRadioGroup}> + {label} + + + +
+
+ +
+
+
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js index f7b94aa..e73148e 100644 --- a/pc4mobx/organization/components/resource/resource.js +++ b/pc4mobx/organization/components/resource/resource.js @@ -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: { - resource.getTableInfo(); resource.setPanelStatus(false) -}}>{i18n.button.search()}), + resource.getTableInfo(); resource.setPanelStatus(false) + }}>{i18n.button.search()}), (), (), (), @@ -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() :
} advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} hasMask={false} buttonsAd={this.getTabBtn()} - onSearch={() => resource.getTableInfo()} + onSearch={() => store.getTableInfo()} onSearchChange={val => this.onSearchChange(val)} /> + + store={store} /> + store={store} /> ) } diff --git a/pc4mobx/organization/stores/resource.js b/pc4mobx/organization/stores/resource.js index 5e9078e..cf9c4d9 100644 --- a/pc4mobx/organization/stores/resource.js +++ b/pc4mobx/organization/stores/resource.js @@ -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:
自定义组件
, + 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; + } } \ No newline at end of file diff --git a/pc4mobx/organization/style/resource.less b/pc4mobx/organization/style/resource.less new file mode 100644 index 0000000..ae78a6a --- /dev/null +++ b/pc4mobx/organization/style/resource.less @@ -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; + } + } +} \ No newline at end of file