|
|
@@ -60,7 +60,7 @@
|
|
|
<template #header>
|
|
|
<div class="hac-card-title g">
|
|
|
<div class="w-[180px]">
|
|
|
- <el-select v-model="stageYearVal" filterable clearable block placeholder="请先选择建设期时间" @change="stageYearClick">
|
|
|
+ <el-select v-model="stageYearVal" filterable clearable block placeholder="请选择" @change="stageYearClick">
|
|
|
<el-option v-for="item in stageYearOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
@@ -228,8 +228,8 @@
|
|
|
<template #header>
|
|
|
<div class="hac-card-title g">
|
|
|
<div class="w-[180px]">
|
|
|
- <el-select v-model="carYearVal" filterable clearable block placeholder="请先选择建设期时间" @change="carYearClick">
|
|
|
- <el-option v-for="item in stageYearOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ <el-select v-model="carYearVal" filterable clearable block placeholder="请先选择运营期时间" @change="carYearClick">
|
|
|
+ <el-option v-for="item in stageYearOptions1" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
<span class="ml-2">车流量信息</span>
|
|
|
@@ -274,7 +274,7 @@ import chengbenPng from '~src/assets/view/chengben.png'
|
|
|
import shuijinPng from '~src/assets/view/shuijin.png'
|
|
|
import totalPng from '~src/assets/view/total.png'
|
|
|
import { getDictionaryData } from '~src/utils/tools'
|
|
|
-import { arrIndex, getArrValue } from 'js-fast-way'
|
|
|
+import { arrIndex, formValidate, getArrValue } from 'js-fast-way'
|
|
|
import projectApi from '~api/promanage/project'
|
|
|
import { getDictionary } from '~api/dictbiz.js'
|
|
|
import HcInputNumber from './input-number.vue'
|
|
|
@@ -297,25 +297,14 @@ const isShow = defineModel('modelValue', {
|
|
|
default: false,
|
|
|
})
|
|
|
const stageYearOptions = ref([
|
|
|
-
|
|
|
+{
|
|
|
+ value: '1',
|
|
|
+ label: '建设期',
|
|
|
+ },
|
|
|
+])
|
|
|
+const stageYearOptions1 = ref([
|
|
|
+
|
|
|
])
|
|
|
-// 添加 watch 来监听 stageYearOptions 的变化
|
|
|
-watch(() => stageYearOptions.value, (newOptions) => {
|
|
|
- if (newOptions && newOptions.length > 0) {
|
|
|
- // 更新 yearFuns 的年份
|
|
|
- yearFuns.value = yearFuns.value.map(item => ({
|
|
|
- ...item,
|
|
|
- year: item.year || newOptions[0].value,
|
|
|
- }))
|
|
|
-
|
|
|
- // 更新 carList 的年份
|
|
|
- carList.value = carList.value.map(item => ({
|
|
|
- ...item,
|
|
|
- year: item.year || newOptions[0].value,
|
|
|
- }))
|
|
|
- }
|
|
|
-}, { immediate: true })
|
|
|
-
|
|
|
const yearFuns = ref([
|
|
|
{
|
|
|
|
|
|
@@ -337,9 +326,27 @@ const yearFuns = ref([
|
|
|
},
|
|
|
])
|
|
|
const carList = ref([{
|
|
|
- year: stageYearOptions.value?.[0]?.value || '', // 设置默认年份
|
|
|
+ year: stageYearOptions1.value?.[0]?.value || '', // 设置默认年份
|
|
|
numbers: Array(12).fill(''), // 初始化12个月份的数据,默认值为0
|
|
|
}])
|
|
|
+// 添加 watch 来监听 stageYearOptions 的变化
|
|
|
+watch(() => stageYearOptions.value, (newOptions) => {
|
|
|
+ if (newOptions && newOptions.length > 0) {
|
|
|
+ // 更新 yearFuns 的年份
|
|
|
+ yearFuns.value = yearFuns.value.map(item => ({
|
|
|
+ ...item,
|
|
|
+ year: item.year || newOptions[0].value,
|
|
|
+ }))
|
|
|
+
|
|
|
+ // 更新 carList 的年份
|
|
|
+ carList.value = carList.value.map(item => ({
|
|
|
+ ...item,
|
|
|
+ year: item.year || newOptions[0].value,
|
|
|
+ }))
|
|
|
+ }
|
|
|
+}, { immediate: true })
|
|
|
+
|
|
|
+
|
|
|
const betweenTime = ref(null)
|
|
|
const betweenTime1 = ref(null)
|
|
|
//监听
|
|
|
@@ -416,7 +423,35 @@ const betweenTimeUpdate = ({ arr, val, query }) => {
|
|
|
|
|
|
// 生成年份区间选项
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ } else {
|
|
|
+ baseForm.value.constructStartTime = null
|
|
|
+ baseForm.value.constructEndTime = null
|
|
|
+ stageYearOptions.value = [
|
|
|
+ {
|
|
|
+ value: '建设期',
|
|
|
+ label: '建设期',
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//日期时间被选择
|
|
|
+const betweenTimeUpdate1 = ({ arr, val, query }) => {
|
|
|
+
|
|
|
+
|
|
|
+ betweenTime1.value = arr
|
|
|
+ if (arr) {
|
|
|
+ // 开始时间
|
|
|
+ if (arr[0]) {
|
|
|
+ baseForm.value.operationStartTime = arr[0]
|
|
|
+ }
|
|
|
+ // 结束时间
|
|
|
+ if (arr[1]) {
|
|
|
+ baseForm.value.operationEndTime = arr[1]
|
|
|
+ }
|
|
|
+
|
|
|
if (arr[0] && arr[1]) {
|
|
|
const startYear = new Date(arr[0]).getFullYear()
|
|
|
|
|
|
@@ -429,12 +464,15 @@ const betweenTimeUpdate = ({ arr, val, query }) => {
|
|
|
label: `${year}年`,
|
|
|
})
|
|
|
}
|
|
|
- stageYearOptions.value = years
|
|
|
-
|
|
|
-
|
|
|
- carYearVal.value = years[0].value
|
|
|
+ // stageYearOptions.value = years
|
|
|
+ stageYearOptions.value = [{
|
|
|
+ value: '建设期',
|
|
|
+ label: '建设期',
|
|
|
+ }, ...years]
|
|
|
+ stageYearOptions1.value = years
|
|
|
+ carYearVal.value = stageYearOptions1.value[0].value
|
|
|
|
|
|
- stageYearVal.value = years[0].value
|
|
|
+ stageYearVal.value = stageYearOptions.value[0].value
|
|
|
|
|
|
|
|
|
// if (stageYearVal.value) {
|
|
|
@@ -445,28 +483,6 @@ const betweenTimeUpdate = ({ arr, val, query }) => {
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
- } else {
|
|
|
- baseForm.value.constructStartTime = null
|
|
|
- baseForm.value.constructEndTime = null
|
|
|
- stageYearOptions.value = []
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-//日期时间被选择
|
|
|
-const betweenTimeUpdate1 = ({ arr, val, query }) => {
|
|
|
-
|
|
|
-
|
|
|
- betweenTime1.value = arr
|
|
|
- if (arr) {
|
|
|
- // 开始时间
|
|
|
- if (arr[0]) {
|
|
|
- baseForm.value.operationStartTime = arr[0]
|
|
|
- }
|
|
|
- // 结束时间
|
|
|
- if (arr[1]) {
|
|
|
- baseForm.value.operationEndTime = arr[1]
|
|
|
- }
|
|
|
} else {
|
|
|
baseForm.value.constructStartTime = null
|
|
|
baseForm.value.constructEndTime = null
|
|
|
@@ -616,7 +632,8 @@ const formRules = {
|
|
|
//新增、编辑提交
|
|
|
const submitLoading = ref(false)
|
|
|
const dialogSubmit = async () => {
|
|
|
-
|
|
|
+ const formRes = await formValidate(formRef.value)
|
|
|
+ if (!formRes) return false
|
|
|
const params = {
|
|
|
...baseForm.value,
|
|
|
list: carList.value,
|