优化功能
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
This commit is contained in:
@@ -80,6 +80,14 @@ export async function getQuickMenuApi() {
|
||||
return requestClient.get<any>(`${prefix}get-quick-menu`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成登录账号
|
||||
* @param id
|
||||
*/
|
||||
export async function generateLoginAccount(id: number) {
|
||||
return requestClient.post<any>(`${prefix}generate-login-account`, { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑账户绑定银行卡
|
||||
* @param data
|
||||
|
||||
@@ -12,6 +12,7 @@ interface RowType {
|
||||
code: string;
|
||||
platform_id: string;
|
||||
phone: string;
|
||||
login_account: string;
|
||||
desc: string;
|
||||
created_at: string;
|
||||
}
|
||||
@@ -44,6 +45,13 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
{ field: 'platform.name', title: '所属平台' },
|
||||
{ field: 'supplier.name', title: '所属供应商' },
|
||||
{ field: 'phone', title: '手机号码' },
|
||||
{
|
||||
field: 'login_account',
|
||||
align: 'left',
|
||||
title: '登录账号',
|
||||
slots: { default: 'login_account' },
|
||||
width: 150,
|
||||
},
|
||||
{ field: 'email', title: '邮箱' },
|
||||
{ field: 'desc', title: '备注' },
|
||||
{ field: 'created_at', title: '注册时间' },
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Button, Image, message } from 'ant-design-vue';
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { TableAction } from '#/components/table-action';
|
||||
|
||||
import {deleteAdmin, resetPassword} from './api';
|
||||
import { deleteAdmin, resetPassword, generateLoginAccount } from './api';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
@@ -69,6 +69,40 @@ const resetPasswordApi = (id: number) => {
|
||||
gridApi.reload();
|
||||
});
|
||||
};
|
||||
|
||||
const generateAccountApi = async (row: any) => {
|
||||
try {
|
||||
const result = await generateLoginAccount(row.id);
|
||||
if (result.login_account) {
|
||||
message.success('生成账号成功');
|
||||
gridApi.reload();
|
||||
}
|
||||
} catch (error: any) {
|
||||
message.error(error.message || '生成账号失败');
|
||||
}
|
||||
};
|
||||
|
||||
const copyToClipboard = async (text: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
message.success('复制成功');
|
||||
} catch (error) {
|
||||
// 降级方案:使用传统方法
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.left = '-999999px';
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
message.success('复制成功');
|
||||
} catch (err) {
|
||||
message.error('复制失败');
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -110,6 +144,16 @@ const resetPasswordApi = (id: number) => {
|
||||
<template #avatar="{ row }">
|
||||
<Image :src="row.avatar" height="30" width="30" />
|
||||
</template>
|
||||
<template #login_account="{ row }">
|
||||
<span v-if="row.login_account">
|
||||
<Button type="link" size="small" @click="copyToClipboard(row.login_account)">
|
||||
{{ row.login_account }}
|
||||
</Button>
|
||||
</span>
|
||||
<Button v-else type="link" size="small" @click="generateAccountApi(row)">
|
||||
生成账号
|
||||
</Button>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
|
||||
@@ -233,6 +233,7 @@ export const modalFormProps: VbenFormProps = {
|
||||
label: '中药采购价比例',
|
||||
rules: 'required',
|
||||
suffix: () => '%',
|
||||
defaultValue: 100,
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
@@ -244,6 +245,7 @@ export const modalFormProps: VbenFormProps = {
|
||||
label: '中药销售比例',
|
||||
rules: 'required',
|
||||
suffix: () => '%',
|
||||
defaultValue: 100,
|
||||
},
|
||||
// {
|
||||
// component: 'VbenInput',
|
||||
|
||||
Reference in New Issue
Block a user