index.vue
5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
<a-card class="content">
<!-- 查询条件 start-->
<a-row>
<a-col :flex="1" style="margin-top: 4px;">
<a-form :model="searchParams" label-align="left" auto-label-width>
<a-row :gutter="24">
<a-col :span="8">
<a-form-item field="station" :label="$t('manage.account.authority.siteName')">
<a-input v-model="searchParams.deptName" :placeholder="$t('manage.account.authority.siteNamePlaceholder')" allow-clear />
</a-form-item>
</a-col>
<a-col :span="8">
<a-button type="primary" @click="fetchData">
<template #icon>
<icon-search />
</template>
{{$t('global.search')}}
</a-button>
</a-col>
</a-row>
</a-form>
</a-col>
</a-row>
<!-- 查询条件 end-->
<a-divider style="margin-top: 0" />
<!-- 表格 start-->
<a-table row-key="id" :columns="tabColumns" :data="renderData" :loading="loading" show-empty-tree
:bordered="{ wrapper: true, cell: true }" :default-expand-all-rows="true">
<template #originType="{ record }">
<a-tag v-if="record.originType === 1" color="rgb(var(--arcoblue-6))">{{$t('manage.account.authority.firm')}}</a-tag>
<a-tag v-if="record.originType === 2 && record.isCanSelect === 0 " color="rgb(var(--green-6))">{{$t('manage.account.authority.group')}}</a-tag>
<a-tag v-if="record.originType === 2 && record.isCanSelect === 1 " color="rgb(var(--orange-6))">{{$t('manage.account.authority.site')}}</a-tag>
</template>
<template #stopFlag="{ record }">
<stop-flag :value="record.stopFlag"></stop-flag>
</template>
<template #operate="{ record }">
<a-button size="small" type="text" status="success" @click="viewRoleClick(record)"
v-if="record.originType === 2">{{$t('manage.account.authority.viewMember')}}
</a-button>
</template>
</a-table>
<!-- 表格 end-->
<!-- 查看成员弹出层 start -->
<a-modal width="auto" v-model:visible="roleModalVisible" class="modal-box" :footer="false">
<template #title>
【{{ roleModalTitle }}】{{$t('manage.account.authority.permissionMember')}}
</template>
<a-table row-key="id" :bordered="{ wrapper: true, cell: true }" hide-expand-button-on-empty
:columns="userTabColumns" :data="filteredData1">
<template #stopFlag="{ record }">
{{ record.stopFlag === 1 ? $t('global.enable') : record.stopFlag === 0 ? $t('global.forbidden') : '' }}
</template>
</a-table>
</a-modal>
<!-- 查看成员弹出层 end -->
</a-card>
</template>
<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { listDept, getDeptMember } from "@/api/manage/account/authority";
import { TableColumnData } from "@arco-design/web-vue";
import useLoading from "@/hooks/loading";
import { handleTree } from "@/utils/ruoyi";
/*************************** 变量区域 begin ***************************/
//加载中
const { loading, setLoading } = useLoading(true);
//站点列
const tabColumns: TableColumnData[] = [
// {
// title: "编号",
// dataIndex: "id",
// slotName: "id",
// align: 'center',
// width: 200
// },
{
title: "站点名称",
dataIndex: "deptName",
slotName: "deptName",
width: 300
},
{
title: "站点编码",
dataIndex: "deptSn",
width: 150
},
{
title: "站点类型",
dataIndex: "originType",
slotName: "originType",
align: 'center',
width: 100
},
{
title: "启用状态",
dataIndex: "stopFlag",
slotName: "stopFlag",
align: 'center',
width: 100
},
{
title: "创建时间",
dataIndex: "createTime",
slotName: "createTime",
width: 180,
align: 'center'
}
];
//站点数据
const renderData = ref<TableColumnData[]>([]);
// 成员列
const userTabColumns: TableColumnData[] = [
{
title: "用户姓名",
dataIndex: "leader",
width: 240
},
{
title: "登录账号",
dataIndex: "deptSn",
width: 240
},
{
title: "手机",
dataIndex: "mobile",
align: 'center',
width: 140
},
{
title: "用户状态",
dataIndex: "stopFlag",
slotName: "stopFlag",
align: 'center',
width: 100
}
];
// 成员数据
const filteredData1 = ref([])
//查询项
const searchParams = ref({
deptName: ""
});
// 站点展示表格单元格合并设置
const roleModalTitle = ref<string>('');
const roleModalVisible = ref(false);
/*************************** 变量区域 end ***************************/
/*************************** 方法区域 begin ***************************/
/**
* 查询站点
*/
const fetchData = async () => {
setLoading(true);
try {
const res = await listDept(searchParams.value);
renderData.value = handleTree(res.data);
} catch (err) {
} finally {
setLoading(false);
}
};
/**
* 查看成员
* @param record 记录
*/
const viewRoleClick = async (record: any) => {
const res = await getDeptMember(record.id)
filteredData1.value = res.data
roleModalTitle.value = record.deptName;
roleModalVisible.value = true;
};
/*************************** 方法区域 end ***************************/
onMounted(() => {
fetchData();
})
</script>
<style lang="less" scoped>
.group-name {
font-weight: 600;
}
</style>