|
@@ -47,6 +47,16 @@
|
|
|
<el-table ref="TableList" :data="dataList">
|
|
|
<el-table-column prop="id" label="ID" width="80"></el-table-column>
|
|
|
<el-table-column prop="name" label="名称"> </el-table-column>
|
|
|
+ <el-table-column prop="archived" label="是否为主干版本" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span
|
|
|
+ :class="{
|
|
|
+ 'color-success': scope.row.id === curMasterVersionId
|
|
|
+ }"
|
|
|
+ ></span>
|
|
|
+ {{ scope.row.id === curMasterVersionId ? "主干版本" : "" }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="archived" label="状态" width="80">
|
|
|
<template slot-scope="scope">
|
|
|
<span
|
|
@@ -73,6 +83,13 @@
|
|
|
@click="toEdit(scope.row)"
|
|
|
>编辑</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ class="btn-primary"
|
|
|
+ type="text"
|
|
|
+ :disabled="scope.row.id === curMasterVersionId"
|
|
|
+ @click="toSetMaster(scope.row)"
|
|
|
+ >设置为主干版本</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
:class="scope.row.archived ? 'btn-danger' : 'btn-primary'"
|
|
|
type="text"
|
|
@@ -106,7 +123,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { appVersionList, appVersionInsertOrUpdate } from "../api";
|
|
|
+import {
|
|
|
+ appVersionList,
|
|
|
+ appVersionInsertOrUpdate,
|
|
|
+ appSetMasterVersion
|
|
|
+} from "../api";
|
|
|
import { ARCHIVED_TYPE } from "../../../constants/enumerate";
|
|
|
import ModifyAppVersion from "../components/ModifyAppVersion.vue";
|
|
|
|
|
@@ -132,11 +153,13 @@ export default {
|
|
|
size: this.GLOBAL.pageSize,
|
|
|
total: 0,
|
|
|
dataList: [],
|
|
|
- curRow: {}
|
|
|
+ curRow: {},
|
|
|
+ curMasterVersionId: null
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
visibleChange() {
|
|
|
+ this.curMasterVersionId = this.app.masterVertionId;
|
|
|
// this.toPage(1);
|
|
|
},
|
|
|
cancel() {
|
|
@@ -170,21 +193,42 @@ export default {
|
|
|
this.curRow = { ...row, appId: this.app.id };
|
|
|
this.$refs.ModifyAppVersion.open();
|
|
|
},
|
|
|
- toArchived(row) {
|
|
|
+ async toSetMaster(row) {
|
|
|
+ const confirm = await this.$confirm(
|
|
|
+ `确定要设置版本号【${row.name}】为主干版本吗?`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
+
|
|
|
+ await appSetMasterVersion({
|
|
|
+ appId: this.app.id,
|
|
|
+ versionId: row.id
|
|
|
+ });
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ this.curMasterVersionId = row.id;
|
|
|
+ this.$emit("master-change");
|
|
|
+ },
|
|
|
+ async toArchived(row) {
|
|
|
const action = row.archived ? "取消归档" : "归档";
|
|
|
- this.$confirm(`确定要${action}版本号【${row.name}】吗?`, "提示", {
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- const archived = !row.archived;
|
|
|
- await appVersionInsertOrUpdate({
|
|
|
- id: row.id,
|
|
|
- archived
|
|
|
- });
|
|
|
- row.archived = archived;
|
|
|
- this.$message.success("操作成功!");
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ const confirm = await this.$confirm(
|
|
|
+ `确定要${action}版本号【${row.name}】吗?`,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ ).catch(() => {});
|
|
|
+ if (confirm !== "confirm") return;
|
|
|
+
|
|
|
+ const archived = !row.archived;
|
|
|
+ await appVersionInsertOrUpdate({
|
|
|
+ id: row.id,
|
|
|
+ archived
|
|
|
+ });
|
|
|
+ row.archived = archived;
|
|
|
+ this.$message.success("操作成功!");
|
|
|
}
|
|
|
}
|
|
|
};
|