From a058242d35f382a4fd8b64dc2cc1761c6d5a0188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 31 Aug 2023 14:23:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feature/2.9.42308.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=8C=E6=AD=A5=E5=88=B0=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/item.js | 256 +++++++++--------- pc4mobx/hrmSalary/pages/salaryItem/columns.js | 21 ++ pc4mobx/hrmSalary/pages/salaryItem/index.js | 27 +- pc4mobx/hrmSalary/pages/salaryItem/index.less | 8 + .../syncToSalaryAccountSetDialog.js | 85 ++++++ pc4mobx/hrmSalary/stores/salaryItem.js | 2 + 6 files changed, 276 insertions(+), 123 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js diff --git a/pc4mobx/hrmSalary/apis/item.js b/pc4mobx/hrmSalary/apis/item.js index 3c3bb052..2d23377a 100644 --- a/pc4mobx/hrmSalary/apis/item.js +++ b/pc4mobx/hrmSalary/apis/item.js @@ -1,4 +1,4 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; /** * 薪资项目api @@ -7,171 +7,171 @@ import { WeaTools } from 'ecCom'; // 薪资项目-获取列表 export const getItemList = params => { - return fetch('/api/bs/hrmsalary/salaryitem/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) + return fetch("/api/bs/hrmsalary/salaryitem/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); }; //薪资项目的高级搜索 export const getSaCondition = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSearchCondition', 'GET', params); + return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSearchCondition", "GET", params); }; //数据源列表字典项 export const formulaDatasourceList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/formula/datasource/list', 'GET', params); + return WeaTools.callApi("/api/bs/hrmsalary/formula/datasource/list", "GET", params); }; //薪资项目-系统薪资项目列表 export const getSysItemList = params => { - return fetch('/api/bs/hrmsalary/salaryitem/sysList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) + return fetch("/api/bs/hrmsalary/salaryitem/sysList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); }; //系统薪资项目的高级搜索 export const getSysSaCondition = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSysSearchCondition', 'GET', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSysSearchCondition", "GET", params); +}; //薪资项目-批量删除薪资项目 export const deleteItem = params => { - return fetch('/api/bs/hrmsalary/salaryitem/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryitem/delete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资项目-批量删除列表 export const deleteItemList = params => { - return fetch('/api/bs/hrmsalary/salaryitem/listCanDelete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryitem/listCanDelete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资项目-新增薪资项目 export const saveItem = params => { - delete params.formulaContent - return fetch('/api/bs/hrmsalary/salaryitem/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + delete params.formulaContent; + return fetch("/api/bs/hrmsalary/salaryitem/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //薪资项目-更新薪资项目 export const updateItem = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/update', 'POST', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/update", "POST", params); +}; //薪资项目-薪资项目详情 export const getItemForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/getSalaryForm', 'GET', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSalaryForm", "GET", params); +}; //薪资项目-添加系统薪资项目 export const saveSysItem = params => { - return fetch('/api/bs/hrmsalary/salaryitem/saveSys', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/salaryitem/saveSys", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //获取薪资项目可选的类型(与属性有联动) export const getItemTypeOption = params => { - return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption', 'GET', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption", "GET", params); +}; //获取公式描述 export const getFormulaDes = params => { - return WeaTools.callApi('/api/bs/hrmsalary/formula/des', 'GET', params); -} + return WeaTools.callApi("/api/bs/hrmsalary/formula/des", "GET", params); +}; // *** 公式 start *** // 获取公式变量类型 export const formualSearchGroup = params => { - return fetch('/api/bs/hrmsalary/formula/search/group', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/formula/search/group", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; //获取公式变量字段 export const formualSearchField = params => { - return fetch('/api/bs/hrmsalary/formula/search/field', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/formula/search/field", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // /api/bs/hrmsalary/formula/save // 保存公式 export const saveFormual = params => { - return fetch('/api/bs/hrmsalary/formula/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/formula/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 公式测试 export const testFormual = params => { - return fetch('/api/bs/hrmsalary/formula/mock', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/formula/mock", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 根据id获取formual export const detailFormual = params => { - return fetch('/api/bs/hrmsalary/formula/detail', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/formula/detail", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // *** 公式 end *** @@ -179,14 +179,28 @@ export const detailFormual = params => { // 列出可以删除的薪资项目 export const listCanDelete = params => { - return fetch('/api/bs/hrmsalary/salaryitem/listCanDelete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - + return fetch("/api/bs/hrmsalary/salaryitem/listCanDelete", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; +//获取哪些账套中使用了该薪资项目 +export const getSalarySobBySalaryItem = params => { + return WeaTools.callApi("/api/bs/hrmsalary/salaryitem/getSalarySobBySalaryItem", "GET", params); +}; +// 同步到薪资账套 +export const syncSalaryItemToSalarySobItem = params => { + return fetch("/api/bs/hrmsalary/salaryitem/syncSalaryItemToSalarySobItem ", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; diff --git a/pc4mobx/hrmSalary/pages/salaryItem/columns.js b/pc4mobx/hrmSalary/pages/salaryItem/columns.js index 04580369..47abe5b1 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/columns.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/columns.js @@ -155,6 +155,27 @@ export const valTakeOptions = [ { key: "2", showname: "公式" }, { key: "3", showname: "SQL" } ]; +export const salarySetConditions = [ + { + items: [{ + colSpan: 1, + checkbox: false, + checkboxValue: false, + conditionType: "SELECT", + domkey: ["salarySobIds"], + fieldcol: 18, + label: "薪资账套", + lanId: 538010, + labelcol: 6, + options: [], + rules: "required|string", + multiple: true, + viewAttr: 3 + }], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 556b0d7e..c2c63718 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -9,6 +9,7 @@ import { columns } from "./columns"; import SlideModalTitle from "../../components/slideModalTitle"; import CustomSalaryItemSlide from "./customSalaryItemSlide"; import CustomPaginationTable from "../../components/customPaginationTable"; +import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog"; import "../socialSecurityBenefits/programme/index.less"; const { getLabel } = WeaLocaleProvider; @@ -25,7 +26,8 @@ export default class SalaryItem extends React.Component { searchValue: "", formalModalVisible: false, searchParams: { current: 1, pageSize: 10, total: 0 }, - selectedRowKeys: [] + selectedRowKeys: [], + syncSalarySetDialog: { visible: false, title: "", id: "" } }; columns.map(item => { if (item.dataIndex == "refere") { @@ -69,7 +71,10 @@ export default class SalaryItem extends React.Component { onEditItem = (record, isedit) => { this.record = record; const { salaryItemStore: { getItemForm, setEditSlideVisible } } = this.props; - this.setState({ editable: isedit, isAdd: false }); + this.setState({ + editable: isedit, isAdd: false, + syncSalarySetDialog: { ...this.state.syncSalarySetDialog, id: record.id } + }); getItemForm(record.id).then(() => { setEditSlideVisible(true); }).catch(({ errormsg }) => { @@ -308,6 +313,15 @@ export default class SalaryItem extends React.Component { ]; } else if (this.state.editable) { arrList = [ + , @@ -365,6 +379,15 @@ export default class SalaryItem extends React.Component { + this.setState({ + syncSalarySetDialog: { + ...this.state.syncSalarySetDialog, + visible: false, id: "", title: "" + } + })} + /> { systemItemVisible && diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index 97c79576..f02dac13 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -102,3 +102,11 @@ } } } + +.salarySetDialog { + .salarySetDialogContent { + .wea-select, .ant-select-selection, .ant-select { + width: 100%; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js b/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js new file mode 100644 index 00000000..bcaa8852 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js @@ -0,0 +1,85 @@ +/* + * Author: 黎永顺 + * name: 同步到薪资账套 + * Description: + * Date: 2023/8/31 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaDialog, WeaLocaleProvider } from "ecCom"; +import { Button } from "antd"; +import { getSearchs } from "../../util"; +import { getSalarySobBySalaryItem } from "../../apis/item"; +import { salarySetConditions } from "./columns"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("salaryItemStore") +@observer +class SyncToSalaryAccountSetDialog extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + conditions: [] + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + const { salaryItemStore: { salarySetform } } = nextProps; + if (nextProps.visible !== this.props.visible && nextProps.visible) this.getSalarySobBySalaryItem(nextProps); + if (nextProps.visible !== this.props.visible && !nextProps.visible) salarySetform.resetForm(); + } + + getSalarySobBySalaryItem = (props) => { + const { id, salaryItemStore: { salarySetform } } = props; + getSalarySobBySalaryItem({ id }).then(({ status, data }) => { + if (status) { + this.setState({ + conditions: _.map(salarySetConditions, item => { + return { + ...item, + items: _.map(item.items, o => ({ + ...o, + options: _.map(data, it => ({ key: it.id, showname: it.content })) + })) + }; + }) + }, () => { + salarySetform.initFormFields(this.state.conditions); + }); + } + }); + }; + + save = () => { + const { salaryItemStore: { salarySetform } } = this.props; + salarySetform.validateForm().then(f => { + console.log(salarySetform.getFormParams()); + if (f.isValid) { + this.setState({ loading: true }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const { salaryItemStore: { salarySetform } } = this.props; + const { conditions } = this.state; + return ( + {getLabel(537558, "确定")}]} + > +
+ {getSearchs(salarySetform, conditions, 1)} +
+
+ ); + } +} + +export default SyncToSalaryAccountSetDialog; diff --git a/pc4mobx/hrmSalary/stores/salaryItem.js b/pc4mobx/hrmSalary/stores/salaryItem.js index 3e97782f..7e7925bc 100644 --- a/pc4mobx/hrmSalary/stores/salaryItem.js +++ b/pc4mobx/hrmSalary/stores/salaryItem.js @@ -8,6 +8,8 @@ import { notNull } from "../util/validate"; const { TableStore } = WeaTableNew; export class SalaryItemStore { + @observable salarySetform = new WeaForm(); //同步薪资账套form + @observable tableStore = new TableStore(); // new table @observable sysListTableStore = new TableStore(); @observable form = new WeaForm(); // nrew 一个form From 036e59b91a78f7c8bdd309f97b1ae3ea62ad9b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 31 Aug 2023 14:43:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature/2.9.42308.02-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=8C=E6=AD=A5=E5=88=B0=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/salaryItem/index.less | 34 ++++++++++++++++++- .../syncToSalaryAccountSetDialog.js | 18 +++++++--- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.less b/pc4mobx/hrmSalary/pages/salaryItem/index.less index f02dac13..b0063821 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.less +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.less @@ -105,8 +105,40 @@ .salarySetDialog { .salarySetDialogContent { - .wea-select, .ant-select-selection, .ant-select { + .wea-select, .ant-select, .ant-select-selection { width: 100%; } + + .wea-select .wea-select-input .arrow { + position: absolute; + right: 4px; + top: 8px; + color: #666; + } + + .wea-select .wdb { + word-break: break-all !important; + word-wrap: break-word !important; + } + + .wea-select .wea-select-input { + height: 30px; + white-space: nowrap; + min-width: 100px; + max-width: 345px; + width: 100%; + display: inline-block; + padding: 4px 17px 4px 4px; + position: relative; + min-height: 30px; + border: 1px solid #d9d9d9; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -o-text-overflow: ellipsis; + text-overflow: ellipsis; + overflow: hidden; + } } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js b/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js index bcaa8852..e8ca847b 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/syncToSalaryAccountSetDialog.js @@ -7,9 +7,9 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; -import { Button } from "antd"; +import { Button, message } from "antd"; import { getSearchs } from "../../util"; -import { getSalarySobBySalaryItem } from "../../apis/item"; +import { getSalarySobBySalaryItem, syncSalaryItemToSalarySobItem } from "../../apis/item"; import { salarySetConditions } from "./columns"; const getLabel = WeaLocaleProvider.getLabel; @@ -53,11 +53,21 @@ class SyncToSalaryAccountSetDialog extends Component { }; save = () => { - const { salaryItemStore: { salarySetform } } = this.props; + const { salaryItemStore: { salarySetform }, id: salaryItemId } = this.props; salarySetform.validateForm().then(f => { - console.log(salarySetform.getFormParams()); if (f.isValid) { + const { salarySobIds } = salarySetform.getFormParams(); this.setState({ loading: true }); + syncSalaryItemToSalarySobItem({ salaryItemId, salarySobIds: salarySobIds.split(",") }) + .then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success(getLabel(38462, "同步成功!")); + this.props.onCancel(); + } else { + message.error(errormsg || getLabel(81556, "同步失败!")); + } + }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); }