diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index 5871c5b9..3090a5e5 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -341,6 +341,18 @@ export const reAccounting = (params) => { }).then(res => res.json()) } +// 薪资结果-编辑表单保存 +export const saveAcctResult = (params) => { + return fetch('/api/bs/hrmsalary/salaryacct/acctresult/save', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} + diff --git a/pc4mobx/hrmSalary/apis/declare.js b/pc4mobx/hrmSalary/apis/declare.js index a7673bbf..8cf65377 100644 --- a/pc4mobx/hrmSalary/apis/declare.js +++ b/pc4mobx/hrmSalary/apis/declare.js @@ -2,7 +2,14 @@ import { WeaTools } from 'ecCom'; //个税申报表-个税申报表列表 export const getDeclareList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxdeclaration/list', 'POST', params); + return fetch('/api/bs/hrmsalary/taxdeclaration/list', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //个税申报表-个税申报表表单 @@ -12,10 +19,46 @@ export const getDeclareForm = params => { //个税申报表-个税申报表生成 export const saveDeclare = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxdeclaration/save', 'POST', params); + return fetch('/api/bs/hrmsalary/taxdeclaration/save', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) } //个税申报表-个税申报表相关信息 export const getDeclareInfo = params => { return WeaTools.callApi('/api/bs/hrmsalary/taxdeclaration/getTaxDeclarationInfo', 'get', params); -} \ No newline at end of file +} + +// 个税申报表详情列表 +export const getDetailList = params => { + return fetch('/api/bs/hrmsalary/taxdeclaration/detail/list', { + method: 'POST', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(params) + }).then(res => res.json()) +} + + +// 个税申报表导出 +export const exportSalaryArchive = (id = "") => { + fetch('/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=' + id).then(res => res.blob().then(blob => { + var filename=`个税申报表.xlsx` + var a = document.createElement('a'); + var url = window.URL.createObjectURL(blob); + a.href = url; + a.download = filename; + a.click(); + window.URL.revokeObjectURL(url); + })) +} + + + diff --git a/pc4mobx/hrmSalary/apis/item.js b/pc4mobx/hrmSalary/apis/item.js index f9b75945..d63c0334 100644 --- a/pc4mobx/hrmSalary/apis/item.js +++ b/pc4mobx/hrmSalary/apis/item.js @@ -147,4 +147,10 @@ export const saveFormual = params => { }).then(res => res.json()) } +// 根据id获取formual +export const detailFormual = params => { + return WeaTools.callApi('/api/bs/hrmsalary/formula/detail', 'GET', params); +} + + // *** 公式 end *** diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js b/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js index 278293ad..c213c643 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/editSalaryDetail.js @@ -1,5 +1,5 @@ import React from 'react' -import { WeaHelpfulTip } from "ecCom" +import { WeaHelpfulTip, WeaInput } from "ecCom" import { Row, Col } from 'antd' import { inject, observer } from 'mobx-react'; import "./index.less" @@ -11,8 +11,33 @@ export default class EditSalaryDetail extends React.Component { const { calculateStore: {acctresultDetail}} = this.props; acctresultDetail(this.props.id) } + + handleItemValueChange(field, value, isInput) { + const { calculateStore: { acctresultDetailForm, setAcctresultDetailForm }} = this.props; + let form = {...acctresultDetailForm} + if(isInput) { + form.inputItems = acctresultDetailForm.inputItems.map(item => { + item = {...item} + if(item.salaryItemName == field) { + item.resultValue = value + } + return item; + }) + } else { + form.formulaItems = acctresultDetailForm.formulaItems.map(item => { + item = {...item} + if(item.salaryItemName == field) { + item.resultValue = value + } + return item; + }) + } + setAcctresultDetailForm(form) + } + + render() { - const { calculateStore: { acctresultDetail }} = this.props; + const { calculateStore: { acctresultDetailForm }} = this.props; return (
@@ -29,63 +54,17 @@ export default class EditSalaryDetail extends React.Component {
{ - acctresultDetail.employeeInfos.map(item => { + acctresultDetailForm.employeeInfos && acctresultDetailForm.employeeInfos.map(item => { return ( {item.fieldName} - {/* {item.} */} - - + {item.fieldValue} + ) }) } - - - 姓名 - 张三 - - - - - - 部门 - 研发 - - - - - - - 岗位 - 开发 - - - - - - - - 入职日期 - 2020-10-20 - - - - - - 手机号 - 18888888888 - - - - - - - 个税扣缴义务人 - 义务人一 - -
@@ -97,50 +76,21 @@ export default class EditSalaryDetail extends React.Component {
- - - 基本工资 - 25,000 - - + { + acctresultDetailForm.inputItems && acctresultDetailForm.inputItems.map(item => { + return ( + + + {item.salaryItemName} + { + this.handleItemValueChange(item.salaryItemName, value, true) + }}/> + + + ) + }) + } - - - 用餐补贴 - 25,000 - - - - - - - 住房补贴 - 25,000 - - - - - - - - 话费补贴 - 5,000 - - - - - - 岗位津贴 - 5,000 - - - - - - 高温补贴 - 5,000 - -
@@ -159,50 +109,20 @@ export default class EditSalaryDetail extends React.Component {
- - - 基本工资 - 25,000 - - - - - - 用餐补贴 - 25,000 - - - - - - - 住房补贴 - 25,000 - - - - - - - - 话费补贴 - 5,000 - - - - - - 岗位津贴 - 5,000 - - - - - - 高温补贴 - 5,000 - - + { + acctresultDetailForm.formulaItems && acctresultDetailForm.formulaItems.map(item => { + return ( + + + {item.salaryItemName} + { + this.handleItemValueChange(item.salaryItemName, value, false) + }}/> + + + ) + }) + }
diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js b/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js index 8eba93a6..60172857 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/salaryDetail.js @@ -30,10 +30,12 @@ export default class SalaryDetail extends React.Component { }) } this.recordId = "" + this.id = "" } componentWillMount() { let id = getQueryString("id") + this.id = id; const { calculateStore: { acctResultList, getSalarySobCycle } } = this.props; acctResultList(id) getSalarySobCycle(id) @@ -76,6 +78,15 @@ export default class SalaryDetail extends React.Component { }) } + // 侧边栏保存 + handleEditSlideSave() { + const {calculateStore } = this.props; + const { saveAcctResult, acctResultList } = calculateStore; + saveAcctResult(this.recordId).then(() => { + acctResultList(this.id) + }) + } + render() { const { slideVisiable } = this.state; const { calculateStore } = this.props; @@ -114,6 +125,7 @@ export default class SalaryDetail extends React.Component { this.handleEditSlideSave()} /> } content={} diff --git a/pc4mobx/hrmSalary/pages/declare/generateDeclarationDetail.js b/pc4mobx/hrmSalary/pages/declare/generateDeclarationDetail.js index be95aa98..a64daac1 100644 --- a/pc4mobx/hrmSalary/pages/declare/generateDeclarationDetail.js +++ b/pc4mobx/hrmSalary/pages/declare/generateDeclarationDetail.js @@ -1,15 +1,49 @@ import React from 'react' import CustomTab from '../../components/customTab' import { Button, Table } from "antd" +import { WeaTable } from 'ecCom' import { declarationColumns, dataSource} from './columns' import "./index.less" +import { inject, observer } from 'mobx-react'; +import { getQueryString } from '../../util/url' +@inject('declareStore') +@observer export default class GenerateDeclarationDetail extends React.Component { + constructor(props) { + super(props) + this.id = getQueryString("id") + } + + componentWillMount() { + const { declareStore: { getDetailList, getDeclareInfo }} = this.props; + getDetailList(this.id) + getDeclareInfo(this.id) + } + + // 导出 + handleExport() { + const { declareStore: {exportSalaryArchive}} = this.props; + exportSalaryArchive(this.id) + } + + getColumns() { + const { declareStore: {datailColumns}} = this.props; + let columns = [...datailColumns] + return columns.map(item => { + item = {...item} + item.width = "150px" + return item; + }) + } + render() { + const { declareStore: { detailDataSource, detailTableStore, declareInfo, datailColumns }} = this.props; + const renderRightOperation = () => { return (
- +
) } @@ -17,8 +51,8 @@ export default class GenerateDeclarationDetail extends React.Component { const renderLeftOperation = () => { return (
- 薪资所属月:2021-11 - 个税扣缴义务人:上海泛微 + 薪资所属月:{declareInfo.salaryMonth && declareInfo.salaryMonth.year} - {declareInfo.salaryMonth && declareInfo.salaryMonth.monthValue} + 个税扣缴义务人:{declareInfo.taxAgentName}
) } @@ -33,7 +67,7 @@ export default class GenerateDeclarationDetail extends React.Component { } />
- + ) diff --git a/pc4mobx/hrmSalary/pages/declare/generateModal.js b/pc4mobx/hrmSalary/pages/declare/generateModal.js index 9cd94b3c..338ff498 100644 --- a/pc4mobx/hrmSalary/pages/declare/generateModal.js +++ b/pc4mobx/hrmSalary/pages/declare/generateModal.js @@ -1,8 +1,10 @@ import React from 'react' import { WeaHelpfulTip, WeaDatePicker, WeaInput } from 'ecCom'; -import { Modal, Row, Col } from 'antd' - +import { Modal, Row, Col, Button } from 'antd' +import { inject, observer } from 'mobx-react'; +@inject('declareStore') +@observer export default class GenerateModal extends React.Component { constructor(props) { super(props) @@ -10,9 +12,21 @@ export default class GenerateModal extends React.Component { date: "" } } + + // 生成申报表 + handleGenerate() { + const { declareStore: { saveDeclare }} = this.props; + saveDeclare(this.state.date).then(() => { + this.props.onGenerate() + }) + } + render() { return ( - this.props.onCancel()} width={800}> + this.props.onCancel()} width={800} + footer={ + + }>
申报
-
+
薪资所属月 this.setState({date: value})} /> - - 备注 - - - - ) diff --git a/pc4mobx/hrmSalary/pages/declare/index.js b/pc4mobx/hrmSalary/pages/declare/index.js index 40b4293b..9ee0abec 100644 --- a/pc4mobx/hrmSalary/pages/declare/index.js +++ b/pc4mobx/hrmSalary/pages/declare/index.js @@ -12,10 +12,11 @@ import ContentWrapper from '../../components/contentWrapper'; import { columns, dataSource } from './columns'; import GenerateModal from './generateModal' +import moment from 'moment' const { MonthPicker } = DatePicker; -@inject('baseTableStore') +@inject('declareStore') @observer export default class Declare extends React.Component { constructor(props) { @@ -23,21 +24,82 @@ export default class Declare extends React.Component { this.state = { value: "", selectedKey: "0", - declarationModalVisible: false + declarationModalVisible: false, + startDate: moment(new Date()).format("YYYY-MM"), + endDate: moment(new Date()).format("YYYY-MM") } columns.map(item => { if(item.dataIndex == "cz") { - item.render =() => { + item.render =(text, record) => { return ( - {window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail")}}>查看 + {window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail?id=" + record.id)}}>查看 ) } } }) } + + componentWillMount() { + this.handleSearch() + } + + // 开始月份改变 + handleStartDateChange(value) { + this.setState({ + startDate: value + }) + const { declareStore } = this.props; + const { getDeclareList } = declareStore + getDeclareList({ + fromSalaryMonthStr: value, + endSalaryMonthStr: this.state.endDate + }) + } + + // 结束月份改变 + handleEndDateChange(value) { + this.setState({ + endDate: value + }) + const { declareStore } = this.props; + const { getDeclareList } = declareStore + getDeclareList({ + fromSalaryMonthStr: this.state.startDate, + endSalaryMonthStr: value + }) + } + + // 查询列表 + handleSearch() { + const { declareStore } = this.props; + const { getDeclareList } = declareStore + getDeclareList({ + fromSalaryMonthStr: this.state.startDate, + endSalaryMonthStr: this.state.endDate + }) + } + + getColumns() { + const { declareStore: {listColumns}} = this.props; + let columns = [...listColumns] + columns.push({ + title: "操作", + dataIndex: "operate", + render: (text, record) => { + return ( + {window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/generateDeclarationDetail?id=" + record.id)}}>查看 + ) + } + }) + return columns; + } + + render() { - const { baseTableStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = baseTableStore; + const { declareStore } = this.props; + const { loading, hasRight, form, condition, + tableStore, showSearchAd, getTableDatas, doSearch, + setShowSearchAd, listDataSource, listColumns } = declareStore; if (!hasRight && !loading) { // 无权限处理 return renderNoright(); @@ -72,13 +134,13 @@ export default class Declare extends React.Component { this.setState({startDate: value})} + onChange={value => this.handleStartDateChange(value)} /> this.setState({endDate: value})} + onChange={value => this.handleEndDateChange(value)} />
+ this.state.showContent &&
} { this.state.addItemVisible && { this.setState({addItemVisible: false})}} /> } + + { + formalModalVisible && + { + this.handleSaveFormal(data) + }} + onCancel={() => this.setState({ + formalModalVisible: false + })} + /> + } ) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js index f054e25f..4e2b9cb3 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/customSalaryItemSlide.js @@ -11,8 +11,7 @@ export default class CustomSalaryItemSlide extends React.Component { super(props) this.state = { showForm: false, - formalModalVisible: false, - formula: "" + formalModalVisible: false } } @@ -29,17 +28,15 @@ export default class CustomSalaryItemSlide extends React.Component { // 保存公式成功回调 handleSaveFormal(data) { - this.handleChange({formulaId: data.id}) - this.setState({ - formula: data.formula - }) + this.handleChange({formulaId: data.id, formulaContent: data.formula}) } render() { const { editable, request } = this.props; - const { name, useDefault, useInEmployeeSalary, roundingMode, pattern, valueType, description, dataType } = request; + const { name, useDefault, useInEmployeeSalary, roundingMode, pattern, valueType, description, dataType, formulaContent, formulaId } = request; const { formalModalVisible } = this.state; - console.log("valueType: " + valueType); + + console.log("request: ", request); return (
@@ -124,7 +121,7 @@ export default class CustomSalaryItemSlide extends React.Component {
this.handleShowFormal()} > - {this.state.formula} + {formulaContent}
@@ -141,6 +138,7 @@ export default class CustomSalaryItemSlide extends React.Component { { formalModalVisible && { this.handleSaveFormal(data) diff --git a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js index 871de439..29d11cd8 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/formalFormModal.js @@ -18,10 +18,19 @@ export default class FormalFormModal extends React.Component { componentWillMount() { const { salaryItemStore } = this.props; - const { salaryAcctImportTemplateParam, setSearchFields } = salaryItemStore; + const { salaryAcctImportTemplateParam, setSearchFields, detailFormual } = salaryItemStore; salaryAcctImportTemplateParam(); setSearchFields([]) + if(this.props.formulaId) { + detailFormual(this.props.formulaId).then(data => { + this.setState({ + value: data.formula + }) + this.parameters = data.parameters + }) + } } + // 多行文本编辑 handleChange(value) { this.setState({ diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 5c456660..c2ee1bcb 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -77,9 +77,9 @@ export default class SalaryItem extends React.Component { case "name": return {this.onEditItem(record, false)}}>{text} case "useInEmployeeSalary": - return + return case "useDefault": - return + return default: return
} diff --git a/pc4mobx/hrmSalary/stores/calculate.js b/pc4mobx/hrmSalary/stores/calculate.js index 20b88fdd..a5b5b373 100644 --- a/pc4mobx/hrmSalary/stores/calculate.js +++ b/pc4mobx/hrmSalary/stores/calculate.js @@ -42,8 +42,9 @@ export class calculateStore { @observable comparisonresultListColumns = [];//列 - - + // 编辑薪资表单数据 + @action + setAcctresultDetailForm = (acctresultDetailForm) => {this.acctresultDetailForm = acctresultDetailForm} // 初始化操作 @action doInit = () => { @@ -347,4 +348,37 @@ export class calculateStore { } + // 薪资结果-编辑表单保存 + @action + saveAcctResult = (recordId) => { + let inputItems = this.acctresultDetailForm.inputItems.map(item => { + let record = {} + record.salaryItemId = item.salaryItemId + record.resultValue = item.resultValue + return record; + }) + + let formulaItems = this.acctresultDetailForm.formulaItems.map(item =>{ + let record = {} + record.salaryItemId = item.salaryItemId + record.resultValue = item.resultValue + return record; + }) + + let items = inputItems.concat(formulaItems) + let params = { + salaryAcctEmpId: recordId, + items + } + API.saveAcctResult(params).then(res => { + if(res.status) { + message.success("保存成功") + resolve(); + } else { + message.error(res.errormsg || "保存失败") + reject(); + } + }) + } + } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/stores/declare.js b/pc4mobx/hrmSalary/stores/declare.js new file mode 100644 index 00000000..edab7837 --- /dev/null +++ b/pc4mobx/hrmSalary/stores/declare.js @@ -0,0 +1,138 @@ +import { observable, action, toJS } from 'mobx'; +import { message } from 'antd'; +import { WeaForm, WeaTableNew } from 'comsMobx'; + +import * as API from '../apis/declare'; // 引入API接口文件 + +const { TableStore } = WeaTableNew; + +export class DeclareStore { + @observable tableStore = new TableStore(); // new table + @observable form = new WeaForm(); // nrew 一个form + @observable condition = []; // 存储后台得到的form数据 + @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 + @observable showSearchAd = false; // 高级搜索面板显示 + @observable loading = true; // 数据加载状态 + + // 列表 + @observable listDataSource = []; + @observable listColumns = []; + + // 详情页 + @observable declareInfo = {}; // 详情基本信息 + @observable detailTableStore = new TableStore(); + @observable detailDataSource = []; + @observable datailColumns = []; + + // 初始化操作 + @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.msg || '接口调用失败!') + } + })); + } + + // 渲染table数据 + @action + getTableDatas = (params) => { + this.loading = true; + const formParams = this.form.getFormParams() || {}; + params = params || formParams; + API.getTableDatas(params).then(action(res => { + if (res.api_status) { // 接口请求成功/失败处理 + this.tableStore.getDatas(res.datas); // table 请求数据 + this.hasRight = res.hasRight; + } else { + message.error(res.msg || '接口调用失败!') + } + this.loading = false; + })); + } + + @action + setShowSearchAd = bool => this.showSearchAd = bool; + + // 高级搜索 - 搜索 + @action doSearch = () => { + this.getTableDatas(); + this.showSearchAd = false; + } + + //个税申报表-个税申报表列表 + @action + getDeclareList = (params = {}) => { + API.getDeclareList(params).then(res => { + if(res.status) { + this.listDataSource = res.data.list ? res.data.list: []; + this.listColumns = res.data.columns + } else { + message.error(res.errormsg || '获取失败') + } + }) + } + + //个税申报表-个税申报表生成 + @action + saveDeclare = (date) => { + return new Promise((resolve, reject) => { + API.saveDeclare({salaryMonthStr: date}).then(res => { + if(res.status) { + message.success("生成成功") + resolve(); + } else { + message.error(res.errormsg || "生成失败") + reject() + } + }) + }) + + } + + //个税申报表-个税申报表相关信息 + @action + getDeclareInfo = (taxDeclarationId) => { + API.getDeclareInfo({taxDeclarationId}).then(res => { + if(res.status) { + this.declareInfo = res.data + } else { + message.error(res.errormsg || "获取失败") + } + }) + } + + // 个税申报表详情列表 + @action + getDetailList = (taxDeclarationIdStr) => { + API.getDetailList({taxDeclarationIdStr}).then(res => { + if(res.status) { + this.detailDataSource = res.data.pageInfo.list ? res.data.pageInfo.list : []; + this.datailColumns = res.data.pageInfo.columns + // this.detailTableStore.getDatas(res.data.dataKey.datas) + } else { + message.error(res.errrmsg || "获取失败") + } + }) + } + + // 个税申报表导出 + @action + exportSalaryArchive = (id) => { + API.exportSalaryArchive(id) + } + + + + +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/stores/index.js b/pc4mobx/hrmSalary/stores/index.js index c07dd0f7..4eb20a5d 100644 --- a/pc4mobx/hrmSalary/stores/index.js +++ b/pc4mobx/hrmSalary/stores/index.js @@ -15,6 +15,7 @@ import { ArchivesStore } from './archives' import { salaryFileStore } from './salaryFile'; import { payrollStore } from './payroll'; import { calculateStore } from './calculate'; +import { DeclareStore } from './declare'; module.exports = { baseFormStore: new BaseFormStore(), @@ -32,6 +33,7 @@ module.exports = { archivesStore: new ArchivesStore(), salaryFileStore: new salaryFileStore(), payrollStore: new payrollStore(), - calculateStore: new calculateStore() + calculateStore: new calculateStore(), + declareStore: new DeclareStore() }; diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js index 28f281be..88d259a6 100644 --- a/pc4mobx/hrmSalary/stores/ledger.js +++ b/pc4mobx/hrmSalary/stores/ledger.js @@ -38,6 +38,11 @@ export class LedgerStore { @observable baseInfoRequest = {}; @observable userSelectedList = []; + // ** 薪资项目 ** + // 添加薪资项目 + @observable addSalaryItemColumns = []; + @observable addSalaryItemDataSource = []; + @action initSlideData = () => { this.salarySobId = ""; @@ -133,6 +138,7 @@ export class LedgerStore { item.items = item.items ? item.items.concat(list) : list } }) + this.setItemGroups(itemGroups); } @@ -426,7 +432,13 @@ export class LedgerStore { }) API.listSalaryItem({name:searchValue, excludeIds}).then(res => { if(res.status) { - this.salaryItemTableStore.getDatas(res.data.datas); + this.addSalaryItemDataSource = res.data.list.map(item => { + item = {...item} + item.key = item.id + return item; + }); + this.addSalaryItemColumns = res.data.columns; + // this.salaryItemTableStore.getDatas(res.data.datas); } else { message.error(res.errormsg || "获取数据失败") } @@ -452,7 +464,8 @@ export class LedgerStore { result.items = result.items.map((i,index) => ( { salaryItemId: i.salaryItemId, - sortedIndex: index + 1 + sortedIndex: index + 1, + formulaId: i.formulaId } )) return result; diff --git a/pc4mobx/hrmSalary/stores/salaryItem.js b/pc4mobx/hrmSalary/stores/salaryItem.js index 4a8e2486..a534889f 100644 --- a/pc4mobx/hrmSalary/stores/salaryItem.js +++ b/pc4mobx/hrmSalary/stores/salaryItem.js @@ -39,6 +39,8 @@ export class SalaryItemStore { @observable searchGroup = []; // 字段列表 @observable searchFields = []; + // 公式详情 + @observable formulaDetail = {}; // 设置字段列表 @action @@ -288,4 +290,21 @@ export class SalaryItemStore { }) } + + // 根据id获取formual + @action + detailFormual = (formulaId) => { + return new Promise((resolve, reject) => { + API.detailFormual({formulaId}).then(res => { + if(res.status) { + this.formulaDetail = res.data + resolve(res.data) + } else { + message.error(res.errormsg || "获取失败") + reject() + } + }) + }) + + } } \ No newline at end of file