无人机管理后台前端(已迁走)
张含笑
2025-08-05 c832bf2e80ac465e71b7a1c1f7a59d4252030989
src/views/tickets/orderLog.vue
@@ -1,13 +1,4 @@
<!--
 * @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">
@@ -21,11 +12,11 @@
                  @keyup.enter="handleSearch" />
              </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 v-model="filters.dateRange" type="daterange" range-separator="至"
@@ -33,7 +24,7 @@
              </div>
              <div class="search-bar-box-item">
                <el-select v-model="filters.file_id" placeholder="请选择关联航线" clearable>
                <el-select v-model="filters.file_id" placeholder="请选择关联航线" filterable clearable>
                  <el-option v-for="item in wayLineList" :key="item.wayline_id" :label="item.name"
                    :value="item.wayline_id" />
                </el-select>
@@ -54,7 +45,7 @@
              </div> -->
              <div class="search-bar-box-item">
                <el-select v-model="filters.status" placeholder="请选择工单状态" clearable>
                <el-select v-model="filters.status" placeholder="请选择工单状态" clearable :disabled="activeTab !== 'all'">
                  <el-option v-for="item in statuses" :key="item.value" :label="item.label" :value="item.value" />
                </el-select>
              </div>
@@ -93,6 +84,18 @@
          <avue-crud class="ztzf-public-general-avue-crud" :data="tableData" :option="option" v-model:page="page"
            ref="crud" :table-loading="loading" @current-change="currentChange" @refresh-change="refreshChange"
            @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'" type="primary" icon="el-icon-plus"
                @click="handleAdd">新建工单</el-button>
@@ -229,13 +232,13 @@
    </el-dialog>
    <!-- 工单详情对话框 -->
    <el-dialog v-model="detailVisible" :title="detailTitle" width="70%" :close-on-click-modal="false"
    <el-dialog align-center v-model="detailVisible" :title="detailTitle" width="70%" :close-on-click-modal="false"
      @close="resetForm">
      <div class="event-title-center">{{ form.name }}</div>
      <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 }" :key="index"
              class="step-title">
              {{ record.status_str }}
@@ -243,7 +246,7 @@
          </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">
@@ -341,6 +344,7 @@
            <el-button type="danger"
              v-if="form.status == 0 || (form.status == 2 && userInfo.user_id == form.create_user)"
              @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> -->
@@ -359,7 +363,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 }" :key="index"
              class="step-title">
              {{ record.status_str }}
@@ -367,7 +371,7 @@
          </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">
@@ -507,11 +511,13 @@
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 {
@@ -581,8 +587,7 @@
        column: [
          {
            label: '工单编号', prop: 'job_info_num', width: 100, ellipsis: true, overHidden: true,
            showOverflowTooltip: true,
            label: '工单编号', prop: 'job_info_num', width: 150,
          },
          {
            label: '工单名称', prop: 'name', width: 100, ellipsis: true, overHidden: true,
@@ -601,7 +606,7 @@
            showOverflowTooltip: true,
          },
          {
            label: '已执行次数', prop: 'job_num', width: 96, ellipsis: true,
            label: '已执行次数', prop: 'job_num', width: 70, ellipsis: true,
            showOverflowTooltip: true,
          },
          {
@@ -692,6 +697,8 @@
  mounted () {
    this.fetchTableData()
    const id = this.$route.query.id
    console.log('idddddd',id);
    if (id) {
      // 确保 id 存在
      this.handleViewDetail({ id })
@@ -703,8 +710,8 @@
    ...mapGetters(['userInfo', 'permission']),
    filteredTabs () {
      // rejection_and_draft 权限控制“已驳回”和“草稿”tab
      console.log(this.permission, '权限信息')
      console.log(this.userInfo, '权限信息22')
      // console.log(this.permission, '权限信息')
      // console.log(this.userInfo, '权限信息22')
      const canShowRejectAndDraft = this.permission?.rejection_and_draft === true
      return this.tabs
        .map(tab => {
@@ -721,6 +728,29 @@
  },
  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
    },
@@ -841,6 +871,17 @@
          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,
@@ -863,7 +904,7 @@
          //     if (selectedTime < now) {
          //       return this.$message.warning('任务时间不能小于当前时间')
          //     }
          //   }
          // }
@@ -929,6 +970,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()
    },
@@ -1017,7 +1067,6 @@
        : (this.detailTitle = '编辑工单')
      this.detailVisible = true
      // 更新航线列表,追加 wayline_file_region_vo 数据
      if (data.wayline_file_region_vo) {
        const newWayline = data.wayline_file_region_vo
@@ -1033,6 +1082,9 @@
      }
      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)
@@ -1195,9 +1247,11 @@
      this.$message.success('审核通过')
      this.detailVisibleCopy = false
      this.detailVisible = false
      this.page.currentPage = 1
      this.onLoad(this.page, this.query)
      this.handleViewDetail()
      // this.handleViewDetail()
    },
    /**
     * 驳回
@@ -1211,6 +1265,8 @@
        let data = response.data.data
        this.$message.success('驳回成功')
        this.detailVisibleCopy = false
        // this.detailVisible = false
        this.page.currentPage = 1
        this.onLoad(this.page, this.query)
@@ -1314,7 +1370,7 @@
}
:deep(.el-textarea__inner) {
  resize: none;
  resize: none;
}
.action-bar {
@@ -1329,7 +1385,7 @@
.el-dialog {
  .el-form-item {
    margin-bottom: 20px;
    margin-bottom: 10px;
  }
}