Browse Source

书签,共享显示用户名

MaiXinRong 2 years ago
parent
commit
719d52ab23
2 changed files with 6 additions and 8 deletions
  1. 2 1
      app/public/js/shares/cs_tools.js
  2. 4 7
      app/service/ledger_tag.js

+ 2 - 1
app/public/js/shares/cs_tools.js

@@ -685,6 +685,7 @@ const showSelectTab = function(select, spread, afterShow) {
         };
 
         const getTagDisplayHtml = function (tag) {
+            console.log(tag);
             const tagClass = classIndexes.find(x => {return x.color === tag.color}) || {};
             const tagHtml = [];
             tagHtml.push('<div name="tag-view">');
@@ -693,7 +694,7 @@ const showSelectTab = function(select, spread, afterShow) {
             tagHtml.push('</div>');
             tag.node && tagHtml.push((tag.node.code || '') + (tag.node.b_code || ''), ' / ', tag.node.name || '');
             if (tag.share) {
-                tagHtml.push('<i class="fa fa-users pull-right text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="所有参与台账审批管理的用户都可以看到这条书签"></i>')
+                tagHtml.push(`<div class="pull-right"><i class="fa fa-users text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="所有参与台账审批管理的用户都可以看到这条书签"></i> <span>${tag.u_name}</span></div>`);
             }
             tagHtml.push('<div class="pull-right edit-tag-btn">');
             const lid = tag.node ? tag.node.ledger_id : -1;

+ 4 - 7
app/service/ledger_tag.js

@@ -31,13 +31,9 @@ module.exports = app => {
          * @returns {Promise<void>}
          */
         async getDatas(tid, sid = -1) {
-            // return await this.db.select(this.tableName, {
-            //     where: {tid: tid, sid: -1},
-            //     columns: ['id', 'uid', 'lid', 'share', 'color', 'comment'],
-            //     orders: [['create_time', 'desc']],
-            // });
-            const sql = 'SELECT id, uid, lid, share, color, comment FROM ' + this.tableName +
-                '  WHERE tid = ? and sid = ? and (uid = ? or share) ORDER BY create_time DESC';
+            const sql = 'SELECT la.id, la.uid, la.lid, la.share, la.color, la.comment, pa.name as u_name FROM ' + this.tableName + ' la ' +
+                '  LEFT JOIN ' + this.ctx.service.projectAccount.tableName + ' pa ON la.uid = pa.id' +
+                '  WHERE la.tid = ? and la.sid = ? and (la.uid = ? or la.share) ORDER BY la.create_time DESC';
             return await this.db.query(sql, [tid, sid, this.ctx.session.sessionUser.accountId]);
         }
 
@@ -67,6 +63,7 @@ module.exports = app => {
             }
             const result = await this.db.insert(this.tableName, data);
             data.id = result.insertId;
+            data.u_name = this.ctx.session.sessionUser.name;
             return data;
         }