entityManager.dataTemplate.vue.ftl
3.68 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<#assign baseUrl><#noparse>${</#noparse>${cfg.system}<#noparse>}</#noparse><#if package.ModuleName??>/${package.ModuleName}</#if>/${table.entityPath}/v1</#assign>
<template>
<div class="data_view">
<h3 style="padding-left: 20px; font-size: 14px" class="data_view__title">
{{ templateInfo.name }}
</h3>
<div class="data-preview-wrap">
${cfg.dataTemplateHtml}
<${table.entityName}-manager-edit ref="${table.entityName}ManagerEdit"></${table.entityName}-manager-edit>
</div>
</div>
</template>
<script>
import ${table.entityName}ManagerEdit from "./${table.entityName}ManagerEdit.vue";
import templatePreview from 'hotent-ui/src/mixins/templatePreview.js'
import api from "@/api/${table.entityName}.js"
export default {
mixins: [templatePreview],
components:{${table.entityName}ManagerEdit},
data() {
return {
dialogVisible: false,
rows: [],
saveMethod: "POST",
single: "true",
templateInfo:${cfg.dataTemplateInfo}
};
},
mounted() {
this.$validator = this.$root.$validator;
},
methods: {
showDialog(id) {
this.$refs.${table.entityName}ManagerEdit.showDialog(id);
},
deleteByIds(ids) {
if (!ids || ids.length === 0) {
this.$message.warning('请至少选中一条数据!')
return
}
api.deleteByIds(ids.join(',')).then((resp) => {
let response = resp.data || resp
if (response.state) {
this.$message.success(response.message || '删除成功')
this.loadData()
}
})
},
loadData(param, cb) {
api.loadData(param || {})
.then(resp => {
let response = resp.data || resp
this.rows = response.rows
this.total = response.total
this.pagination = {
page: response.page,
pageSize: response.pageSize,
total: response.total
}
this.$loading().close()
})
.finally(() => cb && cb())
},
getBpmTemplateByPagination(param, cb1, cb2) {
this.loadData(param.pagination || {}, () => {
cb1 && cb1()
cb2 && cb2()
})
},
initTree(treeField) {},
getSubDataPagination(tab, name, refId, resolve, final) {},
formGetSubEntsByFormKey() {},
async scriptClick(btnAlias, afterScriptValue, parameter) {
if(btnAlias =='add'){
this.showDialog();
}else if(btnAlias =='edit'){
this.showDialog(parameter.id);
} else if (btnAlias == 'del') {
this.deleteByIds([parameter.pkField])
}else if (btnAlias == 'deleted') {
let ids = []
const _selecData = this.$refs.multipleTemplateTable.selection
_selecData &&
_selecData.forEach((element) => {
let id = element[this.templateInfo.pkField || 'id'] || element.id
ids.push(id)
})
this.deleteByIds(ids)
}
}
}
};
</script>
<style lang="scss" scoped>
>>> th.todo-header-row {
background-color: #fafafa;
font-size: 13px;
}
>>> tr.todo-row {
font-size: 13px;
}
.el-container {
background-color: #fff;
}
.el-row {
margin-bottom: 20px;
}
.el-header {
border-bottom: 1.5px solid #ededed;
}
.i {
margin-right: 4px;
}
.todo-subject {
cursor: pointer;
}
>>> .el-dialog__body {
padding: 15px 10px;
}
>>> .el-checkbox {
margin-left: 15px;
}
>>> .el-radio {
margin-left: 15px;
}
>>> .el-button {
margin-left: 0px;
}
.loaded-fail__div {
text-align: center;
font-size: 14px;
font-weight: bold;
color: #f56c6c;
}
.data-preview-wrap
::v-deep
.dropdown-upload__btn
> .el-button-group
> button:first-child {
margin: 0;
padding: 0;
}
</style>