无人机管理后台前端(已迁走)
罗广辉
2025-10-11 02409bfbe15f22fc3b5dccadabfd860a660a49d9
src/views/tickets/orderLog.vue
@@ -1,13 +1,3 @@
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2025-04-15 20:02:29
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2025-04-28 11:38:16
 * @FilePath: \drone-web-manage\src\views\tickets\orderLog.vue
 * @Description:
 *
 * Copyright (c) 2025 by shuishen, All Rights Reserved.
-->
<template>
  <basic-container>
    <el-tabs v-model="activeTab" @tab-click="handleTabChange">
@@ -17,7 +7,7 @@
        :label="`${tab.label} (${tab.count})`"
        :name="tab.name"
      >
        <div class="tab-content">
        <basic-main-content>
          <!-- 查询条件筛选栏 -->
          <div class="filter-bar">
            <div class="search-bar-box">
@@ -30,19 +20,15 @@
                />
              </div>
              <div class="search-bar-box-item">
                <el-select placeholder="请选择所属单位" v-model="filters.create_dept" clearable>
                  <el-option
                    v-for="dept in departments"
                    :key="dept.value"
                    :label="dept.label"
                    :value="dept.value"
                  />
                </el-select>
              </div>
              <!--              <div class="search-bar-box-item">-->
              <!--                <el-select placeholder="请选择所属单位" v-model="filters.create_dept" clearable>-->
              <!--                  <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" :value="dept.value" />-->
              <!--                </el-select>-->
              <!--              </div>-->
              <div class="search-bar-box-item">
                <el-date-picker
                  @change="handleSearch"
                  v-model="filters.dateRange"
                  type="daterange"
                  range-separator="至"
@@ -53,7 +39,13 @@
              </div>
              <div class="search-bar-box-item">
                <el-select v-model="filters.file_id" placeholder="请选择关联航线" clearable>
                <el-select
                  @change="handleSearch"
                  v-model="filters.file_id"
                  placeholder="请选择关联航线"
                  filterable
                  clearable
                >
                  <el-option
                    v-for="item in wayLineList"
                    :key="item.wayline_id"
@@ -64,7 +56,12 @@
              </div>
              <div class="search-bar-box-item">
                <el-select v-model="filters.ai_types" placeholder="关联算法" clearable>
                <el-select
                  @change="handleSearch"
                  v-model="filters.ai_types"
                  placeholder="关联算法"
                  clearable
                >
                  <el-option
                    v-for="item in ai_types"
                    :key="item.dictKey"
@@ -74,19 +71,21 @@
                </el-select>
              </div>
              <div class="search-bar-box-item">
              <!-- <div class="search-bar-box-item">
                <el-select v-model="filters.type" placeholder="请选择工单类型" clearable>
                  <el-option
                    v-for="item in types"
                    :key="item.dictValue"
                    :label="item.dictValue"
                    :value="item.dictKey"
                  />
                  <el-option v-for="item in types" :key="item.dictValue" :label="item.dictValue"
                    :value="item.dictKey" />
                </el-select>
              </div>
              </div> -->
              <div class="search-bar-box-item">
                <el-select v-model="filters.status" placeholder="请选择工单状态" clearable>
                <el-select
                  @change="handleSearch"
                  v-model="filters.status"
                  placeholder="请选择工单状态"
                  clearable
                  :disabled="activeTab !== 'all'"
                >
                  <el-option
                    v-for="item in statuses"
                    :key="item.value"
@@ -100,6 +99,7 @@
            <div class="search-bar-box">
              <div class="search-bar-box-item flex-2">
                <el-date-picker
                  @change="handleSearch"
                  v-model="filters.cycleDateRange"
                  type="daterange"
                  range-separator="至"
@@ -110,13 +110,19 @@
              </div>
              <div class="search-bar-box-item">
                <el-select v-model="filters.rep_fre_type" placeholder="请选择频次">
                <el-select
                  @change="handleSearch"
                  v-model="filters.rep_fre_type"
                  placeholder="请选择频次"
                  clearable
                >
                  <el-option v-for="item in cycles" :key="item" :label="item" :value="item" />
                </el-select>
              </div>
              <div class="search-bar-box-item">
                <el-time-picker
                  @change="handleSearch"
                  v-model="filters.deal_time"
                  placeholder="请选择执行时间"
                  prop="deal_time"
@@ -141,6 +147,7 @@
          <!-- 表格部分 -->
          <avue-crud
            class="ztzf-public-general-avue-crud"
            :data="tableData"
            :option="option"
            v-model:page="page"
@@ -151,7 +158,20 @@
            @on-load="onLoad"
            @search-change="searchChange"
            @size-change="sizeChange"
            v-if="activeTab === tab.name"
          >
            <template #job_info_num="{ row }">
              <el-tooltip-copy :content="row.job_info_num" :showCopyText="true" textAlign="left">
                {{ row.job_info_num }}
              </el-tooltip-copy>
            </template>
            <template #name="{ row }">
              <el-tooltip-copy :content="row.name" :showCopyText="true" textAlign="left">
                {{ row.name }}
              </el-tooltip-copy>
            </template>
            <template #menu-left>
              <el-button
                v-if="hasAddBtnPermission() && activeTab != 'WAIT_AUDIT'"
@@ -162,6 +182,9 @@
              >
              <el-button type="success" plain icon="el-icon-download" @click="exportData"
                >导出</el-button
              >
              <el-button type="primary" plain icon="el-icon-plus" @click="moreAdd"
              >批量添加</el-button
              >
            </template>
@@ -176,23 +199,34 @@
                    >审核</el-button
                  >
                </template>
                 <template
                  v-if="
                <!-- v-if="
                    (userInfo.user_id == row.create_user || hasRecallPaddingBtnPermission()) &&
                    row.status == 1
                  "
                >
                  " -->
                <template v-if="row.status == 1">
                  <!--待审核状态-->
                  <el-button  type="text" icon="el-icon-warning" @click="orderLogRecall(row.id)"
                  <el-button
                    type="text"
                    icon="el-icon-warning"
                    v-if="hasRecallPaddingBtnPermission()"
                    @click="orderLogRecall(row.id)"
                    >撤回</el-button
                  >
                  <!-- <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button> -->
                </template>
                <!--已驳回-->
                <template v-if="row.status == 2">
                  <el-button type="text" icon="el-icon-warning" @click="rejectDetail(row.id)"
                    >驳回原因</el-button
                  >
                  <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)"
                  <el-button
                    v-if="userInfo.user_id == row.create_user"
                    type="text"
                    icon="el-icon-view"
                    @click="handleViewDetail(row)"
                    >编辑</el-button
                  >
                  <el-button v-else type="text" icon="el-icon-view" @click="handleViewDetail(row)"
                    >详情</el-button
                  >
                </template>
@@ -225,7 +259,7 @@
              </el-tooltip>
            </template>
          </avue-crud>
        </div>
        </basic-main-content>
      </el-tab-pane>
    </el-tabs>
@@ -251,7 +285,12 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联航线" prop="file_id">
              <el-select v-model="form.file_id" placeholder="请选择航线" @change="getFlyingNestBy">
              <el-select
                v-model="form.file_id"
                placeholder="请选择航线"
                filterable
                @change="getFlyingNestBy"
              >
                <el-option
                  v-for="item in wayLineList"
                  :key="item.wayline_id"
@@ -265,7 +304,12 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联机巢" prop="device_sns">
              <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple>
              <el-select
                v-model="form.device_sns"
                placeholder="请选择机巢"
                multiple
                :disabled="!device_sns.length"
              >
                <el-option
                  v-for="item in device_sns"
                  :key="item.device_sn"
@@ -311,6 +355,7 @@
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :disabled-date="disabledDate"
              />
            </el-form-item>
          </el-col>
@@ -346,6 +391,7 @@
          <div class="add-box-btns">
            <el-button type="danger" @click="submitForm(1)">发起</el-button>
            <el-button type="primary" @click="submitForm(0)">存草稿</el-button>
            <el-button @click="dialogVisible = false">取消</el-button>
          </div>
        </el-row>
      </el-form>
@@ -353,6 +399,7 @@
    <!-- 工单详情对话框 -->
    <el-dialog
      align-center
      v-model="detailVisible"
      :title="detailTitle"
      width="70%"
@@ -360,10 +407,10 @@
      @close="resetForm"
    >
      <div class="event-title-center">{{ form.name }}</div>
      <el-form :model="form" ref="testform" label-width="100px">
      <el-form :model="form" :rules="rules" ref="testform" label-width="100px">
        <div class="custom-steps-container">
          <!-- 标题行 -->
          <div class="steps-titles">
          <div class="steps-titles" v-if="filters.status !== '0'">
            <div
              v-for="(record, index) in form.record_list"
              :class="{ active: record.user_id >= 0 }"
@@ -375,24 +422,18 @@
          </div>
          <!-- Element Steps 组件 -->
          <el-steps :active="form.active" align-center class="custom-steps">
          <el-steps
            :active="form.active"
            align-center
            class="custom-steps"
            v-if="filters.status !== '0'"
          >
            <el-step v-for="(record, index) in form.record_list" :key="index">
              <template #description>
                <span class="step-description" style="position: relative; display: inline-block">
                  {{ record.user_name }}
                </span>
                <span
                  style="
                    position: absolute;
                    left: 80%;
                    top: 50%;
                    transform: translateY(-50%);
                    width: 100px;
                    margin-left: 4px;
                    color: #666;
                    font-size: 12px;
                  "
                >
                <span class="step-timer">
                  {{ record.interval_time_str }}
                </span>
                <div class="step-description">
@@ -406,12 +447,22 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="工单名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入工单名称"></el-input>
              <el-input
                v-model="form.name"
                placeholder="请输入工单名称"
                :disabled="detailTitle === '工单详情'"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联航线" prop="file_id">
              <el-select v-model="form.file_id" placeholder="请选择航线" @change="getFlyingNestBy">
              <el-select
                v-model="form.file_id"
                placeholder="请选择航线"
                @change="getFlyingNestBy"
                filterable
                :disabled="detailTitle === '工单详情'"
              >
                <el-option
                  v-for="item in wayLineList"
                  :key="item.wayline_id"
@@ -425,7 +476,12 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="关联机巢" prop="device_sns">
              <el-select v-model="form.device_sns" placeholder="请选择机巢" multiple>
              <el-select
                v-model="form.device_sns"
                placeholder="请选择机巢"
                multiple
                :disabled="detailTitle === '工单详情'"
              >
                <el-option
                  v-for="item in device_sns"
                  :key="item.device_sn"
@@ -437,7 +493,12 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="关联算法" prop="ai_types">
              <el-select v-model="form.ai_types" placeholder="请选择关联算法" multiple>
              <el-select
                v-model="form.ai_types"
                placeholder="请选择关联算法"
                multiple
                :disabled="detailTitle === '工单详情'"
              >
                <el-option
                  v-for="item in ai_types"
                  :key="item.dictKey"
@@ -464,12 +525,18 @@
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :disabled-date="disabledDate"
                :disabled="detailTitle === '工单详情'"
              />
            </el-form-item>
          </el-col>
          <el-col :span="3">
            <el-select v-model="form.rep_fre_type" placeholder="请选择频次">
            <el-select
              v-model="form.rep_fre_type"
              placeholder="请选择频次"
              :disabled="detailTitle === '工单详情'"
            >
              <el-option v-for="item in cycles" :key="item" :label="item" :value="item" />
            </el-select>
          </el-col>
@@ -483,6 +550,7 @@
              :picker-options="{
                selectableRange: '00:00 - 23:59',
              }"
              :disabled="detailTitle === '工单详情'"
            />
          </el-col>
        </el-row>
@@ -497,6 +565,7 @@
                placeholder="请输入工单内容"
                maxlength="255"
                show-word-limit
                :disabled="detailTitle === '工单详情'"
              ></el-input>
            </el-form-item>
          </el-col>
@@ -516,12 +585,18 @@
              @click="submitForm(1)"
              >发布</el-button
            >
            <el-button
              type="primary"
              v-if="form.status == 0 || (form.status == 2 && userInfo.user_id == form.create_user)"
              @click="submitForm(0)"
              >保存</el-button
            >
            <!-- <el-button type="primary" v-if="form.status == 0 || userInfo.user_id == form.create_user"
                            @click="submitForm(0)">保存</el-button> -->
            <el-button
              type="primary"
              v-if="form.status == 1 && this.permission.orderLogpass"
              v-if="form.status == 1 && hasPaddingBtnPermission()"
              @click="orderLogPass(form.id)"
              >通过</el-button
            >
@@ -538,6 +613,7 @@
    <!-- 工单详情 -->
    <el-dialog
      align-center
      v-model="detailVisibleCopy"
      title="工单详情"
      width="70%"
@@ -548,7 +624,7 @@
      <el-form :model="form" ref="testform" label-width="100px">
        <div class="custom-steps-container">
          <!-- 标题行 -->
          <div class="steps-titles">
          <div class="steps-titles" v-if="filters.status !== '0'">
            <div
              v-for="(record, index) in form.record_list"
              :class="{ active: record.user_id >= 0 }"
@@ -560,24 +636,18 @@
          </div>
          <!-- Element Steps 组件 -->
          <el-steps :active="form.active" align-center class="custom-steps">
          <el-steps
            :active="form.active"
            align-center
            class="custom-steps"
            v-if="filters.status !== '0'"
          >
            <el-step v-for="(record, index) in form.record_list" :key="index">
              <template #description>
                <span class="step-description" style="position: relative; display: inline-block">
                  {{ record.user_name }}
                </span>
                <span
                  style="
                    position: absolute;
                    left: 80%;
                    top: 50%;
                    transform: translateY(-50%);
                    width: 100px;
                    margin-left: 4px;
                    color: #666;
                    font-size: 12px;
                  "
                >
                <span class="step-timer">
                  {{ record.interval_time_str }}
                </span>
                <div class="step-description">
@@ -724,7 +794,7 @@
            <el-button
              type="primary"
              v-if="form.status == 1 && this.permission.orderLogpass"
              v-if="form.status == 1 && hasPaddingBtnPermission()"
              @click="orderLogPass(form.id)"
              >通过</el-button
            >
@@ -738,6 +808,69 @@
          </div>
        </el-row>
      </el-form>
    </el-dialog>
    <el-dialog class="ztzf-dialog" append-to-body v-model="moreAddVisible" title="批量添加" :width="pxToRem(1200)" :close-on-click-modal="false" :destroy-on-close="true">
      <el-button type="primary" plain icon="el-icon-plus" @click="addMoreData" style="margin-bottom: 10px;"></el-button>
      <el-table border :data="moreDataList" height="400">
        <el-table-column label="序号" type="index" width="60"></el-table-column>
        <el-table-column prop="name" label="工单名称" align="center">
          <template #default="scope">
            <el-input v-model="scope.row.name"></el-input>
          </template>
        </el-table-column>
        <el-table-column prop="end_time" label="选择航线" align="center">
          <template #default="scope">
            <el-select
              v-model="scope.row.file_id"
              placeholder="请选择航线"
              filterable
              @change="getFlyingNestBy"
            >
              <el-option
                v-for="item in wayLineList"
                :key="item.wayline_id"
                :label="item.name"
                :value="item.wayline_id"
              />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column prop="end_time" label="选择机巢" align="center">
          <template #default="scope">
            <el-select
              v-model="scope.row.device_sns"
              placeholder="请选择机巢"
            >
              <el-option label="赣县-夏谭机场" value="赣县-夏谭机场" />
              <el-option label="江西融媒" value="江西融媒" />
              <el-option label="广盈机场" value="广盈机场" />
              <el-option label="桃花街道" value="桃花街道" />
              <el-option label="南昌机场一代1" value="南昌机场一代1" />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column prop="time" label="创建日期" align="center">
          <template #default="scope">
            <el-date-picker v-model="scope.row.time" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" placeholder="选择日期" style="width: 200px;" />
          </template>
        </el-table-column>
        <el-table-column label="描述" prop="remark">
          <template #default="scope">
            <el-input v-model="scope.row.remark"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="100">
          <template #default="scope">
            <el-button icon="el-icon-delete" type="text" @click="handleDelete(scope.$index)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="moreAddVisible = false">取 消</el-button>
          <el-button type="primary" @click="saveSubmit">保存</el-button>
        </span>
      </template>
    </el-dialog>
  </basic-container>
</template>
@@ -766,8 +899,16 @@
import { downloadXls } from '@/utils/util';
import 'nprogress/nprogress.css';
import { analyzeKmzFile, removeTextKey, XMLToJSON } from '@/utils/cesium/kmz';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn'; // 导入中文语言包
import weekday from 'dayjs/plugin/weekday';
import elTooltipCopy from '@/components/ElTooltipCopy.vue';
dayjs.extend(weekday);
dayjs.locale('zh-cn');
export default {
  components: { elTooltipCopy },
  name: 'TicketPage',
  data() {
    return {
@@ -805,7 +946,7 @@
        { label: '已通过', value: '3' },
      ],
      //周期
      cycles: ['周一', '周二', '周三', '周四', '周五', '周六', '周末', '周天', '工作日', '每天'],
      cycles: ['每天', '周一', '周二', '周三', '周四', '周五', '周六', '周末', '周天', '工作日'],
      tableData: [],
      option: {
@@ -816,7 +957,7 @@
        align: 'center',
        border: true,
        stripe: true,
        stripe: false,
        searchShow: true,
        searchBtnText: '搜索',
        searchMenuSpan: 6,
@@ -831,20 +972,93 @@
        menu: true,
        menuWidth: 210,
        menuClassName: 'cur-menu',
        column: [
          { label: '工单编号', prop: 'job_info_num', width: 100, ellipsis: true, overHidden: true },
          { label: '工单名称', prop: 'name', width: 100, ellipsis: true, overHidden: true },
          { label: '工单状态', prop: 'status', width: 88 },
          { label: '所属单位', prop: 'dept_name', width: 100, ellipsis: true },
          { label: '发起时间', prop: 'create_time', width: 144, ellipsis: true },
          { label: '已执行次数', prop: 'job_num', width: 96, ellipsis: true },
          { label: '工单内容', prop: 'content', ellipsis: true, overHidden: true },
          { label: '关联航线', prop: 'wayline_name', width: 100, ellipsis: true, overHidden: true },
          { label: '关联算法', prop: 'ai_type_str', width: 100, ellipsis: true, overHidden: true },
          { label: '关联机巢', prop: 'device_names', width: 100, ellipsis: true, overHidden: true },
          { label: '创建人', prop: 'creator_name', width: 96, ellipsis: true, overHidden: true },
          { label: '关联机巢', prop: 'device_names', width: 112, ellipsis: true, overHidden: true },
        height: 'auto',
        calcHeight: 196,
        column: [
          {
            label: '工单编号',
            prop: 'job_info_num',
            width: 150,
          },
          {
            label: '工单名称',
            prop: 'name',
            width: 100,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '工单状态',
            prop: 'status',
            width: 88,
            showOverflowTooltip: true,
          },
          {
            label: '所属单位',
            prop: 'dept_name',
            ellipsis: true,
            showOverflowTooltip: true,
          },
          {
            label: '创建时间',
            prop: 'create_time',
            width: 144,
            ellipsis: true,
            showOverflowTooltip: true,
          },
          {
            label: '已执行次数',
            prop: 'job_num',
            width: 70,
            ellipsis: true,
            showOverflowTooltip: true,
          },
          {
            label: '工单内容',
            prop: 'content',
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '关联航线',
            prop: 'wayline_name',
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '关联算法',
            prop: 'ai_type_str',
            width: 100,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '关联机巢',
            prop: 'device_names',
            width: 100,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          {
            label: '创建人',
            prop: 'creator_name',
            width: 96,
            ellipsis: true,
            overHidden: true,
            showOverflowTooltip: true,
          },
          // {
          //   label: '关联机巢', prop: 'device_names', width: 112, ellipsis: true, overHidden: true,
          //   showOverflowTooltip: true,
          // },
          {
            label: '工单周期频次',
            prop: '',
@@ -852,6 +1066,7 @@
            formatter: row => this.formatCycleTime(row),
            html: true,
            ellipsis: true,
            showOverflowTooltip: true,
            // overHidden: true
          },
        ],
@@ -862,6 +1077,8 @@
        currentPage: 1,
        total: 0,
      },
      moreDataList: [],
      moreAddVisible: false,
      dialogVisible: false,
      detailVisible: false,
      currentDetail: {},
@@ -873,7 +1090,6 @@
        ],
        file_id: [{ required: true, message: '需要选择航线', trigger: 'change' }],
        device_sns: [{ required: true, message: '请选择机巢', trigger: 'change' }],
        ai_types: [{ required: true, message: '请选择算法', trigger: 'change' }],
        content: [
          { required: true, message: '请输入工单内容', trigger: 'blur' },
          { max: 255, message: '工单内容不能超过255个字', trigger: 'blur' },
@@ -907,9 +1123,13 @@
  mounted() {
    this.fetchTableData();
    const id = this.$route.query.id;
    console.log('idddddd', id);
    if (id) {
      // 确保 id 存在
      this.handleViewDetail({ id });
      const find = this.$store.state.tags.bsTagList.find(i => i.path === '/tickets/orderLog');
      find && (find.query = {});
    } else {
      console.error('工单ID不存在!');
    }
@@ -918,6 +1138,8 @@
    ...mapGetters(['userInfo', 'permission']),
    filteredTabs() {
      // rejection_and_draft 权限控制“已驳回”和“草稿”tab
      // console.log(this.permission, '权限信息')
      // console.log(this.userInfo, '权限信息22')
      const canShowRejectAndDraft = this.permission?.rejection_and_draft === true;
      return this.tabs
        .map(tab => {
@@ -934,6 +1156,32 @@
  },
  methods: {
    handleCellClick(row, column) {
      if (column.no === 1) {
        navigator.clipboard.writeText(row.job_info_num).then(() => {
          this.$message.success('复制工单编号成功');
        });
      } else if (column.no === 2) {
        navigator.clipboard.writeText(row.name).then(() => {
          this.$message.success('复制工单名称成功');
        });
      } else if (column.no === 4) {
        navigator.clipboard.writeText(row.dept_name).then(() => {
          this.$message.success('复制所属单位成功');
        });
      } else if (column.no === 8) {
        navigator.clipboard.writeText(row.wayline_name).then(() => {
          this.$message.success('复制关联航线成功');
        });
      } else if (column.no === 9) {
        navigator.clipboard.writeText(row.ai_type_str).then(() => {
          this.$message.success('复制关联算法成功');
        });
      }
    },
    disabledDate(time) {
      return time.getTime() < Date.now() - 8.64e7; // 86400000 = 24 * 60 * 60 * 1000
    },
    searchChange(params, done) {
      // console.log('searchChange')
      this.query = params;
@@ -1052,11 +1300,43 @@
          this.form.begin_time = this.formatDate(dateRange[0]);
          this.form.end_time = this.formatDate(dateRange[1]);
          // 如果选中日期包含当前天,那么选中的时间点不能小于当前时间
          if (this.form.deal_time) {
            const selectedDate = dayjs(this.form.date_range[0]).format('YYYY-MM-DD');
            const selectedTime = dayjs(selectedDate + ' ' + this.form.deal_time).toDate();
            const now = new Date();
            if (selectedDate === dayjs().format('YYYY-MM-DD') && selectedTime < now) {
              return this.$message.warning('任务时间不能小于当前时间');
            }
          }
          const submitData = {
            ...this.form,
            status: status,
            ai_types: this.form.ai_types?.length ? this.form.ai_types : [],
          };
          // 判断该值this.form.date_range[0] 周几 和rep_fre_type 是不是相等
          // if (this.form.deal_time) {
          //    const weekday = dayjs(this.form.date_range[0]).format('dddd');
          //    console.log('444', weekday)
          //   //  form.rep_fre_type
          //   const now = new Date()
          //   const today = now.toDateString()
          //   const selectedDate = new Date(this.form.date_range[0]).toDateString()
          //   if (today === selectedDate) {
          //     const [hours, minutes] = this.form.deal_time.split(':')
          //     const selectedTime = new Date()
          //     selectedTime.setHours(parseInt(hours), parseInt(minutes))
          //     if (selectedTime < now) {
          //       return this.$message.warning('任务时间不能小于当前时间')
          //     }
          //   }
          // }
          await saveUpdateOrderLog(submitData);
          let id = this.form.id;
          if (id) {
@@ -1082,7 +1362,8 @@
        this.form = {
          ...response.data.data,
        };
        this.detailVisible = true;
        // this.detailVisible = true
        this.handleViewDetail(data);
      });
    },
    formatDate(date) {
@@ -1117,6 +1398,15 @@
    handleTabChange(tab) {
      this.activeTab = tab.props?.name || tab.name;
      this.filters.status = '';
      if (tab.props?.name === 'WAIT_AUDIT') {
        this.filters.status = '1';
      } else if (tab.props?.name === 'REJECTED') {
        this.filters.status = '2';
      } else if (tab.props?.name === 'PASS') {
        this.filters.status = '3';
      } else if (tab.props?.name === 'DRAFT') {
        this.filters.status = '0';
      }
      this.page.currentPage = 1;
      this.fetchTableData();
    },
@@ -1163,10 +1453,82 @@
    handleAdd() {
      this.form = {};
      this.dialogVisible = true;
      this.$nextTick(() => {
        if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
          this.$refs.MapContainer.initAddEntity('initPosition');
        }
      });
      //航线列表
      this.asyncgetWaylineFileListByArea();
    },
    // 批量添加
    moreAdd() {
      this.moreDataList = []
      this.moreAddVisible = true;
    },
    addMoreData() {
      this.moreDataList.push({
        name: '',
        file_id: '',
        device_sns: '',
        time: '',
        remark: ''
      })
    },
    // 删除
    handleDelete(index) {
      if (this.moreDataList.length > 0) {
        this.moreDataList.splice(index, 1)
      }
    },
    // 批量保存
    saveSubmit() {
      // tableData复制5条数据
      if (this.moreDataList.length === 0) {
        this.$message.warning('请添加数据');
        return
      }
      let bfList = []
      this.moreDataList.map((item, index) => {
        bfList.push({
            $cellEdit:false,
            $index:5,
            ai_type_str:'道路裂缝',
            area_code: `360113000000${index}`,
            begin_time:"2025/09/27 18:08",
            content:item.remark,
            create_time:item.time,
            create_user:"1971102860644016129",
            creator_name:"权限测试账号",
            cycle_time_value:"2025/09/27 2025/09/28 每天 18:08",
            dept_name: item.device_sns,
            device_names: item.device_sns,
            device_sns:['8UUXN5M00A08ZD'],
            end_time:"2025/09/28",
            execute_time_arr: ['1758967680', '1759054080'],
            file_id:"47825a57-e376-427e-8ed1-8bc94c27b9cf",
            id: index,
            industry_type_str:"综合类",
            job_info_num:"36011320250927031",
            latitude:28.692045732105385,
            longitude:115.85282499919674,
            name: item.name,
            reason:"",
            remark:item.remark,
            rep_fre_type:"每天",
            status:1,
            status_str:"待审核",
            wayline_job_info_id: index,
        })
      })
      // 把备份的数据加入tableData 中
      this.tableData = [...this.tableData, ...bfList]
      this.page.total = this.tableData.length + bfList.length
      this.moreAddVisible = false;
    },
    resetForm() {
      this.form = {
        name: '',
@@ -1200,13 +1562,30 @@
      this.device_sns = data.device_list;
      this.permission &&
      (this.permission.order_log_review || this.permission.order_log_recall) &&
      (data.status == 1 || data.status == 3 || data.status == 2)
      (data.status == 1 ||
        data.status == 3 ||
        (data.status == 2 && this.userInfo.user_id !== this.form.create_user))
        ? (this.detailTitle = '工单详情')
        : (this.detailTitle = '编辑工单');
      this.detailVisible = true;
      // 更新航线列表,追加 wayline_file_region_vo 数据
      if (data.wayline_file_region_vo) {
        const newWayline = data.wayline_file_region_vo;
        // 检查是否已经存在于 this.wayLineList 中
        const isDuplicate = this.wayLineList.some(
          item => item.wayline_id === newWayline.wayline_id
        );
        if (!isDuplicate) {
          this.wayLineList.push(newWayline);
        }
      }
      this.initMapLine(data.device_map_infos);
      const find = this.$store.state.tags.bsTagList.find(i => i.path === '/tickets/orderLog');
      find && (find.query = {});
    },
    async handleCheckDetail(row) {
      const response = await orderLogDetails(row.id);
@@ -1214,7 +1593,20 @@
      this.form = {
        ...data,
      };
      // 更新航线列表,追加 wayline_file_region_vo 数据
      // 更新航线列表,追加 wayline_file_region_vo 数据
      if (data.wayline_file_region_vo) {
        const newWayline = data.wayline_file_region_vo;
        // 检查是否已经存在于 this.wayLineList 中
        const isDuplicate = this.wayLineList.some(
          item => item.wayline_id === newWayline.wayline_id
        );
        if (!isDuplicate) {
          this.wayLineList.push(newWayline);
        }
      }
      // 更新机巢列表
      this.device_sns = data.device_list;
      this.detailVisibleCopy = true;
@@ -1293,58 +1685,46 @@
      this.initMapLine();
    },
    initMapLine(infos = {}) {
    initMapLine(infos = {}, cb = () => {}) {
      let currentLine = this.wayLineList.find(item => item.wayline_id == this.form.file_id);
      if (!currentLine) return;
      // 异步解析kmz文件
      const analysis = async url => {
        return new Promise(async resolve => {
          const res = await analyzeKmzFile(`${url}?_t=${new Date().getTime()}`);
          const templateXML = await res.fileInfoObj['wpmz/template.kml'];
          const templateXMLJSON = XMLToJSON(templateXML)?.['Document'];
          const templateXMLObj = removeTextKey(templateXMLJSON.Folder);
          resolve(templateXMLObj);
        });
      };
      const drawLine = async () => {
        let prexUrl = ref(import.meta.env.VITE_APP_AIRLINE_URL + currentLine.object_key);
        const res = await analysis(prexUrl.value);
        if (!res.Placemark.length) return;
        renderingLine(res);
      };
      const renderingLine = lineObj => {
        const positions = lineObj.Placemark.map(item => {
          return item.Point.coordinates.split(',');
        });
        if (JSON.stringify(infos) != '{}')
          positions.unshift([infos[0].longitude, infos[0].latitude]);
        this.$nextTick(() => {
          if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
            this.$refs.MapContainer.initAddEntity('polyline', positions);
          }
        });
      };
      drawLine();
      this.$nextTick(() => {
        if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) {
          this.$refs.MapContainer.initAddEntity('polyline', {
            url: `${
              import.meta.env.VITE_APP_AIRLINE_URL + currentLine.object_key
            }?_t=${new Date().getTime()}`,
            type: currentLine.wayline_type,
            cb,
            infos,
          });
        }
      });
    },
    //可飞行机巢列表
    async getFlyingNestBy(waylineId) {
      this.initMapLine();
      const that = this;
      //按照航线来
      const params = {
        type: 0,
        wayline_id: waylineId,
      };
      var wayLineListResponse = await getFlyingNestBy(params);
      this.device_sns = wayLineListResponse.data.data;
      // 先清空
      that.form.device_sns = [];
      that.device_sns = [];
      this.initMapLine({}, async polygon => {
        const currentLine = that.wayLineList.find(item => item.wayline_id === waylineId);
        //按照航线来
        const params = {
          type: [2, 4, 5].includes(currentLine.wayline_type) ? 2 : 0,
          wayline_id: waylineId,
          polygon,
        };
        var wayLineListResponse = await getFlyingNestBy(params);
        // 再赋值
        that.device_sns = wayLineListResponse.data.data;
      });
    },
    //撤回
@@ -1369,6 +1749,12 @@
      let data = response.data.data;
      this.$message.success('审核通过');
      this.detailVisibleCopy = false;
      this.detailVisible = false;
      this.page.currentPage = 1;
      this.onLoad(this.page, this.query);
      // this.handleViewDetail()
    },
    /**
     * 驳回
@@ -1380,8 +1766,13 @@
      }).then(async ({ value }) => {
        let response = await orderLogReject(id, value);
        let data = response.data.data;
        this.$message.success('驳回成果');
        this.$message.success('驳回成功');
        this.detailVisibleCopy = false;
        // this.detailVisible = false
        this.page.currentPage = 1;
        this.onLoad(this.page, this.query);
      });
    },
  },
@@ -1396,20 +1787,34 @@
  },
};
</script>
<style></style>
<style lang="scss" scoped>
:deep(.el-textarea__inner) {
  padding: 8px 12px;
}
::v-deep(.el-tabs) {
  height: 100%;
  display: flex;
  flex-direction: column;
:deep(.el-input__inner),
:deep(.el-select),
:deep(.el-select .el-input) {
  width: 100%; // 确保所有输入框和选择框宽度一致
}
  .el-tabs__header {
    order: 1;
  }
.tab-content {
  padding: 10px;
  .el-tabs__content {
    order: 2;
  }
  .el-tabs__content {
    height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    .el-tab-pane {
      height: 0;
      flex: 1;
      display: flex;
      flex-direction: column;
    }
  }
}
.filter-bar {
@@ -1442,6 +1847,35 @@
  }
}
:deep(.el-pagination .el-select) {
  width: 128px !important;
}
.step-timer {
  position: absolute;
  left: 80%;
  top: 50%;
  transform: translateY(-50%);
  width: 100px;
  margin-left: 4px;
  color: #666;
  font-size: 12px;
}
:deep(.el-textarea__inner) {
  padding: 8px 12px;
}
:deep(.el-input__inner),
:deep(.el-select),
:deep(.el-select .el-input) {
  width: 100%; // 确保所有输入框和选择框宽度一致
}
:deep(.el-textarea__inner) {
  resize: none;
}
.action-bar {
  margin-bottom: 16px;
}
@@ -1452,28 +1886,9 @@
  }
}
.tab-content {
  min-height: 200px;
}
.detail-form {
  :deep(.el-form-item) {
    margin-bottom: 10px;
  }
  :deep(.el-form-item__label) {
    color: #606266;
    font-weight: normal;
  }
  :deep(.el-form-item__content) {
    color: #303133;
  }
}
.el-dialog {
  .el-form-item {
    margin-bottom: 20px;
    margin-bottom: 10px;
  }
}
@@ -1559,11 +1974,8 @@
    & > ::v-deep(.el-button) {
      flex: 1;
      max-width: 44px;
      &:nth-child(4n) {
        margin-left: 0;
      }
      margin-left: 0;
      margin-right: 10px;
    }
  }
}