/** * 标准清单库 * * @author CaiAoLin * @date 2017/8/4 * @version */ import BaseModel from "../../common/base/base_model"; import STDBillsLibListsSchema from "./schemas/std_bills_lib_lists"; class STDBillsLibListsModel extends BaseModel { /** * 构造函数 * * @return {void} */ constructor() { let parent = super(); parent.model = STDBillsLibListsSchema; parent.init(); } /** * 获取标准清单 * * @param {String} compilationId * @return {Promise} */ async getBillList(compilationId) { let result = false; let billLib = await this.findDataByCondition({deleted: false}, null, false); if (billLib.length <= 0) { return result; } // 整理数据 let billList = []; for(let tmp of billLib) { let tmpRation = {id: tmp.billsLibId, name: tmp.billsLibName}; if (compilationId !== tmp.compilationId) { continue; } if (billList.length <= 0) { billList = [tmpRation]; } else { billList.push(tmpRation); } } result = billList; return result; } } export default STDBillsLibListsModel;