FormTemplateCopyDialog.vue
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
<el-dialog
width="50%"
title="模板复制"
:visible="dialogVisible"
:before-close="handleClose"
append-to-body
>
<el-form :model="newValue" data-vv-scope="templateForm">
<el-row>
<el-col :offset="2" :span="12">
<span>旧模板</span>
</el-col>
<el-col :span="10">
<span>新模板</span>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<span>模板名字:</span
><ht-input disabled v-model="oldValue.templateName" />
</el-col>
<el-col :span="10" :offset="2">
<el-input v-model="newValue.name" />
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<span>模板别名:</span><ht-input disabled v-model="oldValue.alias" />
</el-col>
<el-col :span="10" :offset="2">
<el-input
v-model="newValue.alias"
v-pinyin="newValue.name"
/>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button @click="save()">保 存</el-button>
</div>
</el-dialog>
</template>
<script>
import form from "@/api/form.js";
export default {
props: ["oldValue"],
data() {
return {
dialogVisible: false,
newValue: {
id: "",
name: "",
alias: ""
}
};
},
methods: {
handleOpen() {
this.dialogVisible = true;
this.newValue = {name:'',alias:""}
},
handleClose() {
this.dialogVisible = false;
this.$emit("loadData");
},
save() {
if (this.newValue.alias == "" || this.newValue.name == "") {
this.$message({ message: "请填写完整信息", type: "warning" });
return;
}
form
.copyTemplate(this.oldValue.id, this.newValue.name, this.newValue.alias)
.then(resp => {
if (resp.data.state) {
this.$message({ message: resp.data.message, type: "success" });
this.$emit("loadData");
this.dialogVisible=false;
this.newValue={};
}
});
}
}
};
</script>
<style scoped></style>