std_glj_lib_map_model.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * 工料机库业务逻辑
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/8/16
  6. * @version
  7. */
  8. import BaseModel from "../../common/base/base_model";
  9. import STDGLJLibMapSchema from "../../std_glj_lib/models/schemas";
  10. class STDGLJLibMapModel extends BaseModel {
  11. /**
  12. * 构造函数
  13. *
  14. * @return {void}
  15. */
  16. constructor() {
  17. let parent = super();
  18. parent.model = STDGLJLibMapSchema;
  19. parent.init();
  20. }
  21. /**
  22. * 获取对应的工料机库
  23. *
  24. * @param {String} compilationId
  25. * @return {Promise}
  26. */
  27. async getGLJLibList(compilationId) {
  28. let result = [];
  29. let gliLib = await this.findDataByCondition({deleted: false, compilationId: compilationId.toString()}, null, false);
  30. if (gliLib.length <= 0) {
  31. return result;
  32. }
  33. // 整理数据
  34. let gljList = [];
  35. for(let tmp of gliLib) {
  36. let tmpRation = {id: tmp.ID, name: tmp.dispName};
  37. if (gljList.length <= 0) {
  38. gljList = [tmpRation];
  39. } else {
  40. gljList.push(tmpRation);
  41. }
  42. }
  43. result = gljList;
  44. return result;
  45. }
  46. }
  47. export default STDGLJLibMapModel;