无人机管理后台前端(已迁走)
rjg
2025-04-17 3517c8c68d8439796adff77193b82a01ad7b11b2
Merge branch 'master' of http://139.196.74.78:10010/r/drone/drone-web-manage
2 files modified
64 ■■■■ changed files
src/views/tickets/orderLog.vue 53 ●●●●● patch | view | raw | blame | history
src/views/tickets/ticket.vue 11 ●●●●● patch | view | raw | blame | history
src/views/tickets/orderLog.vue
@@ -11,7 +11,7 @@
<template>
    <basic-container>
        <el-tabs v-model="activeTab" @tab-click="handleTabChange">
            <el-tab-pane v-for="tab in tabs" :key="tab.name" :label="`${tab.label} (${tab.count})`" :name="tab.name">
            <el-tab-pane v-for="tab in filteredTabs" :key="tab.name" :label="`${tab.label} (${tab.count})`" :name="tab.name">
                <div class="tab-content">
                    <!-- 查询条件筛选栏 -->
                    <div class="filter-bar">
@@ -67,13 +67,13 @@
                        :table-loading="loading" @current-change="currentChange" @refresh-change="refreshChange"
                        @on-load="onLoad" @search-change="searchChange" @size-change="sizeChange">
                        <template #menu-left>
                            <el-button type="primary" icon="el-icon-plus" v-if="activeTab!='WAIT_AUDIT' ">新建工单</el-button>
                            <el-button v-if="hasAddBtnPermission()" type="primary" icon="el-icon-plus" v-if="activeTab!='WAIT_AUDIT' ">新建工单</el-button>
                            <el-button type="success" plain icon="el-icon-download" @click="exportData">导出</el-button>
                        </template>
                        <template #menu="{ row }">
                            <div v-if="row.status == 1 && userInfo.user_id != row.create_user">
                                <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">审核</el-button>
                                <el-button v-if="hasPaddingBtnPermission()" type="text" icon="el-icon-view" @click="handleViewDetail(row)">审核</el-button>
                                   <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
                            </div>
@@ -82,7 +82,8 @@
                                <div v-if="row.status == 1">
                                    <el-button type="text" icon="el-icon-warning-outline"
                                        @click="orderLogRecall(row.id)">撤回</el-button>
                                    <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
                                    <el-button type="text" icon="el-icon-view"
                                        @click="handleViewDetail(row)">详情</el-button>
                                </div>
                                   </div>
                                <!--已驳回-->
@@ -91,16 +92,14 @@
                                        @click="rejectDetail(row.id)">驳回原因</el-button>
                                        <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
                                </div>
                                   <div v-if="row.status == 3">
                                        <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button>
                                </div>
                                <!--草稿-->
                                <div v-if="row.status == 0 && userInfo.user_id == row.create_user">
                                    <el-button type="text" icon="el-icon-edit-outline"
                                        @click="handleViewDetail(row)">编辑</el-button>
                                         <el-button type="text" icon="el-icon-position" @click="userPublishPush(row.id)">发布</el-button>
                                             <el-button type="text" icon="el-icon-delete" @click="deleteOrderLog(row.id)">删除</el-button>
                                <el-button type="text" icon="el-icon-position"
                                    @click="userPublishPush(row.id)">发布</el-button>
                                <el-button type="text" icon="el-icon-delete"
                                    @click="deleteOrderLog(row.id)">删除</el-button>
                                </div>
                             
                         
@@ -288,8 +287,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 ||  userInfo.user_id == form.create_user"
                        <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 && userInfo.user_id != form.create_user"
@@ -471,7 +469,20 @@
        this.fetchTableData()
    },
    computed: {
        ...mapGetters(['userInfo']),
        ...mapGetters(['userInfo', 'permission']),
        filteredTabs() {
            // rejection_and_draft 权限控制“已驳回”和“草稿”tab
            const canShowRejectAndDraft = this.permission?.rejection_and_draft === true;
            return this.tabs.map(tab => {
                if (tab.name === 'DRAFT') {
                    return { ...tab, isShow: canShowRejectAndDraft };
                }
                if (tab.name === 'REJECTED') {
                    return { ...tab, isShow: canShowRejectAndDraft };
                }
                return { ...tab, isShow: true };
            }).filter(tab => tab.isShow);
        },
    },
    methods: {
@@ -533,7 +544,7 @@
                })
          
                console.log('权限检查:', this.permission);
                this.page.total = total || 0
                this.updateGlobalCounts()
            } catch (error) {
@@ -662,8 +673,7 @@
        },
        handleTabChange (tab) {
            this.activeTab = tab.props?.name || tab.name;
            this.filters.status = ''
            this.activeTab = tab.props?.name || tab.name
            this.filters.status = ''
            this.page.currentPage = 1
            this.fetchTableData()
@@ -740,7 +750,6 @@
            }
            return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}`
        },
        async handleViewDetail (row) {
            const response = await orderLogDetails(row.id)
            this.form = {
@@ -767,6 +776,16 @@
                })
            })
        },
        hasAddBtnPermission() {
            // undefined 或 false 都返回 false,只有 true 返回 true
            console.log('this.permission.order_log_add :', this.permission.order_log_add );
            return this.permission && this.permission.order_log_add === true;
        },
        hasPaddingBtnPermission() {
            // undefined 或 false 都返回 false,只有 true 返回 true
            console.log('权限检查:', this.permission);
            return this.permission && this.permission.order_log_review === true;
        },
        //自己点发布
           userPublishPush (id) {
            this.$confirm('确定发布吗?', '提示', {
src/views/tickets/ticket.vue
@@ -446,6 +446,7 @@
  name: "TicketPage",
  data() {
    return {
      submitLoading: false, // 新增loading状态
      activeTab: "all",
      // tabs 只保留静态结构,不做权限判断
      tabs: [
@@ -965,6 +966,8 @@
    },
    async submitForm() {
      if (this.submitLoading) return; // 防止重复提交
      this.submitLoading = true;
      try {
        // 提交时需要完整验证
        await this.$refs.form.validate();
@@ -1021,9 +1024,14 @@
          this.$message.error(error.message || '工单创建失败,请稍后重试');
        }
      }
      finally {
      this.submitLoading = false;
    }
    },
    async saveDraft() {
      if (this.submitLoading) return; // 防止重复提交
      this.submitLoading = true;
      try {
        const submitData = {
          id: this.form.id,
@@ -1067,6 +1075,9 @@
      } catch (error) {
        this.$message.error(error.message || '保存草稿失败,请稍后重试');
      }
      finally {
      this.submitLoading = false;
    }
    },
    async handleLocationChange(val) {