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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<template>
<dialog-form
width="750px"
ref="dialog"
:title="formEdit.id ? '编辑' : '新增'"
:form-edit="formEdit"
:form-data="formData"
labelWidth="120px"
@handleConfirm="handleConfirm"
></dialog-form>
</template>
<script>
import { feignField } from "@/api/field.js"
import { getCoopGroupList } from "@/api/coop-group.js"
export default {
name: "DialogFormSelf",
data() {
return {
formEdit: {},
formData: [
{
label: "疾病名",
prop: "diseaseName",
spanCount: 12,
type: "input",
},
{
label: "机构名",
prop: "orgName",
spanCount: 12,
type: "input",
},
{
label: "协作组",
prop: "groupId",
type: "select",
opts: [],
},
{
label: "表单名",
prop: "formName",
spanCount: 12,
type: "input",
},
{
label: "表单id",
prop: "formId",
spanCount: 12,
type: "input",
},
{
label: "原表名",
prop: "sourceTableName",
spanCount: 12,
type: "input",
},
{
label: "原表code",
prop: "sourceTableCode",
spanCount: 12,
type: "input",
},
{
label: "原字段名",
prop: "sourceFieldName",
spanCount: 12,
type: "input",
},
{
label: "原字段code",
prop: "sourceFieldCode",
spanCount: 12,
type: "input",
},
{
label: "目标表名",
spanCount: 12,
type: "input",
prop: "targetTableCode",
},
{
label: "目标表名code",
spanCount: 12,
type: "input",
prop: "targetTableName",
},
{
label: "目标字段名",
type: "input",
spanCount: 12,
prop: "targetFieldName",
},
{
label: "目标字段名code",
type: "input",
spanCount: 12,
prop: "targetFieldCode",
},
{
label: "字典",
type: "input",
spanCount: 12,
prop: "dictType",
},
{
label: "创建人",
prop: "createUser",
spanCount: 12,
type: "input",
},
{
label: "格式化方式",
prop: "formatType",
spanCount: 12,
type: "select",
optsFormatter: () => {
return this.dictMap && this.dictMap["data_format_type"]
},
},
],
}
},
methods: {
// 获得协作组列表
getCoopGroupList() {
getCoopGroupList().then((res) => {
const d = res.data
this.formData[2].opts = d.map((item) => {
return {
label: item.groupName,
value: item.id,
}
})
})
},
handleAdd(row) {
this.formEdit = Object.assign({}, row)
this.$refs.dialog.open()
},
handleConfirm(form) {
const data = Object.assign({}, form)
data.groupName = this.$handle.formatDicList(
this.formData[2].opts,
form.groupId
)
const msg = data.id ? "编辑成功" : "新增成功"
feignField(data).then((res) => {
if (res.code === 1) {
this.$message.success(msg)
this.$refs.dialog.close()
this.$emit("handleConfirm")
}
})
},
},
created() {
this.getCoopGroupList()
},
}
</script>
<style lang="scss" scoped>
.drawer__container {
padding: 0 20px;
.drawer__content {
height: calc(100vh - #{"160px"});
overflow-y: auto;
&::-webkit-scrollbar {
width: 0px;
height: 0px;
}
&::-webkit-scrollbar-thumb {
background-color: #fff;
}
}
.footer {
margin-top: 20px;
display: flex;
button {
flex: 1;
}
}
}
</style>