|
@@ -71,32 +71,35 @@
|
|
</template>
|
|
</template>
|
|
<el-form :model="yearForm" label-width="auto" :rules="yearFormRules" class="mt-3" label-position="left" size="large">
|
|
<el-form :model="yearForm" label-width="auto" :rules="yearFormRules" class="mt-3" label-position="left" size="large">
|
|
<el-form-item label="全年计划投资:" prop="key1" class="w-100">
|
|
<el-form-item label="全年计划投资:" prop="key1" class="w-100">
|
|
- <el-input v-model="yearForm.key1" placeholder="请输入" clearable>
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="yearForm.key1" placeholder="请输入" clearable
|
|
|
|
+ :formatter="formatInput"
|
|
|
|
+ >
|
|
<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="yearForm.key2" placeholder="请输入" clearable>
|
|
|
|
|
|
+ <el-input v-model="yearForm.key2" placeholder="请输入" clearable :formatter="formatInput">
|
|
<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="yearForm.key3" placeholder="请输入" clearable>
|
|
|
|
|
|
+ <el-input v-model="yearForm.key3" placeholder="请输入" clearable :formatter="formatInput">
|
|
<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="yearForm.key4" placeholder="请输入" clearable>
|
|
|
|
|
|
+ <el-input v-model="yearForm.key4" placeholder="请输入" clearable :formatter="formatInput">
|
|
<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="yearForm.key5" placeholder="请输入" clearable>
|
|
|
|
|
|
+ <el-input v-model="yearForm.key5" placeholder="请输入" clearable :formatter="formatInput">
|
|
<template #prepend>四季度</template>
|
|
<template #prepend>四季度</template>
|
|
<template #append>亿元</template>
|
|
<template #append>亿元</template>
|
|
</el-input>
|
|
</el-input>
|
|
@@ -132,7 +135,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { onMounted, ref, watch } from 'vue'
|
|
|
|
|
|
+import { computed, onMounted, ref, watch } from 'vue'
|
|
import { isNullES } from 'js-fast-way'
|
|
import { isNullES } from 'js-fast-way'
|
|
import { getDictionary } from '~api/dictbiz'
|
|
import { getDictionary } from '~api/dictbiz'
|
|
import { arrToKey, formValidate, getArrValue, getObjValue, isArrItem } from 'js-fast-way'
|
|
import { arrToKey, formValidate, getArrValue, getObjValue, isArrItem } from 'js-fast-way'
|
|
@@ -224,13 +227,7 @@ const endYearChange = (val) => {
|
|
baseForm.value.key5 = ''
|
|
baseForm.value.key5 = ''
|
|
}
|
|
}
|
|
baseForm.value.key6 = val
|
|
baseForm.value.key6 = val
|
|
- if (val <= baseForm.value.key5) {
|
|
|
|
- window.$message.warning('完工年要大于开工年')
|
|
|
|
- baseForm.value.key6 = ''
|
|
|
|
- endYearRef.value?.handleOpen()
|
|
|
|
- } else {
|
|
|
|
- endYearRef.value?.handleClose()
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
//失去焦点
|
|
//失去焦点
|
|
const endYearBlur = () => {
|
|
const endYearBlur = () => {
|
|
@@ -238,11 +235,7 @@ const endYearBlur = () => {
|
|
baseForm.value.key5 = ''
|
|
baseForm.value.key5 = ''
|
|
baseForm.value.key6 = ''
|
|
baseForm.value.key6 = ''
|
|
window.$message.warning('请重新选择完整的范围年份')
|
|
window.$message.warning('请重新选择完整的范围年份')
|
|
- } else if (baseForm.value.key6 <= baseForm.value.key5) {
|
|
|
|
- baseForm.value.key5 = ''
|
|
|
|
- baseForm.value.key6 = ''
|
|
|
|
- window.$message.warning('完工年要大于开工年')
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
let years = []
|
|
let years = []
|
|
let startYear = baseForm.value.key5
|
|
let startYear = baseForm.value.key5
|
|
@@ -261,8 +254,36 @@ const endYearBlur = () => {
|
|
const yearOptions = ref([])
|
|
const yearOptions = ref([])
|
|
const selectYear = ref('')
|
|
const selectYear = ref('')
|
|
|
|
|
|
-const yearForm = ref({ key1:'', key2: '', key3:'', key4:'', key5:'', key6:'', key7:'', key8:'', key9:'' })
|
|
|
|
|
|
+const yearForm = ref({ key1:'', key2: '', key3:'', key4:'', key5:'', key6:'', key7:'', key8:'', key9:'', key10:'' })
|
|
const yearFormRules = {}
|
|
const yearFormRules = {}
|
|
|
|
+const formatInput = (value)=>{
|
|
|
|
+ // 如果输入为空,则直接返回空字符串
|
|
|
|
+ if (!value) {
|
|
|
|
+ return ''
|
|
|
|
+ }
|
|
|
|
+ // 使用正则表达式匹配输入是否合法
|
|
|
|
+ const regExp = /^\d+(\.\d{0,2})?$/
|
|
|
|
+ if (regExp.test(value)) {
|
|
|
|
+ return value // 如果输入合法,则返回原始值
|
|
|
|
+ } else {
|
|
|
|
+ // 如果输入不合法,则移除非法字符,并返回处理后的值
|
|
|
|
+ return value.slice(0, -1)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+//监听
|
|
|
|
+watch(() => [
|
|
|
|
+yearForm.value.key2,
|
|
|
|
+yearForm.value.key3,
|
|
|
|
+yearForm.value.key4,
|
|
|
|
+yearForm.value.key5,
|
|
|
|
+], ([key2, key3, key4, key5]) => {
|
|
|
|
+ yearForm.value.key1 = Number(key2) + Number(key3) + Number(key4) + Number(key5)
|
|
|
|
+},
|
|
|
|
+{ immediate:true }),
|
|
|
|
+{ deep:true }
|
|
|
|
+
|
|
|
|
|
|
//取消
|
|
//取消
|
|
const cancelClick = () => {
|
|
const cancelClick = () => {
|