|
@@ -77,7 +77,7 @@ module.exports = app => {
|
|
|
*
|
|
|
* @return {Array} - 返回标段数据
|
|
|
*/
|
|
|
- async getList(listStatus) {
|
|
|
+ async getList(listStatus, permission) {
|
|
|
// 获取当前项目信息
|
|
|
const session = this.ctx.session;
|
|
|
let sql = '';
|
|
@@ -91,7 +91,18 @@ module.exports = app => {
|
|
|
' ON t.`user_id` = pa.`id` ' +
|
|
|
' WHERE t.`project_id` = ? AND t.`user_id` = ?';
|
|
|
sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, session.sessionProject.id, session.sessionUser.accountId];
|
|
|
+ } else if (permission !== null && permission.tender !== undefined && permission.tender.indexOf('2') !== -1) {
|
|
|
+ // 具有查看所有标段权限的用户查阅标段
|
|
|
+ sql = 'SELECT t.`id`, t.`project_id`, t.`name`, t.`status`, t.`category`, t.`ledger_times`, t.`ledger_status`, t.`measure_type`, t.`user_id`, t.`create_time`, ' +
|
|
|
+ ' pa.`name` As `user_name`, pa.`role` As `user_role`, pa.`company` As `user_company` ' +
|
|
|
+ ' FROM ?? As t ' +
|
|
|
+ ' Left Join ?? As pa ' +
|
|
|
+ ' ON t.`user_id` = pa.`id` ' +
|
|
|
+ ' WHERE t.`project_id` = ?';
|
|
|
+ sqlParam = [this.tableName, this.ctx.service.projectAccount.tableName, session.sessionProject.id];
|
|
|
} else {
|
|
|
+ // 根据用户权限查阅标段
|
|
|
+
|
|
|
// tender 163条数据,project_account 68条数据测试
|
|
|
// 查询两张表耗时0.003s,查询tender左连接project_account耗时0.002s
|
|
|
sql = 'SELECT t.`id`, t.`project_id`, t.`name`, t.`status`, t.`category`, t.`ledger_times`, t.`ledger_status`, t.`measure_type`, t.`user_id`, t.`create_time`, ' +
|