张含笑
2025-10-13 ca987bfb2dad4b87b931a4bf3e93c030bde63e1d
src/subPackages/workDetail/index.vue
@@ -16,10 +16,7 @@
      <!-- 步骤条 -->
      <div class="stepContainer">
        <up-steps :current="currentStep" direction="column">
            <up-steps-item
              v-for="(step, index) in stepTitles"
              :key="index"
            >
            <up-steps-item v-for="(step, index) in stepTitles" :key="index">
              <template #title>
                <div class="horizontal-step">
                  <span class="step-title">{{ step.title }}</span>
@@ -42,6 +39,7 @@
            <div>关联任务:{{workDetailData.job_name}}</div>
            <div>工单创建人:{{workDetailData.event_num?.slice(0, 2) === 'AI' ? 'AI 小飞':workDetailData.creator}}</div>
            <div>事件地址:{{workDetailData.address}}</div>
            <div>关联算法:{{workDetailData.ai_types}}</div>
            <div>发起部门:{{workDetailData.dept_name}}</div>
            <div>发起任务时间:{{workDetailData.create_time}}</div>
@@ -78,8 +76,11 @@
</template>
<script setup>
   import {getStepInfo,getList,flowEvent} from '/src/api/work/index.js'
   import {
      getStepInfo,
      getList,
      flowEvent
   } from '/src/api/work/index.js'
   
   const eventNum = ref('');
   const currentStatus = ref('')
@@ -87,8 +88,7 @@
   const currentStep = ref(0);
   // 工单内容
   const workDetailData = ref({})
   const stepTitles  =ref([
      {
   const stepTitles = ref([{
         title: '待审核',
         status: '2'
      },
@@ -121,7 +121,7 @@
     const response = res.data.data.records;
     workDetailData.value = response[0];
     currentStatus.value = workDetailData.value.status;
     console.log('详情',response);
      // console.log('详情',response);
   }
   // 步骤条
   const calculateCurrentStep = (status) => {
@@ -133,12 +133,25 @@
     }
     return statusToStep[String(status)] || 0 
   }
   const getStepInfoData = async (val) => {
     const res = await getStepInfo(val);
     stepResponse.value = res.data.data;
     console.log('stepResponse',stepResponse.value)
     currentStep.value = calculateCurrentStep(currentStatus.value);
      // 动态匹配步骤描述
      const matchedSteps = {};
      stepResponse.value.forEach(step => {
         // 找到 stepTitles 中对应的步骤索引
         const stepIndex = stepTitles.value.findIndex(item => item.status === String(step.status));
         if (stepIndex !== -1) {
            matchedSteps[stepIndex] = step;
   }
      });
      // 确保 stepResponse 按 stepTitles 顺序填充
      stepResponse.value = stepTitles.value.map((_, index) => matchedSteps[index] || null);
   };
   // 图片预览
   const previewImage = (url) => {
      uni.previewImage({
@@ -147,7 +160,18 @@
      });
   };
   // 通过
   const approveTicket=()=>{}
   const approveTicket = async () => {
      const data = {
         id: workDetailData.value.id,
         status: workDetailData.value.status,
         isPass: 0, // 0 表示通过
         eventNum: workDetailData.value.event_num,
      };
      console.log('data', data)
      const file = workDetailData.value.file || null;
      const response = await flowEvent(data, file);
      console.log('通过', response)
   }
   // // 不通过
   const rejectTicket=()=>{}
   // // 受理
@@ -198,6 +222,7 @@
         background-color: antiquewhite;
         border-radius: 5px;
         padding: 10px;
          .horizontal-step {
             display: flex;
             align-items: center;
@@ -223,18 +248,22 @@
         display: flex;
         justify-content: space-between;
         margin-bottom: 10px;
         .btngroups {
            display: flex;
            justify-content: space-between;
            .u-button {
               padding: 9px 20px;
                 height: 32px;
                 &:last-child {
                     margin-left: 12px;
                     margin-right: 12px;
                   }
            }
         }
         .leftBtn {
           width: 70px;
           height: 32px;
@@ -246,6 +275,7 @@
           cursor: pointer;
           opacity: 0.8;
         }
         .disableds {
           background: #999 !important;
           cursor: not-allowed !important;
@@ -253,12 +283,19 @@
           opacity: 0.3 !important;
         }
      }
      .workOrderContent {
         margin-top: 15px;
         .workOrderContainer {
            div {
               margin-bottom: 10px;
            }
            .titketName {
               display: flex;
               align-items: center;
            }
         }
      }