|
@@ -1,22 +1,22 @@
|
|
<template>
|
|
<template>
|
|
- <hc-card scrollbar is-action-btn class="create-project">
|
|
|
|
|
|
+ <hc-card class="create-project" is-action-btn scrollbar>
|
|
<template #header>
|
|
<template #header>
|
|
<div class="flex-1 text-center text-[24px] font-bold">项目信息填写</div>
|
|
<div class="flex-1 text-center text-[24px] font-bold">项目信息填写</div>
|
|
</template>
|
|
</template>
|
|
- <el-form ref="formRef" :model="baseForm" label-width="auto" :rules="baseFormRules" size="large" label-position="left">
|
|
|
|
|
|
+ <el-form ref="formRef" :model="baseForm" :rules="baseFormRules" label-position="left" label-width="auto" size="large">
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="项目名称:" prop="name">
|
|
<el-form-item label="项目名称:" prop="name">
|
|
- <el-input v-model="baseForm.name" placeholder="请输入" clearable />
|
|
|
|
|
|
+ <el-input v-model="baseForm.name" clearable placeholder="请输入" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
<el-form-item label="建设规模:" prop="buildScale">
|
|
<el-form-item label="建设规模:" prop="buildScale">
|
|
- <el-input v-model="baseForm.buildScale" placeholder="请输入" clearable>
|
|
|
|
|
|
+ <el-input v-model="baseForm.buildScale" clearable placeholder="请输入">
|
|
<template #append>
|
|
<template #append>
|
|
<el-select v-model="baseForm.buildScaleUnit" placeholder="单位" style="width: 80px">
|
|
<el-select v-model="baseForm.buildScaleUnit" placeholder="单位" style="width: 80px">
|
|
- <el-option label="公里" value="1" />
|
|
|
|
- <el-option label="无" value="2" />
|
|
|
|
|
|
+ <el-option label="公里" :value="1" />
|
|
|
|
+ <el-option label="无" :value="2" />
|
|
</el-select>
|
|
</el-select>
|
|
</template>
|
|
</template>
|
|
</el-input>
|
|
</el-input>
|
|
@@ -38,104 +38,95 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="总投资:" prop="allInvestMoney">
|
|
<el-form-item label="总投资:" prop="allInvestMoney">
|
|
- <el-input
|
|
|
|
- v-model="baseForm.allInvestMoney" placeholder="请输入" clearable
|
|
|
|
- :formatter="formatInput"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-input v-model="baseForm.allInvestMoney" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="十四五计划投资:" prop="fourteenFiveInvest">
|
|
<el-form-item label="十四五计划投资:" prop="fourteenFiveInvest">
|
|
- <el-input
|
|
|
|
- v-model="baseForm.fourteenFiveInvest" placeholder="请输入" clearable
|
|
|
|
- :formatter="formatInput"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-input v-model="baseForm.fourteenFiveInvest" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="开工年:" prop="startYear">
|
|
<el-form-item label="开工年:" prop="startYear">
|
|
- <el-date-picker ref="startYearRef" v-model="baseForm.startYear" class="block" type="year" placeholder="请选择" value-format="YYYY" @change="startYearChange" />
|
|
|
|
|
|
+ <el-date-picker ref="startYearRef" v-model="baseForm.startYear" class="block" placeholder="请选择" type="year" value-format="YYYY" @change="startYearChange" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="完工年:" prop="endYear">
|
|
<el-form-item label="完工年:" prop="endYear">
|
|
- <el-date-picker ref="endYearRef" v-model="baseForm.endYear" class="block" type="year" placeholder="请选择" value-format="YYYY" @change="endYearChange" @blur="endYearBlur" />
|
|
|
|
|
|
+ <el-date-picker ref="endYearRef" v-model="baseForm.endYear" class="block" placeholder="请选择" type="year" value-format="YYYY" @blur="endYearBlur" @change="endYearChange" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="市级重点项目:" prop="isFocusProject">
|
|
<el-form-item label="市级重点项目:" prop="isFocusProject">
|
|
<el-select v-model="baseForm.isFocusProject" placeholder="请选择">
|
|
<el-select v-model="baseForm.isFocusProject" placeholder="请选择">
|
|
- <el-option label="是" :value="1" />
|
|
|
|
- <el-option label="否" :value="0" />
|
|
|
|
|
|
+ <el-option :value="1" label="是" />
|
|
|
|
+ <el-option :value="0" label="否" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
<el-form-item label="交通强国建设试点任务:" prop="isPilotPlan">
|
|
<el-form-item label="交通强国建设试点任务:" prop="isPilotPlan">
|
|
<el-select v-model="baseForm.isPilotPlan" placeholder="请选择">
|
|
<el-select v-model="baseForm.isPilotPlan" placeholder="请选择">
|
|
- <el-option label="是" :value="1" />
|
|
|
|
- <el-option label="否" :value="0" />
|
|
|
|
|
|
+ <el-option :value="1" label="是" />
|
|
|
|
+ <el-option :value="0" label="否" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
<el-form-item label="牵头单位:" prop="leaderUnit">
|
|
<el-form-item label="牵头单位:" prop="leaderUnit">
|
|
- <el-input v-model="baseForm.leaderUnit" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="baseForm.leaderUnit" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
<el-form-item label="配合单位:" prop="assistUnit">
|
|
<el-form-item label="配合单位:" prop="assistUnit">
|
|
- <el-input v-model="baseForm.assistUnit" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="baseForm.assistUnit" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
<el-form-item label="责任单位:" prop="dutyUnit">
|
|
<el-form-item label="责任单位:" prop="dutyUnit">
|
|
- <el-input v-model="baseForm.dutyUnit" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="baseForm.dutyUnit" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</el-form>
|
|
</el-form>
|
|
<hc-card-item class="year-detail mt-3">
|
|
<hc-card-item class="year-detail mt-3">
|
|
<template #header>
|
|
<template #header>
|
|
- <el-select v-model="selectYear" placeholder="选择年份" class="select-year w-[100px]" @change="changeYear">
|
|
|
|
- <el-option v-for="(item, index) in yearOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
|
|
+ <el-select v-model="selectYear" class="select-year w-[100px]" placeholder="选择年份" @change="changeYear">
|
|
|
|
+ <el-option v-for="(item) in yearOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
</el-select>
|
|
</el-select>
|
|
</template>
|
|
</template>
|
|
- <el-form :model="yearOptions[selectIndex].yearForm" label-width="auto" class="mt-3" label-position="left" size="large" :disabled="!selectYear">
|
|
|
|
- <el-form-item label="全年计划投资:" prop="yearlyInvest" class="w-100">
|
|
|
|
- <el-input
|
|
|
|
- v-model="yearOptions[selectIndex].yearForm.yearlyInvest" placeholder="请输入" clearable :disabled="isChangeyearlyInvest"
|
|
|
|
- :formatter="formatInput"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-form :disabled="!selectYear" :model="yearOptions[selectIndex].yearForm" class="mt-3" label-position="left" label-width="auto" size="large">
|
|
|
|
+ <el-form-item class="w-100" label="全年计划投资:" prop="yearlyInvest">
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.yearlyInvest" :disabled="isChangeyearlyInvest" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="预计完成投资额:" prop="key1">
|
|
<el-form-item label="预计完成投资额:" prop="key1">
|
|
<div class="quarter-box w-full flex">
|
|
<div class="quarter-box w-full flex">
|
|
<div class="flex">
|
|
<div class="flex">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.oneInvest" placeholder="请输入" clearable :formatter="formatInput">
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.oneInvest" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #prepend>一季度</template>
|
|
<template #prepend>一季度</template>
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
<div class="ml-[40px] flex">
|
|
<div class="ml-[40px] flex">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.twoInvest" placeholder="请输入" clearable :formatter="formatInput">
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.twoInvest" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #prepend>二季度</template>
|
|
<template #prepend>二季度</template>
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
<div class="ml-[40px] flex">
|
|
<div class="ml-[40px] flex">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.threeInvest" placeholder="请输入" clearable :formatter="formatInput">
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.threeInvest" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #prepend>三季度</template>
|
|
<template #prepend>三季度</template>
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
<div class="ml-[40px] flex">
|
|
<div class="ml-[40px] flex">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.fourInvest" placeholder="请输入" clearable :formatter="formatInput">
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.fourInvest" :formatter="formatInput" clearable placeholder="请输入">
|
|
<template #prepend>四季度</template>
|
|
<template #prepend>四季度</template>
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
@@ -143,28 +134,28 @@
|
|
</div>
|
|
</div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="全年目标:" prop="yearlyTarget">
|
|
<el-form-item label="全年目标:" prop="yearlyTarget">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.yearlyTarget" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.yearlyTarget" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
- <el-form :model="yearOptions[selectIndex]?.yearForm" label-width="auto" class="mt-3" label-position="left" :disabled="!selectYear">
|
|
|
|
|
|
+ <el-form :disabled="!selectYear" :model="yearOptions[selectIndex]?.yearForm" class="mt-3" label-position="left" label-width="auto">
|
|
<div class="hc-form-item-title">各季度工作计划:</div>
|
|
<div class="hc-form-item-title">各季度工作计划:</div>
|
|
<el-form-item label="一季度:" prop="onePlan">
|
|
<el-form-item label="一季度:" prop="onePlan">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.onePlan" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.onePlan" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="二季度:" prop="twoPlan">
|
|
<el-form-item label="二季度:" prop="twoPlan">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.twoPlan" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.twoPlan" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="三季度:" prop="threePlan ">
|
|
<el-form-item label="三季度:" prop="threePlan ">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.threePlan" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.threePlan" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="四季度:" prop="fourPlan">
|
|
<el-form-item label="四季度:" prop="fourPlan">
|
|
- <el-input v-model="yearOptions[selectIndex].yearForm.fourPlan" placeholder="请输入" clearable type="textarea" />
|
|
|
|
|
|
+ <el-input v-model="yearOptions[selectIndex].yearForm.fourPlan" clearable placeholder="请输入" type="textarea" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</hc-card-item>
|
|
</hc-card-item>
|
|
<template #action>
|
|
<template #action>
|
|
<el-button type="info" @click="cancelClick">取消</el-button>
|
|
<el-button type="info" @click="cancelClick">取消</el-button>
|
|
- <el-button v-if="!formInfo.id" color="#20C98B" type="primary" class="text-white" @click="createClick">创建</el-button>
|
|
|
|
|
|
+ <el-button v-if="!formInfo.id" class="text-white" color="#20C98B" type="primary" @click="createClick">创建</el-button>
|
|
<el-button v-else type="warning" @click="saveClick">保存</el-button>
|
|
<el-button v-else type="warning" @click="saveClick">保存</el-button>
|
|
</template>
|
|
</template>
|
|
</hc-card>
|
|
</hc-card>
|
|
@@ -172,8 +163,7 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { onMounted, ref, watch } from 'vue'
|
|
import { onMounted, ref, watch } from 'vue'
|
|
-import { isNullES } from 'js-fast-way'
|
|
|
|
-import { arrIndex, formValidate, getArrValue, getObjValue } from 'js-fast-way'
|
|
|
|
|
|
+import { arrIndex, formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
import mainApi from '~api/project/project'
|
|
import mainApi from '~api/project/project'
|
|
import { getDictionaryData } from '~src/utils/tools'
|
|
import { getDictionaryData } from '~src/utils/tools'
|
|
import BigNumber from 'bignumber.js'
|
|
import BigNumber from 'bignumber.js'
|
|
@@ -192,15 +182,13 @@ const emit = defineEmits(['back'])
|
|
const formInfo = ref(props.form)
|
|
const formInfo = ref(props.form)
|
|
watch(() => props.form, (data) => {
|
|
watch(() => props.form, (data) => {
|
|
formInfo.value = data
|
|
formInfo.value = data
|
|
-
|
|
|
|
})
|
|
})
|
|
|
|
|
|
//渲染完成
|
|
//渲染完成
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
-
|
|
|
|
- await getProStation()
|
|
|
|
- await getProType()
|
|
|
|
- getDataApi()
|
|
|
|
|
|
+ await getProStation()
|
|
|
|
+ await getProType()
|
|
|
|
+ getDataApi()
|
|
})
|
|
})
|
|
const getDataApi = async () => {
|
|
const getDataApi = async () => {
|
|
const form = getObjValue(formInfo.value)
|
|
const form = getObjValue(formInfo.value)
|
|
@@ -208,10 +196,9 @@ const getDataApi = async () => {
|
|
getProDetail(form.id)
|
|
getProDetail(form.id)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-const getProDetail = async (id)=>{
|
|
|
|
|
|
+const getProDetail = async (id) => {
|
|
const { error, code, data } = await mainApi.detail(id)
|
|
const { error, code, data } = await mainApi.detail(id)
|
|
//处理数据
|
|
//处理数据
|
|
-
|
|
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
baseForm.value = getObjValue(data)
|
|
baseForm.value = getObjValue(data)
|
|
let list = getArrValue(baseForm.value?.list)
|
|
let list = getArrValue(baseForm.value?.list)
|
|
@@ -221,21 +208,19 @@ const getProDetail = async (id)=>{
|
|
baseForm.value.startYear = data.startYear.toString()
|
|
baseForm.value.startYear = data.startYear.toString()
|
|
baseForm.value.endYear = data.endYear.toString()
|
|
baseForm.value.endYear = data.endYear.toString()
|
|
yearOptions.value = []
|
|
yearOptions.value = []
|
|
- list.forEach((ele)=>{
|
|
|
|
|
|
+ list.forEach((ele) => {
|
|
yearOptions.value.push({
|
|
yearOptions.value.push({
|
|
- value:ele.planYear,
|
|
|
|
- label:ele.planYear,
|
|
|
|
- yearForm:ele,
|
|
|
|
|
|
+ value: ele.planYear,
|
|
|
|
+ label: ele.planYear,
|
|
|
|
+ yearForm: ele,
|
|
})
|
|
})
|
|
-
|
|
|
|
})
|
|
})
|
|
-
|
|
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
baseForm.value = {}
|
|
baseForm.value = {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-const baseForm = ref({ buildScaleUnit:'1' })
|
|
|
|
|
|
+
|
|
|
|
+const baseForm = ref({ buildScaleUnit: '1' })
|
|
const baseFormRules = {
|
|
const baseFormRules = {
|
|
name: {
|
|
name: {
|
|
required: true,
|
|
required: true,
|
|
@@ -261,15 +246,16 @@ const stateOptions = ref([])
|
|
|
|
|
|
const getProStation = async () => {
|
|
const getProStation = async () => {
|
|
stateOptions.value = await getDictionaryData('projectStage', true)
|
|
stateOptions.value = await getDictionaryData('projectStage', true)
|
|
-
|
|
|
|
}
|
|
}
|
|
//项目类型
|
|
//项目类型
|
|
const typeOptions = ref([])
|
|
const typeOptions = ref([])
|
|
const getProType = async () => {
|
|
const getProType = async () => {
|
|
typeOptions.value = await getDictionaryData('projectType', true)
|
|
typeOptions.value = await getDictionaryData('projectType', true)
|
|
- }
|
|
|
|
- const endYearRef = ref(null)
|
|
|
|
- const startYearRef = ref(null)
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const endYearRef = ref(null)
|
|
|
|
+const startYearRef = ref(null)
|
|
|
|
+
|
|
//开始年
|
|
//开始年
|
|
const startYearChange = (val) => {
|
|
const startYearChange = (val) => {
|
|
baseForm.value.startYear = val.toString()
|
|
baseForm.value.startYear = val.toString()
|
|
@@ -284,110 +270,108 @@ const endYearChange = (val) => {
|
|
baseForm.value.startYear = ''
|
|
baseForm.value.startYear = ''
|
|
}
|
|
}
|
|
baseForm.value.endYear = val.toString()
|
|
baseForm.value.endYear = val.toString()
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
//失去焦点
|
|
//失去焦点
|
|
const endYearBlur = () => {
|
|
const endYearBlur = () => {
|
|
if (isNullES(baseForm.value.startYear) || isNullES(baseForm.value.endYear)) {
|
|
if (isNullES(baseForm.value.startYear) || isNullES(baseForm.value.endYear)) {
|
|
baseForm.value.startYear = ''
|
|
baseForm.value.startYear = ''
|
|
baseForm.value.endYear = ''
|
|
baseForm.value.endYear = ''
|
|
window.$message.warning('请重新选择完整的范围年份')
|
|
window.$message.warning('请重新选择完整的范围年份')
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ let years = []
|
|
|
|
+ let startYear = baseForm.value.startYear
|
|
|
|
+ let endYear = baseForm.value.endYear
|
|
|
|
+ for (let year = startYear; year <= endYear; year++) {
|
|
|
|
+ years.push(
|
|
|
|
+ {
|
|
|
|
+ value: year,
|
|
|
|
+ label: year,
|
|
|
|
+ yearForm: {
|
|
|
|
+ planYear: year,
|
|
|
|
+ oneInvest: '',
|
|
|
|
+ twoInvest: '',
|
|
|
|
+ threeInvest: '',
|
|
|
|
+ fourInvest: '',
|
|
|
|
+ yearlyTarget: '',
|
|
|
|
+ onePlan: '',
|
|
|
|
+ twoPlan: '',
|
|
|
|
+ threePlan: '',
|
|
|
|
+ fourPlan: '',
|
|
|
|
|
|
- let years = []
|
|
|
|
- let startYear = baseForm.value.startYear
|
|
|
|
- let endYear = baseForm.value.endYear
|
|
|
|
- for (let year = startYear; year <= endYear; year++) {
|
|
|
|
- years.push(
|
|
|
|
- {
|
|
|
|
- value:year,
|
|
|
|
- label:year,
|
|
|
|
- yearForm:{
|
|
|
|
- planYear:year,
|
|
|
|
- oneInvest:'',
|
|
|
|
- twoInvest:'',
|
|
|
|
- threeInvest:'',
|
|
|
|
- fourInvest:'',
|
|
|
|
- yearlyTarget:'',
|
|
|
|
- onePlan:'',
|
|
|
|
- twoPlan:'',
|
|
|
|
- threePlan:'',
|
|
|
|
- fourPlan:'',
|
|
|
|
-
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- },
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- yearOptions.value = years
|
|
|
|
- selectYear.value = yearOptions.value[0].value
|
|
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ yearOptions.value = years
|
|
|
|
+ selectYear.value = yearOptions.value[0].value
|
|
}
|
|
}
|
|
//选择年份
|
|
//选择年份
|
|
const selectIndex = ref(0)
|
|
const selectIndex = ref(0)
|
|
const yearOptions = ref([{
|
|
const yearOptions = ref([{
|
|
- value:'',
|
|
|
|
- label:'',
|
|
|
|
- yearForm:{
|
|
|
|
- yearlyInvest:'',
|
|
|
|
- oneInvest:'',
|
|
|
|
- twoInvest:'',
|
|
|
|
- threeInvest:'',
|
|
|
|
- fourInvest:'',
|
|
|
|
- yearlyTarget:'',
|
|
|
|
- onePlan:'',
|
|
|
|
- twoPlan:'',
|
|
|
|
- threePlan:'',
|
|
|
|
- fourPlan:'',
|
|
|
|
- planYear:'',
|
|
|
|
- },
|
|
|
|
- }])
|
|
|
|
|
|
+ value: '',
|
|
|
|
+ label: '',
|
|
|
|
+ yearForm: {
|
|
|
|
+ yearlyInvest: '',
|
|
|
|
+ oneInvest: '',
|
|
|
|
+ twoInvest: '',
|
|
|
|
+ threeInvest: '',
|
|
|
|
+ fourInvest: '',
|
|
|
|
+ yearlyTarget: '',
|
|
|
|
+ onePlan: '',
|
|
|
|
+ twoPlan: '',
|
|
|
|
+ threePlan: '',
|
|
|
|
+ fourPlan: '',
|
|
|
|
+ planYear: '',
|
|
|
|
+ },
|
|
|
|
+}])
|
|
const selectYear = ref(null)
|
|
const selectYear = ref(null)
|
|
-const changeYear = (val)=>{
|
|
|
|
|
|
+const changeYear = (val) => {
|
|
selectIndex.value = arrIndex(yearOptions.value, 'value', val)
|
|
selectIndex.value = arrIndex(yearOptions.value, 'value', val)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-const formatInput = (value)=>{
|
|
|
|
- // 如果输入为空,则直接返回空字符串
|
|
|
|
- if (!value) {
|
|
|
|
|
|
+const formatInput = (value) => {
|
|
|
|
+ // 如果输入为空,则直接返回空字符串
|
|
|
|
+ if (!value) {
|
|
return ''
|
|
return ''
|
|
- }
|
|
|
|
- // 移除非数字和小数点
|
|
|
|
- value = value.replace(/[^\d.]/g, '')
|
|
|
|
- // 使用正则表达式匹配输入是否合法
|
|
|
|
- const regExp = /^\d+(\.\d{0,2})?$/
|
|
|
|
- if (regExp.test(value)) {
|
|
|
|
|
|
+ }
|
|
|
|
+ // 移除非数字和小数点
|
|
|
|
+ value = value.replace(/[^\d.]/g, '')
|
|
|
|
+ // 使用正则表达式匹配输入是否合法
|
|
|
|
+ const regExp = /^\d+(\.\d{0,2})?$/
|
|
|
|
+ if (regExp.test(value)) {
|
|
return value // 如果输入合法,则返回原始值
|
|
return value // 如果输入合法,则返回原始值
|
|
- } else {
|
|
|
|
|
|
+ } else {
|
|
// 如果输入不合法,则移除非法字符,并返回处理后的值
|
|
// 如果输入不合法,则移除非法字符,并返回处理后的值
|
|
return value.slice(0, -1)
|
|
return value.slice(0, -1)
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const isChangeyearlyInvest = ref(false)
|
|
const isChangeyearlyInvest = ref(false)
|
|
//监听
|
|
//监听
|
|
watch(() => [
|
|
watch(() => [
|
|
-yearOptions.value[selectIndex.value].yearForm.oneInvest,
|
|
|
|
-yearOptions.value[selectIndex.value].yearForm.twoInvest,
|
|
|
|
-yearOptions.value[selectIndex.value].yearForm.threeInvest,
|
|
|
|
-yearOptions.value[selectIndex.value].yearForm.fourInvest,
|
|
|
|
-], ([key2, key3, key4, key5]) => {
|
|
|
|
- if ( Number(key2) > 0 || Number(key3) > 0 || Number(key4) > 0 || Number(key5) > 0) {
|
|
|
|
- isChangeyearlyInvest.value = true
|
|
|
|
- } else {
|
|
|
|
- isChangeyearlyInvest.value = false
|
|
|
|
- }
|
|
|
|
- // yearOptions.value[selectIndex.value].yearForm.yearlyInvest = Number(key2) + Number(key3) + Number(key4) + Number(key5)
|
|
|
|
- yearOptions.value[selectIndex.value].yearForm.yearlyInvest = ( BigNumber( Number(key2)) .plus (BigNumber(Number(key3))) .plus (BigNumber( Number(key4))) .plus (BigNumber(Number(key5)))).toNumber()
|
|
|
|
- const totalYearlyInvest = yearOptions.value.reduce((accumulator, currentValue) => {
|
|
|
|
- // return accumulator + currentValue.yearForm.yearlyInvest
|
|
|
|
- return BigNumber(Number(accumulator)).plus(BigNumber(Number(currentValue.yearForm.yearlyInvest))).toNumber()
|
|
|
|
- }, 0)
|
|
|
|
- baseForm.value.allInvestMoney = totalYearlyInvest
|
|
|
|
-},
|
|
|
|
|
|
+ yearOptions.value[selectIndex.value].yearForm.oneInvest,
|
|
|
|
+ yearOptions.value[selectIndex.value].yearForm.twoInvest,
|
|
|
|
+ yearOptions.value[selectIndex.value].yearForm.threeInvest,
|
|
|
|
+ yearOptions.value[selectIndex.value].yearForm.fourInvest,
|
|
|
|
+ ], ([key2, key3, key4, key5]) => {
|
|
|
|
+ if (Number(key2) > 0 || Number(key3) > 0 || Number(key4) > 0 || Number(key5) > 0) {
|
|
|
|
+ isChangeyearlyInvest.value = true
|
|
|
|
+ } else {
|
|
|
|
+ isChangeyearlyInvest.value = false
|
|
|
|
+ }
|
|
|
|
+ // yearOptions.value[selectIndex.value].yearForm.yearlyInvest = Number(key2) + Number(key3) + Number(key4) + Number(key5)
|
|
|
|
+ yearOptions.value[selectIndex.value].yearForm.yearlyInvest = (BigNumber(Number(key2)).plus(BigNumber(Number(key3))).plus(BigNumber(Number(key4))).plus(BigNumber(Number(key5)))).toNumber()
|
|
|
|
+ const totalYearlyInvest = yearOptions.value.reduce((accumulator, currentValue) => {
|
|
|
|
+ // return accumulator + currentValue.yearForm.yearlyInvest
|
|
|
|
+ return BigNumber(Number(accumulator)).plus(BigNumber(Number(currentValue.yearForm.yearlyInvest))).toNumber()
|
|
|
|
+ }, 0)
|
|
|
|
+ baseForm.value.allInvestMoney = totalYearlyInvest
|
|
|
|
+ },
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
//取消
|
|
//取消
|
|
const cancelClick = () => {
|
|
const cancelClick = () => {
|
|
emit('back')
|
|
emit('back')
|
|
@@ -399,17 +383,17 @@ const creatLoading = ref(false)
|
|
const createClick = async () => {
|
|
const createClick = async () => {
|
|
const form = formInfo.value
|
|
const form = formInfo.value
|
|
let list = []
|
|
let list = []
|
|
- yearOptions.value.forEach((ele)=>{
|
|
|
|
|
|
+ yearOptions.value.forEach((ele) => {
|
|
let yearForm = ele.yearForm
|
|
let yearForm = ele.yearForm
|
|
list.push(yearForm)
|
|
list.push(yearForm)
|
|
})
|
|
})
|
|
const isValidate = await formValidate(formRef.value)
|
|
const isValidate = await formValidate(formRef.value)
|
|
if (!isValidate) return false
|
|
if (!isValidate) return false
|
|
creatLoading.value = true
|
|
creatLoading.value = true
|
|
- //发起请求
|
|
|
|
- const { error, code, msg } = await mainApi.add({
|
|
|
|
- ...baseForm.value,
|
|
|
|
- list,
|
|
|
|
|
|
+ //发起请求
|
|
|
|
+ const { error, code, msg } = await mainApi.add({
|
|
|
|
+ ...baseForm.value,
|
|
|
|
+ list,
|
|
})
|
|
})
|
|
//判断状态
|
|
//判断状态
|
|
creatLoading.value = false
|
|
creatLoading.value = false
|
|
@@ -420,44 +404,43 @@ const createClick = async () => {
|
|
baseForm.value = {}
|
|
baseForm.value = {}
|
|
yearOptions.value = [
|
|
yearOptions.value = [
|
|
{
|
|
{
|
|
- value:'',
|
|
|
|
- label:'',
|
|
|
|
- yearForm:{
|
|
|
|
- yearlyInvest:'',
|
|
|
|
- oneInvest:'',
|
|
|
|
- twoInvest:'',
|
|
|
|
- threeInvest:'',
|
|
|
|
- fourInvest:'',
|
|
|
|
- yearlyTarget:'',
|
|
|
|
- onePlan:'',
|
|
|
|
- twoPlan:'',
|
|
|
|
- threePlan:'',
|
|
|
|
- fourPlan:'',
|
|
|
|
- },
|
|
|
|
- }]
|
|
|
|
|
|
+ value: '',
|
|
|
|
+ label: '',
|
|
|
|
+ yearForm: {
|
|
|
|
+ yearlyInvest: '',
|
|
|
|
+ oneInvest: '',
|
|
|
|
+ twoInvest: '',
|
|
|
|
+ threeInvest: '',
|
|
|
|
+ fourInvest: '',
|
|
|
|
+ yearlyTarget: '',
|
|
|
|
+ onePlan: '',
|
|
|
|
+ twoPlan: '',
|
|
|
|
+ threePlan: '',
|
|
|
|
+ fourPlan: '',
|
|
|
|
+ },
|
|
|
|
+ }]
|
|
// cancelClick()
|
|
// cancelClick()
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
window.$message.error(msg ?? '操作失败')
|
|
window.$message.error(msg ?? '操作失败')
|
|
}
|
|
}
|
|
-
|
|
|
|
console.log('创建')
|
|
console.log('创建')
|
|
}
|
|
}
|
|
|
|
|
|
//保存
|
|
//保存
|
|
const saveClick = async () => {
|
|
const saveClick = async () => {
|
|
let list = []
|
|
let list = []
|
|
- yearOptions.value.forEach((ele)=>{
|
|
|
|
|
|
+ yearOptions.value.forEach((ele) => {
|
|
let yearForm = ele.yearForm
|
|
let yearForm = ele.yearForm
|
|
list.push(yearForm)
|
|
list.push(yearForm)
|
|
})
|
|
})
|
|
const isValidate = await formValidate(formRef.value)
|
|
const isValidate = await formValidate(formRef.value)
|
|
if (!isValidate) return false
|
|
if (!isValidate) return false
|
|
creatLoading.value = true
|
|
creatLoading.value = true
|
|
- //发起请求
|
|
|
|
- const { error, code, msg } = await mainApi.update({
|
|
|
|
- ...baseForm.value,
|
|
|
|
- list,
|
|
|
|
|
|
+ //发起请求
|
|
|
|
+ const { error, code, msg } = await mainApi.update({
|
|
|
|
+ ...baseForm.value,
|
|
|
|
+ list,
|
|
})
|
|
})
|
|
//判断状态
|
|
//判断状态
|
|
creatLoading.value = false
|
|
creatLoading.value = false
|
|
@@ -465,11 +448,9 @@ const saveClick = async () => {
|
|
window?.$message?.success(msg)
|
|
window?.$message?.success(msg)
|
|
const form = getObjValue(formInfo.value)
|
|
const form = getObjValue(formInfo.value)
|
|
getProDetail(form.id)
|
|
getProDetail(form.id)
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
window.$message.error(msg ?? '操作失败')
|
|
window.$message.error(msg ?? '操作失败')
|
|
}
|
|
}
|
|
-
|
|
|
|
console.log('创建')
|
|
console.log('创建')
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@@ -504,7 +485,7 @@ const saveClick = async () => {
|
|
}
|
|
}
|
|
.form-text {
|
|
.form-text {
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|
|
- color:var(--el-text-color-regular) ;
|
|
|
|
|
|
+ color: var(--el-text-color-regular);
|
|
font-size: var(--el-form-label-font-size);
|
|
font-size: var(--el-form-label-font-size);
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|