zhangzengfei
2022-06-07 e9dc03b62fea3db1b2029a2a485c3e18caac6a43
src/views/project/index.vue
@@ -112,9 +112,22 @@
                >
                <el-button
                  size="small"
                  type="warning"
                  :disabled="scope.row.state === 0"
                  @click="handleRebuild(scope.row)"
                  >重置</el-button
                >
                <!-- 正在打包的任务以及自动打包的任务不允许删除 -->
                <el-button
                  size="small"
                  type="danger"
                  :disabled="
                    scope.row.createType == 0 ||
                    (scope.row.state > 0 && scope.row.state < 3)
                  "
                  @click="handleDeletePkg(scope.row)"
                  >删除</el-button
                >
              </template>
            </el-table-column>
@@ -200,7 +213,7 @@
<script>
import { getList, deletePrj, getPkgList, buildPkg } from "@/api/project";
import { publish, download, rebuild } from "@/api/package";
import { publish, download, rebuild, deletePkg } from "@/api/package";
import TableEdit from "./components/ProjectEdit.vue";
@@ -219,7 +232,7 @@
        arm64: "arm_64",
      },
      typeOptions: {
        os: "OS基础包",
        os: "AIOS",
        sys: "系统包",
        app: "应用包",
        algo: "算法包",
@@ -236,6 +249,7 @@
      total: 0,
      background: true,
      selectRows: "",
      expandRow: "",
      elementLoadingText: "正在加载...",
      queryForm: {
        pageNo: 1,
@@ -320,9 +334,12 @@
        return;
      }
      const { data, total } = await getPkgList(row.id);
      this.getPackageList(row.id);
    },
    async getPackageList(id) {
      const { data, total } = await getPkgList(id);
      this.list.forEach((item, idx) => {
        if (item.id === row.id) {
        if (item.id === id) {
          this.list[idx].pkgList = data.reverse();
        }
      });
@@ -369,6 +386,15 @@
        }
      });
    },
    handleDeletePkg(row) {
      if (row.id) {
        this.$baseConfirm("你确定要删除当前项吗", null, async () => {
          const { msg } = await deletePkg(row);
          this.$baseMessage(msg, "success");
          this.getPackageList(row.projectId);
        });
      }
    },
  },
};
</script>