<script setup name="declarePage">
import { onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { genFileId, ElMessage } from 'element-plus'
import store from '@/store'
import { dictionary } from '@/http/apis/projectCollection/projectCollectionEnter'
const {
    fourSystem,
    businessTerritory,
    constructionLevel,
    projectBasisMaterials,
    insuranceLevel,
    coreBusiness
  } = store.dictStore.globalDicts || {},
  column1 = [
    {
      type: 'selection'
    },
    {
      label: '依据项',
      key: 'yjx',
      prop: 'yjx'
    },
    {
      label: '依据文件名',
      key: 'yjwjm',
      prop: 'yjwjm',
      width: 250
    },
    {
      label: '文件',
      slot: 'action',
      width: 100
    }
  ],
  column2 = [
    {
      type: 'index'
    },
    {
      label: '业务编号',
      key: 'ywbh',
      prop: 'ywbh'
    },
    {
      label: '业务名称',
      key: 'ywmc',
      prop: 'ywmc',
      width: 250
    },
    {
      label: '所属单位',
      key: 'shdw',
      prop: 'shdw',
      width: 100
    }
  ],
  // 核心业务
  column3 = [
    {
      type: 'selection'
    },
    {
      label: '编号',
      prop: 'id',
      key: 'id'
    },
    {
      label: '名称',
      prop: 'matterName',
      key: 'matterName'
    },
    {
      label: '单位',
      prop: 'orgName',
      key: 'orgName'
    }
    // {
    //   title: '操作',
    //   key: 'action',
    //   fixed: 'right',
    //   scopedSlots: { customRender: 'action' },
    // },
  ],
  pagination = false,
  selectionChange = (row) => {
    baseForm.value.num16 = row
  },
  collapseModal = ref('1'),
  collapseModal1 = ref('1'),
  collapseModal2 = ref('1'),
  collapseModal3 = ref('1'),
  collapseModal4 = ref('1'),
  collapseModal5 = ref('1'),
  collapseModal6 = ref('1'),
  collapseModal7 = ref('1'),
  baseForm = ref({}),
  // 手机号码校验
  checkTelPhone = (rule, value, callback) => {
    if (value === '') {
      return callback(new Error('请输入正确的手机号'))
    } else {
      const regIdCard =
          /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
      if (regIdCard.test(value)) {
        callback()
      } else {
        return callback(new Error('请输入正确的手机号'))
      }
    }
  },
  // 统一社会信用代码校验
  checkSocialCode = (rule, value, callback) => {
    if (value !== '') {
      const regSocialCode =
          /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/
      if (regSocialCode.test(value)) {
        callback()
      } else {
        callback(new Error('统一社会信用代码格式错误'))
      }
    }
  },
  baseRules = {
    num1: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
    num2: [
      { required: true, message: '请选择是否临时增补', trigger: 'change' }
    ],
    num3: [{ required: true, message: '请输入项目负责人', trigger: 'blur' }],
    num4: [
      { required: true, message: '请输入项目负责人手机号', trigger: 'blur' },
      { validator: checkTelPhone, trigger: 'blur' }
    ],
    num5: [{ required: true, message: '请输入项目联系人', trigger: 'blur' }],
    num6: [
      { required: true, message: '请输入项目联系人手机号', trigger: 'blur' },
      { validator: checkTelPhone, trigger: 'blur' }
    ],
    num7: [{ required: true, message: '请输入建设单位', trigger: 'blur' }],
    num8: [
      {
        required: true,
        message: '请输入建设单位统一信用代码',
        trigger: 'blur'
      },
      { validator: checkSocialCode, trigger: 'blur' }
    ],
    num9: [{ required: true, message: '请选择项目类型', trigger: 'change' }],
    num10: [
      { required: true, message: '请选择是否首次新建', trigger: 'change' }
    ],
    num11: [{ required: true, message: '请选择预算年度', trigger: 'change' }],
    num12: [{ required: true, message: '请选择四大体系', trigger: 'change' }],
    num13: [
      {
        required: true,
        message: '请选择是否数字化改革项目',
        trigger: 'change'
      }
    ],
    num14: [
      { required: true, message: '请选择综合业务领域', trigger: 'change' }
    ],
    num15: [{ required: true, message: '请选择建设层级', trigger: 'change' }],
    num16: [{ required: true, message: '请选择立项依据', trigger: 'change' }],
    num17: [{ required: true, message: '请输入发改编码', trigger: 'blur' }],
    num18: [{ required: true, message: '请输入财产编码', trigger: 'blur' }],
    num19: [{ required: true, message: '请选择是否上云', trigger: 'change' }],
    num20: [{ required: true, message: '请选择云类型', trigger: 'change' }],
    num21: [{ required: true, message: '请选择等保级别', trigger: 'change' }],
    num22: [{ required: true, message: '请选择是否密评', trigger: 'change' }],
    num23: [{ required: true, message: '请输入项目简介', trigger: 'blur' }]
  },
  capitalForm = ref({}),
  capitalRules = {
    sum1: [{ required: true, message: '请输入申报金额', trigger: 'blur' }],
    sum2: [{ required: true, message: '请输入自有资金', trigger: 'blur' }],
    sum3: [
      {
        required: true,
        message: '请输入政府投资-本级财政资金',
        trigger: 'blur'
      }
    ],
    sum4: [
      {
        required: true,
        message: '请输入政府投资-上级补助资金',
        trigger: 'blur'
      }
    ],
    sum5: [{ required: true, message: '请输入银行贷款', trigger: 'blur' }],
    sum6: [{ required: true, message: '请输入其他资金', trigger: 'blur' }]
  },
  totalMoneyForm = ref({}),
  totalMoneyRules = {
    money1: [{ required: true, message: '请输入软件开发', trigger: 'blur' }],
    money2: [
      { required: true, message: '请输入云资源、硬件配置', trigger: 'blur' }
    ],
    money3: [{ required: true, message: '请输入第三方服务', trigger: 'blur' }]
  },
  annualPlanForm = ref({}),
  annualPlanRules = {
    annualPlan1: [
      { required: true, message: '请输入年度支付金额', trigger: 'blur' }
    ],
    annualPlan2: [
      { required: true, message: '请输入自有资金', trigger: 'blur' }
    ],
    annualPlan3: [
      {
        required: true,
        message: '请输入政府投资-本级财政资金',
        trigger: 'blur'
      }
    ],
    annualPlan4: [
      {
        required: true,
        message: '请输入政府投资-上级补助资金',
        trigger: 'blur'
      }
    ],
    annualPlan5: [
      { required: true, message: '请输入银行贷款', trigger: 'blur' }
    ],
    annualPlan6: [{ required: true, message: '请输入其他', trigger: 'blur' }]
  },
  safetyInvestmentForm = ref({}),
  safetyInvestmentRules = {
    safetyInvestment1: [
      { required: true, message: '请输入投入项', trigger: 'blur' }
    ],
    safetyInvestment2: [
      { required: true, message: '请输入内容描述', trigger: 'blur' }
    ],
    safetyInvestment3: [
      { required: true, message: '请输入金额', trigger: 'blur' }
    ]
  },
  enclosureForm = reactive({
    fileList1: [],
    fileList2: []
  }),
  enclosureFormRules = {
    preliminaryPlan: [
      { required: true, message: '请上传初步方案', trigger: 'blur' }
    ],
    supportingMaterials: [
      { required: true, message: '请上传佐证材料', trigger: 'blur' }
    ]
  },
  notesForm = reactive({
    notesTextarea: ''
  }),
  notesFormRules = {
    notes: [
      { required: false, message: '', trigger: 'blur' }
    ]
  },
  // 初步方案文件上传
  upload = ref(),
  preliminaryPlanRef = ref(),
  // fileList1 = ref([]),
  handlePreliminaryPlanPreview = (uploadFile) => {
    console.log(uploadFile)
  },
  handlePreliminaryPlanRemove = (file, uploadFiles) => {
    console.log(file, uploadFiles)
  },
  handlePreliminaryPlanExceed = (files) => {
    upload.value.clearFiles()
    const file = files[0]
    file.uid = genFileId()
    upload.value.handleStart(file)
  },
  beforeUploadHandlePreliminaryPlan = (file) => {
  // const png = file.name.split('.')[1] === 'png'
  // const jpg = file.name.split('.')[1] === 'jpg'
  // const jpeg = file.name.split('.')[1] === 'jpeg'
    const pdf = file.name.split('.')[1] === 'pdf'
    const under100M = file.size / 1024 / 1024 < 100
    if (!pdf) {
      ElMessage.error('文件格式错误，仅支持上传PDF格式的文件！')
      return false
    } else if (!under100M) {
      ElMessage.error('文件大小不能超过100Mb！')
      return false
    } else {
      const preliminaryPlanParams = new FormData()
      preliminaryPlanParams.append('fileToUpload', file)
      if (file.type === 'application/pdf') {
        preliminaryPlanParams.append('fileType', 'Attachment')
      } else {
        preliminaryPlanParams.append('fileType', 'ImageTraining')
      }
    }
  },
  // 佐证材料文件上传
  handleSupportingMaterialsPreview = (uploadFile) => {
    console.log(uploadFile)
  },
  handleSupportingMaterialsRemove = (file, uploadFiles) => {
    console.log(file, uploadFiles)
  },
  beforeUploadHandleSupportingMaterials = (file) => {
  // const png = file.name.split('.')[1] === 'png'
  // const jpg = file.name.split('.')[1] === 'jpg'
  // const jpeg = file.name.split('.')[1] === 'jpeg'
    const pdf = file.name.split('.')[1] === 'pdf'
    const under100M = file.size / 1024 / 1024 < 100
    if (!pdf) {
      ElMessage.error('文件格式错误，仅支持上传PDF格式的文件！')
      return false
    } else if (!under100M) {
      ElMessage.error('文件大小不能超过100Mb！')
      return false
    }
  },
  // 提交表单
  form1 = ref(),
  form2 = ref(),
  form3 = ref(),
  form4 = ref(),
  form5 = ref(),
  form6 = ref(),
  submitAllForm = async () => {
    const form1Validated = new Promise((resolve, reject) => {
      form1.value.validate(valid => {
        if (valid) resolve(valid)
      })
    })
    const form2Validated = new Promise((resolve, reject) => {
      form2.value.validate(valid => {
        if (valid) resolve(valid)
      })
    })
    const form3Validated = new Promise((resolve, reject) => {
      form3.value.validate(valid => {
        if (valid) resolve()
      })
    })
    const form4Validated = new Promise((resolve, reject) => {
      form4.value.validate(valid => {
        if (valid) resolve()
      })
    })
    const form5Validated = new Promise((resolve, reject) => {
      form5.value.validate(valid => {
        if (valid) resolve()
      })
    })
    const form6Validated = new Promise((resolve, reject) => {
      form6.value.validate(valid => {
        if (valid) resolve()
      })
    })
    Promise.all([form1Validated, form2Validated, form3Validated, form4Validated, form5Validated, form6Validated]).then((value) => {
      alert('表单验证通过', value)
    }, (reason) => {
      alert('表单提交失败', reason)
    })
  },
  router = useRouter(),
  backToProjectDeclare = () => {
    router.push({ name: 'projectDeclare' })
  },
  // 增加模块相关方法
  // moduleActiveList = ref([0]),
  // addModule = ref([
  //   {
  //     id: 0,
  //     example: true
  //   }
  // ]),
  // addModuleFn = () => {
  //   moduleActiveList.value.push(addModule.value.length)
  //   addModule.value.push({
  //     id: addModule.value.length
  //   })
  // },
  // delModule = (index) => {
  //   addModule.value.splice(index, 1)
  //   moduleActiveList.value.splice(index, 1)
  // },
  visible = ref(false),
  censusParams = reactive({}),
  total = ref(0),
  confirmFn = () => {},
  searchFn = () => {},
  handleReset = () => {},
  selectionCensusPChange = () => {},
  getTableData = () => {},
  selectFn = () => {
    visible.value = true
  },
  dictionaryList = ref([])
onMounted(async () => {
  dictionaryList.value = (await dictionary({ type: 'PROJECT_TYPE' })).data
})
</script>

<template>
  <div class="mainBox">
    <el-row>
      <el-col class="leftCol" :span="24">
        <el-collapse v-model="collapseModal">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">基本信息</div>
            </template>
            <el-form
              ref="form1"
              :model="baseForm"
              :rules="baseRules"
              label-position="right"
              label-width="180px"
              label-suffix=":"
            >
              <el-row :gutter="40">
                <el-col :span="12">
                  <el-form-item label="项目名称" prop="num1">
                    <el-input v-model="baseForm.num1" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="是否临时增补" prop="num2">
                    <el-radio-group v-model="baseForm.num2">
                      <el-radio :label="1">是</el-radio>
                      <el-radio :label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="项目负责人" prop="num3">
                    <el-input v-model="baseForm.num3" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="项目负责人手机号" prop="num4">
                    <el-input v-model="baseForm.num4" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="项目联系人" prop="num5">
                    <el-input v-model="baseForm.num5" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="项目联系人手机号" prop="num6">
                    <el-input v-model="baseForm.num6" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="建设单位" prop="num7">
                    <el-input v-model="baseForm.num7" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="建设单位统一信用代码" prop="num8">
                    <el-input v-model="baseForm.num8" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="项目类型" prop="num9">
                    <el-radio-group v-model="baseForm.num9">
                      <el-radio
                        v-for="(item,index) in dictionaryList?.filter(i => i.type === 'PROJECT_TYPE')"
                        :key="index"
                        :label="item.value"
                      >{{ item.label }}</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="是否首次新建" prop="num10">
                    <el-radio-group v-model="baseForm.num10">
                      <el-radio :label="1">是</el-radio>
                      <el-radio :label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="预算年度" prop="num11">
                    <el-date-picker
                      v-model="baseForm.num11"
                      type="year"
                      placeholder="请选择"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="四大体系" prop="num12">
                    <el-select v-model="baseForm.num12" placeholder="请选择">
                      <el-option
                        v-for="(item, index) in fourSystem"
                        :key="index"
                        :label="item"
                        :value="index"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="是否数字化改革项目" prop="num13">
                    <el-radio-group v-model="baseForm.num13">
                      <el-radio :label="1">是</el-radio>
                      <el-radio :label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="综合业务领域" prop="num14">
                    <el-select v-model="baseForm.num14" placeholder="请选择">
                      <el-option
                        v-for="(item, index) in businessTerritory"
                        :key="index"
                        :label="item"
                        :value="index"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="建设层级" prop="num15">
                    <el-radio-group v-model="baseForm.num15">
                      <el-radio
                        v-for="(item, index) in constructionLevel"
                        :key="index"
                        :label="index"
                      >{{ item }}
                      </el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="立项依据材料" prop="num16">
                    <table-list
                      :pagination="pagination"
                      style="width: 100%"
                      :column="column1"
                      :data="projectBasisMaterials"
                      @selection-change="selectionChange"
                    >
                      <template #action>
                        <a>上传</a>
                      </template>
                    </table-list>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="发改编码" prop="num17">
                    <el-input v-model="baseForm.num17" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="财产编码" prop="num18">
                    <el-input v-model="baseForm.num18" maxlength="50" placeholder="请输入" />
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="是否上云" prop="num19">
                    <el-radio-group v-model="baseForm.num19">
                      <el-radio :label="1">是</el-radio>
                      <el-radio :label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="云类型" prop="num20">
                    <el-checkbox-group v-model="baseForm.num20">
                      <el-checkbox label="1">政务云（非信创）</el-checkbox>
                      <el-checkbox label="2">政务云（信创）</el-checkbox>
                      <el-checkbox label="3">其他</el-checkbox>
                    </el-checkbox-group>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="等保级别" prop="num21">
                    <el-radio-group v-model="baseForm.num21">
                      <el-radio
                        v-for="(item, index) in insuranceLevel"
                        :key="index"
                        :label="index"
                      >{{ item }}</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="是否密评" prop="num22">
                    <el-radio-group v-model="baseForm.num22">
                      <el-radio :label="1">是</el-radio>
                      <el-radio :label="2">否</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="项目简介" prop="num23">
                    <el-input
                      v-model="baseForm.num23"
                      :rows="4"
                      type="textarea"
                      placeholder="请输入"
                      maxlength="2000"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal1" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">资金申报情况（单位：万元）</div>
            </template>
            <el-form
              ref="form2"
              :model="capitalForm"
              :rules="capitalRules"
              label-position="right"
              label-width="180px"
              label-suffix=":"
            >
              <el-row>
                <el-col :span="12">
                  <el-form-item label="申报金额" prop="sum1">
                    <el-input-number
                      v-model="capitalForm.sum1"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="自有资金" prop="sum2">
                    <el-input-number
                      v-model="capitalForm.sum2"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="政府投资-本级财政资金" prop="sum3">
                    <el-input-number
                      v-model="capitalForm.sum3"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="政府投资-上级补助资金" prop="sum4">
                    <el-input-number
                      v-model="capitalForm.sum4"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="银行贷款" prop="sum5">
                    <el-input-number
                      v-model="capitalForm.sum5"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="其他资金" prop="sum6">
                    <el-input-number
                      v-model="capitalForm.sum6"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal2" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">总投资分配情况（单位：万元）</div>
            </template>
            <el-form
              ref="form3"
              style="padding-left: 16px"
              :model="totalMoneyForm"
              :rules="totalMoneyRules"
              label-suffix=":"
            >
              <el-row :gutter="10">
                <el-col :span="8">
                  <el-form-item label="软件开发" prop="money1">
                    <el-input-number
                      v-model="totalMoneyForm.money1"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="云资源、硬件配置" prop="money2">
                    <el-input-number
                      v-model="totalMoneyForm.money2"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="第三方服务" prop="money3">
                    <el-input-number
                      v-model="totalMoneyForm.money3"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal3" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">
                年度支付计划（单位：万元）
              </div>
            </template>
            <el-form
              ref="form4"
              style="padding-left: 16px"
              :model="annualPlanForm"
              :rules="annualPlanRules"
              label-position="right"
              label-width="180px"
              label-suffix=":"
            >
              <el-row>
                <el-col :span="12">
                  <el-form-item label="年度支付金额" prop="annualPlan1">
                    <el-input-number
                      v-model="annualPlanForm.annualPlan1"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :span="12">
                  <el-form-item label="自有资金" prop="annualPlan2">
                    <el-input-number
                      v-model="annualPlanForm.annualPlan2"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="政府投资-本级财政资金"
                    prop="annualPlan3"
                  >
                    <el-input-number
                      v-model="annualPlanForm.annualPlan3"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="政府投资-上级补助资金"
                    prop="annualPlan4"
                  >
                    <el-input-number
                      v-model="annualPlanForm.annualPlan4"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="银行贷款" prop="annualPlan5">
                    <el-input-number
                      v-model="annualPlanForm.annualPlan5"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="其他" prop="annualPlan6">
                    <el-input-number
                      v-model="annualPlanForm.annualPlan6"
                      placeholder="请填写"
                      :min="0"
                      :max="99999.999999"
                      :precision="6"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal4" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">
                核心业务
              </div>
            </template>
            <div style="padding-left: 16px">
              <div class="flexRight" style="margin-bottom: 16px">
                <el-button type="primary" @click="selectFn">
                  选择核心业务
                </el-button>
              </div>
              <table-list
                :pagination="pagination"
                style="width: 100%"
                :column="column2"
                :data="coreBusiness"
              />
            </div>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal5" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">
                安全投入
              </div>
            </template>
            <el-form
              ref="form5"
              style="padding-left: 16px"
              :model="safetyInvestmentForm"
              :rules="safetyInvestmentRules"
              label-position="right"
              label-width="100px"
              label-suffix=":"
            >
              <el-row>
                <el-col :span="12">
                  <el-form-item label="投入项" prop="safetyInvestment1">
                    <el-input
                      v-model="safetyInvestmentForm.safetyInvestment1"
                      placeholder="请输入"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="内容描述" prop="safetyInvestment2">
                    <el-input
                      v-model="safetyInvestmentForm.safetyInvestment2"
                      :rows="4"
                      maxlength="2000"
                      type="textarea"
                      placeholder="请输入"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="金额" prop="safetyInvestment3">
                    <el-input-number
                      v-model="safetyInvestmentForm.safetyInvestment3"
                      placeholder="请填写"
                      :min="0"
                      :controls="false"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal6" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">
                附件
              </div>
            </template>
            <el-form
              ref="form6"
              style="padding-left: 16px"
              :model="enclosureForm"
              :rules="enclosureFormRules"
              label-position="right"
              label-width="100px"
              label-suffix=":"
            >
              <el-form-item label="初步方案" prop="preliminaryPlan">
                <el-upload
                  ref="preliminaryPlanRef"
                  v-model:file-list="enclosureForm.fileList1"
                  class="upload-demo"
                  action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
                  multiple
                  :on-preview="handlePreliminaryPlanPreview"
                  :on-remove="handlePreliminaryPlanRemove"
                  :before-upload="beforeUploadHandlePreliminaryPlan"
                  :limit="1"
                  :on-exceed="handlePreliminaryPlanExceed"
                  accept="application/pdf"
                >
                  <el-button plain type="primary">选择文件</el-button>
                  <template #tip>
                    <div class="el-upload__tip">
                      支持PDF文件
                    </div>
                  </template>
                </el-upload>
              </el-form-item>
              <el-form-item
                label="佐证材料"
                prop="supportingMaterials"
              >
                <el-upload
                  v-model:file-list="enclosureForm.fileList2"
                  class="upload-demo"
                  action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
                  multiple
                  :on-preview="handleSupportingMaterialsPreview"
                  :on-remove="handleSupportingMaterialsRemove"
                  :before-upload="beforeUploadHandleSupportingMaterials"
                  :limit="10"
                  accept="application/pdf"
                >
                  <el-button plain type="primary">选择文件</el-button>
                  <template #tip>
                    <div class="el-upload__tip">
                      支持PDF文件
                    </div>
                  </template>
                </el-upload>
              </el-form-item>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <el-collapse v-model="collapseModal7" class="marginTop">
          <el-collapse-item name="1">
            <template #title>
              <div class="collapse-title">
                备注
              </div>
            </template>
            <el-form
              style="padding-left: 16px"
              :model="notesForm"
              :rules="notesFormRules"
              label-position="right"
              label-width="100px"
              label-suffix=":"
            >
              <el-form-item
                label="备注"
                prop="notes"
              ><el-input
                v-model="notesForm.notesTextarea"
                :autosize="{ minRows: 2, maxRows: 4 }"
                maxlength="2000"
                type="textarea"
                placeholder="请填写"
              /> </el-form-item>
            </el-form>
          </el-collapse-item>
        </el-collapse>
        <!-- <div v-if="addModule && addModule.length > 0" class="marginTop">
          <el-collapse
            v-for="(item, index) in addModule"
            :key="item.id"
            v-model="moduleActiveList"
            class="marginTop"
          >
            <el-collapse-item :name="item.id">
              <template #title>
                <div class="flexbetween collapse-title">
                  <div class="flexItem" @click.stop>
                    <el-input
                      v-model="item.moduleName"
                      style="width: 400px"
                      placeholder="请填写模块名称。例如市级有进度计划模块，可如下定义"
                    />
                    &nbsp;&nbsp;
                    <el-input-number
                      v-model="item.sort"
                      placeholder="请填写"
                      :min="1"
                    />
                  </div>
                  <a
                    class="delClass"
                    @click.stop="delModule(index)"
                  >删除模块</a>
                </div>
              </template>
              <el-form
                v-if="item.example"
                style="padding-left: 16px"
                :model="item.form"
                label-position="right"
                label-width="100px"
                label-suffix=":"
              >
                <el-row>
                  <el-col :span="12">
                    <el-form-item
                      label="第一季度"
                      :required="true"
                      :prop="item.dyjd"
                    >
                      <el-input
                        v-model="item.dyjd"
                        readonly
                        placeholder="请输入"
                      />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      :rules="{
                        required: true,
                      }"
                      label="第二季度"
                    >
                      <el-input
                        v-model="item.dejd"
                        readonly
                        placeholder="请输入"
                      />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item
                      :rules="{
                        required: true,
                      }"
                      label="第三季度"
                    >
                      <el-input
                        v-model="item.dsjd"
                        readonly
                        placeholder="请输入"
                      />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item class="btnClass">
                      <div class="btn">增加字段</div>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
              <el-form
                v-else
                :model="item.form"
                style="padding-left: 16px"
                label-position="right"
                label-width="100px"
                label-suffix=":"
              >
                <el-row>
                  <el-col :span="12">
                    <el-form-item v-if="item.form" class="btnClass">
                      <div class="btn">增加字段</div>
                    </el-form-item>
                    <div v-else class="btn fontSize">增加字段</div>
                  </el-col>
                </el-row>
              </el-form>
            </el-collapse-item>
          </el-collapse>
        </div> -->
        <!-- <div class="btn marginTop" @click="addModuleFn">增加模块</div> -->
      </el-col>
    </el-row>
    <div class="bottomBtn flexCenter marginTop">
      <el-button plain type="primary" @click="backToProjectDeclare"> 返回 </el-button>
      <el-button type="primary" @click="submitAllForm"> 提交审核 </el-button>
    </div>
    <el-dialog title="选择核心业务" :model-value="visible" width="700px">
      <el-row style="margin-bottom: 16px" :gutter="20">
        <el-col :span="12">
          <el-input v-model="censusParams.matterName" placeholder="请输入" />
        </el-col>
        <el-col :span="12">
          <div class="flex">
            <el-button type="primary" @click="searchFn">查询</el-button>
            <el-button @click="handleReset">重置</el-button>
          </div>
        </el-col>
      </el-row>
      <table-list
        ref="tableListRef"
        :column="column3"
        :data="data"
        :total="total"
        @selection-change="selectionCensusPChange"
        @get-table-data="getTableData"
      />
      <!-- <a-table
        :row-selection="{
          selectedRowKeys: selectedRowKeys,
          onSelect: onSelect,
          onSelectAll: onSelectAll,
          getCheckboxProps: getCheckboxProps,
        }"
        :columns="businessColumns"
        :data-source="businessList"
        :pagination="false"
      >
        <template #action="text, record"> - </template>
      </a-table> -->
      <!-- <div style="text-align: right; padding-top: 10px">
        <a-button
          type="primary"
          :disabled="!isPrePage"
          style="margin-right: 10px"
          @click="changePage(0)"
        >
          上一页
        </a-button>
        <a-button type="primary" :disabled="!isNextPage" @click="changePage(1)">
          下一页
        </a-button>
      </div> -->
      <template #footer>
        <el-button type="primary" @click="confirmFn"> 提交 </el-button>
        <el-button @click="visible = false"> 关闭 </el-button>
      </template>
    </el-dialog>
  </div>
</template>
<style lang="less" scoped>
.mainBox {
  position: relative;
  padding-bottom: 53px;
}
:deep(.el-collapse) {
  .el-collapse-item__header {
    padding: 0px 16px;
    font-size: 14px;
  }
  .el-collapse-item__content {
    padding: 16px 16px 16px 0px;
    // margin-left: -50px;
  }
  .el-collapse-item__header.is-active {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }
  .collapse-title {
    flex: 1 0 90%;
    order: 1;
    .el-collapse-item__header {
      flex: 1 0 auto;
      order: -1;
    }
    .el-input-number {
      width: 150px !important;
    }
  }
}
.btnClass {
  :deep(.el-form-item__content) {
    line-height: 24px;
  }
}

.marginTop {
  margin-top: 16px;
}
.delClass {
  color: #e65151;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 100, 235, 1);
  width: 100%;
  padding: 2px 0px;
  border-radius: 4px;
  border: 1px solid rgba(0, 100, 235, 1);
  cursor: pointer;
}
.bottomBtn {
  width: calc(100% - 201px);
  position: fixed;
  z-index: 999;
  right: 0px;
  bottom: 0px;
  background: #fff;
  padding: 10px 0px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
</style>
