131 lines
3.7 KiB
JavaScript
131 lines
3.7 KiB
JavaScript
import { observable, action, toJS } from 'mobx';
|
|
import { message } from 'antd';
|
|
import { WeaForm, WeaTableNew } from 'comsMobx';
|
|
|
|
import * as API from '../apis/otherDeduct'; // 引入API接口文件
|
|
import * as TaxAgentApi from '../apis/taxAgent'
|
|
|
|
const { TableStore } = WeaTableNew;
|
|
|
|
export class OtherDeductStore {
|
|
@observable tableStore = new TableStore(); // new table
|
|
@observable slideTableStore = new TableStore();
|
|
@observable form = new WeaForm(); // nrew 一个form
|
|
@observable condition = []; // 存储后台得到的form数据
|
|
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
|
|
@observable showSearchAd = false; // 高级搜索面板显示
|
|
@observable loading = true; // 数据加载状态
|
|
@observable step = 0; // 当前所在第几步
|
|
@observable slideVisiable = false; // slide 是否隐藏
|
|
|
|
@observable slideDataSource = [];
|
|
|
|
@observable importResult = {}
|
|
@observable modalVisiable = false; // 模态框显示
|
|
|
|
@observable currentRecord = {}; // 当前record
|
|
|
|
@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) { // 接口请求成功/失败处理
|
|
this.condition = res.data.condition;
|
|
this.form.initFormFields(res.data.condition); // 渲染高级搜索form表单
|
|
} else {
|
|
message.error(res.errormsg || '接口调用失败!')
|
|
}
|
|
}));
|
|
}
|
|
|
|
// 渲染table数据
|
|
@action
|
|
getTableDatas = (params) => {
|
|
params = params || {};
|
|
this.loading = true;
|
|
let requestParams = this.form.getFormParams() || {};
|
|
requestParams = {...requestParams, ...params}
|
|
API.getOtherDeductList(params).then(action(res => {
|
|
if (res.status) { // 接口请求成功/失败处理
|
|
this.tableStore.getDatas(res.data.datas); // table 请求数据
|
|
} else {
|
|
message.error(res.errormsg || '接口调用失败!')
|
|
}
|
|
this.loading = false;
|
|
}));
|
|
}
|
|
|
|
@action
|
|
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
|
|
}
|
|
}))
|
|
}
|
|
|
|
// 导入预览
|
|
@action previewImport = (params) => {
|
|
API.importOtherDeductionPreview(params).then(action(res => {
|
|
if(res.status) {
|
|
this.slideDataSource = res.data.preview
|
|
}
|
|
}))
|
|
}
|
|
|
|
// 导出
|
|
@action 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 请求数据
|
|
} else {
|
|
message.error(res.errormsg || '接口调用失败!')
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
// 导出明细
|
|
@action exportOtherDeductDetailList = (id, ids = "") => {
|
|
API.exportOtherDeductDetailList(id, ids)
|
|
}
|
|
|
|
|
|
} |