Browse Source

下拉框数据

duy 1 year ago
parent
commit
0630c9490f
1 changed files with 30 additions and 7 deletions
  1. 30 7
      src/views/project/admin/list.vue

+ 30 - 7
src/views/project/admin/list.vue

@@ -16,12 +16,12 @@
         <template #extraToHeader>
         <template #extraToHeader>
             <div class="w-[120px]">
             <div class="w-[120px]">
                 <el-select v-model="searchForm.key1" filterable clearable block placeholder="项目阶段" @change="searchClick">
                 <el-select v-model="searchForm.key1" filterable clearable block placeholder="项目阶段" @change="searchClick">
-                    <el-option v-for="item in stateOptions" :key="item.value" :label="item.label" :value="item.value" />
+                    <el-option v-for="item in stateOptions" :key="item.id" :label="item.dictValue" :value="item.id" />
                 </el-select>
                 </el-select>
             </div>
             </div>
             <div class="ml-2 w-[100px]">
             <div class="ml-2 w-[100px]">
                 <el-select v-model="searchForm.key2" filterable clearable block placeholder="项目类型" @change="searchClick">
                 <el-select v-model="searchForm.key2" filterable clearable block placeholder="项目类型" @change="searchClick">
-                    <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value" />
+                    <el-option v-for="item in typeOptions" :key="item.id" :label="item.dictValue" :value="item.id" />
                 </el-select>
                 </el-select>
             </div>
             </div>
         </template>
         </template>
@@ -86,20 +86,43 @@
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-import { ref } from 'vue'
+import { onMounted, ref } from 'vue'
 import HcTableList from '../modules/project-list.vue'
 import HcTableList from '../modules/project-list.vue'
+import { getDictionary } from '~api/dictbiz'
+import { getArrValue } from 'js-fast-way'
 
 
 //事件
 //事件
 const emit = defineEmits(['edit'])
 const emit = defineEmits(['edit'])
+//渲染完成
+onMounted(() => {
 
 
+    getProStation()
+    getProType()
+})
 const tableRef = ref(null)
 const tableRef = ref(null)
 
 
 //项目阶段
 //项目阶段
-const stateOptions = ref([{ value: '1', label: '新开工项目' }, { value: '2', label: '建成项目' }, { value: '3', label: '在建项目' }])
-
+const stateOptions = ref([])
+const getProStation = async () => {
+    const { error, code, data } = await getDictionary({ code:'projectStage' })
+        if (!error && code === 200) {
+            stateOptions.value = getArrValue(data) 
+        } else {
+            stateOptions.value = []
+        }   
+    
+}
 //项目类型
 //项目类型
-const typeOptions = ref([{ value: '1', label: '铁路' }, { value: '2', label: '高速公路' }, { value: '3', label: '在建项目' }])
-
+const typeOptions = ref([])
+const getProType = async () => {
+    const { error, code, data } = await getDictionary({ code:'projectType' })
+        if (!error && code === 200) {
+            typeOptions.value = getArrValue(data)
+        } else {
+            typeOptions.value = []
+        }   
+    
+    }
 //搜索条件
 //搜索条件
 const searchForm = ref({
 const searchForm = ref({
     startYear: '', endYear: '', queryValue: '', year: '',
     startYear: '', endYear: '', queryValue: '', year: '',