<script setup>
import feedback from "@/utils/feedback";
import useUserStore from "@/stores/modules/user";
import {timeFormat} from "@/utils/util";
import reportFile from '@/components/reportFile/index.vue';
import useCatchStore from '@/stores/modules/catch'
import {getDetail} from "@/api/report/index";
import {useRoute, useRouter} from "vue-router";
import {getReportFlow} from "@/api/report/flow";
import useTabsStore from "@/stores/modules/multipleTabs";
import {listPolice} from "@/api/system/police";

const {addTab, removeTab, tabList} =
    useTabsStore();
const filesData = ref([])
const props = defineProps(["node","isEnd","id","backPath"]);
const router = useRouter();
const preview = ref(false);
const dialog = ref(false)
const actionRow = ref({})
const userStore = useUserStore();
const catchStore = useCatchStore();
const dict = catchStore.getDicts(["procurementMethod"]);
let formDataRef = ref()
let formReviewRef = ref()
const loading = ref(false)
const route = useRoute();

const endDialog =ref(false)
const isAudit = ref(false)
const isEndData = ref(false)
let activeName = ref("initial")

let formData = ref({
  project: {
    projectType: null,
    node: 'initial'
  },
  files: {
    initial: [],
    exploration: [],
    cross: []
  },
  review: {}
})
const fileDict = ref(
    [
      {
        type: ['服务类', '货物类'],
        fileData: [
          {
            request: true,
            type: "必传附件",
            fileName: "承诺书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "立项批示",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "政府采购计划",
            fileNode: 'initial'
          },
          {
            request: false,
            type: '普通附件',
            fileName: "",
            fileNode: 'initial'
          }
        ]
      },
      {
        type: ['工程类'],
        fileData: [
          {
            request: true,
            type: "必传附件",
            fileName: "承诺书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "立项批示",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "政府采购计划",
            fileNode: 'initial'
          },
          {
            request: false,
            type: '普通附件',
            fileName: "经建设单位签字并盖章后的施工图纸",
            fileNode: 'initial'
          },
          {
            request: false,
            type: '普通附件',
            fileName: "",
            fileNode: 'initial'
          }
        ]
      },
      {
        type: ['信息化类'],
        fileData: [
          {
            request: true,
            type: "必传附件",
            fileName: "承诺书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "立项批示",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "政府采购计划",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "建设方案或功能需求",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "科信部门审计意见",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "",
            fileNode: 'initial'
          }
        ]
      }
    ]
)
const fileEndDict = ref(
    [
      {
        type: ['服务类', '货物类'],
        fileData: [
          {
            request: true,
            type: "必传附件",
            fileName: "承诺书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "立项批示",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "政府采购计划",
            fileNode: 'initial'
          },
          {
            request: false,
            type: '普通附件',
            fileName: "",
            fileNode: 'initial'
          }
        ]
      },
      {
        type: ['工程类'],
        fileData: [
          {
            request: true,
            type: "必传附件",
            fileName: "承诺书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "立项批示",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "政府采购计划",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "合同或协议",
            fileNode: 'initial'
          },
          {
            request: true,
            type: '必传附件',
            fileName: "验收书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: '必传附件',
            fileName: "工程结算清单",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "采购手续",
            fileNode: 'initial'
          },

          {
            request: false,
            type: "普通附件",
            fileName: "经济技术签证单",
            fileNode: 'initial'
          },
          {
            request: false,
            type: '普通附件',
            fileName: "经建设单位签字并盖章后的施工图纸",
            fileNode: 'initial'
          },

          {
            request: false,
            type: '普通附件',
            fileName: "",
            fileNode: 'initial'
          }
        ]
      },
      {
        type: ['信息化类'],
        fileData: [
          {
            request: true,
            type: "必传附件",
            fileName: "承诺书",
            fileNode: 'initial'
          },
          {
            request: true,
            type: "必传附件",
            fileName: "立项批示",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "政府采购计划",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "建设方案或功能需求",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "科信部门审计意见",
            fileNode: 'initial'
          },
          {
            request: false,
            type: "普通附件",
            fileName: "",
            fileNode: 'initial'
          }
        ]
      }
    ]
)



const catchSotre = useCatchStore();
const departs = catchSotre.getDeparts();

const isDisabled = ref(true)
const isAuditButton = ref(false)
const datePicker = ref()
const serviceTime = ref([])
//获取详情
const getDetailFun = async (val) => {

  loading.value = true;

  formData.value = await getDetail({"id": val});

  if (props.isAudit) {
    isAuditButton.value = true
  }

  //编辑
  if (props.isAudit && userStore.user) {
    //一审审计员
    if (formData.value.project.node === 'first') {
      formData.value.review.firstAuditor = userStore.user.nickName;
      rulesDataTwo.value.firstMoney = [
        {required: true, message: '请选择一审金额', trigger: 'blur'},

      ];
      rulesDataTwo.value.firstReduceMoney = [
        {required: true, message: '请选择一审审减金额', trigger: 'blur'},
      ];
      rulesDataTwo.value.firstTime = [
        {required: true, message: '请选择一审日期', trigger: 'blur'},
      ];
      rulesDataTwo.value.firstAuditor = [
        {required: true, message: '请输入一审审计人', trigger: 'blur'}
      ];

    }
    //二审审计员
    if (formData.value.project.node === 'second') {
      formData.value.review.secondAuditor = userStore.user.nickName;
      rulesDataTwo.value.secondMoney = [
        {required: true, message: '请选择二审金额', trigger: 'blur'},
      ];
      rulesDataTwo.value.secondReduceMoney = [
        {required: true, message: '请选择二审审减金额', trigger: 'blur'},
      ];
      rulesDataTwo.value.secondTime = [
        {required: true, message: '请选择二审日期', trigger: 'blur'},
      ];
      rulesDataTwo.value.secondAuditor = [
        {required: true, message: '请输入二审审计人', trigger: 'blur'}
      ];
    }
    // 三审审计员
    if (formData.value.project.node === 'third') {
      formData.value.review.thirdlyAuditor = userStore.user.nickName;
      rulesDataTwo.value.thirdlyMoney = [
        {required: true, message: '请选择三审金额', trigger: 'blur'},

      ];
      rulesDataTwo.value.thirdlyReduceMoney = [
        {required: true, message: '请选择三审审减金额', trigger: 'blur'},
      ];
      rulesDataTwo.value.thirdlyTime = [
        {required: true, message: '请选择三审日期', trigger: 'blur'},
      ];
      rulesDataTwo.value.thirdlyAuditor = [
        {required: true, message: '请输入三审审计人', trigger: 'blur'}
      ];
    }
  }
  await nextTick(() => {
    if (datePicker.value) {
      datePicker.value.handleClose()
    }
  })
  loading.value = false;

}

//审查内容是否允许编辑
const isAuditEdit = (val,label=null) => {
  return false
}
//删除附件
const delFileData = async (row,index) => {
  await feedback.confirm(`确认删除附件数据(必传附件清除附件，普通附件删除)  ？`)
  if(row.request){
    row.fileData =[]
  }else{
    formData.value.files[activeName.value].splice(index,1)
  }
  row.fileData=[]
}
const rulesData = ref({
  reportType: [{required: true, message: '请选择报审类型', trigger: 'blur'}],
  reportName: [{required: true, message: '请输入项目名称', trigger: 'blur'}],
  projectType: [{required: true, message: '请选择项目类别', trigger: 'blur'}],
  auditUnitId: [{required: true, message: '请选择审计单位', trigger: 'blur'}],
  projectUnitId: [{required: true, message: '请选择项目单位', trigger: 'blur'}],
  projectPrincipal: [{required: true, message: '请选择报审类型', trigger: 'blur'}],
  projectPhone: [{required: true, message: '请选择负责人联系方式', trigger: 'blur'}],
  purchaseMethod: [{required: true, message: '请选择采购方式', trigger: 'blur'}],
  reportMoney: [{required: true, message: '请选择报审金额', trigger: 'blur'}],
  projectApprovalMoney: [{required: true, message: '请选择立项金额', trigger: 'blur'}],
  projectApprovalLead: [{required: true, message: '请选择报审领导', trigger: 'blur'}],
  applicant: [{required: true, message: '请输入报审人', trigger: 'blur'}],
  applicantTime: [{required: true, message: '请输入报审日期', trigger: 'blur'}],
  contractTime: [{required: true, message: '请输入合同签订日期', trigger: 'blur'}],
  contractMount: [{required: true, message: '请输入合同金额', trigger: 'blur'}],
  serviceUnit: [{required: true, message: '请输入服务单位', trigger: 'blur'}],
  serviceUnitManager: [{required: true, message: '请输入服务单位负责人', trigger: 'blur'}],
  serviceTime: [{required: true, message: '请输入报审日期', trigger: 'blur'}],
  serviceUnitPhone: [{required: true, message: '请输入服务单位联系电话', trigger: 'blur'}],
  projectApprovalTime: [{required: true, message: '请输入立项日期', trigger: 'blur'}],
  applyGovernmentTime: [{required: true, message: '请选择申报政府采购日期', trigger: 'blur'}],
  purchaseTime: [{required: true, message: '请选择采购日期', trigger: 'blur'}],
})
const rulesDataTwo = ref({
  reviewStatus: [
    {required: true, message: '请输入审计情况', trigger: 'blur'}
  ],
  reviewGist: [
    {required: true, message: '请输入审计依据', trigger: 'blur'}
  ],
  reviewContent: [
    {required: true, message: '请输入审计内容', trigger: 'blur'}
  ],
  isExploration: [
    {required: true, message: '请选择是否勘察', trigger: 'blur'}
  ],
  isCross: [
    {required: true, message: '请选择是否对审', trigger: 'blur'}
  ]
})
const files = ref([])
//关闭弹窗
const closeFile = () => {
  preview.value = false;
}

//获取流程
const reportFlowDialog = ref(false)
const reportFlowTable = ref([])
const  reportFlowLoading = ref(false)
const getReportFlowFun = async () => {
  reportFlowDialog.value = true
  reportFlowLoading.value=true
  const res = await getReportFlow({id:formData.value.project.id,code:'report'});
  reportFlowLoading.value=false
  reportFlowTable.value = res;
}




//获取单位为简称
function getDepartShortName(departData, id, rowName) {
  if (departData) {
    for (let i = 0; i < departData.length; i++) {
      let s = departData[i];
      if (s.id === id) {
        formData.value.project[rowName] = s.shortName;
        break;
      }
      if (s.children) {
        getDepartShortName(s.children, id, rowName)
      }
    }
  }
}
//获取tab名
const handleClick = (tab, event) => {
  activeName.value = tab.props.name
  filesData.value = []
}


//关闭
const closeFun = () => {
  if (props.node) {
    router.push({path:props.backPath})
  } else {
    router.push({path:"/work", query:{"load": true}})
  }
}


//根据输入值获取信息
const inputGetList = (val) => {
  query.value.name = val;
  getPoliceList()
}
//审核人
const query = ref({
  current: 1,
  departBranch: false
});
let polices = ref([])

function getPoliceList() {
  listPolice(query.value).then((data) => {
    polices.value = data.records;
  });
}

getPoliceList()
let date = ref()




//一审、二审、三审是否显示
const isShowFun = (list = []) => {
  if (props.node) {
    if (['Lead', 'original', 'audit'].includes(props.node)) {
      return true
    } else {
      return list.includes(props.node)
    }
  } else {
    if (['Lead', 'original', 'audit'].includes(formData.value.project.node)) {
      return true
    } else {
      return list.includes(formData.value.project.node)
    }
  }
}
//tab是否显示
function FileTabShowFun (){
  let show = true;
  if(!formData.value.project.node){
    return false;
  }
  let data =  formData.value.project.node;
  switch (data){
    case "initial":
    case "review":
      show=false;
      break
    default:
      show=true;
      break
  }

  return show;
}


const emits = defineEmits(["closePageFun"])
//关闭窗口
const closePage =()=>{
  emits("closePageFun",null);
}




//添加附件按钮是否显示
function addFileFun(val) {

  return false;
}
/**
 * 附件上传或删除
 * @param node 按钮所属tab
 * */
function disableFileBtn(node){
  return true

}



//  监控是否为创建
watch(() => props.id, (val) => {
  if(val){
    getDetailFun(val)
  }else{
    useTabsStore().removeTab('/warning/reportDetail', router);
  }
}, {deep: true, immediate: true})
//报审人姓名
watch(()=>formData.value.project.applicantId,(val)=>{
  if(val && polices.value.length > 0 && polices.value.filter(s=>s.idCode === val) > 0){
    formData.value.project.applicant =polices.value.filter(s=>s.idCode === val)[0].name;
  }
},{deep:true,immediate:true})
//监测是否是结算项目报审
watch(() => props.isEnd, (val) => {
  isEndData.value = val === true || val === 'true';
  if (isEndData.value) {
    formData.value.project.reportType = '结算项目'
  } else {
    formData.value.project.reportType = '项目控制价'
  }
}, {deep: true, immediate: true})
//附件列表
watch(() => formData.value.project.projectType, (val) => {
  if (!(props.node || props.isAudit)) {
    let fileDataList = isEndData ? fileEndDict.value : fileDict.value;
    if (val) {
      let data = fileDataList.filter(s => s.type.includes(val))
      formData.value.files.initial = data ? data[0].fileData : fileDataList[0].fileData
    } else {
      formData.value.files.initial = fileDataList[0].fileData
    }
  }
}, {immediate: true, deep: true})
//监测单位，获取单位简称
watch(() => formData.value.project.projectUnitId, (val) => {
  if (val) {
    getDepartShortName(departs, val, 'projectUnit')
  }
}, {immediate: true, deep: true})
//监测审计单位，获取审计单位简称
watch(() => formData.value.project.auditUnitId, (val) => {
  if (val) {
    getDepartShortName(departs, val, 'auditUnit')
  }
}, {immediate: true, deep: true})
</script>

<template>
  <div class="wrapper control-price-page" v-loading="loading">
    <main>
      <el-header>

        <h2 style="text-align: center">{{ isEndData ? '控制价项目报审' : '结算项目报审' }}</h2>
      </el-header>
      <el-main>
        <div class="flex v-center" style="height:30px;margin-bottom: 10px">
          <h5>报审信息</h5>
        </div>
        <div>
          <el-form :loading="loading" :model="formData.project" ref="formDataRef" :rules="rulesData" label-width="140">
            <el-row>
              <el-col :span="6">
                <el-form-item label="报审类型" prop="reportType">
                  <el-select :disabled="isDisabled" v-model="formData.project.reportType">
                    <el-option value="项目控制价" label="项目控制价"></el-option>
                    <el-option value="结算项目" label="结算项目"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="项目名称" prop="reportName">
                  <el-input :disabled="isDisabled" v-model="formData.project.reportName"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="项目类别">
                  <el-select :disabled="isDisabled" v-model="formData.project.projectType">
                    <el-option value="服务类" label="服务类"></el-option>
                    <el-option value="工程类" label="工程类"></el-option>
                    <el-option value="货物类" label="货物类"></el-option>
                    <el-option value="信息化类" label="信息化类"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="审计单位" prop="auditUnitId">
                  <depart-tree-select :auth="false" :disabled="isDisabled" v-model="formData.project.auditUnitId"
                                      :size="'default'" placeholder="" clearable/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item label="项目单位" prop="projectUnitId">
                  <depart-tree-select :auth="false" :disabled="isDisabled" v-model="formData.project.projectUnitId"
                                      :size="'default'" placeholder="" clearable/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="项目负责人" prop="projectPrincipal">
                  <el-input :disabled="isDisabled" v-model="formData.project.projectPrincipal"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="负责人联系方式" prop="projectPhone">
                  <el-input :disabled="isDisabled" v-model="formData.project.projectPhone"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item v-if="isEndData" label="报审金额（元）" prop="reportMoney">
                  <el-input :disabled="isDisabled" type="number" v-model="formData.project.reportMoney"></el-input>
                </el-form-item>
                <el-form-item v-else label="采购方式" prop="purchaseMethod">
                  <el-select :disabled="isDisabled" v-model="formData.project.purchaseMethod">
                    <el-option v-for="(item,index) in dict.procurementMethod" :key="index"
                               :label="item.dictLabel"
                               :value="item.dictValue"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6">
                <el-form-item v-if="isEndData" label="立项日期" prop="projectApprovalTime">
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.projectApprovalTime"
                      style="width: 100%"
                      type="date"
                      placeholder="选择立项日期"
                  />
                </el-form-item>
                <el-form-item v-else label="报审金额（元）" prop="reportMoney">
                  <el-input :disabled="isDisabled" type="number" v-model="formData.project.reportMoney"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="立项金额（元）" prop="projectApprovalMoney">
                  <el-input :disabled="isDisabled" type="number"
                            v-model="formData.project.projectApprovalMoney"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="立项审批领导" prop="projectApprovalLead">
                  <el-input :disabled="isDisabled" v-model="formData.project.projectApprovalLead"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="报审人" prop="applicant">
                  <!--                <el-input :disabled="isDisabled" v-model="formData.project.applicant"></el-input>-->
                  <el-select :disabled="isDisabled" v-model="formData.project.applicantId" :remote-method="inputGetList"
                             filterable>
                    <el-option v-for="(item,index) in polices" :key="index" :value="item.idCode"
                               :label="item.name"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="6" v-if="isEndData">
                <el-form-item label="申报政府采购日期" prop="applyGovernmentTime">
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.applyGovernmentTime"
                      style="width: 100%"
                      type="date"
                      placeholder="选择申报政府采购日期"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="isEndData">
                <el-form-item label="采购方式" prop="purchaseMethod">
                  <el-select :disabled="isDisabled" v-model="formData.project.purchaseMethod">
                    <el-option v-for="(item,index) in dict.procurementMethod" :key="index"
                               :label="item.dictLabel"
                               :value="item.dictValue"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="isEndData">
                <el-form-item label="采购日期" prop="purchaseTime">
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.purchaseTime"
                      style="width: 100%"
                      type="date"
                      placeholder="选择采购日期"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="报审日期" prop="applicantTime">
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.applicantTime"
                      style="width: 100%"
                      type="date"
                      placeholder="选择报审日期"
                  />
                </el-form-item>
              </el-col>
              <el-col v-if="!isEndData && !isAuditEdit(['original','audit'],'文号')" :span="6">
                <el-form-item label="文号" >
                  <el-input  :disabled="isDisabled" v-model="formData.project.referenceNumber" />
                </el-form-item>
              </el-col>
              <el-col v-if="!isEndData && !isAuditEdit(['original','audit'],'发文日期')" :span="6">
                <el-form-item label="发文日期" >
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.publicationDate"
                      style="width: 100%"
                      type="date"
                      placeholder="选择发文日期"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-if="isEndData">
              <el-col :span="6">
                <el-form-item label="合同签订日期" prop="contractTime">
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.contractTime"
                      style="width: 100%"
                      type="date"
                      placeholder="选择报合同签订日期"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="合同金额" prop="contractMount">
                  <el-input :disabled="isDisabled" type="number" v-model="formData.project.contractMount"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="服务单位" prop="serviceUnit">
                  <el-input :disabled="isDisabled" v-model="formData.project.serviceUnit"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="服务单位负责人" prop="serviceUnitManager">
                  <el-input :disabled="isDisabled" v-model="formData.project.serviceUnitManager"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row v-if="isEndData">
              <el-col :span="6">
                <el-form-item label="服务日期" prop="serviceTime">
                  <el-date-picker
                      ref="datePicker"
                      :disabled="isDisabled"
                      v-model="formData.project.serviceTime"
                      type="daterange"
                      range-separator="-"
                      start-placeholder="开始服务日期"
                      end-placeholder="结束服务日期"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="服务单位联系电话" prop="serviceUnitPhone">
                  <el-input :disabled="isDisabled" v-model="formData.project.serviceUnitPhone"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="!isAuditEdit(['original','audit'])">
                <el-form-item label="文号" >
                  <el-input  :disabled="isDisabled" v-model="formData.project.referenceNumber" />
                </el-form-item>
              </el-col>
              <el-col :span="6" v-if="!isAuditEdit(['original','audit'])">
                <el-form-item label="发文日期" >
                  <el-date-picker
                      :disabled="isDisabled"
                      v-model="formData.project.publicationDate"
                      style="width: 100%"
                      type="date"
                      placeholder="选择发文日期"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <hr style="border-color: rgba(232,232,232,0.67);opacity: 0.2">
        <div class="flex v-center" style="height:30px;margin-bottom: 10px">
          <h5>审计信息</h5>
        </div>
        <el-form
            v-if="!(['initial','review'].includes(formData.project.node) || ['initial','review'].includes(props.node))"
            :model="formData.review" ref="formReviewRef" :rules="rulesDataTwo" label-width="160">
          <!--        一审  -->
          <el-row :gutter="20" v-if="isShowFun(['first','second','third', 'end']) ">
            <el-col :span="6">
              <el-form-item label="一审金额(元)" prop="firstMoney">
                <el-input :disabled="isDisabled" type="number" v-model="formData.review.firstMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="一审审减金额(元)" prop="firstReduceMoney">
                <el-input :disabled="isDisabled" type="number"
                          v-model="formData.review.firstReduceMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="一审日期" prop="firstTime">
                <el-date-picker :disabled="isDisabled"
                                v-model="formData.review.firstTime"
                                style="width: 100%"
                                type="date"
                                placeholder="选择一审日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="一审审计员" prop="firstAuditor">
                <el-input :disabled="isDisabled" v-model="formData.review.firstAuditor"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <!--        二审-->
          <el-row :gutter="20" v-if="isShowFun(['second','third', 'end'])">
            <el-col :span="6 ">
              <el-form-item label="二审金额(元)" prop="secondMoney">
                <el-input :disabled="isDisabled" type="number"
                          v-model="formData.review.secondMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="二审审减金额(元)" prop="secondReduceMoney">
                <el-input :disabled="isDisabled" type="number"
                          v-model="formData.review.secondReduceMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="二审日期" prop="secondTime">
                <el-date-picker
                    :disabled="isDisabled"
                    v-model="formData.review.secondTime"
                    style="width: 100%"
                    type="date"
                    placeholder="选择二审日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="二审审计员" prop="secondAuditor">
                <el-input :disabled="isDisabled" v-model="formData.review.secondAuditor"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <!--        三审-->
          <el-row :gutter="20" v-if="isShowFun(['third', 'end'])">
            <el-col :span="6">
              <el-form-item label="三审金额(元)" prop="thirdlyMoney">
                <el-input :disabled="isDisabled" type="number"
                          v-model="formData.review.thirdlyMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="三审审减金额(元)" prop="thirdlyReduceMoney">
                <el-input :disabled="isDisabled" type="number"
                          v-model="formData.review.thirdlyReduceMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="三审日期" prop="thirdlyTime">
                <el-date-picker
                    :disabled="isDisabled"
                    v-model="formData.review.thirdlyTime"
                    style="width: 100%"
                    type="date"
                    placeholder="选择三审日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="三审审计员" prop="thirdlyAuditor">
                <el-input :disabled="isDisabled" v-model="formData.review.thirdlyAuditor"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <!--审查依据-->
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="审计情况" prop="reviewStatus">
                <el-input :disabled="isDisabled" type="textarea" :rows="5"
                          v-model="formData.review.reviewStatus"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="审计依据" prop="reviewGist">
                <el-input :disabled="isDisabled" type="textarea" :rows="5"
                          v-model="formData.review.reviewGist"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <!--审查内容-->
          <el-row :gutter="20">
            <el-col>
              <el-form-item label="审计内容" prop="reviewContent">
                <el-input :disabled="isDisabled" type="textarea" :rows="5"
                          v-model="formData.review.reviewContent"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="勘察情况" prop="isExploration">
                <el-radio-group :disabled="isDisabled"
                                v-model="formData.review.isExploration">
                  <el-radio value="1">已勘察</el-radio>
                  <el-radio value="2">未勘察</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="对审情况" prop="isCross">
                <el-radio-group :disabled="isDisabled" v-model="formData.review.isCross">
                  <el-radio value="1">已对审</el-radio>
                  <el-radio value="2">未对审</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>

        </el-form>

        <div class="table-container">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="报审附件" name="initial"></el-tab-pane>
            <el-tab-pane v-if="FileTabShowFun()" label="审计附件" name="audit"></el-tab-pane>
            <el-tab-pane v-if="formData.review?.isExploration === '1'" label="勘察附件" name="exploration"></el-tab-pane>
            <el-tab-pane v-if="formData.review?.isCross === '1'" label="对审附件" name="cross"></el-tab-pane>
          </el-tabs>
          <el-table :data="formData.files[activeName]" preserve-expanded-content >
            <el-table-column type="expand">
              <template #default="props">
                <div v-if="props.row?.fileData">
                  <file-list   v-model:files="props.row.fileData" :removeEnable="false"></file-list>
                </div>
                <div v-else>
                  <p style="color: darkgray;text-align: center">无附件</p>
                </div>
              </template>
            </el-table-column>
            <el-table-column width="50" type="index" label="序号" :index="(index)=> index+1"></el-table-column>
            <el-table-column label="附件类型" prop="type" width="100"></el-table-column>
            <el-table-column label="上传" width="150">
              <template #default="{$index,row}">
                <el-button type="primary" :disabled="disableFileBtn(activeName)"
                >上传
                  <template #icon>
                    <icon name="el-icon-upload-filled"/>
                  </template>
                </el-button>
              </template>
            </el-table-column>
            <el-table-column label="删除" width="100">
              <template #default="{row,$index}">
                <el-button type="default" :disabled="disableFileBtn(activeName)"  @click="delFileData(row,$index)">删除
                </el-button>
              </template>
            </el-table-column>
            <el-table-column label="资料名称" prop="fileName" width="140"></el-table-column>
            <el-table-column label="文件上传情况" prop="name" min-width="180" show-overflow-tooltip>
              <template #default="{row}" >
                {{row.fileData?(row.fileData.length > 0?'已上传':'未上传'):'未上传'}}
              </template>
            </el-table-column>
            <el-table-column label="上传人" width="120" prop="crtUser"></el-table-column>
            <el-table-column label="上传时间" width="170" prop="crtTime"></el-table-column>

          </el-table>

        </div>
        <div class="flex end mt-20" >
          <el-button type="danger" @click="closePage">关闭</el-button>
        </div>

      </el-main>
    </main>
  </div>

  <el-dialog v-model="reportFlowDialog" title="审批记录" width="80vw">
    <div class="table-container">
      <el-table :data="reportFlowTable" v-loading="reportFlowLoading">
        <el-table-column width="50" type="index" label="序号" :index="(index)=> index+1"></el-table-column>
        <el-table-column label="操作" prop="reportCode"></el-table-column>
        <el-table-column label="办理人" prop="approver"></el-table-column>
        <el-table-column label="提交时间" prop="areportTime">
          <template #default="{row}">
            {{ timeFormat(row.areportTime,'yyyy-mm-dd hh:MM:ss') }}
          </template>
        </el-table-column>
        <el-table-column label="完成时间" prop="approverTime">
          <template #default="{row}">
            {{ timeFormat(row.approverTime,'yyyy-mm-dd hh:MM:ss') }}
          </template>
        </el-table-column>
        <el-table-column label="办理结果" prop="approverState">
          <template #default="{row}">
            <el-tag type="primary" v-if="row.approverState === '开始'">开始</el-tag>
            <el-tag type="success" v-if="row.approverState === '结束'">完成</el-tag>
            <el-tag type="danger" v-if="row.approverState === '驳回'">驳回</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="办理意见" prop="approverMessage" show-overflow-tooltip></el-table-column>
        <el-table-column label="办理状态" prop="approverState"></el-table-column>
      </el-table>
    </div>
  </el-dialog>




  <report-file :preview="preview" :activeFile="actionRow" @closeFile="closeFile"/>
</template>

<style  lang="scss">
.el-table .el-table__cell{
  position: initial !important;
}

.control-price-page {
  --el-disabled-bg-color: #ffffff;
  --el-disabled-text-color: #000000;
  --el-border-color-disabled: #dcdfe6;

  .el-input.is-disabled .el-input__wrapper {
    background-color: #ffffff !important;
    box-shadow: 0 0 0 1px var(--el-border-color) inset;
  }

  .el-input.is-disabled .el-input__inner {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
  }

  .el-select.is-disabled .el-select__wrapper,
  .el-select .el-select__wrapper.is-disabled {
    background-color: #ffffff !important;
    border-color: #dcdfe6 !important;
    color: #000000 !important;
    cursor: default !important;
  }

  .el-select.is-disabled .el-select__selected-item,
  .el-select.is-disabled .el-input__inner {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
  }

  .el-date-editor.is-disabled .el-input__wrapper {
    background-color: #ffffff !important;
  }

  .el-date-editor.is-disabled .el-input__inner {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
  }

  .el-textarea.is-disabled .el-textarea__inner {
    background-color: #ffffff !important;
    color: #000000 !important;
  }

  .el-radio.is-disabled .el-radio__label {
    color: #000000 !important;
  }

  .el-select.is-disabled,
  .el-select.is-disabled *,
  .el-input.is-disabled,
  .el-input.is-disabled * {
    cursor: default !important;
  }
}
</style>
