فهرست منبع

Merge remote-tracking branch 'origin/master'

ZaiZai 1 سال پیش
والد
کامیت
20e079714b

+ 14 - 6
src/api/modules/project/project.js

@@ -44,10 +44,18 @@ export default {
     },
     //修改项目完成情况
     async updateProFin(form) {
-    return HcApi({
-        url: '/api/blade-attach/project/update-project-finished',
-        method: 'post',
-        data: form,
-    }, false)
-},
+        return HcApi({
+            url: '/api/blade-attach/project/update-project-finished',
+            method: 'post',
+            data: form,
+        }, false)
+    },
+    //删除
+    async del(ids) {
+        return HcApi({
+            url: '/api/blade-attach/project/remove',
+            method: 'post',
+            params: { ids },
+        }, false)
+    },
 }

+ 4 - 0
src/views/project/admin/create.vue

@@ -349,6 +349,8 @@ const formatInput = (value)=>{
   if (!value) {
         return ''
       }
+        // 移除非数字和小数点
+        value = value.replace(/[^\d.]/g, '')
       // 使用正则表达式匹配输入是否合法
       const regExp = /^\d+(\.\d{0,2})?$/
       if (regExp.test(value)) {
@@ -449,6 +451,8 @@ const saveClick = async () => {
     creatLoading.value = false
     if (!error && code === 200) {
         window?.$message?.success(msg)
+        const form = getObjValue(formInfo.value)
+        getProDetail(form.id)
      
     } else {
         window.$message.error(msg ?? '操作失败')

+ 13 - 5
src/views/project/admin/list.vue

@@ -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 :datas="tableData" @tap="rowNameClick" @check="tableCheck" />
+        <HcTableList ref="tableRef" is-admin :datas="tableData" @tap="rowNameClick" @check="tableCheck" @change="searchClick" />
         <template #action>
             <div>建设规模:共计 xx 公里</div>
             <hc-pages :pages="searchForm" @change="pageChange" />
@@ -88,7 +88,7 @@
 <script setup>
 import { onMounted, ref } from 'vue'
 import HcTableList from '../modules/project-list.vue'
-import { getArrValue } from 'js-fast-way'
+import { arrToId, getArrValue } from 'js-fast-way'
 import mainApi from '~api/project/project'
 import { getDictionaryData } from '~src/utils/tools'
 
@@ -160,9 +160,17 @@ const rowNameClick = (row) => {
 }
 
 //批量删除
-const delTableItem = (_, resolve) => {
-    tableRef.value?.batchRemove()
-    resolve()
+//批量删除
+const delTableItem = async (_, resolve) => {
+    const ids = arrToId(tableCheckKeys.value)
+    const { error, code, msg } = await mainApi.del(ids)
+    if (!error && code === 200) {
+        window.$message.success('删除成功')
+        resolve()
+        searchClick()
+    } else {
+        window.$message.error(msg ?? '删除失败')
+    }
 }
 
 //批量导出

+ 30 - 10
src/views/project/ledger.vue

@@ -4,13 +4,13 @@
             <div v-if="tabsKey === '1'" class="hc-flex">
                 <hc-date-year v-model="searchForm1.startYear" v-model:end="searchForm1.endYear" />
                 <div class="relative ml-3 w-[300px]">
-                    <hc-search-input v-model="searchForm1.queryValue" text="搜索" color="#151921" @search="searchClick1">
-                        <template #prepend>
+                    <hc-search-input v-model="searchForm1.searchValue" text="搜索" color="#151921" @search="searchClick1">
+                        <!-- <template #prepend>
                             <el-select v-model="searchForm1.year" placeholder="年份" clearable style="width: 80px">
                                 <el-option label="2023" value="2023" />
                                 <el-option label="2024" value="2024" />
                             </el-select>
-                        </template>
+                        </template> -->
                     </hc-search-input>
                 </div>
             </div>
@@ -18,12 +18,12 @@
         <template #extra>
             <div v-if="tabsKey === '1'" class="hc-flex">
                 <div class="ml-6 w-[120px]">
-                    <el-select v-model="searchForm1.key1" filterable clearable block placeholder="项目阶段" @change="searchClick1">
+                    <el-select v-model="searchForm1.projectStage" filterable clearable block placeholder="项目阶段" @change="searchClick1">
                         <el-option v-for="item in projectStage" :key="item.value" :label="item.label" :value="item.value" />
                     </el-select>
                 </div>
                 <div class="ml-2 w-[100px]">
-                    <el-select v-model="searchForm1.key2" filterable clearable block placeholder="项目类型" @change="searchClick1">
+                    <el-select v-model="searchForm1.projectType" filterable clearable block placeholder="项目类型" @change="searchClick1">
                         <el-option v-for="item in typeData" :key="item.value" :label="item.label" :value="item.value" />
                     </el-select>
                 </div>
@@ -42,7 +42,7 @@
                 <el-button v-yes-com:[deriveTableItem2] :disabled="tableCheckKeys2.length <= 0" type="primary" class="ml-2">批量导出</el-button>
             </div>
         </template>
-        <HcTableList1 v-if="tabsKey === '1'" ref="table1Ref" />
+        <HcTableList1 v-if="tabsKey === '1'" ref="table1Ref" :datas="tableData1" />
         <HcTableList2 v-if="tabsKey === '2'" :datas="tableData2" :loading="tableLoading2" @tap="rowNameClick2" @check="tableCheck2" @change="searchClick2" />
         <template #action>
             <hc-pages v-if="tabsKey === '1'" :pages="searchForm1" @change="pageChange1" />
@@ -56,7 +56,7 @@ import { onMounted, ref } from 'vue'
 import { getDictionaryData } from '~src/utils/tools'
 import { arrToId, getArrValue, newDownBlob } from 'js-fast-way'
 import mainApi from '~api/project/gist'
-
+import mainProApi from '~api/project/project'
 //子组件
 import HcTableList1 from './modules/project-list.vue'
 import HcTableList2 from './modules/gist-list.vue'
@@ -85,14 +85,15 @@ onMounted(() => {
 const projectStage = ref([])//项目阶段
 const getDataApi = async () => {
     projectStage.value = await getDictionaryData('projectStage', true)
+    getTableData1()
 }
 
 //项目类型
-const typeData = ref([{ value: '1', label: '铁路' }, { value: '2', label: '高速公路' }])
+const typeData = ref([])
 
 //搜索条件
 const searchForm1 = ref({
-    startYear: '', endYear: '', queryValue: '', year: '',
+    startYear: '', endYear: '', searchValue: '', projectStage:null, projectType:null,
     current: 1, size: 20, total: 0,
 })
 const searchForm2 = ref({
@@ -102,7 +103,8 @@ const searchForm2 = ref({
 
 //搜索
 const searchClick1 = () => {
-
+    searchForm1.value.current = 1
+    getTableData1()
 }
 const searchClick2 = () => {
     searchForm2.value.current = 1
@@ -113,6 +115,7 @@ const searchClick2 = () => {
 const pageChange1 = ({ current, size }) => {
     searchForm1.value.current = current
     searchForm1.value.size = size
+    getTableData1()
 }
 
 //分页
@@ -127,6 +130,8 @@ const table1Ref = ref(null)
 //表格数据
 const tableData2 = ref([])
 const tableLoading2 = ref(false)
+const tableData1 = ref([])
+const tableLoading1 = ref(false)
 
 //表格被选择
 const tableCheckKeys1 = ref([])
@@ -151,6 +156,21 @@ const getTableData2 = async () => {
     }
 }
 
+//获取表格数据
+const getTableData1 = async () => {
+    tableData1.value = []
+    tableLoading1.value = true
+    const { error, code, data } = await mainProApi.page(searchForm1.value)
+    //处理数据
+    tableLoading2.value = false
+    if (!error && code === 200) {
+        tableData1.value = getArrValue(data['records'])
+        searchForm1.value.total = data.total || 0
+    } else {
+        tableData1.value = []
+        searchForm1.value.total = 0
+    }
+}
 //名称被点击
 const rowNameClick2 = (row) => {
     console.log(row)

+ 40 - 9
src/views/project/modules/project-list.vue

@@ -40,6 +40,18 @@
                         <hc-info-table-td is-title width="30px" center>完 工 年</hc-info-table-td>
                         <hc-info-table-td center>{{ rowDetail?.endYear }}</hc-info-table-td>
                     </tr>
+                    <tr>
+                        <hc-info-table-td is-title width="30px" center>总投资</hc-info-table-td>
+                        <hc-info-table-td center>{{ rowDetail?.allInvestMoney }}</hc-info-table-td>
+                        <hc-info-table-td is-title width="30px" center>“十四五”计划投资</hc-info-table-td>
+                        <hc-info-table-td center>{{ rowDetail?.fourteenFiveInvest }}</hc-info-table-td>
+                    </tr>
+                    <tr>
+                        <hc-info-table-td is-title width="30px" center>市级重点项目</hc-info-table-td>
+                        <hc-info-table-td center>{{ rowDetail.isFocusProject === 1 ? '是' : '否' }}</hc-info-table-td>
+                        <hc-info-table-td is-title width="30px" center>交通强国建设试点任务</hc-info-table-td>
+                        <hc-info-table-td center>{{ rowDetail?.isPilotPlan === 1 ? '是' : '否' }}</hc-info-table-td>
+                    </tr>
                     <tr>
                         <hc-info-table-td is-title width="30px" center>牵头单位</hc-info-table-td>
                         <hc-info-table-td center>{{ rowDetail?.leaderUnit }}</hc-info-table-td>
@@ -153,7 +165,8 @@
                                     <el-table-column prop="investMoney" label="投资完成额(亿元)" width="100" align="center">
                                         <template #default="{ row }">
                                             <hc-body>
-                                                <hc-table-input v-model="row.investMoney" />
+                                                <!-- <hc-table-input v-model="row.investMoney" /> -->
+                                                <el-input v-model="row.investMoney" clearable :formatter="formatInput" />
                                             </hc-body>
                                         </template>
                                     </el-table-column>
@@ -248,7 +261,7 @@ const props = defineProps({
 })
 
 //事件
-const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check'])
+const emit = defineEmits(['tap', 'completion', 'examine', 'del', 'export', 'check', 'change'])
 
 //监听权限
 const isAdminAuth = ref(props.isAdmin)
@@ -275,7 +288,7 @@ const tableColumn = ref([
    { key: 'startYear', name: '开工年' },
    { key: 'endYear', name: '完工年' },
    { key: 'allInvest', name: '总投资(亿元)' },
-   { key: 'fourteenFiveInvest', name: '\'十四五\'计划投资(亿元)' },
+   { key: 'fourteenFiveInvest', name: '\“十四五”\'计划投资(亿元)' },
    { key: 'isFocusProjectName', name: '市级重点项目' },
    { key: 'isPilotPlanName', name: '交通强国建设试点任务' },
    { key: 'finishedInvestMoney', name: '完成投资金额(亿元)' },
@@ -345,13 +358,15 @@ const getDetailData = async (id) => {
 
 }
 //删除
-const delTableItem = ({ item }, resolve) => {
-    console.log('我被执行了', item)
-    //这里可以写一些操作,下面是模拟3秒关闭
-    setTimeout(() => {
+const delTableItem = async ({ item }, resolve) => {
+    const { error, code, msg } = await mainApi.del(item.id)
+    if (!error && code === 200) {
+        window.$message.success('删除成功')
         resolve()
-        emit('del', item)
-    }, 3000)
+        emit('change')
+    } else {
+        window.$message.error(msg ?? '删除失败')
+    }
 }
 //关闭抽屉
 const drawerCancel = () => {
@@ -483,6 +498,22 @@ const setSpanMethod = (column, row, isAllYear = true) => {
     }
 }
 
+const formatInput = (value)=>{
+    // 移除非数字和小数点
+    value = value.replace(/[^\d.]/g, '')
+
+    // 将输入值转换为浮点数
+    let floatValue = parseFloat(value)
+
+    // 检查输入是否为数字且不小于0
+    if (!isNaN(floatValue) && floatValue >= 0) {
+    // 如果是数字且不小于0,则返回原始值
+    return value
+    } else {
+    // 如果输入不符合要求,则返回空字符串
+    return ''
+}
+}
 defineExpose({
     batchRemove,
     batchExport,