riku
2025-07-29 fa9d2b5117227f263ad9aa15b71bddb3fe64ac81
src/components/mission/MissionManage.vue
@@ -1,13 +1,13 @@
<template>
  <el-button
  <!-- <el-button
    type="primary"
    icon="Memo"
    class="el-button-custom p-events-auto"
    @click="dialogVisible = !dialogVisible"
  >
    任务管理
  </el-button>
  <CardDialog v-model="dialogVisible" title="走航任务管理">
  </el-button> -->
  <CardDialog v-bind="$attrs" title="走航任务管理">
    <el-row class="mission-table">
      <el-col :span="20">
        <el-table
@@ -17,7 +17,7 @@
          :show-overflow-tooltip="true"
          border
          height="64vh"
          row-class-name="t-row"
          row-class-name="t-row-normal"
          cell-class-name="t-cell"
          header-row-class-name="t-header-row"
          header-cell-class-name="t-header-cell"
@@ -34,41 +34,57 @@
            label="开始时间"
            align="center"
            :formatter="timeFormatter"
            width="150"
          />
          <el-table-column
            prop="endTime"
            label="结束时间"
            align="center"
            :formatter="timeFormatter"
            width="150"
          />
          <el-table-column label="管理" width="140" align="center">
          <el-table-column label="管理" width="160" align="center">
            <template #default="{ row }">
              <!-- <MissionEdit mode="update"></MissionEdit> -->
              <el-button
                type="primary"
                size="small"
                icon="EditPen"
                class="el-button-custom"
                @click="updateMission(row)"
              ></el-button>
              <el-button
                type="primary"
                size="small"
                icon="Delete"
                class="el-button-custom"
                @click="deleteMission(row)"
                >删除</el-button
              >
              <el-button
              ></el-button>
              <!-- <el-button
                :loading="row.downloadLoading"
                type="primary"
                size="small"
                icon="Document"
                class="el-button-custom"
                @click="downloadReport(row)"
                >报告</el-button
              >
              ></el-button> -->
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="4" class="flex-col">
        <div>
          <!-- <el-button type="primary" class="el-button-custom">
        <!-- <div> -->
        <!-- <el-button type="primary" class="el-button-custom">
                新建任务
              </el-button> -->
          <MissionCreate></MissionCreate>
        </div>
        <el-button
          type="primary"
          class="el-button-custom"
          @click="createMission"
        >
          新建任务
        </el-button>
        <!-- </div> -->
        <!-- <div>
          <el-button type="primary" class="el-button-custom">
            数据导入
@@ -89,6 +105,12 @@
    msg="确认是否删除该走航任务"
    confirmText="删除"
  ></MessageBox>
  <MissionEdit
    v-model="dialogVisible"
    width="30%"
    :mode="editMode"
    :mission="selectedMission"
  ></MissionEdit>
</template>
<script>
import moment from 'moment';
@@ -102,18 +124,37 @@
    const { loading, fetchData } = useFetchData();
    return { loading, fetchData };
  },
  props: {},
  props: {
    // modelValue: Boolean
  },
  // emits: ['update:modelValue'],
  data() {
    return {
      dialogVisible: false,
      msgBoxVisible: false,
      onConfirm: undefined
      onConfirm: undefined,
      // 任务编辑模式,create:创建新任务,update:编辑已有任务
      editMode: 'create',
      // 选中的待编辑任务
      selectedMission: undefined
    };
  },
  computed: {
    ...mapStores(useMissionStore)
  },
  methods: {
    // handleChange(value) {
    //   this.$emit('update:modelValue', value);
    // },
    createMission() {
      this.editMode = 'create';
      this.dialogVisible = true;
    },
    updateMission(row) {
      this.editMode = 'update';
      this.selectedMission = row;
      this.dialogVisible = true;
    },
    deleteMission(row) {
      this.onConfirm = () => {
        this.missionStore.deleteMission(row.missionCode);
@@ -126,6 +167,7 @@
        .downloadReport(row.missionCode)
        .finally(() => (row.downloadLoading = false));
    },
    // eslint-disable-next-line no-unused-vars
    timeFormatter(row, col, cellValue, index) {
      return moment(cellValue).format('YYYY-MM-DD HH:mm:ss');
    }
@@ -153,6 +195,10 @@
}
.mission-table {
  height: 60vh;
  /* height: 60vh; */
}
:deep(.t-row-normal) {
  background-color: transparent !important;
}
</style>