diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js index 710233df..4b7ea0f7 100644 --- a/pc4mobx/hrmSalary/apis/attendance.js +++ b/pc4mobx/hrmSalary/apis/attendance.js @@ -1,236 +1,286 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; //数据采集-考勤引用-考勤数据列表 -export const getAttendanceList = params => { - return fetch('/api/bs/hrmsalary/attendQuote/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const checkOperation = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/checkOperation", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; +//数据采集-考勤引用-考勤数据列表 +export const getAttendanceList = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤数据-获取导入参数 -export const getImportAttendanceParam = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getImportParams', 'get', params); -} +export const getImportAttendanceParam = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getImportParams", + "get", + params + ); +}; //数据采集-考勤引用-获取账套列表 -export const getLedgerList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/selectSalarySobList', 'get', params); -} +export const getLedgerList = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/selectSalarySobList", + "get", + params + ); +}; //数据采集-考勤引用-获取引用考勤表单 -export const getAttendanceReferForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getSyncForm', 'get', params); -} +export const getAttendanceReferForm = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getSyncForm", + "get", + params + ); +}; //数据采集-考勤引用-获取引用考勤表单周期数据 -export const getAttendanceReferPeriod = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle', 'post', params); -} +export const getAttendanceReferPeriod = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", + "post", + params + ); +}; //数据采集-考勤引用-同步引用考勤数据 -export const syncAttendanceRefer = params => { - return fetch('/api/bs/hrmsalary/attendQuote/syncAttendQuoteData', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const syncAttendanceRefer = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/syncAttendQuoteData", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-查看考勤数据 -export const getAttendanceDetail = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/view', 'get', params); -} +export const getAttendanceDetail = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/attendQuote/view", "get", params); +}; //数据采集-考勤引用-删除考勤数据 -export const deleteAttendance = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/delete', 'POST', params); -} +export const deleteAttendance = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/delete", + "POST", + params + ); +}; //数据采集-考勤引用-导出考勤数据 -export const exportAttendance = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/export', 'POST', params); -} +export const exportAttendance = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/export", + "POST", + params + ); +}; //数据采集- 考勤应用-导出模版+全量数据 -export const exportForTemplate = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/exportForTemplate', 'POST', params); -} +export const exportForTemplate = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/exportForTemplate", + "POST", + params + ); +}; //数据采集-考勤引用-考勤字段管理列表 -export const getAttendanceFieldList = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const getAttendanceFieldList = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-获取考勤字段表单 -export const getAttendanceFieldForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getFieldForm', 'get', params); -} +export const getAttendanceFieldForm = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getFieldForm", + "get", + params + ); +}; //数据采集-考勤引用-新建考勤字段 -export const saveAttendanceField = params => { - return fetch('/api/bs/hrmsalary/attendQuote/saveField', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const saveAttendanceField = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/saveField", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-修改考勤字段 -export const updateAttendanceField = params => { - return fetch('/api/bs/hrmsalary/attendQuote/updateField', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const updateAttendanceField = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/updateField", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-启用/停用自定义字段 -export const updateAttendanceFieldStatus = params => { - return fetch('/api/bs/hrmsalary/attendQuote/updateEnableStatus', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const updateAttendanceFieldStatus = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/updateEnableStatus", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-删除考勤字段 -export const deleteAttendanceField = params => { - return fetch('/api/bs/hrmsalary/attendQuote/deleteField', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const deleteAttendanceField = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/deleteField", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-列表 -export const getAttendanceFieldSettingList = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getAttendanceFieldSettingList = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldSetting/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-保存 -export const saveAttendanceFieldSetting = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/save', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const saveAttendanceFieldSetting = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldSetting/save", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-恢复默认设置 -export const returnToAttendanceFieldSettingDefault = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/recoverAsDefault', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const returnToAttendanceFieldSettingDefault = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldSetting/recoverAsDefault", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-考勤引用-考勤引用字段设置-设为默认设置 -export const saveAttendanceFieldSettingAsDefault = params => { - return fetch('/api/bs/hrmsalary/attendQuote/fieldSetting/saveAsDefault', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const saveAttendanceFieldSettingAsDefault = (params) => { + return fetch("/api/bs/hrmsalary/attendQuote/fieldSetting/saveAsDefault", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; // 考勤导入模板下载 export const downloadTemplate = (salaryYearMonth, salarySobId) => { - // /api/bs/hrmsalary/attendQuote/downloadTemplate - fetch('/api/bs/hrmsalary/attendQuote/downloadTemplate?salaryYearMonth=' + salaryYearMonth + "&salarySobId=" + salarySobId).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); - })) -} + // /api/bs/hrmsalary/attendQuote/downloadTemplate + fetch( + "/api/bs/hrmsalary/attendQuote/downloadTemplate?salaryYearMonth=" + + salaryYearMonth + + "&salarySobId=" + + salarySobId + ).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); + }) + ); +}; // 考勤导入预览 export const previewAttendQuote = (params) => { - return fetch('/api/bs/hrmsalary/attendQuote/preview', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/attendQuote/preview", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; // 考勤数据导入 export const importAttendQuoteData = (params) => { - return fetch('/api/bs/hrmsalary/attendQuote/importAttendQuoteData', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/attendQuote/importAttendQuoteData", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; -// 查看考勤详情 +// 查看考勤详情 export const viewAttendQuote = (ids) => { - return fetch('/api/bs/hrmsalary/attendQuote/view', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(ids) - }).then(res => res.json()) -} + return fetch("/api/bs/hrmsalary/attendQuote/view", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(ids), + }).then((res) => res.json()); +}; // 根据所属月和账套获取周期 export const getSalaryCycleAndAttendCycle = (params) => { - return WeaTools.callApi('/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle', 'get', params); - -} + return WeaTools.callApi( + "/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", + "get", + params + ); +}; diff --git a/pc4mobx/hrmSalary/apis/cumDeduct.js b/pc4mobx/hrmSalary/apis/cumDeduct.js index 8e5dd048..be04bdad 100644 --- a/pc4mobx/hrmSalary/apis/cumDeduct.js +++ b/pc4mobx/hrmSalary/apis/cumDeduct.js @@ -1,85 +1,102 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; //数据采集-累计专项附加扣除列表 -export const getCumDeductList = params => { - return fetch('/api/bs/hrmsalary/addUpDeduction/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getCumDeductList = (params) => { + return fetch("/api/bs/hrmsalary/addUpDeduction/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-累计专项附加扣除列表的高级搜索 -export const getCumDeductSaCondition = params => { - return WeaTools.callApi('/api/bs/hrmsalary/addUpDeduction/getSearchCondition', 'get', params); -} +export const getCumDeductSaCondition = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/addUpDeduction/getSearchCondition", + "get", + params + ); +}; //数据采集-累计专项附加扣除-导出 export const exportCumDeductList = (ids = "") => { - fetch('/api/bs/hrmsalary/addUpDeduction/export?ids=' + ids).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); - })) -} + fetch("/api/bs/hrmsalary/addUpDeduction/export?ids=" + ids).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); + }) + ); +}; //数据采集-累计专项附加扣除-获取导入参数 -export const getImportCumDeductParam = params => { - return WeaTools.callApi('/api/bs/hrmsalary/addUpDeduction/getImportParams', 'get', params); -} +export const getImportCumDeductParam = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/addUpDeduction/getImportParams", + "get", + params + ); +}; //数据采集-获取累计专项附加扣除记录 -export const getCumDeductDetailList = params => { - return fetch('/api/bs/hrmsalary/addUpDeduction/getDetailList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getCumDeductDetailList = (params) => { + return fetch("/api/bs/hrmsalary/addUpDeduction/getDetailList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-累计专项附加扣除-导出明细 -export const exportCumDeductDetailList = (id, ids="") => { - fetch('/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId='+id+'&ids=' + ids).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); - })) -} +export const exportCumDeductDetailList = (id, ids = "") => { + fetch( + "/api/bs/hrmsalary/addUpDeduction/exportDetail?accumulatedSpecialAdditionalDeductionId=" + + id + + "&ids=" + + ids + ).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); + }) + ); +}; // 数据采集-获取累计专项附加扣除-导入 -export const importCumDeductParam = params => { - return fetch('/api/bs/hrmsalary/addUpDeduction/importAddUpDeduction', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const importCumDeductParam = (params) => { + return fetch("/api/bs/hrmsalary/addUpDeduction/importAddUpDeduction", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; // 数据采集-获取累计专项附加扣除-导入预览 -export const importCumDeductPreview = params => { - return fetch('/api/bs/hrmsalary/addUpDeduction/preview', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const importCumDeductPreview = (params) => { + return fetch("/api/bs/hrmsalary/addUpDeduction/preview", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; diff --git a/pc4mobx/hrmSalary/apis/cumSituation.js b/pc4mobx/hrmSalary/apis/cumSituation.js index 3af18fe9..aef62744 100644 --- a/pc4mobx/hrmSalary/apis/cumSituation.js +++ b/pc4mobx/hrmSalary/apis/cumSituation.js @@ -1,85 +1,102 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; //数据采集-累计情况列表 -export const getCumSituationList = params => { - return fetch('/api/bs/hrmsalary/addUpSituation/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getCumSituationList = (params) => { + return fetch("/api/bs/hrmsalary/addUpSituation/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-累计情况列表的高级搜索 -export const getCumSituationSaCondition = params => { - return WeaTools.callApi('/api/bs/hrmsalary/addUpSituation/getSearchCondition', 'get', params); -} +export const getCumSituationSaCondition = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/addUpSituation/getSearchCondition", + "get", + params + ); +}; //数据采集-累计情况-导出 -export const exportCumSituationList = ids => { - fetch('/api/bs/hrmsalary/addUpSituation/export?ids=' + ids).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); - })) -} +export const exportCumSituationList = (ids) => { + fetch("/api/bs/hrmsalary/addUpSituation/export?ids=" + ids).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); + }) + ); +}; //数据采集-累计情况-获取导入参数 -export const getImportCumSituationParam = params => { - return WeaTools.callApi('/api/bs/hrmsalary/addUpSituation/getImportParams', 'get', params); -} +export const getImportCumSituationParam = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/addUpSituation/getImportParams", + "get", + params + ); +}; //数据采集-获取累计情况记录 -export const getCumSituationDetailList = params => { - return fetch('/api/bs/hrmsalary/addUpSituation/getDetailList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getCumSituationDetailList = (params) => { + return fetch("/api/bs/hrmsalary/addUpSituation/getDetailList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-累计情况-导出明细 -export const exportCumSituationDetailList = (id, ids="") => { - fetch('/api/bs/hrmsalary/addUpSituation/exportDetail?accumulatedSituationId='+id+'&ids=' + ids).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); - })) -} +export const exportCumSituationDetailList = (id, ids = "") => { + fetch( + "/api/bs/hrmsalary/addUpSituation/exportDetail?accumulatedSituationId=" + + id + + "&ids=" + + ids + ).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); + }) + ); +}; // 数据采集-累计情况-导入 -export const importCumSituationParam = params => { - return fetch('/api/bs/hrmsalary/addUpSituation/importAddUpSituation', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const importCumSituationParam = (params) => { + return fetch("/api/bs/hrmsalary/addUpSituation/importAddUpSituation", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; // 数据采集-累计情况-导入预览 -export const importCumSituationPreview = params => { - return fetch('/api/bs/hrmsalary/addUpSituation/preview', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} \ No newline at end of file +export const importCumSituationPreview = (params) => { + return fetch("/api/bs/hrmsalary/addUpSituation/preview", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; diff --git a/pc4mobx/hrmSalary/apis/index.js b/pc4mobx/hrmSalary/apis/index.js index ad9e15d5..854c9bf6 100644 --- a/pc4mobx/hrmSalary/apis/index.js +++ b/pc4mobx/hrmSalary/apis/index.js @@ -1,22 +1,21 @@ -import { WeaTools } from 'ecCom'; +import { WeaTools } from "ecCom"; // form基础数据 -export const getBaseForm = params => { - return WeaTools.callApi('/api/demo01/getFormDemo', 'GET', params); +export const getBaseForm = (params) => { + return WeaTools.callApi("/api/demo01/getFormDemo", "GET", params); }; // form保存 -export const doSaveBaseSet = params => { - return WeaTools.callApi('/api/demo01/saveFormDemo', 'POST', params); +export const doSaveBaseSet = (params) => { + return WeaTools.callApi("/api/demo01/saveFormDemo", "POST", params); }; - // 获取高级搜索条件 -export const getCondition = params => { - return WeaTools.callApi('/api/demo03/weatableConditonDemo', 'GET', params); +export const getCondition = (params) => { + return WeaTools.callApi("/api/demo03/weatableConditonDemo", "GET", params); }; // 获取table数据 -export const getTableDatas = params => { - return WeaTools.callApi('/api/demo03/weatableDemo', 'GET', params); -}; \ No newline at end of file +export const getTableDatas = (params) => { + return WeaTools.callApi("/api/demo03/weatableDemo", "GET", params); +}; diff --git a/pc4mobx/hrmSalary/apis/otherDeduct.js b/pc4mobx/hrmSalary/apis/otherDeduct.js index 346b6c72..e74f7e66 100644 --- a/pc4mobx/hrmSalary/apis/otherDeduct.js +++ b/pc4mobx/hrmSalary/apis/otherDeduct.js @@ -1,88 +1,107 @@ -import { WeaTools } from 'ecCom'; - +import { WeaTools } from "ecCom"; //数据采集-其他免税扣除列表 -export const getOtherDeductList = params => { - return fetch('/api/bs/hrmsalary/otherDeduction/list', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getOtherDeductList = (params) => { + return fetch("/api/bs/hrmsalary/otherDeduction/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-其他免税扣除列表的高级搜索 -export const getOtherDeductSaCondition = params => { - return WeaTools.callApi('/api/bs/hrmsalary/otherDeduction/getSearchCondition', 'get', params); -} +export const getOtherDeductSaCondition = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/otherDeduction/getSearchCondition", + "get", + params + ); +}; //数据采集-其他免税扣除-获取导入参数 -export const getImportOtherDeductParam = params => { - return WeaTools.callApi('/api/bs/hrmsalary/otherDeduction/getImportParams', 'get', params); -} +export const getImportOtherDeductParam = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/otherDeduction/getImportParams", + "get", + params + ); +}; //数据采集-其他免税扣除-导出 export const exportOtherDeductList = (ids = "") => { - fetch('/api/bs/hrmsalary/otherDeduction/export?ids=' + ids).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); - })) - return WeaTools.callApi('/api/bs/hrmsalary/otherDeduction/export', 'POST', params); -} + fetch("/api/bs/hrmsalary/otherDeduction/export?ids=" + ids).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); + }) + ); + return WeaTools.callApi( + "/api/bs/hrmsalary/otherDeduction/export", + "POST", + params + ); +}; //数据采集-获取其他免税扣除记录 -export const getOtherDeductDetailList = params => { - return fetch('/api/bs/hrmsalary/otherDeduction/getDetailList', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const getOtherDeductDetailList = (params) => { + return fetch("/api/bs/hrmsalary/otherDeduction/getDetailList", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; //数据采集-其他免税扣除-导出明细 export const exportOtherDeductDetailList = (id, ids) => { - fetch('/api/bs/hrmsalary/otherDeduction/exportDetail?otherTaxExemptDeductionId='+id+'&ids=' + ids).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); - })) -} + fetch( + "/api/bs/hrmsalary/otherDeduction/exportDetail?otherTaxExemptDeductionId=" + + id + + "&ids=" + + ids + ).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); + }) + ); +}; // 数据采集-其他免税扣除-导入 -export const importOtherDeductionParam = params => { - return fetch('/api/bs/hrmsalary/otherDeduction/importData', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} - +export const importOtherDeductionParam = (params) => { + return fetch("/api/bs/hrmsalary/otherDeduction/importData", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; // 数据采集-其他免税扣除-导入预览 -export const importOtherDeductionPreview = params => { - return fetch('/api/bs/hrmsalary/otherDeduction/preview', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const importOtherDeductionPreview = (params) => { + return fetch("/api/bs/hrmsalary/otherDeduction/preview", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; diff --git a/pc4mobx/hrmSalary/apis/taxAgent.js b/pc4mobx/hrmSalary/apis/taxAgent.js index 3b2fda39..09dc15fa 100644 --- a/pc4mobx/hrmSalary/apis/taxAgent.js +++ b/pc4mobx/hrmSalary/apis/taxAgent.js @@ -1,41 +1,86 @@ -import { WeaTools } from 'ecCom'; -import { formPost } from '../util/request'; - +import { WeaTools } from "ecCom"; +import { formPost, postFetch } from "../util/request"; //个税扣缴义务人列表 -export const getTaxAgentList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxAgent/list', 'GET', params); -} +export const getTaxAgentList = (params) => { + return fetch("/api/bs/hrmsalary/taxAgent/list", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(params), + }).then((res) => res.json()); +}; + +// 系统管理员权限 +export const getPermission = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/taxAgent/permission", + "GET", + params + ); +}; //获取个税扣缴义务人表单 -export const getTaxAgentForm = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxAgent/getForm', 'get', params); -} +export const getTaxAgentForm = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/taxAgent/getForm", "get", params); +}; + +//获取个税扣缴义务人基础信息表单 +export const getTaxAgentBaseForm = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/taxAgent/base/getForm", + "get", + params + ); +}; //新建个税扣缴义务人 -export const saveTaxAgent = params => { - return formPost('/api/bs/hrmsalary/taxAgent/save', params) - // return WeaTools.callApi('/api/bs/hrmsalary/taxAgent/save', 'POST', params); -} +export const saveTaxAgent = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/save", params); +}; //编辑个税扣缴义务人 -export const updateTaxAgent = params => { - return formPost('/api/bs/hrmsalary/taxAgent/update', params) -} +export const updateTaxAgent = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/update", params); +}; +//保存个税扣缴义务人基础信息 +export const taxAgentBaseSave = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/base/save", params); +}; //删除个税扣缴义务人 -export const deleteTaxAgent = params => { - return fetch('/api/bs/hrmsalary/taxAgent/delete', { - method: 'POST', - mode: 'cors', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify(params) - }).then(res => res.json()) -} +export const deleteTaxAgent = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/delete", params); +}; + +//人员范围保存 +export const taxAgentRangeSave = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/range/save", params); +}; +//人员范围删除 +export const taxAgentRangeDelete = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/range/delete", params); +}; +//人员范围列表 +export const getTaxAgentRangeListInclude = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/range/listInclude", params); +}; +//人员范围排除列表 +export const getTaxAgentRangeListExclude = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/range/listExclude", params); +}; +//获取人员范围表单 +export const getTaxAgentRangeForm = (params) => { + return postFetch("/api/bs/hrmsalary/taxAgent/range/getForm", params); +}; //个税扣缴义务人下拉列表 -export const getTaxAgentSelectList = params => { - return WeaTools.callApi('/api/bs/hrmsalary/taxAgent/selectList', 'GET', params); -} \ No newline at end of file +export const getTaxAgentSelectList = (params) => { + return WeaTools.callApi( + "/api/bs/hrmsalary/taxAgent/selectList", + "GET", + params + ); +}; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js index 63f67d6b..31373dc9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js @@ -50,12 +50,23 @@ export default class RefereAttendFormModal extends React.Component { // 同步点击回调 handleSync() { - const { attendanceStore: {syncAttendanceRefer}} = this.props + const { attendanceStore: {syncAttendanceRefer, checkOperation}} = this.props if(!this.validate()) { return } - syncAttendanceRefer(this.state.request).then(() => { - this.props.onCancel() + const { salarySobId, salaryYearMonth:salaryYearMonthStr }=this.state.request + const payload={ + salaryYearMonthStr, + salarySobId + } + checkOperation(payload).then(({status, data, errorMsg})=>{ + if(status && data){ + syncAttendanceRefer(this.state.request).then(() => { + this.props.onCancel() + }) + }else{ + message.warning('已经核算过不可操作'); + } }) } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js index 3774fa18..6618d60b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/editSlideContent.js @@ -1,153 +1,217 @@ -import React from 'react'; -import { Row, Col, Table, DatePicker } from "antd" -import { inject, observer } from 'mobx-react'; -import { WeaInput, WeaTextarea, WeaSearchGroup, WeaSelect } from "ecCom"; -import { slideColumns} from './columns'; -import "./editSlideContent.less" -import { WeaTableNew } from "comsMobx" -const WeaTable = WeaTableNew.WeaTable; -import moment from 'moment' +import React from "react"; +import { Row, Col, Table, DatePicker } from "antd"; +import { inject, observer } from "mobx-react"; +import { + WeaInput, + WeaTextarea, + WeaSearchGroup, + WeaSelect, + WeaTable, +} from "ecCom"; +import "./editSlideContent.less"; +import moment from "moment"; const { MonthPicker } = DatePicker; - let emptyItem = { - incomeLowerLimit: "0.00", - incomeUpperLimit: "0.00", - dutyFreeValue: "0.00", - dutyFreeRate: "0.00", - taxableIncomeLl: "0.00", - taxableIncomeUl: "0.00", - taxRate: "0.00", - taxDeduction: "0.00" -} + incomeLowerLimit: "0.00", + incomeUpperLimit: "0.00", + dutyFreeValue: "0.00", + dutyFreeRate: "0.00", + taxableIncomeLl: "0.00", + taxableIncomeUl: "0.00", + taxRate: "0.00", + taxDeduction: "0.00", +}; -@inject('cumDeductStore', "taxAgentStore") +@inject("cumDeductStore", "taxAgentStore") @observer export default class EditSlideContent extends React.Component { + constructor(props) { + super(props); + this.state = { + taxAgentId: "", + startDate: "", + endDate: "", + editable: + this.props.editable === undefined ? "true" : this.props.editable, + }; + } - constructor(props) { - super(props); - this.state = { - taxAgentId: "", - startDate: "", - endDate: "", - editable: this.props.editable === undefined ? "true": this.props.editable - } + componentWillMount() { + // 初始化渲染页面 + const { + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; + fetchTaxAgentOption(); + } + + addItem() { + const { + taxRateStore: { setDataSource }, + } = this.props; + let dataSource = [...this.props.taxRateStore.dataSource]; + let indexNum = 1; + if (dataSource.length > 0) { + indexNum = dataSource[dataSource.length - 1].indexNum + 1; + } + let item = { ...emptyItem }; + item.indexNum = indexNum; + dataSource.push(item); + setDataSource(dataSource); + } + + fetchCumDeductDetailList(param) { + const { cumDeductStore } = this.props; + const { getCumDeductDetailList, currentRecord } = cumDeductStore; + getCumDeductDetailList(currentRecord.id, param); + } + + // 日期格式变化加载数据 + handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { + let declareMonth = []; + if (startDate != "" && startDate != undefined) { + declareMonth.push(startDate); } - componentWillMount() { // 初始化渲染页面 - const { taxAgentStore: { fetchTaxAgentOption } } = this.props; - fetchTaxAgentOption(); + if (endDate != "" && endDate != undefined) { + declareMonth.push(endDate); } - - addItem() { - const { taxRateStore: {setDataSource}} = this.props; - let dataSource = [...this.props.taxRateStore.dataSource]; - let indexNum = 1; - if(dataSource.length > 0) { - indexNum = dataSource[dataSource.length - 1].indexNum + 1 - } - let item = {...emptyItem} - item.indexNum = indexNum - dataSource.push(item); - setDataSource(dataSource) + let item = { + taxAgentId: taxAgentId, + }; + if (declareMonth.length != 0) { + item.declareMonth = declareMonth; } + this.fetchCumDeductDetailList(item); + } - fetchCumDeductDetailList(param) { - const { cumDeductStore} = this.props; - const { getCumDeductDetailList, currentRecord } = cumDeductStore; - getCumDeductDetailList(currentRecord.id, param); - } + onSelectChange = (val) => { + const { onChangeSlideSelectKey } = this.props; + onChangeSlideSelectKey && onChangeSlideSelectKey(val); + }; - // 日期格式变化加载数据 - handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { - let declareMonth = [] - if(startDate != "" && startDate != undefined) { - declareMonth.push(startDate); - } + render() { + const { + taxAgentStore: { taxAgentOption }, + } = this.props; + const { cumDeductStore } = this.props; + const { + slideTableStore, + currentRecord, + slideColumns, + slidePageObj, + slideTableDataSource, + setSlidePageObj, + slideLoading, + } = cumDeductStore; + const { startDate, endDate, taxAgentId } = this.state; - if(endDate != "" && endDate != undefined) { - declareMonth.push(endDate); - } - let item = { - taxAgentId: taxAgentId - } - if(declareMonth.length != 0) { - item.declareMonth = declareMonth - } - this.fetchCumDeductDetailList(item) - } + const pagination = { + total: slidePageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setSlidePageObj({ ...slidePageObj, current, pageSize }); + }, + onChange(current) { + setSlidePageObj({ + ...slidePageObj, + current, + pageSize: slidePageObj.pageSize, + }); + }, + }; + const newColumns = _.map([...slideColumns], (item) => { + if (item.dataIndex === "declareMonth") { + return { + ...item, + width: 120, + fixed: "left", + }; + } else { + return { ...item }; + } + }); + const rowSelection = { + selectedRowKeys: this.props.slideSelectedKey, + onChange: this.onSelectChange, + }; + return ( +
+ + + {currentRecord.username} + + + 申报月份 +
+
+ { + let startDate = ""; + if (v != "" && v != undefined) { + startDate = moment(v).format("YYYY-MM"); + } + this.setState({ startDate }); + this.handleFetchCumDeductDetailList( + startDate, + endDate, + taxAgentId + ); + }} + /> +
+ +
+ { + let endDate = ""; + if (v != "" && v != undefined) { + endDate = moment(v).format("YYYY-MM"); + } + this.setState({ endDate }); + this.handleFetchCumDeductDetailList( + startDate, + endDate, + taxAgentId + ); + }} + /> +
+
+ + + 个税扣缴义务人 + { + this.setState({ taxAgentId: v }); + this.handleFetchCumDeductDetailList(startDate, endDate, v); + }} + /> + +
- - render() { - const { taxAgentStore: {taxAgentOption}} = this.props; - const { cumDeductStore } = this.props; - const { slideTableStore, currentRecord } = cumDeductStore; - const { startDate, endDate, taxAgentId } = this.state; - return ( -
- - - {currentRecord.username} - - - 申报月份 -
-
- { - let startDate = ""; - if(v != "" && v!= undefined) { - startDate = moment(v).format("YYYY-MM") - } - this.setState({startDate}) - this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) - }} - /> -
- - 至 - -
- { - let endDate = "" - if(v != "" && v!= undefined) { - endDate = moment(v).format("YYYY-MM") - } - this.setState({endDate}) - this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) - }} - /> -
-
- - - 个税扣缴义务人 - { - this.setState({taxAgentId: v}) - this.handleFetchCumDeductDetailList(startDate, endDate, v) - }} - /> - -
- -
- -
-
- ) - } -} \ No newline at end of file +
+ +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index bb0a7a07..e275a0d9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -1,39 +1,41 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; - -import { Button, Table, DatePicker, Dropdown, Menu, Modal, message, Row, Col } from 'antd'; - -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaDatePicker, WeaSelect, WeaHelpfulTip, WeaSlideModal } from 'ecCom'; -import { WeaTableNew } from "comsMobx" -import moment from 'moment'; - -const WeaTable = WeaTableNew.WeaTable; - -import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../../components/customTab'; -import ContentWrapper from '../../../components/contentWrapper'; -import ImportModal from '../../../components/importModal' -import { columns, dataSource, modalColumns } from './columns'; -import { optionAddAll } from '../../../util/options' - +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Button, DatePicker, Dropdown, Menu, message, Row, Col } from "antd"; +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaDatePicker, + WeaSelect, + WeaHelpfulTip, + WeaSlideModal, + WeaTable, +} from "ecCom"; +import moment from "moment"; +import { renderNoright, getSearchs } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../../components/customTab"; +import ContentWrapper from "../../../components/contentWrapper"; +import ImportModal from "../../../components/importModal"; +import { modalColumns } from "./columns"; +import { optionAddAll } from "../../../util/options"; const { MonthPicker } = DatePicker; -import "./index.less" +import "./index.less"; -import SlideModalTitle from '../../../components/slideModalTitle'; -import EditSlideContent from './editSlideContent'; +import SlideModalTitle from "../../../components/slideModalTitle"; +import EditSlideContent from "./editSlideContent"; - -@inject('cumDeductStore', "taxAgentStore") +@inject("cumDeductStore", "taxAgentStore") @observer export default class CumDeduct extends React.Component { constructor(props) { super(props); this.state = { value: "", - selectedKey: "0", + selectedKey: [], + slideSelectedKey: [], //详情表格的选中项 visiable: false, monthValue: "", taxAgentId: "", @@ -41,24 +43,31 @@ export default class CumDeduct extends React.Component { inited: false, modalParam: { declareMonth: "", - taxAgentId: "" - } - } + taxAgentId: "", + }, + }; } - componentWillMount() { // 初始化渲染页面 - const { cumDeductStore: { doInit }, taxAgentStore: { fetchTaxAgentOption } } = this.props; + componentWillMount() { + // 初始化渲染页面 + const { + cumDeductStore: { doInit }, + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; doInit(); - fetchTaxAgentOption().then(() => { + fetchTaxAgentOption().then((res) => { this.setState({ - inited: true - }) - }) + inited: true, + }); + }); } getSearchsAdQuick() { const { monthValue, taxAgentId } = this.state; - const { taxAgentStore: { taxAgentOption }, cumDeductStore: {form, getTableDatas} } = this.props; + const { + taxAgentStore: { taxAgentOption }, + cumDeductStore: { form, getTableDatas }, + } = this.props; return (
@@ -121,94 +130,139 @@ export default class CumDeduct extends React.Component { } renderFormComponent() { - const { modalParam } = this.state - const { taxAgentStore: {taxAgentOption} } = this.props; + const { modalParam } = this.state; + const { + taxAgentStore: { taxAgentOption }, + } = this.props; return ( - - - 税款所属期 - this.setState({ modalParam: {...modalParam, declareMonth: value} })} - /> - - - 个税扣缴义务人 - { - this.setState({ modalParam: {...modalParam, taxAgentId: v} }); - }} - /> - - - ) -} + + + + 税款所属期 + + + this.setState({ + modalParam: { ...modalParam, declareMonth: value }, + }) + } + /> + + + + 个税扣缴义务人 + + { + this.setState({ modalParam: { ...modalParam, taxAgentId: v } }); + }} + /> + + + ); + } onEdit = (record) => { - const { cumDeductStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList, setCurrentRecord } } = this.props; - setSlideVisiable(true) - setCurrentRecord(record) + const { + cumDeductStore: { + slideVisiable, + setSlideVisiable, + getCumDeductDetailList, + setCurrentRecord, + }, + } = this.props; + setSlideVisiable(true); + setCurrentRecord(record); getCumDeductDetailList(record.id); } // 增加编辑功能,重写columns绑定事件 getColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { + let newColumns = ""; + newColumns = columns.map((column) => { let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { case "username": - return {this.onEdit(record)}} - >{text} + return ( + { + this.onEdit(record); + }}> + {text} + + ); case "operate": - return {this.onEdit(record)}}>查看明细 + return ( + { + this.onEdit(record); + }}> + 查看明细 + + ); default: - return
+ return
; } - } + }; return newColumn; }); return newColumns; - } + }; handleCancel() { const { cumDeductStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = cumDeductStore + const { modalVisiable, setModalVisiable, setStep } = cumDeductStore; setModalVisiable(false); setStep(0); } - onOperatesClick = (record, index, operate, flag) => { - switch(operate.index.toString()){ - case '0': // 查看明细 + switch (operate.index.toString()) { + case "0": // 查看明细 this.onEdit(record); break; } }; - showColumn = () => { - const { cumDeductStore: { tableStore } } = this.props; + const { + cumDeductStore: { tableStore }, + } = this.props; tableStore.setColSetVisible(true); tableStore.tableColSet(true); - } + }; // 初始化导入参数 handleInitModal() { - const { cumDeductStore: { setSlideDataSource, setImportResult }} = this.props; - setSlideDataSource([]) - setImportResult({}) + const { + cumDeductStore: { setSlideDataSource, setImportResult }, + } = this.props; + setSlideDataSource([]); + setImportResult({}); } + onSelectChange = (val) => { + this.setState({ + selectedKey: val, + }); + }; + handleSearch() { const { cumDeductStore:{getTableDatas} } = this.props; const { monthValue, taxAgentId } = this.state; @@ -223,98 +277,219 @@ export default class CumDeduct extends React.Component { } render() { - const { modalParam } = this.state; + const { modalParam, slideSelectedKey, monthValue, taxAgentId } = this.state; const { cumDeductStore, taxAgentStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = cumDeductStore; - const { taxAgentOption } = taxAgentStore - const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore, step, setStep, slideDataSource, importResult } = cumDeductStore - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; + const { + loading, + dataSource, + columns, + pageObj, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + previewImport, + importFile, + } = cumDeductStore; + const { taxAgentOption } = taxAgentStore; + const { + slideVisiable, + setSlideVisiable, + modalVisiable, + setModalVisiable, + slideTableStore, + step, + setStep, + slideDataSource, + importResult, + setPageObj, + } = cumDeductStore; + const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn - }, + const rightMenu = [ + // 右键菜单 + // { + // key: "BTN_COLUMN", + // icon: , + // content: "显示列定制", + // onClick: this.showColumn, + // }, ]; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + , ]; - const topTab = [ - ]; + const topTab = []; const renderSearchOperationItem = () => { - return
- } + return
; + }; const handleButtonClick = () => { - const { cumDeductStore: {exportCumDeductList}} = this.props; + const { + cumDeductStore: { exportCumDeductList }, + } = this.props; exportCumDeductList(); - } + }; const handleMenuClick = () => { - if(selectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (this.state.selectedKey.length == 0) { + message.warning("未选择条目"); + return; } - const { cumDeductStore: { exportCumDeductList } } = this.props; - exportCumDeductList(selectedRowKeys.join(",")) - } + const { + cumDeductStore: { exportCumDeductList }, + } = this.props; + exportCumDeductList(this.state.selectedKey.join(",")); + }; const handleBtnImport = () => { - const { cumDeductStore: { setModalVisiable, setStep } } = this.props; + const { + cumDeductStore: { setModalVisiable, setStep }, + } = this.props; setStep(0); - setModalVisiable(true) - } - - + setModalVisiable(true); + }; const btns = [ - , - - 导出选中 - - } type="ghost"> + , + + 导出选中 + + } + type="ghost"> 导出全部 - - ] + , + ]; const handleExportAllDetailClick = () => { - const {cumDeductStore: {exportCumDeductDetailList, currentRecord} } =this.props; + const { + cumDeductStore: { exportCumDeductDetailList, currentRecord }, + } = this.props; exportCumDeductDetailList(currentRecord.id); - } + }; const handleExportSelectedDetailClick = () => { - if(detailSelectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (this.state.slideSelectedKey.length == 0) { + message.warning("未选择条目"); + return; } - const { cumDeductStore: { exportCumDeductDetailList, currentRecord } } = this.props; - exportCumDeductDetailList(currentRecord.id, detailSelectedRowKeys.join(",")) - } + const { + cumDeductStore: { exportCumDeductDetailList, currentRecord }, + } = this.props; + exportCumDeductDetailList( + currentRecord.id, + this.state.slideSelectedKey.join(",") + ); + }; const renderBtns = () => { return ( - - 导出选中 - - } type="ghost"> + + 导出选中 + + } + type="ghost"> 导出全部 - - ) - } + + ); + }; + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); + }, + onChange(current) { + setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); + }, + }; + const rowSelection = { + selectedRowKeys: this.state.selectedKey, + onChange: this.onSelectChange, + }; + const newColumns = _.map([...columns], (item) => { + if (item.dataIndex === "username") { + return { + ...item, + width: 100, + fixed: "left", + render: (text, record) => ( + + ), + }; + } else if (item.dataIndex === "taxAgentName") { + return { + ...item, + width: 180, + fixed: "left", + }; + } else if (item.dataIndex === "operate") { + return { + ...item, + width: 100, + fixed: "right", + render: (text, record) => ( + + ), + }; + } else { + return { ...item }; + } + }); return (
@@ -323,39 +498,39 @@ export default class CumDeduct extends React.Component { > } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) - buttons={btns} - > - + buttons={btns}>
setShowSearchAd(bool)} //高级搜索面板受控 + setShowSearchAd={(bool) => setShowSearchAd(bool)} //高级搜索面板受控 searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 buttonsAd={adBtn} // 高级搜索内部按钮 onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 + onSearchChange={(v) => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 />
-
- { - modalVisiable && { - this.handleInitModal() + this.handleInitModal(); }} params={modalParam} columns={modalColumns} @@ -363,40 +538,59 @@ export default class CumDeduct extends React.Component { setStep={setStep} slideDataSource={slideDataSource} importResult={importResult} - onFinish={() => {setModalVisiable(false); setStep(0); doSearch();}} - previewImport={(params) => {previewImport(params)}} - importFile={(params) => {importFile(params)}} + onFinish={() => { + setModalVisiable(false); + setStep(0); + doSearch(); + }} + previewImport={(params) => { + previewImport(params); + }} + importFile={(params) => { + importFile(params); + }} templateLink={"/api/bs/hrmsalary/addUpDeduction/downloadTemplate"} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { this.handleCancel() }} - /> - } - - { - slideVisiable && {this.state.currentOperate == "add" ? doSave() : doUpdate()}} - editable={false} - btns={ - renderBtns() - } - /> - } - content={()} - onClose={() => setSlideVisiable(false)} - showMask={true} - closeMaskOnClick={() => setSlideVisiable(false)} /> - } + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { + this.handleCancel(); + }} + /> + )} + + {slideVisiable && ( + { + this.state.currentOperate == "add" ? doSave() : doUpdate(); + }} + editable={false} + btns={renderBtns()} + /> + } + content={ + + this.setState({ slideSelectedKey: val }) + } + /> + } + onClose={() => setSlideVisiable(false)} + showMask={true} + closeMaskOnClick={() => setSlideVisiable(false)} + /> + )}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less index 9663398d..ef51e77f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.less @@ -1,31 +1,47 @@ .cumDeductWrapper { - .weaTabWrapper { - position: relative; - .searchConditionWrapper { - width: 600px; - margin-left: 10px; - margin-top: 8px; - } - .searchConditionItem { - float: left; - } - .conditionFormLabel { - margin-right: 10px; - } - .helperWrapper { - float: left; - margin-left: 10px; - margin-right: 10px; - margin-top: 6px; - } + .weaTabWrapper { + position: relative; + + .searchConditionWrapper { + width: 600px; + margin-left: 10px; + margin-top: 8px; } - .wea-tab-search-ad-quick { - .wea-tab-right-search-ad-quick { - margin-top: 0px; - } - .wea-search-container-search-ad-quick { - top: 46px; - } + .searchConditionItem { + float: left; } + + .conditionFormLabel { + margin-right: 10px; + } + + .helperWrapper { + float: left; + margin-left: 10px; + margin-right: 10px; + margin-top: 6px; + } + } + + .wea-tab-search-ad-quick { + .wea-tab-right-search-ad-quick { + margin-top: 0px; + } + + .wea-search-container-search-ad-quick { + top: 46px; + } + } + + .linkWapper { + a { + color: #4d7ad8; + } + + a:hover { + text-decoration: none; + } + } + } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js index 2fe86804..863f5cdc 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/editSlideContent.js @@ -1,156 +1,222 @@ -import React from 'react'; -import { Row, Col, Table, DatePicker } from "antd" -import { inject, observer } from 'mobx-react'; -import { WeaInput, WeaTextarea, WeaSearchGroup, WeaSelect } from "ecCom"; -import { slideColumns} from './columns'; -import "./editSlideContent.less" -import { WeaTableNew } from "comsMobx" -const WeaTable = WeaTableNew.WeaTable; -import moment from 'moment' +import React from "react"; +import { Row, Col, Table, DatePicker } from "antd"; +import { inject, observer } from "mobx-react"; +import { + WeaInput, + WeaTextarea, + WeaSearchGroup, + WeaSelect, + WeaTable, +} from "ecCom"; +import { slideColumns } from "./columns"; +import "./editSlideContent.less"; +import moment from "moment"; const { MonthPicker } = DatePicker; - let emptyItem = { - incomeLowerLimit: "0.00", - incomeUpperLimit: "0.00", - dutyFreeValue: "0.00", - dutyFreeRate: "0.00", - taxableIncomeLl: "0.00", - taxableIncomeUl: "0.00", - taxRate: "0.00", - taxDeduction: "0.00" -} + incomeLowerLimit: "0.00", + incomeUpperLimit: "0.00", + dutyFreeValue: "0.00", + dutyFreeRate: "0.00", + taxableIncomeLl: "0.00", + taxableIncomeUl: "0.00", + taxRate: "0.00", + taxDeduction: "0.00", +}; -@inject('cumSituationStore', "taxAgentStore") +@inject("cumSituationStore", "taxAgentStore") @observer export default class EditSlideContent extends React.Component { - constructor(props) { - super(props); - this.state = { - taxAgentId: "", - startDate: "", - endDate: "", - editable: this.props.editable === undefined ? "true": this.props.editable - } + constructor(props) { + super(props); + this.state = { + taxAgentId: "", + startDate: "", + endDate: "", + editable: + this.props.editable === undefined ? "true" : this.props.editable, + }; + } + + componentWillMount() { + // 初始化渲染页面 + const { + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; + fetchTaxAgentOption(); + } + + addItem() { + const { + taxRateStore: { setDataSource }, + } = this.props; + let dataSource = [...this.props.taxRateStore.dataSource]; + let indexNum = 1; + if (dataSource.length > 0) { + indexNum = dataSource[dataSource.length - 1].indexNum + 1; + } + let item = { ...emptyItem }; + item.indexNum = indexNum; + dataSource.push(item); + setDataSource(dataSource); + } + + fetchCumDeductDetailList(param) { + const { cumSituationStore } = this.props; + const { getCumDeductDetailList, currentRecord } = cumSituationStore; + getCumDeductDetailList(currentRecord.id, param); + } + + // 日期格式变化加载数据 + handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { + let declareMonth = []; + if (startDate != "" && startDate != undefined) { + declareMonth.push(startDate); } - componentWillMount() { // 初始化渲染页面 - const { taxAgentStore: { fetchTaxAgentOption } } = this.props; - fetchTaxAgentOption(); + if (endDate != "" && endDate != undefined) { + declareMonth.push(endDate); } - - addItem() { - const { taxRateStore: {setDataSource}} = this.props; - let dataSource = [...this.props.taxRateStore.dataSource]; - let indexNum = 1; - if(dataSource.length > 0) { - indexNum = dataSource[dataSource.length - 1].indexNum + 1 - } - let item = {...emptyItem} - item.indexNum = indexNum - dataSource.push(item); - setDataSource(dataSource) + let item = { + taxAgentId: taxAgentId, + }; + if (declareMonth.length != 0) { + item.taxYearMonth = declareMonth; } + this.fetchCumDeductDetailList(item); + } - fetchCumDeductDetailList(param) { - const { cumSituationStore} = this.props; - const { getCumDeductDetailList, currentRecord } = cumSituationStore; - getCumDeductDetailList(currentRecord.id, param); - } + onSelectChange = (val) => { + const { onChangeSlideSelectKey } = this.props; + onChangeSlideSelectKey && onChangeSlideSelectKey(val); + }; + render() { + const { + taxAgentStore: { taxAgentOption }, + } = this.props; + const { cumSituationStore } = this.props; + const { + slideTableStore, + currentRecord, + slideColumns, + slidePageObj, + slideTableDataSource, + setSlidePageObj, + slideLoading, + } = cumSituationStore; + const { startDate, endDate, taxAgentId } = this.state; - // 日期格式变化加载数据 - handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { - let declareMonth = [] - if(startDate != "" && startDate != undefined) { - declareMonth.push(startDate); - } + const pagination = { + total: slidePageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setSlidePageObj({ ...slidePageObj, current, pageSize }); + }, + onChange(current) { + setSlidePageObj({ + ...slidePageObj, + current, + pageSize: slidePageObj.pageSize, + }); + }, + }; + const newColumns = _.map([...slideColumns], (item) => { + if (item.dataIndex === "declareMonth") { + return { + ...item, + width: 120, + fixed: "left", + }; + } else { + return { ...item }; + } + }); + const rowSelection = { + selectedRowKeys: this.props.slideSelectedKey, + onChange: this.onSelectChange, + }; + return ( +
+ + + {currentRecord.username} + + + 申报月份 +
+
+ { + let startDate = ""; + if (v != "" && v != undefined) { + startDate = moment(v).format("YYYY-MM"); + } + this.setState({ startDate }); + this.handleFetchCumDeductDetailList( + startDate, + endDate, + taxAgentId + ); + }} + /> +
+ +
+ { + let endDate = ""; + if (v != "" && v != undefined) { + endDate = moment(v).format("YYYY-MM"); + } + this.setState({ endDate }); + this.handleFetchCumDeductDetailList( + startDate, + endDate, + taxAgentId + ); + }} + /> +
+
+ + + 个税扣缴义务人 + { + this.setState({ taxAgentId: v }); + this.fetchCumDeductDetailList({ + declareMonth: [startDate, endDate], + taxAgentId: v, + }); + }} + /> + +
- if(endDate != "" && endDate != undefined) { - declareMonth.push(endDate); - } - let item = { - taxAgentId: taxAgentId - } - if(declareMonth.length != 0) { - item.taxYearMonth = declareMonth - } - this.fetchCumDeductDetailList(item) - } - - - render() { - const { taxAgentStore: {taxAgentOption}} = this.props; - const { cumSituationStore } = this.props; - const { slideTableStore, currentRecord } = cumSituationStore; - const { startDate, endDate, taxAgentId } = this.state; - return ( -
- - - {currentRecord.username} - - - 申报月份 -
-
- { - let startDate = ""; - if(v != "" && v!= undefined) { - startDate = moment(v).format("YYYY-MM") - } - this.setState({startDate}) - this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) - }} - /> -
- - 至 - -
- { - let endDate = "" - if(v != "" && v!= undefined) { - endDate = moment(v).format("YYYY-MM") - } - this.setState({endDate}) - this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) - }} - /> -
-
- - - 个税扣缴义务人 - { - this.setState({taxAgentId: v}) - this.fetchCumDeductDetailList({ - declareMonth: [startDate, endDate], - taxAgentId: v - }) - }} - /> - -
- -
- -
-
- ) - } -} \ No newline at end of file +
+ +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index ba6f15b5..a910fd64 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -1,62 +1,85 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; -import { Button, Table, DatePicker, Dropdown, Menu, Modal, message, Row, Col } from 'antd'; +import { + Button, + Table, + DatePicker, + Dropdown, + Menu, + Modal, + message, + Row, + Col, +} from "antd"; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaDatePicker, WeaSelect, WeaHelpfulTip, WeaSlideModal } from 'ecCom'; -import { WeaTableNew } from "comsMobx" -import moment from 'moment'; - -const WeaTable = WeaTableNew.WeaTable; - -import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../../components/customTab'; -import ContentWrapper from '../../../components/contentWrapper'; -import ImportModal from '../../../components/importModal' -import { columns, dataSource, modalColumns } from './columns'; -import { optionAddAll } from '../../../util/options'; +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaRangePicker, + WeaDatePicker, + WeaSelect, + WeaHelpfulTip, + WeaSlideModal, + WeaTable, +} from "ecCom"; +import moment from "moment"; +import { renderNoright, getSearchs } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../../components/customTab"; +import ContentWrapper from "../../../components/contentWrapper"; +import ImportModal from "../../../components/importModal"; +import { modalColumns } from "./columns"; +import { optionAddAll } from "../../../util/options"; const { MonthPicker } = DatePicker; -import "./index.less" +import "./index.less"; -import SlideModalTitle from '../../../components/slideModalTitle'; -import EditSlideContent from './editSlideContent'; +import SlideModalTitle from "../../../components/slideModalTitle"; +import EditSlideContent from "./editSlideContent"; - -@inject('cumSituationStore', "taxAgentStore") +@inject("cumSituationStore", "taxAgentStore") @observer export default class CumSituation extends React.Component { constructor(props) { super(props); this.state = { value: "", - selectedKey: "0", + selectedKey: [], + slideSelectedKey: [], //详情表格的选中项 visiable: false, inited: false, monthValue: "", taxAgentId: "", modalParam: { taxYearMonth: "", - } - } + }, + }; } - componentWillMount() { // 初始化渲染页面 - const { cumSituationStore: { doInit }, taxAgentStore: { fetchTaxAgentOption } } = this.props; + componentWillMount() { + // 初始化渲染页面 + const { + cumSituationStore: { doInit }, + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; doInit(); fetchTaxAgentOption().then(() => { this.setState({ - inited: true - }) - }) + inited: true, + }); + }); } getSearchsAdQuick() { const { monthValue, taxAgentId } = this.state; - const { taxAgentStore: { taxAgentOption }, cumSituationStore: {form, getTableDatas} } = this.props; + const { + taxAgentStore: { taxAgentOption }, + cumSituationStore: { form, getTableDatas }, + } = this.props; return (
@@ -119,84 +142,124 @@ export default class CumSituation extends React.Component { renderFormComponent() { - const { modalParam } = this.state - const { taxAgentStore: {taxAgentOption} } = this.props; + const { modalParam } = this.state; + const { + taxAgentStore: { taxAgentOption }, + } = this.props; return ( - - - 税款所属期 - this.setState({ modalParam: {taxYearMonth: value} })} - /> - - - ) + + + + 税款所属期 + + + this.setState({ modalParam: { taxYearMonth: value } }) + } + /> + + + ); } onEdit = (record) => { - const { cumSituationStore: { slideVisiable, setSlideVisiable, getCumDeductDetailList, setCurrentRecord } } = this.props; - setSlideVisiable(true) - setCurrentRecord(record) + const { + cumSituationStore: { + slideVisiable, + setSlideVisiable, + getCumDeductDetailList, + setCurrentRecord, + }, + } = this.props; + setSlideVisiable(true); + setCurrentRecord(record); getCumDeductDetailList(record.id); - } + }; // 增加编辑功能,重写columns绑定事件 getColumns = (columns) => { let newColumns = []; - if(!columns) { - return [] + if (!columns) { + return []; } - newColumns = columns.map(column => { + newColumns = columns.map((column) => { let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { case "username": - return {this.onEdit(record)}} - dangerouslySetInnerHTML={{ __html: valueSpan }} /> + return ( + { + this.onEdit(record); + }} + dangerouslySetInnerHTML={{ __html: valueSpan }} + /> + ); case "operate": - return {this.onEdit(record)}}>查看明细 + return ( + { + this.onEdit(record); + }}> + 查看明细 + + ); default: - return
+ return
; } - } + }; return newColumn; }); - console.log("newColumns: ", newColumns); return newColumns; - } - + }; handleCancel() { const { cumSituationStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = cumSituationStore + const { modalVisiable, setModalVisiable, setStep } = cumSituationStore; setModalVisiable(false); setStep(0); } onOperatesClick = (record, index, operate, flag) => { - switch(operate.index.toString()){ - case '0': // 查看明细 + switch (operate.index.toString()) { + case "0": // 查看明细 this.onEdit(record); break; } }; showColumn = () => { - const { cumSituationStore: { tableStore } } = this.props; + const { + cumSituationStore: { tableStore }, + } = this.props; tableStore.setColSetVisible(true); tableStore.tableColSet(true); - } + }; // 导入参数初始化 handleInitImport = () => { - const { cumSituationStore: { setSlideDataSource, setImportResult } } = this.props; - setSlideDataSource([]) - setImportResult({}) - } + const { + cumSituationStore: { setSlideDataSource, setImportResult }, + } = this.props; + setSlideDataSource([]); + setImportResult({}); + }; + + onSelectChange = (val) => { + this.setState({ + selectedKey: val, + }); + }; // 搜索 handleSearch() { @@ -213,104 +276,226 @@ export default class CumSituation extends React.Component { } render() { - const { cumSituationStore, taxAgentStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = cumSituationStore; - const { taxAgentOption } = taxAgentStore - const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore, step, setStep, slideDataSource, importResult } = cumSituationStore - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - const { modalParam } = this.state; + const { cumSituationStore, taxAgentStore, slideSelectedKey } = this.props; + const { + loading, + dataSource, + columns, + pageObj, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + previewImport, + importFile, + } = cumSituationStore; + const { taxAgentOption } = taxAgentStore; + const { + slideVisiable, + setSlideVisiable, + modalVisiable, + setModalVisiable, + slideTableStore, + step, + setStep, + slideDataSource, + importResult, + setPageObj, + } = cumSituationStore; + const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; + const { modalParam, monthValue, taxAgentId } = this.state; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn - }, + const rightMenu = [ + // 右键菜单 + // { + // key: "BTN_COLUMN", + // icon: , + // content: "显示列定制", + // onClick: this.showColumn, + // }, ]; - const collectParams = { // 收藏功能配置 - favname: '往期累计情况(工资、薪金)', + const collectParams = { + // 收藏功能配置 + favname: "往期累计情况(工资、薪金)", favouritetype: 1, objid: 0, - link: 'wui/index.html#/ns_demo03/index', + link: "wui/index.html#/ns_demo03/index", importantlevel: 1, }; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + , ]; - const topTab = [ - ]; + const topTab = []; const renderSearchOperationItem = () => { - return
- } + return
; + }; const handleButtonClick = () => { - const { cumSituationStore: {exportCumDeductList}} = this.props; + const { + cumSituationStore: { exportCumDeductList }, + } = this.props; exportCumDeductList(); - } + }; const handleMenuClick = () => { - if(selectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return; } - const { cumSituationStore: { exportCumDeductList } } = this.props; - exportCumDeductList(selectedRowKeys.join(",")) - } + const { + cumSituationStore: { exportCumDeductList }, + } = this.props; + exportCumDeductList(selectedRowKeys.join(",")); + }; const handleBtnImport = () => { - const { cumSituationStore: { setModalVisiable, setStep } } = this.props; + const { + cumSituationStore: { setModalVisiable, setStep }, + } = this.props; setStep(0); - setModalVisiable(true) - } - - + setModalVisiable(true); + }; const btns = [ - , - - 导出选中 - - } type="ghost"> + , + + 导出选中 + + } + type="ghost"> 导出全部 - - ] + , + ]; const handleExportAllDetailClick = () => { - const {cumSituationStore: {exportCumSituationDetailList, currentRecord} } =this.props; + const { + cumSituationStore: { exportCumSituationDetailList, currentRecord }, + } = this.props; exportCumSituationDetailList(currentRecord.id); - } + }; const handleExportSelectedDetailClick = () => { - if(detailSelectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (this.state.slideSelectedKey.length == 0) { + message.warning("未选择条目"); + return; } - const { cumSituationStore: { exportCumSituationDetailList, currentRecord } } = this.props; - exportCumSituationDetailList(currentRecord.id, detailSelectedRowKeys.join(",")) - } + const { + cumSituationStore: { exportCumSituationDetailList, currentRecord }, + } = this.props; + exportCumSituationDetailList( + currentRecord.id, + this.state.slideSelectedKey.join(",") + ); + }; const renderBtns = () => { return ( - - 导出选中 - - } type="ghost"> + + 导出选中 + + } + type="ghost"> 导出全部 - - ) - } + + ); + }; + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); + }, + onChange(current) { + setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); + }, + }; + const rowSelection = { + selectedRowKeys: this.state.selectedKey, + onChange: this.onSelectChange, + }; + const newColumns = _.map([...columns], (item) => { + if (item.dataIndex === "username") { + return { + ...item, + width: 100, + fixed: "left", + render: (text, record) => ( + + ), + }; + } else if (item.dataIndex === "taxAgentName") { + return { + ...item, + width: 180, + fixed: "left", + }; + } else if (item.dataIndex === "operate") { + return { + ...item, + width: 100, + fixed: "right", + render: (text, record) => ( + + ), + }; + } else { + return { ...item, width: 150 }; + } + }); return (
@@ -319,19 +504,17 @@ export default class CumSituation extends React.Component { > } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - buttons={btns} - > - + buttons={btns}>
setShowSearchAd(bool)} //高级搜索面板受控 + setShowSearchAd={(bool) => setShowSearchAd(bool)} //高级搜索面板受控 searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 buttonsAd={adBtn} // 高级搜索内部按钮 onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 @@ -340,59 +523,80 @@ export default class CumSituation extends React.Component { searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 />
-
- { - modalVisiable && { - this.handleInitImport() + this.handleInitImport(); }} templateLink={"/api/bs/hrmsalary/addUpSituation/downloadTemplate"} params={modalParam} columns={modalColumns} step={step} setStep={setStep} - onFinish={() => {setModalVisiable(false); setStep(0); doSearch();}} + onFinish={() => { + setModalVisiable(false); + setStep(0); + doSearch(); + }} slideDataSource={slideDataSource} importResult={importResult} - previewImport={(params) => {previewImport(params)}} - importFile={(params) => {importFile(params)}} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { this.handleCancel() }} /> - } - { - slideVisiable && {this.state.currentOperate == "add" ? doSave() : doUpdate()}} - editable={false} - btns={ - renderBtns() - } - /> - } - content={()} - onClose={() => setSlideVisiable(false)} - showMask={true} - closeMaskOnClick={() => setSlideVisiable(false)} /> - } + previewImport={(params) => { + previewImport(params); + }} + importFile={(params) => { + importFile(params); + }} + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { + this.handleCancel(); + }} + /> + )} + {slideVisiable && ( + { + this.state.currentOperate == "add" ? doSave() : doUpdate(); + }} + editable={false} + btns={renderBtns()} + /> + } + content={ + + this.setState({ slideSelectedKey: val }) + } + /> + } + onClose={() => setSlideVisiable(false)} + showMask={true} + closeMaskOnClick={() => setSlideVisiable(false)} + /> + )}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js index 58f3ca02..15cfaf74 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/editSlideContent.js @@ -1,153 +1,218 @@ -import React from 'react'; -import { Row, Col, Table, DatePicker } from "antd" -import { inject, observer } from 'mobx-react'; -import { WeaInput, WeaTextarea, WeaSearchGroup, WeaSelect } from "ecCom"; -import { slideColumns} from './columns'; -import "./editSlideContent.less" -import { WeaTableNew } from "comsMobx" -const WeaTable = WeaTableNew.WeaTable; -import moment from 'moment' +import React from "react"; +import { Row, Col, Table, DatePicker } from "antd"; +import { inject, observer } from "mobx-react"; +import { + WeaInput, + WeaTextarea, + WeaSearchGroup, + WeaSelect, + WeaTable, +} from "ecCom"; +import "./editSlideContent.less"; +import moment from "moment"; const { MonthPicker } = DatePicker; - let emptyItem = { - incomeLowerLimit: "0.00", - incomeUpperLimit: "0.00", - dutyFreeValue: "0.00", - dutyFreeRate: "0.00", - taxableIncomeLl: "0.00", - taxableIncomeUl: "0.00", - taxRate: "0.00", - taxDeduction: "0.00" -} + incomeLowerLimit: "0.00", + incomeUpperLimit: "0.00", + dutyFreeValue: "0.00", + dutyFreeRate: "0.00", + taxableIncomeLl: "0.00", + taxableIncomeUl: "0.00", + taxRate: "0.00", + taxDeduction: "0.00", +}; -@inject('otherDeductStore', "taxAgentStore") +@inject("otherDeductStore", "taxAgentStore") @observer export default class EditSlideContent extends React.Component { + constructor(props) { + super(props); + this.state = { + taxAgentId: "", + startDate: "", + endDate: "", + editable: + this.props.editable === undefined ? "true" : this.props.editable, + }; + } - constructor(props) { - super(props); - this.state = { - taxAgentId: "", - startDate: "", - endDate: "", - editable: this.props.editable === undefined ? "true": this.props.editable - } + componentWillMount() { + // 初始化渲染页面 + const { + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; + fetchTaxAgentOption(); + } + + addItem() { + const { + taxRateStore: { setDataSource }, + } = this.props; + let dataSource = [...this.props.taxRateStore.dataSource]; + let indexNum = 1; + if (dataSource.length > 0) { + indexNum = dataSource[dataSource.length - 1].indexNum + 1; + } + let item = { ...emptyItem }; + item.indexNum = indexNum; + dataSource.push(item); + setDataSource(dataSource); + } + + fetchCumDeductDetailList(param) { + const { otherDeductStore } = this.props; + const { getOtherDeductDetailList, currentRecord } = otherDeductStore; + getOtherDeductDetailList(currentRecord.id, param); + } + + // 日期格式变化加载数据 + handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { + let declareMonth = []; + if (startDate != "" && startDate != undefined) { + declareMonth.push(startDate); } - componentWillMount() { // 初始化渲染页面 - const { taxAgentStore: { fetchTaxAgentOption } } = this.props; - fetchTaxAgentOption(); + if (endDate != "" && endDate != undefined) { + declareMonth.push(endDate); } - - addItem() { - const { taxRateStore: {setDataSource}} = this.props; - let dataSource = [...this.props.taxRateStore.dataSource]; - let indexNum = 1; - if(dataSource.length > 0) { - indexNum = dataSource[dataSource.length - 1].indexNum + 1 - } - let item = {...emptyItem} - item.indexNum = indexNum - dataSource.push(item); - setDataSource(dataSource) + let item = { + taxAgentId: taxAgentId, + }; + if (declareMonth.length != 0) { + item.declareMonth = declareMonth; } + this.fetchCumDeductDetailList(item); + } - fetchCumDeductDetailList(param) { - const { otherDeductStore} = this.props; - const { getOtherDeductDetailList, currentRecord } = otherDeductStore; - getOtherDeductDetailList(currentRecord.id, param); - } + onSelectChange = (val) => { + const { onChangeSlideSelectKey } = this.props; + onChangeSlideSelectKey && onChangeSlideSelectKey(val); + }; - // 日期格式变化加载数据 - handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) { - let declareMonth = [] - if(startDate != "" && startDate != undefined) { - declareMonth.push(startDate); - } + render() { + const { + taxAgentStore: { taxAgentOption }, + } = this.props; + const { otherDeductStore } = this.props; + const { + slideTableStore, + currentRecord, + slideColumns, + slidePageObj, + slideTableDataSource, + setSlidePageObj, + slideLoading, + } = otherDeductStore; + const { startDate, endDate, taxAgentId } = this.state; - if(endDate != "" && endDate != undefined) { - declareMonth.push(endDate); - } - let item = { - taxAgentId: taxAgentId - } - if(declareMonth.length != 0) { - item.declareMonth = declareMonth - } - this.fetchCumDeductDetailList(item) - } + const pagination = { + total: slidePageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setSlidePageObj({ ...slidePageObj, current, pageSize }); + }, + onChange(current) { + setSlidePageObj({ + ...slidePageObj, + current, + pageSize: slidePageObj.pageSize, + }); + }, + }; + const newColumns = _.map([...slideColumns], (item) => { + if (item.dataIndex === "declareMonth") { + return { + ...item, + width: 120, + fixed: "left", + }; + } else { + return { ...item }; + } + }); + const rowSelection = { + selectedRowKeys: this.props.slideSelectedKey, + onChange: this.onSelectChange, + }; + return ( +
+ + + {currentRecord.username} + + + 申报月份 +
+
+ { + let startDate = ""; + if (v != "" && v != undefined) { + startDate = moment(v).format("YYYY-MM"); + } + this.setState({ startDate }); + this.handleFetchCumDeductDetailList( + startDate, + endDate, + taxAgentId + ); + }} + /> +
+ +
+ { + let endDate = ""; + if (v != "" && v != undefined) { + endDate = moment(v).format("YYYY-MM"); + } + this.setState({ endDate }); + this.handleFetchCumDeductDetailList( + startDate, + endDate, + taxAgentId + ); + }} + /> +
+
+ + + 个税扣缴义务人 + { + this.setState({ taxAgentId: v }); + this.handleFetchCumDeductDetailList(startDate, endDate, v); + }} + /> + +
- - render() { - const { taxAgentStore: {taxAgentOption}} = this.props; - const { otherDeductStore } = this.props; - const { slideTableStore, currentRecord } = otherDeductStore; - const { startDate, endDate, taxAgentId } = this.state; - return ( -
- - - {currentRecord.username} - - - 申报月份 -
-
- { - let startDate = ""; - if(v != "" && v!= undefined) { - startDate = moment(v).format("YYYY-MM") - } - this.setState({startDate}) - this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) - }} - /> -
- - 至 - -
- { - let endDate = "" - if(v != "" && v!= undefined) { - endDate = moment(v).format("YYYY-MM") - } - this.setState({endDate}) - this.handleFetchCumDeductDetailList(startDate, endDate, taxAgentId) - }} - /> -
-
- - - 个税扣缴义务人 - { - this.setState({taxAgentId: v}) - this.handleFetchCumDeductDetailList(startDate, endDate, v) - }} - /> - -
- -
- -
-
- ) - } -} \ No newline at end of file +
+ +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index ef7eb43f..444c9af0 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -1,62 +1,82 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; - -import { Button, Table, DatePicker, Dropdown, Menu, Modal, message, Row, Col } from 'antd'; - -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaDatePicker, WeaSelect, WeaHelpfulTip, WeaSlideModal } from 'ecCom'; -import { WeaTableNew } from "comsMobx" -import moment from 'moment'; - -const WeaTable = WeaTableNew.WeaTable; - -import { renderNoright, getSearchs } from '../../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../../components/customTab'; -import ContentWrapper from '../../../components/contentWrapper'; -import ImportModal from '../../../components/importModal' -import { columns, dataSource, modalColumns } from './columns'; - +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { + Button, + Table, + DatePicker, + Dropdown, + Menu, + Modal, + message, + Row, + Col, +} from "antd"; +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaRangePicker, + WeaDatePicker, + WeaSelect, + WeaHelpfulTip, + WeaSlideModal, + WeaTable, +} from "ecCom"; +import moment from "moment"; +import { renderNoright, getSearchs } from "../../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../../components/customTab"; +import ContentWrapper from "../../../components/contentWrapper"; +import ImportModal from "../../../components/importModal"; +import { modalColumns } from "./columns"; const { MonthPicker } = DatePicker; -import "./index.less" +import "./index.less"; -import SlideModalTitle from '../../../components/slideModalTitle'; -import EditSlideContent from './editSlideContent'; -import { optionAddAll } from '../../../util/options'; +import SlideModalTitle from "../../../components/slideModalTitle"; +import EditSlideContent from "./editSlideContent"; +import { optionAddAll } from "../../../util/options"; - -@inject('otherDeductStore', "taxAgentStore") +@inject("otherDeductStore", "taxAgentStore") @observer export default class OtherDeduct extends React.Component { constructor(props) { super(props); this.state = { value: "", - selectedKey: "0", + selectedKey: [], + slideSelectedKey: [], //详情表格的选中项 visiable: false, monthValue: "", taxAgentId: "", inited: false, modalParam: { declareMonth: "", - } - } + }, + }; } - componentWillMount() { // 初始化渲染页面 - const { otherDeductStore: { doInit }, taxAgentStore: { fetchTaxAgentOption } } = this.props; + componentWillMount() { + // 初始化渲染页面 + const { + otherDeductStore: { doInit }, + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; doInit(); fetchTaxAgentOption().then(() => { this.setState({ - inited: true - }) - }) + inited: true, + }); + }); } getSearchsAdQuick() { const { monthValue, taxAgentId } = this.state; - const { taxAgentStore: { taxAgentOption }, otherDeductStore: {form, getTableDatas} } = this.props; + const { + taxAgentStore: { taxAgentOption }, + otherDeductStore: { form, getTableDatas }, + } = this.props; return (
@@ -118,81 +138,121 @@ export default class OtherDeduct extends React.Component { } onEdit = (record) => { - const { otherDeductStore: { slideVisiable, setSlideVisiable, getOtherDeductDetailList, setCurrentRecord } } = this.props; - setSlideVisiable(true) - setCurrentRecord(record) + const { + otherDeductStore: { + slideVisiable, + setSlideVisiable, + getOtherDeductDetailList, + setCurrentRecord, + }, + } = this.props; + setSlideVisiable(true); + setCurrentRecord(record); getOtherDeductDetailList(record.id); - } + }; // 增加编辑功能,重写columns绑定事件 getColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { + let newColumns = ""; + newColumns = columns.map((column) => { let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { case "username": - return {this.onEdit(record)}} - dangerouslySetInnerHTML={{ __html: valueSpan }} /> + return ( + { + this.onEdit(record); + }} + dangerouslySetInnerHTML={{ __html: valueSpan }} + /> + ); case "operate": - return {this.onEdit(record)}}>查看明细 + return ( + { + this.onEdit(record); + }}> + 查看明细 + + ); default: - return
+ return
; } - } + }; return newColumn; }); return newColumns; - } + }; handleCancel() { const { otherDeductStore } = this.props; - const { modalVisiable, setModalVisiable, setStep } = otherDeductStore + const { modalVisiable, setModalVisiable, setStep } = otherDeductStore; setModalVisiable(false); setStep(0); } - onOperatesClick = (record, index, operate, flag) => { - switch(operate.index.toString()){ - case '0': // 查看明细 + switch (operate.index.toString()) { + case "0": // 查看明细 this.onEdit(record); break; } }; renderFormComponent() { - const { modalParam } = this.state - const { taxAgentStore: {taxAgentOption} } = this.props; + const { modalParam } = this.state; + const { + taxAgentStore: { taxAgentOption }, + } = this.props; return ( - - - 税款所属期 - this.setState({ modalParam: {declareMonth: value} })} - /> - - - - ) + + + + 税款所属期 + + + this.setState({ modalParam: { declareMonth: value } }) + } + /> + + + ); } showColumn = () => { - const { otherDeductStore: { tableStore } } = this.props; + const { + otherDeductStore: { tableStore }, + } = this.props; tableStore.setColSetVisible(true); tableStore.tableColSet(true); - } + }; // 初始化导入参数 handleInitImport() { - const { otherDeductStore: {setSlideDataSource, setImportResult}} = this.props; - setSlideDataSource([]) - setImportResult({}) + const { + otherDeductStore: { setSlideDataSource, setImportResult }, + } = this.props; + setSlideDataSource([]); + setImportResult({}); } + onSelectChange = (val) => { + this.setState({ + selectedKey: val, + }); + }; + handleSearch() { const { otherDeductStore:{getTableDatas} } = this.props; const { monthValue, taxAgentId } = this.state; @@ -207,105 +267,228 @@ export default class OtherDeduct extends React.Component { } render() { - const { otherDeductStore, taxAgentStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, previewImport, importFile } = otherDeductStore; - const { taxAgentOption } = taxAgentStore - const { slideVisiable, setSlideVisiable, modalVisiable, setModalVisiable, slideTableStore, step, setStep, slideDataSource, importResult } = otherDeductStore - const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; - const { modalParam } = this.state; + const { otherDeductStore, taxAgentStore, slideSelectedKey } = this.props; + const { + loading, + dataSource, + columns, + pageObj, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + previewImport, + importFile, + } = otherDeductStore; + const { taxAgentOption } = taxAgentStore; + const { + slideVisiable, + setSlideVisiable, + modalVisiable, + setModalVisiable, + slideTableStore, + step, + setStep, + slideDataSource, + importResult, + setPageObj, + } = otherDeductStore; + const selectedRowKeys = toJS(tableStore.selectedRowKeys) || []; + const { modalParam, monthValue, taxAgentId } = this.state; const detailSelectedRowKeys = toJS(slideTableStore.selectedRowKeys) || []; - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn - }, + const rightMenu = [ + // 右键菜单 + // { + // key: "BTN_COLUMN", + // icon: , + // content: "显示列定制", + // onClick: this.showColumn, + // }, ]; - const collectParams = { // 收藏功能配置 - favname: '其他免税扣除', + const collectParams = { + // 收藏功能配置 + favname: "其他免税扣除", favouritetype: 1, objid: 0, - link: 'wui/index.html#/ns_demo03/index', + link: "wui/index.html#/ns_demo03/index", importantlevel: 1, }; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + , ]; - const topTab = [ - ]; + const topTab = []; const renderSearchOperationItem = () => { - return
- } + return
; + }; const handleButtonClick = () => { - const { otherDeductStore: {exportOtherDeductList}} = this.props; + const { + otherDeductStore: { exportOtherDeductList }, + } = this.props; exportOtherDeductList(); - } + }; const handleMenuClick = () => { - if(selectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return; } - const { otherDeductStore: { exportOtherDeductList } } = this.props; - exportOtherDeductList(selectedRowKeys.join(",")) - } + const { + otherDeductStore: { exportOtherDeductList }, + } = this.props; + exportOtherDeductList(selectedRowKeys.join(",")); + }; const handleBtnImport = () => { - const { otherDeductStore: { setModalVisiable, setStep } } = this.props; + const { + otherDeductStore: { setModalVisiable, setStep }, + } = this.props; setStep(0); - setModalVisiable(true) - } - - + setModalVisiable(true); + }; const btns = [ - , - - 导出选中 - - } type="ghost"> + , + + 导出选中 + + } + type="ghost"> 导出全部 - - ] + , + ]; const handleExportAllDetailClick = () => { - const {otherDeductStore: {exportOtherDeductDetailList, currentRecord} } =this.props; + const { + otherDeductStore: { exportOtherDeductDetailList, currentRecord }, + } = this.props; exportOtherDeductDetailList(currentRecord.id); - } + }; const handleExportSelectedDetailClick = () => { - if(detailSelectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (this.state.slideSelectedKey.length == 0) { + message.warning("未选择条目"); + return; } - const { otherDeductStore: { exportOtherDeductDetailList, currentRecord } } = this.props; - exportOtherDeductDetailList(currentRecord.id, detailSelectedRowKeys.join(",")) - } + const { + otherDeductStore: { exportOtherDeductDetailList, currentRecord }, + } = this.props; + exportOtherDeductDetailList( + currentRecord.id, + this.state.slideSelectedKey.join(",") + ); + }; const renderBtns = () => { return ( - - 导出选中 - - } type="ghost"> + + 导出选中 + + } + type="ghost"> 导出全部 - - ) - } + + ); + }; + const rowSelection = { + selectedRowKeys: this.state.selectedKey, + onChange: this.onSelectChange, + }; + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ + current, + pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); + }, + onChange(current) { + setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + taxAgentId, + declareMonth: monthValue && [monthValue], + }); + }, + }; + + const newColumns = _.map([...columns], (item) => { + if (item.dataIndex === "username") { + return { + ...item, + width: 100, + fixed: "left", + render: (text, record) => ( + + ), + }; + } else if (item.dataIndex === "taxAgentName") { + return { + ...item, + width: 180, + fixed: "left", + }; + } else if (item.dataIndex === "operate") { + return { + ...item, + width: 100, + fixed: "right", + render: (text, record) => ( + + ), + }; + } else { + return { ...item }; + } + }); return (
@@ -314,80 +497,99 @@ export default class OtherDeduct extends React.Component { > } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 - buttons={btns} - > - + buttons={btns}>
setShowSearchAd(bool)} //高级搜索面板受控 + setShowSearchAd={(bool) => setShowSearchAd(bool)} //高级搜索面板受控 searchsAd={getSearchs(form, toJS(condition), 2)} // 高级搜索内部数据 buttonsAd={adBtn} // 高级搜索内部按钮 onSearch={() => this.handleSearch()} // 点搜索按钮时的回调 searchsAdQuick={this.getSearchsAdQuick()} - onSearchChange={v => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 + onSearchChange={(v) => form.updateFields({ username: v })} // 在搜索框中输入的文字改变时的回调: 这里需要同步高级搜索和外部搜索框的值 searchsBaseValue={form.getFormParams().username} // 外部input搜索值受控: 这里和高级搜索的requestname同步 />
-
- { - modalVisiable && { - this.handleInitImport() + this.handleInitImport(); }} templateLink={"/api/bs/hrmsalary/otherDeduction/downloadTemplate"} params={modalParam} columns={modalColumns} step={step} setStep={setStep} - onFinish={() => {setModalVisiable(false); setStep(0); doSearch();}} + onFinish={() => { + setModalVisiable(false); + setStep(0); + doSearch(); + }} importResult={importResult} slideDataSource={slideDataSource} - previewImport={(params) => {previewImport(params)}} - importFile={(params) => {importFile(params)}} - renderFormComponent={() => this.renderFormComponent()} - visiable={modalVisiable} - onCancel={() => { this.handleCancel() }} - /> - } - { - slideVisiable && {this.state.currentOperate == "add" ? doSave() : doUpdate()}} - editable={false} - btns={ - renderBtns() - } - /> - } - content={()} - onClose={() => setSlideVisiable(false)} - showMask={true} - closeMaskOnClick={() => setSlideVisiable(false)} /> - } + previewImport={(params) => { + previewImport(params); + }} + importFile={(params) => { + importFile(params); + }} + renderFormComponent={() => this.renderFormComponent()} + visiable={modalVisiable} + onCancel={() => { + this.handleCancel(); + }} + /> + )} + {slideVisiable && ( + { + this.state.currentOperate == "add" ? doSave() : doUpdate(); + }} + editable={false} + btns={renderBtns()} + /> + } + content={ + + this.setState({ slideSelectedKey: val }) + } + /> + } + onClose={() => setSlideVisiable(false)} + showMask={true} + closeMaskOnClick={() => setSlideVisiable(false)} + /> + )}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less index e69de29b..bb9f7d42 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.less @@ -0,0 +1,11 @@ +.cumDeductWrapper { + .linkWapper { + a { + color: #4d7ad8; + } + + a:hover { + text-decoration: none; + } + } +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/ledger/addUserModal.js b/pc4mobx/hrmSalary/pages/ledger/addUserModal.js index 2e74c9a8..7591af61 100644 --- a/pc4mobx/hrmSalary/pages/ledger/addUserModal.js +++ b/pc4mobx/hrmSalary/pages/ledger/addUserModal.js @@ -1,134 +1,181 @@ -import React from 'react' -import { Modal, Button, Row, Col, Radio } from 'antd' -import { WeaSelect, WeaBrowser } from "ecCom" -import { inject, observer } from 'mobx-react'; -import RequiredLabelTip from '../../components/requiredLabelTip'; +import React from "react"; +import { Modal, Button, Row, Col, Radio } from "antd"; +import { WeaSelect, WeaBrowser } from "ecCom"; +import { inject, observer } from "mobx-react"; +import RequiredLabelTip from "../../components/requiredLabelTip"; const objectOptions = [ - { - key: "EMPLOYEE", - showname: "人员", - selected: false - }, - { - key: "DEPT", - showname: "部门", - selected: false - }, - { - key: "POSITION", - showname: "岗位", - selected: false - } - -] + { + key: "EMPLOYEE", + showname: "人员", + selected: false, + }, + { + key: "SUBCOMPANY", + showname: "分部", + selected: false, + }, + { + key: "DEPT", + showname: "部门", + selected: false, + }, + { + key: "POSITION", + showname: "岗位", + selected: false, + }, +]; -@inject('ledgerStore') +@inject("ledgerStore") @observer export default class AddUserModal extends React.Component { - constructor(props) { - super(props) - this.state = { - selectedKey: "EMPLOYEE", - radioValue: "ALL", - ids: "" - } - } + constructor(props) { + super(props); + this.state = { + selectedKey: "EMPLOYEE", + radioValue: "ALL", + ids: "", + }; + } - onRadioChange(e) { - this.setState({radioValue: e.target.value}) - } + onRadioChange(e) { + this.setState({ radioValue: e.target.value }); + } - // 保存 - handleSave() { - const { ledgerStore: {saveLedgerPersonRange, salarySobId, includeType} } = this.props; - saveLedgerPersonRange({ - salarySobId: salarySobId, - includeType: includeType, - employeeStatus: this.state.radioValue, - targetParams: this.state.ids.split(",").map(id => ({targetType: this.state.selectedKey, targetId: id})) - }) - } + // 保存 + handleSave() { + const { + ledgerStore: { saveLedgerPersonRange, salarySobId, includeType }, + } = this.props; + saveLedgerPersonRange({ + salarySobId: salarySobId, + includeType: includeType, + employeeStatus: this.state.radioValue, + targetParams: this.state.ids + .split(",") + .map((id) => ({ targetType: this.state.selectedKey, targetId: id })), + }); + } - // 重置 - handleReset() { - this.setState({ - selectedKey: "EMPLOYEE", - radioValue: "ALL", - ids: "" - }) - } + // 重置 + handleReset() { + this.setState({ + selectedKey: "EMPLOYEE", + radioValue: "ALL", + ids: "", + }); + } - render() { - return ( - {this.props.onCancel()}} width={600} - title="关联人员" - footer={ -
- - -
- } - > -
- - 对象类型 - -
- { - this.setState({selectedKey: value, ids: ""}) - }}/> -
-
- { - this.state.selectedKey == "EMPLOYEE" && { - this.setState({ids}) - }} - /> - } - { - this.state.selectedKey == "DEPT" && { - this.setState({ids}) - }} - /> - } - { - this.state.selectedKey == "POSITION" && { - this.setState({ids}) - }} - /> - } -
- -
- - 选择员工状态 - - this.onRadioChange(e)} value={this.state.radioValue}> - 全部 - 在职 - 离职 - - - -
- -
- ) - } -} \ No newline at end of file + render() { + return ( + { + this.props.onCancel(); + }} + width={600} + title="关联人员" + footer={ +
+ + +
+ }> +
+ + + 对象类型 + + + +
+ { + this.setState({ selectedKey: value, ids: "" }); + }} + /> +
+
+ {this.state.selectedKey == "EMPLOYEE" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "DEPT" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "SUBCOMPANY" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "POSITION" && ( + { + this.setState({ ids }); + }} + /> + )} +
+ +
+ + + 选择员工状态 + + + + this.onRadioChange(e)} + value={this.state.radioValue}> + 全部 + 在职 + 离职 + + + +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/ledger/calcRulesForm.js b/pc4mobx/hrmSalary/pages/ledger/calcRulesForm.js index 26c4a86a..7bc4bdb8 100644 --- a/pc4mobx/hrmSalary/pages/ledger/calcRulesForm.js +++ b/pc4mobx/hrmSalary/pages/ledger/calcRulesForm.js @@ -77,12 +77,16 @@ export default class CalRulesForm extends React.Component { } render() { - const { ledgerStore: {sobItemRuleDataSource}} = this.props; + const { ledgerStore: {sobItemRuleDataSource,baseInfoRequest}} = this.props; + const { canEdit="true" } = baseInfoRequest; let datas = this.convertDataSource(sobItemRuleDataSource) return (
- {this.setState({modalVisible: true})}}/> + { + canEdit ==='true'&& + {this.setState({modalVisible: true})}}/> + }
diff --git a/pc4mobx/hrmSalary/pages/ledger/index.js b/pc4mobx/hrmSalary/pages/ledger/index.js index 1f92dad4..2326ade3 100644 --- a/pc4mobx/hrmSalary/pages/ledger/index.js +++ b/pc4mobx/hrmSalary/pages/ledger/index.js @@ -1,30 +1,36 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; -import { Button, Table, DatePicker, Switch, Modal } from 'antd'; +import { Button, Table, DatePicker, Switch, Modal, Dropdown, Menu } from "antd"; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaSlideModal } from 'ecCom'; -import { WeaTableNew } from "comsMobx" -import { renderNoright, getSearchs } from '../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../components/customTab'; -import ContentWrapper from '../../components/contentWrapper'; -import StepSlide from '../../components/stepSlide' -import SlideBaseForm from './slideBaseForm' -import SlideRefereUser from './slideRefereUser' +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaRangePicker, + WeaInputSearch, + WeaSlideModal, + WeaTable, +} from "ecCom"; +import { renderNoright, getSearchs } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../components/customTab"; +import ContentWrapper from "../../components/contentWrapper"; +import StepSlide from "../../components/stepSlide"; +import SlideBaseForm from "./slideBaseForm"; +import SlideRefereUser from "./slideRefereUser"; -import { columns, dataSource } from './columns'; -import SalaryItemForm from './salaryItemForm'; -import CalRulesForm from './calcRulesForm'; -import ValidRulesForm from './validRulesForm'; -import SlideModalTitle from '../../components/slideModalTitle' -import CopyFormModal from './copyFormModal' +import { columns } from "./columns"; +import SalaryItemForm from "./salaryItemForm"; +import CalRulesForm from "./calcRulesForm"; +import ValidRulesForm from "./validRulesForm"; +import SlideModalTitle from "../../components/slideModalTitle"; +import CopyFormModal from "./copyFormModal"; +import "./index.less"; const { MonthPicker } = DatePicker; -const WeaTable = WeaTableNew.WeaTable; - -@inject('ledgerStore') +@inject("ledgerStore", "taxAgentStore") @observer export default class Ledger extends React.Component { constructor(props) { @@ -39,224 +45,393 @@ export default class Ledger extends React.Component { selectedTab: 0, currentReocrd: {}, searchValue: "", - step1Request: {} - } + step1Request: {}, + }; } handleSearch(value) { - const{ ledgerStore: {getTableDatas}} = this.props; - getTableDatas({name: value}) + const { + ledgerStore: { getTableDatas }, + } = this.props; + getTableDatas({ name: value }); } refereUser() { this.setState({ editSlideVisible: true, - selectedTab: 1 - }) + selectedTab: 1, + }); } onEdit() { this.setState({ - editSlideVisible: true - }) + editSlideVisible: true, + }); } componentWillMount() { - const { ledgerStore : {doInit}} = this.props; - doInit() + const { + ledgerStore: { doInit }, + taxAgentStore: { fetchTaxAgentOption }, + } = this.props; + doInit(); + fetchTaxAgentOption(); } - handleItemStatusChange(value, record) { - const { ledgerStore: { changeLedgerStatus }} = this.props; + const { + ledgerStore: { changeLedgerStatus }, + } = this.props; changeLedgerStatus(record.id, value ? 0 : 1); } - handleItemClick(record, selectedTab = 0) { - const { ledgerStore: {setSalarySobId} } = this.props; - setSalarySobId(record.id) + const { + ledgerStore: { setSalarySobId }, + } = this.props; + setSalarySobId(record.id); this.setState({ selectedTab, editSlideVisible: true, - request: record - }) + request: record, + }); } // 编辑Slide保存按钮 handleEditSlideSave() { const { selectedTab, step1Request } = this.state; - const { ledgerStore: {saveLedgerItem, saveAdjustmentRule, saveLedgerBasic, baseInfoRequest}} = this.props; - if(selectedTab == 0) { - saveLedgerBasic(baseInfoRequest) - } else if(selectedTab == 2) { - saveLedgerItem() - } else if(selectedTab == 3) { - saveAdjustmentRule() - } + const { + ledgerStore: { + saveLedgerItem, + saveAdjustmentRule, + saveLedgerBasic, + baseInfoRequest, + }, + } = this.props; + if (selectedTab == 0) { + saveLedgerBasic(baseInfoRequest); + } else if (selectedTab == 2) { + saveLedgerItem(); + } else if (selectedTab == 3) { + saveAdjustmentRule(); + } } // 增加编辑功能,重写columns绑定事件 getColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { + let newColumns = ""; + newColumns = columns.map((column) => { let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { - case 'name': - return {this.handleItemClick(record)}}>{text} + newColumn.render = (text, record, index) => { + //前端元素转义 + let valueSpan = + record[newColumn.dataIndex + "span"] !== undefined + ? record[newColumn.dataIndex + "span"] + : record[newColumn.dataIndex]; + switch (newColumn.dataIndex) { + case "name": + return ( + { + this.handleItemClick(record); + }}> + {text} + + ); case "disable": - return {this.handleItemStatusChange(value, record)}}/> + return ( + { + this.handleItemStatusChange(value, record); + }} + /> + ); case "operate": - return {this.handleItemClick(record, 1)}}>关联人员 + return ( + { + this.handleItemClick(record, 1); + }}> + 关联人员 + + ); default: - return
+ return
; } - } + }; return newColumn; }); return newColumns; - } + }; - - onOperatesClick = (record, index, operate, flag) => { - const { ledgerStore: { deleteLedger }} = this.props; - switch(operate.index.toString()){ + onOperatesClick = (record, type) => { + const { + ledgerStore: { deleteLedger }, + } = this.props; + switch (type.toString()) { case "0": // 编辑 - this.handleItemClick(record) + this.handleItemClick(record); break; - case '1': // 复制 + case "1": // 复制 this.setState({ copyFormVisible: true, - currentReocrd: record - }) + currentReocrd: record, + }); break; case "3": // 关联人员 - this.handleItemClick(record, 1) + this.handleItemClick(record, 1); break; case "4": // 删除 Modal.confirm({ - title: '信息确认', - content: '确认删除', - onOk:() => { - deleteLedger([record.id]) - }, - onCancel: () => { - + title: "信息确认", + content: "确认删除", + onOk: () => { + deleteLedger([record.id]); }, + onCancel: () => {}, }); - + break; } }; handleCopySave = (value) => { - const { ledgerStore: { doCopy}} = this.props + const { + ledgerStore: { doCopy }, + } = this.props; doCopy(this.state.currentReocrd.id, value).then(() => { - this.setState({copyFormVisible: false}) - }) - } + this.setState({ copyFormVisible: false }); + }); + }; handleNew = () => { - const { ledgerStore: { initSlideData }} = this.props; + const { + ledgerStore: { initSlideData }, + } = this.props; initSlideData(); - this.setState({stepSlideVisible: true, currentStep: 0}) - } + this.setState({ stepSlideVisible: true, currentStep: 0 }); + }; render() { const { ledgerStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = ledgerStore; + const { + loading, + dataSource, + columns, + pageObj, + setPageObj, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + baseInfoRequest, + } = ledgerStore; + const { canEdit = "true" } = baseInfoRequest; const { currentStep, selectedTab } = this.state; - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn + const rightMenu = [ + // 右键菜单 + { + key: "BTN_COLUMN", + icon: , + content: "显示列定制", + onClick: this.showColumn, }, ]; - const collectParams = { // 收藏功能配置 - favname: '薪资账套', + const collectParams = { + // 收藏功能配置 + favname: "薪资账套", favouritetype: 1, objid: 0, - link: 'wui/index.html#/ns_demo03/index', + link: "wui/index.html#/ns_demo03/index", importantlevel: 1, }; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + , ]; - const topTab = [ - ]; + const topTab = []; const renderRightOperation = () => { return ( -
- - {this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> +
+ + { + this.setState({ searchValue: value }); + }} + onSearch={(value) => { + this.handleSearch(value); + }} + />
- ) - } + ); + }; const nextStep = () => { const { currentStep } = this.state; - this.setState({currentStep: currentStep + 1}) - } + this.setState({ currentStep: currentStep + 1 }); + }; const prevStep = () => { const { currentStep } = this.state; - this.setState({currentStep: currentStep - 1}); - } + this.setState({ currentStep: currentStep - 1 }); + }; const steps = [ "基础设置", "关联人员", "薪资项目", "调薪记薪规则", // "校验规则", - ] + ]; const handleStep1Save = () => { const { step1Request } = this.state; - const { ledgerStore: {saveLedgerBasic, baseInfoRequest} } = this.props; + const { + ledgerStore: { saveLedgerBasic, baseInfoRequest }, + } = this.props; saveLedgerBasic(baseInfoRequest).then(() => { nextStep(); - }) - } - + }); + }; const handleStep3Save = () => { - const { ledgerStore: {saveAdjustmentRule} } = this.props; + const { + ledgerStore: { saveAdjustmentRule }, + } = this.props; saveAdjustmentRule().then(() => { - nextStep() - }) - } + nextStep(); + }); + }; const handleStepSave = () => { const { currentStep } = this.state; - const { ledgerStore: { saveLedgerBasic, saveLedgerItem, saveAdjustmentRule, baseInfoRequest }} = this.props; - if(currentStep == 0) { + const { + ledgerStore: { + saveLedgerBasic, + saveLedgerItem, + saveAdjustmentRule, + baseInfoRequest, + }, + } = this.props; + if (currentStep == 0) { saveLedgerBasic(baseInfoRequest).then(() => { nextStep(); - }) - } else if(currentStep == 1) { - nextStep() - }else if(currentStep == 2) { + }); + } else if (currentStep == 1) { + nextStep(); + } else if (currentStep == 2) { saveLedgerItem().then(() => { - nextStep() - }) - } else if(currentStep == 3) { + nextStep(); + }); + } else if (currentStep == 3) { saveAdjustmentRule().then(() => { - this.setState({stepSlideVisible: false}) - }) - } - } + this.setState({ stepSlideVisible: false }); + }); + } + }; + + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + setPageObj({ ...pageObj, current, pageSize }); + getTableDatas({ current, pageSize, name: this.state.searchValue }); + }, + onChange(current) { + setPageObj({ ...pageObj, current, pageSize: pageObj.pageSize }); + getTableDatas({ + current, + pageSize: pageObj.pageSize, + name: this.state.searchValue, + }); + }, + }; + const newColumns = _.map([...columns], (item) => { + if (item.dataIndex === "name") { + return { + ...item, + render: (text, record) => ( + + ), + }; + } else if (item.dataIndex === "disable") { + return { + ...item, + render: (text, record) => ( + { + this.handleItemStatusChange(value, record); + }} + /> + ), + }; + } else if (item.dataIndex === "operate") { + return { + ...item, + render: (text, record) => ( +
+ { + this.handleItemClick(record, 1); + }}> + 关联人员 + + this.onOperatesClick(record, item.key)}> + 编辑 + 复制 + 关联人员 + 删除 + + }> + + + + +
+ ), + }; + } else { + return { ...item }; + } + }); return (
@@ -266,140 +441,181 @@ export default class Ledger extends React.Component { > } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 > - { - - }} - /> - {}} /> - { - this.state.stepSlideVisible && {this.setState({stepSlideVisible: false})}} - customOperate = { -
- { - currentStep == 0 && - } - { - currentStep == 1 &&
- - -
- } - { - currentStep == 2 &&
- - - + + {this.state.stepSlideVisible && ( + { + this.setState({ stepSlideVisible: false }); + }} + customOperate={ +
+ {currentStep == 0 && ( + + )} + {currentStep == 1 && ( +
+ +
- } - { - currentStep == 3 && + )} + {currentStep == 2 && (
- - + + +
- - } -
- } - title="新建账套" - content={ -
- { - currentStep == 0 && - } - { - currentStep == 1 && - } - { - currentStep == 2 && - } - { - currentStep == 3 && - } - {/* { + )} + {currentStep == 3 && ( +
+ + +
+ )} +
+ } + title="新建账套" + content={ +
+ {currentStep == 0 && } + {currentStep == 1 && } + {currentStep == 2 && } + {currentStep == 3 && } + {/* { currentStep == 4 && } */} - -
- - } +
+ } /> - } + )} - { - this.state.editSlideVisible && - this.handleEditSlideSave()} - subItemChange={ - (item) => {this.setState({selectedTab: item.key})} - } + subItemChange={(item) => { + this.setState({ selectedTab: item.key }); + }} /> } - content={
- { - selectedTab == 0 && - } - { - selectedTab == 1 && - } - { - selectedTab == 2 && - } - { - selectedTab == 3 && - } - {/* { + content={ +
+ {selectedTab == 0 && } + {selectedTab == 1 && } + {selectedTab == 2 && } + {selectedTab == 3 && } + {/* { selectedTab == 4 && } */} -
} - onClose={() => this.setState({editSlideVisible: false})} +
+ } + onClose={() => this.setState({ editSlideVisible: false })} showMask={true} - closeMaskOnClick={() => this.setState({editSlideVisible: false})} /> - } + closeMaskOnClick={() => + this.setState({ editSlideVisible: false }) + } + /> + )} - { - this.state.copyFormVisible && - this.handleCopySave(value)} - onCancel={() => {this.setState({copyFormVisible: false})}} + onCancel={() => { + this.setState({ copyFormVisible: false }); + }} /> - } + )}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/ledger/index.less b/pc4mobx/hrmSalary/pages/ledger/index.less index 19d0e653..66478c8e 100644 --- a/pc4mobx/hrmSalary/pages/ledger/index.less +++ b/pc4mobx/hrmSalary/pages/ledger/index.less @@ -1,146 +1,187 @@ .slideBaseForm { - .leftContentWrapper { - margin: 10px; - border: 1px solid #eee; - border-radius: 5px; - padding: 10px; - } - .rightContentWrapper { - margin: 10px; - } + .leftContentWrapper { + margin: 10px; + border: 1px solid #eee; + border-radius: 5px; + padding: 10px; + } + + .rightContentWrapper { + margin: 10px; + } } .rightContentWrapper { - .greytip { - color: #999; - line-height: 24px; - font-size: 12px; - } - .tipLabel { - color: #333; - font-size: 14px; - line-height: 26px; - } - .higelinered { - color: red; - } + .greytip { + color: #999; + line-height: 24px; + font-size: 12px; + } + + .tipLabel { + color: #333; + font-size: 14px; + line-height: 26px; + } + + .higelinered { + color: red; + } } .slideRefereUser { - .tabItem { - cursor: pointer; + .tabItem { + cursor: pointer; + } + + .refereUserHeader { + height: 47px; + line-height: 47px; + padding-left: 10px; + padding-right: 10px; + } + + .headerLeft { + display: inline-block; + color: #666; + + .selectedCrumbs { + color: #4ba9f2; } - .refereUserHeader { - height: 47px; - line-height: 47px; - padding-left: 10px; - padding-right: 10px; - } - .headerLeft { - display: inline-block; - color: #666; - .selectedCrumbs { - color: #4ba9f2; - } - - } - .headerIcon { - float: right; - } - .searchInput { - margin-top: 10px; - float: right; - } - .headerIcon { - color: #4ba9f2; - display: inline-block; - .iconItem { - cursor: pointer; - margin-right: 10px; - } + + } + + .headerIcon { + float: right; + } + + .searchInput { + margin-top: 10px; + float: right; + } + + .headerIcon { + color: #4ba9f2; + display: inline-block; + + .iconItem { + cursor: pointer; + margin-right: 10px; } + } } .salaryItemForm { - padding: 10px 20px; - .btnBar { - height: 47px; - .btns { - display: inline-block; - } - .searchInputWrapper { - float: right; - display: inline-block; - } + padding: 10px 20px; + + .btnBar { + height: 47px; + + .btns { + display: inline-block; } - .userInfoWrapper { - overflow: hidden; - .rightBtnsWrapper { - float: right; - display: inline-block; - .iconItem { - margin-right: 10px; - color: #2db7f5; - } - } + + .searchInputWrapper { + float: right; + display: inline-block; } - .userInfoSelected { - margin-top: 10px; - margin-bottom: 10px; - padding: 10px; - border: 1px solid #eee; - border-radius: 5px; + } + + .userInfoWrapper { + overflow: hidden; + + .rightBtnsWrapper { + float: right; + display: inline-block; + + .iconItem { + margin-right: 10px; + color: #2db7f5; + } } - .tableItemWrapper { - margin-top: 10px; - .rightBtnsWrapper { - float: right; - .iconItem { - margin-right: 10px; - color: #2db7f5; - } - } - .itemTitle { - font-size: 14px; - font-weight: 500; - } - + } + + .userInfoSelected { + margin-top: 10px; + margin-bottom: 10px; + padding: 10px; + border: 1px solid #eee; + border-radius: 5px; + } + + .tableItemWrapper { + margin-top: 10px; + + .rightBtnsWrapper { + float: right; + + .iconItem { + margin-right: 10px; + color: #2db7f5; + } } + + .itemTitle { + font-size: 14px; + font-weight: 500; + } + + } } .calRulesForm { - padding: 10px 20px; - .headerIcon { - float: right; - .iconItem { - margin-right: 10px; - color: #2db7f5; - } - } - .tableWrapper { - margin-top: 20px; + padding: 10px 20px; + + .headerIcon { + float: right; + + .iconItem { + margin-right: 10px; + color: #2db7f5; } + } + + .tableWrapper { + margin-top: 20px; + } } .validRulesForm { - padding: 10px 20px; - .headerBar { - height: 47px; - line-height: 47px; - .inputSearch { - margin-top: 8px; - float: right; - } - .btnsWrapper { - float: right; - .iconItem { - margin-right: 10px; - cursor: pointer; - color: #2db7f5; - } - } + padding: 10px 20px; + + .headerBar { + height: 47px; + line-height: 47px; + + .inputSearch { + margin-top: 8px; + float: right; } - .tableWrapper { - margin-top: 20px; + + .btnsWrapper { + float: right; + + .iconItem { + margin-right: 10px; + cursor: pointer; + color: #2db7f5; + } } + } + + .tableWrapper { + margin-top: 20px; + } +} + +.mySalaryBenefitsWrapper { + .linkWapper { + a { + color: #4d7ad8; + } + + a:hover { + text-decoration: none; + } + } } \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js b/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js index bc37a5bd..1514cbf8 100644 --- a/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js +++ b/pc4mobx/hrmSalary/pages/ledger/salaryItemForm.js @@ -83,14 +83,15 @@ export default class SalaryItemForm extends React.Component { } render() { - const {ledgerStore: {itemGroups, salaryItems, empBrowserList, setAddCategoryVisible, addCategoryVisible}} = this.props; + const {ledgerStore: {itemGroups, salaryItems, empBrowserList, setAddCategoryVisible, addCategoryVisible, baseInfoRequest}} = this.props; + const { canEdit="true" } = baseInfoRequest; const { previewVisible } = this.state; return (
- - + +
{/*
@@ -120,11 +121,8 @@ export default class SalaryItemForm extends React.Component { if(item.items) { item.items && item.items.map(i => {i.key = i.id}) return ( - {this.handleItemDataSourceChange(dataSource, item)}} title={item.name} - onGroupDelete={() => {this.handleGroupDelete(item)}} - onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/> - ) + {this.handleItemDataSourceChange(dataSource, item)}} title={item.name} onGroupDelete={() => {this.handleGroupDelete(item)}} onTitleChange={(value) => {this.handleItemTitleChange(item, value)}} onChange={(dataSource) => {this.handleCanMoveItemChange(dataSource, item)}}/> + ) } return "" } diff --git a/pc4mobx/hrmSalary/pages/ledger/slideBaseForm.js b/pc4mobx/hrmSalary/pages/ledger/slideBaseForm.js index 71d02cbe..10042c72 100644 --- a/pc4mobx/hrmSalary/pages/ledger/slideBaseForm.js +++ b/pc4mobx/hrmSalary/pages/ledger/slideBaseForm.js @@ -1,151 +1,319 @@ -import React from 'react' -import { Row, Col } from 'antd' -import { WeaSelect, WeaTextarea, WeaInput, WeaCheckbox } from "ecCom" -import "./index.less" -import TipLabel from '../../components/TipLabel' -import { daysOptions, cycleTypeOption } from './options' -import { inject, observer } from 'mobx-react'; -import RequiredLabelTip from "../../components/requiredLabelTip" -import { getCurrentYearMonth, getCurrentMonth, getSubtractMonthYearMonth, getAddMonthYearMonth} from '../../util/date' +import React from "react"; +import { Row, Col } from "antd"; +import { toJS } from "mobx"; +import { WeaSelect, WeaTextarea, WeaInput, WeaCheckbox } from "ecCom"; +import "./index.less"; +import TipLabel from "../../components/TipLabel"; +import { daysOptions, cycleTypeOption } from "./options"; +import { inject, observer } from "mobx-react"; +import RequiredLabelTip from "../../components/requiredLabelTip"; +import { + getCurrentYearMonth, + getCurrentMonth, + getSubtractMonthYearMonth, + getAddMonthYearMonth, +} from "../../util/date"; -@inject('ledgerStore') +@inject("ledgerStore", "taxAgentStore") @observer export default class SlideBaseForm extends React.Component { - constructor(props) { - super(props) - this.state = { - name: "", - taxableItems: 1 - } + constructor(props) { + super(props); + this.state = { + name: "", + taxableItems: 1, + }; + } + componentWillMount() { + const { edit } = this.props; + const { + ledgerStore: { initBaseInfoRequest }, + } = this.props; + if (edit) { + const { + ledgerStore: { getLedgerBasicForm }, + } = this.props; + getLedgerBasicForm(); + } else { + initBaseInfoRequest(); } - componentWillMount() { - const { edit } = this.props; - const { ledgerStore: {initBaseInfoRequest}} = this.props; - if(edit) { - const { ledgerStore: { getLedgerBasicForm }} = this.props; - getLedgerBasicForm() - } else { - initBaseInfoRequest(); - } + } + + handleChange(params) { + const { + ledgerStore: { baseInfoRequest, setBaseInfoRequest }, + } = this.props; + let request = { ...baseInfoRequest }; + Object.keys(params).map((key) => { + request[key] = params[key]; + }); + setBaseInfoRequest(request); + } + + // 获取开始日期 + getStartDate(salaryCycleType, day) { + day = Number(day); + return this.getMonth(salaryCycleType) + "-" + (day < 10 ? "0" + day : day); + } + + // 获取开始月份 + getMonth(salaryCycleType) { + switch (salaryCycleType) { + case "1": // 上上月 + return getSubtractMonthYearMonth(2); + case "2": // 上月 + return getSubtractMonthYearMonth(1); + case "3": // 本月 + return getCurrentYearMonth(); + case "4": // 下月 + return getAddMonthYearMonth(1); } + } - handleChange(params) { - const { ledgerStore: {baseInfoRequest, setBaseInfoRequest}} = this.props; - let request= {...baseInfoRequest} - Object.keys(params).map(key => { - request[key] = params[key] - }) - setBaseInfoRequest(request) - } + render() { + const { request, ledgerStore, taxAgentStore, edit } = this.props; + const { baseInfoRequest } = ledgerStore; + const { taxAgentOption } = taxAgentStore; + const { + canEdit="true", + name, + taxAgentId, + taxableItems, + salaryCycleType, + salaryCycleFromDay, + taxCycleType, + attendCycleType, + attendCycleFromDay, + socialSecurityCycleType, + description, + } = baseInfoRequest; + return ( +
+ + +
+ + + 账套名称 + + + + { + this.handleChange({ name: value }); + }} + /> + + + + + 个税扣缴义务人 + + + + { + this.handleChange({ taxAgentId: v }); + }} + /> + + + + + 薪资类型 + + + + { + this.handleChange({ taxableItems: value }); + }} + /> + + + + + 薪资周期 + + + + { + this.handleChange({ salaryCycleType: value }); + }} + /> + { + this.handleChange({ salaryCycleFromDay: value }); + }} + /> + 至本月最后一天 + + + + + 税款所属期 + + + + { + this.handleChange({ taxCycleType: value }); + }} + /> + + + + + 考勤周期 + + + + { + this.handleChange({ attendCycleType: value }); + }} + /> + { + this.handleChange({ attendCycleFromDay: value }); + }} + /> + 至本月最后一天 + + + + + 福利台账月份 + + + + { + this.handleChange({ socialSecurityCycleType: value }); + }} + /> + + - // 获取开始日期 - getStartDate(salaryCycleType, day) { - day = Number(day) - return this.getMonth(salaryCycleType) + "-" + (day < 10 ? "0" + day : day) - } - - // 获取开始月份 - getMonth(salaryCycleType) { - switch(salaryCycleType) { - case "1": // 上上月 - return getSubtractMonthYearMonth(2) - case "2": // 上月 - return getSubtractMonthYearMonth(1) - case "3": // 本月 - return getCurrentYearMonth() - case "4": // 下月 - return getAddMonthYearMonth(1) - } - } - - render() { - const { request, ledgerStore } = this.props; - const { baseInfoRequest } = ledgerStore; - const { name, taxableItems, salaryCycleType, salaryCycleFromDay, - taxCycleType, attendCycleType, attendCycleFromDay, socialSecurityCycleType, - description} = baseInfoRequest - return ( -
- - -
- - 账套名称 - - {this.handleChange({name: value})}}/> - - - - 薪资类型 - - {this.handleChange({taxableItems: value})}}/> - - - - 薪资周期 - - {this.handleChange({salaryCycleType: value})}}/> - {this.handleChange({salaryCycleFromDay: value})}}/> - 至本月最后一天 - - - - 税款所属期 - - {this.handleChange({taxCycleType: value})}}/> - - - - 考勤周期 - - {this.handleChange({attendCycleType: value})}}/> - {this.handleChange({attendCycleFromDay: value})}}/> - 至本月最后一天 - - - - 福利台账月份 - - {this.handleChange({socialSecurityCycleType: value})}}/> - - - - - 核算人员范围 - - - - - - 备注 - - {this.handleChange({description: value})}} /> - - -
- - -
- -

例:薪资所属月是{getCurrentYearMonth()}(即核算员工{getCurrentMonth()}月的工资)

-

根据您当前的选择,相应的周期为:

-
薪资周期
-

{this.getStartDate(salaryCycleType, salaryCycleFromDay)}{this.getMonth(salaryCycleType)}-30

-
税款所属期
-

{this.getMonth(taxCycleType)}

-
考勤取值周期
-

{this.getStartDate(attendCycleType, attendCycleFromDay)}{this.getMonth(attendCycleType)}-30

-
福利台账月份
-

引用{this.getMonth(socialSecurityCycleType)}的福利台账数据

-
-
- -
+ + + 核算人员范围 + + + + + + + + 备注 + + { + this.handleChange({ description: value }); + }} + /> + +
- ) - } -} \ No newline at end of file + + +
+ +

+ 例:薪资所属月是 + {getCurrentYearMonth()} + (即核算员工 + {getCurrentMonth()} + 月的工资) +

+

根据您当前的选择,相应的周期为:

+
薪资周期
+

+ + {this.getStartDate(salaryCycleType, salaryCycleFromDay)} + + 至 + + {this.getMonth(salaryCycleType)}-30 + +

+
税款所属期
+

+ {this.getMonth(taxCycleType)} +

+
考勤取值周期
+

+ + {this.getStartDate(attendCycleType, attendCycleFromDay)} + + 至 + + {this.getMonth(attendCycleType)}-30 + +

+
福利台账月份
+

+ 引用 + + {this.getMonth(socialSecurityCycleType)} + + 的福利台账数据 +

+
+
+ + +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js b/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js index 7a015479..6d8e660c 100644 --- a/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js +++ b/pc4mobx/hrmSalary/pages/ledger/slideRefereUser.js @@ -56,7 +56,8 @@ export default class SlideRefereUser extends React.Component { } render() { - const { ledgerStore: {includeType, userTableStore, addUserModalVisible, setAddUserModalVisible}} = this.props; + const { ledgerStore: {includeType, userTableStore, addUserModalVisible, setAddUserModalVisible, baseInfoRequest}} = this.props; + const { canEdit="true" } = baseInfoRequest; let { columns, list} = userTableStore const { selectedRowKeys } = this.state columns = columns || [] @@ -74,10 +75,13 @@ export default class SlideRefereUser extends React.Component {
{this.handleTabClick(1)}}>关联人员范围 {' '} | {' '} {this.handleTabClick(0)}}>从范围中排除
{this.setState({searchValue: value})}} onSearch={(value) => {this.handleSearch(value)}}/> -
+ { + canEdit === 'true' && +
{this.handleTabDelete()}}/> {setAddUserModalVisible(true)}}/> -
+
+ }
{this.props.title} { this.props.title !== "未分类" && - {this.handleEditGroupIconClick(this.props.title)}}/> - {this.handleDeleteGroupIconClick()}}/> + { + !disabled && + + {this.handleEditGroupIconClick(this.props.title)}}/> + {this.handleDeleteGroupIconClick()}}/> + + } } - {this.handleDelete()}}/> - { this.setState({addItemVisible: true}) }}/> + { + !disabled && + + {this.handleDelete()}}/> + { this.setState({addItemVisible: true}) }}/> + + } {this.handleTiggleContent()}}/> diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js index e5a9ddca..aadfa25e 100644 --- a/pc4mobx/hrmSalary/pages/salaryFile/index.js +++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js @@ -1,17 +1,34 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; -import { Button, Table, DatePicker, Dropdown, Menu, message } from 'antd'; +import { + Button, + Table, + DatePicker, + Dropdown, + Menu, + message, + Modal, +} from "antd"; -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaTable, - WeaInputSearch, WeaSlideModal, WeaCheckbox, WeaHelpfulTip } from 'ecCom'; +import { + WeaTop, + WeaTab, + WeaRightMenu, + WeaRangePicker, + WeaTable, + WeaInputSearch, + WeaSlideModal, + WeaCheckbox, + WeaHelpfulTip, +} from "ecCom"; -import { renderNoright, getSearchs } from '../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../components/customTab'; -import ContentWrapper from '../../components/contentWrapper'; +import { renderNoright, getSearchs } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import CustomTab from "../../components/customTab"; +import ContentWrapper from "../../components/contentWrapper"; -import { columns, dataSource } from './columns'; +import { columns, dataSource } from "./columns"; import ChangeSalaryModal from "./changeSalaryModal" import EditAgentModal from './editAgentModal'; @@ -24,10 +41,10 @@ import CustomPaginationTable from "../../components/customPaginationTable" const { MonthPicker } = DatePicker; -import "./index.less" -import CustomTable from '../../components/customTable'; +import "./index.less"; +import CustomTable from "../../components/customTable"; -@inject('salaryFileStore') +@inject("salaryFileStore") @observer export default class SalaryFile extends React.Component { constructor(props) { @@ -52,113 +69,136 @@ export default class SalaryFile extends React.Component { } componentWillMount() { - const { salaryFileStore: {doInit} } = this.props; + const { + salaryFileStore: { doInit }, + } = this.props; doInit(); } // 设置导入步数 setStep(step) { - this.setState({step}) + this.setState({ step }); } // 渲染导入模板附加元素 renderFormComponent() { return ( -
+
+ width={200} + title="提示:建议先导出现有最新数据,修改后再导入" + placement="topLeft" + />
- ) + ); } - // 导入预览 handlePreviewImport(params) { - const { salaryFileStore: {importPreview}} = this.props; + const { + salaryFileStore: { importPreview }, + } = this.props; params.importType = this.state.importType; - importPreview(params) + importPreview(params); } // 导入档案 handleImportFile(params) { - const { salaryFileStore: {importSalaryArchive}} = this.props; - params.importType = this.state.importType - importSalaryArchive(params).then(data => { - data.errorData = data.errorNotice + const { + salaryFileStore: { importSalaryArchive }, + } = this.props; + params.importType = this.state.importType; + importSalaryArchive(params).then((data) => { + data.errorData = data.errorNotice; this.setState({ - importResult: data - }) - }) + importResult: data, + }); + }); } - // 导入完成按钮操作 handleImportFinish() { - this.setState({modalVisiable: false, step: 0}) + this.setState({ modalVisiable: false, step: 0 }); } // 导出全部 handleExportAll() { - const { salaryFileStore: {exportSalaryArchive}} = this.props; + const { + salaryFileStore: { exportSalaryArchive }, + } = this.props; exportSalaryArchive(); } // 定制列 getColumns() { - const { salaryFileStore: {tableStore}} = this.props; - return tableStore.columns.filter(item => item.display == "true").map(item => { - item.width = item.oldWidth - if(item.dataIndex == "operate") { - item.render = (text, record) => ( - this.handleEdit(record)}>查看 - ) - item.fixed = 'right' - } else if(item.dataIndex == "username"){ - item.fixed = 'left' - } - return item - }) + const { + salaryFileStore: { tableStore }, + } = this.props; + return tableStore.columns + .filter((item) => item.display == "true") + .map((item) => { + item.width = item.oldWidth; + if (item.dataIndex == "operate") { + item.render = (text, record) => ( + this.handleEdit(record)}>查看 + ); + item.fixed = "right"; + } else if (item.dataIndex == "username") { + item.fixed = "left"; + } + return item; + }); } // 编辑行 handleEdit(record) { - this.setState({editSlideVisible: true}) - const { salaryFileStore: {setCurrentId}} = this.props; - setCurrentId(record.id) + this.setState({ editSlideVisible: true }); + const { + salaryFileStore: { setCurrentId }, + } = this.props; + setCurrentId(record.id); } // 显示调整个税扣缴义务人表单 handSildeOptionMenuClick(e) { - const { salaryFileStore: {setEditAgentVisible}} = this.props; - setEditAgentVisible(true) + const { + salaryFileStore: { setEditAgentVisible }, + } = this.props; + setEditAgentVisible(true); } // 查看 Slide 头部操作按钮 renderEditSlideOperate() { - return
- - 调整个税扣缴义务人 - - } onClick={() => {this.setState({changeSalaryVisible: true})}}>调薪 + return ( +
+ + 调整个税扣缴义务人 + + } + onClick={() => { + this.setState({ changeSalaryVisible: true }); + }}> + 调薪 +
+ ); } // table选中条目 - onSelectChange = selectedRowKeys => { + onSelectChange = (selectedRowKeys) => { this.setState({ selectedRowKeys }); }; // 显示影响搜索面板 handleShowSearchBar = () => { this.setState({ - showSearchBar: !this.state.showSearchBar - }) - } + showSearchBar: !this.state.showSearchBar, + }); + }; // 页面跳转 handlePageChange = (value) => { @@ -174,78 +214,120 @@ export default class SalaryFile extends React.Component { // 搜索 handleSearch(value) { - const { salaryFileStore: {getTableDatas, form}} = this.props; - getTableDatas({username: value}) + const { + salaryFileStore: { getTableDatas, form }, + } = this.props; + getTableDatas({ username: value }); } // 初始化导入参数 handleInitModal() { - const { salaryFileStore: { setPreviewDataSource } } = this.props; - setPreviewDataSource([]) + const { + salaryFileStore: { setPreviewDataSource }, + } = this.props; + setPreviewDataSource([]); this.setState({ - importResult: {} - }) + importResult: {}, + }); } render() { const { salaryFileStore } = this.props; - const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = salaryFileStore; - const { importType, previewColumns, previewDataSource, dataSource, currentId, editAgentVisible, setEditAgentVisible, pageInfo } = salaryFileStore; - + const { + loading, + hasRight, + form, + condition, + tableStore, + showSearchAd, + getTableDatas, + doSearch, + setShowSearchAd, + } = salaryFileStore; + const { + importType, + previewColumns, + previewDataSource, + dataSource, + currentId, + editAgentVisible, + setEditAgentVisible, + pageInfo, + } = salaryFileStore; + const { selectedTab, step, selectedRowKeys } = this.state; - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - { - key: 'BTN_COLUMN', - icon: , - content: '显示列定制', - onClick: this.showColumn + const rightMenu = [ + // 右键菜单 + { + key: "BTN_COLUMN", + icon: , + content: "显示列定制", + onClick: this.showColumn, }, ]; - const collectParams = { // 收藏功能配置 - favname: '薪资档案', + const collectParams = { + // 收藏功能配置 + favname: "薪资档案", favouritetype: 1, objid: 0, - link: 'wui/index.html#/ns_demo03/index', + link: "wui/index.html#/ns_demo03/index", importantlevel: 1, }; - const adBtn = [ // 高级搜索内部按钮 - , - , - , + const adBtn = [ + // 高级搜索内部按钮 + , + , + , ]; - const topTab = [ - ]; + const topTab = []; - const renderSearchOperationItem = () => { - - } + const renderSearchOperationItem = () => {}; const handleMenuClick = (e) => { - this.setState({importType: e.key, modalVisiable: true, step: 0}) - } + const { key } = e; + if (key === "init") { + Modal.confirm({ + title: "信息确认", + content: `若导入表格中的人员已存在在薪资档案中,初始化导入会将档案中该人员的数据清除再导入,点击确定继续导入`, + onOk: () => { + this.setState({ importType: e.key, modalVisiable: true, step: 0 }); + }, + onCancel() {}, + }); + } else { + this.setState({ importType: e.key, modalVisiable: true, step: 0 }); + } + }; const handleMenuClick2 = () => { const { electedRowKeys } = this.state; - if(selectedRowKeys.length == 0) { - message.warning("未选择条目") - return + if (selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return; } - const { salaryFileStore: {exportSalaryArchive}} = this.props; - exportSalaryArchive(selectedRowKeys.join(",")) - } + const { + salaryFileStore: { exportSalaryArchive }, + } = this.props; + exportSalaryArchive(selectedRowKeys.join(",")); + }; const menu = ( - { - importType.map(item => ( - {item.content} - )) - } + {importType.map((item) => ( + {item.content} + ))} ); @@ -257,53 +339,82 @@ export default class SalaryFile extends React.Component { ); const renderRightOperation = () => { - return ( -
- + - 导入 - {this.handleExportAll()}}>导出全部 - - {this.setState({ - searchValue: value - })}} onSearch={(value) => {this.handleSearch(value)}}/> - {/* */} -
- ) - } + placement="topLeft" + /> + + 导入 + + { + this.handleExportAll(); + }}> + 导出全部 + + + { + this.setState({ + searchValue: value, + }); + }} + onSearch={(value) => { + this.handleSearch(value); + }} + /> + {/* */} +
+ ); + }; - const handleSlideMoreMenuClick = () => { - - } + const handleSlideMoreMenuClick = () => {}; const slideMoreMenu = ( 导出全部 ); - + const renderCustomOperate = () => { return ( -
- 导出 +
+ + 导出 +
- ) - } + ); + }; const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange, + selectedRowKeys, + onChange: this.onSelectChange, }; return ( @@ -314,8 +425,8 @@ export default class SalaryFile extends React.Component { > } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) dropMenuProps={{ collectParams }} // 收藏功能: 配置之后显示 收藏、帮助、显示页面地址 这3个功能 @@ -326,7 +437,7 @@ export default class SalaryFile extends React.Component { } /> - - - { - this.state.modalVisiable && - { - this.handleInitModal() + this.handleInitModal(); }} params={{}} columns={previewColumns} @@ -359,89 +468,110 @@ export default class SalaryFile extends React.Component { setStep={this.setStep.bind(this)} slideDataSource={previewDataSource} importResult={this.state.importResult} - onFinish={() => {this.handleImportFinish()}} - previewImport={(params) => { - this.handlePreviewImport(params) + onFinish={() => { + this.handleImportFinish(); + }} + previewImport={(params) => { + this.handlePreviewImport(params); + }} + importFile={(params) => { + this.handleImportFile(params); + }} + templateLink={ + "/api/bs/hrmsalary/salaryArchive/downloadTemplate?importType=" + + this.state.importType + } + renderFormComponent={() => { + this.renderFormComponent(); + }} + visiable={this.state.modalVisiable} + onCancel={() => { + this.setState({ modalVisiable: false }); }} - importFile={(params) => {this.handleImportFile(params)}} - templateLink={"/api/bs/hrmsalary/salaryArchive/downloadTemplate?importType=" + this.state.importType} - renderFormComponent={() => {this.renderFormComponent()}} - visiable={this.state.modalVisiable} - onCancel={() => { this.setState({modalVisiable: false})}} /> - } - { - this.state.changeSalaryVisible && {this.setState({changeSalaryVisible: false})}} + onCancel={() => { + this.setState({ changeSalaryVisible: false }); + }} /> - } + )} - { - editAgentVisible && {setEditAgentVisible(false)}} + onCancel={() => { + setEditAgentVisible(false); + }} /> - } + )} {/* 操作记录 */} - { - this.state.recordSlideVisible && - {renderCustomOperate()}} - subItemChange={ - (item) => {this.setState({selectedTab: item.key})} - } - /> - } - content={
- { - selectedTab == 0 && - } - { - selectedTab == 1 && - } -
} - onClose={() => this.setState({recordSlideVisible: false})} - showMask={true} - closeMaskOnClick={() => this.setState({recordSlideVisible: false})} /> - } + {this.state.recordSlideVisible && ( + { + renderCustomOperate(); + }} + subItemChange={(item) => { + this.setState({ selectedTab: item.key }); + }} + /> + } + content={ +
+ {selectedTab == 0 && } + {selectedTab == 1 && } +
+ } + onClose={() => this.setState({ recordSlideVisible: false })} + showMask={true} + closeMaskOnClick={() => + this.setState({ recordSlideVisible: false }) + } + /> + )} - { - this.state.editSlideVisible && - - } - content={} - onClose={() => this.setState({editSlideVisible: false})} - showMask={true} - closeMaskOnClick={() => this.setState({editSlideVisible: false})} /> - } - + {this.state.editSlideVisible && ( + + } + content={} + onClose={() => this.setState({ editSlideVisible: false })} + showMask={true} + closeMaskOnClick={() => this.setState({ editSlideVisible: false })} + /> + )}
- ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js b/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js new file mode 100644 index 00000000..a311613e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/addTaxAgentModal.js @@ -0,0 +1,155 @@ +import React from "react"; +import { Modal, Button, Row, Col, Radio, Checkbox } from "antd"; +import { WeaSelect, WeaBrowser } from "ecCom"; +import { inject, observer } from "mobx-react"; +import RequiredLabelTip from "../../components/requiredLabelTip"; + +const CheckboxGroup = Checkbox.Group; + +export default class AddTaxAgentModal extends React.Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "EMPLOYEE", + checkboxValue: [], + ids: "", + }; + } + + onCheckboxChange = (checkboxValue) => { + this.setState({ checkboxValue }); + }; + + // 保存 + handleSave = () => { + const { onTaxAgentSave } = this.props; + const { checkboxValue, ids, selectedKey } = this.state; + const payload = { + employeeStatus: checkboxValue, + targetParams: _.map(ids.split(","), (it) => ({ + targetType: selectedKey, + targetId: it, + })), + }; + onTaxAgentSave && onTaxAgentSave(payload); + }; + + // 重置 + handleReset = () => { + this.setState({ + selectedKey: "EMPLOYEE", + checkboxValue: [], + ids: "", + }); + }; + + render() { + const { employeeStatus, targetTypeList, visible, onCancel, loading } = + this.props; + return ( + + + +
+ }> +
+ +
+ 对象类型 + + + +
+ ({ + ...it, + key: it.id, + showname: it.name, + selected: false, + }))} + value={this.state.selectedKey} + onChange={(value) => { + this.setState({ selectedKey: value, ids: "" }); + }} + /> +
+
+ {this.state.selectedKey == "EMPLOYEE" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "DEPT" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "SUBCOMPANY" && ( + { + this.setState({ ids }); + }} + /> + )} + {this.state.selectedKey == "POSITION" && ( + { + this.setState({ ids }); + }} + /> + )} +
+ + + +
+ 选择员工状态 + + + + ({ + label: it.name, + value: it.id, + }))} + value={this.state.checkboxValue} + onChange={(e) => this.onCheckboxChange(e)} + /> + + + + + ); + } +} diff --git a/pc4mobx/hrmSalary/pages/taxAgent/editConditions.js b/pc4mobx/hrmSalary/pages/taxAgent/editConditions.js new file mode 100644 index 00000000..f9afbe87 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/editConditions.js @@ -0,0 +1,65 @@ +/* + * Author: 黎永顺 + * Description: 表单渲染condition + * Date: 2022-05-30 22:39:03 + * LastEditTime: 2022-05-31 20:34:07 + */ +export const editConditions = [ + { + items: [ + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 14, + rules: "required|string", + label: "名称", + labelcol: 6, + value: "", + viewAttr: 3, + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "/hrm/resource/HrmResource.jsp?id=", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: "人力资源", + type: "1", + viewAttr: 3, + rules: "required", + }, + colSpan: 1, + conditionType: "BROWSER", + rules: "required|string", + domkey: ["adminUserIds"], + fieldcol: 14, + label: "管理员", + labelcol: 6, + viewAttr: 3, + }, + { + colSpan: 1, + conditionType: "TEXTAREA", + domkey: ["description"], + fieldcol: 14, + label: "备注", + labelcol: 6, + value: "", + viewAttr: 2, + }, + ], + defaultshow: true, + }, +]; diff --git a/pc4mobx/hrmSalary/pages/taxAgent/editModal.js b/pc4mobx/hrmSalary/pages/taxAgent/editModal.js index 52d382c4..71c19d90 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/editModal.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/editModal.js @@ -1,82 +1,179 @@ -import React from 'react' -import { Button, Modal, Row, Col, message } from 'antd'; -import { WeaTextarea, WeaInput } from "ecCom"; -import { logColumns, dataSource } from "../../common/columns" -import RequiredLabelTip from "../../components/requiredLabelTip" +import React from "react"; +import { Button, Row, Col, message } from "antd"; +import { + WeaDialog, + WeaFormItem, + WeaSearchGroup, + WeaSteps, + WeaTab, +} from "ecCom"; +import { WeaSwitch } from "comsMobx"; +import PersonalScope from "./personalScope"; + +const titleOuter = { + display: "flex", + justifyContent: "space-between", + alignItems: "center", +}; +const left = { + display: "flex", + flexDirection: "column", +}; +const stepWrapper = { + padding: "20px 200px", +}; + +const Step = WeaSteps.Step; export default class EditModal extends React.Component { - constructor(props) { - super(props) - this.state = { - name: "", - remark: "" + constructor(props) { + super(props); + this.state = { + date: "", + }; + } + + handleSubmit = () => { + const { onSubmit, btnType, onPrev } = this.props; + const { form } = this.props.taxAgentStore; + if (btnType === "prev") { + onPrev && onPrev(); + return; + } + form.validateForm().then((f) => { + if (f.isValid) { + const formData = form.getFormParams(); + const { adminUserIds, ...extraVal } = formData; + onSubmit && + onSubmit({ adminUserIds: adminUserIds.split(","), ...extraVal }); + } else { + f.showErrors(); + this.setState({ date: new Date() }); // 改变一个state的变量,强制页面刷新 + } + }); + }; + + renderEditForm = () => { + const { editConditions } = this.props; + const { form } = this.props.taxAgentStore; + const { isFormInit } = form; + let group = []; + isFormInit && + editConditions.map((c, index) => { + let items = []; + c.items.map((field, idx) => { + items.push({ + com: ( + + + + ), + col: 1, + hide: form.isHide(field, (keys, allParams) => { + return false; + }), + }); + }); + group.push( + + ); + }); + return group; + }; + + render() { + const { date } = this.state; + const { + visible, + title, + current, + btnType, + editType, + editId, + saveloading, + onClose, + onChangeTab, + taxAgentStore, + editConditions, + } = this.props; + const { form } = taxAgentStore; + return ( + { + form.resetForm(); + onClose && onClose(); + }} + title={ +
+
+
{title}
+
+
+ {editType !== "set" && ( + + )} +
+
} - } - - componentWillMount() { // 初始化渲染页面 - this.setState({ - name: this.props.name, - remark: this.props.remark - }) - } - - validate() { - if(this.state.name == "") { - message.warning("个税扣缴义务人名称不能为空"); - return false; - } - return true; - } - - submitAdd() { - if(this.validate()) { - this.props.onSubmitAdd({name: this.state.name, description: this.state.remark}) - } - } - - submitUpdate() { - if(this.validate) { - this.props.onSubmitUpdate({id: this.props.currentId, name: this.state.name, description: this.state.remark}) - } - } - - render() { - return ( - { - this.props.operate == "add" ? this.submitAdd() : this.submitUpdate(); - }} onCancel={this.props.onCancel} - > - -
-
名称:
- -
- {this.setState({ - name: v - })}} - /> - - - - - -
备注:
- -
- { - this.setState({ - remark: v - }) - } - } /> - - - - ) - } + visible={visible} + style={{ width: 800, minHeight: 350 }} + hasScroll> + {title.indexOf("编辑") >= 0 && ( + onChangeTab && onChangeTab(v)} + /> + )} + {(btnType === "save" || title.indexOf("编辑") < 0) && ( +
+ + + + +
+ )} + {current == 0 ? ( + this.renderEditForm() + ) : ( + + )} + + ); + } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.js b/pc4mobx/hrmSalary/pages/taxAgent/index.js index f53c3fe3..f4580d2b 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.js +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.js @@ -1,225 +1,451 @@ -import React from 'react'; -import { inject, observer } from 'mobx-react'; -import { toJS } from 'mobx'; +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Row, Col, Switch, message, Modal, Menu, Dropdown } from "antd"; +import { + WeaTop, + WeaRightMenu, + WeaSearchGroup, + WeaFormItem, + WeaTable, +} from "ecCom"; +import { renderNoright } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 +import EditModal from "./editModal"; +import TipLabel from "../../components/TipLabel"; +import { editConditions } from "./editConditions"; +import "./index.less"; -import { Button, Table, DatePicker, Row, Col, Modal, Form, Input } from 'antd'; -const { TextArea } = Input; - -import { WeaTop, WeaTab, WeaRightMenu, WeaRangePicker, WeaInputSearch, WeaInput, WeaTextarea } from 'ecCom'; - -import { WeaTableNew } from 'comsMobx'; - -const WeaTable = WeaTableNew.WeaTable; -import { renderNoright, getSearchs } from '../../util'; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 -import CustomTab from '../../components/customTab'; -import ContentWrapper from '../../components/contentWrapper'; -import "./index.less" - -import { columns, dataSource } from './columns'; - -import { logColumns } from '../../common/columns' -import LogViewModal from '../../components/logViewModal'; -import EditModal from './editModal' -import TipLabel from '../../components/TipLabel' - -const { MonthPicker } = DatePicker; - -@inject('taxAgentStore') +@inject("taxAgentStore") @observer export default class TaxAgent extends React.Component { constructor(props) { super(props); this.state = { - value: "", - selectedKey: "0", - searchValue: "", - logViewVisiable: false, - modalVisiable: false, - remarkValue: "", - nameValue: "", - title: "新增个税扣缴义务人", - currentOperate: "add", - currentId: "", - } + editModalProps: { + title: "新增个税扣缴义务人", + visible: false, + current: 0, + btnType: "save", //save: 添加, edit: 编辑, prev: '上一步' + editId: "", + editType: "save", + }, + editModalLoading: { + saveloading: false, + }, + devolutionStatus: 0, + conditions: editConditions, + permission: {}, + }; } - componentWillMount() { // 初始化渲染页面 - const { taxAgentStore: { doInit } } = this.props; + componentWillMount() { + const { taxAgentStore } = this.props; + const { doInit } = taxAgentStore; doInit(); + this.getPermission(); } - showLogView = () => { - this.setState({logViewVisiable: true}) - } - - onEdit = (record) => { - this.setState({ - remarkValue: record.description, - nameValue: record.name, - title: "编辑个税扣缴义务人", - currentOperate: "update", - currentId: record.id - }) - const {taxAgentStore : { setModalVisiable }} = this.props - setModalVisiable(true) - } - - // 增加编辑功能,重写columns绑定事件 - getColumns = (columns) => { - let newColumns = ''; - newColumns = columns.map(column => { - let newColumn = column; - newColumn.render = (text, record, index) => { //前端元素转义 - let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; - switch(newColumn.dataIndex) { - case "name": - return {this.onEdit(record)}} - dangerouslySetInnerHTML={{ __html: valueSpan }} /> - case "operate": - return {this.onEdit(record)}}>编辑 - default: - return
- } - } - return newColumn; - }); - return newColumns; - } - - onOperatesClick = (record, index, operate, flag) => { - const {taxAgentStore : {doDelete}} = this.props; - switch(operate.index.toString()){ - case '0': // 删除 - Modal.confirm({ - title: "信息确认", - content: "确认删除吗?", - onOk() { - doDelete([record.id]) - }, - onCancel() {} + getPermission = () => { + const { getPermission } = this.props.taxAgentStore; + getPermission().then(({ status, data }) => { + if (status) { + this.setState({ permission: data }, () => { + this.getTaxAgentBaseForm(); }); + } + }); + }; + + getTaxAgentBaseForm = () => { + const { taxAgentStore } = this.props; + const { getTaxAgentBaseForm } = taxAgentStore; + getTaxAgentBaseForm().then(({ status, data }) => { + if (status && !_.isEmpty(data)) { + const { devolutionStatus } = data; + this.setState({ devolutionStatus }); + } + }); + }; + + taxAgentBaseSave = (devolutionStatus) => { + Modal.confirm({ + title: "信息确认", + content: `确认${!devolutionStatus ? "停用" : "启用"}分权?`, + onOk: () => { + const paylaod = { devolutionStatus }; + const { taxAgentStore } = this.props; + const { taxAgentBaseSave, doInit, pageObj } = taxAgentStore; + taxAgentBaseSave(paylaod).then(({ status, errormsg }) => { + if (status) { + message.success(`${!devolutionStatus ? "停用" : "启用"}分权成功`); + this.getTaxAgentBaseForm(); + doInit({ current: pageObj.current, pageSize: pageObj.pageSize }); + } else { + message.error( + errormsg || `${!devolutionStatus ? "停用" : "启用"}分权失败` + ); + } + }); + }, + onCancel() {}, + }); + }; + + getTaxAgentForm = (id, current) => { + const { conditions } = this.state; + const { taxAgentStore } = this.props; + const { getTaxAgentForm, getCondition } = taxAgentStore; + getTaxAgentForm({ id }).then(({ status, data }) => { + if (status && !_.isEmpty(data)) { + const [conditionItem] = conditions; + const conditionMap = _.map(conditionItem.items, (it) => { + const key = it.domkey.join(""); + if (it.conditionType === "BROWSER") { + return { + ...it, + browserConditionParam: { + ...it.browserConditionParam, + replaceDatas: _.map(data[key], (b) => ({ + id: b.id, + name: b.content, + })), + }, + viewAttr: current == 1 ? 1 : it.viewAttr, + }; + } else { + if (data[key]) { + return { + ...it, + value: data[key], + viewAttr: current == 1 ? 1 : it.viewAttr, + }; + } + } + return { ...it, viewAttr: current == 1 ? 1 : it.viewAttr }; + }); + this.setState( + { + conditions: [{ defaultshow: true, items: conditionMap }], + }, + () => { + getCondition(this.state.conditions); + } + ); + } + }); + }; + + showEditModal = (editId, current) => { + this.setState( + { + editModalProps: { + ...this.state.editModalProps, + visible: true, + title: editId ? "编辑个税扣缴义务人" : "新增个税扣缴义务人", + btnType: editId ? "edit" : "save", + editId: editId, + editType: current ? "set" : editId && !current ? "edit" : "save", + current: current ? current : 0, + }, + }, + () => { + editId && this.getTaxAgentForm(editId, current); + } + ); + }; + + closeModal = () => { + const { taxAgentStore } = this.props; + const { form, getCondition } = taxAgentStore; + this.setState( + { + editModalProps: { + ...this.state.editModalProps, + title: "新增个税扣缴义务人", + current: 0, + btnType: "save", + editId: "", + editType: "save", + visible: false, + }, + conditions: editConditions, + }, + () => { + form.resetForm(); + getCondition(this.state.conditions); + } + ); + }; + /** + * name:表单提交 + * return {*} + */ + handleSubmit = (module) => { + const { taxAgentStore } = this.props; + const { editModalProps } = this.state; + const { doInit, saveTaxAgent, updateTaxAgent, pageObj } = taxAgentStore; + const { btnType, editId, editType } = editModalProps; + if (btnType === "save") { + // 新增 + this.setState({ + editModalLoading: { + saveloading: true, + }, + }); + const payload = { ...module }; + saveTaxAgent(payload).then(({ status, errormsg, data }) => { + this.setState({ + editModalLoading: { + saveloading: false, + }, + }); + if (status) { + message.success("新增成功"); + this.setState({ + editModalProps: { + ...editModalProps, + editId: data, + current: 1, + btnType: "prev", + }, + }); + doInit({ current: pageObj.current, pageSize: pageObj.pageSize }); + } else { + message.error(errormsg || "新增失败"); + } + }); + } else if (btnType === "edit") { + // 编辑 + this.setState({ + editModalLoading: { + saveloading: true, + }, + }); + const payload = { ...module, id: editId }; + updateTaxAgent(payload).then(({ status, errormsg }) => { + this.setState({ + editModalLoading: { + saveloading: false, + }, + }); + if (status) { + message.success("更新成功"); + if (editType === "edit") { + this.closeModal(); + } else { + this.setState({ + editModalProps: { + ...editModalProps, + current: 1, + btnType: "prev", + }, + }); + } + doInit({ current: pageObj.current, pageSize: pageObj.pageSize }); + } else { + message.error(errormsg || "更新失败"); + } + }); } }; + /** + * name: 删除个税扣缴义务人 + * param {*} agentId + * return {*} + */ + deleteTaxAgent = (agentId) => { + const { taxAgentStore } = this.props; + const { deleteTaxAgent, pageObj, doInit } = taxAgentStore; + Modal.confirm({ + title: "信息确认", + content: `确认要删除吗?`, + onOk: () => { + deleteTaxAgent([agentId]).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + doInit({ current: pageObj.current, pageSize: pageObj.pageSize }); + } else { + message.error(errormsg || "删除失败"); + } + }); + }, + }); + }; render() { const { taxAgentStore } = this.props; - const { loading, hasRight, form, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd, doInsert } = taxAgentStore; - const { modalVisiable, setModalVisiable, doUpdate } = taxAgentStore; + const { + editModalProps, + editModalLoading, + devolutionStatus, + conditions, + permission, + } = this.state; + const { loading, pageObj, dataSource, columns, doInit, hasRight } = + taxAgentStore; - const topTab = [ - ]; - - - - if (!hasRight && !loading) { // 无权限处理 + if (!hasRight && !loading) { + // 无权限处理 return renderNoright(); } - const rightMenu = [// 右键菜单 - // { - // key: 'BTN_COLUMN', - // icon: , - // content: '操作日志', - // onClick: this.showLogView - // }, - ]; - - const initEditModal = () => { - this.setState({ - nameValue: '', - remarkValue: "", - title: "新增个税扣缴义务人", - currentOperate: "add" - }) - } - - const showEditModal = () => { - - initEditModal(); - setModalVisiable(true) - } - - const renderSearchOperationItem = () => { - return
- - {' '} - doSearch(name)} - /> -
- } - const renderTipsLabel = () => { const tipList = [ "1、个税扣缴义务人与档案中的个税扣缴义务人匹配,修改个税扣缴义务人名称,薪资档案的个税扣缴义务人数据同步更新;", - "2、删除个税扣缴义务人需先确认档案里无人员使用该个税扣缴义务人,否则不予删除;" - ] - return ( - - ) - } + "2、删除个税扣缴义务人需先确认档案里无人员使用该个税扣缴义务人,否则不予删除;", + ]; + return ; + }; + + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange(current, pageSize) { + doInit({ current, pageSize }); + }, + onChange(current) { + doInit({ current, pageSize: pageObj.pageSize }); + }, + }; + const newColumns = _.map( + [ + ...columns, + { + title: "操作", + key: "operation", + render: (text, record) => ( + + ), + }, + ], + (item) => { + if (item.dataIndex === "employeeRange") { + return { + ...item, + render: (text, record) => { + return ( + + ); + }, + }; + } else { + return { ...item }; + } + } + ); return (
- + } // 左侧图标 - iconBgcolor='#F14A2D' // 左侧图标背景色 + icon={} // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 showDropIcon={true} // 是否显示下拉按钮 - dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同) > - { - this.setState({ selectedKey: v }) - }} - /> - +
- +
+ {permission.isChief && ( + + + + + + )} + +
个税扣缴义务人
+ this.showEditModal()} + /> +
+ } + showGroup> + + +
{renderTipsLabel()} - - - { - modalVisiable && {setModalVisiable(false)}} - onSubmitAdd={(params) => {doInsert(params)}} - operate={this.state.currentOperate} - onSubmitUpdate={(params) => {doUpdate(params)}} - currentId={this.state.currentId} - /> - } - {this.setState({logViewVisiable: false})}} - /> + {editModalProps.visible && ( + + this.setState({ + editModalProps: { + ...editModalProps, + current: 0, + btnType: "edit", + }, + }) + } + onChangeTab={(current) => { + this.setState({ + editModalProps: { + ...editModalProps, + current, + }, + }); + }} + onClose={this.closeModal} + onSubmit={this.handleSubmit} + /> + )} - ) + ); } } diff --git a/pc4mobx/hrmSalary/pages/taxAgent/index.less b/pc4mobx/hrmSalary/pages/taxAgent/index.less index b8805555..e8a39031 100644 --- a/pc4mobx/hrmSalary/pages/taxAgent/index.less +++ b/pc4mobx/hrmSalary/pages/taxAgent/index.less @@ -1,21 +1,81 @@ -.logViewModal { - .searchBar { +.mySalaryBenefitsWrapper { + height: 100%; + + .wea-new-top-wapper { + height: 100%; + } + + .mySalaryTableWrapper { + .wea-search-group { + padding: 0; + + .wea-content { + padding-left: 16px; + + .ant-switch { + margin-top: 5px; + } + } + + .titleWrapper { + width: 100%; display: flex; + justify-content: space-between; + align-items: center; + + i { + color: #2db7f5; + font-size: 18px; + } + } } - .searchBarLabel { - margin-bottom: 10px; + + .ant-table-row:hover { + a.ant-dropdown-link { + display: inline-block; + } } - .searchBarItem { - position: relative; - width: 200px; - margin-left: 10px; - margin-right: 10px; - } - .searchDateRange { - width: 300px; - } - .searchBtn { - position: absolute; - bottom: 0px; + + .operationWapper, + .employeeRangeWapper { + a { + color: #4d7ad8; + } + + a:hover { + text-decoration: none; + } + + a.ant-dropdown-link { + margin-left: 18px; + display: none; + } } + } } + +.logViewModal { + .searchBar { + display: flex; + } + + .searchBarLabel { + margin-bottom: 10px; + } + + .searchBarItem { + position: relative; + width: 200px; + margin-left: 10px; + margin-right: 10px; + } + + .searchDateRange { + width: 300px; + } + + .searchBtn { + position: absolute; + bottom: 0px; + } +} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/taxAgent/personalScope.js b/pc4mobx/hrmSalary/pages/taxAgent/personalScope.js new file mode 100644 index 00000000..304adb8d --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/personalScope.js @@ -0,0 +1,218 @@ +/* + * Author: 黎永顺 + * Description: 个税扣缴义务人-人员范围 + * Date: 2022-05-31 09:51:59 + * LastEditTime: 2022-06-01 17:57:42 + */ +import React, { Component } from "react"; +import { message, Modal } from "antd"; +import { inject, observer } from "mobx-react"; +import SlideTaxagentUser from "./slideTaxagentUser"; +import "./index.less"; + +const personScopeWarrper = { + padding: "0 25px", +}; + +@inject("taxAgentStore", "ledgerStore") +@observer +export default class PersonalScope extends Component { + constructor() { + super(); + this.state = { + queryLoading: false, + submitLoading: false, + targetTypeList: [], + employeeStatus: [], + dataSource: [], + columns: [], + pageObj: { + current: 1, + pageSize: 10, + total: 0, + }, + }; + } + componentDidMount() { + this.getTaxAgentRangeForm(); + this.getTaxAgentRangeListInclude(); + } + + getTaxAgentRangeForm = () => { + const { getTaxAgentRangeForm } = this.props.taxAgentStore; + getTaxAgentRangeForm().then(({ status, data }) => { + if (status) { + const { employeeStatus, targetTypeList } = data; + this.setState({ employeeStatus, targetTypeList }); + } + }); + }; + + getTaxAgentRangeListInclude = (pageModule = {}) => { + const { taxAgentId } = this.props; + const { getTaxAgentRangeListInclude } = this.props.taxAgentStore; + this.setState({ queryLoading: true }); + getTaxAgentRangeListInclude({ ...pageModule, taxAgentId }).then( + ({ status, data }) => { + this.setState({ queryLoading: false }); + if (status && !_.isEmpty(data)) { + const { + columns, + list: dataSource, + pageNum: current, + pageSize, + total, + } = data; + this.setState({ + columns, + dataSource, + pageObj: { + current, + pageSize, + total, + }, + }); + } + } + ); + }; + getTaxAgentRangeListExclude = (pageModule = {}) => { + const { taxAgentId } = this.props; + const { getTaxAgentRangeListExclude } = this.props.taxAgentStore; + this.setState({ queryLoading: true }); + getTaxAgentRangeListExclude({ ...pageModule, taxAgentId }).then( + ({ status, data }) => { + this.setState({ queryLoading: false }); + if (status && !_.isEmpty(data)) { + const { + columns, + list: dataSource, + pageNum: current, + pageSize, + total, + } = data; + this.setState({ + columns, + dataSource, + pageObj: { + current, + pageSize, + total, + }, + }); + } + } + ); + }; + + taxAgentRangeDelete = ({ ids, tab }) => { + const { taxAgentRangeDelete } = this.props.taxAgentStore; + const { pageObj } = this.state; + Modal.confirm({ + title: "信息确认", + content: `确认删除该条数据吗?`, + onOk: () => { + taxAgentRangeDelete(ids).then(({ status, errorMsg }) => { + if (status) { + message.success("删除成功"); + tab == "1" + ? this.getTaxAgentRangeListInclude({ + current: pageObj.current, + pageSize: pageObj.pageSize, + }) + : this.getTaxAgentRangeListExclude({ + current: pageObj.current, + pageSize: pageObj.pageSize, + }); + } else { + message.error(errorMsg || "删除失败"); + } + }); + }, + onCancel() {}, + }); + }; + + taxAgentRangeSave = (module) => { + const { taxAgentId } = this.props; + const { pageObj } = this.state; + const { includeType } = module; + const { taxAgentRangeSave } = this.props.taxAgentStore; + this.setState({ submitLoading: true }); + taxAgentRangeSave({ ...module, taxAgentId }).then( + ({ status, errorMsg }) => { + this.setState({ submitLoading: false }); + if (status) { + this.tagAgentRef.closeModal(); + message.success("新增成功"); + includeType == "1" + ? this.getTaxAgentRangeListInclude({ + current: pageObj.current, + pageSize: pageObj.pageSize, + }) + : this.getTaxAgentRangeListExclude({ + current: pageObj.current, + pageSize: pageObj.pageSize, + }); + } else { + message.error(errorMsg || "新增失败"); + } + } + ); + }; + + render() { + const { + dataSource, + columns, + pageObj, + employeeStatus, + targetTypeList, + submitLoading, + queryLoading, + } = this.state; + return ( +
+ (this.tagAgentRef = dom)} + dataSource={dataSource} + columns={columns} + pageObj={pageObj} + submitLoading={submitLoading} + queryLoading={queryLoading} + setPageObj={(params) => { + const { current, pageSize, tab } = params; + this.setState( + { + pageObj: { + ...pageObj, + current, + pageSize, + }, + }, + () => { + tab == "1" + ? this.getTaxAgentRangeListInclude({ ...pageObj, ...params }) + : this.getTaxAgentRangeListExclude({ ...pageObj, ...params }); + } + ); + }} + employeeStatus={employeeStatus} + targetTypeList={targetTypeList} + onDeleteTaxAgent={this.taxAgentRangeDelete} + onTaxAgentSave={this.taxAgentRangeSave} + onTaxAngetSearch={({ targetName, tab }) => { + tab == "1" + ? this.getTaxAgentRangeListInclude({ targetName }) + : this.getTaxAgentRangeListExclude({ targetName }); + }} + onChangeTab={(tab) => { + tab == "1" + ? this.getTaxAgentRangeListInclude() + : this.getTaxAgentRangeListExclude(); + }} + /> +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/taxAgent/slideTaxagentUser.js b/pc4mobx/hrmSalary/pages/taxAgent/slideTaxagentUser.js new file mode 100644 index 00000000..a2c6254b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/taxAgent/slideTaxagentUser.js @@ -0,0 +1,201 @@ +import React from "react"; +import { Icon, Table, message } from "antd"; +import { WeaInputSearch } from "ecCom"; +import AddTaxAgentModal from "./addTaxAgentModal"; + +export default class SlideTaxagentUser extends React.Component { + constructor(props) { + super(props); + this.state = { + addTaxagentModalVisible: false, + includeType: 1, + selectedRowKeys: [], + searchValue: "", + }; + } + + handleTabClick(includeType) { + const { onChangeTab } = this.props; + this.setState( + { + includeType, + }, + () => { + onChangeTab && onChangeTab(includeType); + } + ); + } + + onSelectChange = (selectedRowKeys) => { + this.setState({ selectedRowKeys }); + }; + + handleTabDelete = () => { + const { onDeleteTaxAgent } = this.props; + const { includeType } = this.state; + if (this.state.selectedRowKeys.length == 0) { + message.warning("未选择条目"); + return; + } + onDeleteTaxAgent({ ids: this.state.selectedRowKeys, tab: includeType }); + }; + + handleSearch = (value) => { + const { includeType } = this.state; + const { onTaxAngetSearch } = this.props; + onTaxAngetSearch({ + tab: includeType, + targetName: value, + }); + }; + + closeModal = () => { + this.setState({ + addTaxagentModalVisible: false, + }); + }; + + render() { + const { + includeType, + selectedRowKeys, + searchValue, + addTaxagentModalVisible, + } = this.state; + const { + submitLoading, + queryLoading, + dataSource, + columns: taxAgentColumns, + pageObj, + setPageObj, + employeeStatus, + targetTypeList, + onTaxAgentSave, + } = this.props; + + const rowSelection = { + selectedRowKeys, + onChange: this.onSelectChange, + }; + const pagination = { + total: pageObj.total, + showTotal: (total) => `共 ${total} 条`, + showSizeChanger: true, + onShowSizeChange: (current, pageSize) => { + setPageObj && + setPageObj({ + current, + pageSize, + tab: includeType, + targetName: searchValue, + }); + }, + onChange: (current) => { + setPageObj && + setPageObj({ + current, + tab: includeType, + targetName: searchValue, + }); + }, + }; + + return ( +
+
+
+ { + this.handleTabClick(1); + }}> + 关联人员范围 + {" "} + {" "} | {" "}{" "} + { + this.handleTabClick(0); + }}> + 从范围中排除 + +
+
+
+ { + this.handleTabDelete(); + }} + /> + this.setState({ addTaxagentModalVisible: true })} + /> +
+ { + this.setState({ searchValue: value }); + }} + onSearch={(value) => { + this.handleSearch(value); + }} + /> +
+
+
+
+ + + + onTaxAgentSave && + onTaxAgentSave({ ...val, includeType: includeType }) + } + visible={addTaxagentModalVisible} + onCancel={() => { + this.setState({ addTaxagentModalVisible: false }); + }} + /> + + ); + } +} diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index b8609544..9cf12795 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -1,20 +1,20 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; -import * as API from '../apis/attendance'; // 引入API接口文件 +import * as API from "../apis/attendance"; // 引入API接口文件 const { TableStore } = WeaTableNew; export class AttendanceStore { @observable tableStore = new TableStore(); // new table - @observable attendTableStore = new TableStore(); + @observable attendTableStore = new TableStore(); @observable form = new WeaForm(); // nrew 一个form @observable condition = []; // 存储后台得到的form数据 @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 - @observable step = 0 ; + @observable step = 0; @observable modalVisiable = false; @observable slideVisiable = false; @observable currentItem = {}; @@ -40,7 +40,7 @@ export class AttendanceStore { @observable previewAttendQuoteList = []; // 导入-预览列表 @observable previewAttendQuoteColumns = []; // 导入预览-列表对应列 @observable previewAttendQuoteDataSource = []; // 导入预览-列表 - @observable importResult = {} + @observable importResult = {}; // 考勤数据详情 @observable attendQuoteDetailPageInfo = {}; // 详情列表分页数据 @@ -48,104 +48,107 @@ export class AttendanceStore { @observable cycle = {}; - // ** 设置导入参数 start ** + // ** 设置导入参数 start ** @action setPreviewAttendQuoteColumns = (previewAttendQuoteColumns) => { this.previewAttendQuoteColumns = previewAttendQuoteColumns; - } + }; @action setPreviewAttendQuoteDataSource = (previewAttendQuoteDataSource) => { - this.previewAttendQuoteDataSource = previewAttendQuoteDataSource - } + this.previewAttendQuoteDataSource = previewAttendQuoteDataSource; + }; @action setImportResult = (importResult) => { - this.importResult = importResult - } - // ** 设置导入参数 end ** - + this.importResult = importResult; + }; + // ** 设置导入参数 end ** @action searchFieldSettingList = (value) => { - if(value != "") { + if (value != "") { let requestFeildAttendList = [...this.requestFeildAttendList]; - this.fieldSettingAttendList = requestFeildAttendList.filter(item => item.name.indexOf(value) > -1) - let requestFeildCustomList = [...this.requestFeildCustomList] - this.fieldSettingCustomList = requestFeildCustomList.filter(item => item.name.indexOf(value) > -1) + this.fieldSettingAttendList = requestFeildAttendList.filter( + (item) => item.name.indexOf(value) > -1 + ); + let requestFeildCustomList = [...this.requestFeildCustomList]; + this.fieldSettingCustomList = requestFeildCustomList.filter( + (item) => item.name.indexOf(value) > -1 + ); } else { this.fieldSettingAttendList = [...this.requestFeildAttendList]; this.fieldSettingCustomList = [...this.requestFeildCustomList]; } - - } + }; @action - setFieldSettingAttendList = fieldSettingAttendList => - { - this.fieldSettingAttendList = fieldSettingAttendList - let requestFeildAttendList = [...this.requestFeildAttendList] - requestFeildAttendList.map(item => { - this.fieldSettingAttendList.map(inner => { - - if(inner.id == item.id && inner.checked != item.checked) { - item.checked = inner.checked + setFieldSettingAttendList = (fieldSettingAttendList) => { + this.fieldSettingAttendList = fieldSettingAttendList; + let requestFeildAttendList = [...this.requestFeildAttendList]; + requestFeildAttendList.map((item) => { + this.fieldSettingAttendList.map((inner) => { + if (inner.id == item.id && inner.checked != item.checked) { + item.checked = inner.checked; } - }) - }) + }); + }); this.requestFeildAttendList = requestFeildAttendList; - } + }; @action - setFieldSettingCustomList = fieldSettingCustomList => - { - this.fieldSettingCustomList = fieldSettingCustomList - let requestFeildCustomList = [...this.requestFeildCustomList] - requestFeildCustomList.map(item => { - this.fieldSettingCustomList.map(inner => { - if(inner.id == item.id && inner.checked != item.checked) { - item.checked = inner.checked + setFieldSettingCustomList = (fieldSettingCustomList) => { + this.fieldSettingCustomList = fieldSettingCustomList; + let requestFeildCustomList = [...this.requestFeildCustomList]; + requestFeildCustomList.map((item) => { + this.fieldSettingCustomList.map((inner) => { + if (inner.id == item.id && inner.checked != item.checked) { + item.checked = inner.checked; } - }) - }) - } + }); + }); + }; @action - setCurrentItem = currentItem => this.currentItem = currentItem; + setCurrentItem = (currentItem) => (this.currentItem = currentItem); @action - setCurrentItemOperate = currentItemOperate => this.currentItemOperate = currentItemOperate; + setCurrentItemOperate = (currentItemOperate) => + (this.currentItemOperate = currentItemOperate); @action - setSlideVisiable = slideVisiable => this.slideVisiable = slideVisiable; + setSlideVisiable = (slideVisiable) => (this.slideVisiable = slideVisiable); @action - setStep = step => this.step = step + setStep = (step) => (this.step = step); @action - setModalVisiable = modalVisiable => this.modalVisiable = modalVisiable - + setModalVisiable = (modalVisiable) => (this.modalVisiable = modalVisiable); + // 初始化操作 @action doInit = () => { // this.getCondition(); // this.getTableDatas(); - this.getAttendanceList({}) + this.getAttendanceList({}); // this.getAttendanceFieldSettingList({sourceType:'IMPORT'}) - } + }; // 获得高级搜索表单数据 @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 || '接口调用失败!') - } - })); - } + 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 @@ -153,298 +156,318 @@ export class AttendanceStore { 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.errormsg || '接口调用失败!') - } - this.loading = false; - })); - } + API.getTableDatas(params).then( + action((res) => { + if (res.api_status) { + // 接口请求成功/失败处理 + this.tableStore.getDatas(res.datas); // table 请求数据 + this.hasRight = res.hasRight; + } else { + message.error(res.errormsg || "接口调用失败!"); + } + this.loading = false; + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; // 字段列表 @action getAttendanceFieldList = (params) => { this.loading = true; - API.getAttendanceFieldList(params).then(res => { - if (res.status) { // 接口请求成功/失败处理 + API.getAttendanceFieldList(params).then((res) => { + if (res.status) { + // 接口请求成功/失败处理 this.fieldTableStore.getDatas(res.data.dataKey.datas); // table 请求数据 - this.fieldDataSource = res.data.pageInfo.list - this.fieldPageInfo = res.data.pageInfo + this.fieldDataSource = res.data.pageInfo.list; + this.fieldPageInfo = res.data.pageInfo; } else { - message.error(res.errormsg || '接口调用失败!') + message.error(res.errormsg || "接口调用失败!"); } this.loading = false; - }) - } + }); + }; @action saveAttendanceField = (params) => { - API.saveAttendanceField(params).then(res => { - if(res.status) { - message.success("保存成功") + API.saveAttendanceField(params).then((res) => { + if (res.status) { + message.success("保存成功"); } else { - message.error(res.errormsg ||"保存失败") + message.error(res.errormsg || "保存失败"); } - }) - } + }); + }; @action deleteAttendanceField = (params) => { - API.deleteAttendanceField(params).then(res => { - if(res.status) { - message.success("删除成功") + API.deleteAttendanceField(params).then((res) => { + if (res.status) { + message.success("删除成功"); } else { - message.error(res.errormsg ||"删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; // 批量删除 @action doBatchDelete = () => { - let ids = toJS(this.tableStore.selectedRowKeys) - if(ids.length == 0) { + let ids = toJS(this.tableStore.selectedRowKeys); + if (ids.length == 0) { message.warning("未选择任何条目"); - return + return; } - API.deleteAttendanceField(this.tableStore.selectedRowKeys).then(res => { - if(res.status) { - message.success("删除成功") + API.deleteAttendanceField(this.tableStore.selectedRowKeys).then((res) => { + if (res.status) { + message.success("删除成功"); } else { - message.error(res.errormsg || "删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; // 更新 @action updateAttendanceField = (params) => { - API.updateAttendanceField(params).then(res => { - if(res.status) { - message.success("修改成功") + API.updateAttendanceField(params).then((res) => { + if (res.status) { + message.success("修改成功"); } else { - message.error(res.errormsg || "修改失败") + message.error(res.errormsg || "修改失败"); } - }) - } + }); + }; // 更新状态 @action updateAttendanceFieldStatus = (params) => { - return API.updateAttendanceFieldStatus(params).then(res => { - if(res.status) { + return API.updateAttendanceFieldStatus(params).then((res) => { + if (res.status) { message.success("修改成功"); return new Promise((resolve, reject) => { resolve(true); - }) + }); } else { - message.error( res.errormsg || "修改失败") + message.error(res.errormsg || "修改失败"); return new Promise((resolve, reject) => { resolve(false); - }) + }); } - }) - } + }); + }; // 考勤数据列表 @action getAttendanceList = (params) => { this.loading = true; - API.getAttendanceList(params).then(res => { - if (res.status) { // 接口请求成功/失败处理 + API.getAttendanceList(params).then((res) => { + if (res.status) { + // 接口请求成功/失败处理 // this.attendTableStore.getDatas(res.data.datas); // table 请求数据 this.attendanceDataSource = res.data.list; this.attendancePageInfo = res.data; - this.attendanceColumns = res.data.columns + this.attendanceColumns = res.data.columns; } else { - message.error(res.errormsg || '接口调用失败!') + message.error(res.errormsg || "接口调用失败!"); } this.loading = false; - }) - } + }); + }; //数据采集-考勤引用-考勤引用字段设置-列表 @action getAttendanceFieldSettingList = (params) => { this.loading = true; - API.getAttendanceFieldSettingList(params).then(res => { - if(res.status) { - this.requestFeildAttendList = res.data[0] ? res.data[0].items : [] - this.fieldSettingAttendList = this.requestFeildAttendList - this.requestFeildCustomList = res.data[1] ? res.data[1].items : [] + API.getAttendanceFieldSettingList(params).then((res) => { + if (res.status) { + this.requestFeildAttendList = res.data[0] ? res.data[0].items : []; + this.fieldSettingAttendList = this.requestFeildAttendList; + this.requestFeildCustomList = res.data[1] ? res.data[1].items : []; this.fieldSettingCustomList = this.requestFeildCustomList; } else { - message.error(res.errormsg || "接口调用失败!") + message.error(res.errormsg || "接口调用失败!"); } this.loading = false; - }) - - } + }); + }; //数据采集-考勤引用-考勤引用字段设置-保存 - @action + @action saveAttendanceFieldSetting = (sourceType = "IMPORT") => { - let attendList = this.requestFeildAttendList.map(item => ({id: item.id, checked: item.checked})) - let customList = this.requestFeildCustomList.map(item => ({id: item.id, checked: item.checked})) + let attendList = this.requestFeildAttendList.map((item) => ({ + id: item.id, + checked: item.checked, + })); + let customList = this.requestFeildCustomList.map((item) => ({ + id: item.id, + checked: item.checked, + })); let request = { sourceType: sourceType, - currentSettingFields: [...attendList, ...customList] - } - API.saveAttendanceFieldSetting(request).then(res => { - if(res.status) { - message.success("保存成功") + currentSettingFields: [...attendList, ...customList], + }; + API.saveAttendanceFieldSetting(request).then((res) => { + if (res.status) { + message.success("保存成功"); } else { - message.error(res.errormsg || "保存失败") + message.error(res.errormsg || "保存失败"); } - }) - } - + }); + }; //数据采集-考勤引用-考勤引用字段设置-恢复默认设置 @action returnToAttendanceFieldSettingDefault = (sourceType = "IMPORT") => { - API.returnToAttendanceFieldSettingDefault({sourceType: sourceType}).then(res => { - if(res.status) { - this.requestFeildAttendList = res.data[0] ? res.data[0].items : [] - this.fieldSettingAttendList = this.requestFeildAttendList - this.requestFeildCustomList = res.data[1] ? res.data[1].items : [] - this.fieldSettingCustomList = this.requestFeildCustomList; - } else { - message.error(res.errormsg || "获取数据失败") + API.returnToAttendanceFieldSettingDefault({ sourceType: sourceType }).then( + (res) => { + if (res.status) { + this.requestFeildAttendList = res.data[0] ? res.data[0].items : []; + this.fieldSettingAttendList = this.requestFeildAttendList; + this.requestFeildCustomList = res.data[1] ? res.data[1].items : []; + this.fieldSettingCustomList = this.requestFeildCustomList; + } else { + message.error(res.errormsg || "获取数据失败"); + } } - }) - } + ); + }; //数据采集-考勤引用-考勤引用字段设置-设为默认设置 @action saveAttendanceFieldSettingAsDefault = (sourceType = "IMPORT") => { - - let attendList = this.requestFeildAttendList.map(item => ({id: item.id, checked: item.checked})) - let customList = this.requestFeildCustomList.map(item => ({id: item.id, checked: item.checked})) + let attendList = this.requestFeildAttendList.map((item) => ({ + id: item.id, + checked: item.checked, + })); + let customList = this.requestFeildCustomList.map((item) => ({ + id: item.id, + checked: item.checked, + })); let request = { - sourceType:sourceType, - currentSettingFields: [...attendList, ...customList] - } - API.saveAttendanceFieldSettingAsDefault(request).then(res => { - if(res.status) { - message.success("设置成功") + sourceType: sourceType, + currentSettingFields: [...attendList, ...customList], + }; + API.saveAttendanceFieldSettingAsDefault(request).then((res) => { + if (res.status) { + message.success("设置成功"); } else { - message.error( res.errormsg || "设置失败") + message.error(res.errormsg || "设置失败"); } - }) - } + }); + }; // 导入表单-账套列表 @action getLedgerList = () => { return new Promise((resolve, reject) => { - API.getLedgerList({}).then(res => { - if(res.status) { - this.importLedgerList = res.data - resolve(this.importLedgerList) + API.getLedgerList({}).then((res) => { + if (res.status) { + this.importLedgerList = res.data; + resolve(this.importLedgerList); } else { - message.error(res.errormsg || "获取失败") - reject() + message.error(res.errormsg || "获取失败"); + reject(); } - }) - }) - - } + }); + }); + }; // 下载导入模板 @action downloadTemplate = (salaryYearMonth, salarySobId) => { - API.downloadTemplate(salaryYearMonth, salarySobId) - } + API.downloadTemplate(salaryYearMonth, salarySobId); + }; // 导入预览 @action previewAttendQuote = (params) => { - API.previewAttendQuote(params).then(res => { - if(res.status) { - this.previewAttendQuoteList = res.data + API.previewAttendQuote(params).then((res) => { + if (res.status) { + this.previewAttendQuoteList = res.data; this.previewAttendQuoteColumns = res.data.headers.map((item, index) => { - let column = {} - column.title = item; + let column = {}; + column.title = item; column.dataIndex = "" + index; - column.key = index + "" - return column - }) + column.key = index + ""; + return column; + }); this.previewAttendQuoteDataSource = res.data.list.map((item) => { - let data = {} + let data = {}; item.map((i, index) => { - data[index + ''] = i - }) - return data - }) - + data[index + ""] = i; + }); + return data; + }); } else { message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 考勤导入 @action importAttendQuoteData = (params) => { - API.importAttendQuoteData(params).then(res => { - if(res.status) { - this.importResult = res.data + API.importAttendQuoteData(params).then((res) => { + if (res.status) { + this.importResult = res.data; } else { - message.error(res.errormsg || "导入失败") + message.error(res.errormsg || "导入失败"); } - }) - } - + }); + }; + // 考勤数据详情 @action viewAttendQuote = (params = {}) => { - API.viewAttendQuote(params).then(res => { - if(res.status) { - this.attendQuoteDetailPageInfo = res.data.pageInfo - this.attendQuoteDetailTableStore.getDatas(res.data.dataKey.datas) + API.viewAttendQuote(params).then((res) => { + if (res.status) { + this.attendQuoteDetailPageInfo = res.data.pageInfo; + this.attendQuoteDetailTableStore.getDatas(res.data.dataKey.datas); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; // 考勤引用同步 @action syncAttendanceRefer = (params) => { return new Promise((resolve, reject) => { - API.syncAttendanceRefer(params).then(res => { - if(res.status) { - message.success("同步成功") - resolve() + API.syncAttendanceRefer(params).then((res) => { + if (res.status) { + message.success("同步成功"); + resolve(); } else { - message.error(res.errormsg || "同步失败") + message.error(res.errormsg || "同步失败"); reject(); } - }) - }) - } + }); + }); + }; + // 考勤引用同步 + @action + checkOperation = (params) => { + return API.checkOperation(params); + }; // 根据所属月和账套获取周期 @action getSalaryCycleAndAttendCycle = (salaryYearMonthStr, salarySobId) => { - API.getSalaryCycleAndAttendCycle({salaryYearMonthStr, salarySobId}).then(res => { - if(res.status) { - this.cycle = res.data - } else { - message.error(res.errormsg || "获取失败") + API.getSalaryCycleAndAttendCycle({ salaryYearMonthStr, salarySobId }).then( + (res) => { + if (res.status) { + this.cycle = res.data; + } else { + message.error(res.errormsg || "获取失败"); + } } - - }) - } -} \ No newline at end of file + ); + }; +} diff --git a/pc4mobx/hrmSalary/stores/cumDeduct.js b/pc4mobx/hrmSalary/stores/cumDeduct.js index 42ba3d22..6803d625 100644 --- a/pc4mobx/hrmSalary/stores/cumDeduct.js +++ b/pc4mobx/hrmSalary/stores/cumDeduct.js @@ -1,10 +1,10 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; -import * as API from '../apis/cumDeduct'; // 引入API接口文件 -import * as TaxAgentApi from '../apis/taxAgent' -import { removePropertyCondition } from '../util/response'; +import * as API from "../apis/cumDeduct"; // 引入API接口文件 +import * as TaxAgentApi from "../apis/taxAgent"; +import { removePropertyCondition } from "../util/response"; const { TableStore } = WeaTableNew; @@ -16,61 +16,87 @@ export class CumDeductStore { @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 + @observable slideLoading = true; // 详情数据加载状态 @observable step = 0; // 当前所在第几步 @observable slideVisiable = false; // slide 是否隐藏 - @observable slideDataSource = []; - - @observable importResult = {} + @observable importResult = {}; @observable modalVisiable = false; // 模态框显示 - @observable currentRecord = {}; // 当前record + @observable columns = []; + @observable pageObj = {}; //列表数据 + @observable dataSource = []; //列表数据 + @observable slideColumns = []; //详情列数据 + @observable slidePageObj = {}; //详情分页列表数据 + @observable slideTableDataSource = []; //详情列表数据 - // ** 设置导入参数 start ** + // ** 设置导入参数 start ** @action setSlideDataSource = (slideDataSource) => { - this.slideDataSource = slideDataSource - } + this.slideDataSource = slideDataSource; + }; @action setImportResult = (importResult) => { - this.importResult = importResult - } - // ** 设置导入参数 end ** + this.importResult = importResult; + }; + // ** 设置导入参数 end ** @action - setCurrentRecord = currentRecord => this.currentRecord = currentRecord; + setColumns = (columns) => (this.columns = columns); @action - setModalVisiable = visiable => this.modalVisiable = visiable + setPageObj = (pageObj) => (this.pageObj = pageObj); @action - setStep = step => this.step = step; + setDataSource = (dataSource) => (this.dataSource = dataSource); + + // 详情列表数据 + @action + setSlideColumns = (columns) => (this.slideColumns = columns); @action - setSlideVisiable = slideVisiable => this.slideVisiable = slideVisiable; + setSlidePageObj = (pageObj) => (this.slidePageObj = pageObj); + @action + setSlideTableDataSource = (dataSource) => + (this.slideTableDataSource = dataSource); + + @action + setCurrentRecord = (currentRecord) => (this.currentRecord = currentRecord); + + @action + setModalVisiable = (visiable) => (this.modalVisiable = visiable); + + @action + setStep = (step) => (this.step = step); + + @action + setSlideVisiable = (slideVisiable) => (this.slideVisiable = slideVisiable); // 初始化操作 @action doInit = () => { this.getCondition(); this.getTableDatas(); - } + }; // 获得高级搜索表单数据 @action getCondition = () => { - API.getCumDeductSaCondition().then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - let condition = removePropertyCondition(res.data.condition) - this.condition = condition; - this.form.initFormFields(condition); // 渲染高级搜索form表单 - } else { - message.error(res.errormsg || '接口调用失败!') - } - })); - } + API.getCumDeductSaCondition().then( + action((res) => { + if (res.status) { + // 接口请求成功/失败处理 + let condition = removePropertyCondition(res.data.condition); + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 渲染table数据 @action @@ -78,71 +104,106 @@ export class CumDeductStore { params = params || {}; this.loading = true; let requestParams = this.form.getFormParams() || {}; - requestParams = {...requestParams, ...params} - API.getCumDeductList(requestParams).then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.data.datas); // table 请求数据 - } else { - message.error(res.errormsg || '接口调用失败!') - } - this.loading = false; - })); - } + requestParams = { + ...requestParams, + ...params, + current: this.pageObj.current, + pageSize: this.pageObj.pageSize, + }; + API.getCumDeductList(requestParams).then( + action(({ status, data, errormsg }) => { + this.loading = false; + if (status) { + // 接口请求成功/失败处理 + const { columns, list, total, pageNum: current, pageSize } = data; + this.setColumns(columns); + this.setDataSource(list); + this.setPageObj({ + total, + current, + pageSize, + }); + } else { + this.setDataSource([]); + this.setPageObj({ + ...this.pageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); + } + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; // 导入 @action importFile = (params) => { - API.importCumDeductParam(params).then(action(res => { - if(res.status) { - this.importResult = res.data - } - })) - } + API.importCumDeductParam(params).then( + action((res) => { + if (res.status) { + this.importResult = res.data; + } + }) + ); + }; // 导入预览 @action previewImport = (params) => { - API.importCumDeductPreview(params).then(action(res => { - if(res.status) { - this.slideDataSource = res.data.preview - } else { - message.error(res.errormsg || '预览失败') - } - })) - } + API.importCumDeductPreview(params).then( + action((res) => { + if (res.status) { + this.slideDataSource = res.data.preview; + } else { + message.error(res.errormsg || "预览失败"); + } + }) + ); + }; // 导出 @action exportCumDeductList = (ids = "") => { - API.exportCumDeductList(ids) - } + API.exportCumDeductList(ids); + }; // 查询明细 @action getCumDeductDetailList = (id, param = {}) => { - let requestParams = {"accumulatedSpecialAdditionalDeductionId": id}; - requestParams = {...requestParams, ...param} - API.getCumDeductDetailList(requestParams).then(res => { - if(res.status) { - if (res.status) { // 接口请求成功/失败处理 - this.slideTableStore.getDatas(res.data.datas); // table 请求数据 + let requestParams = { accumulatedSpecialAdditionalDeductionId: id }; + requestParams = { ...requestParams, ...param }; + this.slideLoading = true; + API.getCumDeductDetailList(requestParams).then( + ({ data, status, errormsg }) => { + this.slideLoading = false; + if (status) { + const { columns, list, total, pageNum: current, pageSize } = data; + this.setSlideColumns(columns); + this.setSlideTableDataSource(list); + this.setSlidePageObj({ + total, + current, + pageSize, + }); } else { - message.error(res.errormsg || '接口调用失败!') + this.setSlideTableDataSource(list); + this.setSlidePageObj({ + ...this.slidePageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); } } - }) - } + ); + }; // 导出明细 @action exportCumDeductDetailList = (id, ids = "") => { - API.exportCumDeductDetailList(id, ids) - } - - - -} \ No newline at end of file + API.exportCumDeductDetailList(id, ids); + }; +} diff --git a/pc4mobx/hrmSalary/stores/cumSituation.js b/pc4mobx/hrmSalary/stores/cumSituation.js index 500ad050..999a367a 100644 --- a/pc4mobx/hrmSalary/stores/cumSituation.js +++ b/pc4mobx/hrmSalary/stores/cumSituation.js @@ -1,10 +1,9 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; -import { removePropertyCondition } from '../util/response'; +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; +import { removePropertyCondition } from "../util/response"; -import * as API from '../apis/cumSituation'; // 引入API接口文件 -import * as TaxAgentApi from '../apis/taxAgent' +import * as API from "../apis/cumSituation"; // 引入API接口文件 const { TableStore } = WeaTableNew; @@ -19,56 +18,84 @@ export class CumSituationStore { @observable step = 0; // 当前所在第几步 @observable slideVisiable = false; // slide 是否隐藏 @observable slideDataSource = []; - @observable importResult = {} + @observable importResult = {}; @observable modalVisiable = false; // 模态框显示 @observable currentRecord = {}; // 当前record + @observable columns = []; + @observable pageObj = {}; //列表数据 + @observable dataSource = []; //列表数据 + @observable slideColumns = []; //详情列数据 + @observable slidePageObj = {}; //详情分页列表数据 + @observable slideTableDataSource = []; //详情列表数据 // ** 设置导入参数 start ** @action setSlideDataSource = (slideDataSource) => { - this.slideDataSource = slideDataSource - } + this.slideDataSource = slideDataSource; + }; @action setImportResult = (importResult) => { - this.importResult = importResult - } + this.importResult = importResult; + }; // ** 设置导入参数 end ** @action - setCurrentRecord = currentRecord => this.currentRecord = currentRecord; + setColumns = (columns) => (this.columns = columns); @action - setModalVisiable = visiable => this.modalVisiable = visiable + setPageObj = (pageObj) => (this.pageObj = pageObj); @action - setStep = step => this.step = step; + setDataSource = (dataSource) => (this.dataSource = dataSource); + + // 详情列表数据 + @action + setSlideColumns = (columns) => (this.slideColumns = columns); @action - setSlideVisiable = slideVisiable => this.slideVisiable = slideVisiable; + setSlidePageObj = (pageObj) => (this.slidePageObj = pageObj); + @action + setSlideTableDataSource = (dataSource) => + (this.slideTableDataSource = dataSource); + + @action + setCurrentRecord = (currentRecord) => (this.currentRecord = currentRecord); + + @action + setModalVisiable = (visiable) => (this.modalVisiable = visiable); + + @action + setStep = (step) => (this.step = step); + + @action + setSlideVisiable = (slideVisiable) => (this.slideVisiable = slideVisiable); // 初始化操作 @action doInit = () => { this.getCondition(); this.getTableDatas(); - } + }; // 获得高级搜索表单数据 @action getCondition = () => { - API.getCumSituationSaCondition().then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - let condition = removePropertyCondition(res.data.condition) - this.condition = condition; - this.form.initFormFields(condition); // 渲染高级搜索form表单 - } else { - message.error(res.errormsg || '接口调用失败!') - } - })); - } + API.getCumSituationSaCondition().then( + action((res) => { + if (res.status) { + // 接口请求成功/失败处理 + let condition = removePropertyCondition(res.data.condition); + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 渲染table数据 @action @@ -76,72 +103,102 @@ export class CumSituationStore { params = params || {}; this.loading = true; let requestParams = this.form.getFormParams() || {}; - requestParams = {...requestParams, ...params} - API.getCumSituationList(requestParams).then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.data.datas); // table 请求数据 - } else { - message.error(res.errormsg || '接口调用失败!') - } - this.loading = false; - })); - } + requestParams = { ...requestParams, ...params }; + API.getCumSituationList(requestParams).then( + action(({ status, data, errormsg }) => { + this.loading = false; + if (status) { + // 接口请求成功/失败处理 + const { columns, list, total, pageNum: current, pageSize } = data; + this.setColumns(columns); + this.setDataSource(list); + this.setPageObj({ + total, + current, + pageSize, + }); + } else { + this.setDataSource([]); + this.setPageObj({ + ...this.pageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); + } + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; -// 导入 + // 导入 @action importFile = (params) => { - API.importCumSituationParam(params).then(action(res => { - if(res.status) { - this.importResult = res.data - } else { - message.error(res.errormsg || '接口调用失败!') - } - })) - } + API.importCumSituationParam(params).then( + action((res) => { + if (res.status) { + this.importResult = res.data; + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 导入预览 @action previewImport = (params) => { - API.importCumSituationPreview(params).then(action(res => { - if(res.status) { - this.slideDataSource = res.data.preview - } else { - message.error(res.errormsg || '接口调用失败!') - } - })) - } + API.importCumSituationPreview(params).then( + action((res) => { + if (res.status) { + this.slideDataSource = res.data.preview; + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 导出 @action exportCumSituationList = (ids = "") => { - API.exportCumSituationList(ids) - } + API.exportCumSituationList(ids); + }; // 查询明细 @action getCumDeductDetailList = (id, param = {}) => { - let requestParams = {"accumulatedSituationId": id}; - requestParams = {...requestParams, ...param} - API.getCumSituationDetailList(requestParams).then(res => { - if(res.status) { - if (res.status) { // 接口请求成功/失败处理 - this.slideTableStore.getDatas(res.data.datas); // table 请求数据 + let requestParams = { accumulatedSituationId: id }; + requestParams = { ...requestParams, ...param }; + API.getCumSituationDetailList(requestParams).then( + ({ status, data, errormsg }) => { + if (status) { + // 接口请求成功/失败处理 + const { columns, list, total, pageNum: current, pageSize } = data; + this.setSlideColumns(columns); + this.setSlideTableDataSource(list); + this.setSlidePageObj({ + total, + current, + pageSize, + }); } else { - message.error(res.errormsg || '接口调用失败!') + this.setSlideTableDataSource([]); + this.setSlidePageObj({ + ...this.slidePageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); } } - }) - } + ); + }; // 导出明细 @action exportCumSituationDetailList = (id, ids = "") => { - API.exportCumSituationDetailList(id, ids) - } - - -} \ No newline at end of file + API.exportCumSituationDetailList(id, ids); + }; +} diff --git a/pc4mobx/hrmSalary/stores/ledger.js b/pc4mobx/hrmSalary/stores/ledger.js index 3d269f48..ca3b7b94 100644 --- a/pc4mobx/hrmSalary/stores/ledger.js +++ b/pc4mobx/hrmSalary/stores/ledger.js @@ -1,10 +1,10 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; -import * as API from '../apis/ledger'; // 引入API接口文件 -import { tempateColumns } from '../pages/payroll/columns'; -import { notNull } from '../util/validate'; +import * as API from "../apis/ledger"; // 引入API接口文件 +import { tempateColumns } from "../pages/payroll/columns"; +import { notNull } from "../util/validate"; const { TableStore } = WeaTableNew; @@ -16,20 +16,20 @@ export class LedgerStore { @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 @observable salarySobId = ""; - @observable includeType=1; // 0:排除、1:包含 + @observable includeType = 1; // 0:排除、1:包含 @observable userTableStore = {}; @observable addUserModalVisible = false; @observable itemGroups = [ { - id:"default", + id: "default", name: "未分类", - items: [] - } + items: [], + }, ]; @observable salaryItemTableStore = new TableStore(); - @observable empBrowserList = [] - @observable empFields = [] - @observable excludeIds = [] + @observable empBrowserList = []; + @observable empFields = []; + @observable excludeIds = []; @observable addCategoryVisible = false; // 薪资项目-添加分类Modal @observable ruleOptionList = []; // 第四步规则可选项目列表 @@ -47,144 +47,163 @@ export class LedgerStore { @action initSlideData = () => { this.salarySobId = ""; - this.includeType = 1 - this.userTableStore = {} - this.addUserModalVisible = false + this.includeType = 1; + this.userTableStore = {}; + this.addUserModalVisible = false; this.itemGroups = [ { - id:"default", + id: "default", name: "未分类", - items: [] - } + items: [], + }, ]; - this.empBrowserList = [] - this.empFields = [] - this.excludeIds = [] - this.ruleOptionList = [] + this.empBrowserList = []; + this.empFields = []; + this.excludeIds = []; + this.ruleOptionList = []; this.sobItemRuleDataSource = []; // 第四步规则列表 this.ledgerRuleList = []; this.baseInfoRequest = {}; this.userSelectedList = []; - } + }; + @observable columns = []; + @observable pageObj = {}; //列表数据 + @observable dataSource = []; //列表数据 + + @action + setColumns = (columns) => (this.columns = columns); + + @action + setPageObj = (pageObj) => (this.pageObj = pageObj); + + @action + setDataSource = (dataSource) => (this.dataSource = dataSource); // 设置员工字段 @action - setEmpFields = (empFields) => this.empFields = empFields + setEmpFields = (empFields) => (this.empFields = empFields); @action - setUserSelectedList = userSelectedList => this.userSelectedList = userSelectedList + setUserSelectedList = (userSelectedList) => + (this.userSelectedList = userSelectedList); @action - setBaseInfoRequest = baseInfoRequest => this.baseInfoRequest = baseInfoRequest + setBaseInfoRequest = (baseInfoRequest) => + (this.baseInfoRequest = baseInfoRequest); @action - setSobItemRuleDataSource = sobItemRuleDataSource => this.sobItemRuleDataSource = sobItemRuleDataSource + setSobItemRuleDataSource = (sobItemRuleDataSource) => + (this.sobItemRuleDataSource = sobItemRuleDataSource); @action - setAddCategoryVisible = addCategoryVisible => this.addCategoryVisible = addCategoryVisible + setAddCategoryVisible = (addCategoryVisible) => + (this.addCategoryVisible = addCategoryVisible); @action - setExcludeIds = excludeIds => this.excludeIds = excludeIds - + setExcludeIds = (excludeIds) => (this.excludeIds = excludeIds); + @action - addExcludeIds = id => { - let excludeIds = [...this.excludeIds] - excludeIds.push(id) - this.excludeIds = excludeIds - } + addExcludeIds = (id) => { + let excludeIds = [...this.excludeIds]; + excludeIds.push(id); + this.excludeIds = excludeIds; + }; @action addEmpFields = (fieldId) => { let sortedIndex = 1; - if(this.empFields.length > 0) { - let lastSortedIndex = this.empFields[this.empFields.length - 1].sortedIndex - sortedIndex = parseInt(lastSortedIndex) + 1 + if (this.empFields.length > 0) { + let lastSortedIndex = + this.empFields[this.empFields.length - 1].sortedIndex; + sortedIndex = parseInt(lastSortedIndex) + 1; } let item = { fieldId, sortedIndex, - canDelete: true - } - let result = [...this.empFields] - result.push(item) - this.empFields = result - this.userSelectedList = this.empFields.map(item => { - item = {...item} - item.key = item.fieldId - if(!item.showname || item.showname == "") { - this.empBrowserList.map(bitem => { - if(bitem.key == item.fieldId) { - item.showname = bitem.showname + canDelete: true, + }; + let result = [...this.empFields]; + result.push(item); + this.empFields = result; + this.userSelectedList = this.empFields.map((item) => { + item = { ...item }; + item.key = item.fieldId; + if (!item.showname || item.showname == "") { + this.empBrowserList.map((bitem) => { + if (bitem.key == item.fieldId) { + item.showname = bitem.showname; } - }) + }); } return item; - }) - } + }); + }; @action - setItemGroups = itemGroups => this.itemGroups = itemGroups + setItemGroups = (itemGroups) => (this.itemGroups = itemGroups); @action - addItemGroup = name => { - if(!name || name == "" || name.trim() == "") { - message.warning("分类名称不能为空") - return + addItemGroup = (name) => { + if (!name || name == "" || name.trim() == "") { + message.warning("分类名称不能为空"); + return; } - let itemGroups = [...this.itemGroups] + let itemGroups = [...this.itemGroups]; let flag = false; - itemGroups.map(item => { - if(item.name == name) { + itemGroups.map((item) => { + if (item.name == name) { flag = true; } - }) - if(flag) { - message.warning("分类已存在") - return + }); + if (flag) { + message.warning("分类已存在"); + return; } - let item = {name, items: []} - itemGroups.unshift(item) - this.setItemGroups(itemGroups) - this.addCategoryVisible = false - } + let item = { name, items: [] }; + itemGroups.unshift(item); + this.setItemGroups(itemGroups); + this.addCategoryVisible = false; + }; @action addItemsToGroup = (title, list) => { - let itemGroups = [...this.itemGroups] - itemGroups.map(item => { - if(item.name == title) { - item.items = item.items ? item.items.concat(list) : list + let itemGroups = [...this.itemGroups]; + itemGroups.map((item) => { + if (item.name == title) { + item.items = item.items ? item.items.concat(list) : list; } - }) + }); this.setItemGroups(itemGroups); - } + }; @action - addCategoryList = item => { - let list = [...this.categoryList] - list.push(item) - this.categoryList = list - } - - @action - removeCategoryList = item => { - let list = [...this.categoryList] - list.filter(i => item.name != i.name) + addCategoryList = (item) => { + let list = [...this.categoryList]; + list.push(item); this.categoryList = list; - } + }; @action - setAddUserModalVisible = addUserModalVisible => this.addUserModalVisible = addUserModalVisible; + removeCategoryList = (item) => { + let list = [...this.categoryList]; + list.filter((i) => item.name != i.name); + this.categoryList = list; + }; @action - setUserTableStore = userTableStore => this.userTableStore = userTableStore; + setAddUserModalVisible = (addUserModalVisible) => + (this.addUserModalVisible = addUserModalVisible); @action - setIncludeType = includeType => this.includeType = includeType + setUserTableStore = (userTableStore) => + (this.userTableStore = userTableStore); @action - setSalarySobId = salarySobId => this.salarySobId = salarySobId; + setIncludeType = (includeType) => (this.includeType = includeType); + + @action + setSalarySobId = (salarySobId) => (this.salarySobId = salarySobId); // 初始化操作 @action @@ -201,9 +220,9 @@ export class LedgerStore { attendCycleType: "1", attendCycleFromDay: "1", socialSecurityCycleType: "1", - description: "" - }) - } + description: "", + }); + }; @action initBaseInfoRequest = () => { @@ -216,468 +235,488 @@ export class LedgerStore { attendCycleType: "1", attendCycleFromDay: "1", socialSecurityCycleType: "1", - description: "" - }) - } + description: "", + }); + }; // 获得高级搜索表单数据 @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 || '接口调用失败!') - } - })); - } + 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.getLedgerList(params).then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.data.datas); // table 请求数据 - } else { - message.error(res.errormsg || '接口调用失败!') - } - this.loading = false; - })); - } + API.getLedgerList(params).then( + action(({ status, data, errormsg }) => { + this.loading = false; + if (status) { + // 接口请求成功/失败处理 + const { columns, list, total, pageNum: current, pageSize } = data; + this.setColumns(columns); + this.setDataSource(list); + this.setPageObj({ + total, + current, + pageSize, + }); + } else { + this.setDataSource([]); + this.setPageObj({ + ...this.pageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); + } + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; // 复制 @action doCopy = (id, name) => { return new Promise((resolve, reject) => { - API.duplicateLedger({id, name}).then(res => { - if(res.status) { - message.success("复制成功") + API.duplicateLedger({ id, name }).then((res) => { + if (res.status) { + message.success("复制成功"); this.getTableDatas({}); resolve(); } else { - message.error(res.errormsg || "复制失败") + message.error(res.errormsg || "复制失败"); reject(); } - }) - }) - - } - + }); + }); + }; //启用/禁用薪资帐套 @action changeLedgerStatus = (id, disable) => { - API.changeLedgerStatus({id, disable}).then(res => { - if(res.status) { + API.changeLedgerStatus({ id, disable }).then((res) => { + if (res.status) { this.getTableDatas({}); - message.success("修改成功") + message.success("修改成功"); } else { - message.error(res.errormsg || "修改失败") + message.error(res.errormsg || "修改失败"); } - }) - } + }); + }; validateBaseFrom(params) { - if(!notNull(params.name)) { + if (!notNull(params.name)) { message.warning("名称不能为空"); - return false + return false; } - if(!notNull(params.taxableItems)) { + if (!notNull(params.taxableItems)) { message.warning("薪资类型不能为空"); - return false + return false; } - if(!notNull(params.salaryCycleType)) { + if (!notNull(params.salaryCycleType)) { message.warning("薪资周期不能为空"); - return false + return false; } - if(!notNull(params.salaryCycleFromDay)) { + if (!notNull(params.salaryCycleFromDay)) { message.warning("薪资周期不能为空"); - return false + return false; } - if(!notNull(params.taxCycleType)) { + if (!notNull(params.taxCycleType)) { message.warning("税款所属期不能为空"); - return false + return false; } - if(!notNull(params.attendCycleType)) { + if (!notNull(params.attendCycleType)) { message.warning("考勤周期不能为空"); - return false + return false; } - if(!notNull(params.attendCycleFromDay)) { + if (!notNull(params.attendCycleFromDay)) { message.warning("考勤周期不能为空"); - return false + return false; } - if(!notNull(params.socialSecurityCycleType)) { + if (!notNull(params.socialSecurityCycleType)) { message.warning("福利台账月份不能为空"); - return false + return false; } - return true + return true; } - //保存薪资帐套基本信息 @action saveLedgerBasic = (params) => { - if(!this.validateBaseFrom(params)) { - return + if (!this.validateBaseFrom(params)) { + return; } return new Promise((resolve, reject) => { - API.saveLedgerBasic(params).then(res => { - if(res.status) { + API.saveLedgerBasic(params).then((res) => { + if (res.status) { this.salarySobId = res.data; - resolve() - this.getTableDatas({}) - message.success("保存成功") + resolve(); + this.getTableDatas({}); + message.success("保存成功"); } else { - reject(res.errormsg || "保存失败") - message.error(res.errormsg || "保存失败") + reject(res.errormsg || "保存失败"); + message.error(res.errormsg || "保存失败"); } - }) - }) - - } + }); + }); + }; //删除薪资帐套 @action deleteLedger = (params) => { - API.deleteLedger(params).then(res => { - if(res.status) { - message.success("删除成功") + API.deleteLedger(params).then((res) => { + if (res.status) { + message.success("删除成功"); this.getTableDatas({}); } else { - message.error(res.errormsg || "删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; validateLedgerPersonRange(params) { - if(!notNull(params.includeType)) { - message.warning("对象类型不能为空") - return false + if (!notNull(params.includeType)) { + message.warning("对象类型不能为空"); + return false; } - if(!notNull(params.targetParams)) { - message.warning("对象类型不能为空") - return false + if (!notNull(params.targetParams)) { + message.warning("对象类型不能为空"); + return false; } - if(!notNull(params.employeeStatus)) { - message.warning("选择员工状态不能为空") - return false + if (!notNull(params.employeeStatus)) { + message.warning("选择员工状态不能为空"); + return false; } - return true + return true; } //保存薪资帐套人员范围 @action saveLedgerPersonRange = (params) => { - if(!this.validateLedgerPersonRange(params)) { - return + if (!this.validateLedgerPersonRange(params)) { + return; } - API.saveLedgerPersonRange(params).then(res => { - if(res.status) { - if(this.includeType == 1) { - this.getLedgerPersonRangeInclude({salarySobId: this.salarySobId}) + API.saveLedgerPersonRange(params).then((res) => { + if (res.status) { + if (this.includeType == 1) { + this.getLedgerPersonRangeInclude({ salarySobId: this.salarySobId }); } else { - this.getLedgerPersonRangeExclude({salarySobId: this.salarySobId}) + this.getLedgerPersonRangeExclude({ salarySobId: this.salarySobId }); } this.addUserModalVisible = false; - message.success("添加成功") + message.success("添加成功"); } else { - message.error(res.errormsg || "添加失败") + message.error(res.errormsg || "添加失败"); } - }) - } + }); + }; //薪资帐套人员范围(包含)列表 getLedgerPersonRangeInclude = (params) => { - API.getLedgerPersonRangeInclude(params).then(res => { - if(res.status) { - this.setUserTableStore(res.data) + API.getLedgerPersonRangeInclude(params).then((res) => { + if (res.status) { + this.setUserTableStore(res.data); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; //薪资帐套人员范围(排除)列表 getLedgerPersonRangeExclude = (params) => { - API.getLedgerPersonRangeExclude(params).then(res => { - if(res.status) { - this.setUserTableStore(res.data) + API.getLedgerPersonRangeExclude(params).then((res) => { + if (res.status) { + this.setUserTableStore(res.data); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; //删除薪资帐套人员范围 deleteLedgerPersonRange = (params) => { - API.deleteLedgerPersonRange(params).then(res => { - if(res.status) { - if(this.includeType == 1) { - this.getLedgerPersonRangeInclude({salarySobId: this.salarySobId}) + API.deleteLedgerPersonRange(params).then((res) => { + if (res.status) { + if (this.includeType == 1) { + this.getLedgerPersonRangeInclude({ salarySobId: this.salarySobId }); } else { - this.getLedgerPersonRangeExclude({salarySobId: this.salarySobId}) + this.getLedgerPersonRangeExclude({ salarySobId: this.salarySobId }); } - message.success("删除成功") + message.success("删除成功"); } else { - message.error(res.errormsg || "删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; - // 薪资项目可选列表 + // 薪资项目可选列表 @action listSalaryItem = (searchValue = "", current = 1) => { - let excludeIds = [] - this.itemGroups.map(item => { - item.items && item.items.map(i => { - excludeIds.push(i.salaryItemId) - }) - }) - this.loading = true - API.listSalaryItem({name:searchValue, excludeIds, current}).then(res => { - if(res.status) { - if(res.data.list) { - this.addSalaryItemDataSource = res.data.list.map(item => { - item = {...item} - item.key = item.id - return item; - }); + let excludeIds = []; + this.itemGroups.map((item) => { + item.items.map((i) => { + excludeIds.push(i.salaryItemId); + }); + }); + this.loading = true; + API.listSalaryItem({ name: searchValue, excludeIds, current }).then( + (res) => { + if (res.status) { + if (res.data.list) { + this.addSalaryItemDataSource = res.data.list.map((item) => { + item = { ...item }; + item.key = item.id; + return item; + }); + } else { + this.addSalaryItemDataSource = []; + } + + this.addSalaryItemColumns = res.data.columns; + this.addSalaryItemPageInfo = res.data; + // this.salaryItemTableStore.getDatas(res.data.datas); } else { - this.addSalaryItemDataSource = [] + message.error(res.errormsg || "获取数据失败"); } - - this.addSalaryItemColumns = res.data.columns; - this.addSalaryItemPageInfo = res.data - // this.salaryItemTableStore.getDatas(res.data.datas); - } else { - message.error(res.errormsg || "获取数据失败") + this.loading = false; } - this.loading = false - }) - } + ); + }; @action empFieldList = () => { - API.empFieldList().then(res => { - if(res.status) { - this.empBrowserList = res.data.map(item => {return {showname: item.name, key: item.id, selected: false}}) + API.empFieldList().then((res) => { + if (res.status) { + this.empBrowserList = res.data.map((item) => { + return { showname: item.name, key: item.id, selected: false }; + }); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; @action saveLedgerItem = () => { - let itemGroups = [...this.itemGroups] - itemGroups = itemGroups.map(item => { - let result = {...item} - if(result.items) { - result.items = result.items.map((i,index) => ( - { + let itemGroups = [...this.itemGroups]; + itemGroups = itemGroups + .map((item) => { + let result = { ...item }; + if (result.items) { + result.items = result.items.map((i, index) => ({ salaryItemId: i.salaryItemId, sortedIndex: index + 1, - formulaId: i.formulaId - } - )) - return result; - } - }).filter(item => item) + formulaId: i.formulaId, + })); + return result; + } + }) + .filter((item) => item); let params = { salarySobId: this.salarySobId, empFields: this.empFields, - itemGroups: itemGroups.filter(item => item.id != "default"), - items: itemGroups.filter(item => item.id == 'default')[0].items - } + itemGroups: itemGroups.filter((item) => item.id != "default"), + items: itemGroups.filter((item) => item.id == "default")[0].items, + }; return new Promise((resolve, reject) => { - API.saveLedgerItem(params).then(res => { - if(res.status) { - resolve() + API.saveLedgerItem(params).then((res) => { + if (res.status) { + resolve(); message.success("保存成功"); } else { - reject() - message.error(res.errormsg || "保存失败") + reject(); + message.error(res.errormsg || "保存失败"); } - }) - }) - - } - + }); + }); + }; + // 调薪计薪规则可选的薪资项目列表 @action listSalarySobItem = () => { let params = { salarySobId: this.salarySobId, - excludeSalaryItemIds: this.sobItemRuleDataSource.map(item => item.salaryItemId) - } + excludeSalaryItemIds: this.sobItemRuleDataSource.map( + (item) => item.salaryItemId + ), + }; return new Promise((resolve, reject) => { - API.listSalarySobItem(params).then(res => { - if(res.status) { - this.ruleOptionList = res.data.map(item => { + API.listSalarySobItem(params).then((res) => { + if (res.status) { + this.ruleOptionList = res.data.map((item) => { return { key: item.salaryItemId.toString(), showname: item.salaryItemName, - selected: false - } - }) - resolve() + selected: false, + }; + }); + resolve(); } else { - reject() - message.error(res.errormsg || "获取失败") + reject(); + message.error(res.errormsg || "获取失败"); } - }) - }) - } + }); + }); + }; // 调薪计薪规则保存 @action saveAdjustmentRule = () => { let params = { - salarySobId:this.salarySobId, - ruleParams:this.sobItemRuleDataSource - } + salarySobId: this.salarySobId, + ruleParams: this.sobItemRuleDataSource, + }; return new Promise((resolve, reject) => { - API.saveAdjustmentRule(params).then(res => { - if(res.status) { - resolve() - message.success("保存成功") + API.saveAdjustmentRule(params).then((res) => { + if (res.status) { + resolve(); + message.success("保存成功"); } else { - reject() - message.error(res.errormsg || "获取失败") + reject(); + message.error(res.errormsg || "获取失败"); } - }) - }) - } + }); + }); + }; @action listAdjustmentRule = () => { let params = { - salarySobId: this.salarySobId - } - API.listAdjustmentRule(params).then(res => { - if(res.status) { - this.sobItemRuleDataSource = res.data + salarySobId: this.salarySobId, + }; + API.listAdjustmentRule(params).then((res) => { + if (res.status) { + this.sobItemRuleDataSource = res.data; } - }) - } + }); + }; // 保存薪资帐套校验规则 @action saveLedgerRule = (params) => { params.salarySobId = this.salarySobId; - API.saveLedgerRule(params).then(res => { - if(res.status) { - this.getLedgerRuleList() - message.success("保存成功") + API.saveLedgerRule(params).then((res) => { + if (res.status) { + this.getLedgerRuleList(); + message.success("保存成功"); } else { - message.error(res.errormsg || "保存失败") + message.error(res.errormsg || "保存失败"); } - }) - } + }); + }; //薪资帐套校验规则列表 @action getLedgerRuleList = (name = "") => { let params = { salarySobId: this.salarySobId, - name - } - API.getLedgerRuleList(params).then(res => { - if(res.status) { - this.ledgerRuleList = res.data + name, + }; + API.getLedgerRuleList(params).then((res) => { + if (res.status) { + this.ledgerRuleList = res.data; } else { - message.error(res.errormsg || "获取数据失败") + message.error(res.errormsg || "获取数据失败"); } - }) - } + }); + }; //删除薪资帐套校验规则 @action deleteLedgerRule = (ids) => { - API.deleteLedgerRule(ids).then(res => { - if(res.status) { - message.success("删除成功") + API.deleteLedgerRule(ids).then((res) => { + if (res.status) { + message.success("删除成功"); this.getLedgerRuleList(); } else { - message.error(res.errormsg || "删除失败") + message.error(res.errormsg || "删除失败"); } - }) - } + }); + }; // 获取基本信息 @action getLedgerBasicForm = () => { - API.getLedgerBasicForm(this.salarySobId).then(res => { - if(res.status) { - let basicForm = res.data.basicForm - Object.keys(basicForm).map(key => { - if(basicForm[key]) { + API.getLedgerBasicForm(this.salarySobId).then((res) => { + if (res.status) { + let basicForm = res.data.basicForm; + Object.keys(basicForm).map((key) => { + if (basicForm[key]) { basicForm[key] = basicForm[key].toString(); } - }) - this.baseInfoRequest = basicForm + }); + this.baseInfoRequest = basicForm; } else { - messsage.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } + }); + }; //薪资帐套薪资项目详情 @action getLedgerItemForm = () => { - API.getLedgerItemForm({salarySobId: this.salarySobId}).then(res => { - if(res.status) { - this.empFields = res.data.empFields - this.itemGroups = res.data.itemGroups + API.getLedgerItemForm({ salarySobId: this.salarySobId }).then((res) => { + if (res.status) { + this.empFields = res.data.empFields; + this.itemGroups = res.data.itemGroups; let defaultItems = { - id:"default", + id: "default", name: "未分类", - items:res.data.items - } - this.itemGroups.unshift(defaultItems) - API.empFieldList().then(ires => { - if(res.status) { - this.empBrowserList = ires.data.map(item => {return {showname: item.name, key: item.id, selected: false}}) - this.userSelectedList = this.empFields.map(item => { - item = {...item} - item.key = item.fieldId - this.empBrowserList.map(bitem => { - if(bitem.key == item.fieldId) { - item.showname = bitem.showname - } - }) - return item; - }) - console.log("this.userSelectedList: " ,toJS(this.userSelectedList)); + items: res.data.items, + }; + this.itemGroups.unshift(defaultItems); + API.empFieldList().then((ires) => { + if (res.status) { + this.empBrowserList = ires.data.map((item) => { + return { showname: item.name, key: item.id, selected: false }; + }); + this.userSelectedList = this.empFields.map((item) => { + item = { ...item }; + item.key = item.fieldId; + this.empBrowserList.map((bitem) => { + if (bitem.key == item.fieldId) { + item.showname = bitem.showname; + } + }); + return item; + }); + console.log("this.userSelectedList: ", toJS(this.userSelectedList)); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) + }); } else { - message.error(res.errormsg || "获取失败") + message.error(res.errormsg || "获取失败"); } - }) - } - -} \ No newline at end of file + }); + }; +} diff --git a/pc4mobx/hrmSalary/stores/otherDeduct.js b/pc4mobx/hrmSalary/stores/otherDeduct.js index e85429b9..79609e7b 100644 --- a/pc4mobx/hrmSalary/stores/otherDeduct.js +++ b/pc4mobx/hrmSalary/stores/otherDeduct.js @@ -1,10 +1,10 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; -import { removePropertyCondition } from '../util/response'; +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; +import { removePropertyCondition } from "../util/response"; -import * as API from '../apis/otherDeduct'; // 引入API接口文件 -import * as TaxAgentApi from '../apis/taxAgent' +import * as API from "../apis/otherDeduct"; // 引入API接口文件 +import * as TaxAgentApi from "../apis/taxAgent"; const { TableStore } = WeaTableNew; @@ -16,60 +16,88 @@ export class OtherDeductStore { @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示 @observable loading = true; // 数据加载状态 + @observable slideLoading = true; // 详情数据加载状态 @observable step = 0; // 当前所在第几步 @observable slideVisiable = false; // slide 是否隐藏 - @observable slideDataSource = []; - - @observable importResult = {} + @observable importResult = {}; @observable modalVisiable = false; // 模态框显示 - @observable currentRecord = {}; // 当前record - // ** 设置导入参数 start ** + @observable columns = []; + @observable pageObj = {}; //列表数据 + @observable dataSource = []; //列表数据 + @observable slideColumns = []; //详情列数据 + @observable slidePageObj = {}; //详情分页列表数据 + @observable slideTableDataSource = []; //详情列表数据 + + // ** 设置导入参数 start ** @action setSlideDataSource = (slideDataSource) => { - this.slideDataSource = slideDataSource - } + this.slideDataSource = slideDataSource; + }; @action setImportResult = (importResult) => { - this.importResult = importResult - } - // ** 设置导入参数 end ** + this.importResult = importResult; + }; @action - setCurrentRecord = currentRecord => this.currentRecord = currentRecord; + setColumns = (columns) => (this.columns = columns); @action - setModalVisiable = visiable => this.modalVisiable = visiable + setPageObj = (pageObj) => (this.pageObj = pageObj); @action - setStep = step => this.step = step; + setDataSource = (dataSource) => (this.dataSource = dataSource); + + // 详情列表数据 + @action + setSlideColumns = (columns) => (this.slideColumns = columns); @action - setSlideVisiable = slideVisiable => this.slideVisiable = slideVisiable; + setSlidePageObj = (pageObj) => (this.slidePageObj = pageObj); + @action + setSlideTableDataSource = (dataSource) => + (this.slideTableDataSource = dataSource); + + // ** 设置导入参数 end ** + + @action + setCurrentRecord = (currentRecord) => (this.currentRecord = currentRecord); + + @action + setModalVisiable = (visiable) => (this.modalVisiable = visiable); + + @action + setStep = (step) => (this.step = step); + + @action + setSlideVisiable = (slideVisiable) => (this.slideVisiable = slideVisiable); // 初始化操作 @action doInit = () => { this.getCondition(); this.getTableDatas(); - } + }; // 获得高级搜索表单数据 @action getCondition = () => { - API.getOtherDeductSaCondition().then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - let condition = removePropertyCondition(res.data.condition) - this.condition = condition; - this.form.initFormFields(condition); // 渲染高级搜索form表单 - } else { - message.error(res.errormsg || '接口调用失败!') - } - })); - } + API.getOtherDeductSaCondition().then( + action((res) => { + if (res.status) { + // 接口请求成功/失败处理 + let condition = removePropertyCondition(res.data.condition); + this.condition = condition; + this.form.initFormFields(condition); // 渲染高级搜索form表单 + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 渲染table数据 @action @@ -77,72 +105,101 @@ export class OtherDeductStore { params = params || {}; this.loading = true; let requestParams = this.form.getFormParams() || {}; - requestParams = {...requestParams, ...params} - API.getOtherDeductList(requestParams).then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - this.tableStore.getDatas(res.data.datas); // table 请求数据 - } else { - message.error(res.errormsg || '接口调用失败!') - } - this.loading = false; - })); - } + requestParams = { ...requestParams, ...params }; + API.getOtherDeductList(requestParams).then( + action(({ status, data, errormsg }) => { + if (status) { + const { columns, list, total, pageNum: current, pageSize } = data; + this.setColumns(columns); + this.setDataSource(list); + this.setPageObj({ + total, + current, + pageSize, + }); + } else { + this.setDataSource([]); + this.setPageObj({ + ...this.pageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); + } + this.loading = false; + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = () => { this.getTableDatas(); this.showSearchAd = false; - } + }; // 导入 @action importFile = (params) => { - API.importOtherDeductionParam(params).then(action(res => { - if(res.status) { - this.importResult = res.data - } else { - message.error(res.errormsg || '接口调用失败!') - } - })) - } + API.importOtherDeductionParam(params).then( + action((res) => { + if (res.status) { + this.importResult = res.data; + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 导入预览 @action previewImport = (params) => { - API.importOtherDeductionPreview(params).then(action(res => { - if(res.status) { - this.slideDataSource = res.data.preview - } else { - message.error(res.errormsg || '接口调用失败!') - } - })) - } + API.importOtherDeductionPreview(params).then( + action((res) => { + if (res.status) { + this.slideDataSource = res.data.preview; + } else { + message.error(res.errormsg || "接口调用失败!"); + } + }) + ); + }; // 导出 @action exportOtherDeductList = (ids = "") => { - API.exportOtherDeductList(ids) - } + API.exportOtherDeductList(ids); + }; // 查询明细 @action getOtherDeductDetailList = (id, param = {}) => { - let requestParams = {"otherTaxExemptDeductionId": id}; - requestParams = {...requestParams, ...param} - API.getOtherDeductDetailList(requestParams).then(res => { - if(res.status) { - if (res.status) { // 接口请求成功/失败处理 - this.slideTableStore.getDatas(res.data.datas); // table 请求数据 + let requestParams = { otherTaxExemptDeductionId: id }; + requestParams = { ...requestParams, ...param }; + this.slideLoading = true; + API.getOtherDeductDetailList(requestParams).then( + ({ status, data, errormsg }) => { + if (status) { + const { columns, list, total, pageNum: current, pageSize } = data; + this.setSlideColumns(columns); + this.setSlideTableDataSource(list); + this.setSlidePageObj({ + total, + current, + pageSize, + }); } else { - message.error(res.errormsg || '接口调用失败!') + this.setSlideTableDataSource([]); + this.setSlidePageObj({ + ...this.slidePageObj, + total: 0, + }); + message.error(errormsg || "接口调用失败!"); } } - }) - } + ); + }; // 导出明细 @action exportOtherDeductDetailList = (id, ids = "") => { - API.exportOtherDeductDetailList(id, ids) - } - - -} \ No newline at end of file + API.exportOtherDeductDetailList(id, ids); + }; +} diff --git a/pc4mobx/hrmSalary/stores/taxAgent.js b/pc4mobx/hrmSalary/stores/taxAgent.js index a919cdab..e4de51b0 100644 --- a/pc4mobx/hrmSalary/stores/taxAgent.js +++ b/pc4mobx/hrmSalary/stores/taxAgent.js @@ -1,138 +1,155 @@ -import { observable, action, toJS } from 'mobx'; -import { message } from 'antd'; -import { WeaForm, WeaTableNew } from 'comsMobx'; -import moment from 'moment' +import { observable, action, toJS } from "mobx"; +import { message } from "antd"; +import { WeaForm, WeaTableNew } from "comsMobx"; +import moment from "moment"; -import * as API from '../apis/taxAgent'; // 引入API接口文件 -import { columns } from '../pages/socialSecurityBenefits/archives/columns'; -import { dataSource } from '../pages/mySalary/columns'; +import * as API from "../apis/taxAgent"; // 引入API接口文件 +import { columns } from "../pages/socialSecurityBenefits/archives/columns"; +import { dataSource } from "../pages/mySalary/columns"; +import { editConditions } from "../pages/taxAgent/editConditions"; const { TableStore } = WeaTableNew; export class TaxAgentStore { @observable tableStore = new TableStore(); // new table - @observable form = new WeaForm(); // nrew 一个form + @observable form = new WeaForm(); //表单实体 @observable condition = []; // 存储后台得到的form数据 @observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据 @observable showSearchAd = false; // 高级搜索面板显示 - @observable loading = true; // 数据加载状态 - - @observable modalVisiable = false; // EditModal 模态框 - + @observable loading = false; // 数据加载状态 + @observable modalVisiable = false; // EditModal 模态框 @observable columns = []; - @observable dataSource = []; + @observable pageObj = {}; //列表数据 + @observable dataSource = []; //列表数据 @observable taxAgentOption = []; // 个税扣缴义务人 + @action + setModalVisiable = (visiable) => (this.modalVisiable = visiable); @action - setModalVisiable = visiable => this.modalVisiable = visiable; + setColumns = (columns) => (this.columns = columns); @action - setColumns = columns => this.columns = columns; + setPageObj = (pageObj) => (this.pageObj = pageObj); @action - setDataSource = dataSource => this.dataSource = dataSource; + setDataSource = (dataSource) => (this.dataSource = dataSource); // 初始化操作 @action - doInit = () => { - this.getTableDatas(); - } + doInit = (params) => { + this.getTaxAgentList(params); + this.getCondition(editConditions); + }; // 获得高级搜索表单数据 @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 || '接口调用失败!') - } - })); - } + getCondition = (condition) => { + this.form.initFormFields(condition); + }; // 渲染table数据 @action - getTableDatas = (params) => { + getTaxAgentList = (params) => { this.loading = true; params = params || {}; - API.getTaxAgentList(params).then(action(res => { - if (res.status) { // 接口请求成功/失败处理 - let current = this.tableStore.current || 1; - let sortParams = this.tableStore.sortParams.toJS() || []; - this.tableStore.getDatas(res.data.datas) - } else { - message.error(res.msg || '接口调用失败!') - } - this.loading = false; - })); - } + API.getTaxAgentList(params).then( + action(({ data, status }) => { + this.loading = false; + if (status) { + // 接口请求成功/失败处理 + const { columns, list, total, pageNum: current, pageSize } = data; + this.setColumns(columns); + this.setDataSource(list); + this.setPageObj({ + total, + current, + pageSize, + }); + } else { + message.error(res.msg || "接口调用失败!"); + } + }) + ); + }; @action - setShowSearchAd = bool => this.showSearchAd = bool; + setShowSearchAd = (bool) => (this.showSearchAd = bool); // 高级搜索 - 搜索 @action doSearch = (name) => { - this.getTableDatas({name}); + this.getTaxAgentList({ name }); this.showSearchAd = false; - } + }; // 新增 - @action doInsert = (params) => { - API.saveTaxAgent(params).then(res => { - if(res.status) { - message.success("新增成功"); - this.setModalVisiable(false) - this.getTableDatas(); - this.showSearchAd = false; - } else { - message.error( res.errormsg || "新增失败"); - } - }) - } + @action saveTaxAgent = (params) => { + return API.saveTaxAgent(params); + }; // 更新 - @action doUpdate = (params) => { - API.updateTaxAgent(params).then(res => { - if(res.status) { - message.success("更新成功"); - this.setModalVisiable(false) - this.getTableDatas(); - this.showSearchAd = false; - } else { - message.error(res.errormsg || "新增失败"); - } - }) - } + @action updateTaxAgent = (params) => { + return API.updateTaxAgent(params); + }; - @action doDelete = (params) => { - API.deleteTaxAgent(params).then(res => { - if(res.status) { - message.success("删除成功"); - this.setModalVisiable(false) - this.getTableDatas(); - this.showSearchAd = false; - } else { - message.error( res.errormsg || "删除失败"); - } - }) - } + // 获取个税扣缴义务人基础信息表单 + @action getTaxAgentBaseForm = (params) => { + return API.getTaxAgentBaseForm(params); + }; + + // 获取个税扣缴义务人表单 + @action getTaxAgentForm = (params) => { + return API.getTaxAgentForm(params); + }; + + // 保存个税扣缴义务人基础信息 + @action taxAgentBaseSave = (params) => { + return API.taxAgentBaseSave(params); + }; + + @action deleteTaxAgent = (params) => { + return API.deleteTaxAgent(params); + }; + + @action getPermission = (params) => { + return API.getPermission(params); + }; + // 人员范围列表 + @action getTaxAgentRangeListInclude = (params) => { + return API.getTaxAgentRangeListInclude(params); + }; + // 人员范围排除列表 + @action getTaxAgentRangeListExclude = (params) => { + return API.getTaxAgentRangeListExclude(params); + }; + // 获取人员范围表单 + @action getTaxAgentRangeForm = (params) => { + return API.getTaxAgentRangeForm(params); + }; + // 人员范围保存 + @action taxAgentRangeSave = (params) => { + return API.taxAgentRangeSave(params); + }; + // 人员范围删除 + @action taxAgentRangeDelete = (params) => { + return API.taxAgentRangeDelete(params); + }; @action fetchTaxAgentOption = () => { return new Promise((resolve, reject) => { - API.getTaxAgentSelectList().then(action(res => { - if(res.status) { - let options = res.data.list.map(item => {return {key: item.id, showname: item.content}}) - this.taxAgentOption = options - resolve() - } else { - message.error(res.errormsg || "获取失败") - reject() - } - })) - }) - - } - -} \ No newline at end of file + API.getTaxAgentSelectList().then( + action((res) => { + if (res.status) { + this.taxAgentOption = res.data.map((item) => { + return { key: item.id, showname: item.content }; + }); + resolve(); + } else { + message.error(res.errormsg || "获取失败"); + reject(); + } + }) + ); + }); + }; +} diff --git a/pc4mobx/hrmSalary/style/index.less b/pc4mobx/hrmSalary/style/index.less index 92ab7c56..57689171 100644 --- a/pc4mobx/hrmSalary/style/index.less +++ b/pc4mobx/hrmSalary/style/index.less @@ -5,6 +5,7 @@ position: relative; height: 100%; text-align: center; + >div { position: absolute; top: 50%; @@ -29,3 +30,7 @@ overflow: hidden; } + +.ant-checkbox-wrapper+.ant-checkbox-wrapper { + margin-left: 0 !important; +} \ No newline at end of file