无人机管理后台前端(已迁走)
张含笑
2025-07-16 d0b0fc600751f0e161ae55c7b9c6fde452e85207
src/views/tickets/ticket.vue
@@ -32,7 +32,7 @@
          <!-- 表格部分 -->
          <avue-crud ref="avueCrud" v-model="tableData" :option="option" :data="tableData" v-model:page="page"
            @size-change="sizeChange" @current-change="handleCurrentChange" :table-loading="loading"
            @size-change="sizeChange" @current-change="handleCurrentChange" @refresh-change="refreshChange" :table-loading="loading"
            @selection-change="handleSelectionChange" :permission="permissionList" v-if="activeTab === tab.name">
            <template #menu-left>
              <el-button v-if="(activeTab === 'all' || activeTab === 'myTickets') && permissionList.addBtn"
@@ -53,8 +53,11 @@
                <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
              </template>
              <el-button v-if="row.status === 4 && row.isReview !== 1" type="text" icon="el-icon-check"
                @click="reCheck(row)">复核</el-button>
              <template v-if="permission.tickets_repeat_review">
                <el-button v-if="row.status === 4 && row.isReview !== 1" type="text" icon="el-icon-check"
                           @click="reCheck(row)">复核</el-button>
              </template>
            </template>
            <template #status="{ row }">
              <span :style="getStatusTagType(row.status) ? 'color:' + getStatusTagType(row.status) : ''">
@@ -145,11 +148,21 @@
            </el-col>
            <el-col :span="12">
              <el-form-item label="附件图片" prop="photos" required class="upload-wrapper">
                <el-upload ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card"
                <el-upload v-if="createoredit === 1" ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card"
                  :on-change="handleFileChange" :on-remove="handleUploadRemove" :before-upload="beforeUpload"
                  :file-list="form.photos" :limit="1" accept="image/*" class="create-upload">
                  <template v-if="form.photos.length < 1">
                    <!-- <i class="el-icon-plus">+</i> -->
                      <div class="el-icon-plus">
                      <span>+</span>
                    </div>
                  </template>
                </el-upload>
                  <el-upload v-else ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card"
                  :on-change="handleFileChange" :on-remove="handleUploadRemove" :before-upload="beforeUpload"
                  :file-list="popupShowImage(form.photos)" :limit="1" accept="image/*" class="create-upload">
                  <template v-if="form.photos.length < 1">
                      <div class="el-icon-plus">
                      <span>+</span>
                    </div>
@@ -504,9 +517,11 @@
</template>
<script>
import { getSmallImg,getShowImg } from '@/utils/util';
import { ElMessageBox, ElLoading } from 'element-plus'
import { calculateDefaultRange } from '@/utils/util'
import { gcj02ToWgs84, wgs84ToGcj02 } from '@/utils/coordinateTransformation'
import _ from 'lodash'
import {
  getList,
  createTicket,
@@ -519,7 +534,6 @@
} from '@/api/tickets/ticket'
import { export_json_to_excel } from '@/utils/exportExcel'
import geoJson from '@/assets/geoJson.json'
import { mapGetters } from 'vuex'
import { getAdcodeObj } from '@/utils/disposeData'
function regExp (label, name) {
@@ -539,6 +553,7 @@
      dispatchLoading: false,
      completeLoading: false,
      finalizeLoading: false,
      createoredit:'',
      activeTab: 'all',
      // tabs 只保留静态结构,不做权限判断
      tabs: [
@@ -730,6 +745,11 @@
  mounted () {
    const href = this.$route.href
    if (this.$route?.query?.status !== undefined && this.$route?.query?.status !== null){
      this.filters.status = this.$route?.query?.status + ''
      this.$router.replace({})
    }
    let curQueryParams = {}
    if (href.indexOf('?') != -1 && href.split('?').length > 0) {
@@ -891,7 +911,7 @@
        { label: '关联任务', value: this.currentDetail.job_name || '/' },
        { label: '任务发起人', value: this.currentDetail.creator },
        { label: '当前状态', value: this.mapStatus(this.currentDetail.status) },
        { label: '事件地址', value: this.currentDetail.address }, // 包含经纬度信息
        { label: '事件地址', value: this.currentDetail.address || this.currentDetail.latAndLon }, // 包含经纬度信息
        { label: '关联算法', value: this.currentDetail.aiType },
        { label: '发起单位', value: this.currentDetail.department },
        { label: '发起任务时间', value: this.currentDetail.startTime },
@@ -968,6 +988,16 @@
        return '/'
      }
    },
    popupShowImage () {
      return (list) => {
        return list.map(item => ({
          ...item,
          url: getShowImg(item.url)
        }))
      }
    }
  },
  methods: {
@@ -1474,6 +1504,8 @@
    },
    async handleCurrentChange (val) {
      // 先更新页码
      this.page.currentPage = val
      // 等待 DOM 更新后再请求数据
@@ -1482,6 +1514,7 @@
    },
    async sizeChange (val) {
      this.page.pageSize = val
      this.page.currentPage = 1 // 重置到第一页
      await this.$nextTick()
@@ -1489,6 +1522,8 @@
    },
    handleAdd () {
    this.createoredit =1
      this.dialogVisible = true
      this.mapParams.center = null
      this.form.location = []
@@ -1520,6 +1555,7 @@
    },
    async handleViewDetail (row) {
      // 找到当前行在tableData中的索引
      this.currentIndex = this.tableData.findIndex(item => item.id === row.id)
      // 先设置workType,直接从row读取
@@ -1569,8 +1605,8 @@
          })
        }
        this.currentDetail.status = row.status
      } catch (error) {
        if (this.activeTab === 'myTickets') {
          const statusArr = this.workType === 1 ? ['3', '4'] : this.fixedStatuses
@@ -1583,8 +1619,13 @@
          this.stepInfos = []
        }
      }
      console.log(detailData,'detailDatadetailDatadetailData');
      this.currentDetail = {
        ...detailData,
        address:null,
        latAndLon: _.round(detailData.location[0],6) + ',' + _.round(detailData.location[1],6)
      }
      this.currentDetail = detailData
       console.log('this.currentDetail',this.currentDetail);
      this.detailVisible = true
      this.$nextTick(() => {
@@ -1999,6 +2040,7 @@
    // 添加编辑方法
    handleEdit (row) {
    this.createoredit = 2
      console.log('编辑原始数据:', row)
      // 尝试从row.dept_id或通过部门名称查找对应的部门ID
@@ -2074,6 +2116,7 @@
        address: row.address || '',
        content: row.content,
        photos: [],
      }
      let curLocation = []
@@ -2147,6 +2190,7 @@
    // 添加选择变化处理方法
    handleSelectionChange (selection) {
      this.selections = selection
      console.log('已选择的行:', selection)
    },