【招生用户端】 优化# 子账号管理:账号状态
parent
314c71a520
commit
889efd326d
|
@ -6,3 +6,7 @@ export enum DataFlowEnum {
|
|||
DEFAULT = 0,
|
||||
SPECIFIC = 1
|
||||
}
|
||||
export enum isDisabledEnum {
|
||||
YES = 1,
|
||||
NO = 0
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
</template>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="账号状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-form-item label="账号状态" prop="isDisable">
|
||||
<el-radio-group v-model="form.isDisable">
|
||||
<el-radio v-for="option in accountStatusOptions" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
@ -68,9 +68,9 @@ import { organzationLists } from '@/api/account_center/organization'
|
|||
import { postLists } from '@/api/account_center/postion'
|
||||
import { subAccountAdd, subAccountDetail, subAccountEdit } from '@/api/account_center/sub_account'
|
||||
import ProDialog, { type IParams } from '@/components/ProDialog/index.vue'
|
||||
import { DataFlowEnum, StatusEnum } from '@/enums'
|
||||
import { DataFlowEnum, isDisabledEnum } from '@/enums'
|
||||
import { validateContact } from '@/utils/validate'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
|
||||
export interface IAccount {
|
||||
organizationId: number | string
|
||||
|
@ -78,7 +78,7 @@ export interface IAccount {
|
|||
mobile: string
|
||||
postId: number[]
|
||||
dataFlow: number
|
||||
accountStatus: number
|
||||
isDisable: number
|
||||
teacher: string
|
||||
}
|
||||
const proDialogRef = ref<InstanceType<typeof ProDialog>>()
|
||||
|
@ -97,8 +97,8 @@ const channelOptions = ref([
|
|||
{ label: '组织指定', value: DataFlowEnum.SPECIFIC }
|
||||
])
|
||||
const accountStatusOptions = ref([
|
||||
{ label: '启用', value: 1 },
|
||||
{ label: '停用', value: 2 }
|
||||
{ label: '启用', value: isDisabledEnum.NO },
|
||||
{ label: '停用', value: isDisabledEnum.YES }
|
||||
])
|
||||
const channelTooltips = ['选择默认组织则数据流向到所属组织下的所有招生老师;', '选择组织指定则可选择将数据流向到所属组织下的指定招生老师;']
|
||||
const form = ref({
|
||||
|
@ -108,7 +108,7 @@ const form = ref({
|
|||
mobile: '',
|
||||
postIds: [],
|
||||
dataFlow: 0,
|
||||
status: 1,
|
||||
isDisable: 0,
|
||||
teacher: ''
|
||||
})
|
||||
const fetchPostionData = async (callback?: (params: []) => void) => {
|
||||
|
@ -135,7 +135,7 @@ const setDsiabled = (nodes: any[]) => {
|
|||
nodes.forEach(node => {
|
||||
const ancestorArray = node.ancestors ? node.ancestors.split(',') : []
|
||||
const level = ancestorArray.length - 1
|
||||
node.disabled = level < 2 || node.status == StatusEnum.Stop
|
||||
node.disabled = level < 2 || node.isDisable == isDisabledEnum.YES
|
||||
if (node.children && node.children.length > 0) {
|
||||
setDsiabled(node.children)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<el-button type="danger" plain :icon="Delete" :disabled="isDisabled" @click="handleBatchDelete">批量删除</el-button>
|
||||
</el-space>
|
||||
<el-space>
|
||||
<el-input :placeholder="`请输入${placeholder}`" v-model="searchForm.keyword" @input="handleInputChange">
|
||||
<el-input :placeholder="`请输入${placeholder}`" v-model="searchForm.keyword" clearable @input="handleInputChange">
|
||||
<template #prepend>
|
||||
<el-select v-model="selectKey" :placeholder="placeholder" class="w-[100px]">
|
||||
<el-option v-for="option in searchOptions" :key="option.field" :label="option.label" :value="option.field" />
|
||||
|
@ -37,8 +37,13 @@
|
|||
</span>
|
||||
</el-space>
|
||||
</template>
|
||||
<template #accountStatus="{ row }">
|
||||
<el-switch v-model="row.accountStatus" :active-value="1" :inactive-value="0" :before-change="() => handleStatusChange(row)" />
|
||||
<template #isDisable="{ row }">
|
||||
<el-switch
|
||||
v-model="row.isDisable"
|
||||
:active-value="isDisabledEnum.NO"
|
||||
:inactive-value="isDisabledEnum.YES"
|
||||
:before-change="() => handleStatusChange(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" @click="handleEdit(row)">编辑</el-button>
|
||||
|
@ -57,7 +62,8 @@ import { Plus, Delete } from '@element-plus/icons-vue'
|
|||
import accountDialog from '../components/account-list/account-dialog.vue'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
import { subAccountDelete, subAccountList } from '@/api/account_center/sub_account'
|
||||
import { StatusEnum } from '@/enums'
|
||||
import { StatusEnum, isDisabledEnum } from '@/enums'
|
||||
import { omit } from 'lodash-es'
|
||||
|
||||
const props = defineProps({
|
||||
curOrganization: {
|
||||
|
@ -74,8 +80,8 @@ const searchOptions = shallowRef([
|
|||
])
|
||||
const placeholder = computed(() => searchOptions.value.find(item => item.field == selectKey.value)?.label)
|
||||
const accountStatusOptions = ref([
|
||||
{ label: '启用', value: StatusEnum.Normal },
|
||||
{ label: '停用', value: StatusEnum.Stop }
|
||||
{ label: '启用', value: isDisabledEnum.NO },
|
||||
{ label: '停用', value: isDisabledEnum.YES }
|
||||
])
|
||||
const loading = ref(false)
|
||||
const proTableRef = ref()
|
||||
|
@ -86,7 +92,7 @@ const columns = reactive([
|
|||
{ prop: 'mobile', label: '联系电话', width: 180 },
|
||||
{ prop: 'organizationName', label: '所属组织', width: 180 },
|
||||
{ prop: 'postName', label: '岗位', width: 180 },
|
||||
{ prop: 'status', label: '账号状态', width: 180 },
|
||||
{ prop: 'isDisable', label: '账号状态', width: 180 },
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 }
|
||||
])
|
||||
|
||||
|
@ -96,8 +102,10 @@ const isDisabledAdd = computed(() => props.curOrganization.status == StatusEnum.
|
|||
const fetchTableList = async (nodeId?: number) => {
|
||||
loading.value = true
|
||||
try {
|
||||
const newParams = omit(searchForm.value, ['keyword'])
|
||||
const params = {
|
||||
organizationId: nodeId ?? props.curOrganization.id
|
||||
organizationId: nodeId ?? props.curOrganization.id,
|
||||
...newParams
|
||||
}
|
||||
const result = await subAccountList(params)
|
||||
tableData.value = result ?? []
|
||||
|
@ -163,7 +171,9 @@ const showAccountDialog = (row?: any) => {
|
|||
const searchForm = ref({
|
||||
keyword: '',
|
||||
postId: '',
|
||||
status: ''
|
||||
isDisable: '',
|
||||
username: '',
|
||||
mobile: ''
|
||||
})
|
||||
const handleInputChange = useDebounceFn(() => {
|
||||
const formMap: Record<string, string> = {
|
||||
|
@ -171,9 +181,11 @@ const handleInputChange = useDebounceFn(() => {
|
|||
mobile: ''
|
||||
}
|
||||
formMap[selectKey.value] = searchForm.value.keyword
|
||||
searchForm.value[selectKey.value] = formMap[selectKey.value]
|
||||
fetchTableList()
|
||||
}, 500)
|
||||
const handleSelectChange = () => {
|
||||
console.log('handleSelectChange')
|
||||
fetchTableList()
|
||||
}
|
||||
const positionOptions = ref<any[]>([])
|
||||
|
||||
|
|
Loading…
Reference in New Issue