huangbin 4 tahun lalu
induk
melakukan
4086de7419

+ 2 - 0
src/common/setup/table/clolumn.ts

@@ -58,6 +58,8 @@ export function getTableColumns() {
             cb && cb(e, item, filtered);
             columns.value.push(item);
         });
+        console.log('columns', columns);
+
     }
     /**
      * 更新动态表头

+ 18 - 6
src/views/report/components/filter/index.vue

@@ -64,13 +64,25 @@ export default defineComponent({
             selectedUser.value.key = getUserId();
             queryTable().then((res) => {
                 userList.value.length = 0;
-                userList.value.push({ value: getUserId(), lable: getUserName() });
-                res.forEach((e) => {
-                    e.userlist.forEach((el) => {
-                        // userList.value.push({ value: el.loginid, lable: `${el.loginname}-${el.logincode}` });
-                        userList.value.push({ value: el.loginid, lable: el.loginname });
+                const id = getUserId();
+                const has = res.find((e) => e.roleid === id);
+                if (has) {
+                    // 找到了,代表着是交易员,只能看自己和下级
+                    has.userlist.forEach((el) => {
+                        userList.value.push({ value: el.loginid, lable: `${el.loginname}-${el.logincode}` });
+                        // userList.value.push({ value: el.loginid, lable: el.loginname });
                     });
-                });
+                } else {
+                    // 没有找到代表着是机构,可以查看所有交易员
+                    userList.value.push({ value: id, lable: getUserName() });
+                    res.forEach((e) => {
+                        userList.value.push({ value: e.roleid, lable: e.rolename });
+                        e.userlist.forEach((el) => {
+                            userList.value.push({ value: el.loginid, lable: `${el.loginname}-${el.logincode}` });
+                            // userList.value.push({ value: el.loginid, lable: el.loginname });
+                        });
+                    });
+                }
             });
         });
         return {