fix bug
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import request from './request'
|
||||
|
||||
// 获取简易客户列表(用于下拉选择)
|
||||
export const getSimpleCustomerList = (params, config) => {
|
||||
return request.get('/customers/simple', { params, ...config })
|
||||
}
|
||||
|
||||
// 获取客户列表
|
||||
export const getCustomerList = (params, config) => {
|
||||
return request.get('/customers', { params, ...config })
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import request from './request'
|
||||
|
||||
// 获取简易供应商列表(用于下拉选择)
|
||||
export const getSimpleSupplierList = (params, config) => {
|
||||
return request.get('/suppliers/simple', { params, ...config })
|
||||
}
|
||||
|
||||
// 获取供应商列表
|
||||
export const getSupplierList = (params, config) => {
|
||||
return request.get('/suppliers', { params, ...config })
|
||||
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
updateContract,
|
||||
deleteContractAPI
|
||||
} from '../api/contract'
|
||||
import { getCustomerList } from '../api/customer'
|
||||
import { getSimpleCustomerList } from '../api/customer'
|
||||
import { getEmployeeList } from '../api/employee'
|
||||
import { getSupplierList } from '../api/suppliers'
|
||||
import { getSimpleSupplierList } from '../api/suppliers'
|
||||
import { getSimpleUserList } from '../api/user'
|
||||
import { formatDateTime, formatDate } from "../utils/date"
|
||||
import { hasPermission, getUserInfo } from '../store/user'
|
||||
@@ -36,9 +36,9 @@ const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
|
||||
// 采购经理只能操作采购合同,招商经理只能操作加盟合同(提前定义,供 form 初始化使用)
|
||||
const isAdmin = computed(() => getUserInfo()?.roleName === 'admin')
|
||||
const isProcurementManager = computed(() => getUserInfo()?.roleName === 'procurement_manager')
|
||||
const isFranchiseManager = computed(() => getUserInfo()?.roleName === 'franchise_manager')
|
||||
const isAdmin = computed(() => getUserInfo()?.departmentName === 'admin')
|
||||
const isProcurementManager = computed(() => getUserInfo()?.departmentName === 'procurement_manager')
|
||||
const isFranchiseManager = computed(() => getUserInfo()?.departmentName === 'franchise_manager')
|
||||
const getDefaultType = () => {
|
||||
if (isProcurementManager.value) return 'supply'
|
||||
if (isFranchiseManager.value) return 'franchise'
|
||||
@@ -55,7 +55,7 @@ const form = reactive({
|
||||
effective_date: '',
|
||||
expiry_date: '',
|
||||
amount: 0,
|
||||
status: '待审批',
|
||||
status: '生效中',
|
||||
remark: '',
|
||||
responsible_user_id: ''
|
||||
})
|
||||
@@ -85,14 +85,14 @@ const handleCurrentChange = (val) => {
|
||||
// 获取客户、员工、供应商和用户列表供下拉选择
|
||||
const fetchOptions = async () => {
|
||||
const results = await Promise.allSettled([
|
||||
getCustomerList(null, { quiet: true }),
|
||||
getSimpleCustomerList(null, { quiet: true }),
|
||||
getEmployeeList(null, { quiet: true }),
|
||||
getSupplierList(null, { quiet: true }),
|
||||
getSimpleSupplierList(null, { quiet: true }),
|
||||
getSimpleUserList({ quiet: true })
|
||||
])
|
||||
if (results[0].status === 'fulfilled') {
|
||||
const cRes = results[0].value
|
||||
customerList.value = cRes.data?.list || cRes.data || []
|
||||
customerList.value = cRes?.data || []
|
||||
}
|
||||
if (results[1].status === 'fulfilled') {
|
||||
const eRes = results[1].value
|
||||
@@ -100,11 +100,11 @@ const fetchOptions = async () => {
|
||||
}
|
||||
if (results[2].status === 'fulfilled') {
|
||||
const sRes = results[2].value
|
||||
supplierList.value = sRes.data?.list || sRes.data || []
|
||||
supplierList.value = sRes?.data || []
|
||||
}
|
||||
if (results[3].status === 'fulfilled') {
|
||||
const uRes = results[3].value
|
||||
userList.value = uRes.data || []
|
||||
userList.value = uRes?.data || []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ const resetForm = () => {
|
||||
effective_date: '',
|
||||
expiry_date: '',
|
||||
amount: 0,
|
||||
status: '待审批',
|
||||
status: '生效中',
|
||||
remark: '',
|
||||
responsible_user_id: ''
|
||||
})
|
||||
@@ -283,11 +283,12 @@ const closeDetail = () => {
|
||||
// 状态样式
|
||||
const getStatusType = (status) => {
|
||||
const map = {
|
||||
'草稿': 'info',
|
||||
'生效中': 'success',
|
||||
'生效': 'success',
|
||||
'已到期': 'danger',
|
||||
'待审批': 'warning',
|
||||
'已终止': 'info'
|
||||
'完成': 'success',
|
||||
'已完成': 'success',
|
||||
'作废': 'danger'
|
||||
}
|
||||
return map[status] || 'info'
|
||||
}
|
||||
@@ -327,6 +328,7 @@ const dateShortcuts = [
|
||||
const canCreate = computed(() => hasPermission('contract', 'create'))
|
||||
const canUpdate = computed(() => hasPermission('contract', 'update'))
|
||||
const canDelete = computed(() => hasPermission('contract', 'delete'))
|
||||
const canOperate = computed(() => canUpdate.value || canDelete.value)
|
||||
|
||||
// 招商经理只能编辑加盟合同,采购经理只能编辑采购合同
|
||||
const canEditRow = (row) => {
|
||||
@@ -436,7 +438,7 @@ const canDeleteRow = (row) => {
|
||||
{{ formatDate(row.expiry_date) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="140" fixed="right">
|
||||
<el-table-column label="操作" width="140" fixed="right" v-if="canOperate">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editContract(row)" v-if="canEditRow(row)">编辑</el-button>
|
||||
<el-button link type="danger" @click="deleteContract(row.id)" v-if="canDeleteRow(row)">删除</el-button>
|
||||
@@ -538,10 +540,11 @@ const canDeleteRow = (row) => {
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" required>
|
||||
<el-select v-model="form.status" style="width: 100%;">
|
||||
<el-option label="待审批" value="待审批" />
|
||||
<el-option label="草稿" value="草稿" />
|
||||
<el-option label="生效中" value="生效中" />
|
||||
<el-option label="已到期" value="已到期" />
|
||||
<el-option label="已终止" value="已终止" />
|
||||
<el-option label="生效" value="生效" />
|
||||
<el-option label="完成" value="完成" />
|
||||
<el-option label="作废" value="作废" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { getSimpleUserList } from '../api/user'
|
||||
import { hasPermission, getUserInfo } from '../store/user'
|
||||
|
||||
const isAdmin = computed(() => getUserInfo()?.roleName === 'admin')
|
||||
const isAdmin = computed(() => getUserInfo()?.departmentName === 'admin')
|
||||
|
||||
const form = reactive({
|
||||
id: '',
|
||||
@@ -67,7 +67,7 @@ onMounted(() => {
|
||||
// 仅管理员可加载用户列表用于选择负责人
|
||||
if (isAdmin.value) {
|
||||
getSimpleUserList({ quiet: true }).then(res => {
|
||||
userList.value = res.data?.list || res.data || []
|
||||
userList.value = res.data || []
|
||||
}).catch(() => {})
|
||||
}
|
||||
})
|
||||
@@ -238,6 +238,7 @@ const handleCurrentChange = (val) => {
|
||||
const canCreate = computed(() => hasPermission('customer', 'create'))
|
||||
const canUpdate = computed(() => hasPermission('customer', 'update'))
|
||||
const canDelete = computed(() => hasPermission('customer', 'delete'))
|
||||
const canOperate = computed(() => canUpdate.value || canDelete.value)
|
||||
|
||||
</script>
|
||||
|
||||
@@ -298,13 +299,19 @@ const canDelete = computed(() => hasPermission('customer', 'delete'))
|
||||
<el-table-column prop="id" label="编号" width="80" />
|
||||
<el-table-column prop="name" label="姓名" width="120" />
|
||||
<el-table-column prop="phone" label="电话" width="150" />
|
||||
<el-table-column label="地区" min-width="150">
|
||||
<template #default="{ row }">
|
||||
{{ [row.province, row.city].filter(Boolean).join(' ') || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="email" label="邮箱" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="address" label="地址" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="responsible_user_name" label="负责人" width="100">
|
||||
<template #default="{ row }">
|
||||
{{ row.responsible_user_name || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right" v-if="canOperate">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editCustomer(row)" v-if="canUpdate">编辑</el-button>
|
||||
<el-button link type="danger" @click="deleteCustomer(row.id)" v-if="canDelete">删除</el-button>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
updateEmployee,
|
||||
deleteEmployeeAPI
|
||||
} from '../api/employee'
|
||||
import { hasPermission } from '../store/user'
|
||||
import { hasPermission, getUserInfo } from '../store/user'
|
||||
import { formatDateTime, formatDate } from '../utils/date'
|
||||
import { createUser } from '../api/user'
|
||||
|
||||
@@ -51,15 +51,15 @@ const userForm = reactive({
|
||||
username: '',
|
||||
password: '',
|
||||
name: '',
|
||||
role_id: 2,
|
||||
department_id: 2,
|
||||
is_active: 1,
|
||||
employee_id: null
|
||||
})
|
||||
|
||||
// 部门列表
|
||||
const departmentOptions = [
|
||||
'运营部', '销售部', '技术部', '市场部', '财务部', '仓储部', '人事部', '行政部',
|
||||
'招商部', '采购部', '总经理办公室', '信息技术部'
|
||||
'信息技术部', '总经理办公室', '招商部', '采购部', '运营部', '财务部',
|
||||
'销售部', '技术部', '市场部', '仓储部', '人事部', '行政部'
|
||||
]
|
||||
|
||||
// 学历列表
|
||||
@@ -288,7 +288,7 @@ const openUserForm = (employee) => {
|
||||
userForm.username = ''
|
||||
userForm.password = ''
|
||||
userForm.name = employee.name
|
||||
userForm.role_id = 2
|
||||
userForm.department_id = 2
|
||||
userForm.is_active = 1
|
||||
userForm.employee_id = employee.id
|
||||
}
|
||||
@@ -306,7 +306,7 @@ const saveUserFromEmployee = async () => {
|
||||
await createUser({
|
||||
username: userForm.username,
|
||||
password: userForm.password,
|
||||
role_id: userForm.role_id,
|
||||
department_id: userForm.department_id,
|
||||
employee_id: userForm.employee_id,
|
||||
is_active: userForm.is_active
|
||||
})
|
||||
@@ -322,7 +322,7 @@ const cancelCreateUser = () => {
|
||||
userForm.username = ''
|
||||
userForm.password = ''
|
||||
userForm.name = ''
|
||||
userForm.role_id = 2
|
||||
userForm.department_id = 2
|
||||
userForm.is_active = 1
|
||||
userForm.employee_id = null
|
||||
showSearchResults.value = true
|
||||
@@ -332,6 +332,8 @@ const cancelCreateUser = () => {
|
||||
const canCreate = computed(() => hasPermission('employee', 'create'))
|
||||
const canUpdate = computed(() => hasPermission('employee', 'update'))
|
||||
const canDelete = computed(() => hasPermission('employee', 'delete'))
|
||||
const canOperate = computed(() => canUpdate.value || canDelete.value)
|
||||
const showSalary = computed(() => ['总经理办公室', '财务部'].includes(getUserInfo()?.departmentDesc))
|
||||
|
||||
</script>
|
||||
|
||||
@@ -393,14 +395,14 @@ const canDelete = computed(() => hasPermission('employee', 'delete'))
|
||||
</el-table-column>
|
||||
<el-table-column prop="age" label="年龄" width="60" />
|
||||
<el-table-column prop="education" label="学历" width="70" />
|
||||
<el-table-column prop="department" label="部门" width="90" />
|
||||
<el-table-column prop="position" label="职务" width="110" />
|
||||
<el-table-column prop="salary" label="工资" width="100">
|
||||
<el-table-column prop="department" label="部门" min-width="90" />
|
||||
<el-table-column prop="position" label="职务" min-width="110" />
|
||||
<el-table-column prop="salary" label="工资" width="100" v-if="showSalary">
|
||||
<template #default="{ row }">
|
||||
¥{{ row.salary?.toLocaleString() }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="phone" label="联系电话" width="130" />
|
||||
<el-table-column prop="phone" label="联系电话" min-width="130" />
|
||||
<el-table-column prop="entry_date" label="入职时间" width="110">
|
||||
<template #default="{ row }">
|
||||
{{ formatDate(row.entry_date) }}
|
||||
@@ -413,7 +415,7 @@ const canDelete = computed(() => hasPermission('employee', 'delete'))
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right" v-if="canOperate">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editEmployee(row)" v-if="canUpdate">编辑</el-button>
|
||||
<el-button link type="danger" @click="deleteEmployee(row.id)" v-if="canDelete">删除</el-button>
|
||||
@@ -562,10 +564,14 @@ const canDelete = computed(() => hasPermission('employee', 'delete'))
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户角色">
|
||||
<el-select v-model="userForm.role_id" placeholder="请选择角色" style="width: 100%;">
|
||||
<el-option label="普通用户" :value="2" />
|
||||
<el-option label="系统管理员" :value="1" />
|
||||
<el-form-item label="所属部门">
|
||||
<el-select v-model="userForm.department_id" placeholder="请选择部门" style="width: 100%;">
|
||||
<el-option label="信息技术部" :value="1" />
|
||||
<el-option label="总经理办公室" :value="2" />
|
||||
<el-option label="招商部" :value="3" />
|
||||
<el-option label="运营部" :value="4" />
|
||||
<el-option label="采购部" :value="5" />
|
||||
<el-option label="财务部" :value="6" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@@ -53,7 +53,7 @@ const checkPermission = (resource, action) => {
|
||||
<div class="header-right">
|
||||
<span class="user-info" v-if="userInfo">
|
||||
<el-icon><User /></el-icon>
|
||||
{{ userInfo.name }}({{ userInfo.roleName }})
|
||||
{{ userInfo.name }}({{ userInfo.departmentDesc }})
|
||||
</span>
|
||||
<el-menu-item index="" class="logout-item" @click="handleLogout">
|
||||
<el-icon><SwitchButton/></el-icon>
|
||||
|
||||
@@ -254,6 +254,7 @@ const handleCurrentChange = (val) => {
|
||||
const canCreate = computed(() => hasPermission('product', 'create'))
|
||||
const canUpdate = computed(() => hasPermission('product', 'update'))
|
||||
const canDelete = computed(() => hasPermission('product', 'delete'))
|
||||
const canOperate = computed(() => canUpdate.value || canDelete.value)
|
||||
|
||||
</script>
|
||||
|
||||
@@ -328,7 +329,7 @@ const canDelete = computed(() => hasPermission('product', 'delete'))
|
||||
<el-table-column prop="unit" label="单位" width="70" />
|
||||
<el-table-column prop="specification" label="规格" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="supplier" label="供应商" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right" v-if="canOperate">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editProduct(row)" v-if="canUpdate">编辑</el-button>
|
||||
<el-button link type="danger" @click="deleteProduct(row.id)" v-if="canDelete">删除</el-button>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
updateService,
|
||||
deleteServiceAPI
|
||||
} from '../api/service'
|
||||
import { getCustomerList } from '../api/customer'
|
||||
import { getSimpleCustomerList } from '../api/customer'
|
||||
import { getSimpleEmployeeList } from '../api/employee'
|
||||
import { hasPermission } from '../store/user'
|
||||
import { formatDateTime, formatDate } from '../utils/date'
|
||||
@@ -57,11 +57,11 @@ onMounted(() => {
|
||||
// 获取客户和员工列表供下拉选择(仅运营部员工可跟进售后)
|
||||
const fetchOptions = async () => {
|
||||
const results = await Promise.allSettled([
|
||||
getCustomerList(null, { quiet: true }),
|
||||
getSimpleCustomerList(null, { quiet: true }),
|
||||
getSimpleEmployeeList({ department: '运营部' }, { quiet: true })
|
||||
])
|
||||
if (results[0].status === 'fulfilled') {
|
||||
customerList.value = results[0].value.data?.list || results[0].value.data || []
|
||||
customerList.value = results[0].value.data || []
|
||||
}
|
||||
if (results[1].status === 'fulfilled') {
|
||||
employeeList.value = results[1].value.data || []
|
||||
@@ -261,6 +261,7 @@ const handleCurrentChange = (val) => {
|
||||
const canCreate = computed(() => hasPermission('after_sale', 'create'))
|
||||
const canUpdate = computed(() => hasPermission('after_sale', 'update'))
|
||||
const canDelete = computed(() => hasPermission('after_sale', 'delete'))
|
||||
const canOperate = computed(() => canUpdate.value || canDelete.value)
|
||||
|
||||
</script>
|
||||
|
||||
@@ -317,11 +318,15 @@ const canDelete = computed(() => hasPermission('after_sale', 'delete'))
|
||||
<el-table :data="paginatedData" v-loading="loading" border style="width: 100%"
|
||||
@row-dblclick="handleRowDblClick" row-class-name="clickable-row">
|
||||
<el-table-column prop="id" label="编号" width="70" />
|
||||
<el-table-column prop="customer_id" label="客户ID" width="90" />
|
||||
<el-table-column prop="feedback" label="反馈内容" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="employee_id" label="业务员ID" width="100">
|
||||
<el-table-column prop="customer_name" label="客户" width="100">
|
||||
<template #default="{ row }">
|
||||
{{ row.employee_id || '—' }}
|
||||
{{ row.customer_name || row.customer_id }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="feedback" label="反馈内容" min-width="200" show-overflow-tooltip />
|
||||
<el-table-column prop="employee_name" label="业务员" width="90">
|
||||
<template #default="{ row }">
|
||||
{{ row.employee_name || row.employee_id || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="handle_status" label="处理状态" width="100">
|
||||
@@ -337,7 +342,7 @@ const canDelete = computed(() => hasPermission('after_sale', 'delete'))
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="handle_method" label="处理方式" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right" v-if="canOperate">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editService(row)" v-if="canUpdate">编辑</el-button>
|
||||
<el-button link type="danger" @click="deleteService(row.id)" v-if="canDelete">删除</el-button>
|
||||
@@ -415,8 +420,8 @@ const canDelete = computed(() => hasPermission('after_sale', 'delete'))
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="售后编号">{{ currentDetail.id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="售后日期">{{ formatDate(currentDetail.service_date) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客户ID">{{ currentDetail.customer_id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="业务员ID">{{ currentDetail.employee_id || '未分配' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="客户">{{ currentDetail.customer_name || currentDetail.customer_id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="业务员">{{ currentDetail.employee_name || currentDetail.employee_id || '未分配' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="处理状态">
|
||||
<el-tag :type="statusMap[currentDetail.handle_status]">
|
||||
{{ currentDetail.handle_status }}
|
||||
|
||||
@@ -226,6 +226,7 @@ const handleCurrentChange = (val) => {
|
||||
const canCreate = computed(() => hasPermission('supplier', 'create'))
|
||||
const canUpdate = computed(() => hasPermission('supplier', 'update'))
|
||||
const canDelete = computed(() => hasPermission('supplier', 'delete'))
|
||||
const canOperate = computed(() => canUpdate.value || canDelete.value)
|
||||
|
||||
</script>
|
||||
|
||||
@@ -298,7 +299,7 @@ const canDelete = computed(() => hasPermission('supplier', 'delete'))
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" fixed="right">
|
||||
<el-table-column label="操作" width="150" fixed="right" v-if="canOperate">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="editSupplier(row)" v-if="canUpdate">编辑</el-button>
|
||||
<el-button link type="danger" @click="deleteSupplier(row.id)" v-if="canDelete">删除</el-button>
|
||||
|
||||
@@ -16,9 +16,8 @@ import { formatDateTime } from '../utils/date'
|
||||
const form = reactive({
|
||||
username: '',
|
||||
password: '',
|
||||
role_id: 2,
|
||||
department_id: 2,
|
||||
employee_id: null,
|
||||
department: '',
|
||||
is_active: 1
|
||||
})
|
||||
|
||||
@@ -39,14 +38,14 @@ const currentDetail = ref(null)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
|
||||
// 角色列表
|
||||
const roleList = ref([
|
||||
{ id: 1, name: 'admin', description: '系统管理员' },
|
||||
{ id: 2, name: 'general_manager', description: '总经理' },
|
||||
{ id: 3, name: 'franchise_manager', description: '招商经理' },
|
||||
{ id: 4, name: 'operations_manager', description: '运营经理' },
|
||||
{ id: 5, name: 'procurement_manager', description: '采购经理' },
|
||||
{ id: 6, name: 'finance', description: '财务人员' }
|
||||
// 部门列表
|
||||
const deptList = ref([
|
||||
{ id: 1, name: 'admin', description: '信息技术部' },
|
||||
{ id: 2, name: 'general_manager', description: '总经理办公室' },
|
||||
{ id: 3, name: 'franchise_manager', description: '招商部' },
|
||||
{ id: 4, name: 'operations_manager', description: '运营部' },
|
||||
{ id: 5, name: 'procurement_manager', description: '采购部' },
|
||||
{ id: 6, name: 'finance', description: '财务部' }
|
||||
])
|
||||
|
||||
// 员工列表
|
||||
@@ -103,7 +102,7 @@ const handleSearch = async () => {
|
||||
|
||||
loading.value = true
|
||||
const params = {
|
||||
role_id: filterType.value || undefined,
|
||||
department_id: filterType.value || undefined,
|
||||
is_active: filterStatus.value !== '' ? filterStatus.value : undefined
|
||||
}
|
||||
// 根据搜索类型添加参数
|
||||
@@ -128,9 +127,8 @@ const handleSearch = async () => {
|
||||
const resetForm = () => {
|
||||
form.username = ''
|
||||
form.password = ''
|
||||
form.role_id = 2
|
||||
form.department_id = 2
|
||||
form.employee_id = null
|
||||
form.department = ''
|
||||
form.is_active = 1
|
||||
isEditMode.value = false
|
||||
currentUserId.value = null
|
||||
@@ -149,9 +147,8 @@ const editUser = (row) => {
|
||||
currentUserId.value = row.id
|
||||
form.username = row.username
|
||||
form.password = ''
|
||||
form.role_id = row.role_id
|
||||
form.department_id = row.department_id
|
||||
form.employee_id = row.employee_id
|
||||
form.department = row.department
|
||||
form.is_active = row.is_active
|
||||
showAddForm.value = true
|
||||
showSearchResults.value = false
|
||||
@@ -170,9 +167,8 @@ const saveUser = async () => {
|
||||
|
||||
const formData = {
|
||||
username: form.username,
|
||||
role_id: form.role_id,
|
||||
department_id: form.department_id,
|
||||
employee_id: form.employee_id,
|
||||
department: form.department,
|
||||
is_active: form.is_active
|
||||
}
|
||||
if (!isEditMode.value) {
|
||||
@@ -249,14 +245,6 @@ const handleCurrentChange = (val) => {
|
||||
currentPage.value = val
|
||||
}
|
||||
|
||||
// 员工选择变化
|
||||
const handleEmployeeChange = (empId) => {
|
||||
const emp = employeeList.value.find(e => e.id === empId)
|
||||
if (emp) {
|
||||
form.department = emp.department
|
||||
}
|
||||
}
|
||||
|
||||
// 检查权限
|
||||
const canManage = computed(() => hasPermission('user', 'manage'))
|
||||
|
||||
@@ -289,8 +277,8 @@ const canManage = computed(() => hasPermission('user', 'manage'))
|
||||
|
||||
<div class="filter-row">
|
||||
<span class="filter-label">筛选条件:</span>
|
||||
<el-select v-model="filterType" placeholder="用户角色" clearable style="width: 140px; margin-right: 12px;">
|
||||
<el-option v-for="role in roleList" :key="role.id" :label="role.description" :value="role.id" />
|
||||
<el-select v-model="filterType" placeholder="所属部门" clearable style="width: 140px; margin-right: 12px;">
|
||||
<el-option v-for="dept in deptList" :key="dept.id" :label="dept.description" :value="dept.id" />
|
||||
</el-select>
|
||||
<el-select v-model="filterStatus" placeholder="用户状态" clearable style="width: 140px;">
|
||||
<el-option label="启用" :value="1" />
|
||||
@@ -317,19 +305,14 @@ const canManage = computed(() => hasPermission('user', 'manage'))
|
||||
@row-dblclick="handleRowDblClick" row-class-name="clickable-row">
|
||||
<el-table-column prop="id" label="ID" width="80" />
|
||||
<el-table-column prop="username" label="用户名" width="120" />
|
||||
<el-table-column prop="real_name" label="真实姓名" width="120">
|
||||
<el-table-column prop="real_name" label="真实姓名" min-width="120">
|
||||
<template #default="{ row }">
|
||||
{{ row.real_name || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="role_name" label="角色" width="120">
|
||||
<el-table-column prop="dept_desc" label="部门" min-width="120">
|
||||
<template #default="{ row }">
|
||||
{{ row.role_description || row.role_name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="department" label="部门" width="120">
|
||||
<template #default="{ row }">
|
||||
{{ row.department || '-' }}
|
||||
{{ row.dept_desc || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_active" label="状态" width="100">
|
||||
@@ -381,19 +364,14 @@ const canManage = computed(() => hasPermission('user', 'manage'))
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关联员工">
|
||||
<el-select v-model="form.employee_id" placeholder="请选择关联员工" style="width: 100%;" filterable clearable
|
||||
@change="handleEmployeeChange">
|
||||
<el-select v-model="form.employee_id" placeholder="请选择关联员工" style="width: 100%;" filterable clearable>
|
||||
<el-option v-for="emp in employeeList" :key="emp.id" :label="`${emp.id} - ${emp.name}`" :value="emp.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="所属部门">
|
||||
<el-input v-model="form.department" placeholder="选择员工后自动填充" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="用户角色" required>
|
||||
<el-select v-model="form.role_id" placeholder="请选择角色" style="width: 100%;">
|
||||
<el-option v-for="role in roleList" :key="role.id" :label="role.description" :value="role.id" />
|
||||
<el-form-item label="所属部门" required>
|
||||
<el-select v-model="form.department_id" placeholder="请选择部门" style="width: 100%;">
|
||||
<el-option v-for="dept in deptList" :key="dept.id" :label="dept.description" :value="dept.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@@ -419,8 +397,7 @@ const canManage = computed(() => hasPermission('user', 'manage'))
|
||||
<el-descriptions-item label="用户ID">{{ currentDetail.id }}</el-descriptions-item>
|
||||
<el-descriptions-item label="用户名">{{ currentDetail.username }}</el-descriptions-item>
|
||||
<el-descriptions-item label="真实姓名">{{ currentDetail.real_name || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="角色">{{ currentDetail.role_description || currentDetail.role_name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="部门">{{ currentDetail.department || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="部门">{{ currentDetail.dept_desc || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="关联员工">{{ currentDetail.employee_id || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<el-tag :type="currentDetail.is_active === 1 ? 'success' : 'danger'">
|
||||
|
||||
Reference in New Issue
Block a user