From 94530a85ede7a8ed14aad44506de74f7d622b498 Mon Sep 17 00:00:00 2001
From: wersd <1523826083@qq.com>
Date: Mon, 7 Jul 2025 23:39:32 +0800
Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E4=BB=98=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/crm/project/index.ts | 1 +
src/views/crm/contract/index.vue | 91 ++++++++-----
src/views/crm/project/ProjectForm.vue | 55 ++++++--
.../project/component/ProjectPartnetForm.vue | 38 ++----
src/views/crm/project/index.vue | 125 ++++++++++--------
src/views/crm/receivable/ReceivableForm.vue | 19 ++-
src/views/crm/receivable/plan/index.vue | 7 +-
src/views/crm/stationsite/index.vue | 15 ---
8 files changed, 195 insertions(+), 156 deletions(-)
diff --git a/src/api/crm/project/index.ts b/src/api/crm/project/index.ts
index bddc459b1..b2cbedfa6 100644
--- a/src/api/crm/project/index.ts
+++ b/src/api/crm/project/index.ts
@@ -21,6 +21,7 @@ export interface ProjectVO {
supplementaryMaterials: string // 其他补充材料文件路径
type: number // 类型
projectStatus: number // 状态
+ estimatedPiles: number //枪数
}
// 查询CRM 项目信息分页
diff --git a/src/views/crm/contract/index.vue b/src/views/crm/contract/index.vue
index c779def7e..4cc476ef3 100644
--- a/src/views/crm/contract/index.vue
+++ b/src/views/crm/contract/index.vue
@@ -11,15 +11,6 @@
class="-mb-15px"
label-width="68px"
>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -205,7 +228,7 @@ import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ContractApi from '@/api/crm/contract'
import ContractForm from './ContractForm.vue'
-import { DICT_TYPE } from '@/utils/dict'
+import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils'
import * as CustomerApi from '@/api/crm/customer'
import { TabsPaneContext } from 'element-plus'
@@ -224,7 +247,9 @@ const queryParams = reactive({
name: null,
customerId: null,
orderDate: [],
- no: null
+ no: null,
+ contractType: null,
+ contractStatus: null,
})
const queryFormRef = ref() // 搜索的表单
const exportLoading = ref(false) // 导出的加载中
@@ -342,12 +367,12 @@ const tableRowClassName = ({ row }: { row: any }) => {
return '';
}
// 计算剩余天数
- const diffTime = today.getTime() - endTime.getTime();
+ const diffTime = endTime.getTime() - today.getTime();
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
- console.log('diffDays', diffDays, endTime);
- if (diffDays <= 90) { // 少于3个月
+ console.log('diffDays', diffDays, today, endTime);
+ if (diffDays <= 90 && (row.contractStatus === 1 || row.contractStatus === 2)) { // 少于3个月
return 'expiring-soon-row';
- } else if (diffDays <= 180) { // 少于6个月
+ } else if (diffDays <= 180 && (row.contractStatus === 1 || row.contractStatus === 2)) { // 少于6个月
return 'expiring-row';
}
return '';
diff --git a/src/views/crm/project/ProjectForm.vue b/src/views/crm/project/ProjectForm.vue
index 5cdfaf25b..3ef1ee70a 100644
--- a/src/views/crm/project/ProjectForm.vue
+++ b/src/views/crm/project/ProjectForm.vue
@@ -58,7 +58,9 @@
-
+
关闭
开启
@@ -145,10 +147,10 @@
@@ -157,36 +159,66 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -218,7 +250,6 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('') // 表单的类型:create - 新增;update - 修改
-const partners = ref([]) // 合伙人列表
const formData = ref({
id: undefined,
@@ -237,6 +268,7 @@ const formData = ref({
powerSupplyReply: '',
investmentAgreement: '',
supplementaryMaterials: [],
+ partners:[],
type: undefined,
projectStatus: undefined
})
@@ -287,7 +319,7 @@ const open = async (type: string, id?: number) => {
}
}
// 加载部门列表
- deptList.value = await DeptApi.getSimpleDeptList()
+ deptList.value = await DeptApi.querySimpleDeptList(3)
// 获得合同列表
contractOptions.value = await ContractApi.getContractSimpleAllList()
// 获得场地列表
@@ -343,6 +375,7 @@ const resetForm = () => {
powerSupplyReply: '',
investmentAgreement: '',
supplementaryMaterials: [],
+ partners:[],
type: undefined,
projectStatus: undefined
}
diff --git a/src/views/crm/project/component/ProjectPartnetForm.vue b/src/views/crm/project/component/ProjectPartnetForm.vue
index f6b366f75..c9b431176 100644
--- a/src/views/crm/project/component/ProjectPartnetForm.vue
+++ b/src/views/crm/project/component/ProjectPartnetForm.vue
@@ -76,13 +76,7 @@ const emit = defineEmits(['update:partners'])
const formLoading = ref(false)
const userOptions = ref([])
-interface PartnerRow {
- partner?: string
- ratio?: string | number
- investment?: string | number
-}
-
-const formData = ref([])
+const formData = ref([])
const formRules = reactive({
partner: [
@@ -109,19 +103,15 @@ onMounted(async () => {
userOptions.value = await UserApi.getSimpleUserList()
})
-watch(
- () => props.partners,
- (val) => {
- formData.value = (val || []).map(item => ({
- ...item,
- partner: item.partner ? String(item.partner) : ''
- }))
- },
- { immediate: true }
-)
const handleAdd = () => {
- formData.value.push({ partner: '', ratio: '', investment: '' })
+ formData.value.push()
+ const row = {
+ partner: '',
+ ratio: '',
+ investment: ''
+ }
+ formData.value.push(row)
}
const handleDelete = (index: number) => {
@@ -139,7 +129,7 @@ const validate = async () => {
}
return true
}
-const calcInvestment = (row: PartnerRow) => {
+const calcInvestment = (row) => {
const ratio = Number(row.ratio) || 0
const price = Number(props.price) || 0
return ratio && price ? ((ratio * price) / 100).toFixed(2) : ''
@@ -149,16 +139,6 @@ const getMaxRatio = (index: number) => {
const used = formData.value.reduce((sum, item, idx) => idx !== index ? sum + (Number(item.ratio) || 0) : sum, 0)
return Math.max(0, 100 - used)
}
-watch(
- () => formData.value.map(item => item.ratio),
- () => {
- formData.value.forEach(row => {
- row.investment = calcInvestment(row)
- })
- },
- { deep: true }
-)
-
watch(
() => formData.value,
(val) => {
diff --git a/src/views/crm/project/index.vue b/src/views/crm/project/index.vue
index c5e057710..dbf3aafc9 100644
--- a/src/views/crm/project/index.vue
+++ b/src/views/crm/project/index.vue
@@ -8,25 +8,22 @@
:inline="true"
label-width="68px"
>
-
-
+
-
-
-
+ >
+
+
-
+
-
+
+
-
-
-
-
-
-
-
-
搜索
重置
@@ -93,21 +75,27 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ calculateCostPerPile(row) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
([])
/** 查询列表 */
const getList = async () => {
@@ -181,6 +173,11 @@ const getList = async () => {
}
}
+/** 打开场地详情 */
+const { push } = useRouter()
+const openSiteDetail = (id: number) => {
+ push({ name: 'CrmStationSiteDetail', params: { id } })
+}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
@@ -227,8 +224,26 @@ const handleExport = async () => {
}
}
+const calculateCostPerPile = (row) => {
+ // 检查枪数是否有效(非空、非零、数字类型)
+ if (!row.estimatedPiles || isNaN(row.estimatedPiles) || row.estimatedPiles <= 0) {
+ return ''; // 无效值返回空字符串
+ }
+
+ // 检查总投资额是否有效
+ if (!row.totalInvestment || isNaN(row.totalInvestment)) {
+ return ''; // 无效值返回空字符串
+ }
+
+ // 计算并保留两位小数
+ const cost = (row.totalInvestment / row.estimatedPiles).toFixed(2);
+ return parseFloat(cost); // 转为数字类型避免显示多余的0
+};
+
/** 初始化 **/
-onMounted(() => {
- getList()
+onMounted(async () => {
+ await getList()
+ // 加载部门列表
+ deptList.value = await DeptApi.querySimpleDeptList(3)
})
\ No newline at end of file
diff --git a/src/views/crm/receivable/ReceivableForm.vue b/src/views/crm/receivable/ReceivableForm.vue
index cd6de1fc3..113735b63 100644
--- a/src/views/crm/receivable/ReceivableForm.vue
+++ b/src/views/crm/receivable/ReceivableForm.vue
@@ -44,7 +44,7 @@
+
+
+
+
+
+
@@ -132,8 +138,6 @@
-
-
-
-
-
-
-
diff --git a/src/views/crm/receivable/plan/index.vue b/src/views/crm/receivable/plan/index.vue
index 4ff24c035..e29aac322 100644
--- a/src/views/crm/receivable/plan/index.vue
+++ b/src/views/crm/receivable/plan/index.vue
@@ -157,16 +157,17 @@
-
+
+
(null)
-const TENCENT_MAP_KEY = import.meta.env.VITE_APP_TENCENT_MAP_KEY // 你的腾讯地图key
/** 打开场地信息详情 */
const { currentRoute, push } = useRouter()
@@ -259,19 +257,6 @@ const handleExport = async () => {
}
}
-/** 地图弹窗相关操作 */
-const openMapDialog = (row: any) => {
- currentRow.value = row
- // 拼接带初始点的 url
-
- let url = `https://apis.map.qq.com/tools/locpicker?type=1&key=${TENCENT_MAP_KEY}&referer=myapp`
- if (row.locationLat && row.locationLng) {
- url += `&coord=${row.locationLat},${row.locationLng}`
- }
- tencentLbsUrl.value = url
- mapDialogVisible.value = true
-}
-
watch(mapDialogVisible, (val) => {
if (!val) {
tencentLbsUrl.value = '' // 关闭时重置,避免缓存