<template>
  <div class="audit-project-manage">
    <!-- 搜索区域 -->
    <div class="search-container">
      <el-form :inline="true" :model="searchForm" class="demo-form-inline">
        <el-form-item label="计划年度：">
          <el-date-picker
            v-model="searchForm.year"
            type="year"
            placeholder="请选择计划年度"
            format="yyyy"
            value-format="yyyy"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="地区：" prop="areaCode">
          <el-cascader
            v-model="searchForm.areaCode"
            :options="districtTree"
            :props="districtTreeCascaderProps"
            :show-all-levels="false"
            clearable
            placeholder="请选择地区"
          ></el-cascader>
        </el-form-item>
        <el-form-item label="监审项目名称：">
          <el-input
            v-model="searchForm.projectName"
            placeholder="请输入监审项目名称"
            clearable
            maxlength="30"
          />
        </el-form-item>
        <el-form-item>
          <el-button icon="el-icon-search" type="primary" @click="handleSearch">
            搜索
          </el-button>
          <el-button
            plain
            type="primary"
            icon="el-icon-refresh"
            @click="handleReset"
          >
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="button-container">
      <el-button
        plain
        type="success"
        icon="el-icon-circle-plus"
        style="margin-bottom: 10px"
        @click="handleAdd"
      >
        添加
      </el-button>
    </div>

    <!-- 数据表格 -->
    <el-table
      v-loading="loading"
      :data="projectList"
      border
      style="width: 100%"
    >
      <el-table-column label="序号" width="80" align="center">
        <template slot-scope="scope">
          {{ scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column
        prop="planYear"
        label="计划年度"
        width="100"
        align="center"
      />
      <el-table-column
        prop="areaCode"
        label="监审地区"
        width="100"
        align="center"
      >
        <template slot-scope="scope">
          {{ regionNameMap[scope.row.areaCode] }}
        </template>
      </el-table-column>
      <el-table-column
        prop="projectName"
        label="成本监审项目名称"
        align="center"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <a href="#" class="link-text" @click.prevent="handleView(scope.row)">
            {{ scope.row.projectName }}
          </a>
        </template>
      </el-table-column>
      <el-table-column
        prop="auditedUnitId"
        label="被监审单位"
        align="center"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ getUnitName(scope.row.auditedUnitId) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="auditTime"
        label="监审时间"
        width="100"
        align="center"
      />
      <el-table-column
        prop="auditType"
        label="监审形式"
        width="100"
        align="center"
      >
        <template slot-scope="scope">
          {{ getDictName('auditType', scope.row.auditType) }}
        </template>
      </el-table-column>
      <el-table-column
        prop="orgId"
        label="监审主体"
        align="center"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ orgNameMap[scope.row.orgId] }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="180" align="center">
        <template slot-scope="scope">
          <el-button size="mini" type="text" @click="handleEdit(scope.row)">
            修改
          </el-button>
          <el-button size="mini" type="text" @click="handleDelete(scope.row)">
            删除
          </el-button>
          <el-button
            size="mini"
            type="text"
            @click="handleEstablish(scope.row)"
          >
            立项
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <div class="pagination-container">
      <el-pagination
        :current-page="pagination.currentPage"
        :page-sizes="[50, 100]"
        :page-size="pagination.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pagination.total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      ></el-pagination>
    </div>

    <!-- 查看/编辑/新增对话框 -->
    <el-dialog
      :title="dialogTitle"
      :visible.sync="dialogVisible"
      width="700px"
      z-index="8000"
      :close-on-click-modal="false"
      @close="handleDialogClose"
    >
      <div class="dialog-content">
        <el-form
          ref="projectForm"
          :model="currentProject"
          :rules="rules"
          label-width="140px"
          :disabled="dialogTitle == '查看项目'"
        >
          <el-row :gutter="20">
            <el-col :span="24">
              <el-form-item label="成本监审项目名称" prop="projectName">
                <el-input
                  v-model="currentProject.projectName"
                  placeholder="请输入成本监审项目名称"
                  clearable
                  maxlength="30"
                />
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="关联成本监审目录" prop="catalogId">
                <CatalogCascader
                  ref="catalogCascader"
                  :form-item="{ placeholder: '请选择监审目录' }"
                  style="width: 100%"
                  :value="currentProject.catalogId"
                  @change="handleCatalogChange"
                />
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="被监审单位" prop="auditedUnitId">
                <el-select
                  v-model="currentProject.auditedUnitId"
                  placeholder="请选择单位"
                  clearable
                  multiple
                  style="width: 80%"
                  @change="handleUnitChange"
                >
                  <el-option
                    v-for="unit in unitList"
                    :key="unit.unitId"
                    :label="unit.unitName"
                    :value="unit.unitId"
                  />
                </el-select>
                <!-- <el-input
                  v-model="currentProject.auditedUnitName"
                  style="width: 76%"
                  placeholder="请输入被监审单位"
                  readonly
                />
                <el-button
                  type="primary"
                  class="ml10"
                  @click="showUnitDialog = true"
                >
                  选择单位
                </el-button>
                <UnitSelectDialog
                  :visible.sync="showUnitDialog"
                  @unit-selected="handleUnitSelected"
                /> -->
                <el-button
                  type="primary"
                  class="ml10"
                  @click="dialogAddUnitVisible = true"
                >
                  新增单位
                </el-button>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="计划年度" prop="planYear">
                <el-date-picker
                  v-model="currentProject.planYear"
                  style="width: 100%"
                  type="year"
                  placeholder="请选择计划年度"
                  format="yyyy"
                  value-format="yyyy"
                  clearable
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="监审时间" prop="auditTime">
                <el-input
                  v-model="currentProject.auditTime"
                  placeholder="请输入监审时间，例如：上半年/下半年"
                  clearable
                  maxlength="30"
                ></el-input>
                <!-- <el-select
                  v-model="currentProject.auditTime"
                  style="width: 100%"
                  placeholder="请选择监审形式"
                >
                  <el-option
                    v-for="(item, index) in auditTimeList"
                    :key="index"
                    :label="item.dictLabel"
                    :value="item.dictValue"
                  ></el-option>
                </el-select> -->
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="监审形式" prop="auditType">
                <el-select
                  v-model="currentProject.auditType"
                  style="width: 100%"
                  placeholder="请选择监审形式"
                  clearable
                >
                  <el-option
                    v-for="item in dictData['auditType']"
                    :key="item.key"
                    :label="item.name"
                    :value="item.key"
                  ></el-option>
                  <!-- <el-option
                    v-for="(item, index) in auditTypeList"
                    :key="index"
                    :label="item.dictLabel"
                    :value="item.dictValue"
                  ></el-option> -->
                </el-select>
              </el-form-item>
            </el-col>
            <!-- 监审地区 -->
            <el-col :span="24">
              <el-form-item label="监审地区" prop="areaCode">
                <RegionSelector
                  :initial-area-code="currentProject.areaCode"
                  :disabled="false"
                  @region-change="handleRegionChange"
                ></RegionSelector>
              </el-form-item>
            </el-col>

            <el-col :span="24">
              <el-form-item label="监审主体" prop="orgId">
                <el-select
                  v-model="currentProject.orgId"
                  placeholder="请选择监审主体"
                  style="width: 100%"
                  clearable
                >
                  <el-option
                    v-for="Org in areaOrgList"
                    :key="Org.id"
                    :label="Org.name"
                    :value="Org.id"
                  />
                </el-select>
                <!-- <el-input
                  v-model="currentProject.orgName"
                  style="width: 76%"
                  placeholder="请输入监审主体"
                  readonly
                /> -->
                <!-- <el-button
                  type="primary"
                  class="ml10"
                  style="width: 22%"
                  @click="showOrgDialog = true"
                >
                  选择部门
                </el-button>
                <OrgSelectDialog
                  :visible.sync="showOrgDialog"
                  @org-selected="handleOrgSelected"
                /> -->
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>

      <div
        slot="footer"
        class="dialog-footer"
        style="text-align: center; display: flex; justify-content: flex-end"
      >
        <el-button
          v-if="dialogTitle !== '查看项目'"
          type="primary"
          @click="submitForm"
        >
          确认
        </el-button>
        <el-button plain type="primary" @click="dialogVisible = false">
          {{ dialogTitle == '查看项目' ? '关闭' : '取消' }}
        </el-button>
      </div>
    </el-dialog>
    <!-- 立项弹窗 -->
    <EstablishmentDialog
      :title="dialogTitle"
      :visible="isEstablish"
      :provinces="provinces"
      :initial-data="establishRow"
      :type="3"
      @save="handleEstablishSave"
      @cancel="handleEstablishCancel"
      @close="handleEstablishClose"
    />

    <!-- 选择被监审单位弹窗 -->
    <el-dialog
      title="选择单位"
      :visible.sync="dialogUnitVisible"
      width="500px"
      @close="handleDialogClose"
    ></el-dialog>

    <!-- 新增监审单位 -->
    <AuditEntityFormtDialog
      :dialog-visible="dialogAddUnitVisible"
      dialog-title="新增被监审单位"
      :is-view-mode="isViewMode"
      @confirm="handleDialogSuccess"
      @update:dialogVisible="dialogAddUnitVisible = $event"
    />
  </div>
</template>

<script>
  import { Message, MessageBox } from 'element-ui'
  import RegionSelector from './RegionSelector.vue'
  import CatalogCascader from './CatalogCascader.vue'
  import EstablishmentDialog from '@/components/costAudit/EstablishmentDialog.vue'
  // import UnitSelectDialog from '@/components/costAudit/UnitSelectDialog.vue'
  // import OrgSelectDialog from '@/components/costAudit/OrgSelectDialog.vue'
  import AuditEntityFormtDialog from '@/components/costAudit/AuditEntityFormtDialog.vue'
  import {
    getDataList,
    getDetailById,
    addProjectApproval,
    delProjectApprovalById,
    editProjectApproval,
    getOrgById,
    getDefaultDem,
    getOrgListByDemId,
  } from '@/api/annualReviewPlan'
  import { getAllUnitListByRegionCode } from '@/api/auditEntityManage'
  import { dictMixin, regionMixin } from '@/mixins/useDict'

  export default {
    name: 'AuditProjectManage',
    components: {
      EstablishmentDialog, // 注册组件
      RegionSelector, //选择地区
      CatalogCascader, //选择监审目录级联
      // UnitSelectDialog, //选择被监审单位，
      AuditEntityFormtDialog, //新增监审单位
      // OrgSelectDialog, //选择监审主体
    },
    mixins: [dictMixin, regionMixin],
    data() {
      return {
        dictData: {
          auditType: [], //监审形式
        },
        loading: false,
        // 搜索表单
        searchForm: {
          year: '',
          areaCode: [],
          projectName: '',
        },
        // 项目列表
        projectList: [],
        // 分页信息
        pagination: {
          currentPage: 1,
          pageSize: 50,
          total: 0,
        },
        // 地区名称映射
        regionNameMap: {},
        //监审主体名称映射
        orgNameMap: {},
        //监审目录
        categoryList: [],
        OrgList: [],
        unitList: [],
        establishRow: {},
        currentProject: {
          projectName: '',
          catalogId: '',
          auditedUnitId: [],
          auditedUnitName: '',
          planYear: '',
          auditTime: '',
          auditType: '',
          areaCode: '',
          orgId: '',

          provinceId: '',
          cityId: '',
          districtId: '',
          provinceName: '',
          cityName: '',
          districtName: '',
          orgName: '',
        },
        areaCode: '',

        provinces: [],
        cities: [],
        districts: [],
        formCities: [],
        formDistricts: [],

        // 对话框相关
        dialogVisible: false,
        dialogTitle: '',
        isEdit: false,
        isView: false,
        isEstablish: false,
        //被监审单位
        dialogUnitVisible: false, //选择单位弹窗
        isViewMode: false,
        showUnitDialog: false, //选择被监审单位弹窗
        dialogAddUnitVisible: false, //新增被监审单位弹窗

        showOrgDialog: false, //选择监审主体弹窗

        // 表单验证规则
        rules: {
          projectName: [
            {
              required: true,
              message: '请输入成本监审项目名称',
              trigger: 'blur',
            },
          ],
          catalogId: [
            {
              required: true,
              message: '请输入关联成本监审目录',
              trigger: 'blur',
            },
          ],
          auditedUnitId: [
            { required: true, message: '请选择被监审单位', trigger: 'change' },
          ],
          planYear: [
            { required: true, message: '请选择计划年度', trigger: 'change' },
          ],
          auditTime: [
            { required: true, message: '请输入监审时间', trigger: 'blur' },
          ],
          auditType: [
            { required: true, message: '请选择监审形式', trigger: 'change' },
          ],
          // areaCode: [
          //   { required: true, message: '请选择监审地区', trigger: 'change' },
          // ],
          orgId: [
            { required: true, message: '请输入监审主体', trigger: 'blur' },
          ],
        },
        formData: {
          projectName: '',
          catalogId: '',
          province: '',
          city: '',
          district: '',
          auditedUnit: '',
          auditBody: '',
          planYear: '',
          initiationType: '',
          auditType: '',
          provinceId: '',
          cityId: '',
          districtId: '',
          province: '',
          city: '',
          district: '',
          costYears: [{ value: '2022' }, { value: '2023' }, { value: '2024' }],
          needAudit: false,
          needEvaluation: false,
          initiationReason: '',
          // 修改为与图片一致的立项依据文件列表
          initiationBasisFiles: [
            { name: '太原市电力公司关于电网输配电价格调整申请表.pdf' },
            { name: '******依据文件.pdf' },
          ],
          // 修改为与图片一致的其他材料文件列表
          otherFiles: [{ name: '立项审批表.pdf' }],
          auditLeader: '',
          auditTeamMembers: '',
          otherRequirements: '',
        },
        establishRules: {
          projectName: [
            {
              required: true,
              message: '请输入成本监审项目名称',
              trigger: 'blur',
            },
          ],
          catalogId: [
            {
              required: true,
              message: '请输入关联成本监审目录',
              trigger: 'blur',
            },
          ],
          auditedUnit: [
            { required: true, message: '请输入被监审单位', trigger: 'blur' },
          ],
          auditBody: [
            { required: true, message: '请输入监审主体', trigger: 'blur' },
          ],
          planYear: [
            { required: true, message: '请选择计划年度', trigger: 'change' },
          ],
          initiationType: [
            { required: true, message: '请选择立项类型', trigger: 'change' },
          ],
          auditType: [
            { required: true, message: '请选择监审形式', trigger: 'change' },
          ],
          auditLeader: [
            {
              required: true,
              message: '请选择监审任务负责人',
              trigger: 'change',
            },
          ],
          auditTeamMembers: [
            {
              required: true,
              message: '请选择监审任务组成员',
              trigger: 'change',
            },
          ],
        },
      }
    },
    computed: {
      areaOrgList() {
        // 过滤出区域单位
        let user = this.$permission.getUserInfo()
        let arr = []
        if (this.$permission.isAdminOrProvince()) {
          // 管理员或省级权限，显示所有数据
          arr = this.OrgList
        } else {
          console.log('this.OrgList', this.OrgList)
          // 非管理员且数据范围为区域时，筛选出当前用户区域下的市区数据
          arr = this.OrgList
        }
        return arr
      },
    },
    mounted() {
      this.handleSearch() //加载数据
      this.getDefaultDem()
      this.getAllUnitList()
    },
    methods: {
      handleReset() {
        this.searchForm = {
          year: '',
          areaCode: [],
          projectName: '',
        }
        this.pagination.currentPage = 1
        this.handleSearch()
      },
      getAllUnitList() {
        getAllUnitListByRegionCode().then((res) => {
          this.unitList = res.value || []
          // 过滤掉状态为停用的数据
          this.unitList = this.unitList.filter((item) => item.status == 1)
        })
      },
      getUnitName(unitId) {
        // 直接处理unitId值，而不是row对象
        if (unitId && typeof unitId === 'string' && unitId.includes(',')) {
          // 如果包含逗号，分割成数组并查找对应的unitName
          const unitIds = unitId.split(',')
          return unitIds
            .map((id) => {
              const unit = this.unitList.find((item) => item.unitId == id)
              return unit ? unit.unitName : ''
            })
            .filter((name) => name) // 过滤空值
            .join(',')
        } else {
          // 单个unitId的情况
          const unit = this.unitList.find((item) => item.unitId == unitId)
          return unit ? unit.unitName : ''
        }
      },
      // 获取默认维度
      getDefaultDem() {
        getDefaultDem().then((res) => {
          if (res && res.code === 200) {
            const demId = res.value ? res.value.id : null
            if (demId) {
              this.getOrgListByDemId(demId)
            }
          }
        })
      },
      // 根据维度ID获取单位列表
      getOrgListByDemId(demId) {
        getOrgListByDemId({ demId }).then((res) => {
          if (res && res.code === 200) {
            this.OrgList = res.value || []
          }
        })
      },
      // 获取监审主体名称
      batchGetOrgNames() {
        this.projectList.forEach((row) => {
          const orgId = row.orgId
          getOrgById({ id: orgId })
            .then((res) => {
              if (res && res.value && res.value.name) {
                // 缓存名称
                this.$set(this.orgNameMap, orgId, res.value.name)
              }
            })
            .catch((err) => {
              console.error('获取监审主体名称失败', err)
              this.$set(this.orgNameMap, orgId, '获取失败')
            })
            .finally(() => {})
        })
      },

      // 处理地区选择变化
      handleRegionChange(region) {
        this.areaCode = region.code
        this.currentProject.areaLevel = region.level
      },

      handleSearch() {
        this.loading = true
        const params = {
          areaCode:
            this.searchForm.areaCode[this.searchForm.areaCode.length - 1] || '',
          planYear: this.searchForm.year,
          projectName: this.searchForm.projectName,
          page: this.pagination.currentPage,
          pageSize: this.pagination.pageSize,
        }
        getDataList(params)
          .then(async (res) => {
            this.loading = false
            this.projectList = res.rows || []
            this.pagination.total = res.total || 0
            await this.fetchRegionNames(this.projectList, 'areaCode')
            this.batchGetOrgNames() //获取监审主体名称
          })
          .catch((error) => {
            this.loading = false
          })
      },
      handleUnitChange(value) {
        // this.currentProject.auditedUnitId = value
        console.log('选择的被监审单位:', value)
      },
      // 处理选择被监审单位后的回调
      handleUnitSelected(selectedUnit) {
        this.currentProject.auditedUnitId = selectedUnit.unitId
        this.currentProject.auditedUnitName = selectedUnit.unitName
      },
      // 处理选择监审主体后的回调
      handleOrgSelected(selectedOrg) {
        console.log('选择的监审主体:', selectedOrg)
        this.currentProject.orgId = selectedOrg.id
        this.currentProject.orgName = selectedOrg.name
      },

      // 处理监审目录选择后的回调
      handleCatalogChange(value) {
        this.currentProject.catalogId = value
      },

      // 处理新增
      handleAdd() {
        this.dialogTitle = '新增年度监审项目'
        this.isEdit = false
        this.isView = false
        this.currentProject = {
          projectName: '',
          catalogId: '',
          auditedUnitId: [],
          auditedUnitName: '',
          planYear: '',
          auditTime: '',
          auditType: '',
          areaCode: '',
          orgId: '',
          provinceId: '',
          cityId: '',
          districtId: '',
          provinceName: '',
          cityName: '',
          districtName: '',
        }
        if (this.$permission.getUserInfo()) {
          let user = this.$permission.getUserInfo()
          if (user.dataScope === 0) {
            this.currentProject.areaCode = user.provinceCode
          } else if (user.dataScope === 1) {
            this.currentProject.areaCode = user.cityCode
          } else if (user.dataScope === 2) {
            this.currentProject.areaCode = user.countyCode
          }
        }
        this.dialogVisible = true
      },
      // 处理查看
      handleView(row) {
        this.dialogTitle = '查看项目'
        this.isView = true
        this.currentProject = {
          ...row,
          auditedUnitId: row.auditedUnitId ? row.auditedUnitId.split(',') : [],
        }
        this.currentProject.orgName = this.orgNameMap[row.orgId] || ''
        this.dialogVisible = true
      },
      // 处理编辑
      handleEdit(row) {
        this.dialogTitle = '年度监审项目维护'
        this.isEdit = true
        this.isView = false
        this.currentProject = {
          ...row,
          auditedUnitId: row.auditedUnitId ? row.auditedUnitId.split(',') : [],
        }
        this.currentProject.orgName = this.orgNameMap[row.orgId] || ''
        this.dialogVisible = true
      },
      // 处理删除
      handleDelete(row) {
        MessageBox.confirm(
          `确定要删除"${row.projectName}"这个监审项目吗？`,
          '删除确认',
          {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }
        )
          .then(() => {
            delProjectApprovalById(row.planId).then((res) => {
              if (res.code !== 200) {
                Message.error(res.msg || '删除失败')
                return
              }
              Message.success('删除成功')
              // 删除后刷新列表
              this.handleSearch()
            })
          })
          .catch(() => {
            Message.info('已取消删除')
          })
      },
      handleEstablishDialogClose() {},
      // 处理分页大小变化
      handleSizeChange(val) {
        this.pageSize = val
        // 这里可以添加分页逻辑
      },
      // 处理当前页变化
      handleCurrentChange(val) {
        this.currentPage = val
        // 这里可以添加分页逻辑
      },
      // 提交表单
      submitForm() {
        this.currentProject.areaCode =
          this.areaCode || this.currentProject.areaCode
        const data = {
          ...this.currentProject,
          auditedUnitId: this.currentProject.auditedUnitId
            ? this.currentProject.auditedUnitId.join(',')
            : '',
        }
        this.$refs.projectForm.validate((valid) => {
          if (valid) {
            if (this.currentProject.areaCode == '') {
              Message.error('请选择地区！')
              return
            }
            if (this.isEdit) {
              editProjectApproval(data).then((res) => {
                if (res.code !== 200) {
                  Message.error(res.msg || '编辑失败')
                  return
                }
                Message.success('编辑成功')
                this.handleSearch()
              })
            } else {
              addProjectApproval(data).then((res) => {
                if (res.code !== 200) {
                  Message.error(res.msg || '新增失败')
                  return
                }
                Message.success('新增成功')
                this.handleSearch()
              })
            }
            this.dialogVisible = false
          }
        })
      },
      // 关闭对话框时重置表单
      handleDialogClose() {
        if (this.$refs.projectForm) {
          this.$refs.projectForm.resetFields()
        }
        this.currentProject = {
          projectName: '',
          catalogId: '',
          auditedUnitId: [],
          auditedUnitName: '',
          planYear: '',
          auditTime: '',
          auditType: '',
          areaCode: '',
          orgId: '',

          provinceId: '',
          cityId: '',
          districtId: '',
          provinceName: '',
          cityName: '',
          districtName: '',
        }
      },

      // 立项
      handleEstablish(row) {
        this.dialogTitle = '成本监审立项'
        this.establishRow = row
        console.log('立项项目:', row)
        this.isEstablish = true
      },

      // 立项保存
      handleEstablishSave(formData) {
        this.isEstablish = false
      },

      // 立项取消
      handleEstablishCancel() {
        this.isEstablish = false
      },

      // 立项弹窗关闭
      handleEstablishClose() {
        this.isEstablish = false
      },
      // 新增被监审单位
      selectUnit() {
        this.dialogUnitVisible = true
        this.dialogTitle = '新增被监审单位'
      },
      // 新增被监审单位弹窗操作成功回调
      handleDialogSuccess(data, value) {
        this.dialogAddUnitVisible = false
        this.getAllUnitList()
        this.currentProject.auditedUnitId.push(value)
        this.currentProject.areaCode = data.areaCode[data.areaCode.length - 1]
        // this.currentProject.areaLevel = data.areaLevel
      },
    },
  }
</script>

<style lang="scss" scoped>
  @import '@/styles/costAudit.scss';
  .audit-project-manage {
    padding: 20px;
  }

  h2 {
    margin-bottom: 20px;
    font-size: 18px;
    color: #303133;
  }

  .search-container {
    /* padding: 10px; */
    border-radius: 4px;
  }

  .demo-form-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .pagination-container {
    margin-top: 20px;
    text-align: right;
  }

  /* 对话框样式 */
  .dialog-content h3 {
    margin-bottom: 20px;
    font-size: 16px;
    color: #303133;
  }
</style>
