发布&删除

This commit is contained in:
yuan 2021-07-07 10:25:49 +08:00
parent ab0d193095
commit 4f9c70f3cb
4 changed files with 44 additions and 26 deletions

View File

@ -3,7 +3,7 @@ import request from '@/utils/request';
/** 新建用户草稿2d模型*/
export function createModelDraft(data) {
return request({
url: `draft/model2d/`,
url: `/draft/model2d/`,
method: 'post',
data
})
@ -12,7 +12,7 @@ export function createModelDraft(data) {
/** 分页查询用户2d模型草稿*/
export function getModelDraftList(params) {
return request({
url: `draft/model2d/paging`,
url: `/draft/model2d/paging`,
method: 'get',
params
})

View File

@ -7,12 +7,6 @@
<el-form-item label="模型名称" prop="name">
<el-input v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="模型类型" prop="type">
<el-input v-model="formData.type"></el-input>
</el-form-item>
<el-form-item label="模型版本" prop="version">
<el-input v-model="formData.version"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="close"> </el-button>
@ -32,9 +26,7 @@ export default {
formData: { code: "", name: "", type: "", version: "" },
formRules: {
code: [{ required: true, message: "请输入模型编号", trigger: "blur" }],
name: [{ required: true, message: "请输入模型名称", trigger: "blur" }],
type: [{ required: true, message: "请输入模型类型", trigger: "blur" }],
version: [{ required: true, message: "请输入模型类型", trigger: "blur" }]
name: [{ required: true, message: "请输入模型名称", trigger: "blur" }]
}
};
},
@ -67,7 +59,6 @@ export default {
this.$refs.form.validate(valid => {
if (valid) {
this.submit(this.formData).then(resp => {
console.log(resp);
this.close();
});
}

View File

@ -6,7 +6,7 @@
</template>
<script>
import { createModelDraft, getModelDraftList } from "@/api/management/model";
import { getModelDraftList, publishModelDraft, deleteModelDraft } from "@/api/management/model";
import createModelDraftDialog from "./components/create";
export default {
@ -49,18 +49,14 @@ export default {
title: "模型名称",
prop: "name"
},
{
title: "类型",
prop: "type"
},
{
title: "版本",
prop: "version"
},
{
title: "创建时间",
prop: "createTime"
},
{
title: "修改时间",
prop: "updateTime"
},
{
type: "button",
title: this.$t("global.operate"),
@ -101,7 +97,6 @@ export default {
},
closeCreate(e) {
console.log(e);
this.reloadTable();
},
@ -109,15 +104,47 @@ export default {
this.$refs.createDialog.show("edit", data);
},
handleDelete(a, b, c, d, e) {
console.log("delete");
handleDelete(idx, data) {
this.$confirm("确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
center: true
})
.then(
() => {
deleteModelDraft(data.id).then(() => {
this.reloadTable();
});
},
() => {}
)
.catch(e => {
this.$message(e);
});
},
handleDraw(idx, data) {
this.$router.push({ path: `usermodel/${data.id}/edit` });
},
handlePublish() {},
handlePublish(idx, data) {
this.$confirm("确认发布?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
center: true
})
.then(
() => {
publishModelDraft(data.id).then(() => {
this.reloadTable();
});
},
() => {}
)
.catch(e => {
this.$message(e);
});
},
reloadTable() {
this.queryList.reload();

View File

@ -24,7 +24,7 @@ export default {
const data = res.data;
this.name = data.name;
this.type = data.type || "";
this.model = JSON.parse(data.jsonData || "");
this.model = data.jsonData ? JSON.parse(data.jsonData) : {};
});
},
onSave(payload) {