123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /**
- * 定额库业务逻辑模型
- *
- * @author CaiAoLin
- * @date 2017/8/1
- * @version
- */
- import BaseModel from "../base/base_model";
- import STDRationLibMapSchema from "./schemas/std_ration_lib_map";
- class STDRationLibMapModel extends BaseModel {
- /**
- * 构造函数
- *
- * @return {void}
- */
- constructor() {
- let parent = super();
- parent.model = STDRationLibMapSchema;
- parent.init();
- }
- /**
- * 获取定额库
- *
- * @param {String} compilationId
- * @return {Promise}
- */
- async getRationLib(compilationId) {
- let result = false;
- let rationLib = await this.findDataByCondition({deleted: false}, null, false);
- if (rationLib.length <= 0) {
- return result;
- }
- // 整理数据
- let rationData = [];
- for(let tmp of rationLib) {
- let tmpRation = {id: tmp.ID, name: tmp.dispName};
- if (compilationId !== tmp.compilationId) {
- continue;
- }
- if (rationData.length <= 0) {
- rationData = [tmpRation];
- } else {
- rationData.push(tmpRation);
- }
- }
- result = rationData;
- return result;
- }
- }
- export default STDRationLibMapModel;
|