Просмотр исходного кода

台账修订列表,显示修订详情

MaiXinRong 1 месяц назад
Родитель
Сommit
5d7a5dab1a
3 измененных файлов с 34 добавлено и 14 удалено
  1. 16 0
      app/base/base_service.js
  2. 1 1
      app/service/ledger.js
  3. 17 13
      app/view/revise/index.ejs

+ 16 - 0
app/base/base_service.js

@@ -101,6 +101,22 @@ class BaseService extends Service {
     }
 
     /**
+     * 主动分隔插入数据
+     *
+     * @param transaction 事务
+     * @param tableName 表名
+     * @param datas 插入数据
+     * @param split 分隔条数,默认5000
+     * @returns {Promise<void>}
+     */
+    async insertDatasSplit(transaction, tableName, datas, split = 5000) {
+        const conn = transaction || this.db;
+        for (let i = 0; i < datas.length; i += split) {
+            await conn.insert(tableName, datas.slice(i, i + split));
+        }
+    }
+
+    /**
      * 根据id删除数据
      *
      * @param {Number} id - 数据库中的id

+ 1 - 1
app/service/ledger.js

@@ -710,7 +710,7 @@ module.exports = app => {
                 await transaction.insert(this.tableName, datas);
                 if (this.ctx.tender.data.measure_type === measureType.tz.value
                     && cacheTree.pos && cacheTree.pos.length > 0) {
-                    await transaction.insert(this.ctx.service.pos.tableName, cacheTree.pos);
+                    await this.insertDatasSplit(transaction, this.ctx.service.pos.tableName, cacheTree.pos);
                 }
                 await transaction.commit();
                 this._cacheMaxLid(this.ctx.tender.id, cacheTree.keyNodeId);

+ 17 - 13
app/view/revise/index.ejs

@@ -45,26 +45,27 @@
                 <!--修订中-->
                 <table class="table table-bordered">
                     <thead>
-                    <tr>
-                        <th></th>
-                        <th>创建时间</th>
-                        <th>提交人</th>
-                        <th>状态</th>
-                        <th>完成时间</th>
-                        <th>操作</th>
+                    <tr class="text-center">
+                        <th width="60px"></th>
+                        <th width="150px">创建时间</th>
+                        <th width="150px">提交人</th>
+                        <th width="150px">状态</th>
+                        <th width="150px">完成时间</th>
+                        <th>修订详情</th>
+                        <th width="200px">操作</th>
                     </tr>
                     </thead>
                     <% for (const lr of ledgerRevise) { %>
                     <tr>
-                        <td><%- lr.corder %></td>
-                        <td><%- lr.in_time ? ctx.moment(lr.in_time).format('YYYY-MM-DD HH:mm:ss') : '' %></td>
-                        <td><%- lr.user_name %></td>
+                        <td class="text-center"><%- lr.corder %></td>
+                        <td class="text-center"><%- lr.in_time ? ctx.moment(lr.in_time).format('YYYY-MM-DD HH:mm:ss') : '' %></td>
+                        <td class="text-center"><%- lr.user_name %></td>
                         <% if (!lr.valid) {%>
-                        <td class="text-danger">
+                        <td class="text-danger text-center">
                             作废
                         </td>
                         <% } else { %>
-                        <td class="<%- auditConst.auditProgressClass[lr.status] %>">
+                        <td class="<%- auditConst.auditProgressClass[lr.status] %> text-center">
                             <% if (lr.curAuditor) { %>
                             <% const curAuditor = lr.curAuditors[0]; %>
                             <% if (curAuditor.audit_type === auditType.key.common) { %>
@@ -76,7 +77,10 @@
                             <%- auditConst.auditProgress[lr.status] %>
                         </td>
                         <% } %>
-                        <td><%- lr.end_time ? ctx.moment(lr.end_time).format('YYYY-MM-DD') : '' %></td>
+                        <td class="text-center"><%- lr.end_time ? ctx.moment(lr.end_time).format('YYYY-MM-DD') : '' %></td>
+                        <td style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap; positive: relative; max-width: 450px" title="<%- lr.content %>">
+                            <%- lr.content %>
+                        </td>
                         <td>
                             <% if (lr.valid) { %>
                             <% if (lr.status === auditConst.status.uncheck && lr.uid === ctx.session.sessionUser.accountId) { %>