12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /**
- * 工料机库业务逻辑
- *
- * @author CaiAoLin
- * @date 2017/8/16
- * @version
- */
- import BaseModel from "../../common/base/base_model";
- import STDGLJLibMapSchema from "../../std_glj_lib/models/schemas";
- class STDGLJLibMapModel extends BaseModel {
- /**
- * 构造函数
- *
- * @return {void}
- */
- constructor() {
- let parent = super();
- parent.model = STDGLJLibMapSchema;
- parent.init();
- }
- /**
- * 获取对应的工料机库
- *
- * @param {String} compilationId
- * @return {Promise}
- */
- async getGLJLibList(compilationId) {
- let result = [];
- let gliLib = await this.findDataByCondition({deleted: false, compilationId: compilationId.toString()}, null, false);
- if (gliLib.length <= 0) {
- return result;
- }
- // 整理数据
- let gljList = [];
- for(let tmp of gliLib) {
- let tmpRation = {id: tmp.ID, name: tmp.dispName};
- if (gljList.length <= 0) {
- gljList = [tmpRation];
- } else {
- gljList.push(tmpRation);
- }
- }
- result = gljList;
- return result;
- }
- }
- export default STDGLJLibMapModel;
|