BusinessObjHeader.vue
5.01 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
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
190
191
192
193
194
195
196
<template>
<el-form
data-vv-scope="form"
class="businessObj-header-form"
v-form="{inputsDisplay: 'block'}"
>
<ht-form-item label="模型描述" class="is-required" custom-colon>
<ht-input
autocomplete="off"
v-model="formData.description"
:validate="{required: true}"
:disabled="editing && deployed"
:maxlength="50"
:showWordLimit="true"
></ht-input>
</ht-form-item>
<ht-form-item label="模型别名" class="is-required" custom-colon>
<ht-input
v-model="formData.alias"
:disabled="(editing && deployed) || (handleType == 'simple')"
autocomplete="off"
@blur="entBlur"
name="alias"
v-pinyin="formData.description"
validate="required: true|regex:^[a-zA-Z][a-zA-Z0-9_]*$,只能输入字母、数字、下划线,且以字母开头"
:maxlength="50"
:showWordLimit="true"
></ht-input>
</ht-form-item>
<ht-form-item label="所属分类" class="is-required" custom-colon>
<eip-sys-type-selector
placeholder="请选择分类"
:cat-id="'9'"
v-model="formData.categoryName"
:sys-type-id.sync="formData.categoryId"
:validate="{required: true}"
/>
</ht-form-item>
<ht-form-item>
<el-checkbox v-model="formData.supportDb">支持数据库</el-checkbox>
<el-checkbox v-model="formData.isVerify">支持后端校验</el-checkbox>
</ht-form-item>
<div v-if="formData.isVerify">
<ht-form-item class="is-required" custom-colon>
<template slot="label">
接口地址
<el-tooltip
effect="dark"
content="请求类型必须为post 接收参数名称必须为boData"
placement="left-start"
>
<i class="icon-notes"></i
></el-tooltip>
</template>
<ht-input
v-model="verifyJson.url"
placeholder="请输入接口地址 示例:/api/test/get"
class="ht api-address-input"
autocomplete="off"
validate="required"
>
<ht-select
slot="prepend"
v-model="verifyJson.serviceMode"
display-style="block"
:clearable="false"
validate="required"
style="width: 108px"
:options="serviceList"
:props="{key: 'value', value: 'label'}"
></ht-select>
</ht-input>
</ht-form-item>
<ht-form-item custom-colon>
<template slot="label">
接口头部
<el-tooltip
effect="dark"
content='接口头部(header)为JSON格式,如:{"Authorization":"Bearer eyJhbGciOiJIUzUxMiJ9"}'
placement="left-start"
>
<i class="icon-notes"></i
></el-tooltip>
</template>
<ht-input
v-model="verifyJson.headerStr"
class="ht"
placeholder="请输入接口头部(header)"
autocomplete="off"
></ht-input
></ht-form-item>
</div>
</el-form>
</template>
<script>
const eipSysTypeSelector = () =>
import('@/components/selector/EipSysTypeSelector.vue')
import form from '@/api/form.js'
export default {
components: {
eipSysTypeSelector
},
name: 'BusinessObjHeader',
props: ['dataView', 'formData', "handleType"],
data() {
return {
serviceList: [],
verifyJson: {
url: '',
serviceMode: '',
headerStr: ''
}
}
},
watch: {
option: {
handler: function(newVal, oldVal) {
this.initChart()
},
deep: true
}
},
computed: {
editing: function() {
return this.dataView && this.dataView.type == 'edit'
},
deployed: function() {
return this.formData && this.formData.deployed == 1
}
},
mounted() {
if (this.formData.verifyJson) {
this.verifyJson = JSON.parse(this.formData.verifyJson)
}
this.loadSystemList()
},
methods: {
entBlur() {
this.$emit('entBlur')
},
//取得服务列表
loadSystemList() {
form.fetchSystemList().then(resp => {
if (resp && resp.data) {
//从接口中取得服务列表
this.serviceList = resp.data.map(item => {
let m = {value: item.sysCode, label: item.sysName}
return {...m}
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.businessObj-header-form {
padding: 0 16px;
/deep/ .el-form-item__label {
text-align: left;
float: none;
word-break: break-word;
}
/deep/.el-form-item__content {
margin-left: 0 !important;
}
.inputs {
width: 100%;
}
/deep/.el-input-group__prepend {
padding: 0;
text-align: center;
}
}
.api-address-input {
/deep/.field-tail__wrap {
position: relative;
}
/deep/.el-form-item__error {
left: -175px;
top: 25px;
width: 50px;
}
/deep/.el-input-group__prepend {
.field-tail__wrap {
.el-form-item__error {
left: -90px;
top: 25px;
}
}
}
}
</style>