Commit b200153c authored by 周远喜's avatar 周远喜

项目保存模版成功!

parent 3727f106
......@@ -26,13 +26,17 @@ export default {
}
});
},
///projecttemplate/list
templates(params){
return Api.post(`${material}/projecttemplate/list`,params)
},
saveTemplate(params){
return Api.post('projecttemplate/create',params)
return Api.post(`${material}/projectplan/createtemplate`,params)
},
useTemplate(params){
return Api.post('projecttemplate/usetemplate',params)
return Api.post(`${material}/projectplan/usetemplate`,params)
},
deletes(params) {
return Api.post(`${material}/projectplan/batchdelete`, params);
return Api.post(`${material}/projectplan/usetemplate`, params);
}
}
<template>
<div>
<EditGrid :columns="columns" ref="grid" :items="list"
>
</EditGrid>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "list",
head: {
title: "",
author: "henq",
description: "project_template 10/29/2020 5:40:26 PM",
},
data() {
return {
curId: 0,
list:[],
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
key: "title",
title: this.l("title"),
align: "left",
easy: true,
high: true,
},
{
key: "note",
title: this.l("note"),
align: "left",
high: true,
},
{
key: "type",
title: this.l("type"),
align: "left",
high: true,
code: "project.task.Type",
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
type: "user",
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "remove",msg:"确定要导入模版吗?" },
on: { click: () => this.useTemplate(params.row.id) },
},
"导入"
),
// h(
// "op",
// {
// attrs: { oprate: "delete" },
// on: { click: () => this.remove(params.row.id) },
// },
// "删除"
// ),
]);
},
},
],
};
},
mounted() {
this.load();
},
props: {
v: Object,
eid: String,
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = "";
},
load() {
Api.templates({
}).then(r=>{
this.list=r.result;
})
},
useTemplate(id) {
Api.useTemplate({
id:id,
projectId:this.eid
}).then(r=>{
if(r.success){
this.$Message.success("导入成功");
this.$emit("on-load")
}
})
},
l(key) {
let vkey = "project_template" + "." + key;
return this.$t(vkey) || key;
},
},
};
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -397,6 +397,13 @@ export default {
that.title = "保存模版";
that.detail = () => import("./saveTemplate");
that.modal = true;
},
useTemplate(name){
that.curId = that.eid;
that.row = that.data;
that.title = "导入模版";
that.detail = () => import("./importTemplate");
that.modal = true;
}
}
m[name]&&m[name](name);
......
......@@ -47,19 +47,15 @@ export default {
eid: String,
},
mounted() {
if (this.eid ) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
Api.create(this.entity)
Api.saveTemplate(this.entity)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
......
......@@ -107,8 +107,8 @@ export default {
high: true,
},
{
key: "attachment",
title: this.l("attachment"),
key: "note",
title: this.l("note"),
align: "left",
high: true,
},
......@@ -117,9 +117,29 @@ export default {
title: this.l("type"),
align: "left",
high: true,
code:"project.task.level"
// code: "mes.project_template.Type",
code: "project.task.level",
// code: "mes.project_template.Type",
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
type: "user",
},
// {
// key: "attachment",
// title: this.l("attachment"),
// align: "left",
// high: true,
// },
{
title: "操作",
key: "action",
......@@ -210,22 +230,6 @@ export default {
this.modal = false;
},
l(key) {
/*
project_template:{
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
title:'标题',
note:'请注意',
template:'模板',
attachment:'附件',
type:'模版类型',
}
*/
let vkey = "project_template" + "." + key;
return this.$t(vkey) || key;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment