Sfoglia il codice sorgente

工料机库相关

MaiXinRong 2 anni fa
parent
commit
53c1b04411

+ 5 - 0
app/controller/standard_lib_controller.js

@@ -30,6 +30,8 @@ module.exports = app => {
                     case 'xmj':
                         responseData.data = await this.ctx.service.stdXmj.getData(data.list_id);
                         break;
+                    case 'glj':
+                        responseData.data = await this.ctx.service.gljLib.getData(data.list_id);
                     default:
                         throw '查询的标准清单不存在';
                 }
@@ -66,6 +68,9 @@ module.exports = app => {
                     case 'xmj':
                         responseData.data = await this.ctx.service.stdXmj.getAllDataByCondition({ where: condition });
                         break;
+                    case 'glj':
+                        responseData.data = await this.ctx.service.gljLib.getAllDataByCondition({ where: condition });
+                        break;
                     default:
                         throw '查询的标准清单不存在';
                 }

+ 2 - 2
app/public/js/revise.js

@@ -2601,8 +2601,8 @@ $(document).ready(() => {
         stdType: 'xmj',
         libs: stdChapters,
         treeSetting: {
-            id: 'chapter_id',
-            pid: 'pid',
+            id: 'glj_id',
+            pid: 'glj_pid',
             order: 'order',
             level: 'level',
             rootId: -1,

+ 38 - 0
app/service/glj_lib.js

@@ -0,0 +1,38 @@
+'use strict';
+
+/**
+ * 标准清单业务逻辑
+ *
+ * @author Mai
+ * @date 2018/3/13
+ * @version
+ */
+
+const StandardLib = require('./standard_lib');
+module.exports = app => {
+
+    class StdBills extends StandardLib {
+
+        /**
+         * 构造函数
+         *
+         * @param {Object} ctx - egg全局变量
+         * @return {void}
+         */
+        constructor(ctx) {
+            super(ctx, {
+                mid: 'list_id',
+                kid: 'glj_id',
+                pid: 'glj_pid',
+                order: 'order',
+                level: 'level',
+                isLeaf: 'is_leaf',
+                fullPath: 'full_path',
+                keyPre: 'revise_bills_maxLid:'
+            }, 'glj_lib');
+            this.stdType = 'glj';
+        }
+    }
+
+    return StdBills;
+};

+ 14 - 4
app/service/valuation.js

@@ -50,20 +50,30 @@ module.exports = app => {
             const billsId = valuation[valuationField.std_bills]
                 ? this._.map(valuation[valuationField.std_bills].split(','), this._.toInteger)
                 : [-1];
-            const chaptersId = valuation[valuationField.std_xmj]
-                ? this._.map(valuation[valuationField.std_xmj].split(','), this._.toInteger)
-                : [-1];
             const sql = 'SELECT `id`, `name`' +
                 '  From ?? ' +
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
             const sqlParam = ['zh_std_gcl_list', billsId, billsId];
             const billsList = await this.db.query(sql, sqlParam);
+
+            const chaptersId = valuation[valuationField.std_xmj]
+                ? this._.map(valuation[valuationField.std_xmj].split(','), this._.toInteger)
+                : [-1];
             const sql2 = 'SELECT `id`, `name`' +
                 '  From ?? ' +
                 '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
             const sqlParam2 = ['zh_std_xmj_list', chaptersId, chaptersId];
             const chapterList = await this.db.query(sql2, sqlParam2);
-            return [billsList, chapterList];
+
+            const gljId = valuation[valuationField.glj_lib]
+                ? this._.map(valuation[valuationField.glj_lib].split(','), this._.toInteger)
+                : [-1];
+            const sql3 = 'SELECT `id`, `name`' +
+                '  From ?? ' +
+                '  WHERE `id` in ( ? ) ORDER BY FIELD(`id`, ?)';
+            const sqlParam3 = ['zh_glj_lib_list', gljId, gljId];
+            const gljList = await this.db.query(sql3, sqlParam3);
+            return [billsList, chapterList, gljList];
         }
 
     }