forked from drone/command-center-dashboard

chenyao
2025-04-14 8dce9ec188a71901f21b34a5e1d6171e7551aee8
feat: 更新任务管理
6 files modified
217 ■■■■■ changed files
src/views/TaskManage/SearchBox.vue 83 ●●●●● patch | view | raw | blame | history
src/views/TaskManage/TaskIntermediateContent/TaskIntermediateContent.vue 126 ●●●● patch | view | raw | blame | history
src/views/TaskManage/TaskTop/TaskEvent.vue 1 ●●●● patch | view | raw | blame | history
src/views/TaskManage/TaskTop/TaskIndustry.vue 1 ●●●● patch | view | raw | blame | history
src/views/TaskManage/TaskTop/TaskTime.vue 1 ●●●● patch | view | raw | blame | history
src/views/TaskManage/TaskTop/TaskTotal.vue 5 ●●●●● patch | view | raw | blame | history
src/views/TaskManage/SearchBox.vue
@@ -15,8 +15,29 @@
            <el-option v-for="item in machineData" :key="item.device_sn" :label="item.nickname" :value="item.device_sn" />
          </el-select>
        </el-form-item>
        <el-form-item style="width: 520px;">
          <CommonDateTime style="width: 520px;" v-model="newTime" @change="getData" />
        <el-form-item>
          <el-date-picker
                        class="ztzf-date-picker"
                        v-model="dateRange"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        value-format="YYYY-MM-DD"
                        @change="handleSearch"
                    />
        </el-form-item>
        <el-form-item>
          <div class="time-card">
            <div
              class="card-item"
              :class="item === checked ? 'active' : ''"
              v-for="(item, index) in timeList"
              @click="timeClick(item,index)"
            >
              {{ timeListStr[index] }}
            </div>
          </div>
        </el-form-item>
        <el-form-item label="任务算法:" v-if="isExpand">
          <TaskAlgorithmBusiness :setWidth="200" :showAlgorithm="true" @algorithmChange="algorithmChange"/>
@@ -34,7 +55,7 @@
        <el-form-item label="任务类型:" v-if="isExpand">
          <TaskAlgorithmBusiness :setWidth="200" :showBusiness="true" @businessChange="businessChange"/>
        </el-form-item>
        <div class="more"  v-if="isExpand" @click="toggleExpand">收起</div>
        <div class="more" v-if="isExpand" @click="toggleExpand">收起</div>
        <div class="more" v-else @click="toggleExpand">更多</div>
        <div class="search-btn">
          <img @click="handleReset" src="@/assets/images/task/reset.png" alt="">
@@ -47,9 +68,9 @@
</template>
<script setup>
import { pxToRem } from '@/utils/rem'
import CommonDateTime from '@/components/CommonDateTime.vue'
import { deptsByAreaCode, getDockInfo } from '@/api/home/common';
import TaskAlgorithmBusiness from './components/TaskAlgorithmBusiness.vue';
import dayjs from 'dayjs';
const isExpand = ref(false);
const toggleExpand = () => {
@@ -142,6 +163,33 @@
  getDeptsByAreaCode();
};
// 日期 和周期
let timeList = ['today', 'week', 'month', 'year'];
let timeListStr = ['今日', '本周', '本月', '本年'];
let timeListEnum = ['TODAY', 'CURRENT_WEEK', 'CURRENT_MONTH', 'CURRENT_YEAR'];
let checked = ref('today');
const getDateRange = unit => {
  if (unit === 'today') {
    return [dayjs().format('YYYY-MM-DD'), dayjs().format('YYYY-MM-DD')];
  }
  return [dayjs().startOf(unit).format('YYYY-MM-DD'), dayjs().endOf(unit).format('YYYY-MM-DD')];
};
const dateRanges = {
  today: getDateRange('today'),
  week: getDateRange('week'),
  month: getDateRange('month'),
  year: getDateRange('year'),
};
let timeClick = (item,index) => {
  checked.value = item;
  // model.value = dateRanges[item];
  // emit('change', dateRanges[item],timeListEnum[index]);
  searchForm.value.date_enum = timeListEnum[index];
};
onMounted(() => {
  // requestDictionary();
@@ -158,7 +206,7 @@
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 0;  // 设置行间距和列间距
    gap: 20px 12px;  // 设置行间距和列间距
    .more {
      cursor: pointer;
      width: 32px;
@@ -166,7 +214,6 @@
      color: #60B2FF;
      line-height: 32px;
      font-size: 16px;
      margin-right: 10px;
    }
    .search-btn {
      position: absolute;
@@ -179,6 +226,30 @@
        margin-right: 10px;
      }
    }
    .time-card {
      text-align: center;
      background: linear-gradient(270deg, #195bad 0%, rgba(25, 91, 173, 0) 100%);
      border: 1px solid #306fca;
      font-family: Source Han Sans CN, Source Han Sans CN, serif;
      font-weight: 400;
      font-size: 14px;
      color: #ffffff;
      display: flex;
      height: 32px;
      .card-item {
        width: 66px;
        height: 100%;
        line-height: 32px;
        cursor: pointer;
      }
      .active {
        background: linear-gradient(270deg, #19ad8d 0%, rgba(25, 173, 141, 0) 100%);
        box-shadow: inset 0px 0px 8px 0px rgba(0, 255, 200, 0.6);
        border-radius: 0px 0px 0px 0px;
      }
    }
  }
  :deep(.el-form) {
    :deep(.el-input__wrapper.is-disabled) {
src/views/TaskManage/TaskIntermediateContent/TaskIntermediateContent.vue
@@ -2,32 +2,48 @@
<template>
  <div class="task-intermediate-content">
    <SearchBox @search="searchClick" @addTask="handleAddTask"></SearchBox>
    <el-table :data="jobListData" style="width: 100%" height="calc(100vh - 502px)">
      <el-table-column label="序号" width="60">
        <template #default="scope">
          {{ (jobListParams.current - 1) * jobListParams.size + scope.$index + 1 }}
        </template>
      </el-table-column>
      <el-table-column prop="job_info_num" label="任务编号" show-overflow-tooltip />
      <el-table-column prop="name" label="任务名称" show-overflow-tooltip />
      <el-table-column prop="dept_name" label="所属部门"  />
      <el-table-column prop="device_names" label="所属机巢"  />
      <el-table-column prop="ai_type_str" label="关联算法" show-overflow-tooltip />
      <el-table-column label="任务状态" >
        <template #default="scope">
          {{ scope.row.status ? getStatusText(scope.row.status) : ''  }}
        </template>
      </el-table-column>
      <el-table-column prop="industry_type_str" label="任务类型" />
      <el-table-column prop="event_number" label="关联事件" />
      <el-table-column prop="begin_time" label="任务时间" />
      <el-table-column prop="creator_name" label="创建人" />
      <el-table-column label="操作" >
        <template #default="scope">
          <el-button class="current-details" link type="primary" @click="handleDetail(scope.row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="task-table ztzf-table">
      <el-table :data="jobListData"
        :row-class-name="tableRowClassName"
        :row-style="{ height: '54px', fontSize: '14px', 'text-align': 'center' }"
        :header-cell-style="{ 'text-align': 'center', height: '36px', fontSize: '14px' }">
        <el-table-column label="序号" type="index" width="60">
            <template #default="{ $index }">
              {{ ($index + 1).toString().padStart(2, '0') }}
            </template>
          </el-table-column>
        <el-table-column prop="job_info_num" label="任务编号" show-overflow-tooltip />
        <el-table-column prop="name" label="任务名称" show-overflow-tooltip />
        <el-table-column prop="dept_name" label="所属部门"  />
        <el-table-column prop="device_names" label="所属机巢"  />
        <el-table-column prop="ai_type_str" label="关联算法" show-overflow-tooltip />
        <el-table-column label="任务状态" >
          <template #default="scope">
            <span :style="{
              color: scope.row.status === 1 ? '#e36913' :
                     scope.row.status === 2 ? '#ffc398' :
                     scope.row.status === 3 ? '#afd9fb' :
                     scope.row.status === 4 ? '#11c4ff' : '8cfea7'
            }">
              {{ scope.row.status ? getStatusText(scope.row.status) : '' }}
            </span>
          </template>
        </el-table-column>
        <el-table-column prop="industry_type_str" label="任务类型" />
        <el-table-column prop="event_number" label="关联事件">
                    <template #default="scope">
                        <span>{{ scope.row.event_number ? scope.row.event_number : '/' }}</span>
                    </template>
                </el-table-column>
        <el-table-column prop="begin_time" label="任务时间" />
        <el-table-column prop="creator_name" label="创建人" />
        <el-table-column label="操作" >
          <template #default="scope">
            <el-button class="current-details" link type="primary" @click="handleDetail(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="pagination">
      <el-pagination class="ztzf-pagination"
        v-model:current-page="jobListParams.current"
@@ -54,7 +70,7 @@
const jobListParams = reactive({
  current: 1,
  size: 5,
  size: 8,
  searchParams:{}
});
const jobListData = ref([]);
@@ -114,52 +130,28 @@
  isShowAddTask.value = true;
};
const tableRowClassName = ({ row, rowIndex }) => {
    if (rowIndex % 2 === 1) {
        return 'warning-row'
    } else {
        return 'success-row'
    }
}
onMounted(() => {
  getJobList();
});
</script>
<style lang="scss">
.task-intermediate-content {
  .el-table__body tr {
    background: #0B1D38;
    border-bottom: 1px solid;
    border-image: linear-gradient(270deg, rgba(81, 168, 255, 0), rgba(48, 111, 202, 1), rgba(81, 168, 255, 0)) 2 2;
  }
  .el-pagination__sizes {
        .el-select {
          .el-input__wrapper {
            background-color: #021022;
            box-shadow: 0 0 0 1px #1479EF inset;
          }
        }
      }
}
</style>
<style lang="scss" scoped>
.task-intermediate-content {
  margin: 16px 38px 16px 38px;
  background: linear-gradient( 27deg, #1F3E7A 0%, rgba(31,62,122,0.35) 79%, rgba(31,62,122,0) 100%);
  padding: 14px 18px;
  :deep(.el-table) {
    margin-top: 12px;
    background-color: transparent;
    --el-table-tr-bg-color: transparent;
    --el-table-border-color: rgba(255, 255, 255, 0.1);
    --el-table-header-bg-color: rgba(31, 62, 122, 0.5);
    --el-table-header-text-color: #fff;
    --el-table-text-color: #fff;
    .el-table__header {
      background: #0F1929;
      box-shadow: inset 0px -50px 50px 0px rgba(27,148,255,0.13);
      border-radius: 20px 0px 0px 0px;
      border-bottom: 2px solid;
      border-image: linear-gradient(90deg, rgba(81, 168, 255, 0), rgba(48, 111, 202, 1), rgba(81, 168, 255, 0)) 2 2;
    }
    .el-table__body tr:hover > td {
      background-color: rgba(31, 62, 122, 0.3) !important;
    }
  // 表格
  .task-table {
    height: 528px;
    margin-top: 18px;
  }
  .current-details {
@@ -170,10 +162,14 @@
    border: 1px solid #51A8FF;
  }
  .pagination {
    // padding: 20px 0;
  // 分页
  :deep(.el-pagination) {
    display: flex;
    justify-content: center;
  }
  :deep(.el-pagination button) {
    background: center center no-repeat none !important;
    color: #8eb8ea !important;
  }
}
</style>
src/views/TaskManage/TaskTop/TaskEvent.vue
@@ -131,6 +131,7 @@
    color: #CFEAFF;
    padding-left: 44px;
    line-height: 8px;
    font-size: 14px;
  }
  .chart {
    width: 100%;
src/views/TaskManage/TaskTop/TaskIndustry.vue
@@ -114,6 +114,7 @@
    color: #CFEAFF;
    padding-left: 38px;
    line-height: 8px;
    font-size: 14px;
  }
  .chart {
    width: 100%;
src/views/TaskManage/TaskTop/TaskTime.vue
@@ -116,6 +116,7 @@
  height: 100%;
  margin-left: 14px;
  .title {
    font-size: 14px;
    margin-top: 10px;
    width: 502px;
    height: 28.6px;
src/views/TaskManage/TaskTop/TaskTotal.vue
@@ -70,10 +70,11 @@
    }
    img { width: 160px; height: 110px;}
    .num {
      width: 50px;
      position: absolute;
      font-size: 32px;
      top: 94px;
      left: 56px;
      top: 90px;
      left: 48px;
    }
  }
  .other-total {