张含笑
2025-10-13 3cea64c34f9352415959f5e09fd61b61ca93e366
src/subPackages/workDetail/index.vue
@@ -1,6 +1,6 @@
<!-- 工单详情 - 包含待审核、待处理、处理中、已完成 -->
<template>
   <view class="workDetailContainer">
   <div class="workDetailContainer">
      <div class="detailTop">
         <div class="image-container">
            <u-image class="detailImage" :src="workDetailData.photo_url" mode="cover" width="100%" height="200px"
@@ -33,14 +33,14 @@
      <div class="workOrderContent">
         <div class="workOrderTitle">工单内容</div>
         <div class="workOrderContainer">
            <div>工单名称:{{workDetailData.event_name}}</div>
            <div>工单类型:{{workDetailData.type}}</div>
            <div>工单类型:{{workOrderTypeName}}</div>
            <div>关联任务:{{workDetailData.job_name}}</div>
            <div>工单创建人:{{workDetailData.event_num?.slice(0, 2) === 'AI' ? 'AI 小飞':workDetailData.creator}}</div>
            <div>工单创建人:{{workDetailData.event_num?.slice(0, 2) === 'AI' ? 'AI 小飞':workDetailData.create_user}}</div>
            <div>事件地址:{{workDetailData.address}}</div>
            <div >关联算法:{{workDetailData.ai_types}}</div>
            <div>关联算法:{{workDetailData.ai_types}}</div>
            <div>发起部门:{{workDetailData.dept_name}}</div>
            <div>发起任务时间:{{workDetailData.create_time}}</div>
            <div>工单内容:{{workDetailData.remark}}</div>
@@ -72,16 +72,19 @@
         </div>
      </div>
   </view>
   </div>
</template>
<script setup>
   import {
      getStepInfo,
      getList,
      flowEvent
      flowEvent,
      getTicketInfo
   } from '/src/api/work/index.js'
   const allAlgorithms = ref([])
   const algorithms = ref([])
   const types = ref([])
   const eventNum = ref('');
   const currentStatus = ref('')
   const stepResponse = ref([]);
@@ -121,7 +124,8 @@
      const response = res.data.data.records;
      workDetailData.value = response[0];
      currentStatus.value = workDetailData.value.status;
      // console.log('详情',response);
      handleTypeChange(workDetailData.value.work_order_type_dict_key)
      console.log('详情', response);
   }
   // 步骤条
   const calculateCurrentStep = (status) => {
@@ -159,6 +163,50 @@
         current: 0
      });
   };
   // 关联算法
   const getTicketInfoData = async () => {
      const response = await getTicketInfo();
      const {
         dept_data,
         event_type,
         ai_type,
         info
      } = response.data.data;
      allAlgorithms.value = info
      types.value = Object.entries(event_type).map(([key, value]) => ({
         label: value,
         value: key,
      }));
      console.log('宣发', ai_type,allAlgorithms.value);
   }
   // 计算工单类型显示名称
   const workOrderTypeName = computed(() => {
     const type = types.value.find(
       item => item.value === workDetailData.value.work_order_type_dict_key
     );
     return type ? type.label : workDetailData.value.work_order_type_dict_key;
   });
   // 关联算法选择
   const handleTypeChange=(typeValue)=>{
       const matchedCategory = allAlgorithms.value.find(category => category.dict_key === typeValue);
       if (
              !matchedCategory ||
              !matchedCategory.algorithms ||
              matchedCategory.algorithms.length === 0
            ) {
              // 无匹配的算法时清空
             algorithms.value = [];
              return;
            }
           algorithms.value = matchedCategory.algorithms.map(algo => ({
                   label: algo.dict_value,
                   value: algo.dict_key,
                   dict_key: algo.dict_key,
                   dict_value: algo.dict_value,
                 }));
      console.log('typeValue,typeValue', algorithms.value)
   }
   // 通过
   const approveTicket = async () => {
      const data = {
@@ -167,20 +215,24 @@
         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 = () => {}
   // // 受理
   // 受理
   const approveAndDispatch = () => {}
   // // 不受理
   // 不受理
   // const rejectTicket=()=>{}
   // // 完成工单
   // 完成工单
   // const completeTicket=()=>{}
   // 取消
   onShow(() => {
      getTicketInfoData()
   })
</script>
<style lang="scss" scoped>
@@ -300,4 +352,4 @@
      }
   }
</style>
</style>