From 72a3d27b16962a2168d2a2287c37679225934e29 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 4 Aug 2023 17:49:42 +0800 Subject: [PATCH 01/12] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/company/CompanyExtend.js | 17 +++++++++++------ .../components/department/departmentExtend.js | 14 ++++++++++---- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index 9ae029f..ab0ccab 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-18 14:52:39 - * @LastEditTime: 2023-07-26 18:59:02 + * @LastEditTime: 2023-08-04 16:52:47 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/CompanyExtend.js */ @@ -28,11 +28,16 @@ import AttachToNumberField from "../NewNumberField"; export default class CompanyExtend extends React.Component { componentDidMount() { - this.init(); + this.handleHashChange(); + window.addEventListener('hashchange', this.handleHashChange); } - init = () => { + + componentWillUnmount() { + window.removeEventListener('hashchange', this.handleHashChange); + } + + handleHashChange = () => { const { companyExtend, company } = this.props; - //const {id} = company; let { hash } = window.location; hash = hash.split("?")[0]; let id = hash.match("[^/]+(?=/$|$)")[0]; @@ -129,7 +134,7 @@ export default class CompanyExtend extends React.Component { labelCol={{ span: `${field.labelcol}` }} wrapperCol={{ span: `${field.fieldcol}` }}> - {field.domkey[0] == 'subcompanycode' && } + {field.domkey[0] == 'subcompanycode' && isEditor &&} ), colSpan: 1 }); @@ -231,7 +236,7 @@ export default class CompanyExtend extends React.Component { } backCard = () => { - this.init(); + this.handleHashChange(); } view = () => { diff --git a/pc4mobx/organization/components/department/departmentExtend.js b/pc4mobx/organization/components/department/departmentExtend.js index c230801..3dc6f6f 100644 --- a/pc4mobx/organization/components/department/departmentExtend.js +++ b/pc4mobx/organization/components/department/departmentExtend.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-06-02 09:20:03 - * @LastEditTime: 2023-07-26 18:59:14 + * @LastEditTime: 2023-08-04 16:51:56 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js */ @@ -29,9 +29,15 @@ import '../../style/common.less'; export default class DepartmentExtendStore extends React.Component { componentDidMount() { - this.init(); + this.handleHashChange(); + window.addEventListener('hashchange', this.handleHashChange); } - init = () => { + + componentWillUnmount() { + window.removeEventListener('hashchange', this.handleHashChange); + } + + handleHashChange = () => { const { departmentExtend, department } = this.props; let { hash } = window.location; hash = hash.split("?")[0]; @@ -242,7 +248,7 @@ export default class DepartmentExtendStore extends React.Component { } backCard = () => { - this.init(); + this.handleHashChange(); } changeData(key) { 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 02/12] =?UTF-8?q?=E8=8A=B1=E5=90=8D=E5=86=8C=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=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 From 72e58d764cb7b282c957c4ca6cb0c1d8eac90c43 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 9 Aug 2023 14:54:37 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/quickSearch.js | 19 ++ .../components/fieldDefinedSet/QuickSearch.js | 249 ++++++++++++++++++ .../fieldDefinedSet/QuickSearchDetail.js | 0 .../fieldDefinedSet/QuickSearchTableEdit.js | 233 ++++++++++++++++ .../components/postionrank/RankScheme.js | 14 +- pc4mobx/organization/index.js | 5 +- pc4mobx/organization/stores/index.js | 6 +- pc4mobx/organization/stores/quickSearch.js | 175 ++++++++++++ 8 files changed, 690 insertions(+), 11 deletions(-) create mode 100644 pc4mobx/organization/apis/quickSearch.js create mode 100644 pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js create mode 100644 pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js create mode 100644 pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js create mode 100644 pc4mobx/organization/stores/quickSearch.js diff --git a/pc4mobx/organization/apis/quickSearch.js b/pc4mobx/organization/apis/quickSearch.js new file mode 100644 index 0000000..5f1f10f --- /dev/null +++ b/pc4mobx/organization/apis/quickSearch.js @@ -0,0 +1,19 @@ +import { + WeaTools +} from 'ecCom'; + +export const saveFieldDefinedInfo = (moduleName,params) => { + return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }) +} + +export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/cube/list/getQuickSearchInfo`, 'GET', params); + +export const getQuickSearchDetailInfo = (params) => WeaTools.callApi(`/api/cube/list/getQuickSearchDetailInfo`, 'GET', params); + diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js new file mode 100644 index 0000000..c920315 --- /dev/null +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js @@ -0,0 +1,249 @@ +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: , + content: item.menuName, + } + menus.push(obj); + }) + return menus; + } + + getTopMenuBtns() { + const { + quickSearch + } = this.props,{ + topMenu + } = quickSearch + + let btns = []; + topMenu.map((item, i) => { + btns.push(); + }); + 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( +
+ + {} + +
+ ) + }) + + return {arr} + } + + getSearchButton = () => { + return [ + (), + + ] + } + + addRow = () => { + // const { CubeListStore } = this.props; + // let { quickSearchData } = CubeListStore; + // let datas = quickSearchData.datas; + // if(datas.length>=6){ + // message.error(getLabel('387795',"最多只能添加6项")); + // 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); + // CubeListStore.setQuickSearchData(datas); + } + + delRow = () => { + // const { CubeListStore } = this.props; + // let { qcSelectedRowKeys } = CubeListStore; + // if (qcSelectedRowKeys.length <= 0) { + // message.error(getLabel(22346, '请选择要删除的信息', 'label')); + // return; + // } + // const that = this; + // Modal.confirm({ + // title: getLabel(83601, '您确认要删除选中的记录吗?'), + // onOk() { + // let { datas } = CubeListStore.quickSearchData; + // datas = toJS(datas); + // datas = that.delFromArray(datas, qcSelectedRowKeys); + // CubeListStore.qcSelectedRowKeys = []; + // CubeListStore.setQuickSearchData(datas); + // }, + // onCancel() {}, + // }); + } + + 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 ( +
+ {this[key] && this[key]()}} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(key) => {this[key] && this[key]()}} + > + + + + {this.getFormItems()} + + + + + + + + + + +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js new file mode 100644 index 0000000..e69de29 diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js new file mode 100644 index 0000000..c496438 --- /dev/null +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js @@ -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: 2, + options: [{ key: '0', showname: getLabel(149, '默认') }, { key: '1', 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(); + } 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( this.onEdit(record, index, key, value)} + {...otherParams} + length={100} + />) + } else if (_type === 'BUTTON') { + _com.push( this.onClick(record)} + style={{ width, display: 'inline-block' }}>{record[key]}); + } else if (_type === 'INPUTNUMBER') { + _com.push( this.onEdit(record, index, key, value)} + {...otherParams} + />) + } else if (_type === 'SELECT') { + if (isLink) { + _com.push( { + 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( { + this.onEdit(record, index, key, value) + }} + filterOption={(inputValue, option) => selectFilterOption(inputValue, option)} + />); + } + } + + + } + } + }); + return ( +
{_com}
+ ) + }; + + 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 ( +
+ +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index 0ff4370..2c13a40 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -51,7 +51,7 @@ export default class RankScheme extends React.Component { } componentDidMount() { - this.init(); + this.init(); } componentWillUnmount() { @@ -201,8 +201,8 @@ export default class RankScheme extends React.Component { const btn = [ (), + rankScheme.getTableInfo(); rankScheme.setPanelStatus(false) + }}>{i18n.button.search()}), (), (), ]; @@ -260,7 +260,7 @@ export default class RankScheme extends React.Component { return false; }, }); - + } onOperatesClick(record, rowIndex, operate) { @@ -383,11 +383,11 @@ export default class RankScheme extends React.Component { } = rankScheme; if (hasRight === false) { - return renderNoright(); + return renderNoright(); } return ( - hasRight &&
+ hasRight &&
this.handleMenuClick(key)} @@ -438,6 +438,6 @@ export default class RankScheme extends React.Component { onCancel={() => rankScheme.setVisible(false)} />
- ) + ) } } \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index e73f6ed..7b49088 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -32,7 +32,8 @@ import ResourceBasicInfo from "./components/resource/ResourceBasicInfo"; import ResourceCard from "./components/resource/ResourceCard"; import ManagerDetach from "./components/detach/ManagerDetach"; import ColumnSetting from "./components/columnSetting"; -import PersonnelResume from "./components/resource/PersonnelResume" +import PersonnelResume from "./components/resource/PersonnelResume"; +import QuickSearch from "./components/fieldDefinedSet/QuickSearch"; import stores from "./stores"; import "./style/index"; @@ -98,7 +99,7 @@ const Routes = ( - + ); diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index e0d8271..da356c6 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -26,7 +26,8 @@ import {ImportDialogStore} from "./importDialog"; import {ResourceCardStore} from "./resourceCard"; import {ManagerDetachStore} from "./managerDetach"; import {ColumnSetting} from './columnSetting'; -import {PersonnelResumeStore} from './personnelResume' +import {PersonnelResumeStore} from './personnelResume'; +import { QuickSearchStore } from "./quickSearch"; module.exports = { @@ -58,5 +59,6 @@ module.exports = { resourceCard:new ResourceCardStore(), managerDetach: new ManagerDetachStore(), columnSetting: new ColumnSetting(), - personnelResume:new PersonnelResumeStore() + personnelResume:new PersonnelResumeStore(), + quickSearch:new QuickSearchStore() }; diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js new file mode 100644 index 0000000..8fccec9 --- /dev/null +++ b/pc4mobx/organization/stores/quickSearch.js @@ -0,0 +1,175 @@ +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; + + +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; + + /**** ==============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({ customid: 382 }).then(action(({ status, errorCode, error, setting, datas, options, groupidOptions }) => { + if (status == '1') { + this.quickSearchData.setting = setting; + this.quickSearchData.datas = datas.map(d => { + return { ...d, visible: false } + }); + this.quickSearchData.groupidOptions = groupidOptions; + this.quickSearchData.options = options; + this.quickSearchForm.updateFields({ + isquicksearch: setting.isquicksearch, + }); + } else { + message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + } + })); + } + + + + @action("保存页面") saveQuickSearchInfo = (params) => { + // 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; + // } + // if (params) { + // formparm = params; + // } + // API.saveQuickSearchInfo({ + // id: id, + // customid: this.customid, + // data: JSON.stringify(datas), ...formparm + // }).then(({ status, errorCode, error, setting, datas, options }: any) => { + // if (status == '1') { + // message.success(getLabel(83551, '保存成功!')); + // this.qcSelectedRowKeys = []; + // this.getQuickSearchInfo(); + // } else { + // message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + // } + // }); + // this.quickSearchData.setting.id = null; + } + + + + @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(({ status, errorCode, error, setting, datas, precision }) => { + if (status == '1') { + this.quickSearchDetailData = datas; + this.precision = precision; + } else { + message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + } + }); + } + + + + /**===========================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" + } + ] + +} \ No newline at end of file From 56cb6a800aa0227f8eb479af0e43263a2afc2300 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 9 Aug 2023 16:37:35 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/quickSearch.js | 4 +- .../fieldDefinedSet/QuickSearchDetail.js | 261 ++++++++++++++++++ pc4mobx/organization/stores/quickSearch.js | 21 ++ 3 files changed, 284 insertions(+), 2 deletions(-) diff --git a/pc4mobx/organization/apis/quickSearch.js b/pc4mobx/organization/apis/quickSearch.js index 5f1f10f..1fb0eb1 100644 --- a/pc4mobx/organization/apis/quickSearch.js +++ b/pc4mobx/organization/apis/quickSearch.js @@ -13,7 +13,7 @@ export const saveFieldDefinedInfo = (moduleName,params) => { }) } -export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/cube/list/getQuickSearchInfo`, 'GET', params); +export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchInfo`, 'GET', params); -export const getQuickSearchDetailInfo = (params) => WeaTools.callApi(`/api/cube/list/getQuickSearchDetailInfo`, 'GET', params); +export const getQuickSearchDetailInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchDetailInfo`, 'GET', params); diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js index e69de29..b480154 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js @@ -0,0 +1,261 @@ +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; + } + + getSearchButton = () => { + const { quickSearch } = this.props; + const buttons = new Array(); + buttons.push(); + buttons.push(); + + return buttons; + } + + addRow = () => { + // const { CubeListStore } = this.props; + // let { quickSearchDetailData } = CubeListStore; + // let datas = quickSearchDetailData; + // let time = new Date().getTime(); + // let obj = { + // key: "new_" + time, + // customname: '', + // orderid: 0, + // minnum: '', + // maxnum: '', + // type: CubeListStore.qcData.qcType, + // fieldid: CubeListStore.qcData.fieldid, + // customid: CubeListStore.customid + // } + // datas = toJS(datas); + // datas.push(obj); + // CubeListStore.setQuickSearchDetailData(datas); + } + + delRow = () => { + // const { CubeListStore } = this.props; + // let { qcDetailRowKeys } = CubeListStore; + // if (qcDetailRowKeys.length <= 0) { + // message.error(getLabel(22346, '请选择要删除的信息', 'label')); + // return; + // } + // const that = this; + // Modal.confirm({ + // title: getLabel(83601, '您确认要删除选中的记录吗?'), + // onOk() { + // let datas = CubeListStore.quickSearchDetailData; + // datas = toJS(datas); + // datas = that.delFromArray(datas, qcDetailRowKeys); + // CubeListStore.qcDetailRowKeys = []; + // CubeListStore.setQuickSearchDetailData(datas); + // }, + // onCancel() { }, + // }); + } + + 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 = [ + , + + ] + return ( + + + + + + + + + + ) + } + + +} + +@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:
+ {getLabel(387588, "内容自定义条件")}  + +
, 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(); + } else { + const { key, viewAttr = 2, type = 'INPUT', width, otherParams = {} } = c; + const _type = type.toUpperCase(); + _com.push( + + { + _type === 'INPUT' && + quickSearchRefObj[`error_${key}_${index}`] = ref} + > + this.onEdit(record, index, key, value)} + {...otherParams} + /> + + } + { + _type === 'SCOP' && + quickSearchRefObj[`error_${key}_${index}`] = ref} + > +
+ this.onEdit(record, index, key, value)} + /> +
+
+ } + { + _type === 'INPUTNUMBER' && + this.onEdit(record, index, key, value1)} + {...otherParams} + /> + } +
+ ) + } + }); + return ( +
+ {_com} +
+ ) + } + + 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 ( +
+ + + ) + } +} diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js index 8fccec9..b8d4725 100644 --- a/pc4mobx/organization/stores/quickSearch.js +++ b/pc4mobx/organization/stores/quickSearch.js @@ -33,6 +33,8 @@ export class QuickSearchStore { @observable qcData = { qcType: '', cid: '', fieldid: '' };//快速查询明细type @observable quickSearchDetailData = []; @observable precision = 0; + @observable qcDetailRowKeys = []; + quickSearchRefObj = {}; /**** ==============quickSearchForm ===============*/ @observable quickSearchFields = [ @@ -139,6 +141,25 @@ export class QuickSearchStore { } }); } + @action("明细保存") saveQuickSearchDetailInfo = () => { + // let datas = this.quickSearchDetailData; + // if (!this.checkQuickSearchDetailData()) { + // return; + // } + // API.saveQuickSearchDetailInfo({ + // cid: this.qcData.cid, + // data: JSON.stringify(datas) + // }).then(({ status, errorCode, error, setting, datas, options }: any) => { + // if (status == '1') { + // message.success(getLabel(83551, '保存成功!')); + // this.qcDetailRowKeys = []; + // this.getQuickSearchDetailInfo(this.qcData.cid); + // } else { + // message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + // } + // }); + } + From 35b783ca722006452a911447eea412a56b9cd18d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 9 Aug 2023 17:14:53 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/quickSearch.js | 11 +-- .../components/fieldDefinedSet/QuickSearch.js | 99 +++++++++++-------- .../fieldDefinedSet/QuickSearchDetail.js | 2 +- pc4mobx/organization/stores/quickSearch.js | 87 +++++++++------- 4 files changed, 108 insertions(+), 91 deletions(-) diff --git a/pc4mobx/organization/apis/quickSearch.js b/pc4mobx/organization/apis/quickSearch.js index 1fb0eb1..10a9ae2 100644 --- a/pc4mobx/organization/apis/quickSearch.js +++ b/pc4mobx/organization/apis/quickSearch.js @@ -2,15 +2,8 @@ import { WeaTools } from 'ecCom'; -export const saveFieldDefinedInfo = (moduleName,params) => { - return fetch(`/api/bs/hrmorganization/fieldDefined/${moduleName}/saveFields`, { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }) +export const saveQuickSearchInfo = (params) => { + return WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/saveQuickSearchInfo`, 'POST', params); } export const getQuickSearchInfo = (params) => WeaTools.callApi(`/api/bs/hrmorganization/quicksearch/getQuickSearchInfo`, 'GET', params); diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js index c920315..8ce48b3 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js @@ -130,52 +130,65 @@ export default class QuickSearch extends React.Component { } addRow = () => { - // const { CubeListStore } = this.props; - // let { quickSearchData } = CubeListStore; - // let datas = quickSearchData.datas; - // if(datas.length>=6){ - // message.error(getLabel('387795',"最多只能添加6项")); - // 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); - // CubeListStore.setQuickSearchData(datas); + const { quickSearch } = this.props; + let { quickSearchData } = quickSearch; + let datas = quickSearchData.datas; + if(datas.length>=6){ + message.error(getLabel('387795',"最多只能添加6项")); + 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 { CubeListStore } = this.props; - // let { qcSelectedRowKeys } = CubeListStore; - // if (qcSelectedRowKeys.length <= 0) { - // message.error(getLabel(22346, '请选择要删除的信息', 'label')); - // return; - // } - // const that = this; - // Modal.confirm({ - // title: getLabel(83601, '您确认要删除选中的记录吗?'), - // onOk() { - // let { datas } = CubeListStore.quickSearchData; - // datas = toJS(datas); - // datas = that.delFromArray(datas, qcSelectedRowKeys); - // CubeListStore.qcSelectedRowKeys = []; - // CubeListStore.setQuickSearchData(datas); - // }, - // onCancel() {}, - // }); + 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) => { diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js index b480154..23dc8d1 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js @@ -48,7 +48,7 @@ export default class QuickSearchDetail extends React.Component { } addRow = () => { - // const { CubeListStore } = this.props; + // const { quickSearch } = this.props; // let { quickSearchDetailData } = CubeListStore; // let datas = quickSearchDetailData; // let time = new Date().getTime(); diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js index b8d4725..9e7b12d 100644 --- a/pc4mobx/organization/stores/quickSearch.js +++ b/pc4mobx/organization/stores/quickSearch.js @@ -62,65 +62,76 @@ export class QuickSearchStore { @action("数据获取") getQuickSearchInfo = () => { this.clearQuciSearchData(); - API.getQuickSearchInfo({ customid: 382 }).then(action(({ status, errorCode, error, setting, datas, options, groupidOptions }) => { - if (status == '1') { - this.quickSearchData.setting = setting; + API.getQuickSearchInfo({ customid: 382 }).then(action(({ code, data, msg }) => { + if (code == 200) { + this.quickSearchData.setting = data.setting; this.quickSearchData.datas = datas.map(d => { return { ...d, visible: false } }); - this.quickSearchData.groupidOptions = groupidOptions; - this.quickSearchData.options = options; + this.quickSearchData.groupidOptions = data.groupidOptions; + this.quickSearchData.options = data.options; this.quickSearchForm.updateFields({ - isquicksearch: setting.isquicksearch, + isquicksearch: data.setting.isquicksearch, }); } else { - message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + message.error(`[${getLabel(127353, "错误") + code}]:${msg}`); } })); } - @action("保存页面") saveQuickSearchInfo = (params) => { - // let datas = this.quickSearchData.datas; - // datas.map((data, index) => { - // data.orderid = index - // }); + @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; - // } - // if (params) { - // formparm = params; - // } - // API.saveQuickSearchInfo({ - // id: id, - // customid: this.customid, - // data: JSON.stringify(datas), ...formparm - // }).then(({ status, errorCode, error, setting, datas, options }: any) => { - // if (status == '1') { - // message.success(getLabel(83551, '保存成功!')); - // this.qcSelectedRowKeys = []; - // this.getQuickSearchInfo(); - // } else { - // message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); - // } - // }); - // this.quickSearchData.setting.id = null; + 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, + customid: this.customid, + data: JSON.stringify(datas), ...formparm + }).then(({ status, errorCode, error, setting, datas, options }) => { + if (status == '1') { + message.success(getLabel(83551, '保存成功!')); + this.qcSelectedRowKeys = []; + this.getQuickSearchInfo(); + } else { + message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + } + }); + 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; } + @action setQuickSearchData = (datas) => { + this.quickSearchData.datas = datas; + } /**============================quickdetail===================== */ @action("设置") openQuickSearchDetail = (record) => { From 7c6e62c28fdfb4f6cf96180fed87e5ce8499d3b4 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 10 Aug 2023 09:34:44 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/quickSearch.js | 4 + .../fieldDefinedSet/QuickSearchDetail.js | 83 +++++++++++-------- pc4mobx/organization/stores/quickSearch.js | 15 ++-- 3 files changed, 60 insertions(+), 42 deletions(-) diff --git a/pc4mobx/organization/apis/quickSearch.js b/pc4mobx/organization/apis/quickSearch.js index 10a9ae2..7c5e5fb 100644 --- a/pc4mobx/organization/apis/quickSearch.js +++ b/pc4mobx/organization/apis/quickSearch.js @@ -6,6 +6,10 @@ 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); diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js index 23dc8d1..94e43ef 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js @@ -48,44 +48,57 @@ export default class QuickSearchDetail extends React.Component { } addRow = () => { - // const { quickSearch } = this.props; - // let { quickSearchDetailData } = CubeListStore; - // let datas = quickSearchDetailData; - // let time = new Date().getTime(); - // let obj = { - // key: "new_" + time, - // customname: '', - // orderid: 0, - // minnum: '', - // maxnum: '', - // type: CubeListStore.qcData.qcType, - // fieldid: CubeListStore.qcData.fieldid, - // customid: CubeListStore.customid - // } - // datas = toJS(datas); - // datas.push(obj); - // CubeListStore.setQuickSearchDetailData(datas); + 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 { CubeListStore } = this.props; - // let { qcDetailRowKeys } = CubeListStore; - // if (qcDetailRowKeys.length <= 0) { - // message.error(getLabel(22346, '请选择要删除的信息', 'label')); - // return; - // } - // const that = this; - // Modal.confirm({ - // title: getLabel(83601, '您确认要删除选中的记录吗?'), - // onOk() { - // let datas = CubeListStore.quickSearchDetailData; - // datas = toJS(datas); - // datas = that.delFromArray(datas, qcDetailRowKeys); - // CubeListStore.qcDetailRowKeys = []; - // CubeListStore.setQuickSearchDetailData(datas); - // }, - // onCancel() { }, - // }); + 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() { diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js index 9e7b12d..23979b6 100644 --- a/pc4mobx/organization/stores/quickSearch.js +++ b/pc4mobx/organization/stores/quickSearch.js @@ -62,10 +62,10 @@ export class QuickSearchStore { @action("数据获取") getQuickSearchInfo = () => { this.clearQuciSearchData(); - API.getQuickSearchInfo({ customid: 382 }).then(action(({ code, data, msg }) => { + API.getQuickSearchInfo().then(action(({ code, data, msg }) => { if (code == 200) { this.quickSearchData.setting = data.setting; - this.quickSearchData.datas = datas.map(d => { + this.quickSearchData.datas = data.datas.map(d => { return { ...d, visible: false } }); this.quickSearchData.groupidOptions = data.groupidOptions; @@ -98,15 +98,14 @@ export class QuickSearchStore { } API.saveQuickSearchInfo({ id: id, - customid: this.customid, data: JSON.stringify(datas), ...formparm - }).then(({ status, errorCode, error, setting, datas, options }) => { - if (status == '1') { + }).then(({ code, data, msg }) => { + if (data == 200) { message.success(getLabel(83551, '保存成功!')); this.qcSelectedRowKeys = []; this.getQuickSearchInfo(); } else { - message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + message.error(`[${getLabel(127353, "错误") + code}]:${msg}`); } }); this.quickSearchData.setting.id = null; @@ -171,7 +170,9 @@ export class QuickSearchStore { // }); } - + @action setQuickSearchDetailData = (datas) => { + this.quickSearchDetailData = datas; + } /**===========================buttons=========================== */ From de6a309f42be96982a8b622b1057ddd263194804 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 11 Aug 2023 09:39:58 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/stores/quickSearch.js | 82 +++++++++++++++------- 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js index 23979b6..08c456a 100644 --- a/pc4mobx/organization/stores/quickSearch.js +++ b/pc4mobx/organization/stores/quickSearch.js @@ -18,10 +18,11 @@ 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 = { @@ -36,8 +37,8 @@ export class QuickSearchStore { @observable qcDetailRowKeys = []; quickSearchRefObj = {}; - /**** ==============quickSearchForm ===============*/ - @observable quickSearchFields = [ + /**** ==============quickSearchForm ===============*/ + @observable quickSearchFields = [ { domkey: ['isquicksearch'], conditionType: 'SWITCH', @@ -100,7 +101,7 @@ export class QuickSearchStore { id: id, data: JSON.stringify(datas), ...formparm }).then(({ code, data, msg }) => { - if (data == 200) { + if (code == 200) { message.success(getLabel(83551, '保存成功!')); this.qcSelectedRowKeys = []; this.getQuickSearchInfo(); @@ -128,7 +129,7 @@ export class QuickSearchStore { this.quickSearchData.datas = datas; } - @action setQuickSearchData = (datas) => { + @action setQuickSearchData = (datas) => { this.quickSearchData.datas = datas; } @@ -142,38 +143,65 @@ export class QuickSearchStore { } @action getQuickSearchDetailInfo = (cid) => { - API.getQuickSearchDetailInfo({ cid: cid }).then(({ status, errorCode, error, setting, datas, precision }) => { - if (status == '1') { - this.quickSearchDetailData = datas; - this.precision = precision; + API.getQuickSearchDetailInfo({ cid: cid }).then(({ code, data, msg }) => { + if (code == 200) { + this.quickSearchDetailData = data.datas; + this.precision = data.precision; } else { - message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); + 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(({ status, errorCode, error, setting, datas, options }: any) => { - // if (status == '1') { - // message.success(getLabel(83551, '保存成功!')); - // this.qcDetailRowKeys = []; - // this.getQuickSearchDetailInfo(this.qcData.cid); - // } else { - // message.error(`[${getLabel(127353, "错误") + errorCode}]:${error}`); - // } - // }); + 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 = [ @@ -204,5 +232,5 @@ export class QuickSearchStore { "type": "BTN_save" } ] - + } \ No newline at end of file From 67947182fd615adb443826b59cce690bbe3fb419 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Fri, 11 Aug 2023 10:15:56 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/fieldDefinedSet/QuickSearch.js | 4 ++-- .../components/fieldDefinedSet/QuickSearchDetail.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js index 8ce48b3..3f01cf5 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearch.js @@ -133,8 +133,8 @@ export default class QuickSearch extends React.Component { const { quickSearch } = this.props; let { quickSearchData } = quickSearch; let datas = quickSearchData.datas; - if(datas.length>=6){ - message.error(getLabel('387795',"最多只能添加6项")); + if(datas.length>=8){ + message.error(getLabel('387795',"最多只能添加8项")); return; } let time = new Date().getTime(); diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js index 94e43ef..e1d7a1f 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js @@ -34,6 +34,11 @@ export default class QuickSearchDetail extends React.Component { quickSearch.quickSearchDetailVisable = false; } + onChange = (data) => { + const { quickSearch } = this.props; + quickSearch.setQuickSearchDetailData(data); + } + getSearchButton = () => { const { quickSearch } = this.props; const buttons = new Array(); @@ -258,6 +263,7 @@ class QuickSearchTableEdit extends React.Component{ } typeof this.props.onChange === 'function' && this.props.onChange(_datas); } + render() { const { datas, rowSelection } = this.props; return ( From 1a87a3f1180d8118f8630589df86d0175b0e69c2 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Wed, 16 Aug 2023 13:58:08 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/resource.js | 5 + .../components/fieldDefinedSet/FieldDef.js | 6 +- .../fieldDefinedSet/QuickSearchTableEdit.js | 4 +- pc4mobx/organization/components/job/Job.js | 2 +- .../components/resource/resource.js | 7 +- pc4mobx/organization/index.js | 6 + pc4mobx/organization/stores/resource.js | 127 +++++++----------- 7 files changed, 67 insertions(+), 90 deletions(-) diff --git a/pc4mobx/organization/apis/resource.js b/pc4mobx/organization/apis/resource.js index f4c16ee..d8a8aeb 100644 --- a/pc4mobx/organization/apis/resource.js +++ b/pc4mobx/organization/apis/resource.js @@ -31,6 +31,11 @@ export const getHasRight = (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) => { return WeaTools.callApi('/api/bs/hrmorganization/hrmresource/updateForm', 'POST', params); } diff --git a/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js b/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js index ffb3bd2..38f3576 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js +++ b/pc4mobx/organization/components/fieldDefinedSet/FieldDef.js @@ -105,9 +105,9 @@ export default class FieldDef extends Component { } const rMenu = [...rightMenu, ...store.getBasicMenus(this.props.logSmallType, this.props.targetId)] return ( -
{ - this.tabDom = dom -}}> +
{ + this.tabDom = dom + }}> setEditTable(editTable, 'fieldDef')} diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js index c496438..914d31b 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchTableEdit.js @@ -46,8 +46,8 @@ export default class QuickSearchTableEdit extends React.Component { label: '', type: 'SELECT', key: 'showmodel', - viewAttr: 2, - options: [{ key: '0', showname: getLabel(149, '默认') }, { key: '1', showname: getLabel(19852, '平铺') },] + viewAttr: 1, + options: [ { key: '0', showname: getLabel(19852, '平铺') },] }] } ]; diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js index e15d141..f6cd5cd 100644 --- a/pc4mobx/organization/components/job/Job.js +++ b/pc4mobx/organization/components/job/Job.js @@ -1,7 +1,7 @@ /** * @Author: 程亮 * @Date: 2022-05-26 14:05:59 - * @LastEditTime: 2023-08-02 17:09:24 + * @LastEditTime: 2023-08-14 11:39:45 * @Description: * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js */ diff --git a/pc4mobx/organization/components/resource/resource.js b/pc4mobx/organization/components/resource/resource.js index e73148e..56a3ed3 100644 --- a/pc4mobx/organization/components/resource/resource.js +++ b/pc4mobx/organization/components/resource/resource.js @@ -82,6 +82,7 @@ export default class Resource extends React.Component { resource } = this.props; resource.getHasRight(); + resource.getQuickSearchCondition(); let { hash } = window.location; hash = hash.split("?")[1].split("&"); if (hash.length >= 2) { @@ -507,7 +508,7 @@ export default class Resource extends React.Component { } = this.props; const { isPanelShow, form2, lastName, conditionNum, tableStore, nEdialogTitle, visible, condition, - form, dialogLoading, isEdit, date, hasRight, defaultShowLeft + form, dialogLoading, isEdit, date, hasRight, defaultShowLeft,enable } = store; if (hasRight === false) { @@ -542,10 +543,10 @@ export default class Resource extends React.Component { advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20} hasMask={false} buttonsAd={this.getTabBtn()} - onSearch={() => store.getTableInfo()} + onSearch={() => {store.hideRadioGroup();store.getTableInfo();}} onSearchChange={val => this.onSearchChange(val)} /> - + {enable && } 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 rangeConditions = []; + @observable radioParams = {}; + @observable refreshRadioGroup = new Date().getTime(); @computed get radioGroupConfig(){ this.refreshRadioGroup; @@ -167,24 +101,39 @@ export class ResourceStore { } @action onRadioGroupChangeHandle = params => { - console.log(params); + this.radioParams = params; + this.getTableInfo(); } @action("列表") getTableInfo() { - let params; this.tableStore = new TableStore(); - if (this.isEmptyObject(this.form2.getFormParams())) { + let params = {}; + debugger; + if(this.isEmptyObject(this.radioParams)) { params = { ...this.selectTreeNodeInfo, - lastName: this.lastName - }; - } else { + isQuickSearch:false + } + if (this.isEmptyObject(this.form2.getFormParams())) { + params = { + ...params, + lastName: this.lastName, + }; + } else { + params = { + ...params, + ...this.form2.getFormParams() + }; + } + }else { params = { + ...this.radioParams, ...this.selectTreeNodeInfo, - ...this.form2.getFormParams() - }; + isQuickSearch:true + } } + this.form2.resetForm(); Api.getSearchList(params).then(res => { if (res.code === 200) { res.data.datas && this.tableStore.getDatas(res.data.datas, 1); @@ -198,6 +147,7 @@ export class ResourceStore { @action("nodetree事件") doSearch(params) { this.selectTreeNodeInfo = params; + this.showRadioGroup = true; this.getTableInfo(); } @@ -211,7 +161,7 @@ export class ResourceStore { return response.json() }).then(data => { if (data.code === 200) { - message.success(data.msg); + message.success(data.msg,1); this.getTableInfo(); this.setVisible(false); } else { @@ -270,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() { Api.getHasRight().then(res => { @@ -793,8 +755,6 @@ export class ResourceStore { }); } - - updateFields(val) { this.form2.updateFields({ lastname: { @@ -803,6 +763,11 @@ export class ResourceStore { }); } + hideRadioGroup() { + this.radioParams = {}; + this.showRadioGroup = false; + } + setSearchCondition(condition) { this.searchCondition = condition; } From 26f19c32834aedebfa1fb12b02c4e704537da0dc Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 17 Aug 2023 10:56:56 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/fieldDefinedSet/QuickSearchDetail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js index e1d7a1f..b98697e 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QuickSearchDetail.js @@ -165,7 +165,7 @@ class QuickSearchTableEdit extends React.Component{ {getLabel(387588, "内容自定义条件")} 
, dataIndex: "condition", key: "condition", width: "40%", com: [{ label: '', type: 'SCOP', key: 'condition', viewAttr: 3 }] From a7a0de166e0abc4a9c96c21a035724f036085d9f Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 21 Aug 2023 18:09:48 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BC=81=E9=80=9A=E5=AD=A6=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/qtxConfig.js | 6 + .../components/fieldDefinedSet/QtxConfig.js | 176 ++++++++++++++++++ pc4mobx/organization/index.js | 2 + pc4mobx/organization/stores/index.js | 4 +- pc4mobx/organization/stores/qtxConfig.js | 155 +++++++++++++++ pc4mobx/organization/stores/quickSearch.js | 4 - 6 files changed, 342 insertions(+), 5 deletions(-) create mode 100644 pc4mobx/organization/apis/qtxConfig.js create mode 100644 pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js create mode 100644 pc4mobx/organization/stores/qtxConfig.js diff --git a/pc4mobx/organization/apis/qtxConfig.js b/pc4mobx/organization/apis/qtxConfig.js new file mode 100644 index 0000000..08e84ad --- /dev/null +++ b/pc4mobx/organization/apis/qtxConfig.js @@ -0,0 +1,6 @@ +import { WeaTools } from 'ecCom'; + + +export const getQtxConfigInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getCardButtonTable', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js b/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js new file mode 100644 index 0000000..115515c --- /dev/null +++ b/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js @@ -0,0 +1,176 @@ +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: , + content: item.menuName, + } + menus.push(obj); + }) + return menus; + } + + getTopMenuBtns() { + const { + qtxConfig + } = this.props, { + topMenu + } = qtxConfig + + let btns = []; + topMenu.map((item, i) => { + btns.push(); + }); + return btns; + } + + save = () => { + const { + qtxConfig + } = this.props; + //qtxConfig.saveQuickSearchInfo(); + } + + 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(
+
+ + {} + {} + +
+ ) + }) + + return {arr} + } + + + + render() { + const { qtxConfig: store } = this.props; + const { editTableData } = store, { + datas, columns, selectedData, loading + } = editTableData; + + return ( +
+ { this[key] && this[key]() }} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(key) => { this[key] && this[key]() }} + > + + + {this.getFormItems()} + + + store.setTableEditDatas(e)} + /> + + + + +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index af92242..444140a 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -34,6 +34,7 @@ import ManagerDetach from "./components/detach/ManagerDetach"; import ColumnSetting from "./components/columnSetting"; import PersonnelResume from "./components/resource/PersonnelResume"; import QuickSearch from "./components/fieldDefinedSet/QuickSearch"; +import QtxConfig from "./components/fieldDefinedSet/QtxConfig"; import stores from "./stores"; import "./style/index"; @@ -106,6 +107,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index da356c6..c0f3814 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -28,6 +28,7 @@ import {ManagerDetachStore} from "./managerDetach"; import {ColumnSetting} from './columnSetting'; import {PersonnelResumeStore} from './personnelResume'; import { QuickSearchStore } from "./quickSearch"; +import { QtxConfigStore } from "./qtxConfig"; module.exports = { @@ -60,5 +61,6 @@ module.exports = { managerDetach: new ManagerDetachStore(), columnSetting: new ColumnSetting(), personnelResume:new PersonnelResumeStore(), - quickSearch:new QuickSearchStore() + quickSearch:new QuickSearchStore(), + qtxConfig: new QtxConfigStore() }; diff --git a/pc4mobx/organization/stores/qtxConfig.js b/pc4mobx/organization/stores/qtxConfig.js new file mode 100644 index 0000000..b773c9b --- /dev/null +++ b/pc4mobx/organization/stores/qtxConfig.js @@ -0,0 +1,155 @@ +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({ + // isquicksearch: data.setting.isquicksearch, + // }); + } else { + message.error(`[${getLabel(127353, "错误") + code}]:${msg}`); + } + })); + } + + setTableEditDatas = (e) => { + debugger; + if(e.length > 1) { + e.pop(); + message.error("默认只能添加一条配置数据!!!") + } + extendObservable(this.editTableData, { + datas: e + }); + } + + @action("保存页面") saveQtxConfigInfo = () => { + // let datas = this.quickSearchData.datas; + // datas.map((data, index) => { + // data.orderid = index + // }); + + // let formparm = this.configForm.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; + } + + /**===========================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" + } + ] + +} \ No newline at end of file diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js index 08c456a..328b76e 100644 --- a/pc4mobx/organization/stores/quickSearch.js +++ b/pc4mobx/organization/stores/quickSearch.js @@ -129,10 +129,6 @@ export class QuickSearchStore { this.quickSearchData.datas = datas; } - @action setQuickSearchData = (datas) => { - this.quickSearchData.datas = datas; - } - /**============================quickdetail===================== */ @action("设置") openQuickSearchDetail = (record) => { this.quickSearchDetailVisable = true; From 403d040956f7e59c0fcf924109bc1fd935ea4d07 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 22 Aug 2023 18:07:47 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E4=BC=81=E9=80=9A=E5=AD=A6=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/qtxConfig.js | 7 +- .../components/fieldDefinedSet/QtxConfig.js | 4 +- pc4mobx/organization/stores/qtxConfig.js | 66 ++++++++++--------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/pc4mobx/organization/apis/qtxConfig.js b/pc4mobx/organization/apis/qtxConfig.js index 08e84ad..0424d9c 100644 --- a/pc4mobx/organization/apis/qtxConfig.js +++ b/pc4mobx/organization/apis/qtxConfig.js @@ -2,5 +2,8 @@ import { WeaTools } from 'ecCom'; export const getQtxConfigInfo = (params) => { - return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getCardButtonTable', 'GET', params); -} \ No newline at end of file + return WeaTools.callApi('/api/bs/hrmorganization/config/selectConfigInfo', 'GET', params); +} +export const saveQtxConfigInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/config/saveConfigInfo', 'POST', params); + } \ No newline at end of file diff --git a/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js b/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js index 115515c..42ffc21 100644 --- a/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js +++ b/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js @@ -90,7 +90,8 @@ export default class QtxConfig extends React.Component { const { qtxConfig } = this.props; - //qtxConfig.saveQuickSearchInfo(); + let result = this.tableEdit.refs.edit.doRequiredCheck(); + result.pass && qtxConfig.saveQtxConfigInfo(); } login = () => { @@ -157,6 +158,7 @@ export default class QtxConfig extends React.Component { {this.tableEdit = el}} draggable deleteConfirm showCopy={false} diff --git a/pc4mobx/organization/stores/qtxConfig.js b/pc4mobx/organization/stores/qtxConfig.js index b773c9b..fe0bd2e 100644 --- a/pc4mobx/organization/stores/qtxConfig.js +++ b/pc4mobx/organization/stores/qtxConfig.js @@ -64,9 +64,9 @@ export class QtxConfigStore { columns: columns, loading: false }); - // this.configForm.updateFields({ - // isquicksearch: data.setting.isquicksearch, - // }); + this.configForm.updateFields({ + isopenconfig: data.isopenconfig, + }); } else { message.error(`[${getLabel(127353, "错误") + code}]:${msg}`); } @@ -74,7 +74,6 @@ export class QtxConfigStore { } setTableEditDatas = (e) => { - debugger; if(e.length > 1) { e.pop(); message.error("默认只能添加一条配置数据!!!") @@ -85,35 +84,40 @@ export class QtxConfigStore { } @action("保存页面") saveQtxConfigInfo = () => { - // let datas = this.quickSearchData.datas; - // datas.map((data, index) => { - // data.orderid = index - // }); - - // let formparm = this.configForm.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; + 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 = [ {