|
|
@ -25,8 +25,13 @@ |
|
|
<el-col :span="1.5"> |
|
|
<el-col :span="1.5"> |
|
|
<el-button v-hasPermi="['im:user:addCustomer']" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button> |
|
|
<el-button v-hasPermi="['im:user:addCustomer']" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="4" class="flex items-center"> |
|
|
|
|
|
<span class="text-[var(--el-component-bg-color)]">当前客服数量:{{ total }}</span> |
|
|
<el-col :span="8" class="flex items-center" style="margin-left: 10px"> |
|
|
|
|
|
<span class="mr-2">是否开启文件上传</span> |
|
|
|
|
|
<el-switch v-model="fileUploadSwitch" active-text="" inactive-text="" @change="handleFileUploadSwitchChange" /> |
|
|
|
|
|
</el-col> |
|
|
|
|
|
<el-col :span="4" class="flex items-center" style="margin-top: 5px"> |
|
|
|
|
|
<span class="text-[var(--el-component-bg-color)]">当前客服总数量:{{ total }}</span> |
|
|
</el-col> |
|
|
</el-col> |
|
|
|
|
|
|
|
|
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar> |
|
|
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar> |
|
|
@ -118,7 +123,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup name="Customer" lang="ts"> |
|
|
<script setup name="Customer" lang="ts"> |
|
|
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd } from '@/api/im/user/customer'; |
|
|
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, getFileOpen, updateFileOpen } from '@/api/im/user/customer'; |
|
|
import { UserVO, UserQuery, UserForm } from '@/api/im/user/types'; |
|
|
import { UserVO, UserQuery, UserForm } from '@/api/im/user/types'; |
|
|
import { to } from 'await-to-js'; |
|
|
import { to } from 'await-to-js'; |
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
|
|
@ -182,8 +187,42 @@ const data = reactive<PageData<UserForm, UserQuery>>({ |
|
|
}); |
|
|
}); |
|
|
const { queryParams, form, rules } = toRefs(data); |
|
|
const { queryParams, form, rules } = toRefs(data); |
|
|
|
|
|
|
|
|
|
|
|
// 添加文件上传开关状态 |
|
|
|
|
|
const fileUploadSwitch = ref(false); |
|
|
|
|
|
|
|
|
const { im_bool } = toRefs<any>(proxy?.useDict('im_bool')); |
|
|
const { im_bool } = toRefs<any>(proxy?.useDict('im_bool')); |
|
|
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex')); |
|
|
const { sys_user_sex } = toRefs<any>(proxy?.useDict('sys_user_sex')); |
|
|
|
|
|
|
|
|
|
|
|
// 初始化文件上传开关状态 |
|
|
|
|
|
onMounted(async () => { |
|
|
|
|
|
getList(); |
|
|
|
|
|
await initFileUploadSwitch(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/** 初始化文件上传开关状态 */ |
|
|
|
|
|
const initFileUploadSwitch = async () => { |
|
|
|
|
|
try { |
|
|
|
|
|
const response = await getFileOpen(); |
|
|
|
|
|
fileUploadSwitch.value = response.data === 1; |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('获取文件上传开关状态失败:', error); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** 文件上传开关状态改变事件 */ |
|
|
|
|
|
const handleFileUploadSwitchChange = async (value: boolean) => { |
|
|
|
|
|
try { |
|
|
|
|
|
const status = value ? 1 : 0; |
|
|
|
|
|
await updateFileOpen(status); |
|
|
|
|
|
proxy?.$modal.msgSuccess(`${value ? '开启' : '关闭'}文件上传功能成功`); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
// 如果API调用失败,恢复原状态 |
|
|
|
|
|
fileUploadSwitch.value = !value; |
|
|
|
|
|
proxy?.$modal.msgError(`${value ? '开启' : '关闭'}文件上传功能失败`); |
|
|
|
|
|
console.error('更新文件上传开关状态失败:', error); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
/** 提交按钮 */ |
|
|
/** 提交按钮 */ |
|
|
const submitForm = () => { |
|
|
const submitForm = () => { |
|
|
userFormRef.value?.validate(async (valid: boolean) => { |
|
|
userFormRef.value?.validate(async (valid: boolean) => { |
|
|
|