发布&删除

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

View File

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

View File

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

View File

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