修改了客服状态判定的bug,更新了一下提示词提示

This commit is contained in:
Cold
2025-12-29 14:12:18 +08:00
parent a7c3c7d264
commit 1681236702
3 changed files with 14 additions and 27 deletions

View File

@@ -49,11 +49,11 @@
<template #default="scope">
<el-button
size="small"
:type="scope.row.isDisabled == 1 ? 'success' : 'info'"
:type="!scope.row.isDisabled ? 'success' : 'info'"
@click="handleStatusChange(scope.row)"
:loading="scope.row.statusLoading"
>
{{ scope.row.isDisabled == 1 ? '启用' : '禁用' }}
{{ !scope.row.isDisabled ? '启用' : '禁用' }}
</el-button>
</template>
</el-table-column>
@@ -105,7 +105,7 @@ import { addAccount, getaccountList, updatestate } from '/@/api/customerService/
interface TableDataItem {
id: string;
accountName: string;
isDisabled: number; // 修正应该是isDisabled而不是status
isDisabled: boolean; // 布尔值false=启用true=禁用
platform: string;
creator: string;
modifier: string;
@@ -119,7 +119,7 @@ interface TableParam {
platform: string;
pageNum: number;
pageSize: number;
isDisabled: number;
isDisabled?: boolean;
}
interface TableState {
@@ -135,7 +135,6 @@ const initialParam: TableParam = {
platform: '',
pageNum: 1,
pageSize: 10,
isDisabled: 0,
};
// 响应式数据
@@ -253,21 +252,21 @@ const formatTime = (time: string | number | Date): string => {
*/
const handleStatusChange = async (row: TableDataItem) => {
try {
await ElMessageBox.confirm(`确定要${row.isDisabled == 1 ? '禁用' : '启用'}客服账号 "${row.accountName}" 吗?`, '提示', {
await ElMessageBox.confirm(`确定要${!row.isDisabled ? '禁用' : '启用'}客服账号 "${row.accountName}" 吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
row.statusLoading = true;
const newStatus = row.isDisabled == 1 ? 0 : 1; // 修正使用isDisabled字段
const newStatus = !row.isDisabled; // 切换布尔值
await updatestate({
id: row.id,
isDisabled: newStatus, // 接口可能需要status字段
isDisabled: newStatus,
});
ElMessage.success(`客服账号已${newStatus == 0 ? '禁用' : '启用'}`);
ElMessage.success(`客服账号已${newStatus ? '禁用' : '启用'}`);
await getList(); // 重新获取数据
} catch (error) {
if (error == 'cancel') {