模型编辑

This commit is contained in:
yuan 2021-07-06 16:17:52 +08:00
parent d84a52912d
commit 95d0cd03e0
5 changed files with 72 additions and 12 deletions

View File

@ -18,7 +18,7 @@
},
"dependencies": {
"axios": "^0.21.1",
"bjjl-engine-2d": "^1.0.8",
"bjjl-engine-2d": "^1.0.14",
"echarts": "^4.7.0",
"element-ui": "^2.12.0",
"file-saver": "^1.3.3",

View File

@ -186,7 +186,8 @@ const UploadPdfList = () => import('@/views/uploadPdf/list');
const ThirdLogin = () => import('@/views/thirdLogin');
const UserModelDesign = () => import('@/views/userModelDesign')
const UserModelDesign = () => import('@/views/userModelDesign/draftList');
const UserModelEdit = () => import('@/views/userModelDesign/edit');
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
// import { getSessionStorage } from '@/utils/auth';
@ -551,7 +552,7 @@ export const publicAsyncRoute = [
hidden: true,
children: [
{
path:'classManage',
path: 'classManage',
component: OrgClassManage,
hidden: true
},
@ -1269,7 +1270,7 @@ export const asyncRouter = [
hidden: true
},
{
path:'iscs/design',
path: 'iscs/design',
redirect: '/iscs/design',
component: IscsDesign,
meta: {
@ -1291,6 +1292,12 @@ export const asyncRouter = [
i18n: 'router.userModelDesign',
roles: [admin]
},
},
{
path: 'usermodel/edit',
name: 'userModelEdit',
component: UserModelEdit,
hidden: true
}
]
},
@ -1304,7 +1311,7 @@ export const asyncRouter = [
},
children: [
{
path:'design',
path: 'design',
redirect: '/iscs/design/edit',
component: IscsDesign,
meta: {

View File

@ -1,5 +1,5 @@
<template>
<el-dialog v-dialogDrag :visible.sync="visible" title="新建模型" center :destroy-on-close="true">
<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>
@ -41,6 +41,12 @@ export default {
computed: {
submit() {
return this.mode === "edit" ? updateModelDraftInfo : createModelDraft;
},
title() {
return {
edit: "修改模型信息",
create: "新建模型"
}[this.mode];
}
},
methods: {

View File

@ -102,7 +102,7 @@ export default {
closeCreate(e) {
console.log(e);
this.reloadTable()
this.reloadTable();
},
handleEdit(index, data) {
@ -113,13 +113,15 @@ export default {
console.log("delete");
},
handleDraw() {
console.log("draw");
handleDraw(idx, data) {
this.$router.push({ name: "userModelEdit", params: data });
},
reloadTable() {
this.queryList.reload();
}
handlePublish() {},
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -0,0 +1,45 @@
<template>
<jl-model-builder @save="onSave" :composeName="name" :model="model" :id="id" :type="type" />
</template>
<script>
import { updateModelDraftData } from "@/api/management/model";
export default {
name: "editModel",
data() {
return {
name: "",
id: "",
type: "",
model: {}
};
},
mounted() {
console.log(this.$route.params);
const params = this.$route.params;
this.name = params.name;
this.id = params.id;
this.type = params.type || "";
this.model = JSON.parse(params.jsonData || "{}");
},
methods: {
onSave(payload) {
console.log(payload);
const data = {
id: this.id,
name: this.name,
jsonData: JSON.stringify(payload)
};
updateModelDraftData(data)
.then(resp => {
this.$message("保存成功");
})
.catch(e => {
console.log(e);
});
}
}
};
</script>
<style lang="scss" scoped></style>