浏览代码

获取下拉框数据接口

duy 7 月之前
父节点
当前提交
7c8cea880f
共有 1 个文件被更改,包括 28 次插入4 次删除
  1. 28 4
      src/views/home/datav.vue

+ 28 - 4
src/views/home/datav.vue

@@ -19,7 +19,7 @@
                             <HcDatavSelect v-model="searchForm.lag" :datas="lagArr" />
                             <HcDatavSelect v-if="searchForm.lag === '3'" v-model="searchForm.level" :datas="levelArr" placeholder="滞后等级" />
                         </template>
-                        <HcDatavSelect v-model="searchForm.stage" :datas="stageArr" placeholder="项目阶段" />
+                        <HcDatavSelect v-model="searchForm.projectStage" :datas="stageArr" placeholder="项目阶段" />
                         <HcDatavSelect v-if="pageType === '1'" v-model="searchForm.type" :datas="typeArr" placeholder="项目类型" />
                         <HcDatavSelect v-else v-model="searchForm.quarter" :datas="quarterArr" placeholder="选择季度" />
                     </div>
@@ -312,6 +312,7 @@ import HcDatavCard from './modules/card.vue'
 import HcDatavTable from './modules/table.vue'
 import HcDatavCharts from './modules/charts.vue'
 import { isNullES } from 'js-fast-way'
+import { getDictionaryData } from '~src/utils/tools'
 
 const store = useAppStore()
 
@@ -339,6 +340,8 @@ onMounted(() => {
         newMonthArr.push({ id: i + 1, name: `${i + 1}月` })
     }
     monthArr.value = newMonthArr
+    getProType()
+    getProStation()
 })
 
 //关闭引导提示
@@ -349,16 +352,37 @@ const tourFinishClose = () => {
 
 //搜索表单
 const pageType = ref('1')
-const searchForm = ref({ year: '2024', month: 0, level: '0', stage: '1', type: '1' })
+const searchForm = ref({ year: '2024', month: 0, level: '0', projectStage: null, projectType: null })
 const yearArr = [{ id: '2024', name: '2024年' }, { id: '2023', name: '2023年' }, { id: '2022', name: '2022年' }]
 const pageTypeArr = [{ id: '1', name: '项目数据看板' }, { id: '2', name: '工作要点' }]
 const monthArr = ref([])
 const lagArr = [{ id: '1', name: '超进度项目' }, { id: '2', name: '常规项目' }, { id: '3', name: '滞后项目' }, { id: '0', name: '所有' }]
 const levelArr = [{ id: '1', name: '一级' }, { id: '2', name: '二级' }, { id: '3', name: '三级' }, { id: '0', name: '所有' }]
-const stageArr = [{ id: '1', name: '项目阶段' }, { id: '2', name: '在建项目' }, { id: '3', name: '新开工项目' }, { id: '4', name: '建成项目' }]
-const typeArr = [{ id: '1', name: '公路' }, { id: '2', name: '水利' }, { id: '3', name: '房建' }, { id: '4', name: '铁路' }]
+const stageArr = ref([])
+const typeArr = ref([])
 const quarterArr = [{ id: '1', name: '一季度' }, { id: '2', name: '二季度' }, { id: '3', name: '三季度' }, { id: '4', name: '四季度' }]
 
+const getProType = async () => {
+    let data = await getDictionaryData('projectType', true)
+    data.forEach((ele)=>{
+        typeArr.value.push({
+            id:ele.value,
+            name:ele.label,
+        })
+    })
+ }
+const getProStation = async () => {
+    let data = await getDictionaryData('projectStage', true)
+    data.forEach((ele)=>{
+        stageArr.value.push({
+            id:ele.value,
+            name:ele.label,
+        })
+    })
+
+}
+//项目
+//搜索条
 //页面类型改变
 const pageTypeChange = () => {