<template>

  <div class="h5-container">
    <van-nav-bar title="台账详情" @click-left="onClickLeft">
    </van-nav-bar>
    <van-button v-if="nextStepFlag!==1" type="primary" @click="onDateConfirmPlanPre">上一步</van-button>
    <van-form @submit="baocun" ref="formRef">
      <van-field
        border
        readonly
        v-model="form.projectName"
        label="项目名称"
        :colon="true"
        placeholder=""
        required
        auto-size
      />
      <van-field
        border
        readonly
        v-model="form.projectLeader"
        label="项目经理"
        :colon="true"
        placeholder=""
        required
      />

      <van-field
        border
        readonly
        v-model="form.phone"
        label="联系电话"
        :colon="true"
        placeholder=""
        required
        auto-size
      />

      <van-field
        border
        readonly
        v-model="form.dept"
        label="责任部门"
        :colon="true"
        placeholder=""
        required
        auto-size
      />

      <van-field
        border
        readonly
        v-model="form.projectSafePerson"
        label="项目安全员"
        :colon="true"
        placeholder=""
        required
        auto-size
      />

      <van-field
        border
        readonly
        v-model="form.projectPeople"
        label="项目成员"
        :colon="true"
        placeholder=""
        required
        auto-size
      />

      <van-field
        :colon="true"
        readonly
        label="是否使用相关方"
        label-width="200"
      ></van-field>
      <van-radio-group disabled v-model="form.companyYon" direction="horizontal">
        <van-radio style="margin-bottom: 11px;margin-left: 20px;" name="是">是</van-radio>
        <van-radio style="margin-bottom: 11px;margin-left: 20px;" name="否">否</van-radio>
      </van-radio-group>

      <van-field
        v-if="form.companyYon==='是'"
        border
        readonly
        v-model="form.contractorPerson"
        label="相关方负责人"
        :colon="true"
        placeholder=""
        auto-size
        label-width="150px"
      />

      <van-field
        v-if="form.companyYon==='是'"
        border
        v-model="form.contractorName"
        label="相关方单位名称"
        readonly
        :colon="true"
        placeholder=""
        auto-size
        label-width="150px"
      />

      <van-field
        v-if="form.companyYon==='是'"
        border
        v-model="form.contractorPhone"
        readonly
        label="相关方联系电话"
        :colon="true"
        placeholder=""
        auto-size
        label-width="150px"
      />

      <van-field
        v-if="form.companyYon==='是'"
        readonly
        border
        v-model="form.contractorSiteSupervisor"
        label="现场负责人"
        :colon="true"
        placeholder="请输入现场负责人"
        required
        :rules="[{ required: true, message: '请输入' }]"
        label-width="150px"
      />
      <van-field
        v-if="form.companyYon==='是'"
        readonly
        border
        v-model="form.contractorPeople"
        label="相关方人员"
        :colon="true"
        placeholder="请输入相关方人员"
        required
        :rules="[{ required: true, message: '请输入' }]"
        label-width="150px"
      />
      <van-field
        v-if="form.companyYon==='是'"
        readonly
        border
        label="证件"
        :colon="true"
        placeholder=""
        label-width="100px"
      />
      <AttachmentS3Image :plus-icon="false" :readonly="true" v-if="form.companyYon==='是'" :f-id="form.contractorPeopleCard" />

      <van-field
        border
        label="甲方安全协议"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" :f-id="form.ownerAgreement" />

      <van-field
        border
        label="施工方案"
        :colon="true"
        readonly
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" :f-id="form.constructionPlan" />

      <van-field
        border
        label="安全教育培训记录"
        :colon="true"
        placeholder=""
        label-width="120px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" :f-id="form.studyRecord" />

      <van-field
        border
        label="安全交底"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" :f-id="form.safetyDisclose" />

      <van-field
        border
        label="人员信息"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" :f-id="form.personInformation" />

      <van-field
        v-if="form.companyYon==='是'"
        border
        label="相关方单位资质审核材料"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" v-if="form.companyYon==='是'" :f-id="form.contractor" />

      <van-field
        v-if="form.companyYon==='是'"
        border
        label="相关方安全协议"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" v-if="form.companyYon==='是'" :f-id="form.contractorAgreement" />

      <van-field
        v-if="form.companyYon==='是'"
        border
        label="人员保险"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" v-if="form.companyYon==='是'" :f-id="form.personInsurance" />

      <van-field
        v-if="form.companyYon==='是'"
        border
        label="体检报告"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" v-if="form.companyYon==='是'" :f-id="form.testReport" />

      <van-field
        border
        label="其他附件"
        :colon="true"
        placeholder=""
        label-width="100px"
        type="textarea"
        auto-size
      />
      <AttachmentS3 :plus-icon="false" :readonly="true" :f-id="form.otherFile" />
      
      <van-button block round plain type="default" @click="qvxiao">
        取消
      </van-button>
      <div style="height: 10px;"></div>
    </van-form>
  </div>
</template>

<script setup>
import { getUUID } from '@/axios/crypto.js';
import { ref, reactive, onMounted, getCurrentInstance, nextTick, toRaw } from 'vue';
import { closeToast, Dialog, showDialog, showFailToast, showLoadingToast, showSuccessToast, showToast } from 'vant';
import AttachmentS3Image from '@/components/AttachmentS3ImageSY.vue';
import AttachmentS3 from '@/components/AttachmentS3.vue';
import OrganizationalWithLeafUserOne from '@/components/OrganizationalWithLeafUserOne.vue';
import OrganizationalWithLeafUser from '@/components/OrganizationalWithLeafUserSpecialWork.vue';
import OrganizationalWithLeaf from '@/components/OrganizationalWithLeaf.vue';

const { proxy } = getCurrentInstance();

const onClickLeft = () => {
  history.back();
};

const deptCode = ref('');
const dangerPoints = ref([]);
const safeMeasures = ref([]);
onMounted(async () => {

  deptCode.value = JSON.parse(localStorage.getItem('dept'))[0].deptCode;
  
  // form.value.id = '';
  form.value = proxy.$route.query;
  if (form.value.id) {
    var url = '/sgsafe/Project/queryOneById';
    var param = {
      id: form.value.id
    };
    await proxy.$axios.get(url, param).then(response => {
      if (response.data.code === 0) {
        form.value = response.data.data;
      } else {
        showToast({
          message: '操作失败！' + response.data.msg
        });
      }
    });
  }
});

const getTimeFormatter = (date) => {
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始，需加 1
  const day = String(date.getDate()).padStart(2, '0');
  const hours = String(date.getHours()).padStart(2, '0');
  const minutes = String(date.getMinutes()).padStart(2, '0');
  const seconds = String(date.getSeconds()).padStart(2, '0');
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
};


const formRef = ref(null);
const qvxiao = () => {

  showToast({
    type: 'fail',
    message: '操作取消！'
  });
  onClickLeft();
};

//提交审批流程
import { workflowSubmit, workflowCancel } from '@/tools/workflow.js';
import HandwrittenSignature from '@/components/HandwrittenSignature.vue';
import HandwrittenSignatureLook from '@/components/HandwrittenSignatureLook.vue';

const flowId = ref('');
const jsons = ref([]);
flowId.value = 'ProjectSingnatureQun';
const baocun = () => {
  if (form.value.id !== '') {
    form.value.dangerPoint = checkboxDangerPoint.value.toString();
    form.value.safeMeasure = checkboxSafeMeasure.value.toString();
  }

  console.log('保存的参数', form.value);
  // 原有保存逻辑保持不变
  var url = 'sgsafe/ProjectWork/save';
  var param = {
    json: JSON.stringify(form.value)
  };
  proxy.$axios.post(url, param).then(response => {
    if (response.data.code == 0) {
      showToast({
        type: 'success',
        message: '保存成功！'
      });

      form.value = response.data.data;
      nextStepFlag.value++;
      if (nextStepFlag.value === 11) {
        nextStepFlag.value = 0;
        onClickLeft();
      }
      if (nextStepFlag.value === 4) {

        jsons.value = {
          singnatrueQunPerson: form.value.chaoSongPerson
        };

        // 处理函数
        function processValue(value) {
          // 将逗号替换为分号
          const replacedValue = value.replace(/,/g, ';');
          // 分割值
          const parts = replacedValue.split(';');
          // 每个部分前加上 U_
          const processedParts = parts.map(part => `U_${part.trim()}`);
          // 重新组合
          return processedParts.join(';');
        }

        // 处理整个对象
        const processedData = {};
        for (const key in jsons.value) {
          if (jsons.value.hasOwnProperty(key)) {
            processedData[key] = processValue(jsons.value[key]);
          }
        }

        console.log('对象', toRaw(processedData));

        let b = {
          singnatrueQunPerson: processedData.singnatrueQunPerson,
          id: form.value.id
        };

        const aaa = JSON.stringify(toRaw(b));
        sessionStorage.setItem('variables', aaa);
        console.log('aaa', aaa);

        flowId.value = 'ProjectSingnatureQun';

        console.log('----');
        console.log('flowData', form.value);
        console.log(flowId.value);
        console.log(sessionStorage.getItem('variables'));
        // 不弹出提示框，直接执行提交逻辑
        workflowSubmit(
          flowId.value,
          '风险告知人抄送',
          '初始化提交',
          sessionStorage.getItem('variables'),
          form.workId2,
          form.trackId2
        ).then((result) => {
          if (result.status === 'success') {
            // 将结果返回的workId和trackId保存
            var url = 'sgsafe/ProjectWork/saveProcessInfo2';
            var process = {
              'id': form.value.id,
              'workId': result.workId,
              'trackId': result.trackId
            };
            var param = {
              json: JSON.stringify(process)
            };
            proxy.$axios.post(url, param).then(response => {
              if (response.data.code === 0) {
                form.value = response.data.data;
                console.log('保存成功');
                showToast({
                  type: 'success',
                  message: ''
                });
                sendMessage(form.value.chaoSongPerson, '风险告知人抄送', 'projectManage/todo_detail/index2?id=' + form.value.id);
                onRefresh();
              }
            });
          } else {
            showToast({
              type: 'error',
              message: '提交审批失败，' + result.msg
            });
          }
        }).catch((error) => {
          // 捕获workflowSubmit执行过程中的错误（如接口调用失败等）
          showToast({
            type: 'error',
            message: '提交过程出错：' + (error.message || '未知错误')
          });
        });

      }
    } else {
      showToast({
        type: 'fail',
        message: '操作失败！'
      });
    }
  });
};
const sendMessage = (id,userId, content, routing) =>{
  var url = 'sgsafe/ProjectWork/sendMessageProjectWork2';
  var param = {
    params:JSON.stringify({
      id,
      userId,
      content,
      routing
    })
  };
  proxy.$axios.post(url, param).then(response => {
    if (response.data.code==0){
      showToast({
        type: 'success',
        message: '发送成功'
      });
    }
  });
}

const guid = () => {
  function S4() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  }

  return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4());
};

const headers = ref({
  token: localStorage.getItem('token'),
  userId: localStorage.getItem('userId')
});

/*********项目作业管理*******************/

//项目名称选择
const projectNames = ref([]);
const showProjectNamePicker = ref(false);
const onConfirmProjectName = ({ selectedOptions }) => {
  showProjectNamePicker.value = false;
  console.log('选择内容', selectedOptions);
  form.value.projectId = selectedOptions[0].value;
  form.value.projectName = selectedOptions[0].text;
  form.value.projectLeader = selectedOptions[0].projectLeader;
  form.value.projectLeaderCode = selectedOptions[0].projectLeaderCode;
  form.value.projectSafePerson = selectedOptions[0].projectSafePerson;
  form.value.projectSafePersonCode = selectedOptions[0].projectSafePersonCode;
  console.log('选择的内容', form.value);
};
const getProjectNames = () => {
  var url = '/sgsafe/Project/queryProjectNames';
  var param = {};
  proxy.$axios.get(url, param).then(response => {
    if (response.data.code === 0) {
      let a = response.data.data;
      a.forEach(e => {
        projectNames.value.push({
          value: e.id,
          text: e.projectName,
          projectLeader: e.projectLeader,
          projectLeaderCode: e.projectLeaderCode,
          projectSafePerson: e.projectSafePerson,
          projectSafePersonCode: e.projectSafePersonCode
        });
      });
    } else {
      showToast({
        type: 'fail',
        message: '操作失败' + response.data.msg
      });
    }
  });
};

/**表单*/
const form = ref({
  id: '',
  projectName: '',
  projectId: '',
  projectLeader: '',
  projectLeaderCode: '',
  workName: '',
  workDesc: '',
  timeStart: '',
  planEnd: '',
  realEnd: '',
  specialPerson: '',
  specialPersonCode: '',
  specialCard: '',

  dangerPoint: '',
  safeMeasure: '',
  ownerTime: '',
  ownerSignatureStart: '',
  protectClothin: '',
  specialType: '',
  specialPhoto: '',

  startPhoto: '',
  endPhoto: '',
  otherSignatureEnd: '',
  ownerSignatureEnd: '',
  leaderSignatureEnd: '',
  otherQuestion: '',

  projectSafePerson: '',
  projectSafePersonCode: ''
});

//最大最小日期
const minDate = ref();
const maxDate = ref();

//开始时间
const showDatetimePickerStart = ref(false);
const currentDateStart = ref();
const currentTimeStart = ref();
const dateOrTimeStart = ref(false);
const onDateConfirmStart = () => {
  // 日期选择确认后的处理
  dateOrTimeStart.value = true;
};

const resetDatetimeStart = () => {
  dateOrTimeStart.value = false;

  // 初始化日期和时间
  if (form.value.timeStart) {
    const dt = new Date(form.value.timeStart);
    currentDateStart.value = [dt.getFullYear(), dt.getMonth() + 1, dt.getDate()];
    currentTimeStart.value = [
      String(dt.getHours()).padStart(2, '0'),
      String(dt.getMinutes()).padStart(2, '0'),
      String(dt.getSeconds()).padStart(2, '0')
    ];
  } else {
    const now = new Date();
    currentDateStart.value = [now.getFullYear(), now.getMonth() + 1, now.getDate()];
    currentTimeStart.value = [
      String(now.getHours()).padStart(2, '0'),
      String(now.getMinutes()).padStart(2, '0'),
      String(now.getSeconds()).padStart(2, '0')
    ];
  }
};
const onConfirmDatetimeStart = () => {
  const year = currentDateStart.value[0];
  const month = currentDateStart.value[1].toString().padStart(2, '0');
  const day = currentDateStart.value[2].toString().padStart(2, '0');
  const hours = currentTimeStart.value[0].toString().padStart(2, '0');
  const minutes = currentTimeStart.value[1].toString().padStart(2, '0');
  const seconds = currentTimeStart.value[2].toString().padStart(2, '0');

  form.value.timeStart = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  showDatetimePickerStart.value = false;
  dateOrTimeStart.value = false;
};
// 日期选择器取消
const cancelDatePickerStart = () => {
  showDatetimePickerStart.value = false;
  resetDatetimeStart();
};

// 时间选择器取消
const cancelTimePickerStart = () => {
  resetDatetimeStart();
  // 重置为当前时间或从表单获取时间
  if (form.value.timeStart) {
    const dt = new Date(form.value.timeStart);
    currentTimeStart.value = [
      String(dt.getHours()).padStart(2, '0'),
      String(dt.getMinutes()).padStart(2, '0'),
      String(dt.getSeconds()).padStart(2, '0')
    ];
  } else {
    const now = new Date();
    currentTimeStart.value = [
      String(now.getHours()).padStart(2, '0'),
      String(now.getMinutes()).padStart(2, '0'),
      String(now.getSeconds()).padStart(2, '0')
    ];
  }
};

//计划结束时间
const showDatetimePickerPlan = ref(false);
const currentDatePlan = ref();
const currentTimePlan = ref();
const dateOrTimePlan = ref(false);
const onDateConfirmPlan = () => {
  // 日期选择确认后的处理
  dateOrTimePlan.value = true;
};

const resetDatetimePlan = () => {
  dateOrTimePlan.value = false;

  // 初始化日期和时间
  if (form.value.planEnd) {
    const dt = new Date(form.value.planEnd);
    currentDatePlan.value = [dt.getFullYear(), dt.getMonth() + 1, dt.getDate()];
    currentTimePlan.value = [
      String(dt.getHours()).padStart(2, '0'),
      String(dt.getMinutes()).padStart(2, '0'),
      String(dt.getSeconds()).padStart(2, '0')
    ];
  } else {
    const now = new Date();
    currentDatePlan.value = [now.getFullYear(), now.getMonth() + 1, now.getDate()];
    currentTimePlan.value = [
      String(now.getHours()).padStart(2, '0'),
      String(now.getMinutes()).padStart(2, '0'),
      String(now.getSeconds()).padStart(2, '0')
    ];
  }
};
const onConfirmDatetimePlan = () => {
  const year = currentDatePlan.value[0];
  const month = currentDatePlan.value[1].toString().padStart(2, '0');
  const day = currentDatePlan.value[2].toString().padStart(2, '0');
  const hours = currentTimePlan.value[0].toString().padStart(2, '0');
  const minutes = currentTimePlan.value[1].toString().padStart(2, '0');
  const seconds = currentTimePlan.value[2].toString().padStart(2, '0');

  form.value.planEnd = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  showDatetimePickerPlan.value = false;
  dateOrTimePlan.value = false;
};
// 日期选择器取消
const cancelDatePickerPlan = () => {
  showDatetimePickerPlan.value = false;
  resetDatetimePlan();
};

// 时间选择器取消
const cancelTimePickerPlan = () => {
  resetDatetimePlan();
  // 重置为当前时间或从表单获取时间
  if (form.value.planEnd) {
    const dt = new Date(form.value.planEnd);
    currentTimePlan.value = [
      String(dt.getHours()).padStart(2, '0'),
      String(dt.getMinutes()).padStart(2, '0'),
      String(dt.getSeconds()).padStart(2, '0')
    ];
  } else {
    const now = new Date();
    currentTimePlan.value = [
      String(now.getHours()).padStart(2, '0'),
      String(now.getMinutes()).padStart(2, '0'),
      String(now.getSeconds()).padStart(2, '0')
    ];
  }
};

//特种工作人员
const specialPersonKey = guid();
const PopupDepartmentSpecialPerson = ref();
const handleDepartmentSpecialPerson = () => {
  PopupDepartmentSpecialPerson.value.open();
};

const codeAndDescSpecialPerson = ref([]);
const getDepartmentSpecialPerson = (items) => {
  console.log('人员数据', items);
  let codeList = [];
  let descList = [];
  for (let item of items) {
    codeAndDescSpecialPerson.value.push(item.userCode + '-' + item.userDesc);
    codeList.push(item.userCode);
    descList.push(item.userDesc);
  }
  form.value.specialPersonCode = codeList.join(',');
  var url = '/sgsafe/Project/querySpecialCardFileByUserCode';
  var param = {
    userCode:form.value.specialPersonCode
  };
  proxy.$axios.get(url,param).then(response => {
    if (response.data.code===0){
      form.value.specialCard = response.data.data.cardFile
    }else{
      showToast({
        message: '操作失败！'+response.data.message,
      })
    }

  })
  form.value.specialPerson = descList.join(',');
};

//复选
const checkboxDangerPoint = ref([]);
const checkboxSafeMeasure = ref([]);

//控制是否需要管理单位签字
const ownerSignFlag = ref('false');

//管理单位许可作业时间
const showDatetimePickerOwner = ref(false);
const currentDateOwner = ref();
const currentTimeOwner = ref();
const dateOrTimeOwner = ref(false);
const onDateConfirmOwner = () => {
  // 日期选择确认后的处理
  dateOrTimeOwner.value = true;
};

const resetDatetimeOwner = () => {
  dateOrTimeOwner.value = false;

  // 初始化日期和时间
  if (form.value.ownerTime) {
    const dt = new Date(form.value.ownerTime);
    currentDateOwner.value = [dt.getFullYear(), dt.getMonth() + 1, dt.getDate()];
    currentTimeOwner.value = [
      String(dt.getHours()).padStart(2, '0'),
      String(dt.getMinutes()).padStart(2, '0'),
      String(dt.getSeconds()).padStart(2, '0')
    ];
  } else {
    const now = new Date();
    currentDateOwner.value = [now.getFullYear(), now.getMonth() + 1, now.getDate()];
    currentTimeOwner.value = [
      String(now.getHours()).padStart(2, '0'),
      String(now.getMinutes()).padStart(2, '0'),
      String(now.getSeconds()).padStart(2, '0')
    ];
  }
};
const onConfirmDatetimeOwner = () => {
  const year = currentDateOwner.value[0];
  const month = currentDateOwner.value[1].toString().padStart(2, '0');
  const day = currentDateOwner.value[2].toString().padStart(2, '0');
  const hours = currentTimeOwner.value[0].toString().padStart(2, '0');
  const minutes = currentTimeOwner.value[1].toString().padStart(2, '0');
  const seconds = currentTimeOwner.value[2].toString().padStart(2, '0');

  form.value.ownerTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  showDatetimePickerOwner.value = false;
  dateOrTimeOwner.value = false;
};
// 日期选择器取消
const cancelDatePickerOwner = () => {
  showDatetimePickerOwner.value = false;
  resetDatetimeOwner();
};

// 时间选择器取消
const cancelTimePickerOwner = () => {
  resetDatetimeOwner();
  // 重置为当前时间或从表单获取时间
  if (form.value.ownerTime) {
    const dt = new Date(form.value.ownerTime);
    currentTimeOwner.value = [
      String(dt.getHours()).padStart(2, '0'),
      String(dt.getMinutes()).padStart(2, '0'),
      String(dt.getSeconds()).padStart(2, '0')
    ];
  } else {
    const now = new Date();
    currentTimeOwner.value = [
      String(now.getHours()).padStart(2, '0'),
      String(now.getMinutes()).padStart(2, '0'),
      String(now.getSeconds()).padStart(2, '0')
    ];
  }
};

//控制是否需要携带特种防护器具
const specialToolFlag = ref('false');

//特种防护器具类型
const specialTypes = ref([
  { value: '头部护具类', text: '头部护具类' },
  { value: '呼吸护具类', text: '呼吸护具类' },
  { value: '眼（面）护具类', text: '眼（面）护具类' },
  { value: '防护服类', text: '防护服类' },
  { value: '防护鞋类', text: '防护鞋类' },
  { value: '防坠落护具类', text: '防坠落护具类' }
]);
const showSpecialTypePicker = ref(false);
const onConfirmSpecialType = ({ selectedOptions }) => {
  showSpecialTypePicker.value = false;
  console.log('选择内容', selectedOptions);
  form.value.specialType = selectedOptions[0].text;
  console.log('选择的内容', form.value);
};

//用来控制下一步显示
const nextStepFlag = ref(1);

//发送消息
const sendMessageSignature = () => {
  var url = '/sgsafe/ProjectWork/sendMessageSignature';
  var param = {
    params: form.value.id
  };
  if (form.value) {
    proxy.$axios.post(url, param).then(response => {
      if (response.data.code === 0) {
        showToast({
          type: 'success',
          message: '成功抄送'
        });
      } else {
        showToast({
          type: 'fail',
          message: '操作失败' + response.data.msg
        });
      }
    });
  }
};

/**其他**/
const safeMeasure = ref(null);
const dangerPoint = ref(null);
const iconsSafeMeasure = () => {
  if (safeMeasure.value) {
    checkboxSafeMeasure.value.push(safeMeasure.value);

  }
};

const iconsDangerPoint = () => {
  if (dangerPoint.value) {
    checkboxDangerPoint.value.push(dangerPoint.value);
  }
};

//上一步
const onDateConfirmPlanPre = () =>{
  nextStepFlag.value --
}

</script>

<style scoped>
.h5-container {
  width: 100%;
  box-sizing: border-box;
  height: 100vh;
  background-color: white;
  padding: 10px;
  padding-bottom: 20px;
}

.radio-group {
  display: flex;
  background-color: white;
  padding: 10px;
  border-radius: 5px;
  margin: 10px 0;
  gap: 10px;
}

.radio-item {
  padding: 8px 12px;
  border: 1px solid #222;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
  /* 添加过渡效果 */
}

.radio-item.active {
  background-color: #4285f4;
  /* 选中时的蓝色 */
  color: white;
  border-color: #4285f4;
}
</style>
