Commit 6f1d956b by 李宁

1

1 parent 637c146e
......@@ -29,4 +29,15 @@ export function queryAreaData(data) {
url: '/crm/getArea?areaId='+data.areaId,
method: 'GET'
})
}
/**
* 获取可选角色列表
*/
export function queryRoleActive(data) {
return request({
url: '/crm/getUserRoleList',
method: 'GET',
data,
})
}
\ No newline at end of file
......@@ -141,7 +141,7 @@
class="flex flex-col font-['PingFang_SC:Regular',sans-serif] justify-center leading-[0] not-italic text-[#909399] text-[14px] text-nowrap tracking-[-0.01px] hover:text-brand-primary cursor-pointer transition-colors"
>
<p class="leading-[22px] whitespace-pre">
{{ activeView === 'orders' || activeView === 'order-detail' ? '业务管理' : '权限管理' }}
{{ activeView === 'orders' || activeView === 'order-detail' || activeView === 'business' ? '业务管理' : '系统管理' }}
</p>
</button>
......@@ -314,16 +314,11 @@ const props = defineProps<DesktopMainProps>()
const emit = defineEmits(['logout'])
// 响应式数据
const isSidebarCollapsed = ref(false)
const activeMenu = ref<string>('orders') // 当前激活的菜单
const activeView = ref<string>('orders') // 当前显示的视图
const selectedOrderId = ref<string | null>(null) // 当前查看的订单ID
const selectedOrder = ref<any>(null) // 当前查看的订单
const userInfo = ref(localStorage.getItem('pcUserInfo') ? JSON.parse(localStorage.getItem('pcUserInfo') as string) : {})
// 菜单配置
// const businessMenuItems = [
// { id: 'orders', label: '登记订单管理', icon: LayoutDashboard },
// { id: 'business', label: '业务酬金管理', icon: DollarSign }
// ]
const businessMenuItems = computed(() => {
let va = userInfo.value
if(va?.functions){
......@@ -344,10 +339,6 @@ const businessMenuItems = computed(() => {
}
return []
})
// const systemMenuItems = [
// { id: 'roles', label: '角色管理', icon: RoleIcon },
// { id: 'users', label: '账号管理', icon: Users }
// ]
const systemMenuItems = computed(() => {
let va = userInfo.value
if(va?.functions){
......@@ -368,6 +359,7 @@ const systemMenuItems = computed(() => {
}
return []
})
const menuMap: Record<string, string> = {
orders: '登记订单管理',
business: '业务酬金管理',
......@@ -617,6 +609,10 @@ const organizations = ref<Organization[]>([])
// 生命周期
onMounted(() => {
getArea()
setTimeout(()=>{
initData()
},0)
})
const getArea = async ()=>{
try {
......@@ -646,6 +642,19 @@ const getArea = async ()=>{
}
}
const initData = ()=>{
if(businessMenuItems.value.length > 0){
activeMenu.value = businessMenuItems.value[0].id
activeView.value = businessMenuItems.value[0].id
}else if(systemMenuItems.value.length > 0){
activeMenu.value = systemMenuItems.value[0].id
activeView.value = systemMenuItems.value[0].id
}
}
// 当前激活的菜单
const activeMenu = ref<string>('')
// 当前显示的视图
const activeView = ref<string>('')
// 当前登录用户ID
const currentUserId = ref('user-001')
......
......@@ -23,7 +23,7 @@
</el-button>
<!-- 待审核:关闭订单 + 驳回 + 通过 -->
<template v-if="order.auditStatus === '0'">
<template v-if="order.auditStatus==='0' && permissionJson.audit">
<el-dropdown @command="handleAuditCommand">
<el-button type="primary" class="bg-brand-primary">
审核订单
......@@ -164,7 +164,7 @@
placeholder="请输入CRM订单编号"
class="mt-2"
/>
<p v-else class="mt-2 text-neutral-700">{{ order.crmOrderId || '-' }}</p>
<p v-else class="mt-2 text-neutral-700">{{ order.crmOrderId || '--' }}</p>
</div>
<div>
......@@ -177,7 +177,7 @@
placeholder="请输入办理订单备注"
class="mt-2"
/>
<p v-else class="mt-2 text-neutral-700">{{ order.processRemark || '-' }}</p>
<p v-else class="mt-2 text-neutral-700">{{ order.crmOrderMemo || '--' }}</p>
</div>
<el-button
......@@ -193,7 +193,7 @@
</el-card>
<!-- 酬金信息区 -->
<el-card class="p-6">
<el-card class="p-6" v-if="permissionJson.updateOrder">
<h3 class="text-neutral-900 font-bold mb-4">酬金信息</h3>
<div class="space-y-5">
<!-- 预计酬金金额 -->
......@@ -362,6 +362,7 @@ interface Order {
remarks?: string
processRemark?: string
operationLogs?: OperationLog[]
crmOrderMemo?: string
}
interface BusinessRule {
......@@ -391,11 +392,40 @@ const emit = defineEmits<{
// 响应式数据
const crmOrderId = ref(props.order.crmOrderId || '')
const processRemark = ref(props.order.processRemark || '')
const processRemark = ref(props.order.crmOrderMemo || '')
const realMoney = ref(
props.order.realMoney !== undefined ? String(props.order.realMoney) : ''
)
const permissionJson = computed(() => {
const userInfo = ref(localStorage.getItem('pcUserInfo') ? JSON.parse(localStorage.getItem('pcUserInfo') as string) : {})
let va = userInfo.value
let audit = false
let updateOrder = false
if(va?.functions){
let arr = va.functions.filter((item: any) => {return item.id==1})
if(arr.length>0 && arr[0].children){
let arr2 = arr[0].children.filter((item: any) => {return item.id==2})
if(arr2.length>0 && arr2[0].children){
arr2[0].children.forEach((item: any) => {
if(item.id === 4){
updateOrder = true
}
if(item.id === 5){
audit = true
}
})
}
}
}
return {audit,updateOrder}
})
onMounted(()=>{
queryLog()
})
......@@ -461,6 +491,7 @@ const getstatusName = (status: status) => {
const getauditStatusClass = (status: auditStatus) => {
const statusMap = {
'-1': 'bg-blue-100 text-blue-800',
'0': 'bg-purple-100 text-purple-800',
'1': 'bg-green-100 text-green-800',
'2': 'bg-orange-100 text-orange-800'
......@@ -469,6 +500,7 @@ const getauditStatusClass = (status: auditStatus) => {
}
const getauditStatusName = (status: auditStatus) => {
const statusMap = {
'-1': '未提交审核',
'0': '待审核',
'1': '审核通过',
'2': '审核驳回'
......@@ -500,7 +532,7 @@ const handleSaveCrm = async ()=>{
}
}
const handleSaveReward = async () => {
if (realMoney.value && realMoney.value.trim()) {
if (realMoney.value && realMoney.value!='null' && realMoney.value.trim()) {
const amount = parseFloat(realMoney.value)
if (isNaN(amount) || amount < 0) {
ElMessage.error('请输入有效的实际发放酬金')
......@@ -511,7 +543,7 @@ const handleSaveReward = async () => {
const response = await $api.updateOrderMoney({
list: [{
id: props.order.id,
realMoney: realMoney.value
realMoney: realMoney.value=='null'?props.order.preMoney:realMoney.value
}]
})
......@@ -526,48 +558,6 @@ const handleSaveReward = async () => {
}
// 提交审核(办理成功/审核驳回 → 待审核)
const handleSubmitReview = () => {
if (!crmOrderId.value.trim()) {
ElMessage.error('请填写CRM订单编号')
return
}
let finalAmount = props.order.preMoney || 0
if (realMoney.value && realMoney.value.trim()) {
const amount = parseFloat(realMoney.value)
if (isNaN(amount) || amount < 0) {
ElMessage.error('请输入有效的实际发放酬金')
return
}
finalAmount = amount
}
const newLog = {
id: `LOG${Date.now()}`,
time: new Date().toLocaleString('zh-CN'),
operator: '管理员',
action: '提交审核',
details: `CRM订单编号:${crmOrderId.value},提交给主管理员审核,实际发放酬金:¥${finalAmount.toFixed(2)}`
}
emit('update', {
crmOrderId: crmOrderId.value,
processRemark: processRemark.value.trim(),
auditStatus: '0',
realMoney: finalAmount,
rejectReason: undefined,
operationLogs: [...(props.order.operationLogs || []), newLog]
})
ElMessage.success('已提交审核,等待主管理员审核')
setTimeout(() => {
emit('back')
}, 1000)
}
// 审核通过
const handleApprove = async () => {
try {
......
......@@ -8,7 +8,8 @@
<Download class="h-4 w-4 mr-1" />
导出数据
</el-button>
<el-button
<el-button
v-if="permissionJson.audit"
type="primary"
:disabled="selectedOrderIds.length === 0"
class="h-10 pr-4 pl-0"
......@@ -17,7 +18,8 @@
<Check class="h-4 w-4 mr-1" />
批量审核{{ selectedOrderIds.length > 0 ? ` (${selectedOrderIds.length})` : '' }}
</el-button>
<el-button
<el-button
v-if="permissionJson.updateOrder"
type="primary"
class="h-10 pr-4 pl-0"
@click="handleBatchModify"
......@@ -46,7 +48,7 @@
<Search class="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-neutral-500 z-10" />
<el-input
v-model="chinaPersonPhone"
placeholder="登记人手机号"
placeholder="人手机号"
class="search-input text-ellipsis-input"
clearable
/>
......@@ -76,13 +78,14 @@
<!-- 全部审核状态 -->
<el-select v-model="reviewStatusFilter" placeholder="全部审核状态" class="flex-1 bg-gray-100">
<el-option label="全部审核状态" value="" />
<el-option label="未提交审核" value="-1" />
<el-option label="待审核" value="0" />
<el-option label="审核通过" value="1" />
<el-option label="审核驳回" value="2" />
</el-select>
<!-- 全部业务 -->
<el-select v-model="businessNameFilter" placeholder="全部业务" class="flex-1 bg-gray-100">
<!-- <el-select v-model="businessNameFilter" placeholder="全部业务" class="flex-1 bg-gray-100">
<el-option label="全部业务" value="" />
<el-option
v-for="businessName in uniqueBusinessNames"
......@@ -90,7 +93,7 @@
:label="businessName.jobName"
:value="businessName.jobId"
/>
</el-select>
</el-select> -->
<!-- 查询和重置按钮 -->
<el-button type="primary" @click="handleSearch" class="h-10 px-4 shrink-0">
......@@ -186,16 +189,14 @@
</el-table-column>
<!-- 审核状态 -->
<el-table-column prop="auditStatus" label="审核状态" width="90" fixed="right">
<el-table-column prop="auditStatus" label="审核状态" width="120" fixed="right">
<template #default="{ row }">
<span
v-if="row.auditStatus"
<span
:class="getReviewStatusClass(row.auditStatus)"
class="px-2 py-1 rounded text-xs font-medium"
>
{{ getReviewStatusName(row.auditStatus) }}
</span>
<span v-else class="text-neutral-400">-</span>
</template>
</el-table-column>
......@@ -212,7 +213,7 @@
详情
</el-button>
<el-button
v-if="row.auditStatus === 0"
v-if="row.auditStatus===0 && permissionJson.audit"
type="primary"
link
size="small"
......@@ -664,6 +665,7 @@ const getBusinessStatusName = (status: BusinessStatus) => {
const getReviewStatusClass = (status: ReviewStatus) => {
const statusMap: Record<string, string> = {
'-1': 'bg-blue-100 text-blue-800',
'0': 'bg-purple-100 text-purple-800',
'1': 'bg-green-100 text-green-800',
'2': 'bg-orange-100 text-orange-800',
......@@ -675,6 +677,7 @@ const getReviewStatusClass = (status: ReviewStatus) => {
}
const getReviewStatusName = (status: ReviewStatus) => {
const statusMap: Record<string, string> = {
'-1': '未提交审核',
'0': '待审核',
'1': '审核通过',
'2': '审核驳回',
......@@ -685,6 +688,35 @@ const getReviewStatusName = (status: ReviewStatus) => {
return statusMap[status] || '--'
}
const permissionJson = computed(() => {
const userInfo = ref(localStorage.getItem('pcUserInfo') ? JSON.parse(localStorage.getItem('pcUserInfo') as string) : {})
let va = userInfo.value
let audit = false
let updateOrder = false
if(va?.functions){
let arr = va.functions.filter((item: any) => {return item.id==1})
if(arr.length>0 && arr[0].children){
let arr2 = arr[0].children.filter((item: any) => {return item.id==2})
if(arr2.length>0 && arr2[0].children){
arr2[0].children.forEach((item: any) => {
if(item.id === 4){
updateOrder = true
}
if(item.id === 5){
audit = true
}
})
}
}
}
return {audit,updateOrder}
})
// 判断行是否可选择(只有待审核的订单才能被选择)
const isRowSelectable = (row: any) => {
return row.auditStatus === 0
......
......@@ -398,7 +398,7 @@ onMounted(() => {
})
const getRoleList = async ()=>{
try {
const response = await $api.queryRoleList({})
const response = await $api.queryRoleActive({})
if (response && response.c === 0) {
availableRoles.value = response.d.filter((item: any) => {return item.status==1})
}
......
......@@ -5,6 +5,7 @@ import { createApp } from 'vue'
import { createPinia } from 'pinia'
// Element Plus
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
......@@ -29,7 +30,9 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(ElementPlus, {
locale: zhCn,
})
// 将 API 接口、请求实例、状态管理和工具方法挂载到全局
app.config.globalProperties.$api = api
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!