368 lines
10 KiB
JavaScript
368 lines
10 KiB
JavaScript
import { observable, action, toJS } from "mobx";
|
|
import { message } from "antd";
|
|
import { WeaForm, WeaTableNew } from "comsMobx";
|
|
import { removePropertyCondition } from "../util/response";
|
|
import _ from "lodash";
|
|
|
|
import * as API from "../apis/standingBook"; // 引入API接口文件
|
|
|
|
const { TableStore } = WeaTableNew;
|
|
|
|
export class StandingBookStore {
|
|
@observable tableStore = new TableStore(); // new table
|
|
@observable form = new WeaForm(); // nrew 一个form
|
|
@observable condition = []; // 存储后台得到的form数据
|
|
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
|
|
@observable showSearchAd = false; // 高级搜索面板显示
|
|
@observable loading = false; // 数据加载状态
|
|
@observable inspectLoading = false; // 核算异常列表加载loading
|
|
@observable saveLoading = false; // 添加正常缴纳人员loading
|
|
@observable deleteLoading = false; // 删除月份表单loading
|
|
|
|
// 初始化操作
|
|
@action
|
|
doInit = () => {
|
|
// this.getCondition();
|
|
// this.getTableDatas();
|
|
};
|
|
|
|
// 社会福利台账-获取正常缴纳列表
|
|
@action
|
|
getCommonList = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.getCommonList(params).then(
|
|
action(({ data, status }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
const {
|
|
pageInfo: { list, columns, total, pageNum },
|
|
} = data;
|
|
resolve({ list, columns, total, pageNum });
|
|
} else {
|
|
message.error("接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-获取正常缴纳列表
|
|
@action
|
|
getNormalList = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.getNormalList(params).then(
|
|
action(({ data, status }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
const {
|
|
pageInfo: { list, columns, total },
|
|
} = data;
|
|
resolve({ list, columns, total });
|
|
} else {
|
|
message.error("接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-获取补缴列表
|
|
@action
|
|
getSupplementaryList = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.getSupplementaryList(params).then(
|
|
action(({ data, status }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
const {
|
|
pageInfo: { list, columns, total },
|
|
} = data;
|
|
resolve({ list, columns, total });
|
|
} else {
|
|
message.error("接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-获取总览列表
|
|
@action
|
|
getOverViewList = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.getOverViewList(params).then(
|
|
action(({ data, status }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
const { list, columns, total } = data;
|
|
resolve({ list, columns, total });
|
|
} else {
|
|
message.error("接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-获取异动列表
|
|
@action
|
|
getChangeList = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.getChangeList(params).then(
|
|
action(({ data, status }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
const {
|
|
dataKey: { datas },
|
|
pageInfo: { list, total },
|
|
} = data;
|
|
this.tableStore.getDatas(datas);
|
|
resolve({ list, total });
|
|
} else {
|
|
message.error("接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-获取正tab列表
|
|
@action
|
|
getTabList = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.getTabList(params).then(
|
|
action(({ data, status }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
resolve({ data });
|
|
} else {
|
|
message.error("接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-保存并进入核算
|
|
@action
|
|
save = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.save(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
resolve({ data });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-归档
|
|
@action
|
|
siaccountFile = (params) => {
|
|
this.loading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.siaccountFile(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
this.loading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
resolve({ data });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-删除正常缴纳人员
|
|
@action
|
|
siaccountCommonDelete = (params) => {
|
|
return new Promise((resolve, reject) => {
|
|
API.siaccountCommonDelete(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
resolve({ data });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-核算异常列表
|
|
@action
|
|
inspectList = (params) => {
|
|
this.inspectLoading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.inspectList(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
this.inspectLoading = false;
|
|
if (status) {
|
|
// 接口请求成功/失败处理
|
|
const {
|
|
dataKey: { datas },
|
|
pageInfo: { list, total },
|
|
} = data;
|
|
this.tableStore.getDatas(datas);
|
|
resolve({ list, total });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-添加正常缴纳人员
|
|
@action
|
|
siaccountCommonSave = (params) => {
|
|
this.saveLoading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.siaccountCommonSave(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
this.saveLoading = false;
|
|
if (status) {
|
|
resolve({ data });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-添加补缴人员
|
|
@action
|
|
siaccountSupplementarySave = (params) => {
|
|
this.saveLoading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.siaccountSupplementarySave(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
this.saveLoading = false;
|
|
if (status) {
|
|
resolve({ data });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 社会福利台账-删除月份表单
|
|
@action
|
|
siaccountDelete = (params) => {
|
|
this.deleteLoading = true;
|
|
return new Promise((resolve, reject) => {
|
|
API.siaccountDelete(params).then(
|
|
action(({ data, status, errormsg }) => {
|
|
this.deleteLoading = false;
|
|
if (status) {
|
|
resolve({ data });
|
|
} else {
|
|
message.error(errormsg || "接口调用失败!");
|
|
reject();
|
|
}
|
|
})
|
|
);
|
|
});
|
|
};
|
|
// 获得高级搜索表单数据
|
|
@action
|
|
siaccountCommonForm = () => {
|
|
API.siaccountCommonForm().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 || "接口调用失败!");
|
|
}
|
|
})
|
|
);
|
|
};
|
|
// 补缴添加缴纳人员表单
|
|
@action
|
|
querySupplementaryForm = () => {
|
|
API.querySupplementaryForm().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
|
|
getTableDatas = (params) => {
|
|
this.loading = true;
|
|
const formParams = this.form.getFormParams() || {};
|
|
params = params || formParams;
|
|
API.getTableDatas(params).then(
|
|
action((res) => {
|
|
if (res.api_status) {
|
|
// 接口请求成功/失败处理
|
|
this.tableStore.getDatas(res.datas); // table 请求数据
|
|
this.hasRight = res.hasRight;
|
|
} else {
|
|
message.error(res.errormsg || "接口调用失败!");
|
|
}
|
|
this.loading = false;
|
|
})
|
|
);
|
|
};
|
|
|
|
@action
|
|
setShowSearchAd = (bool) => (this.showSearchAd = bool);
|
|
|
|
// 高级搜索 - 搜索
|
|
@action doSearch = () => {
|
|
this.getTableDatas();
|
|
this.showSearchAd = false;
|
|
};
|
|
|
|
@action
|
|
commonAccount = (params) => {
|
|
return new Promise((resolve, reject) => {
|
|
API.commonAccount(params).then(res => {
|
|
if(res.status) {
|
|
resolve();
|
|
} else {
|
|
message.error(res.errormsg || "接口调用失败!")
|
|
reject();
|
|
}
|
|
})
|
|
})
|
|
|
|
}
|
|
}
|