1135 lines
23 KiB
JavaScript
1135 lines
23 KiB
JavaScript
import {
|
||
observable,
|
||
action,
|
||
computed,
|
||
} from 'mobx';
|
||
import {
|
||
WeaLocaleProvider,
|
||
} from 'ecCom';
|
||
import {
|
||
WeaForm,
|
||
WeaTableNew
|
||
} from 'comsMobx';
|
||
import {
|
||
message,
|
||
Button,
|
||
Modal,
|
||
} from 'antd';
|
||
import * as api from '../apis/tax';
|
||
const getLabel = WeaLocaleProvider.getLabel;
|
||
const confirm = Modal.confirm;
|
||
const {
|
||
TableStore
|
||
} = WeaTableNew;
|
||
|
||
class HrmTax {
|
||
@observable cPage = 'main';
|
||
|
||
TAXDEDUCTIONITEMS = ['childEducation', 'continualEducation', 'loan', 'rent', 'supportOlder']; //专项附加扣除填报
|
||
|
||
BASICINFOITEMS = ['personalInfo', 'familyMember']; //基本信息
|
||
|
||
SEARCHGROUPS = [{
|
||
title: getLabel(-1, '基本信息'),
|
||
MENUS: [{
|
||
src: '/images/tax/basic_info.png',
|
||
label: getLabel(-1, '个人信息'),
|
||
onMenuClick: () => this.handleMenuClick('personalInfo')
|
||
}, {
|
||
src: '/images/tax/basic_info.png',
|
||
label: getLabel(-1, '家庭成员'),
|
||
onMenuClick: () => this.handleMenuClick('familyMember')
|
||
}]
|
||
}, {
|
||
title: getLabel(-1, '专项附加扣除填报'),
|
||
MENUS: [{
|
||
src: '/images/tax/child_edu.png',
|
||
label: getLabel(-1, '子女教育'),
|
||
onMenuClick: () => this.handleMenuClick('childEducation')
|
||
}, {
|
||
src: '/images/tax/c_edu.png',
|
||
label: getLabel(-1, '继续教育'),
|
||
onMenuClick: () => this.handleMenuClick('continualEducation')
|
||
}, {
|
||
src: '/images/tax/loan.png',
|
||
label: getLabel(-1, '住房贷款利息'),
|
||
onMenuClick: () => this.handleMenuClick('loan')
|
||
}, {
|
||
src: '/images/tax/rent.png',
|
||
label: getLabel(-1, '住房租金'),
|
||
onMenuClick: () => this.handleMenuClick('rent')
|
||
}, {
|
||
src: '/images/tax/support.png',
|
||
label: getLabel(-1, '赡养老人'),
|
||
onMenuClick: () => this.handleMenuClick('supportOlder')
|
||
}]
|
||
}];
|
||
|
||
TOP = {
|
||
showDropIcon: true,
|
||
iconBgcolor: '#217346',
|
||
icon: <i className='icon-coms-hrm'/>,
|
||
title: getLabel(-1, '个税专项附加扣除信息填报')
|
||
}
|
||
|
||
@computed get breadcrumb() {
|
||
let a;
|
||
|
||
const f = {
|
||
name: getLabel(-1, '信息填报'),
|
||
onClick: () => {
|
||
this.cPage = 'main'
|
||
}
|
||
};
|
||
|
||
switch (this.cPage) {
|
||
case 'main':
|
||
a = [];
|
||
break;
|
||
case 'personalInfo':
|
||
const {
|
||
isEdit
|
||
} = this.personalForm;
|
||
|
||
if (isEdit === '0') {
|
||
a = [f, {
|
||
name: getLabel(-1, '个人信息'),
|
||
}]
|
||
} else {
|
||
a = [{
|
||
name: getLabel(-1, '个税专项附加扣除信息填报'),
|
||
onClick: () => {
|
||
this.cPage = 'main'
|
||
}
|
||
}, {
|
||
name: getLabel(-1, '基本信息填报'),
|
||
}]
|
||
}
|
||
break;
|
||
case 'familyMember':
|
||
a = [f, {
|
||
name: getLabel(-1, '家庭成员'),
|
||
}]
|
||
break;
|
||
case 'childEducation':
|
||
a = [f, {
|
||
name: getLabel(-1, '子女教育'),
|
||
}]
|
||
break;
|
||
case 'continualEducation':
|
||
a = [f, {
|
||
name: getLabel(-1, '继续教育'),
|
||
}]
|
||
break;
|
||
case 'loan':
|
||
a = [f, {
|
||
name: getLabel(-1, '住房贷款利息'),
|
||
}]
|
||
break;
|
||
case 'rent':
|
||
a = [f, {
|
||
name: getLabel(-1, '住房租金'),
|
||
}]
|
||
break;
|
||
case 'supportOlder':
|
||
a = [f, {
|
||
name: getLabel(-1, '赡养老人'),
|
||
}]
|
||
break;
|
||
}
|
||
|
||
return a;
|
||
}
|
||
|
||
@computed get pageLoading() {
|
||
const {
|
||
comsWeaTableStore
|
||
} = this.table;
|
||
|
||
let loading;
|
||
const hasTable = this.hasTable();
|
||
|
||
const hasPersonalForm = this.hasPersonalForm();
|
||
|
||
const hasConditionForm = this.hasConditionForm();
|
||
|
||
const tloading = comsWeaTableStore.loading;
|
||
|
||
const ploading = this.personalForm.loading;
|
||
|
||
const cloading = this.conditionForm.loading;
|
||
|
||
//页面中只包含纯列表
|
||
if (hasTable && !hasConditionForm) {
|
||
loading = tloading;
|
||
}
|
||
|
||
//页面中即包含列表,也包含条件表单
|
||
if (hasTable && hasConditionForm) {
|
||
loading = tloading || cloading;
|
||
}
|
||
|
||
//只包含个人信息表单
|
||
if (hasPersonalForm && !hasConditionForm) {
|
||
loading = ploading;
|
||
}
|
||
|
||
//不仅包含个人信息表单,也包含条件表单
|
||
if (hasPersonalForm && hasConditionForm) {
|
||
loading = ploading || cloading;
|
||
}
|
||
return loading;
|
||
}
|
||
|
||
//页面中是否包含列表
|
||
hasTable = () => {
|
||
const {
|
||
currentIndex
|
||
} = this.step;
|
||
|
||
if (this.cPage === 'familyMember') {
|
||
return true
|
||
}
|
||
if (['childEducation', 'supportOlder'].includes(this.cPage) && currentIndex === 1) {
|
||
return true
|
||
}
|
||
}
|
||
|
||
//页面中是否包含个人信息表单
|
||
hasPersonalForm = () => {
|
||
const {
|
||
currentIndex
|
||
} = this.step;
|
||
|
||
if (this.cPage === 'personalInfo') {
|
||
return true;
|
||
}
|
||
if (this.TAXDEDUCTIONITEMS.includes(this.cPage)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
//页面中是否包含条件表单
|
||
hasConditionForm = () => {
|
||
const {
|
||
currentIndex
|
||
} = this.step;
|
||
|
||
if (this.cPage === 'loan') {
|
||
return true;
|
||
}
|
||
if (this.TAXDEDUCTIONITEMS.includes(this.cPage) && currentIndex > 0) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
|
||
@observable tConf = [];
|
||
@observable rConf = [];
|
||
|
||
@action getRightMenu = (isEdit) => {
|
||
const params = {};
|
||
if (this.cPage === 'personalInfo') {
|
||
if (isEdit !== undefined) {
|
||
Object.assign(params, {
|
||
edit: isEdit
|
||
});
|
||
}
|
||
}
|
||
if (this.TAXDEDUCTIONITEMS.includes(this.cPage)) {
|
||
Object.assign(params, {
|
||
step: this.step.currentIndex + 1
|
||
});
|
||
}
|
||
api.getRightMenu(this.cPage, params).then(data => {
|
||
const {
|
||
btnMenu
|
||
} = data;
|
||
|
||
const {
|
||
tConf,
|
||
rConf
|
||
} = this.filter(btnMenu);
|
||
|
||
this.tConf = tConf;
|
||
this.rConf = rConf;
|
||
}, error => {})
|
||
}
|
||
|
||
|
||
filter = (datas) => {
|
||
let tConf, rConf;
|
||
tConf = datas.filter(item => {
|
||
var bool = false;
|
||
['isTop', 'isBatch'].forEach(prop => {
|
||
const b = parseInt(item[prop]);
|
||
if (b) {
|
||
bool = true
|
||
}
|
||
});
|
||
|
||
return bool
|
||
})
|
||
|
||
rConf = datas;
|
||
|
||
return {
|
||
tConf,
|
||
rConf
|
||
}
|
||
}
|
||
|
||
@computed get topButtons() {
|
||
if (this.cPage !== 'main') {
|
||
return this.tConf.map((item, index) => {
|
||
const {
|
||
menuFun,
|
||
menuName
|
||
} = item;
|
||
|
||
return (
|
||
<Button
|
||
type="primary"
|
||
disabled={this.getDisabled(menuFun) }
|
||
onClick={() => this[menuFun]()}
|
||
>
|
||
{menuName}
|
||
</Button>
|
||
)
|
||
});
|
||
} else {
|
||
return [];
|
||
}
|
||
}
|
||
|
||
@computed get dropMenuDatas() {
|
||
if (this.cPage !== 'main') {
|
||
return this.rConf.map((item, index) => {
|
||
const {
|
||
menuFun,
|
||
menuName,
|
||
menuIcon
|
||
} = item;
|
||
|
||
return {
|
||
key: index.toString(),
|
||
disabled: this.getDisabled(menuFun),
|
||
icon: <i className={`${menuIcon}`} />,
|
||
content: menuName,
|
||
onClick: () => this[menuFun]()
|
||
}
|
||
});
|
||
} else {
|
||
return [];
|
||
}
|
||
}
|
||
|
||
//编辑、保存个人信息表单CALLBACK
|
||
operatePersonalForm = (isEdit) => {
|
||
this.controlUnderline(isEdit);
|
||
this.getRightMenu(isEdit);
|
||
this.formType = 'PF';
|
||
this.getForm(isEdit);
|
||
}
|
||
|
||
//编辑个人信息表单
|
||
doEdit = () => {
|
||
this.operatePersonalForm('1');
|
||
}
|
||
|
||
//保存个人信息表单
|
||
doSave = () => {
|
||
//表单验证通过后执行的逻辑
|
||
const callback = () => {
|
||
this.saveForm('personalForm', () => {
|
||
this.operatePersonalForm('0');
|
||
});
|
||
}
|
||
|
||
this.validateForm('personalForm', callback);
|
||
}
|
||
|
||
//返回
|
||
doCancel = () => {
|
||
this.operatePersonalForm('0');
|
||
}
|
||
|
||
//新建家庭成员
|
||
doCreate = () => {
|
||
this.defineDialogTitle(getLabel(-1, '新建家庭成员'));
|
||
this.callDialogForm('DG');
|
||
}
|
||
|
||
//上一步
|
||
preStep = () => {
|
||
this.changeStepComponentState(false);
|
||
this.getRightMenu();
|
||
if (this.step.currentIndex === 1) {
|
||
this.formType = 'CD';
|
||
this.getForm();
|
||
} else {
|
||
this.formType = 'PF';
|
||
this.getForm();
|
||
}
|
||
}
|
||
|
||
//下一步
|
||
nextStep = () => {
|
||
this.changeStepComponentState(true);
|
||
this.getRightMenu();
|
||
this.formType = 'CD';
|
||
this.getForm();
|
||
(this.step.currentIndex === 1) && this.getSearchList();
|
||
}
|
||
|
||
@action changeStepComponentState = (isIncrease) => {
|
||
if (isIncrease) {
|
||
this.step.currentIndex++; //切换页面时,需要重置该变量
|
||
} else {
|
||
this.step.currentIndex--;
|
||
}
|
||
|
||
const {
|
||
currentIndex,
|
||
items,
|
||
} = this.step;
|
||
|
||
items.forEach((item, index) => {
|
||
if (index < currentIndex) {
|
||
Object.assign(item, {
|
||
status: 'finish'
|
||
});
|
||
} else if (index === currentIndex) {
|
||
Object.assign(item, {
|
||
status: 'process'
|
||
});
|
||
} else {
|
||
Object.assign(item, {
|
||
status: 'wait'
|
||
});
|
||
}
|
||
});
|
||
}
|
||
|
||
//调用弹框内的表单
|
||
//接收两个参数:表单的类型、当前编辑表单的ID
|
||
callDialogForm = (formType, id) => {
|
||
this.openDialog();
|
||
this.formType = formType;
|
||
this.getForm(id);
|
||
}
|
||
|
||
//批量删除
|
||
doDelete = () => {
|
||
const {
|
||
comsWeaTableStore
|
||
} = this.table, {
|
||
selectedRowKeys
|
||
} = comsWeaTableStore;
|
||
|
||
const callback = () => {
|
||
const params = {
|
||
ids: selectedRowKeys.toString(),
|
||
};
|
||
this.delLogic(params);
|
||
}
|
||
|
||
this.delConfirm(true, callback);
|
||
}
|
||
|
||
//确认是否删除
|
||
//接收两个参数:是否是批量删除、确认删除后执行的回调函数
|
||
delConfirm = (isBatch, callback) => {
|
||
let content;
|
||
if (isBatch) {
|
||
content = getLabel('385625', '确定要删除选择的记录吗?');
|
||
} else {
|
||
content = getLabel('83877', '确定要删除吗?');
|
||
}
|
||
|
||
confirm({
|
||
title: getLabel('131329', '信息确认'),
|
||
content: content,
|
||
okText: getLabel('33703', '确定'),
|
||
cancelText: getLabel('32694', '取消'),
|
||
onOk() {
|
||
callback && callback();
|
||
},
|
||
onCancel() {
|
||
return false;
|
||
},
|
||
});
|
||
}
|
||
|
||
//执行删除任务的具体逻辑
|
||
delLogic = (params) => {
|
||
api.del(this.cPage, params).then(data => {
|
||
const {
|
||
status
|
||
} = data;
|
||
|
||
if (status === '1') {
|
||
message.success(-1, '删除成功');
|
||
this.getSearchList();
|
||
} else {
|
||
message.warning(-1, '删除失败');
|
||
}
|
||
});
|
||
}
|
||
|
||
//保存表单分两种情况:保存页面表单、保存弹框内的表单
|
||
//参数formType为要保存表单的类型、 callback为这两种情况保存成功后,具体执行的逻辑
|
||
saveForm = (formType, callback) => {
|
||
const {
|
||
form
|
||
} = this[formType];
|
||
|
||
//后端默认取当前登录人员的id,因此这里不需要传人员id。
|
||
const params = {
|
||
...form.getFormParams(),
|
||
};
|
||
api.save(this.cPage, params).then(data => {
|
||
const {
|
||
status
|
||
} = data;
|
||
|
||
if (status === '1') {
|
||
message.success(getLabel(-1, '保存成功'));
|
||
callback && callback();
|
||
} else {
|
||
message.warning(getLabel(-1, '保存失败'));
|
||
}
|
||
}, error => {})
|
||
}
|
||
|
||
//获取顶部按钮组、右键菜单的状态(是否可点击)
|
||
getDisabled = (func) => {
|
||
const {
|
||
loading
|
||
} = this.personalForm, {
|
||
comsWeaTableStore
|
||
} = this.table;
|
||
|
||
let b;
|
||
if (['doEdit'].includes(func)) {
|
||
b = loading;
|
||
}
|
||
if (['doCreate'].includes(func)) {
|
||
b = comsWeaTableStore.loading;
|
||
}
|
||
if (['doDelete'].includes(func)) {
|
||
b = comsWeaTableStore.selectedRowKeys.length === 0;
|
||
}
|
||
return b;
|
||
}
|
||
|
||
|
||
|
||
@action handleMenuClick = (type) => {
|
||
if (this.BASICINFOITEMS.includes(type)) {
|
||
this.cPage = type;
|
||
}
|
||
|
||
if (type === 'personalInfo') {
|
||
this.operatePersonalForm('0');
|
||
}
|
||
if (type === 'familyMember') {
|
||
this.getRightMenu();
|
||
this.getSearchList();
|
||
}
|
||
if (this.TAXDEDUCTIONITEMS.includes(type)) {
|
||
this.storagePageType(type);
|
||
this.defineDialogTitle(getLabel(-1, '填报前,您需要提前准备以下材料'));
|
||
this.openDialog();
|
||
this.getPreInfo(type);
|
||
}
|
||
}
|
||
|
||
//设置即将跳转页面的类型
|
||
storagePageType = (type) => {
|
||
this.temp = type;
|
||
}
|
||
|
||
//**********************NoLinkageForm、CollapseForm**********************
|
||
formType = 'PF'; //PF: 个人信息表单 PFDG:弹框内的个人信息 DG:弹框内的表单 CD: 条件表单
|
||
|
||
callFormAPIParams = {}; //调用表单接口所需的参数
|
||
|
||
@observable personalForm = { //人员信息表单
|
||
form: new WeaForm(),
|
||
loading: false,
|
||
isEdit: '0',
|
||
}
|
||
|
||
@observable dialogForm = { //弹框内表单
|
||
form: new WeaForm(),
|
||
conditions: [],
|
||
loading: false,
|
||
}
|
||
|
||
@observable conditionForm = { //提交表单
|
||
form: new WeaForm(),
|
||
loading: false,
|
||
}
|
||
|
||
@action getForm = (val) => {
|
||
this.setParamsToCallFormAPI(val);
|
||
|
||
//判断是否调用个人信息表单
|
||
const isCallPersonalForm = this.isCallPersonalForm();
|
||
//判断是否调用弹框内表单
|
||
const isCallDialogForm = this.isCallDialogForm();
|
||
//判断是否调用条件表单
|
||
const isCallCondtionForm = this.isCallCondtionForm();
|
||
|
||
if (isCallPersonalForm) {
|
||
this.personalForm.loading = true;
|
||
}
|
||
|
||
if (isCallDialogForm) {
|
||
this.dialogForm.loading = true;
|
||
}
|
||
|
||
if (isCallCondtionForm) {
|
||
this.conditionForm.loading = true;
|
||
}
|
||
|
||
api.getForm(this.cPage, this.callFormAPIParams, this.step.currentIndex, this.formType, this.subDialog.visible).then(data => {
|
||
const {
|
||
condition
|
||
} = data;
|
||
|
||
if (isCallPersonalForm && !isCallDialogForm) {
|
||
this.initForm('personalForm', condition);
|
||
}
|
||
|
||
if (isCallDialogForm) {
|
||
//表单上有添加按钮的,在配置数据上添加回调函数。
|
||
if (this.hasAddBtn(condition)) {
|
||
this.addAddBtnEventListener(condition)
|
||
}
|
||
this.initForm('dialogForm', condition);
|
||
}
|
||
|
||
if (isCallCondtionForm) {
|
||
this.initForm('conditionForm', condition);
|
||
}
|
||
|
||
}, error => {})
|
||
}
|
||
|
||
//设置调用表单接口的参数
|
||
setParamsToCallFormAPI = (val) => {
|
||
//判断是否调用个人信息表单
|
||
const isCallPersonalForm = this.isCallPersonalForm();
|
||
//判断是否调用弹框内表单
|
||
const isCallDialogForm = this.isCallDialogForm();
|
||
//判断是否调用条件表单
|
||
const isCallCondtionForm = this.isCallCondtionForm();
|
||
|
||
if (isCallPersonalForm) {
|
||
Object.assign(this.callFormAPIParams, {
|
||
edit: val
|
||
});
|
||
this.personalForm.loading = true;
|
||
}
|
||
|
||
if (isCallDialogForm) {
|
||
if (val) {
|
||
Object.assign(this.callFormAPIParams, {
|
||
id: val
|
||
});
|
||
}
|
||
this.dialogForm.loading = true;
|
||
}
|
||
|
||
}
|
||
|
||
//判断调用的是否是个人信息表单
|
||
isCallPersonalForm = (type) => {
|
||
return ['PF', 'PFDG'].includes(this.formType)
|
||
}
|
||
|
||
isEdit = (val) => {
|
||
return val === '1'
|
||
}
|
||
|
||
isCallDialogForm = (type) => {
|
||
return ['PFDG', 'DG'].includes(this.formType);
|
||
}
|
||
|
||
isCallCondtionForm = () => {
|
||
return this.formType === 'CD'
|
||
}
|
||
|
||
hasAddBtn = (conditions) => {
|
||
let b = false;
|
||
conditions.forEach(c => {
|
||
c.items.forEach(item => {
|
||
const {
|
||
otherParams
|
||
} = item;
|
||
|
||
if (otherParams && otherParams.hasAddBtn) {
|
||
b = true;
|
||
}
|
||
})
|
||
});
|
||
return b;
|
||
}
|
||
|
||
addAddBtnEventListener = (conditions) => {
|
||
conditions.forEach(c => {
|
||
c.items.forEach(item => {
|
||
const {
|
||
otherParams
|
||
} = item;
|
||
if (otherParams && otherParams.hasAddBtn) {
|
||
item.addOnClick = () => {
|
||
this.defineDialogTitle(getLabel(-1, '新建家庭成员'));
|
||
this.openDialog();
|
||
this.formType = 'DG';
|
||
this.getForm();
|
||
}
|
||
}
|
||
});
|
||
});
|
||
}
|
||
|
||
//初始化表单
|
||
initForm = (obj, condition) => {
|
||
this[obj].form = new WeaForm();
|
||
this[obj].form.setCondition(condition);
|
||
this[obj].conditions = condition;
|
||
this[obj].loading = false;
|
||
}
|
||
|
||
@computed get isRenderCollapseForm() {
|
||
const {
|
||
conditions
|
||
} = this.dialogForm;
|
||
return conditions.length > 1;
|
||
}
|
||
|
||
//控制个人信息表单是否出现下划线
|
||
controlUnderline = (isEdit) => {
|
||
this.personalForm.isEdit = isEdit;
|
||
}
|
||
|
||
//********************Tab********************
|
||
buttonsAds = [getLabel(82529, '搜索'), getLabel(27088, '重置'), getLabel(32694, '取消')];
|
||
|
||
TAB = {
|
||
advanceHeight: 170,
|
||
hasMask: false,
|
||
keyParam: 'key',
|
||
setShowSearchAd: bool => this.setShowSearchAd(bool),
|
||
onSearch: () => this.onSearch(),
|
||
onSearchChange: val => this.onSearchChange(val),
|
||
onChange: key => this.onTabChange(key),
|
||
buttonsAd: this.buttonsAds.map((name, index) => {
|
||
const type = (index === 0) && "primary";
|
||
let callback;
|
||
if (index === 0) {
|
||
callback = () => this.onSearch();
|
||
} else if (index === 1) {
|
||
callback = () => this.tab.form.resetConditionValue();
|
||
} else {
|
||
callback = this.setShowSearchAd
|
||
}
|
||
return <Button type={type} onClick={() => callback(index === 2 && false)}>{name}</Button>
|
||
})
|
||
}
|
||
|
||
@observable tab = {
|
||
showSearchAd: false,
|
||
form: new WeaForm(),
|
||
selectedKey: '0',
|
||
value: ''
|
||
}
|
||
|
||
@observable onSearchChange = (val) => {
|
||
this.tab.value = val;
|
||
}
|
||
|
||
@action onSearch = () => {
|
||
this.getSearchList();
|
||
}
|
||
|
||
@action onTabChange = (key) => {
|
||
this.tab.selectedKey = key;
|
||
}
|
||
|
||
@action setShowSearchAd = (b) => {
|
||
this.tab.showSearchAd = b;
|
||
}
|
||
|
||
@computed get searchsBaseValue() {
|
||
if (this.cPage === 'main') {
|
||
return ''
|
||
}
|
||
if (this.cPage === 'familyMember') {
|
||
return this.tab.value;
|
||
}
|
||
}
|
||
|
||
@computed get tabDatas() {
|
||
if (this.cPage === 'main') {
|
||
return [{
|
||
key: '0',
|
||
title: getLabel(-1, '信息填报')
|
||
}, {
|
||
key: '1',
|
||
title: getLabel(-1, '填报记录查询')
|
||
}];
|
||
}
|
||
if (this.cPage === 'familyMember') {
|
||
return [];
|
||
}
|
||
}
|
||
|
||
@computed get searchType() {
|
||
let type;
|
||
if (this.cPage === 'main') {
|
||
type = ['base', 'advanced'];
|
||
}
|
||
if (this.cPage === 'familyMember') {
|
||
type = ['base'];
|
||
}
|
||
return type;
|
||
}
|
||
//*********************Table*********************
|
||
TABLE = {
|
||
hasOrder: true,
|
||
needScroll: true,
|
||
}
|
||
|
||
@observable table = {
|
||
comsWeaTableStore: new TableStore(),
|
||
}
|
||
|
||
@action getSearchList = () => {
|
||
const params = this.getParamsToCallTableAPI()
|
||
api.getRecords(this.cPage, params).then(data => {
|
||
const {
|
||
sessionkey
|
||
} = data;
|
||
this.table.comsWeaTableStore = new TableStore();
|
||
this.table.comsWeaTableStore.getDatas(sessionkey, 1);
|
||
}, error => {})
|
||
}
|
||
|
||
getParamsToCallTableAPI = () => {
|
||
const params = {};
|
||
if (this.cPage === 'familyMember') {
|
||
Object.assign(params, {
|
||
lastname: this.searchsBaseValue
|
||
});
|
||
}
|
||
if (this.cPage === 'childEducation') {
|
||
const {
|
||
form
|
||
} = this.conditionForm;
|
||
|
||
Object.assign(params, {
|
||
year: form.getFormParams().year
|
||
});
|
||
}
|
||
return params;
|
||
}
|
||
|
||
//编辑家庭成员
|
||
edit = (id) => {
|
||
this.defineDialogTitle(getLabel(-1, '编辑家庭成员'));
|
||
this.callDialogForm('DG', id);
|
||
}
|
||
|
||
//删除家庭成员
|
||
del = (id) => {
|
||
//删除确认通过后,执行的回调函数
|
||
const callback = () => {
|
||
const params = {
|
||
ids: id
|
||
};
|
||
|
||
this.delLogic(params);
|
||
}
|
||
this.delConfirm(false, callback);
|
||
}
|
||
//*********************Dialog*********************
|
||
DIALOG = {
|
||
hasScroll: true,
|
||
onCancel: () => this.closeDialog(),
|
||
}
|
||
|
||
@computed get dialogButtons() {
|
||
let btns;
|
||
if (this.cPage === 'main') {
|
||
btns = [
|
||
<Button type='primary' onClick={() => this.goToDetailPage()}>{getLabel(-1, '准备完毕,进入填报')}</Button>,
|
||
<Button onClick={() => this.closeDialog()}>{getLabel(-1, '取消')}</Button>,
|
||
];
|
||
} else {
|
||
btns = [<Button type='primary' onClick={() => this.saveDialogForm()}>{getLabel(30986, '保存')}</Button>]
|
||
}
|
||
|
||
return btns;
|
||
}
|
||
|
||
@computed get moreBtn() {
|
||
const btn = {};
|
||
if (this.cPage !== 'main') {
|
||
Object.assign(btn, {
|
||
datas: []
|
||
});
|
||
}
|
||
|
||
return btn;
|
||
}
|
||
|
||
@computed get icon() {
|
||
let icon;
|
||
if (this.cPage === 'main') {
|
||
icon = 'icon-coms-Prompt'
|
||
} else {
|
||
icon = 'icon-coms-hrm'
|
||
}
|
||
|
||
return icon;
|
||
}
|
||
|
||
@computed get iconBgcolor() {
|
||
let color;
|
||
if (this.cPage === 'main') {
|
||
color = '#FF9900'
|
||
} else {
|
||
color = '#217346'
|
||
}
|
||
|
||
return color;
|
||
}
|
||
|
||
@observable dialog = {
|
||
visible: false,
|
||
title: '',
|
||
}
|
||
|
||
@observable subDialog = {
|
||
visible: false,
|
||
title: '',
|
||
}
|
||
|
||
@computed get dialogLoading() {
|
||
return this.dialogForm.loading
|
||
}
|
||
|
||
@computed get dialogStyle() {
|
||
let style;
|
||
if (this.cPage === 'main') {
|
||
style = {
|
||
width: 560,
|
||
height: 215
|
||
}
|
||
}
|
||
if (this.cPage === 'familyMember') {
|
||
style = {
|
||
width: 600,
|
||
height: 350
|
||
}
|
||
}
|
||
if (this.cPage === 'childEducation') {
|
||
style = {
|
||
width: 600,
|
||
height: 500
|
||
};
|
||
}
|
||
|
||
return style;
|
||
}
|
||
|
||
@action openDialog = () => {
|
||
if (!this.dialog.visible) {
|
||
this.dialog.visible = true;
|
||
} else {
|
||
this.subDialog.visible = true;
|
||
}
|
||
}
|
||
|
||
@action closeDialog = () => {
|
||
if (this.subDialog.visible) {
|
||
this.subDialog.visible = false;
|
||
} else {
|
||
this.dialog.visible = false;
|
||
}
|
||
}
|
||
|
||
@action defineDialogTitle = (title) => {
|
||
if (!this.dialog.visible) {
|
||
this.dialog.title = title;
|
||
} else {
|
||
this.subDialog.title = title;
|
||
}
|
||
}
|
||
|
||
//准备完毕、进入填报
|
||
@action goToDetailPage = () => {
|
||
this.cPage = this.temp;
|
||
this.closeDialog();
|
||
this.getRightMenu();
|
||
this.getStep();
|
||
this.formType = 'PF';
|
||
this.getForm('0');
|
||
}
|
||
|
||
//**********************PreInfo**********************
|
||
@observable preInfo = [];
|
||
|
||
//获取提示信息
|
||
@action getPreInfo = (type) => {
|
||
this.dialog.loading = true;
|
||
api.getPreInfo(type).then(data => {
|
||
const {
|
||
items
|
||
} = data;
|
||
|
||
items.map((item, index) => {
|
||
Object.assign(item, {
|
||
imgSrc: this.getImgSrc(type, index)
|
||
});
|
||
});
|
||
|
||
this.preInfo = items;
|
||
|
||
this.dialog.loading = false;
|
||
}, error => {})
|
||
}
|
||
|
||
//获取提示弹框内的图片地址
|
||
getImgSrc = (type, index) => {
|
||
let src;
|
||
switch (type) {
|
||
case 'childEducation':
|
||
if (index === 0) {
|
||
src = '/images/tax/cedu_01.png'
|
||
} else {
|
||
src = '/images/tax/cedu_02.png'
|
||
}
|
||
}
|
||
return src;
|
||
}
|
||
|
||
//校验表单
|
||
//包含两个参数:当前校验表单的类型、校验通过后执行的回调函数
|
||
@action validateForm = (formType, callback) => {
|
||
this[formType].form.validateForm().then(f => {
|
||
if (f.isValid) {
|
||
callback && callback();
|
||
} else {
|
||
f.showErrors();
|
||
}
|
||
})
|
||
}
|
||
|
||
saveDialogForm = () => {
|
||
//弹框内表单校验通过后,执行的回调函数。
|
||
const callback = () => {
|
||
this.saveForm('dialogForm', () => {
|
||
this.closeDialog();
|
||
if (this.isRefreshTable()) {
|
||
this.getSearchList();
|
||
} else {
|
||
this.controlUnderline('0');
|
||
this.formType = 'PF';
|
||
this.getForm('0');
|
||
}
|
||
});
|
||
}
|
||
|
||
this.validateForm('dialogForm', callback);
|
||
}
|
||
|
||
//判断保存弹框内表单后,刷新的是列表还是表单。
|
||
isRefreshTable = () => {
|
||
const {
|
||
currentIndex
|
||
} = this.step;
|
||
|
||
//保存家庭成员
|
||
if (this.cPage === 'familyMember') {
|
||
return true
|
||
}
|
||
//添加子女教育信息、新建家庭成员
|
||
if (['childEducation', 'supportOlder'].includes(this.cPage) && currentIndex === 1) {
|
||
return true
|
||
}
|
||
|
||
}
|
||
|
||
//**********************Step**********************
|
||
@observable step = {
|
||
currentIndex: 0,
|
||
items: []
|
||
}
|
||
|
||
@action getStep = () => {
|
||
api.getStep(this.cPage).then(data => {
|
||
const {
|
||
steps
|
||
} = data;
|
||
|
||
steps.map((step, index) => {
|
||
Object.assign(step, {
|
||
status: (index === 0) ? 'process' : 'wait'
|
||
});
|
||
});
|
||
|
||
this.step.items = steps;
|
||
}, error => {})
|
||
}
|
||
|
||
|
||
//*********************Title******************
|
||
modify = () => {
|
||
this.controlUnderline('1');
|
||
this.defineDialogTitle(getLabel(-1, '修改个人信息'));
|
||
this.openDialog();
|
||
this.formType = 'PFDG';
|
||
this.getForm('1');
|
||
}
|
||
|
||
//*****************ButtonIcons*****************
|
||
buttonIcons = [{
|
||
buttonType: 'add',
|
||
type: 'primary',
|
||
onClick: () => this.addChildEducationInfo()
|
||
}, {
|
||
buttonType: 'del',
|
||
type: 'primary',
|
||
disabled: true,
|
||
onClick: () => this.delChildEducationInfo()
|
||
}];
|
||
|
||
addChildEducationInfo = () => {
|
||
this.defineDialogTitle(getLabel(-1, '添加子女教育信息'));
|
||
this.openDialog();
|
||
this.formType = 'DG';
|
||
this.getForm();
|
||
}
|
||
|
||
delChildEducationInfo = () => {
|
||
|
||
}
|
||
//********************TableUnderSearchGroup********************
|
||
childrenReduceTip = [getLabel(-1, '有子女符合以下两个条件之一:'), getLabel(-1, '扣除年度有子女满3岁且处于小学入学前阶段;'), getLabel(-1, '扣除年度有子女正接受全日制学历教育。')];
|
||
|
||
@computed get searchGroupTitle() {
|
||
if (this.cPage === 'childEducation') {
|
||
return getLabel(-1, '子女教育信息');
|
||
}
|
||
if (this.cPage === 'supportOlder') {
|
||
return getLabel(-1, '被赡养人信息');
|
||
}
|
||
}
|
||
}
|
||
|
||
export const hrmTax = new HrmTax(); |