Explorar o código

feat: 数据管理-报警问题管理的删除按钮添加权限

“fujiacheng” hai 1 ano
pai
achega
67a9ce5294

+ 152 - 114
src/views/datamanager/alertformdata/components/common/AlertTable.vue

@@ -1,7 +1,14 @@
 <template>
   <div class="alert-table-box">
-    <el-table ref="multipleTableRef" :data="tableData" style="width: 100%" height="100%" stripe
-      :cell-style="colorOfState" @selection-change="handleSelectionChange">
+    <el-table
+      ref="multipleTableRef"
+      :data="tableData"
+      style="width: 100%"
+      height="100%"
+      stripe
+      :cell-style="colorOfState"
+      @selection-change="handleSelectionChange"
+    >
       <el-table-column type="selection" width="55"></el-table-column>
       <el-table-column label="问题来源" prop="source" width="150">
         <template #default="{ row }">
@@ -37,22 +44,44 @@
             @click="handleShow(row)">
           <img src="/src/assets/images/alert/show-off.png" alt="" title="点击恢复问题展示" v-if="row.isHide"
             @click="handleShow(row)"> -->
-          <el-tooltip effect="dark" :content="row.isHide ? '点此设置为生效问题' : '点此设置为无效问题'" placement="top">
+          <el-tooltip
+            effect="dark"
+            :content="row.isHide ? '点此设置为生效问题' : '点此设置为无效问题'"
+            placement="top"
+          >
             <el-switch :model-value="!row.isHide" @change="handleShow(row)" />
           </el-tooltip>
           <el-tooltip effect="dark" content="点击标记为加急问题" placement="top">
-            <img src="/src/assets/images/alert/urgent.png" alt="" v-if="!isShowTab && !row.priority"
-              @click="handleUrgent(row)">
+            <img
+              src="/src/assets/images/alert/urgent.png"
+              alt=""
+              v-if="!isShowTab && !row.priority"
+              @click="handleUrgent(row)"
+            />
           </el-tooltip>
           <el-tooltip effect="dark" content="点击取消问题加急" placement="top">
-            <img src="/src/assets/images/alert/urgent-active.png" alt="" v-if="!isShowTab && row.priority"
-              @click="handleUrgent(row)">
+            <img
+              src="/src/assets/images/alert/urgent-active.png"
+              alt=""
+              v-if="!isShowTab && row.priority"
+              @click="handleUrgent(row)"
+            />
           </el-tooltip>
           <el-tooltip effect="dark" content="点击编辑问题" placement="top">
-            <img src="/src/assets/images/alert/edit.png" alt="" v-if="isShowTab" @click="handleEdit(row)">
+            <img
+              src="/src/assets/images/alert/edit.png"
+              alt=""
+              v-if="isShowTab"
+              @click="handleEdit(row)"
+            />
           </el-tooltip>
-          <el-tooltip effect="dark" content="点击删除问题数据" placement="top">
-            <img src="/src/assets/images/alert/delete.png" alt="" @click="handleDelete(row)">
+          <el-tooltip
+            effect="dark"
+            content="点击删除问题数据"
+            placement="top"
+            v-if="hasDataDeletePermisson()"
+          >
+            <img src="/src/assets/images/alert/delete.png" alt="" @click="handleDelete(row)" />
           </el-tooltip>
         </template>
       </el-table-column>
@@ -61,121 +90,130 @@
 </template>
 
 <script setup lang="ts">
-import { ElTable } from 'element-plus';
-import { onBeforeMount, ref } from 'vue';
-import { getNameBySource, getNameByState } from './constant.question';
-import { useIssueType } from '../../hooks/useIssueType';
-import { useWorkLocation } from '../../hooks/useWorkLocation';
-
-const { aiOptions, manualOptions, getAIOptions, getManualOptions, getNameByType } = useIssueType();
-const { locationOptions, getLocationOptions, getNameByWorkid } = useWorkLocation();
-
-const multipleTableRef = ref<InstanceType<typeof ElTable>>();
-
-interface DataSourceItem {
-  source: Number,         // 问题单来源:1-AI检测、2-人工上报
-  issueType: Number,      // 问题单类型
-  description: String,    // 问题描述
-  workspaceId: Number[],  // 工位id(地点=车间+工位?)
-  createdAt: String,
-  personNameInCharge: String,
-  issueState: Number,     // 问题单状态:1-待审核、2-待处理、3-待复核、4-已退回、5-已处理
-};
-
-interface Props {
-  tableData: Array<DataSourceItem>;
-  isShowTab: boolean;    // true展示数据,false默认数据
-  onDetail: (row: DataSourceItem) => unknown; // 详情事件
-  onUrgent?: (row: DataSourceItem) => unknown; // isShowTab=false时,加急按钮事件
-  onEdit?: (row: DataSourceItem) => unknown;   // isShowTab=true时,编辑按钮事件
-  onShow: (row: DataSourceItem) => unknown;   // 显示/隐藏按钮事件
-  onDelete: (row: DataSourceItem) => unknown; // 删除按钮事件
-};
-
-const props = defineProps<Props>();
-
-const emits = defineEmits(['update:selection'])
-const handleSelectionChange = (selection: any[]) => {
-  emits("update:selection", selection);
-};
-
-const handleDetailClick = (row) => {
-  props.onDetail(row);
-};
-const handleUrgent = (row) => {
-  props.onUrgent?.(row);
-};
-const handleEdit = (row) => {
-  props.onEdit?.(row);
-};
-const handleShow = (row) => {
-  props.onShow(row);
-};
-const handleDelete = (row) => {
-  props.onDelete(row);
-};
-
-const getSplicedDes = (val) => {
-  if (val.length < 20) return val;
-  else {
-    const temp = val.substring(0, 20);
-    return temp + '…';
-  }
-};
-
-const colorOfState = ({ row, columnIndex }) => {
-  if (columnIndex === 7) {
-    if (row.issueState === 4 || row.issueState === 6) return { color: "#FF4D4F" };         // 待处理
-    else if (row.issueState === 7 || row.issueState === 8) return { color: "#52C41A " };   // 已处理
-    else if (row.issueState === 3) return { color: "#cdca00" };        // 已撤销
-    else return { color: "#1890FF " };    // 待审核,待复核
+  import { ElTable } from 'element-plus';
+  import { onBeforeMount, ref } from 'vue';
+  import { getNameBySource, getNameByState } from './constant.question';
+  import { useIssueType } from '../../hooks/useIssueType';
+  import { useWorkLocation } from '../../hooks/useWorkLocation';
+  import { useUserStore } from '@/store/modules/user';
+
+  const userStore = useUserStore();
+  const hasDataDeletePermisson = () => {
+    return userStore.checkPermission('data_delete');
   };
-  if (row.isHide) {
-    return { color: "#A8ABB2" };
+
+  const { aiOptions, manualOptions, getAIOptions, getManualOptions, getNameByType } =
+    useIssueType();
+  const { locationOptions, getLocationOptions, getNameByWorkid } = useWorkLocation();
+
+  const multipleTableRef = ref<InstanceType<typeof ElTable>>();
+
+  interface DataSourceItem {
+    source: Number; // 问题单来源:1-AI检测、2-人工上报
+    issueType: Number; // 问题单类型
+    description: String; // 问题描述
+    workspaceId: Number[]; // 工位id(地点=车间+工位?)
+    createdAt: String;
+    personNameInCharge: String;
+    issueState: Number; // 问题单状态:1-待审核、2-待处理、3-待复核、4-已退回、5-已处理
+  }
+
+  interface Props {
+    tableData: Array<DataSourceItem>;
+    isShowTab: boolean; // true展示数据,false默认数据
+    onDetail: (row: DataSourceItem) => unknown; // 详情事件
+    onUrgent?: (row: DataSourceItem) => unknown; // isShowTab=false时,加急按钮事件
+    onEdit?: (row: DataSourceItem) => unknown; // isShowTab=true时,编辑按钮事件
+    onShow: (row: DataSourceItem) => unknown; // 显示/隐藏按钮事件
+    onDelete: (row: DataSourceItem) => unknown; // 删除按钮事件
   }
-};
 
-const clearAll = () => {
-  multipleTableRef.value!.clearSelection();
-};
+  const props = defineProps<Props>();
+
+  const emits = defineEmits(['update:selection']);
+  const handleSelectionChange = (selection: any[]) => {
+    emits('update:selection', selection);
+  };
+
+  const handleDetailClick = (row) => {
+    props.onDetail(row);
+  };
+  const handleUrgent = (row) => {
+    props.onUrgent?.(row);
+  };
+  const handleEdit = (row) => {
+    props.onEdit?.(row);
+  };
+  const handleShow = (row) => {
+    props.onShow(row);
+  };
+  const handleDelete = (row) => {
+    props.onDelete(row);
+  };
+
+  const getSplicedDes = (val) => {
+    if (val.length < 20) return val;
+    else {
+      const temp = val.substring(0, 20);
+      return temp + '…';
+    }
+  };
 
-defineExpose({ clearAll })
+  const colorOfState = ({ row, columnIndex }) => {
+    if (columnIndex === 7) {
+      if (row.issueState === 4 || row.issueState === 6) return { color: '#FF4D4F' }; // 待处理
+      else if (row.issueState === 7 || row.issueState === 8) return { color: '#52C41A ' }; // 已处理
+      else if (row.issueState === 3) return { color: '#cdca00' }; // 已撤销
+      else return { color: '#1890FF ' }; // 待审核,待复核
+    }
+    if (row.isHide) {
+      return { color: '#A8ABB2' };
+    }
+  };
 
-onBeforeMount(() => {
-  getAIOptions();
-  getManualOptions();
-  getLocationOptions();
-});
+  const clearAll = () => {
+    multipleTableRef.value!.clearSelection();
+  };
+
+  defineExpose({ clearAll });
+
+  onBeforeMount(() => {
+    getAIOptions();
+    getManualOptions();
+    getLocationOptions();
+  });
 </script>
 
 <style scoped lang="scss">
-.alert-table-box {
-  display: flex;
-  flex-direction: column;
-  height: calc(100vh - 350px);
-}
-
-.detail-text {
-  color: #1890FF;
-  font-weight: 500;
-  cursor: pointer;
-}
-
-:deep(.el-table-fixed-column--right) {
-  .cell {
+  .alert-table-box {
     display: flex;
-    align-items: center;
+    flex-direction: column;
+    height: calc(100vh - 350px);
   }
 
-  .el-switch {
-    margin-right: 20px;
+  .detail-text {
+    color: #1890ff;
+    font-weight: 500;
+    cursor: pointer;
   }
 
-  img {
-    width: 20px;
-    height: 20px;
-    margin-right: 20px;
-    cursor: pointer;
+  :deep(.el-table-fixed-column--right) {
+    .cell {
+      display: flex;
+      align-items: center;
+      display: flex;
+      justify-content: space-between;
+    }
+
+    .el-switch {
+      margin-right: 20px;
+    }
+
+    img {
+      width: 20px;
+      height: 20px;
+      margin-right: 20px;
+      cursor: pointer;
+    }
   }
-}
-</style>
+</style>

+ 406 - 372
src/views/datamanager/alertformdata/components/default/Default.vue

@@ -1,435 +1,469 @@
 <template>
   <div class="box">
     <div class="search-form">
-      <QueryForm :ai-options="aiOptions" :manual-options="manualOptions" :location-options="locationOptions"
-        @on-search="handleSearch" @on-reset="handleReset" />
+      <QueryForm
+        :ai-options="aiOptions"
+        :manual-options="manualOptions"
+        :location-options="locationOptions"
+        @on-search="handleSearch"
+        @on-reset="handleReset"
+      />
     </div>
     <div class="table-list">
       <div v-if="showActionBar" class="action-bar">
         <span class="num-text">已选{{ chooseNum }}项</span>
-        <el-button :class="isActiveCancelHide ? 'btn-active' : 'btn-normal'"
-          @click="handleCancelHideAll">全部生效</el-button>
-        <el-button :class="isActiveHide ? 'btn-active' : 'btn-normal'" @click="handleHideAll">全部失效</el-button>
-        <el-button :class="isActiveDelete ? 'btn-active' : 'btn-normal'" @click="handleDeleteAll">删除</el-button>
-        <el-button v-if="!cancelUrgentFlag" :class="isActiveUrgent ? 'btn-active' : 'btn-normal'"
-          @click="handleUrgentAll">标记加急</el-button>
-        <el-button v-if="cancelUrgentFlag" :class="isActiveCancelUrgent ? 'btn-active' : 'btn-normal'"
-          @click="handleCancelUrgentAll">取消加急</el-button>
-        <el-button v-if="hasPermisson()" :class="isActiveCopy ? 'btn-active' : 'btn-normal'"
-          @click="handleCopyToShow">复制到展示数据</el-button>
+        <el-button
+          :class="isActiveCancelHide ? 'btn-active' : 'btn-normal'"
+          @click="handleCancelHideAll"
+          >全部生效</el-button
+        >
+        <el-button :class="isActiveHide ? 'btn-active' : 'btn-normal'" @click="handleHideAll"
+          >全部失效</el-button
+        >
+        <el-button :class="isActiveDelete ? 'btn-active' : 'btn-normal'" @click="handleDeleteAll"
+          >删除</el-button
+        >
+        <el-button
+          v-if="!cancelUrgentFlag"
+          :class="isActiveUrgent ? 'btn-active' : 'btn-normal'"
+          @click="handleUrgentAll"
+          >标记加急</el-button
+        >
+        <el-button
+          v-if="cancelUrgentFlag"
+          :class="isActiveCancelUrgent ? 'btn-active' : 'btn-normal'"
+          @click="handleCancelUrgentAll"
+          >取消加急</el-button
+        >
+        <el-button
+          v-if="hasPermisson()"
+          :class="isActiveCopy ? 'btn-active' : 'btn-normal'"
+          @click="handleCopyToShow"
+          >复制到展示数据</el-button
+        >
         <span class="close-btn" @click="handleSelectNone"></span>
       </div>
-      <AlertTable ref="alertTableRef" class="table-bar" :is-show-tab="false" :table-data="tableData"
-        :on-detail="handleDetail" :on-urgent="handleUrgent" :on-show="handleShow" :on-delete="handleDelete"
-        @update:selection="handlePop" />
+      <AlertTable
+        ref="alertTableRef"
+        class="table-bar"
+        :is-show-tab="false"
+        :table-data="tableData"
+        :on-detail="handleDetail"
+        :on-urgent="handleUrgent"
+        :on-show="handleShow"
+        :on-delete="handleDelete"
+        @update:selection="handlePop"
+      />
     </div>
     <div class="pagination-box">
-      <Pagination v-model:page="query.pageNumber" v-model:size="query.pageSize" :total="total"
-        @update:page="handlePageChange" @update:size="handleSizeChange" />
+      <Pagination
+        v-model:page="query.pageNumber"
+        v-model:size="query.pageSize"
+        :total="total"
+        @update:page="handlePageChange"
+        @update:size="handleSizeChange"
+      />
     </div>
-    <DetailDialog v-if="isDetailDialogShow" :description="detailDescription" :image-paths="detailPictures"
-      :video-paths="detailVideos" @close="closeDetailDialog" />
+    <DetailDialog
+      v-if="isDetailDialogShow"
+      :description="detailDescription"
+      :image-paths="detailPictures"
+      :video-paths="detailVideos"
+      @close="closeDetailDialog"
+    />
   </div>
 </template>
 
 <script setup lang="ts">
-import { ref, onMounted, onBeforeMount } from 'vue';
-import { ElMessage, ElMessageBox } from 'element-plus';
-import QueryForm from '../common/QueryForm.vue';
-import AlertTable from '../common/AlertTable.vue';
-import DetailDialog from '../common/DetailDialog.vue';
-import Pagination from '../common/Pagination.vue';
-import { useIssueType } from '../../hooks/useIssueType';
-import { useWorkLocation } from '../../hooks/useWorkLocation';
-import {
-  getDefaultTableData,
-  deleteDefaultTableData,
-  copyToShowTableData,
-  updateDefaultHide,
-  updateDefaultHideAll,
-  updateDefaultPriority,
-  updateDefaultPriorityAll
-} from '@/api/datamanagement/alert-default';
-import { useUserStore } from '@/store/modules/user';
-
-const userStore = useUserStore();
-const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();
-const { locationOptions, getLocationOptions } = useWorkLocation();
-
-const alertTableRef = ref<typeof AlertTable>();
-const tableData = ref([]);
-const showActionBar = ref(false);
-const chooseNum = ref(0);
-const chooseId = ref<number[]>([]);
-// const cancelHideFlag = ref(true);   // true取消隐藏 / false全部隐藏
-const cancelUrgentFlag = ref(true); // true取消加急 / false全部加急
-const isActiveHide = ref(false);
-const isActiveCancelHide = ref(false);
-const isActiveDelete = ref(false);
-const isActiveUrgent = ref(false);
-const isActiveCancelUrgent = ref(false);
-const isActiveCopy = ref(false);
-// 详情
-const isDetailDialogShow = ref(false);
-const detailDescription = ref('');
-const detailPictures = ref<string[]>([]);
-const detailVideos = ref<string[]>([]);
-// 分页
-const total = ref(0);
-
-const query = ref({
-  pageNumber: 1,
-  pageSize: 10
-});
-// 查询
-const handleSearch = (queryForm) => {
-  query.value = queryForm;
-  getTableData();
-};
-// 重置
-const handleReset = (queryForm) => {
-  query.value = queryForm;
-  getTableData();
-};
-
-// 多选
-const handlePop = (selection) => {
-  chooseId.value = [];
-  // cancelHideFlag.value = true;
-  cancelUrgentFlag.value = true;
-  selection.forEach((item) => {
-    if (chooseId.value.indexOf(item.id) === -1)
-      chooseId.value.push(item.id);
-    // 只要有一个item.isHide === false 说明多选的这些选项不是全都隐藏/失效,不用变成“取消隐藏”/全部生效
-    // if (item.isHide === false) cancelHideFlag.value = false;
-    // 只要有一个item.priority === 0 说明不是全都加急状态,不用变成“取消加急”
-    if (item.priority === 0) cancelUrgentFlag.value = false;
+  import { ref, onMounted, onBeforeMount } from 'vue';
+  import { ElMessage, ElMessageBox } from 'element-plus';
+  import QueryForm from '../common/QueryForm.vue';
+  import AlertTable from '../common/AlertTable.vue';
+  import DetailDialog from '../common/DetailDialog.vue';
+  import Pagination from '../common/Pagination.vue';
+  import { useIssueType } from '../../hooks/useIssueType';
+  import { useWorkLocation } from '../../hooks/useWorkLocation';
+  import {
+    getDefaultTableData,
+    deleteDefaultTableData,
+    copyToShowTableData,
+    updateDefaultHide,
+    updateDefaultHideAll,
+    updateDefaultPriority,
+    updateDefaultPriorityAll,
+  } from '@/api/datamanagement/alert-default';
+  import { useUserStore } from '@/store/modules/user';
+
+  const userStore = useUserStore();
+  const { aiOptions, manualOptions, getAIOptions, getManualOptions } = useIssueType();
+  const { locationOptions, getLocationOptions } = useWorkLocation();
+
+  const alertTableRef = ref<typeof AlertTable>();
+  const tableData = ref([]);
+  const showActionBar = ref(false);
+  const chooseNum = ref(0);
+  const chooseId = ref<number[]>([]);
+  // const cancelHideFlag = ref(true);   // true取消隐藏 / false全部隐藏
+  const cancelUrgentFlag = ref(true); // true取消加急 / false全部加急
+  const isActiveHide = ref(false);
+  const isActiveCancelHide = ref(false);
+  const isActiveDelete = ref(false);
+  const isActiveUrgent = ref(false);
+  const isActiveCancelUrgent = ref(false);
+  const isActiveCopy = ref(false);
+  // 详情
+  const isDetailDialogShow = ref(false);
+  const detailDescription = ref('');
+  const detailPictures = ref<string[]>([]);
+  const detailVideos = ref<string[]>([]);
+  // 分页
+  const total = ref(0);
+
+  const query = ref({
+    pageNumber: 1,
+    pageSize: 10,
   });
-  chooseNum.value = selection.length;
-  showActionBar.value = chooseNum.value > 0 ? true : false;
-};
-// 取消多选
-const handleSelectNone = () => {
-  chooseId.value = [];
-  chooseNum.value = 0;
-  alertTableRef.value?.clearAll();
-  showActionBar.value = false;
-};
-
-// 全部隐藏
-const handleHideAll = () => {
-  if (showActionBar.value) isActiveHide.value = !isActiveHide.value;
-  const updateList = {
-    ids: chooseId.value,
-    hide: true,
+  // 查询
+  const handleSearch = (queryForm) => {
+    query.value = queryForm;
+    getTableData();
   };
-  updateDefaultHideAll(updateList).then(() => {
-    handleSelectNone();
+  // 重置
+  const handleReset = (queryForm) => {
+    query.value = queryForm;
     getTableData();
-    ElMessage({
-      message: '操作成功',
-      type: 'success',
+  };
+
+  // 多选
+  const handlePop = (selection) => {
+    chooseId.value = [];
+    // cancelHideFlag.value = true;
+    cancelUrgentFlag.value = true;
+    selection.forEach((item) => {
+      if (chooseId.value.indexOf(item.id) === -1) chooseId.value.push(item.id);
+      // 只要有一个item.isHide === false 说明多选的这些选项不是全都隐藏/失效,不用变成“取消隐藏”/全部生效
+      // if (item.isHide === false) cancelHideFlag.value = false;
+      // 只要有一个item.priority === 0 说明不是全都加急状态,不用变成“取消加急”
+      if (item.priority === 0) cancelUrgentFlag.value = false;
     });
-    setTimeout(function () {
-      isActiveHide.value = !isActiveHide.value;
-    }, 1000);
-  });
-};
-
-// 取消隐藏
-const handleCancelHideAll = () => {
-  if (showActionBar.value) isActiveCancelHide.value = !isActiveCancelHide.value;
-  const updateList = {
-    ids: chooseId.value,
-    hide: false,
+    chooseNum.value = selection.length;
+    showActionBar.value = chooseNum.value > 0 ? true : false;
   };
-  updateDefaultHideAll(updateList).then(() => {
-    handleSelectNone();
-    getTableData();
-    ElMessage({
-      message: '操作成功',
-      type: 'success',
+  // 取消多选
+  const handleSelectNone = () => {
+    chooseId.value = [];
+    chooseNum.value = 0;
+    alertTableRef.value?.clearAll();
+    showActionBar.value = false;
+  };
+
+  // 全部隐藏
+  const handleHideAll = () => {
+    if (showActionBar.value) isActiveHide.value = !isActiveHide.value;
+    const updateList = {
+      ids: chooseId.value,
+      hide: true,
+    };
+    updateDefaultHideAll(updateList).then(() => {
+      handleSelectNone();
+      getTableData();
+      ElMessage({
+        message: '操作成功',
+        type: 'success',
+      });
+      setTimeout(function () {
+        isActiveHide.value = !isActiveHide.value;
+      }, 1000);
     });
-    setTimeout(function () {
-      isActiveCancelHide.value = !isActiveCancelHide.value;
-    }, 1000);
-  });
-}
-
-// 批量删除
-const handleDeleteAll = () => {
-  if (showActionBar.value) isActiveDelete.value = !isActiveDelete.value;
-  ElMessageBox.confirm(
-    '删除之后,数据无法恢复',
-    '请确认是否删除数据',
-    {
+  };
+
+  // 取消隐藏
+  const handleCancelHideAll = () => {
+    if (showActionBar.value) isActiveCancelHide.value = !isActiveCancelHide.value;
+    const updateList = {
+      ids: chooseId.value,
+      hide: false,
+    };
+    updateDefaultHideAll(updateList).then(() => {
+      handleSelectNone();
+      getTableData();
+      ElMessage({
+        message: '操作成功',
+        type: 'success',
+      });
+      setTimeout(function () {
+        isActiveCancelHide.value = !isActiveCancelHide.value;
+      }, 1000);
+    });
+  };
+
+  // 批量删除
+  const handleDeleteAll = () => {
+    if (showActionBar.value) isActiveDelete.value = !isActiveDelete.value;
+    ElMessageBox.confirm('删除之后,数据无法恢复', '请确认是否删除数据', {
       confirmButtonText: '确定',
       cancelButtonText: '取消',
       type: 'warning',
       customClass: 'deleteMessage',
-      center: true
-    }
-  )
-    .then(() => {
-      deleteDefaultTableData(chooseId.value).then(() => {
+      center: true,
+    })
+      .then(() => {
+        deleteDefaultTableData(chooseId.value).then(() => {
+          ElMessage({
+            type: 'success',
+            message: '删除成功',
+          });
+          getTableData();
+          handleSelectNone();
+          isActiveDelete.value = !isActiveDelete.value;
+        });
+      })
+      .catch(() => {
         ElMessage({
-          type: 'success',
-          message: '删除成功',
+          type: 'info',
+          message: '取消删除',
         });
-        getTableData();
-        handleSelectNone();
         isActiveDelete.value = !isActiveDelete.value;
-      })
-    })
-    .catch(() => {
+      });
+  };
+
+  // 标记加急,设置priority = 1
+  const handleUrgentAll = () => {
+    if (showActionBar.value) isActiveUrgent.value = !isActiveUrgent.value;
+    const updateList = {
+      ids: chooseId.value,
+      priority: 1,
+    };
+    updateDefaultPriorityAll(updateList).then(() => {
+      handleSelectNone();
+      getTableData();
       ElMessage({
-        type: 'info',
-        message: '取消删除',
+        message: '已加急',
+        type: 'success',
       });
-      isActiveDelete.value = !isActiveDelete.value;
-    })
-};
-
-// 标记加急,设置priority = 1
-const handleUrgentAll = () => {
-  if (showActionBar.value) isActiveUrgent.value = !isActiveUrgent.value;
-  const updateList = {
-    ids: chooseId.value,
-    priority: 1,
+      setTimeout(function () {
+        isActiveUrgent.value = !isActiveUrgent.value;
+      }, 1000);
+    });
   };
-  updateDefaultPriorityAll(updateList).then(() => {
-    handleSelectNone();
-    getTableData();
-    ElMessage({
-      message: '已加急',
-      type: 'success',
+
+  // 取消加急
+  const handleCancelUrgentAll = () => {
+    if (showActionBar.value) isActiveCancelUrgent.value = !isActiveCancelUrgent.value;
+    const updateList = {
+      ids: chooseId.value,
+      priority: 0,
+    };
+    updateDefaultPriorityAll(updateList).then(() => {
+      handleSelectNone();
+      getTableData();
+      ElMessage({
+        message: '已取消加急',
+        type: 'success',
+      });
+      setTimeout(function () {
+        isActiveCancelUrgent.value = !isActiveCancelUrgent.value;
+      }, 1000);
     });
-    setTimeout(function () {
-      isActiveUrgent.value = !isActiveUrgent.value;
-    }, 1000);
-  });
-};
-
-// 取消加急
-const handleCancelUrgentAll = () => {
-  if (showActionBar.value) isActiveCancelUrgent.value = !isActiveCancelUrgent.value;
-  const updateList = {
-    ids: chooseId.value,
-    priority: 0,
   };
-  updateDefaultPriorityAll(updateList).then(() => {
-    handleSelectNone();
-    getTableData();
-    ElMessage({
-      message: '已取消加急',
-      type: 'success',
+
+  // 复制到展示数据
+  const handleCopyToShow = () => {
+    if (showActionBar.value) isActiveCopy.value = !isActiveCopy.value;
+    copyToShowTableData(chooseId.value).then(() => {
+      ElMessage({
+        message: '复制成功',
+        type: 'success',
+      });
+      setTimeout(function () {
+        isActiveCopy.value = !isActiveCopy.value;
+      }, 1000);
+      handleSelectNone();
     });
-    setTimeout(function () {
-      isActiveCancelUrgent.value = !isActiveCancelUrgent.value;
-    }, 1000);
-  });
-};
-
-// 复制到展示数据
-const handleCopyToShow = () => {
-  if (showActionBar.value) isActiveCopy.value = !isActiveCopy.value;
-  copyToShowTableData(chooseId.value).then(() => {
-    ElMessage({
-      message: '复制成功',
-      type: 'success',
+  };
+
+  // 详情
+  const closeDetailDialog = () => {
+    isDetailDialogShow.value = false;
+  };
+  const handleDetail = (row) => {
+    isDetailDialogShow.value = true;
+    detailDescription.value = row.description;
+    detailPictures.value = row.pictures;
+    detailVideos.value = row.videos;
+  };
+
+  // 单个加急priority=1/取消加急priority=0
+  const handleUrgent = (row) => {
+    const tempPriority = row.priority === 0 ? 1 : 0;
+    const updateList = {
+      id: row.id,
+      priority: tempPriority,
+    };
+    updateDefaultPriority(updateList).then(() => {
+      getTableData();
     });
-    setTimeout(function () {
-      isActiveCopy.value = !isActiveCopy.value;
-    }, 1000);
-    handleSelectNone();
-  })
-};
-
-// 详情
-const closeDetailDialog = () => {
-  isDetailDialogShow.value = false;
-};
-const handleDetail = (row) => {
-  isDetailDialogShow.value = true;
-  detailDescription.value = row.description;
-  detailPictures.value = row.pictures;
-  detailVideos.value = row.videos;
-};
-
-// 单个加急priority=1/取消加急priority=0
-const handleUrgent = (row) => {
-  const tempPriority = row.priority === 0 ? 1 : 0;
-  const updateList = {
-    id: row.id,
-    priority: tempPriority,
   };
-  updateDefaultPriority(updateList).then(() => {
-    getTableData();
-  });
-};
-
-// 单个显示hide=false/隐藏hide=true
-const handleShow = (row) => {
-  const tempHide = row.isHide === false ? true : false;
-  const updateList = {
-    id: row.id,
-    hide: tempHide,
+
+  // 单个显示hide=false/隐藏hide=true
+  const handleShow = (row) => {
+    const tempHide = row.isHide === false ? true : false;
+    const updateList = {
+      id: row.id,
+      hide: tempHide,
+    };
+    updateDefaultHide(updateList).then(() => {
+      getTableData();
+    });
   };
-  updateDefaultHide(updateList).then(() => {
-    getTableData();
-  });
-};
-
-// 删除
-const handleDelete = (row) => {
-  ElMessageBox.confirm(
-    '删除之后,数据无法恢复',
-    '请确认是否删除数据',
-    {
+
+  // 删除
+  const handleDelete = (row) => {
+    ElMessageBox.confirm('删除之后,数据无法恢复', '请确认是否删除数据', {
       confirmButtonText: '确定',
       cancelButtonText: '取消',
       type: 'warning',
       customClass: 'deleteMessage',
-      center: true
-    }
-  )
-    .then(() => {
-      deleteDefaultTableData([row.id]).then(() => {
-        ElMessage({
-          type: 'success',
-          message: '删除成功',
-        });
-        getTableData();
-      })
+      center: true,
     })
-    .catch(() => {
-      ElMessage({
-        type: 'info',
-        message: '取消删除',
+      .then(() => {
+        deleteDefaultTableData([row.id]).then(() => {
+          ElMessage({
+            type: 'success',
+            message: '删除成功',
+          });
+          getTableData();
+        });
       })
-    })
-};
-
-// 换页,重新获取表格
-const handlePageChange = (val) => {
-  query.value.pageNumber = val;
-  getTableData();
-};
-const handleSizeChange = (val) => {
-  query.value.pageSize = val;
-  getTableData();
-};
-
-const getTableData = () => {
-  getDefaultTableData(query.value).then((res) => {
-    console.log(res);
-    tableData.value = res.records;
-    total.value = res.totalRow;
-  })
-};
-
-const hasPermisson = () => {
-  return userStore.checkPermission("question_mock_edit_admin");
-};
-
-onMounted(() => {
-  getTableData();
-});
-
-onBeforeMount(() => {
-  getAIOptions();
-  getManualOptions();
-  getLocationOptions();
-});
-</script>
+      .catch(() => {
+        ElMessage({
+          type: 'info',
+          message: '取消删除',
+        });
+      });
+  };
 
-<style scoped lang="scss">
-.box {
-  display: flex;
-  flex-direction: column;
-}
+  // 换页,重新获取表格
+  const handlePageChange = (val) => {
+    query.value.pageNumber = val;
+    getTableData();
+  };
+  const handleSizeChange = (val) => {
+    query.value.pageSize = val;
+    getTableData();
+  };
 
-.table-list {
-  flex: 1;
-  // height: calc(100vh - 350px);
-  // overflow-y: scroll;
+  const getTableData = () => {
+    getDefaultTableData(query.value).then((res) => {
+      console.log(res);
+      tableData.value = res.records;
+      total.value = res.totalRow;
+    });
+  };
 
-  .action-bar {
-    display: flex;
-    align-items: center;
-    position: absolute;
-    min-width: calc(100vw - 266px);
-    height: 50px;
-    border-radius: 4px 4px 0px 0px;
-    background-color: #DDEFFF;
-    z-index: 10;
+  const hasPermisson = () => {
+    return userStore.checkPermission('question_mock_edit_admin');
+  };
 
-    .num-text {
-      margin: 0 34px 0 25px;
-      color: rgba(0, 0, 0, 0.85);
-      font-weight: 500;
-    }
+  onMounted(() => {
+    getTableData();
+  });
 
-    .btn-normal {
-      color: #1890FF;
-      background: transparent;
-      border: 1px solid #1890FF;
-      border-radius: 2px;
-    }
+  onBeforeMount(() => {
+    getAIOptions();
+    getManualOptions();
+    getLocationOptions();
+  });
+</script>
 
-    .btn-active {
-      color: #FFFFFF;
-      background-color: #1890FF;
-    }
+<style scoped lang="scss">
+  .box {
+    display: flex;
+    flex-direction: column;
+  }
 
-    .close-btn {
-      margin-left: auto;
-      margin-right: 20px;
+  .table-list {
+    flex: 1;
+    // height: calc(100vh - 350px);
+    // overflow-y: scroll;
+
+    .action-bar {
+      display: flex;
+      align-items: center;
+      position: absolute;
+      min-width: calc(100vw - 266px);
+      height: 50px;
+      border-radius: 4px 4px 0px 0px;
+      background-color: #ddefff;
+      z-index: 10;
+
+      .num-text {
+        margin: 0 34px 0 25px;
+        color: rgba(0, 0, 0, 0.85);
+        font-weight: 500;
+      }
+
+      .btn-normal {
+        color: #1890ff;
+        background: transparent;
+        border: 1px solid #1890ff;
+        border-radius: 2px;
+      }
+
+      .btn-active {
+        color: #ffffff;
+        background-color: #1890ff;
+      }
+
+      .close-btn {
+        margin-left: auto;
+        margin-right: 20px;
+      }
+
+      .close-btn:before {
+        content: '\2716';
+        color: #000;
+        cursor: pointer;
+      }
     }
 
-    .close-btn:before {
-      content: '\2716';
-      color: #000;
-      cursor: pointer;
+    .table-bar {
+      position: relative;
     }
   }
 
-  .table-bar {
-    position: relative;
+  .pagination-box {
+    height: 50px;
+    margin-top: 10px;
   }
-}
-
-.pagination-box {
-  height: 50px;
-  margin-top: 10px;
-}
 </style>
 <style lang="scss">
-.deleteMessage {
-  padding: 20px 24px;
-  box-shadow: 0px 12px 48px 16px rgba(0, 0, 0, 0.03), 0px 9px 28px 0px rgba(0, 0, 0, 0.05), 0px 6px 16px -8px rgba(0, 0, 0, 0.08);
-  border-radius: 8px;
-
-  .el-message-box__headerbtn {
-    margin-top: 12px;
-    margin-right: 12px;
-  }
+  .deleteMessage {
+    padding: 20px 24px;
+    box-shadow: 0px 12px 48px 16px rgba(0, 0, 0, 0.03), 0px 9px 28px 0px rgba(0, 0, 0, 0.05),
+      0px 6px 16px -8px rgba(0, 0, 0, 0.08);
+    border-radius: 8px;
+
+    .el-message-box__headerbtn {
+      margin-top: 12px;
+      margin-right: 12px;
+    }
 
-  .el-message-box__title {
-    justify-content: start;
-    color: rgba(0, 0, 0, 0.88);
-    font-size: 16px;
-    font-weight: 500;
-  }
+    .el-message-box__title {
+      justify-content: start;
+      color: rgba(0, 0, 0, 0.88);
+      font-size: 16px;
+      font-weight: 500;
+    }
 
-  .el-message-box__container {
-    justify-content: start;
-    margin-left: 23px;
-  }
+    .el-message-box__container {
+      justify-content: start;
+      margin-left: 23px;
+    }
 
-  .el-message-box__btns {
-    display: block;
-    float: right;
+    .el-message-box__btns {
+      display: block;
+      float: right;
+    }
   }
-}
-</style>
+</style>