Ver código fonte

fix:修改 综合查询页面查询条件

luzhixia 2 semanas atrás
pai
commit
f21942ba15

+ 33 - 4
src/views/costAudit/baseInfo/statistics/comprehensiveQuery.vue

@@ -33,12 +33,28 @@
           ></el-date-picker>
         </el-form-item>
         <el-form-item label="被监审单位:">
-          <el-input
+          <!-- <el-input
             v-model="searchForm.auditedUnitName"
             placeholder="请输入被监审单位"
             style="width: 200px"
             clearable
-          ></el-input>
+          ></el-input> -->
+          <el-select
+            v-model="searchForm.auditedUnitId"
+            placeholder="请选择被监审单位"
+            style="width: 200px"
+            clearable
+            filterable
+            allow-create
+            default-first-option
+          >
+            <el-option
+              v-for="item in auditedUnitOptions"
+              :key="item.unitId"
+              :label="item.unitName"
+              :value="item.unitId"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="立项年度:">
           <el-date-picker
@@ -228,7 +244,7 @@
   import TaskCustomizedReleaseDialog from '@/components/task/TaskCustomizedReleaseDialog.vue'
   import cbjsInfo from './components/cbjsInfo.vue'
   import { getCostProjectDetail } from '@/api/taskCustomizedRelease.js'
-
+  import { getAllUnitList } from '@/api/auditEntityManage.js'
   export default {
     name: 'ComprehensiveQuery',
     components: {
@@ -246,7 +262,7 @@
           projectName: '',
           startYear: '',
           endYear: '',
-          auditedUnitName: '',
+          auditedUnitId: '',
           year: '',
         },
         // 表格数据
@@ -268,12 +284,25 @@
         cbjsInfoVisible: false,
         cbjsInfoData: null,
         loading: false,
+        auditedUnitOptions: [],
       }
     },
     mounted() {
+      this.getOptions()
       this.handleQuery()
     },
     methods: {
+      getOptions() {
+        getAllUnitList()
+          .then((res) => {
+            if (res && res.value) {
+              this.auditedUnitOptions = res.value
+            }
+          })
+          .catch((e) => {
+            console.warn('获取单位列表失败', e)
+          })
+      },
       // 加载项目列表(优化分页数据处理)
       async handleQuery() {
         try {

+ 46 - 0
src/views/costAudit/baseInfo/statistics/historyAnalysis.vue

@@ -189,6 +189,8 @@
         selectedIndicators: [],
         // 原始数据源(用于过滤)
         rawDataSource: null,
+        // 项目被监审单位选项
+        projectAuditedUnitOptions: [],
         // 分页相关属性
         trendTotalPages: 0,
         trendCurrentPage: 1,
@@ -217,8 +219,52 @@
     },
     methods: {
       handleProjectChange() {
+        // 清空之前的选择
+        this.searchForm.auditedUnitId = ''
+        this.searchForm.auditedUnitName = ''
+        this.searchForm.startYear = ''
+        this.searchForm.endYear = ''
+        this.projectAuditedUnitOptions = []
+
         if (this.searchForm.projectId) {
           // 获取项目的被监审单位,监审期间
+          const selectedProject = this.projectOptions.find(
+            (item) => item.projectId === this.searchForm.projectId
+          )
+
+          if (selectedProject) {
+            // 设置被监审单位选项
+            if (selectedProject.auditedUnitId) {
+              const unit = selectedProject.auditedUnitId.split(',')
+              this.auditedUnitOptions.forEach((item) => {
+                if (unit.includes(item.unitId)) {
+                  this.projectAuditedUnitOptions.push(item)
+                }
+              })
+            }
+
+            // 设置监审期间
+            if (selectedProject.auditPeriod) {
+              if (typeof selectedProject.auditPeriod === 'string') {
+                const auditPeriod = selectedProject.auditPeriod
+                  .split(',')
+                  .map((year) => year.trim())
+                // 转换为数字并过滤无效年份
+                const yearNumbers = auditPeriod
+                  .map((year) => parseInt(year, 10))
+                  .filter((year) => !isNaN(year) && year > 0)
+
+                if (yearNumbers.length > 0) {
+                  // 计算最小和最大年份
+                  const start = Math.min(...yearNumbers)
+                  const end = Math.max(...yearNumbers)
+                  // 确保赋值为字符串类型
+                  this.searchForm.startYear = start.toString()
+                  this.searchForm.endYear = end.toString()
+                }
+              }
+            }
+          }
         }
       },
       // 初始化图表

+ 1 - 1
src/views/costAudit/baseInfo/statistics/industryAnalysis.vue

@@ -1274,7 +1274,7 @@
           }
           // 若无选中项,默认选中 parentId 为 -1 的根节点(单选),否则用第一个节点
           if (this.rightSelectedItems.length === 0) {
-            const rootItems = this.getRootItems(this.rightDataItems)
+            const { items: rootItems } = this.getParentIds(this.rightDataItems)
             const defaultItem =
               (rootItems && rootItems.length > 0
                 ? rootItems[0]