release_version代码生成

This commit is contained in:
2026-04-01 21:24:42 +08:00
parent 5344f6deeb
commit 3331ae20ab
3 changed files with 506 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
import request from '@/axios';
export const getList = (current, size, params) => {
return request({
url: '/common/release-version/list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
export const getDetail = (id) => {
return request({
url: '/common/release-version/detail',
method: 'get',
params: {
id
}
})
}
export const remove = (ids) => {
return request({
url: '/common/release-version/remove',
method: 'post',
params: {
ids,
}
})
}
export const add = (row) => {
return request({
url: '/common/release-version/submit',
method: 'post',
data: row
})
}
export const update = (row) => {
return request({
url: '/common/release-version/submit',
method: 'post',
data: row
})
}
export const applyStatus = (id) => {
return request({
url: '/common/release-version/applyStatus',
method: 'post',
params: {
id,
}
})
}

View File

@@ -0,0 +1,182 @@
export default {
height:'auto',
calcHeight: 30,
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
viewBtn: false,
delBtn: false,
addBtn: true,
editBtn: true,
selection: false,
dialogClickModal: false,
column: [
{
label: "主键ID",
prop: "id",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "内部版本号",
prop: "versionCode",
type: "input",
overHidden: true,
},
{
label: "版本显示名称",
prop: "versionName",
type: "input",
overHidden: true,
},
{
label: "应用类型",
prop: "appType",
type: 'radio',
dicUrl: '/blade-system/dict/dictionary?code=release_version_app_type',
props: {
label: 'dictValue',
value: 'dictKey',
},
dataType: 'number',
value : 1,
overHidden: true,
},
{
label: "渠道标识",
prop: "channelCode",
type: 'select',
dicUrl: '/blade-system/dict/dictionary?code=release_version_channel_code',
props: {
label: 'dictValue',
value: 'dictKey',
},
dataType: 'string',
overHidden: true,
},
{
label: "包类型",
prop: "packageType",
type: 'radio',
dicUrl: '/blade-system/dict/dictionary?code=release_version_pack_type',
props: {
label: 'dictValue',
value: 'dictKey',
},
dataType: 'number',
value : 1,
overHidden: true,
},
{
label: "是否强制更新",
prop: "isForceUpdate",
type: 'radio',
dicUrl: '/blade-system/dict/dictionary?code=app_yes_no',
props: {
label: 'dictValue',
value: 'dictKey',
},
dataType: 'number',
value : 0,
overHidden: true,
},
{
label: "下载地址",
prop: "downloadUrl",
type: "input",
overHidden: true,
},
{
label: "更新日志内容",
prop: "updateContent",
type: "textarea",
overHidden: true,
},
{
label: "隐私协议地址",
prop: "privacyAgreementUrl",
type: "input",
overHidden: true,
},
{
label: "用户协议地址",
prop: "userAgreementUrl",
type: "input",
overHidden: true,
},
{
label: "调度链接",
prop: "dispatchUrl",
type: "input",
overHidden: true,
},
{
label: "创建人ID",
prop: "createUser",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "创建部门ID",
prop: "createDept",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "创建时间",
prop: "createTime",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "更新人ID",
prop: "updateUser",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "更新时间",
prop: "updateTime",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "上架状态: 0-未上架/下架, 1-已上架",
prop: "status",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: "逻辑删除标识",
prop: "isDeleted",
type: "input",
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
]
}

View File

@@ -0,0 +1,261 @@
<template>
<basic-container>
<avue-crud :option="option"
v-model:search="search"
v-model:page="page"
v-model="form"
:table-loading="loading"
:data="data"
:permission="permissionList"
:before-open="beforeOpen"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad">
<template #menu-left>
<!-- <el-button type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- plain-->
<!-- v-if="permission.commonReleaseversion_delete"-->
<!-- @click="handleDelete">删 除-->
<!-- </el-button>-->
<!-- <el-button type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- @click="handleExport">导 出-->
<!-- </el-button>-->
</template>
<template #menu="{ row }">
<el-button type="text"
icon="el-icon-circle-check"
@click.stop="toggleStatus(row)"> {{ row.status === 1 ? '下架' : '上架' }}
</el-button>
</template>
</avue-crud>
</basic-container>
</template>
<script>
import {
getList,
getDetail,
add,
update,
remove,
applyStatus
} from '@/api/common/commonReleaseversion';
import option from "@/option/common/commonReleaseversion";
import {mapGetters} from "vuex";
import {exportBlob} from "@/api/common";
import {getToken} from '@/utils/auth';
import {downloadXls} from "@/utils/util";
import {dateNow} from "@/utils/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
export default {
data() {
return {
form: {},
query: {},
search: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0
},
selectionList: [],
option: option,
data: []
};
},
computed: {
...mapGetters(["permission"]),
permissionList() {
return {
addBtn: this.validData(this.permission.commonReleaseversion_add, false),
viewBtn: this.validData(this.permission.commonReleaseversion_view, false),
delBtn: this.validData(this.permission.commonReleaseversion_delete, false),
editBtn: this.validData(this.permission.commonReleaseversion_edit, false)
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
}
},
methods: {
rowSave(row, done, loading) {
add(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
loading();
window.console.log(error);
});
},
rowUpdate(row, index, done, loading) {
update(row).then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
done();
}, error => {
loading();
console.log(error);
});
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
this.$refs.crud.toggleSelection();
});
},
handleExport() {
let downloadUrl = `/common/release-version/commonReleaseversion/export-commonReleaseversion?${this.website.tokenHeader}=${getToken()}`;
const {
} = this.query;
let values = {
};
this.$confirm("是否导出数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
NProgress.start();
exportBlob(downloadUrl, values).then(res => {
downloadXls(res.data, `APP版本发布管理${dateNow()}.xlsx`);
NProgress.done();
})
});
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
});
}
done();
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage){
this.page.currentPage = currentPage;
},
sizeChange(pageSize){
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
const {
} = this.query;
let values = {
};
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
this.selectionClear();
});
},
toggleStatus(row){
let status = row.status === 1 ? '下架' : '上架';
this.$confirm("确定将此版本" + status + "吗?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
return applyStatus(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!"
});
});
},
}
};
</script>
<style>
</style>