发布模型列表

This commit is contained in:
yuan 2021-07-15 11:20:20 +08:00
parent c59b0930a3
commit 9c3deb02e6
8 changed files with 326 additions and 5 deletions

View File

@ -60,19 +60,49 @@ export function deleteModelDraft(id) {
})
}
/** 查询模型数据 */
/** 分页查询模型数据 */
export function getModelList() {
return request({
url: `/api/model2d/list`,
url: `/api/model2d/paging`,
method: 'get',
})
}
/** 查询某个模型所有历史版本数据 */
export function getModelVersions(code) {
return request({
url: `/api/model2d/${code}/versions`,
method: 'get'
})
}
/** 分页查询模型历史版本 */
export function getModelVersionsPaging(code) {
return request({
url: `/api/model2d/${code}/versions/paging`,
method: 'get'
})
}
/** 更新2d模型基础信息 */
export function updateModelBasicInfo(id) {
return request({
url: `/api/model2d/{id}/basic`,
method: 'put'
})
}
/** 回滚版本 */
export function setModelVersion(code, version) {
return request({
url: `/api/model2d/${code}/version/${version}`,
method: 'put'
})
}

View File

@ -100,6 +100,7 @@ export default {
publishISCSManage:'publish ISCS Manage',
voiceTraining: 'Voice Training',
mapGroup: 'Map Group',
userModel: 'User Model',
drawingMange:'Drawing Mange',
newDraw: 'New Draw'
};

View File

@ -104,6 +104,7 @@ export default {
publishISCSManage:'发布ISCS管理',
voiceTraining: '语音训练',
mapGroup: '地图分组',
userModel: '模型管理',
drawingMange:'图纸管理',
newDraw: '新版绘制'
};

View File

@ -125,6 +125,8 @@ const PublishExamRule = () => import('@/views/publish/examRule/index');
const PublishExamRuleDraft = () => import('@/views/publish/examRule/draft/index');
const PublishIBP = () => import('@/views/publish/publishIBP/index');
const PublishISCS = () => import('@/views/publish/publishISCS/index');
const PublishModel = () => import('@/views/publish/userModel/index');
const PublishModelHistory = () => import('@/views/publish/userModel/history');
const TrainingPlatform = () => import('@/views/trainingPlatform/index');
@ -916,6 +918,19 @@ export const asyncRouter = [
meta: {
i18n: 'router.mapGroup'
}
},
{ //发布模型管理
path: 'userModel',
component: PublishModel,
meta: {
i18n: 'router.userModel'
},
},
{ //模型历史版本
path: 'userModel/history',
name: 'modelHistory',
component: PublishModelHistory,
hidden: true
}
]
},

View File

@ -26,7 +26,6 @@ export default {
reset: false,
show: false,
queryObject: {}
},
queryList: {
query: this.queryFunction,

View File

@ -0,0 +1,75 @@
<template>
<el-dialog v-dialogDrag :visible.sync="visible" :title="title" center :destroy-on-close="true">
<el-form :model="formData" :rules="formRules" ref="form">
<!-- <el-form-item label="模型编号" prop="code">
<el-input v-model="formData.code"></el-input>
</el-form-item> -->
<el-form-item label="模型名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="版本" prop="version">
<el-select v-model="formData.version">
<el-option
v-for="item in versionOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
<el-button type="primary" @click="confirmHandler"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getModelVersions } from "@/api/management/model";
export default {
name: "EditModelInfo",
data() {
return {
visible: false,
title: "编辑模型",
formData: { code: "", name: "", type: "", version: "" },
versionOptions: [
{
label: "",
value: ""
}
],
formRules: {
// code: [{ required: true, message: "", trigger: "blur" }],
name: [{ required: true, message: "请输入模型名称", trigger: "blur" }]
}
};
},
mounted() {},
methods: {
initVersionInfo(code) {
getModelVersions(code).then(res => {
this.versionOptions = res.data.map(e => {
return {
label: e.version,
value: e.version
};
});
});
},
show(data) {
this.formData = data;
this.initVersionInfo(data.code);
this.visible = true;
},
close() {
this.visible = false;
this.$emit("close");
},
confirmHandler() {}
}
};
</script>
<style></style>

View File

@ -0,0 +1,95 @@
<template>
<div class="container">
<QueryListPage :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<div class="btn-area">
<el-button type="primary" @click="goBack">返回</el-button>
</div>
</div>
</template>
<script>
import { getModelVersionsPaging, setModelVersion } from "@/api/management/model";
export default {
name: "ModelHistory",
data() {
return {
pagerConfig: {
pageSize: "pageSize",
pageIndex: "pageNum"
},
queryForm: {
labelWidth: "80px",
reset: false,
show: false,
queryObject: {}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: "模型编号",
prop: "code"
// width:'300px'
},
{
title: "模型名称",
prop: "name"
// width:'200px'
},
{
title: "版本",
prop: "version"
// width:'200px'
},
{
title: "创建人ID",
prop: "createUserId"
},
{
title: "修改时间",
prop: "updateTime"
},
{
type: "button",
title: this.$t("global.operate"),
width: "100",
buttons: [
{
name: "应用",
handleClick: this.handleApply
}
]
}
]
}
};
},
methods: {
queryFunction() {
return getModelVersionsPaging(this.$route.query.code);
},
goBack() {
this.$router.go(-1)
},
handleApply(row, data) {
const {code, version} = {...data}
setModelVersion(code, version).then(resp=>{
this.$message.success(`成功切换为${version}版本`)
})
}
}
};
</script>
<style lang="scss" scoped>
.container {
padding: 10px;
.btn-area {
display: flex;
padding: 10px;
justify-content: center;
}
}
</style>

View File

@ -0,0 +1,105 @@
<template>
<div class="container">
<QueryListPage :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<edit-model-info ref="editDialog" @close="reloadTable" />
</div>
</template>
<script>
import { getModelList } from "@/api/management/model";
import EditModelInfo from "./components/editInfo";
export default {
name: "publishModel",
components: { EditModelInfo },
data() {
return {
pagerConfig: {
pageSize: "pageSize",
pageIndex: "pageNum"
},
queryForm: {
labelWidth: "80px",
reset: true,
queryObject: {
code: {
type: "text",
label: "模型编号"
},
name: {
type: "text",
label: "模型名称"
},
type: {
type: "text",
label: "模型类型"
}
}
},
queryList: {
query: this.queryPublishedModelList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: "模型编号",
prop: "code"
},
{
title: "模型名称",
prop: "name"
},{
title: '当前版本',
prop: "version"
},
{
title: "创建时间",
prop: "createTime"
},
{
title: "修改时间",
prop: "updateTime"
},
{
type: "button",
title: this.$t("global.operate"),
width: "350",
buttons: [
// {
// name: "",
// handleClick: this.handleEdit
// },
{
name: "发布历史",
handleClick: this.handleHistory
},
{
name: this.$t("global.delete"),
handleClick: this.handleDelete,
type: "danger"
}
]
}
]
}
};
},
methods: {
queryPublishedModelList(params) {
return getModelList(params);
},
reloadTable() {
this.queryList.reload();
},
handleEdit(row, data) {
this.$refs.editDialog.show(data);
},
handleDelete(row, data) {},
handleHistory(row, data) {
console.log(data.code);
this.$router.push({ name: `modelHistory`, query: { code: data.code } });
}
}
};
</script>
<style lang="sass" scoped></style>