|
@@ -42,13 +42,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup name="User" lang="jsx">
|
|
|
-import { reactive, ref } from 'vue';
|
|
|
-import { useRequest } from 'vue-request';
|
|
|
+import { ref } from 'vue';
|
|
|
import { getUserList } from '@/api/user';
|
|
|
import useFetchTable from '@/hooks/useFetchTable';
|
|
|
import AddUserDialog from './add-user-dialog.vue';
|
|
|
+import { toggleUserStatus } from '@/api/user';
|
|
|
+import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
const showAddUserDialog = ref(false);
|
|
|
const curRow = ref(null);
|
|
|
+const toggleStatus = (row) => {
|
|
|
+ toggleUserStatus({ id: row.id, enable: !row.enable }).then(() => {
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
+ search();
|
|
|
+ });
|
|
|
+};
|
|
|
const columns = [
|
|
|
{ colKey: 'id', title: '用户ID', width: 180 },
|
|
|
{ colKey: 'realName', title: '姓名' },
|
|
@@ -80,27 +87,10 @@ const columns = [
|
|
|
hover="color"
|
|
|
onClick={(e) => {
|
|
|
e.stopPropagation();
|
|
|
+ toggleStatus(row);
|
|
|
}}
|
|
|
>
|
|
|
- 启用
|
|
|
- </t-link>
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- }}
|
|
|
- >
|
|
|
- 禁用
|
|
|
- </t-link>
|
|
|
- <t-link
|
|
|
- theme="primary"
|
|
|
- hover="color"
|
|
|
- onClick={(e) => {
|
|
|
- e.stopPropagation();
|
|
|
- }}
|
|
|
- >
|
|
|
- 分配角色
|
|
|
+ {row.enable ? '禁用' : '启用'}
|
|
|
</t-link>
|
|
|
</div>
|
|
|
);
|
|
@@ -119,6 +109,7 @@ const {
|
|
|
|
|
|
const addSuccess = () => {
|
|
|
showAddUserDialog.value = false;
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
search();
|
|
|
};
|
|
|
</script>
|