Browse Source

Merge remote-tracking branch 'origin/master'

yu.jie 4 years ago
parent
commit
b9d27af355

+ 23 - 3
src/views/information/account_info/list/account_info_business/index.vue

@@ -50,7 +50,7 @@
                 <a-col :span="12">{{getLoginStatusEnumItemName(sub.loginstatus)}}</a-col>
               </a-row>
             </template>
-            <BtnList :btnList="forDataBtn"
+            <BtnList :btnList="sub.btnList"
                      :selectedData="sub"
                      @onClick="chooseAction" />
           </a-collapse-panel>
@@ -64,7 +64,7 @@
     <Reset :selectedData="selectedData"
            @refresh="queryTable" />
     <Locked :selectedData="selectedData"
-            @refresh="queryTable"/>
+            @refresh="queryTable" />
     <Cancel />
     <Detail :selectedData="selectedData" />
   </div>
@@ -101,12 +101,32 @@ export default defineComponent({
     setup() {
         const { loading, tableList, queryTable } = queryTableList();
         const { commonBtn, forDataBtn } = getBtnList('account_info_business', true);
+        console.log('forDataBtn', forDataBtn);
+
         // 角色id
         const roleid = ref<number>(0);
         // 操作相关选中的数据
         const selectedData = reactive({});
         initData(() => {
-            queryTable();
+            queryTable().then(() => {
+                tableList.value.forEach((el) => {
+                    // 过滤无效
+                    const arr = el.userlist.filter((item) => item.loginstatus !== 3);
+                    arr.forEach((item) => {
+                        const { loginstatus } = item;
+                        let btnList = [...forDataBtn.value];
+                        if (loginstatus === 1) {
+                            // 正常
+                            btnList = forDataBtn.value.filter((e) => e.lable !== '解锁');
+                        } else if (loginstatus === 2) {
+                            // 冻结
+                            btnList = forDataBtn.value.filter((e) => e.lable === '解锁' || e.lable === '详情');
+                        }
+                        Object.assign(item, { btnList });
+                    });
+                    Object.assign(el, { userlist: arr });
+                });
+            });
         });
         // 查询
         function search(value: any) {}

+ 5 - 2
src/views/information/account_info/list/account_info_business/setup.ts

@@ -9,8 +9,11 @@ export function queryTableList() {
     // 表格数据
     const tableList = ref<ErmcpLoginUserEx[]>([]);
     function queryTable() {
-        queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 1)
-            .then(res => tableList.value = res)
+        return queryResultLoadingAndInfo(QueryAccMgrLoginUser, loading, 1)
+            .then(res => {
+                tableList.value = res
+                return 'ok'
+            })
     }
     return { loading, tableList, queryTable }
 }