Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

ZaiZai 1 an în urmă
părinte
comite
1c9c2378b5

+ 8 - 0
src/api/modules/project/project.js

@@ -1,6 +1,14 @@
 import { HcApi } from '../../request/index'
 
 export default {
+       //分页
+    async page(form) {
+        return HcApi({
+            url: '/api//blade-attach/project/page',
+            method: 'post',
+            data: form,
+        }, false)
+    },
    
     //新增
     async add(form) {

+ 2 - 2
src/views/project/admin/create.vue

@@ -174,8 +174,8 @@
 import { computed, onMounted, ref, watch } from 'vue'
 import { isNullES } from 'js-fast-way'
 import { getDictionary } from '~api/dictbiz'
-   import { arrIndex, formValidate, getArrValue, getObjValue, isArrItem } from 'js-fast-way'
-   import mainApi from '~api/project/project'
+import { arrIndex, formValidate, getArrValue, getObjValue, isArrItem } from 'js-fast-way'
+import mainApi from '~api/project/project'
 
 const props = defineProps({
     form: {

+ 33 - 12
src/views/project/admin/list.vue

@@ -3,7 +3,7 @@
         <template #headerToSearch>
             <hc-date-year v-model="searchForm.startYear" v-model:end="searchForm.endYear" />
             <div class="relative ml-3 w-[300px]">
-                <hc-search-input v-model="searchForm.queryValue" text="搜索" color="#151921" @search="searchClick">
+                <hc-search-input v-model="searchForm.searchValue" text="搜索" color="#151921" @search="searchClick">
                     <!-- <template #prepend>
                         <el-select v-model="searchForm.year" placeholder="年份" clearable style="width: 80px">
                             <el-option label="2023" value="2023" />
@@ -15,13 +15,13 @@
         </template>
         <template #extraToHeader>
             <div class="w-[120px]">
-                <el-select v-model="searchForm.key1" filterable clearable block placeholder="项目阶段" @change="searchClick">
-                    <el-option v-for="item in stateOptions" :key="item.id" :label="item.dictValue" :value="item.id" />
+                <el-select v-model="searchForm.projectStage" filterable clearable block placeholder="项目阶段" @change="searchClick">
+                    <el-option v-for="item in stateOptions" :key="item.id" :label="item.dictValue" :value="item.dictKey" />
                 </el-select>
             </div>
             <div class="ml-2 w-[100px]">
-                <el-select v-model="searchForm.key2" filterable clearable block placeholder="项目类型" @change="searchClick">
-                    <el-option v-for="item in typeOptions" :key="item.id" :label="item.dictValue" :value="item.id" />
+                <el-select v-model="searchForm.projectType" filterable clearable block placeholder="项目类型" @change="searchClick">
+                    <el-option v-for="item in typeOptions" :key="item.id" :label="item.dictValue" :value="item.dictKey" />
                 </el-select>
             </div>
         </template>
@@ -31,7 +31,7 @@
             <el-button type="warning" class="ml-2" @click="importClick">导入</el-button>
             <el-button v-yes-com:[deriveTableItem] type="primary" class="ml-2" :disabled="tableCheckKeys.length <= 0">批量导出</el-button>
         </template>
-        <HcTableList ref="tableRef" is-admin @tap="rowNameClick" @check="tableCheck" />
+        <HcTableList ref="tableRef" is-admin :datas="tableData" @tap="rowNameClick" @check="tableCheck" />
         <template #action>
             <div>建设规模:共计 xx 公里</div>
             <hc-pages :pages="searchForm" @change="pageChange" />
@@ -90,17 +90,36 @@ import { onMounted, ref } from 'vue'
 import HcTableList from '../modules/project-list.vue'
 import { getDictionary } from '~api/dictbiz'
 import { getArrValue } from 'js-fast-way'
+import mainApi from '~api/project/project'
 
 //事件
 const emit = defineEmits(['edit'])
 //渲染完成
-onMounted(() => {
+onMounted(async () => {
+
+  await getProStation()
+   await getProType()
+   getTableData()
 
-    getProStation()
-    getProType()
 })
 const tableRef = ref(null)
-
+//表格数据
+const tableData = ref([])
+const tableLoading = ref(false)
+const getTableData = async () => {
+    tableData.value = []
+    tableLoading.value = true
+    const { error, code, data } = await mainApi.page(searchForm.value)
+    //处理数据
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data.total || 0
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
+}
 //项目阶段
 const stateOptions = ref([])
 const getProStation = async () => {
@@ -125,17 +144,19 @@ const getProType = async () => {
     }
 //搜索条件
 const searchForm = ref({
-    startYear: '', endYear: '', queryValue: '', year: '',
+    startYear: '', endYear: '', searchValue: '', year: '', projectStage:'', projectType:'',
     current: 1, size: 20, total: 0,
 })
 const searchClick = () => {
-
+    searchForm.value.current = 1
+    getTableData()
 }
 
 //分页
 const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
+    getTableData()
 }
 
 //表格被选择

+ 33 - 27
src/views/project/modules/project-list.vue

@@ -4,9 +4,10 @@
             v-if="isAfterRender" :column="tableColumn" :datas="tableData" :index-style="{ width: 60 }" is-check
             :check-style="{ fixed: true, width: 29 }" class="hc-project-list-table" @selection-change="tableCheckChange"
         >
-            <template #key1="{ row }">
-                <el-link type="primary" @click="rowNameClick(row)">{{ row.key1 }}</el-link>
+            <template #name="{ row }">
+                <el-link type="primary" @click="rowNameClick(row)">{{ row.name }}</el-link>
             </template>
+          
             <template #action="{ row }">
                 <el-link v-if="isAdminAuth" type="warning" @click="completion(row)">项目完成情况</el-link>
                 <el-link type="primary" @click="examine(row)">查看</el-link>
@@ -235,6 +236,14 @@ const props = defineProps({
         type: Boolean,
         default: false,
     },
+    loading: {
+        type: Boolean,
+        default: false,
+    },
+    datas: {
+        type: Array,
+        default: () => ([]),
+    },
 })
 
 //事件
@@ -258,34 +267,31 @@ onMounted(() => {
 
 //表头
 const tableColumn = ref([
-  { key: 'key01', name: '项目阶段' },
-   { key: 'key2', name: '项目类型' },
-   { key: 'key1', name: '项目名称' },
-   { key: 'key3', name: '建设规模' },
-   { key: 'key4', name: '开工年' },
-   { key: 'key5', name: '完工年' },
-   { key: 'key55', name: '总投资(亿元)' },
-   { key: 'key56', name: '\'十四五\'计划投资(亿元)' },
-   { key: 'key57', name: '市级重点项目' },
-   { key: 'key58', name: '交通强国建设试点任务' },
-   { key: 'key59', name: '完成投资金额(亿元)' },
-   { key: 'key11', name: '项目进展比例(%)' },
-   { key: 'key12', name: '完成情况填写比例(%)' },
-   { key: 'key13', name: '牵头单位' },
-   { key: 'key14', name: '配合单位' },
-   { key: 'key15', name: '责任单位' },
+  { key: 'projectStageName', name: '项目阶段' },
+   { key: 'projectTypeName', name: '项目类型' },
+   { key: 'name', name: '项目名称' },
+   { key: 'buildScaleName', name: '建设规模' },
+   { key: 'startYear', name: '开工年' },
+   { key: 'endYear', name: '完工年' },
+   { key: 'allInvest', name: '总投资(亿元)' },
+   { key: 'fourteenFiveInvest', name: '\'十四五\'计划投资(亿元)' },
+   { key: 'isFocusProjectName', name: '市级重点项目' },
+   { key: 'isPilotPlanName', name: '交通强国建设试点任务' },
+   { key: 'finishedInvestMoney', name: '完成投资金额(亿元)' },
+   { key: 'progressRatio', name: '项目进展比例(%)' },
+   { key: 'finishedFillRatio', name: '完成情况填写比例(%)' },
+   { key: 'leaderUnit', name: '牵头单位' },
+   { key: 'assistUnit', name: '配合单位' },
+   { key: 'dutyUnit', name: '责任单位' },
     { key: 'action', name: '操作', width: isAdminAuth.value ? 220 : 100, fixed:'right', align: 'center' },
 ])
 
-//表格数据
-const tableData = ref([
-   { id: 1, key1: '名称1', key2: '-', key3: '-' },
-   { id: 2, key1: '名称2', key2: '-', key3: '-' },
-   { id: 3, key1: '名称3', key2: '-', key3: '-' },
-   { id: 4, key1: '名称4', key2: '-', key3: '-' },
-   { id: 5, key1: '名称5', key2: '-', key3: '-' },
-])
-
+//监听数据
+const tableData = ref(props.datas)
+watch(() => props.datas, (data) => {
+    console.log(data, 'data')
+    tableData.value = data
+})
 //表格被选择
 const tableCheckKeys = ref([])
 const tableCheckChange = (rows) => {