添加基础表维护
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in CONTRACT_SIGN_OPTIONS"
|
||||
v-for="item in contractSignOptions"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
@@ -41,6 +41,21 @@
|
||||
value-format="YYYY"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目状态" prop="projectStatus">
|
||||
<el-select
|
||||
v-model="queryParams.projectStatus"
|
||||
class="!w-180px"
|
||||
clearable
|
||||
placeholder="请选择项目状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in projectStatusOptions"
|
||||
:key="String(item.value)"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
@@ -82,39 +97,33 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentProjectChange"
|
||||
>
|
||||
<el-table-column align="center" label="项目 ID" prop="id" width="88" />
|
||||
<el-table-column align="center" label="项目ID" prop="id" width="88" />
|
||||
<el-table-column align="center" label="工程名称" min-width="220" prop="projectName" />
|
||||
<el-table-column align="center" label="项目经理" min-width="140" prop="projectManagerName" />
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程名称"
|
||||
min-width="220"
|
||||
prop="projectName"
|
||||
show-overflow-tooltip
|
||||
label="项目负责人"
|
||||
min-width="140"
|
||||
prop="engineeringPrincipalName"
|
||||
/>
|
||||
<el-table-column align="center" label="是否签约" width="100">
|
||||
<el-table-column align="center" label="开始年度" prop="projectStartYear" width="110" />
|
||||
<el-table-column align="center" label="项目状态" width="110">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.contractSignedFlag ? 'success' : 'info'">
|
||||
{{ scope.row.contractSignedFlag ? '已签订' : '未签订' }}
|
||||
<el-tag :type="projectStatusTagType(scope.row.projectStatus)">
|
||||
{{ getProjectStatusText(scope.row.projectStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="合同金额(元)" width="130">
|
||||
<el-table-column align="center" label="是否封档" width="90">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.contractAmount) }}
|
||||
{{ scope.row.archiveFlag ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="工程总面积(㎡)" width="140">
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" width="180">
|
||||
<template #default="scope">
|
||||
{{ formatAreaText(scope.row.totalConstructionArea) }}
|
||||
{{ formatDate(scope.row.createTime as any) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="项目开始年度" prop="projectStartYear" width="120" />
|
||||
<el-table-column
|
||||
:formatter="dateFormatter"
|
||||
align="center"
|
||||
label="创建时间"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
/>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@@ -149,36 +158,31 @@
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentProject.projectName }}</div>
|
||||
<div class="mt-4px text-13px text-[var(--el-text-color-secondary)]">
|
||||
建设单位:{{ currentProject.constructionUnitName || '-' }},
|
||||
项目经理:{{ currentProject.projectManagerName || '-' }},
|
||||
工程负责人:{{ currentProject.engineeringPrincipalName || '-' }}
|
||||
建设单位:{{ currentProject.constructionUnitName || '-' }},项目经理:{{
|
||||
currentProject.projectManagerName || '-'
|
||||
}},项目负责人:{{ currentProject.engineeringPrincipalName || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openPlanningForm('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增合约规划
|
||||
</el-button>
|
||||
<el-button @click="getPlanningList">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新规划
|
||||
</el-button>
|
||||
</div>
|
||||
<el-button
|
||||
v-hasPermi="['tjt:planning:create']"
|
||||
plain
|
||||
type="primary"
|
||||
@click="openPlanningForm('create')"
|
||||
>
|
||||
<Icon class="mr-5px" icon="ep:plus" />
|
||||
新增合约规划
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-descriptions :column="1" border title="项目概况">
|
||||
<el-descriptions-item label="工程名称">
|
||||
{{ currentProject.projectName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程名称">{{ currentProject.projectName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工程类型">
|
||||
{{ currentProject.projectType || '-' }}
|
||||
{{ getProjectTypeText(currentProject.projectType) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程类别">
|
||||
{{ getProjectCategoryText(currentProject.projectCategory) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同签订日期">
|
||||
{{ currentProject.contractSigningDate || '-' }}
|
||||
@@ -186,13 +190,31 @@
|
||||
<el-descriptions-item label="联系人">
|
||||
{{ currentProject.contactName || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系方式">
|
||||
<el-descriptions-item label="联系电话">
|
||||
{{ currentProject.contactPhone || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="项目状态">
|
||||
{{ getProjectStatusText(currentProject.projectStatus) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="封档时间">
|
||||
{{ currentProject.archiveTime ? formatDate(currentProject.archiveTime as any) : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="normalizeProjectStatus(currentProject.projectStatus) === pausedStatusValue"
|
||||
label="暂停原因"
|
||||
>
|
||||
{{ currentProject.pauseReason || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="normalizeProjectStatus(currentProject.projectStatus) === terminatedStatusValue"
|
||||
label="中止原因"
|
||||
>
|
||||
{{ currentProject.terminateReason || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="合同金额(元)">
|
||||
{{ formatAmountText(currentProject.contractAmount) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="工程总面积(㎡)">
|
||||
<el-descriptions-item label="工程总面积(m²)">
|
||||
{{ formatAreaText(currentProject.totalConstructionArea) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
@@ -203,18 +225,21 @@
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="规划内容"
|
||||
min-width="200"
|
||||
min-width="260"
|
||||
prop="planningContent"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="归属类型" prop="ownershipType" width="100" />
|
||||
<el-table-column align="center" label="计算方式" prop="calculationMethod" width="110" />
|
||||
<el-table-column align="center" label="归属类型" width="100">
|
||||
<template #default="scope">
|
||||
{{ getOwnershipTypeText(scope.row.ownershipType) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="规划金额(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.planningAmount) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="管理费费率" width="110">
|
||||
<el-table-column align="center" label="管理费率" width="110">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.managementFeeRate) }}
|
||||
</template>
|
||||
@@ -265,16 +290,21 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import * as PlanningApi from '@/api/tjt/planning'
|
||||
import ProjectForm from './ProjectForm.vue'
|
||||
import PlanningForm from './PlanningForm.vue'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
OWNERSHIP_TYPE_OPTIONS,
|
||||
PROJECT_CATEGORY_OPTIONS,
|
||||
PROJECT_STATUS_OPTIONS,
|
||||
PROJECT_TYPE_OPTIONS,
|
||||
formatAmountText,
|
||||
formatAreaText,
|
||||
formatPercentText
|
||||
formatPercentText,
|
||||
normalizeProjectStatus
|
||||
} from '@/views/tjt/shared/planning'
|
||||
|
||||
defineOptions({ name: 'TjtProject' })
|
||||
@@ -282,6 +312,48 @@ defineOptions({ name: 'TjtProject' })
|
||||
const message = useMessage()
|
||||
const { t } = useI18n()
|
||||
|
||||
const cleanOptionLabels = <T,>(options: Array<{ label: string; value: T }>, labels: string[]) =>
|
||||
options.map((item, index) => ({
|
||||
label: labels[index] || item.label,
|
||||
value: item.value
|
||||
}))
|
||||
|
||||
const contractSignOptions = cleanOptionLabels(CONTRACT_SIGN_OPTIONS, ['已签约', '未签约'])
|
||||
const ownershipTypeOptions = cleanOptionLabels(OWNERSHIP_TYPE_OPTIONS, ['专业所', '综合所', '专业分包'])
|
||||
const projectTypeOptions = cleanOptionLabels(PROJECT_TYPE_OPTIONS, [
|
||||
'建筑工程',
|
||||
'精装工程',
|
||||
'综合工程',
|
||||
'专项设计',
|
||||
'BIM设计',
|
||||
'其他'
|
||||
])
|
||||
const projectCategoryOptions = cleanOptionLabels(PROJECT_CATEGORY_OPTIONS, [
|
||||
'住宅',
|
||||
'公建',
|
||||
'工业',
|
||||
'园林景观',
|
||||
'其他'
|
||||
])
|
||||
const projectStatusOptions = cleanOptionLabels(PROJECT_STATUS_OPTIONS, [
|
||||
'进行中',
|
||||
'已完成',
|
||||
'已暂停',
|
||||
'已中止'
|
||||
])
|
||||
|
||||
const completedStatusValue = projectStatusOptions[1]?.value
|
||||
const pausedStatusValue = projectStatusOptions[2]?.value
|
||||
const terminatedStatusValue = projectStatusOptions[3]?.value
|
||||
|
||||
const getOptionLabel = <T,>(options: Array<{ label: string; value: T }>, value?: T) =>
|
||||
options.find((item) => item.value === value)?.label || '-'
|
||||
|
||||
const getOwnershipTypeText = (value?: string) => getOptionLabel(ownershipTypeOptions, value)
|
||||
const getProjectTypeText = (value?: string) => getOptionLabel(projectTypeOptions, value)
|
||||
const getProjectCategoryText = (value?: string) => getOptionLabel(projectCategoryOptions, value)
|
||||
const getProjectStatusText = (value?: string) => getOptionLabel(projectStatusOptions, value)
|
||||
|
||||
const loading = ref(false)
|
||||
const planningLoading = ref(false)
|
||||
const total = ref(0)
|
||||
@@ -297,6 +369,7 @@ const queryParams = reactive<ProjectApi.ProjectPageReqVO>({
|
||||
projectName: undefined,
|
||||
contractSignedFlag: undefined,
|
||||
projectStartYear: undefined,
|
||||
projectStatus: undefined,
|
||||
createTime: []
|
||||
})
|
||||
|
||||
@@ -307,6 +380,20 @@ const queryProjectStartYearValue = computed({
|
||||
}
|
||||
})
|
||||
|
||||
const projectStatusTagType = (status?: string) => {
|
||||
const normalizedStatus = normalizeProjectStatus(status)
|
||||
if (normalizedStatus === completedStatusValue) {
|
||||
return 'success'
|
||||
}
|
||||
if (normalizedStatus === pausedStatusValue) {
|
||||
return 'warning'
|
||||
}
|
||||
if (normalizedStatus === terminatedStatusValue) {
|
||||
return 'danger'
|
||||
}
|
||||
return 'primary'
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -356,7 +443,7 @@ const handleCurrentProjectChange = async (row?: ProjectApi.ProjectVO) => {
|
||||
}
|
||||
|
||||
const projectFormRef = ref()
|
||||
const openProjectForm = (type: string, id?: number) => {
|
||||
const openProjectForm = (type: 'create' | 'update', id?: number) => {
|
||||
projectFormRef.value.open(type, id)
|
||||
}
|
||||
|
||||
@@ -402,13 +489,11 @@ const handlePlanningFormSuccess = async () => {
|
||||
await getPlanningList()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
onActivated(async () => {
|
||||
await getList()
|
||||
await getPlanningList()
|
||||
onActivated(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user