From f6ebafccb923d70005e8f485c2c1a080f219fe0d Mon Sep 17 00:00:00 2001 From: ChoChoX Date: Fri, 26 Jun 2026 01:25:15 +0800 Subject: [PATCH] fix bug --- package.json | 1 + src/api/customer.js | 5 + src/api/suppliers.js | 5 + src/components/contract.vue | 41 +++-- src/components/customer.vue | 13 +- src/components/employee.vue | 38 ++-- src/components/panel.vue | 2 +- src/components/products.vue | 3 +- src/components/service.vue | 25 ++- src/components/supplier.vue | 3 +- src/components/user.vue | 69 +++---- yarn.lock | 351 +++++++++++++++++++++++++++++++++++- 12 files changed, 453 insertions(+), 103 deletions(-) diff --git a/package.json b/package.json index c9a210d..9187401 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.2", + "axios": "^1.18.1", "element-china-area-data": "^5.0.2", "element-plus": "^2.14.1", "vue": "^3.5.34", diff --git a/src/api/customer.js b/src/api/customer.js index 179811f..88523eb 100644 --- a/src/api/customer.js +++ b/src/api/customer.js @@ -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 }) diff --git a/src/api/suppliers.js b/src/api/suppliers.js index 86c92fc..34fd18d 100644 --- a/src/api/suppliers.js +++ b/src/api/suppliers.js @@ -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 }) diff --git a/src/components/contract.vue b/src/components/contract.vue index 3745011..228dbb6 100644 --- a/src/components/contract.vue +++ b/src/components/contract.vue @@ -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) }} - +