From 082cbe1955fb0d0dd8227f956fca147c2e457f3f Mon Sep 17 00:00:00 2001
From: MustangDeng <670124965@qq.com>
Date: Mon, 18 Apr 2022 11:42:45 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/item.js | 40 +++++++++++++
pc4mobx/hrmSalary/pages/ledger/index.js | 2 +-
.../pages/salaryItem/customSalaryItemSlide.js | 36 +++++++++---
.../pages/salaryItem/formalFormModal.js | 58 +++++++++++++++++++
pc4mobx/hrmSalary/pages/salaryItem/index.js | 40 +++++++++----
pc4mobx/hrmSalary/stores/ledger.js | 4 +-
pc4mobx/hrmSalary/stores/salaryItem.js | 44 +++++++++-----
tslint.json | 2 +-
8 files changed, 187 insertions(+), 39 deletions(-)
create mode 100644 pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js
diff --git a/pc4mobx/hrmSalary/apis/item.js b/pc4mobx/hrmSalary/apis/item.js
index a5c77d6f..7f3f0fcd 100644
--- a/pc4mobx/hrmSalary/apis/item.js
+++ b/pc4mobx/hrmSalary/apis/item.js
@@ -108,3 +108,43 @@ export const saveSysItem = params => {
export const getItemTypeOption = params => {
return WeaTools.callApi('/api/bs/hrmsalary/salaryitem/listSalaryItemTypeOption', '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())
+}
+
+//获取公式变量字段
+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())
+}
+
+// /api/bs/hrmsalary/formula/save
+// 保存公式
+export const saveFormual = parmas => {
+ return fetch('/api/bs/hrmsalary/formula/save', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ }).then(res => res.json())
+}
+
+// *** 公式 end ***
diff --git a/pc4mobx/hrmSalary/pages/ledger/index.js b/pc4mobx/hrmSalary/pages/ledger/index.js
index ad837a58..70c80ef0 100644
--- a/pc4mobx/hrmSalary/pages/ledger/index.js
+++ b/pc4mobx/hrmSalary/pages/ledger/index.js
@@ -2,7 +2,7 @@ import React from 'react';
import { inject, observer } from 'mobx-react';
import { toJS } from 'mobx';
-import { Button, Table, DatePicker, Switch } from 'antd';
+import { Button, Table, DatePicker, Switch, Modal } from 'antd';
import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaSlideModal } from 'ecCom';
import { WeaTableNew } from "comsMobx"
diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js
index 62107ee4..d3d65122 100644
--- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js
+++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js
@@ -4,25 +4,35 @@ import { WeaHelpfulTip, WeaSelect, WeaTextarea, WeaInput } from 'ecCom'
import "./index.less"
import { roundingModeOptions, patternOptions, dataTypeOptions } from "./options"
import RequiredLabelTip from '../../components/requiredLabelTip'
+import FormalFormModal from './formalFormModal'
export default class CustomSalaryItemSlide extends React.Component {
constructor(props) {
super(props)
this.state = {
- showForm: false
+ showForm: false,
+ formalModalVisible: false
}
}
handleChange(params) {
let request = {...this.props.request, ...params}
- this.setState({request})
+ this.setState({
+ request,
+ showForm: e.target.value == 2 ? true: false
+ })
this.props.onChange(request)
}
+ handleShowFormal() {
+ this.setState({
+ formalModalVisible: true
+ })
+ }
render() {
const { request, editable } = this.props;
const { name, useDefault, useInEmployeeSalary, roundingMode, pattern, valueType, description, dataType } = request;
-
+ const { formalModalVisible } = this.state;
return (
@@ -74,7 +84,6 @@ export default class CustomSalaryItemSlide extends React.Component {
舍入规则
-
{this.handleChange({roundingMode: value})}}/>
@@ -94,10 +103,8 @@ export default class CustomSalaryItemSlide extends React.Component {
取值方式
{
- this.setState({
- showForm: e.target.value == 2 ? true: false
- })
- this.handleChange({valueType: e.target.value})
+
+ this.handleChange({valueType: e.target.value}, e.target.value)
}}>
输入
公式
@@ -110,7 +117,9 @@ export default class CustomSalaryItemSlide extends React.Component {
公式
-
+
}
@@ -124,6 +133,15 @@ export default class CustomSalaryItemSlide extends React.Component {
+ {
+ formalModalVisible &&
+
+ }
)
}
diff --git a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js
new file mode 100644
index 00000000..28670dec
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js
@@ -0,0 +1,58 @@
+import React from 'react'
+import {Modal} from 'antd'
+import { WeaTextarea } from 'ecCom'
+import { inject, observer } from 'mobx-react';
+
+@inject('salaryItemStore')
+@observer
+export default class FormalFormModal extends React.Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ value: ''
+ }
+ }
+ componentWillMount() {
+ const { salaryItemStore } = this.props;
+ const { salaryAcctImportTemplateParam } = salaryItemStore;
+ salaryAcctImportTemplateParam();
+ }
+ // 多行文本编辑
+ handleChange(value) {
+ this.setState({
+ value
+ })
+ }
+ render() {
+ const {salaryItemStore} = this.props;
+ const { searchGroup } = salaryItemStore
+ const { value } = this.state;
+ return (
+ {this.props.onCancel()}}>
+
+
+
+
+
+
+
变量
+
+ {
+ searchGroup.map(item => {
+ return
+ {item.value}
+
+ })
+ }
+
+
+
+
+
+
+
+
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js
index d556b0b0..18d8ca89 100644
--- a/pc4mobx/hrmSalary/pages/salaryItem/index.js
+++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js
@@ -3,9 +3,9 @@ import { inject, observer } from 'mobx-react';
import { toJS } from 'mobx';
import { Button, Table, DatePicker, Switch, Menu, Dropdown } from 'antd';
-import { WeaTableNew } from "comsMobx"
+// import { WeaTableNew } from "comsMobx"
-import { WeaSlideModal, WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch } from 'ecCom';
+import { WeaTable, WeaSlideModal, WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch } from 'ecCom';
import { renderNoright, getSearchs } from '../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中
import CustomTab from '../../components/customTab';
@@ -15,11 +15,10 @@ import { columns, dataSource } from './columns';
import SlideModalTitle from "../../components/slideModalTitle"
import CustomSalaryItemSlide from './customSalaryItemSlide'
import DeleteSalaryItemModal from './deleteSalaryItemModal';
+import FormalFormModal from './formalFormModal';
const { MonthPicker } = DatePicker;
-const WeaTable = WeaTableNew.WeaTable;
-
@inject('salaryItemStore')
@observer
export default class SalaryItem extends React.Component {
@@ -30,7 +29,8 @@ export default class SalaryItem extends React.Component {
selectedKey: "0",
editable: false,
isAdd: false,
- searchValue: ""
+ searchValue: "",
+ formalModalVisible: false
}
columns.map(item => {
if(item.dataIndex == "refere") {
@@ -66,9 +66,10 @@ export default class SalaryItem extends React.Component {
}
// 增加编辑功能,重写columns绑定事件
- getColumns = (columns) => {
- let newColumns = '';
- newColumns = columns.map(column => {
+ getColumns = () => {
+ const { salaryItemStore } = this.props;
+ const { tableColumns} = salaryItemStore
+ let columns = tableColumns.map(column => {
let newColumn = column;
newColumn.render = (text, record, index) => { //前端元素转义
let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex];
@@ -85,7 +86,16 @@ export default class SalaryItem extends React.Component {
}
return newColumn;
});
- return newColumns;
+ columns.push({
+ key: "operate",
+ title: "操作",
+ render: (text, record) => {
+ return (
+ {this.onEditItem(record, false)}}>编辑
+ )
+ }
+ })
+ return columns
}
@@ -111,7 +121,8 @@ export default class SalaryItem extends React.Component {
render() {
const { salaryItemStore } = this.props;
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = salaryItemStore;
- const { systemItemVisible, setSystemItemVisible, deleteItemVisible, setDeleteItemVisible, deleteItemList, editSlideVisible, setEditSlideVisible, request } = salaryItemStore
+ const { tableDataSource, tableColumns, systemItemVisible, setSystemItemVisible, deleteItemVisible, setDeleteItemVisible, deleteItemList, editSlideVisible, setEditSlideVisible, request } = salaryItemStore
+ const { formalModalVisible} = this.state;
if (!hasRight && !loading) { // 无权限处理
return renderNoright();
}
@@ -230,13 +241,19 @@ export default class SalaryItem extends React.Component {
}
/>
- */}
+
+
+
@@ -275,6 +292,7 @@ export default class SalaryItem extends React.Component {
closeMaskOnClick={() => setEditSlideVisible(false)} />
}
+
)
}
diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js
index ff7741e9..28f281be 100644
--- a/pc4mobx/hrmSalary/stores/ledger.js
+++ b/pc4mobx/hrmSalary/stores/ledger.js
@@ -588,7 +588,9 @@ export class LedgerStore {
if(res.status) {
let basicForm = res.data.basicForm
Object.keys(basicForm).map(key => {
- basicForm[key] = basicForm[key].toString();
+ if(basicForm[key]) {
+ basicForm[key] = basicForm[key].toString();
+ }
})
this.baseInfoRequest = basicForm
} else {
diff --git a/pc4mobx/hrmSalary/stores/salaryItem.js b/pc4mobx/hrmSalary/stores/salaryItem.js
index 3e09bc92..910fa8a2 100644
--- a/pc4mobx/hrmSalary/stores/salaryItem.js
+++ b/pc4mobx/hrmSalary/stores/salaryItem.js
@@ -31,6 +31,10 @@ export class SalaryItemStore {
description: ""
}
+ @observable tableDataSource = []; // 主列表
+ @observable tableColumns = []; // 主列表列
+ @observable searchGroup = []
+
@action
initRequest = () => this.request = {
@@ -60,35 +64,25 @@ export class SalaryItemStore {
// 初始化操作
@action
doInit = () => {
- // this.getCondition();
this.getTableDatas({});
}
- // 获得高级搜索表单数据
- @action
- getCondition = () => {
- API.getCondition().then(action(res => {
- if (res.api_status) { // 接口请求成功/失败处理
- this.condition = res.condition;
- this.form.initFormFields(res.condition); // 渲染高级搜索form表单
- } else {
- message.error(res.errormsg || '接口调用失败!')
- }
- }));
- }
-
// 渲染table数据
@action
getTableDatas = (params) => {
this.loading = true;
+
API.getItemList(params).then(action(res => {
if (res.status) { // 接口请求成功/失败处理
- this.tableStore.getDatas(res.data.datas); // table 请求数据
+ this.tableDataSource = res.data.list
+ this.tableColumns = res.data.columns
+ // this.tableStore.getDatas(res.data.datas); // table 请求数据
} else {
message.error(res.errormsg || '接口调用失败!')
}
this.loading = false;
}));
+
}
@action
@@ -136,7 +130,13 @@ export class SalaryItemStore {
getItemForm = (id) => {
API.getItemForm(id).then(res => {
if(res.status) {
- this.request = res.data.map(item => item.toString())
+ let data = res.data;
+ Object.keys(data).map(key => {
+ if(data[key]) {
+ data[key] = data[key].toString()
+ }
+ })
+ this.request = data;
} else {
message.error(res.errormsg || '获取失败')
}
@@ -236,4 +236,16 @@ export class SalaryItemStore {
}
})
}
+
+ // 获取公式变量类型
+ @action
+ salaryAcctImportTemplateParam = (params = {}) => {
+ API.formualSearchGroup(params).then(res => {
+ if(res.status) {
+ this.searchGroup = res.data
+ } else {
+ message.error(res.errormsg || "获取失败")
+ }
+ })
+ }
}
\ No newline at end of file
diff --git a/tslint.json b/tslint.json
index 67823d8e..6f147f21 100644
--- a/tslint.json
+++ b/tslint.json
@@ -6,4 +6,4 @@
"node_modules/**/*.ts"
]
}
-}
+}
\ No newline at end of file