|
@@ -44,6 +44,55 @@ class CompilationModel extends BaseModel {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取编办列表
|
|
|
+ *
|
|
|
+ * @return {Promise}
|
|
|
+ */
|
|
|
+ async getList() {
|
|
|
+ // 筛选字段
|
|
|
+ let field = {_id: 1, name: 1, is_release: 1, description: 1, categoryID: 1};
|
|
|
+ let compilationData = await this.findDataByCondition({name: {$ne: ''}, is_release: true}, field, false);
|
|
|
+
|
|
|
+ return compilationData === null ? [] : compilationData;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id获取可用的编办数据
|
|
|
+ *
|
|
|
+ * @param {String} id
|
|
|
+ * @return {Promise}
|
|
|
+ */
|
|
|
+ async getCompilationById(id) {
|
|
|
+ let condition = {_id: id, is_release: true};
|
|
|
+ let compilationData = await this.findDataByCondition(condition);
|
|
|
+ if (!compilationData || compilationData.bill_valuation === undefined) {
|
|
|
+ return compilationData;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (compilationData.bill_valuation.length > 0) {
|
|
|
+ let enableValuation = [];
|
|
|
+ for (let index in compilationData.bill_valuation) {
|
|
|
+ if (compilationData.bill_valuation[index].enable) {
|
|
|
+ enableValuation.push(compilationData.bill_valuation[index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ compilationData.bill_valuation = enableValuation;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (compilationData.ration_valuation.length > 0) {
|
|
|
+ let enableValuation = [];
|
|
|
+ for (let index in compilationData.ration_valuation) {
|
|
|
+ if (compilationData.ration_valuation[index].enable) {
|
|
|
+ enableValuation.push(compilationData.bill_valuation[index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ compilationData.ration_valuation = enableValuation;
|
|
|
+ }
|
|
|
+
|
|
|
+ return compilationData;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 设置场景
|
|
|
*
|
|
|
* @param {string} scene
|
|
@@ -377,4 +426,4 @@ class CompilationModel extends BaseModel {
|
|
|
|
|
|
}
|
|
|
|
|
|
-export default CompilationModel;
|
|
|
+export default CompilationModel;
|