Browse Source

批量导入,界面设置

MaiXinRong 2 years ago
parent
commit
6d03dd2fb0

+ 2 - 1
app/middleware/auto_finish_logger.js

@@ -24,6 +24,7 @@ module.exports = options => {
                 return `${((1-x.times.idle/(x.times.idle+x.times.user+x.times.nice+x.times.sys+x.times.irq))*100).toFixed(2)}%`
             });
             logData = {
+                id: this.logId,
                 requestTime: ctx.logInfo.time, responseTime, runTime,
                 beginCpus: ctx.logInfo.cpus, endCpus,
                 user: ctx.session.sessionUser.accountId, userName: ctx.session.sessionUser.name, loginType: ctx.session.sessionUser.loginType,
@@ -32,7 +33,7 @@ module.exports = options => {
             };
         } else {
             logData = {
-                requestTime: ctx.logTime, responseTime, runTime,
+                id: this.logId, requestTime: ctx.logTime, responseTime, runTime,
             };
         }
         const bLogger = runTime > 500 ? ctx.getLogger('warning') : ctx.getLogger('finish');

+ 23 - 39
app/middleware/auto_logger.js

@@ -11,6 +11,7 @@ const os = require('os');
 
 module.exports = options => {
     return function* autoLogger(next) {
+        this.logId = this.app.uuid.v1();
         // 记录业务日志
         function getBussinessLogger(ctx) {
             if (ctx.url.match(/ledger/)) {
@@ -21,46 +22,29 @@ module.exports = options => {
             return ctx.getLogger('mixed');
         }
 
-        const bLogger = getBussinessLogger(this);
-        if (this.session.sessionUser) {
-            const logData = {
-                method: this.method,
-                user: this.session.sessionUser,
-                project: this.session.sessionProject,
-                data: this.request.body,
-            };
-            bLogger.info(JSON.stringify(logData));
-        } else {
-            const logData = {
-                method: this.method,
-                data: this.body,
-            };
-            bLogger.info(JSON.stringify(logData));
+        if (this.url.indexOf('/public/') !== 0) {
+            const bLogger = getBussinessLogger(this);
+            if (this.session.sessionUser) {
+                const logData = {
+                    method: this.method,
+                    user: this.session.sessionUser,
+                    project: this.session.sessionProject,
+                    data: this.request.body,
+                };
+                bLogger.info(JSON.stringify(logData));
+            } else {
+                const logData = {
+                    method: this.method,
+                    data: this.body,
+                };
+                bLogger.info(JSON.stringify(logData));
+            }
+            this.logInfo = { id: this.logId, time: new Date() };
+            const cpus = os.cpus();
+            this.logInfo.cpus = cpus.map(x => {
+                return `${((1-x.times.idle/(x.times.idle+x.times.user+x.times.nice+x.times.sys+x.times.irq))*100).toFixed(2)}%`
+            });
         }
-        this.logInfo = { time: new Date() };
-        const cpus = os.cpus();
-        this.logInfo.cpus = cpus.map(x => {
-            return `${((1-x.times.idle/(x.times.idle+x.times.user+x.times.nice+x.times.sys+x.times.irq))*100).toFixed(2)}%`
-        });
-
-        // 自动记录log的action
-        // const autoLogAction = ['save', 'delete'];
-        // if (this.actionName !== undefined && autoLogAction.indexOf(this.actionName) >= 0) {
-        //     // 操作数据的id
-        //     const idReg = /\/(\d+)/;
-        //     const paramInfo = this.request.originalUrl.match(idReg);
-        //     let targetId = paramInfo[1] !== undefined ? paramInfo[1] : -1;
-        //     targetId = parseInt(targetId);
-        //
-        //     const logData = {
-        //         controller: this.controllerName,
-        //         action: this.actionName,
-        //         operation: this.currentName === undefined ? '保存数据' : this.currentName,
-        //         target_id: targetId,
-        //     };
-        //     yield this.service.log.addLog(logData);
-        // }
-
         yield next;
     };
 };

+ 4 - 4
app/public/js/shares/batch_import.js

@@ -93,11 +93,11 @@ const BatchImportStageGcl = function (setting) {
             SpreadJsObj.initSheet(this.sheet, {
                 cols: [
                     {title: '选择', field: 'selected', hAlign: 1, width: 40, formatter: '@', cellType: 'checkbox'},
-                    {title: '编号', field: 'code', hAlign: 0, width: 180, formatter: '@', cellType: 'tree'},
-                    {title: '名称/引用标段', field: 'name', hAlign: 0, width: 180, formatter: '@'},
+                    {title: '编号', field: 'code', hAlign: 0, width: 180, formatter: '@', cellType: 'tree', readOnly: true },
+                    {title: '名称/引用标段', field: 'name', hAlign: 0, width: 180, formatter: '@', readOnly: true },
                     {title: '可选期', field: 'stage', hAlign: 1, width: 60, formatter: '@'},
-                    {title: '状态', field: 'status', hAlign: 1, width: 60, formatter: '@'},
-                    {title: '错误信息', field: 'error', hAlign: 1, width: 60, formatter: '@'},
+                    {title: '状态', field: 'status', hAlign: 1, width: 60, formatter: '@', readOnly: true},
+                    {title: '错误信息', field: 'error', hAlign: 1, width: 60, formatter: '@', readOnly: true},
                 ],
                 emptyRows: 0,
                 headRows: 1,

+ 2 - 2
publish.md

@@ -10,8 +10,8 @@
 ##特殊操作
 如果没有特殊说明,则在第默认操作的第3步前,执行相关脚本,如果有特殊要求,需特别说明
 
-### V3.5.xxx
-2023-02-12 ~ ...(uat) ~ ...(prod)
+### V3.5.29.0352
+2023-02-12 ~ 2023-03-28(uat) ~ ...(prod)
 
 ### V3.5.28.0227
 2022-10-24 ~ 2023-02-07(uat) ~ 2023-02-12 prod