vue2-client 1.2.16 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -24
- package/package.json +1 -1
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +1196 -1196
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +837 -838
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +529 -528
- package/src/pages/system/ticket/index.vue +438 -435
|
@@ -1,1196 +1,1196 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-drawer
|
|
3
|
-
title="查询配置生成"
|
|
4
|
-
placement="right"
|
|
5
|
-
:width="isMobile ? screenWidth : screenWidth * 0.85"
|
|
6
|
-
:visible="visible"
|
|
7
|
-
@close="onClose"
|
|
8
|
-
>
|
|
9
|
-
<a-row :gutter="24">
|
|
10
|
-
<a-col :xl="14" :lg="12" :md="12" :sm="24" :xs="24">
|
|
11
|
-
<a-form-model
|
|
12
|
-
ref="businessCreateForm"
|
|
13
|
-
:rules="rules"
|
|
14
|
-
:model="form"
|
|
15
|
-
:label-col="labelCol"
|
|
16
|
-
:wrapper-col="wrapperCol"
|
|
17
|
-
>
|
|
18
|
-
<a-form-model-item label="查询主表名" prop="tableName">
|
|
19
|
-
<a-input v-model="form.tableName" placeholder="查询用的主表+别名,用空格隔开,如:t_userfiles u" />
|
|
20
|
-
</a-form-model-item>
|
|
21
|
-
<a-form-model-item label="预设关联表" prop="joinArray">
|
|
22
|
-
<a-popover title="说明" placement="right">
|
|
23
|
-
<template slot="content">
|
|
24
|
-
<p>配置你的查询中可能涉及到的所有关联表</p>
|
|
25
|
-
<p>比如你的查询中涉及到了t_userinfo表,就需要加入t_userinfo表的关联,和你写SQL的关联一样</p>
|
|
26
|
-
<p>请注意,你关联的<span style="color: #ff0000">除主表外的任何表</span>都需要配置</p>
|
|
27
|
-
<a-input-group compact style="width: 400px;">
|
|
28
|
-
<a-input style="width: 20%" placeholder="表别名" readOnly/>
|
|
29
|
-
<a-input style="width: 80%" placeholder="关联条件" readOnly/>
|
|
30
|
-
</a-input-group>
|
|
31
|
-
<a-input-group compact style="width: 400px;">
|
|
32
|
-
<a-input value="ui" style="width: 20%" placeholder="表别名" readOnly/>
|
|
33
|
-
<a-input value="t_userinfo ui on i.f_userinfo_id = ui.f_userinfo_id" style="width: 80%" placeholder="关联条件" readOnly/>
|
|
34
|
-
</a-input-group>
|
|
35
|
-
</template>
|
|
36
|
-
<a-button type="primary" @click="addJoinItem()">增加</a-button>
|
|
37
|
-
</a-popover>
|
|
38
|
-
<div v-for="(itemObj, index) in joinArray" :key="index">
|
|
39
|
-
<a-input-group compact>
|
|
40
|
-
<a-input @change="changeJoinArray()" v-model="itemObj.key" style="width: 20%;position: relative;bottom: 1px;" placeholder="表别名" />
|
|
41
|
-
<a-input @change="changeJoinArray()" v-model="itemObj.value" style="width: 80%" placeholder="关联条件">
|
|
42
|
-
<a-icon slot="addonAfter" type="close" @click="removeJoinItem(index)"/>
|
|
43
|
-
</a-input>
|
|
44
|
-
</a-input-group>
|
|
45
|
-
</div>
|
|
46
|
-
</a-form-model-item>
|
|
47
|
-
<a-form-model-item label="SQL查询表达式" prop="condition">
|
|
48
|
-
<a-input v-model="form.condition.value" placeholder="用作SQL查询的固定条件表达式,如:gb.f_meter_type='物联网表',可选" />
|
|
49
|
-
<template v-if="form.condition.value && Object.keys(form.joinArray).length > 0">
|
|
50
|
-
<a-alert message="提示:如果SQL查询表达式中用到了关联表,需要勾选用到的关联表别名" type="success" />
|
|
51
|
-
<a-checkbox-group v-model="form.condition.join" :options="conditionJoinArray"/>
|
|
52
|
-
</template>
|
|
53
|
-
</a-form-model-item>
|
|
54
|
-
<a-form-model-item label="排序方式" prop="orderBy">
|
|
55
|
-
<a-input v-model="form.orderBy" placeholder="排序字段,用别名+字段名+排序方式(可选)表示,如:u.id desc" />
|
|
56
|
-
</a-form-model-item>
|
|
57
|
-
<a-form-model-item label="数据字段" prop="column">
|
|
58
|
-
<a-button type="primary" @click="addColumnItem()">增加</a-button>
|
|
59
|
-
<div v-for="(columnItem, index) in form.column" :key="index">
|
|
60
|
-
<a-row :gutter="16">
|
|
61
|
-
<a-col :span="16">
|
|
62
|
-
<span style="font-weight: bold">{{ columnItem.title }}({{ columnItem.key }})</span>
|
|
63
|
-
</a-col>
|
|
64
|
-
<a-col v-if="index > 0 && form.column.length > 1" :span="2">
|
|
65
|
-
<a-icon type="up-square" @click="upColumnItem(columnItem.key,index)"/>
|
|
66
|
-
</a-col>
|
|
67
|
-
<a-col v-if="(index !== form.column.length - 1) && form.column.length > 1" :span="2">
|
|
68
|
-
<a-icon type="down-square" @click="downColumnItem(columnItem.key,index)"/>
|
|
69
|
-
</a-col>
|
|
70
|
-
<a-col :span="2">
|
|
71
|
-
<a-icon type="edit" @click="editColumnItem(columnItem.key,index)"/>
|
|
72
|
-
</a-col>
|
|
73
|
-
<a-col :span="2">
|
|
74
|
-
<a-icon type="close" @click="removeColumnItem(columnItem.key,index)"/>
|
|
75
|
-
</a-col>
|
|
76
|
-
</a-row>
|
|
77
|
-
</div>
|
|
78
|
-
</a-form-model-item>
|
|
79
|
-
<a-form-model-item label="操作按钮配置" prop="buttonState">
|
|
80
|
-
<a-checkbox-group v-model="buttonStateData" :options="buttonStateArray" />
|
|
81
|
-
</a-form-model-item>
|
|
82
|
-
</a-form-model>
|
|
83
|
-
<a-modal
|
|
84
|
-
title="数据字段配置"
|
|
85
|
-
:visible="dataColumnVisible"
|
|
86
|
-
:width="1000"
|
|
87
|
-
:zIndex="1001"
|
|
88
|
-
@cancel="modelCancel"
|
|
89
|
-
@ok="submitItem">
|
|
90
|
-
<a-form-model
|
|
91
|
-
ref="itemForm"
|
|
92
|
-
:rules="itemRules"
|
|
93
|
-
:model="item">
|
|
94
|
-
<a-row :gutter="16">
|
|
95
|
-
<a-col :span="8">
|
|
96
|
-
<a-form-model-item label="数据字段名" prop="key">
|
|
97
|
-
<a-input v-model="item.key" placeholder="请输入数据字段名" ref="key">
|
|
98
|
-
<a-popover slot="suffix" title="关于数据字段名" placement="bottom">
|
|
99
|
-
<template slot="content">
|
|
100
|
-
<p>设置数据字段的名称</p>
|
|
101
|
-
<p>用作SQL查询时必须遵守<span style="font-weight: bold">表别名.列名</span>的格式,如:i.id</p>
|
|
102
|
-
<p>其他情况下不限制</p>
|
|
103
|
-
</template>
|
|
104
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
105
|
-
</a-popover>
|
|
106
|
-
</a-input>
|
|
107
|
-
</a-form-model-item>
|
|
108
|
-
</a-col>
|
|
109
|
-
<a-col :span="8">
|
|
110
|
-
<a-form-model-item label="数据字段中文名" prop="title">
|
|
111
|
-
<a-input v-model="item.title" placeholder="请输入数据字段中文名,如:编号" />
|
|
112
|
-
</a-form-model-item>
|
|
113
|
-
</a-col>
|
|
114
|
-
</a-row>
|
|
115
|
-
<a-row :gutter="16">
|
|
116
|
-
<a-col :span="24">
|
|
117
|
-
<a-form-model-item label="数据模式" prop="dataMode">
|
|
118
|
-
<a-checkbox-group v-model="dataModeArrayData" :options="dataModeArray" />
|
|
119
|
-
</a-form-model-item>
|
|
120
|
-
</a-col>
|
|
121
|
-
</a-row>
|
|
122
|
-
<template v-if="dataMode.queryForm || dataMode.addOrEditForm">
|
|
123
|
-
<a-row :gutter="16">
|
|
124
|
-
<a-col :span="8">
|
|
125
|
-
<a-form-model-item label="表单类型" prop="formType">
|
|
126
|
-
<a-select v-model="item.formType" placeholder="表单类型,可选" @change="changeFormType(item)">
|
|
127
|
-
<a-select-option key="input">输入框</a-select-option>
|
|
128
|
-
<a-select-option key="select">选择框</a-select-option>
|
|
129
|
-
<a-select-option key="checkbox">多选框</a-select-option>
|
|
130
|
-
<a-select-option key="radio">单选框</a-select-option>
|
|
131
|
-
<a-select-option key="rangePicker">日期范围选择框</a-select-option>
|
|
132
|
-
<a-select-option key="monthPicker">月份选择框</a-select-option>
|
|
133
|
-
<a-select-option key="datePicker">单日选择框</a-select-option>
|
|
134
|
-
<!-- <a-select-option key="cascader">级联选择框(单个下拉)</a-select-option>-->
|
|
135
|
-
<a-select-option key="selects">级联选择框</a-select-option>
|
|
136
|
-
<a-select-option key="textarea">文本域</a-select-option>
|
|
137
|
-
<a-select-option key="file">文件上传</a-select-option>
|
|
138
|
-
<a-select-option key="image">图片上传</a-select-option>
|
|
139
|
-
<a-popover slot="suffixIcon" title="关于表单类型" placement="right">
|
|
140
|
-
<template slot="content">
|
|
141
|
-
<p>预览设置的表单类型</p>
|
|
142
|
-
<a-input-group compact style="width: 400px;">
|
|
143
|
-
<a-input value="输入框" style="width: 20%" readOnly/>
|
|
144
|
-
<a-input style="width: 80%" placeholder="请输入"/>
|
|
145
|
-
</a-input-group>
|
|
146
|
-
<br/>
|
|
147
|
-
<a-input-group compact style="width: 400px;">
|
|
148
|
-
<a-input value="选择框" style="width: 20%" readOnly/>
|
|
149
|
-
<a-select style="width: 80%" placeholder="请选择"/>
|
|
150
|
-
</a-input-group>
|
|
151
|
-
<br/>
|
|
152
|
-
<a-input-group compact style="width: 400px;">
|
|
153
|
-
<a-input value="多选框" style="width: 20%" readOnly/>
|
|
154
|
-
<a-checkbox-group style="margin-left: 10px;margin-top: 5px; width: 70%" :options="['数据1','数据2']"/>
|
|
155
|
-
</a-input-group>
|
|
156
|
-
<br/>
|
|
157
|
-
<a-input-group compact style="width: 400px;">
|
|
158
|
-
<a-input value="单选框" style="width: 20%" readOnly/>
|
|
159
|
-
<a-radio-group style="margin-left: 10px;margin-top: 5px; width: 70%" :options="[{label: '数据1', value: 'a'},{label: '数据2', value: 'b'}]" name="radioGroup" />
|
|
160
|
-
</a-input-group>
|
|
161
|
-
<br/>
|
|
162
|
-
<a-input-group compact style="width: 400px;">
|
|
163
|
-
<a-input value="日期范围选择框" style="width: 20%" readOnly/>
|
|
164
|
-
<a-range-picker style="width: 80%" :show-time="true" format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss" />
|
|
165
|
-
</a-input-group>
|
|
166
|
-
<br/>
|
|
167
|
-
<a-input-group compact style="width: 400px;">
|
|
168
|
-
<a-input value="月份选择框" style="width: 20%" readOnly/>
|
|
169
|
-
<a-month-picker style="width: 80%"/>
|
|
170
|
-
</a-input-group>
|
|
171
|
-
<br/>
|
|
172
|
-
<a-input-group compact style="width: 400px;">
|
|
173
|
-
<a-input value="单日选择框" style="width: 20%" readOnly/>
|
|
174
|
-
<a-date-picker style="width: 80%"/>
|
|
175
|
-
</a-input-group>
|
|
176
|
-
<br/>
|
|
177
|
-
<a-input-group compact style="width: 400px;">
|
|
178
|
-
<a-input value="级联选择框" style="width: 20%" readOnly/>
|
|
179
|
-
<a-cascader style="width: 80%" placeholder="请选择"/>
|
|
180
|
-
</a-input-group>
|
|
181
|
-
<br/>
|
|
182
|
-
<a-input-group compact style="width: 400px;">
|
|
183
|
-
<a-input value="文本域" style="width: 20%" readOnly/>
|
|
184
|
-
<a-textarea style="width: 80%" placeholder="请输入" :rows="1"/>
|
|
185
|
-
</a-input-group>
|
|
186
|
-
<br/>
|
|
187
|
-
<a-input-group compact style="width: 400px;">
|
|
188
|
-
<a-input value="文件上传" style="width: 20%" readOnly/>
|
|
189
|
-
<a-upload-dragger
|
|
190
|
-
name="file"
|
|
191
|
-
:multiple="true"
|
|
192
|
-
style="margin-left: 5px; width: 75%"
|
|
193
|
-
action="https://www.mocky.io/v2/5cc8019d300000980a055e76">
|
|
194
|
-
<p class="ant-upload-drag-icon">
|
|
195
|
-
<a-icon type="inbox" />
|
|
196
|
-
</p>
|
|
197
|
-
<p class="ant-upload-text">
|
|
198
|
-
点击或拖动文件到该区域上传
|
|
199
|
-
</p>
|
|
200
|
-
<p class="ant-upload-hint">
|
|
201
|
-
支持单个或多个文件
|
|
202
|
-
</p>
|
|
203
|
-
</a-upload-dragger>
|
|
204
|
-
</a-input-group>
|
|
205
|
-
<br/>
|
|
206
|
-
<a-input-group compact style="width: 400px;">
|
|
207
|
-
<a-input value="图片上传" style="width: 20%" readOnly/>
|
|
208
|
-
<a-upload style="margin-left: 5px; width: 75%" list-type="picture-card" :file-list="[]">
|
|
209
|
-
<a-icon type="plus" />
|
|
210
|
-
<div class="ant-upload-text">
|
|
211
|
-
Upload
|
|
212
|
-
</div>
|
|
213
|
-
</a-upload>
|
|
214
|
-
</a-input-group>
|
|
215
|
-
</template>
|
|
216
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
217
|
-
</a-popover>
|
|
218
|
-
</a-select>
|
|
219
|
-
</a-form-model-item>
|
|
220
|
-
</a-col>
|
|
221
|
-
<a-col :span="8">
|
|
222
|
-
<a-form-model-item
|
|
223
|
-
label="表单水印"
|
|
224
|
-
prop="placeholder"
|
|
225
|
-
v-if="item.formType !== 'checkbox' && item.formType !== 'radio' && item.formType !== 'file' && item.formType !== 'image'">
|
|
226
|
-
<a-input v-model="item.placeholder" placeholder="表单水印(placeholder),可选" />
|
|
227
|
-
</a-form-model-item>
|
|
228
|
-
</a-col>
|
|
229
|
-
<a-col :span="8">
|
|
230
|
-
<a-form-model-item label="表单查询方式" prop="queryType" v-if="dataMode.queryForm && dataMode.sqlQueryCondition">
|
|
231
|
-
<a-select v-model="item.queryType" placeholder="表单查询方式,可选">
|
|
232
|
-
<template v-for="queryTypeItem in queryTypeV">
|
|
233
|
-
<a-select-option :key="queryTypeItem.key">{{ queryTypeItem.label }}</a-select-option>
|
|
234
|
-
</template>
|
|
235
|
-
</a-select>
|
|
236
|
-
</a-form-model-item>
|
|
237
|
-
</a-col>
|
|
238
|
-
</a-row>
|
|
239
|
-
<a-row :gutter="16" v-if="item.formType === 'file' || item.formType === 'image'">
|
|
240
|
-
<a-col :span="8">
|
|
241
|
-
<a-form-model-item
|
|
242
|
-
label="允许上传文件数量"
|
|
243
|
-
prop="accept"
|
|
244
|
-
v-if="item.formType === 'file' || item.formType === 'image'">
|
|
245
|
-
<a-slider
|
|
246
|
-
v-model="item.acceptCount"
|
|
247
|
-
:min="1"
|
|
248
|
-
:max="20"
|
|
249
|
-
:marks="{ 1: '1', 3: '3', 5: '5', 10: '10', 15: '15', 20: '20'}"
|
|
250
|
-
:default-value="3"
|
|
251
|
-
/>
|
|
252
|
-
</a-form-model-item>
|
|
253
|
-
</a-col>
|
|
254
|
-
<a-col :span="8">
|
|
255
|
-
<a-form-model-item
|
|
256
|
-
label="文件上传模式"
|
|
257
|
-
prop="resUploadMode"
|
|
258
|
-
v-if="item.formType === 'file' || item.formType === 'image'">
|
|
259
|
-
<a-select v-model="item.resUploadMode" placeholder="文件上传模式,默认为服务器" @change="changeFormType(item)">
|
|
260
|
-
<a-select-option key="server">服务器</a-select-option>
|
|
261
|
-
<a-select-option key="oss">腾讯云对象存储</a-select-option>
|
|
262
|
-
<a-select-option key="base64" :disabled="item.formType === 'file'">Base64</a-select-option>
|
|
263
|
-
<a-popover slot="suffixIcon" title="关于资源上传模式" placement="right">
|
|
264
|
-
<template slot="content">
|
|
265
|
-
<p>指定文件上传到服务器,对象存储还是以base64方式存储</p>
|
|
266
|
-
<br/>
|
|
267
|
-
<p><span style="font-weight: bold">服务器:</span>文件上传到服务器,数据库需存储文件于服务器的路径</p>
|
|
268
|
-
<p><span style="font-weight: bold">对象存储:</span>文件上传到云对象存储,数据库需存储文件于对象存储的路径</p>
|
|
269
|
-
<p><span style="font-weight: bold">base64:</span>文件以base64字符串方式存入数据库中(仅图片上传表单支持)</p>
|
|
270
|
-
</template>
|
|
271
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
272
|
-
</a-popover>
|
|
273
|
-
</a-select>
|
|
274
|
-
</a-form-model-item>
|
|
275
|
-
</a-col>
|
|
276
|
-
<a-col :span="8">
|
|
277
|
-
<a-form-model-item
|
|
278
|
-
label="允许上传文件类型"
|
|
279
|
-
prop="accept"
|
|
280
|
-
v-if="item.formType === 'file'">
|
|
281
|
-
<a-input v-model="item.accept" placeholder="指定文件类型,默认不限制,可选">
|
|
282
|
-
<a-popover slot="suffix" title="关于允许上传文件类型" placement="bottom">
|
|
283
|
-
<template slot="content">
|
|
284
|
-
<p>指定允许上传的文件类型扩展名,如:.doc,.docx等,详情请参考<a target="_blank" @click="visitAcceptFile">允许上传文件类型</a></p>
|
|
285
|
-
</template>
|
|
286
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
287
|
-
</a-popover>
|
|
288
|
-
</a-input>
|
|
289
|
-
</a-form-model-item>
|
|
290
|
-
</a-col>
|
|
291
|
-
<!-- TODO 配置文件上传表单-所属模块 -->
|
|
292
|
-
<!-- TODO 配置文件上传表单-上传扩展目录Key -->
|
|
293
|
-
</a-row>
|
|
294
|
-
<a-row :gutter="16" v-if="item.formType === 'selects'">
|
|
295
|
-
<a-col :span="8">
|
|
296
|
-
<a-form-model-item label="是否根节点" prop="groupIndexView">
|
|
297
|
-
<a-radio-group defaultValue="None" v-model="item.groupIndexView" @change="groupIndexChange" default-value="false" button-style="solid">
|
|
298
|
-
<a-radio-button :value="1">
|
|
299
|
-
是
|
|
300
|
-
</a-radio-button>
|
|
301
|
-
<a-radio-button value="None">
|
|
302
|
-
否
|
|
303
|
-
</a-radio-button>
|
|
304
|
-
</a-radio-group>
|
|
305
|
-
</a-form-model-item>
|
|
306
|
-
</a-col>
|
|
307
|
-
<a-col :span="8" v-if="item.groupIndex !== 1">
|
|
308
|
-
<a-form-model-item label="数据所属节点" prop="groupIndex">
|
|
309
|
-
<a-select v-model="item.parent_title" placeholder="请选择父节点" ref="groupIndex" @change="parent_title_change">
|
|
310
|
-
<a-select-option v-for="item in parent_node" :key="item.key">{{ item.title }}</a-select-option>
|
|
311
|
-
<a-popover slot="suffixIcon" title="关于父节点" placement="bottom">
|
|
312
|
-
<template slot="content">
|
|
313
|
-
<p>多个下拉框为一组时,需要首先选择的为父节点</p>
|
|
314
|
-
</template>
|
|
315
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
316
|
-
</a-popover>
|
|
317
|
-
</a-select>
|
|
318
|
-
</a-form-model-item>
|
|
319
|
-
</a-col>
|
|
320
|
-
</a-row>
|
|
321
|
-
<a-row :gutter="16">
|
|
322
|
-
<a-col :span="8">
|
|
323
|
-
<a-form-model-item label="数据源类型" prop="selectType" v-if="item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == 1) || item.formType === 'cascader'">
|
|
324
|
-
<a-select v-model="item.selectType" placeholder="请选择数据源类型" @change="changeSelectKey(item)">
|
|
325
|
-
<a-select-option key="key">字典键</a-select-option>
|
|
326
|
-
<a-select-option key="fixArray">固定集合</a-select-option>
|
|
327
|
-
<a-select-option key="logic">业务逻辑</a-select-option>
|
|
328
|
-
<a-popover
|
|
329
|
-
slot="suffixIcon"
|
|
330
|
-
title="关于下拉框或级联框数据源类型"
|
|
331
|
-
placement="bottom">
|
|
332
|
-
<template slot="content">
|
|
333
|
-
<p>设置下拉框或级联框的数据源</p>
|
|
334
|
-
<p>数据源类型分为三种,你可以根据需要选择</p>
|
|
335
|
-
<p>字典键:选项从字典表(t_dictionary)获取,你只需要选择字典键的名称即可</p>
|
|
336
|
-
<p>业务逻辑名称:选项通过发起http请求调用指定的业务逻辑(Logic)接口获取</p>
|
|
337
|
-
<p>固定集合:选项为静态值,JSONArray格式</p>
|
|
338
|
-
<p>当表单类型为 " 级联选择框(多个下拉) " 是数据模式为 [{lable,value,children[{lable,value,children[]},{lable,value,children[]}]}] 形式</p>
|
|
339
|
-
<p>如:</p>
|
|
340
|
-
<json-viewer :value="DemoJson" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
|
|
341
|
-
</template>
|
|
342
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
343
|
-
</a-popover>
|
|
344
|
-
</a-select>
|
|
345
|
-
</a-form-model-item>
|
|
346
|
-
</a-col>
|
|
347
|
-
<a-col :span="8">
|
|
348
|
-
<a-form-model-item label="数据源" prop="selectKey" v-if="(item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == 1) || item.formType === 'cascader') && item.selectType">
|
|
349
|
-
<a-select
|
|
350
|
-
show-search
|
|
351
|
-
v-model="item.selectKey"
|
|
352
|
-
v-if="item.selectType === 'key'"
|
|
353
|
-
placeholder="请选择字典键"
|
|
354
|
-
:filter-option="filterOption"
|
|
355
|
-
@change="changeSelectKey(item)"
|
|
356
|
-
>
|
|
357
|
-
<template>
|
|
358
|
-
<a-select-option
|
|
359
|
-
v-for="(optionItem,index) in option"
|
|
360
|
-
:key="index"
|
|
361
|
-
:value="Object.keys(optionItem)[0]">{{ optionItem[Object.keys(optionItem)[0]] }}
|
|
362
|
-
</a-select-option>
|
|
363
|
-
</template>
|
|
364
|
-
</a-select>
|
|
365
|
-
<a-input v-model="item.selectKey" v-if="item.selectType === 'logic'" placeholder="请输入业务逻辑名称"/>
|
|
366
|
-
<a-textarea v-model="item.selectKey" v-if="item.selectType === 'fixArray'" placeholder="请录入数据源" />
|
|
367
|
-
</a-form-model-item>
|
|
368
|
-
</a-col>
|
|
369
|
-
<a-col :span="8">
|
|
370
|
-
<a-form-model-item label="数据外键字段名" prop="selectKeyName" v-if="item.formType === 'select'">
|
|
371
|
-
<a-input v-model="item.selectKeyName" placeholder="该列所在表在主表的外键名,可选">
|
|
372
|
-
<a-popover slot="suffix" title="关于数据外键字段名" placement="bottom">
|
|
373
|
-
<template slot="content">
|
|
374
|
-
<p>当该列所属表为主表的关联表,且存在主外键关联关系,你可以指定<span style="font-weight: bold">该列所在表在主表的外键名</span>,如:i.f_type_id</p>
|
|
375
|
-
<p>如果你的<a @click="$refs['key'].focus()">数据字段名</a>所属表为主表,或字段名已经是主表外键名时,不用设置该值</p>
|
|
376
|
-
<p>设置该参数是为了表单查询时可以通过外键id列而非具体值筛选数据</p>
|
|
377
|
-
<p>示例:</p>
|
|
378
|
-
<p>主表为t_userfiles表,别名为u,与t_gasbrand(气表品牌表)有关联关系,别名为g,数据字段名设置为g.f_gasbrand</p>
|
|
379
|
-
<p>如果指定了数据外键字段名,例如u.f_gasbrand_id,则使用数据外键字段名筛选数据,如果不指定该值,则使用<a @click="$refs['key'].focus()">数据字段名</a>筛选</p>
|
|
380
|
-
</template>
|
|
381
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
382
|
-
</a-popover>
|
|
383
|
-
</a-input>
|
|
384
|
-
</a-form-model-item>
|
|
385
|
-
</a-col>
|
|
386
|
-
</a-row>
|
|
387
|
-
<a-form-model-item label="数据源加载方式" prop="selectLoadType" v-if="item.formType === 'select' && item.selectType === 'logic'">
|
|
388
|
-
<a-row :guttor="16">
|
|
389
|
-
<a-col :span="8">
|
|
390
|
-
<a-radio-group v-model="item.lazyLoad" default-value="false" button-style="solid">
|
|
391
|
-
<a-radio-button value="true">
|
|
392
|
-
懒加载搜索
|
|
393
|
-
</a-radio-button>
|
|
394
|
-
<a-radio-button value="false">
|
|
395
|
-
一次性加载
|
|
396
|
-
</a-radio-button>
|
|
397
|
-
</a-radio-group>
|
|
398
|
-
</a-col>
|
|
399
|
-
</a-row>
|
|
400
|
-
</a-form-model-item>
|
|
401
|
-
<a-form-model-item label="表单校验类型" prop="rule">
|
|
402
|
-
<a-row :gutter="16">
|
|
403
|
-
<a-col :span="8" v-if="item.formType === 'input' || item.formType === 'textarea'">
|
|
404
|
-
<a-select v-model="item.rule.type" placeholder="校验类型,可选">
|
|
405
|
-
<a-select-option key="string">字符串</a-select-option>
|
|
406
|
-
<a-select-option key="number">数字</a-select-option>
|
|
407
|
-
<a-select-option key="boolean">布尔值</a-select-option>
|
|
408
|
-
<a-select-option key="regexp">正则表达式</a-select-option>
|
|
409
|
-
<a-select-option key="integer">整数</a-select-option>
|
|
410
|
-
<a-select-option key="float">小数</a-select-option>
|
|
411
|
-
<a-select-option key="array">数组或集合</a-select-option>
|
|
412
|
-
<a-select-option key="date">日期</a-select-option>
|
|
413
|
-
<a-select-option key="email">邮箱</a-select-option>
|
|
414
|
-
<a-popover slot="suffixIcon" title="关于表单校验类型" placement="bottom">
|
|
415
|
-
<template slot="content">
|
|
416
|
-
<p>设置表单项的校验类型,默认字符串类型</p>
|
|
417
|
-
<p>你也可以设置该表单项是否必填</p>
|
|
418
|
-
</template>
|
|
419
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
420
|
-
</a-popover>
|
|
421
|
-
</a-select>
|
|
422
|
-
</a-col>
|
|
423
|
-
<a-col :span="8">
|
|
424
|
-
<a-radio-group v-model="item.rule.required" default-value="false" button-style="solid">
|
|
425
|
-
<a-radio-button value="true">
|
|
426
|
-
必选项
|
|
427
|
-
</a-radio-button>
|
|
428
|
-
<a-radio-button value="false">
|
|
429
|
-
非必选项
|
|
430
|
-
</a-radio-button>
|
|
431
|
-
</a-radio-group>
|
|
432
|
-
</a-col>
|
|
433
|
-
</a-row>
|
|
434
|
-
</a-form-model-item>
|
|
435
|
-
<a-row :gutter="16" v-if="dataMode.addOrEditForm && dataMode.sqlQueryItem">
|
|
436
|
-
<a-col :span="8">
|
|
437
|
-
<a-form-model-item ref="addOrEdit" label="新增/修改场景选择" prop="addOrEdit">
|
|
438
|
-
<a-select v-model="item.addOrEdit" placeholder="请选择场景">
|
|
439
|
-
<a-select-option key="all">新增和修改</a-select-option>
|
|
440
|
-
<a-select-option key="add">仅支持新增</a-select-option>
|
|
441
|
-
<a-select-option key="edit">仅支持修改</a-select-option>
|
|
442
|
-
<a-select-option key="silenceAdd">静默新增(不生成表单)</a-select-option>
|
|
443
|
-
<a-popover
|
|
444
|
-
slot="suffixIcon"
|
|
445
|
-
title="关于新增/修改场景选择"
|
|
446
|
-
placement="bottom">
|
|
447
|
-
<template slot="content">
|
|
448
|
-
<p>设置表单项的新增/修改场景</p>
|
|
449
|
-
<p>静默新增类型用于非人为新增的数据,不会生成表单项,且必须设置字段用途</p>
|
|
450
|
-
</template>
|
|
451
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
452
|
-
</a-popover>
|
|
453
|
-
</a-select>
|
|
454
|
-
</a-form-model-item>
|
|
455
|
-
</a-col>
|
|
456
|
-
<a-col :span="8">
|
|
457
|
-
<a-form-model-item v-if="item.addOrEdit === 'silenceAdd'" ref="silencePurpose" label="字段用途" prop="silencePurpose">
|
|
458
|
-
<a-select v-model="item.silencePurpose" placeholder="请选择字段用途">
|
|
459
|
-
<a-select-option key="createTime">创建时间</a-select-option>
|
|
460
|
-
<a-select-option key="operator">创建/操作人</a-select-option>
|
|
461
|
-
<a-select-option key="orgId">组织机构ID</a-select-option>
|
|
462
|
-
<a-select-option key="customize">自定义</a-select-option>
|
|
463
|
-
<a-popover
|
|
464
|
-
slot="suffixIcon"
|
|
465
|
-
title="关于字段用途"
|
|
466
|
-
placement="bottom">
|
|
467
|
-
<template slot="content">
|
|
468
|
-
<p>用于静默新增时设置字段用途</p>
|
|
469
|
-
<p>在新增数据的表单提交时,页面会根据设置的字段用途获取相关数据并追加到表单中</p>
|
|
470
|
-
<p>当字段用途选择为<span style="font-weight: bold">自定义</span>时,必须指定一个业务逻辑(Logic)名称,表单提交前会将表单内容作为参数调用该Logic接口,并将Logic返回值作为表单值</p>
|
|
471
|
-
</template>
|
|
472
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
473
|
-
</a-popover>
|
|
474
|
-
</a-select>
|
|
475
|
-
</a-form-model-item>
|
|
476
|
-
</a-col>
|
|
477
|
-
<a-col :span="8">
|
|
478
|
-
<a-form-model-item v-if="item.silencePurpose === 'customize'" label="业务逻辑" prop="silenceSource">
|
|
479
|
-
<a-input v-model="item.silenceSource" placeholder="请输入业务逻辑名称"/>
|
|
480
|
-
</a-form-model-item>
|
|
481
|
-
</a-col>
|
|
482
|
-
</a-row>
|
|
483
|
-
</template>
|
|
484
|
-
<template v-if="dataMode.table">
|
|
485
|
-
<a-row :gutter="16">
|
|
486
|
-
<a-col :span="8">
|
|
487
|
-
<a-form-model-item label="作用域插槽" prop="slot">
|
|
488
|
-
<a-select v-model="item.slot.type" placeholder="插槽类型,可选">
|
|
489
|
-
<a-select-option key="default">不设置</a-select-option>
|
|
490
|
-
<a-select-option key="ellipsis">文本溢出省略</a-select-option>
|
|
491
|
-
<a-select-option key="badge">多彩徽标</a-select-option>
|
|
492
|
-
<a-select-option key="date">日期格式化</a-select-option>
|
|
493
|
-
<a-select-option key="dateTime">日期时间格式化</a-select-option>
|
|
494
|
-
<a-select-option key="action">操作列</a-select-option>
|
|
495
|
-
<a-popover slot="suffixIcon" title="关于作用域插槽" placement="bottom">
|
|
496
|
-
<template slot="content">
|
|
497
|
-
<p>你可以通过设置表格列的作用域插槽实现一些效果</p>
|
|
498
|
-
<p>如果没有指定,默认会设置为文本溢出省略(长度:16)</p>
|
|
499
|
-
<p>如果你选择文本溢出省略,需要设置文本溢出上限长度</p>
|
|
500
|
-
<p>如果你选择多彩徽标,需要设置徽标对应的数据样式字典键</p>
|
|
501
|
-
</template>
|
|
502
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
503
|
-
</a-popover>
|
|
504
|
-
</a-select>
|
|
505
|
-
</a-form-model-item>
|
|
506
|
-
</a-col>
|
|
507
|
-
<a-col :span="8">
|
|
508
|
-
<a-form-model-item label="表格列宽度" prop="width">
|
|
509
|
-
<a-popover
|
|
510
|
-
title="关于表格列宽度"
|
|
511
|
-
placement="bottom">
|
|
512
|
-
<template slot="content">
|
|
513
|
-
<p>当作用域插槽设置为文本溢出省略时,表格列宽度将自适应,计算方式为文本溢出上限长度 * 7 + 42</p>
|
|
514
|
-
<p>当作用域插槽设置为多彩徽标时,表格列宽度为固定为130</p>
|
|
515
|
-
<p>当作用域插槽设置为日期时间格式化时,表格列宽度为固定为160</p>
|
|
516
|
-
<p>当该列数据过长导致换行时,建议设置作用域插槽为文本溢出省略,或将表格列设置为固定宽度值</p>
|
|
517
|
-
</template>
|
|
518
|
-
<a-input-number style="width: 100%" v-model="item.width" placeholder="表格列宽度,可选"/>
|
|
519
|
-
</a-popover>
|
|
520
|
-
</a-form-model-item>
|
|
521
|
-
</a-col>
|
|
522
|
-
<a-col :span="8">
|
|
523
|
-
<a-form-model-item label="字段默认值" prop="default" v-if="dataMode.sqlQueryItem">
|
|
524
|
-
<a-input v-model="item.default" placeholder="当查询结果为null时,指定默认值,可选" />
|
|
525
|
-
</a-form-model-item>
|
|
526
|
-
</a-col>
|
|
527
|
-
</a-row>
|
|
528
|
-
<a-row :gutter="16">
|
|
529
|
-
<a-col :span="8">
|
|
530
|
-
<a-form-model-item label="文本溢出上限长度" prop="slotValue" v-if="item.slot.type === 'ellipsis'">
|
|
531
|
-
<a-input-number style="width: 100%" v-model="item.slotValue" placeholder="请输入文本溢出上限长度"/>
|
|
532
|
-
</a-form-model-item>
|
|
533
|
-
<a-form-model-item label="徽标字典键" prop="slotKeyMap" v-if="item.slot.type === 'badge'">
|
|
534
|
-
<a-input v-model="item.slotKeyMap" placeholder="请输入徽标字典键">
|
|
535
|
-
<a-popover
|
|
536
|
-
title="关于徽标字典键"
|
|
537
|
-
placement="bottom"
|
|
538
|
-
slot="suffix">
|
|
539
|
-
<template slot="content">
|
|
540
|
-
<p>如果你设置了表单类型为选择框,且数据源是字典键,该值会自动带出</p>
|
|
541
|
-
</template>
|
|
542
|
-
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
543
|
-
</a-popover>
|
|
544
|
-
</a-input>
|
|
545
|
-
</a-form-model-item>
|
|
546
|
-
<a-form-model-item label="操作列文本" prop="actionText" v-if="item.slot.type === 'action'">
|
|
547
|
-
<a-input v-model="item.actionText" placeholder="请输入操作列显示文本,默认为详情"/>
|
|
548
|
-
</a-form-model-item>
|
|
549
|
-
</a-col>
|
|
550
|
-
</a-row>
|
|
551
|
-
</template>
|
|
552
|
-
<a-alert style="margin-top: 5px" v-if="dataModeArrayData.length === 0" show-icon message="错误:请至少选择一种数据模式" type="error" />
|
|
553
|
-
<a-alert style="margin-top: 5px" v-if="dataMode.addOrEditForm && !dataMode.sqlQueryItem" show-icon message="错误:如果要生成新增/修改表单项,必须勾选生成SQL查询项" type="error" />
|
|
554
|
-
<a-alert style="margin-top: 5px" v-if="(item.formType === 'file' || item.formType === 'image') && !(!dataMode.table && !dataMode.sqlQueryCondition && !dataMode.queryForm)" show-icon message="错误:上传类表单的数据模式只能选择 生成新增/修改表单项 和 生成SQL查询项 " type="error" />
|
|
555
|
-
<a-alert style="margin-top: 5px" v-if="dataMode.queryForm && !dataMode.sqlQueryCondition" show-icon message="提示:您没有勾选生成SQL查询表达式,渲染的表单项不会生成SQL查询条件" type="info" />
|
|
556
|
-
<a-alert style="margin-top: 5px" v-if="dataMode.table && !dataMode.sqlQueryItem" show-icon message="提示:您没有勾选生成SQL查询项,渲染的表格列不会绑定SQL结果集数据" type="info" />
|
|
557
|
-
</a-form-model>
|
|
558
|
-
</a-modal>
|
|
559
|
-
<a-button type="primary" @click="view">操作</a-button>
|
|
560
|
-
</a-col>
|
|
561
|
-
<a-col :xl="10" :lg="12" :md="12" :sm="24" :xs="24">
|
|
562
|
-
<a-card :bordered="false" title="预览" size="small" style="overflow: auto">
|
|
563
|
-
<json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="result" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
|
|
564
|
-
</a-card>
|
|
565
|
-
</a-col>
|
|
566
|
-
</a-row>
|
|
567
|
-
<a-modal
|
|
568
|
-
title="效果预览"
|
|
569
|
-
:width="isMobile ? screenWidth : screenWidth * 0.8"
|
|
570
|
-
:centered="true"
|
|
571
|
-
:visible="modelVisible"
|
|
572
|
-
:zIndex="1001"
|
|
573
|
-
@cancel="onModelClose"
|
|
574
|
-
:destroyOnClose="true">
|
|
575
|
-
<template slot="footer">
|
|
576
|
-
<a-button key="close" @click="onModelClose">
|
|
577
|
-
返回
|
|
578
|
-
</a-button>
|
|
579
|
-
<a-button key="submit" type="primary" @click="submit">
|
|
580
|
-
保存
|
|
581
|
-
</a-button>
|
|
582
|
-
</template>
|
|
583
|
-
<x-form-table
|
|
584
|
-
:view-mode="true"
|
|
585
|
-
:queryParamsJson="result">
|
|
586
|
-
</x-form-table>
|
|
587
|
-
</a-modal>
|
|
588
|
-
</a-drawer>
|
|
589
|
-
</template>
|
|
590
|
-
|
|
591
|
-
<script>
|
|
592
|
-
import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
|
|
593
|
-
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
|
|
594
|
-
import JsonViewer from 'vue-json-viewer'
|
|
595
|
-
import FileSaver from 'file-saver'
|
|
596
|
-
import { queryType } from '@/config/CreateQueryConfig'
|
|
597
|
-
import { mapState } from 'vuex'
|
|
598
|
-
import { post } from '@vue2-client/services/api/restTools'
|
|
599
|
-
import { commonApi } from '@vue2-client/services/api/common'
|
|
600
|
-
const DemoJson = [{ value: 'zhejiang', label: 'Zhejiang', children: [{ value: 'hangzhou', label: 'Hangzhou', children: [{ value: 'xihu', label: 'West Lake' }] }] }]
|
|
601
|
-
export default {
|
|
602
|
-
name: 'CreateQuery',
|
|
603
|
-
components: {
|
|
604
|
-
JsonViewer,
|
|
605
|
-
XFormTable,
|
|
606
|
-
XFormItem
|
|
607
|
-
},
|
|
608
|
-
data () {
|
|
609
|
-
return {
|
|
610
|
-
DemoJson,
|
|
611
|
-
// 页面宽度
|
|
612
|
-
screenWidth: document.documentElement.clientWidth,
|
|
613
|
-
// 效果预览模态框是否展示
|
|
614
|
-
modelVisible: false,
|
|
615
|
-
// 数据列配置模态框是否展示
|
|
616
|
-
dataColumnVisible: false,
|
|
617
|
-
// 数据列操作类型:新增,修改
|
|
618
|
-
type: '新增',
|
|
619
|
-
// 数据模式类型集合
|
|
620
|
-
dataModeArray: [
|
|
621
|
-
{ label: '生成查询表单项', value: 'queryForm' },
|
|
622
|
-
{ label: '生成表格列', value: 'table' },
|
|
623
|
-
{ label: '生成新增/修改表单项', value: 'addOrEditForm' },
|
|
624
|
-
{ label: '生成SQL查询项', value: 'sqlQueryItem' },
|
|
625
|
-
{ label: '生成SQL查询表达式', value: 'sqlQueryCondition' }
|
|
626
|
-
],
|
|
627
|
-
// 操作按钮状态集合
|
|
628
|
-
buttonStateArray: [
|
|
629
|
-
{ label: '新增', value: 'add' },
|
|
630
|
-
{ label: '修改', value: 'edit' },
|
|
631
|
-
{ label: '删除', value: 'delete' },
|
|
632
|
-
{ label: '导出', value: 'export' }
|
|
633
|
-
],
|
|
634
|
-
// 数据模式类型集合值
|
|
635
|
-
dataModeArrayData: ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition'],
|
|
636
|
-
// 操作按钮状态集合值
|
|
637
|
-
buttonStateData: ['add', 'edit', 'delete', 'export'],
|
|
638
|
-
labelCol: { span: 4 },
|
|
639
|
-
wrapperCol: { span: 14 },
|
|
640
|
-
form: {
|
|
641
|
-
tableName: '',
|
|
642
|
-
joinArray: {},
|
|
643
|
-
condition: {},
|
|
644
|
-
orderBy: '',
|
|
645
|
-
column: []
|
|
646
|
-
},
|
|
647
|
-
result: {},
|
|
648
|
-
item: {
|
|
649
|
-
key: '',
|
|
650
|
-
title: '',
|
|
651
|
-
slot: {},
|
|
652
|
-
rule: {
|
|
653
|
-
required: 'false'
|
|
654
|
-
},
|
|
655
|
-
dataModeArray: []
|
|
656
|
-
},
|
|
657
|
-
itemMap: {},
|
|
658
|
-
selectIndex: null,
|
|
659
|
-
selectType: undefined,
|
|
660
|
-
joinArray: [],
|
|
661
|
-
rules: {
|
|
662
|
-
tableName: [{ required: true, message: '请输入查询表名', trigger: 'blur' }],
|
|
663
|
-
orderBy: [{ required: true, message: '请输入排序方式', trigger: 'blur' }]
|
|
664
|
-
},
|
|
665
|
-
itemRules: {
|
|
666
|
-
key: [{ required: true, message: '请输入数据列名', trigger: 'blur' }],
|
|
667
|
-
title: [{ required: true, message: '请输入中文名称', trigger: 'blur' }],
|
|
668
|
-
selectType: [{ required: true, message: '请选择数据源类型', trigger: 'change' }],
|
|
669
|
-
selectKey: [{ required: true, message: '请输入数据源内容', trigger: 'blur' }],
|
|
670
|
-
slotValue: [{ required: true, message: '请输入文本溢出上限长度', trigger: 'blur' }],
|
|
671
|
-
slotKeyMap: [{ required: true, message: '请输入徽标字典键', trigger: 'blur' }],
|
|
672
|
-
silencePurpose: [{ required: true, message: '请选择字段用途', trigger: 'change' }],
|
|
673
|
-
silenceSource: [{ required: true, message: '请输入业务逻辑名称', trigger: 'blur' }],
|
|
674
|
-
group: [{ required: true, message: '请选择父节点', trigger: 'blur' }],
|
|
675
|
-
groupIndex: [{ required: true, message: '如果不是根节点请选择自己的父节点', trigger: 'blur' }]
|
|
676
|
-
|
|
677
|
-
},
|
|
678
|
-
// 字典键集合
|
|
679
|
-
option: []
|
|
680
|
-
}
|
|
681
|
-
},
|
|
682
|
-
mounted () {
|
|
683
|
-
this.initView()
|
|
684
|
-
},
|
|
685
|
-
computed: {
|
|
686
|
-
...mapState('setting', ['isMobile']),
|
|
687
|
-
parent_node () {
|
|
688
|
-
return this.form.column.filter(item => item.formType === 'selects' && item.key != this.item.key)
|
|
689
|
-
},
|
|
690
|
-
queryTypeV () {
|
|
691
|
-
if (this.item.formType) {
|
|
692
|
-
return queryType.filter(item => item.match.includes(this.item.formType))
|
|
693
|
-
}
|
|
694
|
-
return queryType
|
|
695
|
-
},
|
|
696
|
-
conditionJoinArray: function () {
|
|
697
|
-
const result = []
|
|
698
|
-
for (const item in this.form.joinArray) {
|
|
699
|
-
if (item !== '') {
|
|
700
|
-
result.push({
|
|
701
|
-
label: item,
|
|
702
|
-
value: item
|
|
703
|
-
})
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
if (result.length === 0) {
|
|
707
|
-
result.push({
|
|
708
|
-
label: '-',
|
|
709
|
-
value: '-'
|
|
710
|
-
})
|
|
711
|
-
}
|
|
712
|
-
return result
|
|
713
|
-
},
|
|
714
|
-
dataMode: function () {
|
|
715
|
-
const result = {
|
|
716
|
-
queryForm: false,
|
|
717
|
-
table: false,
|
|
718
|
-
addOrEditForm: false,
|
|
719
|
-
sqlQueryItem: false,
|
|
720
|
-
sqlQueryCondition: false
|
|
721
|
-
}
|
|
722
|
-
for (const item of this.dataModeArrayData) {
|
|
723
|
-
result[item] = true
|
|
724
|
-
}
|
|
725
|
-
return result
|
|
726
|
-
},
|
|
727
|
-
buttonState: function () {
|
|
728
|
-
const result = {
|
|
729
|
-
add: false,
|
|
730
|
-
edit: false,
|
|
731
|
-
delete: false,
|
|
732
|
-
export: false
|
|
733
|
-
}
|
|
734
|
-
for (const item of this.buttonStateData) {
|
|
735
|
-
result[item] = true
|
|
736
|
-
}
|
|
737
|
-
return result
|
|
738
|
-
}
|
|
739
|
-
},
|
|
740
|
-
props: {
|
|
741
|
-
visible: {
|
|
742
|
-
type: Boolean,
|
|
743
|
-
default: false
|
|
744
|
-
},
|
|
745
|
-
toEditJson: {
|
|
746
|
-
type: Object,
|
|
747
|
-
default: () => {}
|
|
748
|
-
}
|
|
749
|
-
},
|
|
750
|
-
watch: {
|
|
751
|
-
visible (rel) {
|
|
752
|
-
if (rel) {
|
|
753
|
-
this.initView()
|
|
754
|
-
}
|
|
755
|
-
if (rel && this.toEditJson) {
|
|
756
|
-
// 处理预设关联表
|
|
757
|
-
if (this.joinArray.length === 0) {
|
|
758
|
-
for (const key in this.toEditJson.joinArray) {
|
|
759
|
-
this.joinArray.push({
|
|
760
|
-
key: key,
|
|
761
|
-
value: this.toEditJson.joinArray[key]
|
|
762
|
-
})
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
// 处理具体表单项
|
|
766
|
-
this.form = Object.assign(
|
|
767
|
-
{
|
|
768
|
-
tableName: '',
|
|
769
|
-
joinArray: {},
|
|
770
|
-
condition: {},
|
|
771
|
-
orderBy: '',
|
|
772
|
-
column: []
|
|
773
|
-
}, this.toEditJson
|
|
774
|
-
)
|
|
775
|
-
for (const columnItem of this.form.column) {
|
|
776
|
-
// 数据模式兼容性处理
|
|
777
|
-
if (!(columnItem.dataMode || columnItem.dataModeArray)) {
|
|
778
|
-
columnItem.dataModeArray = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
779
|
-
} else if (columnItem.dataMode) {
|
|
780
|
-
if (columnItem.dataMode === 'all') {
|
|
781
|
-
columnItem.dataModeArray = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
782
|
-
} else if (columnItem.dataMode === 'form') {
|
|
783
|
-
columnItem.dataModeArray = ['queryForm', 'addOrEditForm', 'sqlQueryCondition']
|
|
784
|
-
} else if (columnItem.dataMode === 'table') {
|
|
785
|
-
columnItem.dataModeArray = ['table', 'sqlQueryItem']
|
|
786
|
-
} else if (columnItem.dataMode === 'table_form') {
|
|
787
|
-
columnItem.dataModeArray = ['table', 'sqlQueryItem', 'sqlQueryCondition']
|
|
788
|
-
} else if (columnItem.dataMode === 'only_form') {
|
|
789
|
-
columnItem.dataModeArray = ['queryForm']
|
|
790
|
-
} else if (columnItem.dataMode === 'only_table') {
|
|
791
|
-
columnItem.dataModeArray = ['table']
|
|
792
|
-
} else if (columnItem.dataMode === 'clear') {
|
|
793
|
-
columnItem.dataModeArray = ['sqlQueryItem', 'sqlQueryCondition']
|
|
794
|
-
} else if (columnItem.dataMode === 'only_add_modify') {
|
|
795
|
-
columnItem.dataModeArray = ['addOrEditForm', 'sqlQueryItem']
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
delete columnItem.dataMode
|
|
799
|
-
// 插槽兼容处理
|
|
800
|
-
if (columnItem.slot) {
|
|
801
|
-
if (columnItem.slot.value && columnItem.slot.type === 'ellipsis') {
|
|
802
|
-
columnItem.slotValue = columnItem.slot.value
|
|
803
|
-
} else if (columnItem.slot.keyMap && columnItem.slot.type === 'badge') {
|
|
804
|
-
columnItem.slotKeyMap = columnItem.slot.keyMap
|
|
805
|
-
} else if (columnItem.slot.actionText && columnItem.slot.type === 'action') {
|
|
806
|
-
columnItem.actionText = columnItem.slot.actionText
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
// 必选项兼容处理
|
|
810
|
-
if (columnItem.rule && !isNaN(columnItem.rule.required)) {
|
|
811
|
-
columnItem.rule.required = columnItem.rule.required.toString()
|
|
812
|
-
} else {
|
|
813
|
-
if (!columnItem.rule) {
|
|
814
|
-
columnItem.rule = {}
|
|
815
|
-
}
|
|
816
|
-
columnItem.rule.required = 'false'
|
|
817
|
-
}
|
|
818
|
-
// 下拉框数据源兼容处理
|
|
819
|
-
if ((columnItem.formType === 'select' || columnItem.formType === 'cascader') && columnItem.selectKey) {
|
|
820
|
-
// 数据源为logic
|
|
821
|
-
if (columnItem.selectKey.toString().startsWith('logic@')) {
|
|
822
|
-
columnItem.selectType = 'logic'
|
|
823
|
-
} else if (columnItem.selectKey instanceof Array || this.isJSON(columnItem.selectKey)) {
|
|
824
|
-
// 数据源为固定json集合
|
|
825
|
-
if (columnItem.selectKey instanceof Array) {
|
|
826
|
-
columnItem.selectKey = JSON.stringify(columnItem.selectKey)
|
|
827
|
-
}
|
|
828
|
-
columnItem.selectType = 'fixArray'
|
|
829
|
-
} else {
|
|
830
|
-
columnItem.selectType = 'key'
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
this.itemMap[columnItem.key] = Object.assign({
|
|
834
|
-
key: '',
|
|
835
|
-
title: '',
|
|
836
|
-
slot: {},
|
|
837
|
-
rule: {
|
|
838
|
-
required: 'false'
|
|
839
|
-
},
|
|
840
|
-
dataModeArray: []
|
|
841
|
-
}, columnItem)
|
|
842
|
-
}
|
|
843
|
-
// 处理操作按钮配置
|
|
844
|
-
if (this.toEditJson.buttonState) {
|
|
845
|
-
this.buttonStateData = []
|
|
846
|
-
for (const buttonStateKey of Object.keys(this.toEditJson.buttonState)) {
|
|
847
|
-
if (this.toEditJson.buttonState[buttonStateKey]) {
|
|
848
|
-
this.buttonStateData.push(buttonStateKey)
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
} else {
|
|
852
|
-
this.buttonStateData = ['add', 'edit', 'delete', 'export']
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
},
|
|
857
|
-
methods: {
|
|
858
|
-
parent_title_change (parentKey) {
|
|
859
|
-
const parentArr = this.form.column.filter(item => item.formType === 'selects' && item.key === parentKey)
|
|
860
|
-
if (parentArr.length === 1) {
|
|
861
|
-
this.item.groupIndex = parentArr[0].groupIndex + 1
|
|
862
|
-
this.item.group = parentArr[0].group
|
|
863
|
-
this.item.parent_title = parentArr[0].title
|
|
864
|
-
} else {
|
|
865
|
-
this.$message.error('数据字段中有字段别名相同,请检查!')
|
|
866
|
-
}
|
|
867
|
-
},
|
|
868
|
-
groupIndexChange ({ target }) {
|
|
869
|
-
if (target.value === 1) {
|
|
870
|
-
this.item.groupIndex = 1
|
|
871
|
-
if (this.item.title) {
|
|
872
|
-
this.item.group = this.item.title + '组'
|
|
873
|
-
} else {
|
|
874
|
-
this.item.groupIndex = ''
|
|
875
|
-
this.$message.error('请先输入字段中文名称!')
|
|
876
|
-
}
|
|
877
|
-
} else {
|
|
878
|
-
this.item.groupIndex = ''
|
|
879
|
-
}
|
|
880
|
-
},
|
|
881
|
-
// 初始化组件
|
|
882
|
-
initView () {
|
|
883
|
-
this.joinArray = []
|
|
884
|
-
this.result = {}
|
|
885
|
-
post(commonApi.getDictionaryParam, {}).then(res => {
|
|
886
|
-
this.option = res
|
|
887
|
-
})
|
|
888
|
-
},
|
|
889
|
-
onClose () {
|
|
890
|
-
this.$emit('update:visible', false)
|
|
891
|
-
},
|
|
892
|
-
filterOption (input, option) {
|
|
893
|
-
return (
|
|
894
|
-
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
895
|
-
)
|
|
896
|
-
},
|
|
897
|
-
onModelClose () {
|
|
898
|
-
this.modelVisible = false
|
|
899
|
-
},
|
|
900
|
-
addJoinItem () {
|
|
901
|
-
this.joinArray.push({
|
|
902
|
-
key: '',
|
|
903
|
-
value: ''
|
|
904
|
-
})
|
|
905
|
-
this.changeJoinArray()
|
|
906
|
-
},
|
|
907
|
-
removeJoinItem (index) {
|
|
908
|
-
this.joinArray.splice(index, 1)
|
|
909
|
-
this.changeJoinArray()
|
|
910
|
-
},
|
|
911
|
-
addColumnItem () {
|
|
912
|
-
this.type = '新增'
|
|
913
|
-
this.dataColumnVisible = true
|
|
914
|
-
},
|
|
915
|
-
editColumnItem (key, index) {
|
|
916
|
-
if (this.itemMap[key]) {
|
|
917
|
-
this.type = '修改'
|
|
918
|
-
this.item = this.itemMap[key]
|
|
919
|
-
if (this.item.formType === 'selects') {
|
|
920
|
-
// 因为 groupIndex 可能有很多值 单选框不行 赋给一个新的变量
|
|
921
|
-
this.item.groupIndexView = this.item.groupIndex === 1 ? 1 : 'None'
|
|
922
|
-
}
|
|
923
|
-
this.dataModeArrayData = this.item.dataModeArray
|
|
924
|
-
this.selectIndex = index
|
|
925
|
-
this.dataColumnVisible = true
|
|
926
|
-
} else {
|
|
927
|
-
this.$message.warn('编辑失败')
|
|
928
|
-
}
|
|
929
|
-
},
|
|
930
|
-
removeColumnItem (key, index) {
|
|
931
|
-
const _this = this
|
|
932
|
-
this.$confirm({
|
|
933
|
-
title: '您确定要删除该数据项?',
|
|
934
|
-
content: '删除的数据项无法恢复',
|
|
935
|
-
okText: '确定',
|
|
936
|
-
okType: 'danger',
|
|
937
|
-
cancelText: '取消',
|
|
938
|
-
onOk () {
|
|
939
|
-
delete _this.itemMap[key]
|
|
940
|
-
_this.form.column.splice(index, 1)
|
|
941
|
-
}
|
|
942
|
-
})
|
|
943
|
-
},
|
|
944
|
-
upColumnItem (key, index) {
|
|
945
|
-
const newIndex = index - 1
|
|
946
|
-
const itemA = this.form.column[newIndex]
|
|
947
|
-
const itemB = this.form.column[index]
|
|
948
|
-
this.form.column.splice(index, 1, itemA)
|
|
949
|
-
this.form.column.splice(newIndex, 1, itemB)
|
|
950
|
-
},
|
|
951
|
-
downColumnItem (key, index) {
|
|
952
|
-
const newIndex = index + 1
|
|
953
|
-
const itemA = this.form.column[newIndex]
|
|
954
|
-
const itemB = this.form.column[index]
|
|
955
|
-
this.form.column.splice(index, 1, itemA)
|
|
956
|
-
this.form.column.splice(newIndex, 1, itemB)
|
|
957
|
-
},
|
|
958
|
-
changeJoinArray () {
|
|
959
|
-
const joinArrayObject = {}
|
|
960
|
-
for (const item of this.joinArray) {
|
|
961
|
-
joinArrayObject[item.key] = item.value
|
|
962
|
-
}
|
|
963
|
-
this.form.joinArray = joinArrayObject
|
|
964
|
-
},
|
|
965
|
-
submitItem () {
|
|
966
|
-
this.$refs.itemForm.validate(valid => {
|
|
967
|
-
if (valid) {
|
|
968
|
-
if (this.dataModeArrayData.length === 0) {
|
|
969
|
-
this.$message.error('请至少选择一种数据模式')
|
|
970
|
-
return
|
|
971
|
-
}
|
|
972
|
-
if (this.dataMode.addOrEditForm && !this.dataMode.sqlQueryItem) {
|
|
973
|
-
this.$message.error('如果要生成新增/修改表单项,必须勾选生成SQL查询项')
|
|
974
|
-
return
|
|
975
|
-
}
|
|
976
|
-
if ((this.item.formType === 'file' || this.item.formType === 'image') && !(!this.dataMode.table && !this.dataMode.sqlQueryCondition && !this.dataMode.queryForm)) {
|
|
977
|
-
this.$message.error('上传类表单的数据模式只能选择 生成新增/修改表单项 和 生成SQL查询项')
|
|
978
|
-
return
|
|
979
|
-
}
|
|
980
|
-
this.itemHandle()
|
|
981
|
-
}
|
|
982
|
-
})
|
|
983
|
-
},
|
|
984
|
-
itemHandle () {
|
|
985
|
-
const str = JSON.stringify(this.item)
|
|
986
|
-
const item = JSON.parse(str)
|
|
987
|
-
this.itemMap[item.key] = JSON.parse(str)
|
|
988
|
-
this.itemMap[item.key].dataModeArray = this.dataModeArrayData
|
|
989
|
-
// 查询表单项或者新增/修改表单项
|
|
990
|
-
if (this.dataMode.queryForm || this.dataMode.addOrEditForm) {
|
|
991
|
-
if (!this.dataMode.sqlQueryItem || !this.dataMode.addOrEditForm) {
|
|
992
|
-
delete item.addOrEdit
|
|
993
|
-
delete item.silencePurpose
|
|
994
|
-
delete item.silenceSource
|
|
995
|
-
}
|
|
996
|
-
// 不生成SQL查询表达式,或者表单查询类型为=
|
|
997
|
-
if (!this.dataMode.sqlQueryCondition || (item.queryType && item.queryType === '=')) {
|
|
998
|
-
delete item.queryType
|
|
999
|
-
}
|
|
1000
|
-
// 表单类型为输入框
|
|
1001
|
-
if (item.formType && item.formType === 'input') {
|
|
1002
|
-
delete item.formType
|
|
1003
|
-
}
|
|
1004
|
-
// 校验类型
|
|
1005
|
-
if (item.rule.required) {
|
|
1006
|
-
item.rule.required = item.rule.required.toString() === 'true'
|
|
1007
|
-
} else {
|
|
1008
|
-
item.rule.required = false
|
|
1009
|
-
}
|
|
1010
|
-
// 下拉框
|
|
1011
|
-
if ((item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == '1') || item.formType === 'cascader') && item.selectKey) {
|
|
1012
|
-
// 数据源为logic
|
|
1013
|
-
if (item.selectType === 'logic') {
|
|
1014
|
-
// 如果已经有了 logic@ 将不再拼接
|
|
1015
|
-
if (item.selectKey.substring(0, 6) !== 'logic@') {
|
|
1016
|
-
item.selectKey = 'logic@' + item.selectKey
|
|
1017
|
-
}
|
|
1018
|
-
} else if (item.selectType === 'fixArray') {
|
|
1019
|
-
// 数据源为固定json集合
|
|
1020
|
-
if (!this.isJSON(item.selectKey)) {
|
|
1021
|
-
this.$message.warning('下拉框数据源不是JSON集合')
|
|
1022
|
-
return
|
|
1023
|
-
}
|
|
1024
|
-
delete item.lazyLoad
|
|
1025
|
-
} else {
|
|
1026
|
-
delete item.lazyLoad
|
|
1027
|
-
}
|
|
1028
|
-
if (item.formType !== 'selects') {
|
|
1029
|
-
delete item.selectType
|
|
1030
|
-
}
|
|
1031
|
-
} else {
|
|
1032
|
-
if (item.formType !== 'selects') {
|
|
1033
|
-
delete item.group
|
|
1034
|
-
delete item.groupIndex
|
|
1035
|
-
}
|
|
1036
|
-
delete item.selectType
|
|
1037
|
-
delete item.selectKey
|
|
1038
|
-
delete item.selectKeyName
|
|
1039
|
-
delete item.lazyLoad
|
|
1040
|
-
}
|
|
1041
|
-
} else {
|
|
1042
|
-
delete item.queryType
|
|
1043
|
-
delete item.formType
|
|
1044
|
-
delete item.addOrEdit
|
|
1045
|
-
delete item.silencePurpose
|
|
1046
|
-
delete item.silenceSource
|
|
1047
|
-
delete item.placeholder
|
|
1048
|
-
delete item.rule
|
|
1049
|
-
delete item.selectType
|
|
1050
|
-
delete item.selectKey
|
|
1051
|
-
delete item.selectKeyName
|
|
1052
|
-
delete item.lazyLoad
|
|
1053
|
-
}
|
|
1054
|
-
// 表格列
|
|
1055
|
-
if (this.dataMode.table) {
|
|
1056
|
-
if (item.slot.type && item.slot.type !== 'default') {
|
|
1057
|
-
if (item.slotValue && item.slot.type === 'ellipsis') {
|
|
1058
|
-
item.slot.value = item.slotValue
|
|
1059
|
-
} else if (item.slotKeyMap && item.slot.type === 'badge') {
|
|
1060
|
-
item.slot.keyMap = item.slotKeyMap
|
|
1061
|
-
} else if (item.actionText && item.slot.type === 'action') {
|
|
1062
|
-
item.slot.actionText = item.actionText
|
|
1063
|
-
}
|
|
1064
|
-
} else {
|
|
1065
|
-
delete item.slot
|
|
1066
|
-
}
|
|
1067
|
-
if (!item.width) {
|
|
1068
|
-
delete item.width
|
|
1069
|
-
}
|
|
1070
|
-
delete item.slotValue
|
|
1071
|
-
delete item.slotKeyMap
|
|
1072
|
-
delete item.actionText
|
|
1073
|
-
} else {
|
|
1074
|
-
delete item.slot
|
|
1075
|
-
delete item.slotValue
|
|
1076
|
-
delete item.slotKeyMap
|
|
1077
|
-
delete item.actionText
|
|
1078
|
-
delete item.width
|
|
1079
|
-
}
|
|
1080
|
-
// SQL查询项
|
|
1081
|
-
if (!this.dataMode.sqlQueryItem) {
|
|
1082
|
-
delete item.default
|
|
1083
|
-
}
|
|
1084
|
-
item.dataModeArray = this.dataModeArrayData
|
|
1085
|
-
if (this.type === '新增') {
|
|
1086
|
-
this.form.column.push(item)
|
|
1087
|
-
} else {
|
|
1088
|
-
this.form.column[this.selectIndex] = item
|
|
1089
|
-
}
|
|
1090
|
-
this.item = {
|
|
1091
|
-
key: '',
|
|
1092
|
-
title: '',
|
|
1093
|
-
slot: {},
|
|
1094
|
-
rule: {
|
|
1095
|
-
required: 'false'
|
|
1096
|
-
},
|
|
1097
|
-
dataModeArray: []
|
|
1098
|
-
}
|
|
1099
|
-
this.$message.success('增加成功')
|
|
1100
|
-
this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
1101
|
-
this.dataColumnVisible = false
|
|
1102
|
-
},
|
|
1103
|
-
// 判断是否为json字符串
|
|
1104
|
-
isJSON (str) {
|
|
1105
|
-
if (typeof str == 'string') {
|
|
1106
|
-
try {
|
|
1107
|
-
const obj = JSON.parse(str)
|
|
1108
|
-
return !!(typeof obj == 'object' && obj)
|
|
1109
|
-
} catch (e) {
|
|
1110
|
-
return false
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
},
|
|
1114
|
-
exportJson () {
|
|
1115
|
-
const data = JSON.stringify(this.form, null, 2)
|
|
1116
|
-
const blob = new Blob([data], { type: 'application/json' })
|
|
1117
|
-
FileSaver.saveAs(blob, `Query.json`)
|
|
1118
|
-
this.$message.success('导出成功!')
|
|
1119
|
-
},
|
|
1120
|
-
viewHandle (then) {
|
|
1121
|
-
if (this.form.column.length === 0) {
|
|
1122
|
-
this.$message.error('你没有增加任何数据字段')
|
|
1123
|
-
return
|
|
1124
|
-
}
|
|
1125
|
-
this.result = JSON.parse(JSON.stringify(this.form))
|
|
1126
|
-
if (this.result.condition && (!this.result.condition.value || this.result.condition.value === '')) {
|
|
1127
|
-
delete this.result.condition
|
|
1128
|
-
}
|
|
1129
|
-
for (const item of this.result.column) {
|
|
1130
|
-
if (item.selectType === 'fixArray') {
|
|
1131
|
-
item.selectKey = JSON.parse(item.selectKey)
|
|
1132
|
-
}
|
|
1133
|
-
if (item.dataModeArray.length === 5) {
|
|
1134
|
-
delete item.dataModeArray
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
if (this.buttonStateData.length !== 4) {
|
|
1138
|
-
this.result.buttonState = this.buttonState
|
|
1139
|
-
}
|
|
1140
|
-
then()
|
|
1141
|
-
},
|
|
1142
|
-
view () {
|
|
1143
|
-
this.$refs.businessCreateForm.validate(valid => {
|
|
1144
|
-
if (valid) {
|
|
1145
|
-
this.viewHandle(() => {
|
|
1146
|
-
this.modelVisible = true
|
|
1147
|
-
})
|
|
1148
|
-
}
|
|
1149
|
-
})
|
|
1150
|
-
},
|
|
1151
|
-
submit () {
|
|
1152
|
-
this.onModelClose()
|
|
1153
|
-
this.$refs.businessCreateForm.validate(valid => {
|
|
1154
|
-
if (valid) {
|
|
1155
|
-
this.viewHandle(() => {
|
|
1156
|
-
// saveQueryParams
|
|
1157
|
-
this.$emit('saveQueryParams', this.result)
|
|
1158
|
-
})
|
|
1159
|
-
}
|
|
1160
|
-
})
|
|
1161
|
-
},
|
|
1162
|
-
modelCancel () {
|
|
1163
|
-
this.dataColumnVisible = false
|
|
1164
|
-
// 延迟是为了避免编辑数据窗口关闭时重置表单导致的闪烁
|
|
1165
|
-
setTimeout(() => {
|
|
1166
|
-
this.item = {
|
|
1167
|
-
key: '',
|
|
1168
|
-
title: '',
|
|
1169
|
-
slot: {},
|
|
1170
|
-
rule: {
|
|
1171
|
-
required: 'false'
|
|
1172
|
-
},
|
|
1173
|
-
dataModeArray: []
|
|
1174
|
-
}
|
|
1175
|
-
this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
1176
|
-
}, 100)
|
|
1177
|
-
},
|
|
1178
|
-
changeFormType (item) {
|
|
1179
|
-
if (item.formType === 'file' || item.formType === 'image') {
|
|
1180
|
-
this.dataModeArrayData = ['addOrEditForm', 'sqlQueryItem']
|
|
1181
|
-
}
|
|
1182
|
-
},
|
|
1183
|
-
changeSelectKey (item) {
|
|
1184
|
-
if (item.selectType === 'key' && item.selectKey) {
|
|
1185
|
-
item.slot.type = 'badge'
|
|
1186
|
-
item.slotKeyMap = item.selectKey
|
|
1187
|
-
}
|
|
1188
|
-
},
|
|
1189
|
-
visitAcceptFile () {
|
|
1190
|
-
window.open('https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input/file#attr-accept')
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
</script>
|
|
1195
|
-
<style lang="less" scoped>
|
|
1196
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<a-drawer
|
|
3
|
+
title="查询配置生成"
|
|
4
|
+
placement="right"
|
|
5
|
+
:width="isMobile ? screenWidth : screenWidth * 0.85"
|
|
6
|
+
:visible="visible"
|
|
7
|
+
@close="onClose"
|
|
8
|
+
>
|
|
9
|
+
<a-row :gutter="24">
|
|
10
|
+
<a-col :xl="14" :lg="12" :md="12" :sm="24" :xs="24">
|
|
11
|
+
<a-form-model
|
|
12
|
+
ref="businessCreateForm"
|
|
13
|
+
:rules="rules"
|
|
14
|
+
:model="form"
|
|
15
|
+
:label-col="labelCol"
|
|
16
|
+
:wrapper-col="wrapperCol"
|
|
17
|
+
>
|
|
18
|
+
<a-form-model-item label="查询主表名" prop="tableName">
|
|
19
|
+
<a-input v-model="form.tableName" placeholder="查询用的主表+别名,用空格隔开,如:t_userfiles u" />
|
|
20
|
+
</a-form-model-item>
|
|
21
|
+
<a-form-model-item label="预设关联表" prop="joinArray">
|
|
22
|
+
<a-popover title="说明" placement="right">
|
|
23
|
+
<template slot="content">
|
|
24
|
+
<p>配置你的查询中可能涉及到的所有关联表</p>
|
|
25
|
+
<p>比如你的查询中涉及到了t_userinfo表,就需要加入t_userinfo表的关联,和你写SQL的关联一样</p>
|
|
26
|
+
<p>请注意,你关联的<span style="color: #ff0000">除主表外的任何表</span>都需要配置</p>
|
|
27
|
+
<a-input-group compact style="width: 400px;">
|
|
28
|
+
<a-input style="width: 20%" placeholder="表别名" readOnly/>
|
|
29
|
+
<a-input style="width: 80%" placeholder="关联条件" readOnly/>
|
|
30
|
+
</a-input-group>
|
|
31
|
+
<a-input-group compact style="width: 400px;">
|
|
32
|
+
<a-input value="ui" style="width: 20%" placeholder="表别名" readOnly/>
|
|
33
|
+
<a-input value="t_userinfo ui on i.f_userinfo_id = ui.f_userinfo_id" style="width: 80%" placeholder="关联条件" readOnly/>
|
|
34
|
+
</a-input-group>
|
|
35
|
+
</template>
|
|
36
|
+
<a-button type="primary" @click="addJoinItem()">增加</a-button>
|
|
37
|
+
</a-popover>
|
|
38
|
+
<div v-for="(itemObj, index) in joinArray" :key="index">
|
|
39
|
+
<a-input-group compact>
|
|
40
|
+
<a-input @change="changeJoinArray()" v-model="itemObj.key" style="width: 20%;position: relative;bottom: 1px;" placeholder="表别名" />
|
|
41
|
+
<a-input @change="changeJoinArray()" v-model="itemObj.value" style="width: 80%" placeholder="关联条件">
|
|
42
|
+
<a-icon slot="addonAfter" type="close" @click="removeJoinItem(index)"/>
|
|
43
|
+
</a-input>
|
|
44
|
+
</a-input-group>
|
|
45
|
+
</div>
|
|
46
|
+
</a-form-model-item>
|
|
47
|
+
<a-form-model-item label="SQL查询表达式" prop="condition">
|
|
48
|
+
<a-input v-model="form.condition.value" placeholder="用作SQL查询的固定条件表达式,如:gb.f_meter_type='物联网表',可选" />
|
|
49
|
+
<template v-if="form.condition.value && Object.keys(form.joinArray).length > 0">
|
|
50
|
+
<a-alert message="提示:如果SQL查询表达式中用到了关联表,需要勾选用到的关联表别名" type="success" />
|
|
51
|
+
<a-checkbox-group v-model="form.condition.join" :options="conditionJoinArray"/>
|
|
52
|
+
</template>
|
|
53
|
+
</a-form-model-item>
|
|
54
|
+
<a-form-model-item label="排序方式" prop="orderBy">
|
|
55
|
+
<a-input v-model="form.orderBy" placeholder="排序字段,用别名+字段名+排序方式(可选)表示,如:u.id desc" />
|
|
56
|
+
</a-form-model-item>
|
|
57
|
+
<a-form-model-item label="数据字段" prop="column">
|
|
58
|
+
<a-button type="primary" @click="addColumnItem()">增加</a-button>
|
|
59
|
+
<div v-for="(columnItem, index) in form.column" :key="index">
|
|
60
|
+
<a-row :gutter="16">
|
|
61
|
+
<a-col :span="16">
|
|
62
|
+
<span style="font-weight: bold">{{ columnItem.title }}({{ columnItem.key }})</span>
|
|
63
|
+
</a-col>
|
|
64
|
+
<a-col v-if="index > 0 && form.column.length > 1" :span="2">
|
|
65
|
+
<a-icon type="up-square" @click="upColumnItem(columnItem.key,index)"/>
|
|
66
|
+
</a-col>
|
|
67
|
+
<a-col v-if="(index !== form.column.length - 1) && form.column.length > 1" :span="2">
|
|
68
|
+
<a-icon type="down-square" @click="downColumnItem(columnItem.key,index)"/>
|
|
69
|
+
</a-col>
|
|
70
|
+
<a-col :span="2">
|
|
71
|
+
<a-icon type="edit" @click="editColumnItem(columnItem.key,index)"/>
|
|
72
|
+
</a-col>
|
|
73
|
+
<a-col :span="2">
|
|
74
|
+
<a-icon type="close" @click="removeColumnItem(columnItem.key,index)"/>
|
|
75
|
+
</a-col>
|
|
76
|
+
</a-row>
|
|
77
|
+
</div>
|
|
78
|
+
</a-form-model-item>
|
|
79
|
+
<a-form-model-item label="操作按钮配置" prop="buttonState">
|
|
80
|
+
<a-checkbox-group v-model="buttonStateData" :options="buttonStateArray" />
|
|
81
|
+
</a-form-model-item>
|
|
82
|
+
</a-form-model>
|
|
83
|
+
<a-modal
|
|
84
|
+
title="数据字段配置"
|
|
85
|
+
:visible="dataColumnVisible"
|
|
86
|
+
:width="1000"
|
|
87
|
+
:zIndex="1001"
|
|
88
|
+
@cancel="modelCancel"
|
|
89
|
+
@ok="submitItem">
|
|
90
|
+
<a-form-model
|
|
91
|
+
ref="itemForm"
|
|
92
|
+
:rules="itemRules"
|
|
93
|
+
:model="item">
|
|
94
|
+
<a-row :gutter="16">
|
|
95
|
+
<a-col :span="8">
|
|
96
|
+
<a-form-model-item label="数据字段名" prop="key">
|
|
97
|
+
<a-input v-model="item.key" placeholder="请输入数据字段名" ref="key">
|
|
98
|
+
<a-popover slot="suffix" title="关于数据字段名" placement="bottom">
|
|
99
|
+
<template slot="content">
|
|
100
|
+
<p>设置数据字段的名称</p>
|
|
101
|
+
<p>用作SQL查询时必须遵守<span style="font-weight: bold">表别名.列名</span>的格式,如:i.id</p>
|
|
102
|
+
<p>其他情况下不限制</p>
|
|
103
|
+
</template>
|
|
104
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
105
|
+
</a-popover>
|
|
106
|
+
</a-input>
|
|
107
|
+
</a-form-model-item>
|
|
108
|
+
</a-col>
|
|
109
|
+
<a-col :span="8">
|
|
110
|
+
<a-form-model-item label="数据字段中文名" prop="title">
|
|
111
|
+
<a-input v-model="item.title" placeholder="请输入数据字段中文名,如:编号" />
|
|
112
|
+
</a-form-model-item>
|
|
113
|
+
</a-col>
|
|
114
|
+
</a-row>
|
|
115
|
+
<a-row :gutter="16">
|
|
116
|
+
<a-col :span="24">
|
|
117
|
+
<a-form-model-item label="数据模式" prop="dataMode">
|
|
118
|
+
<a-checkbox-group v-model="dataModeArrayData" :options="dataModeArray" />
|
|
119
|
+
</a-form-model-item>
|
|
120
|
+
</a-col>
|
|
121
|
+
</a-row>
|
|
122
|
+
<template v-if="dataMode.queryForm || dataMode.addOrEditForm">
|
|
123
|
+
<a-row :gutter="16">
|
|
124
|
+
<a-col :span="8">
|
|
125
|
+
<a-form-model-item label="表单类型" prop="formType">
|
|
126
|
+
<a-select v-model="item.formType" placeholder="表单类型,可选" @change="changeFormType(item)">
|
|
127
|
+
<a-select-option key="input">输入框</a-select-option>
|
|
128
|
+
<a-select-option key="select">选择框</a-select-option>
|
|
129
|
+
<a-select-option key="checkbox">多选框</a-select-option>
|
|
130
|
+
<a-select-option key="radio">单选框</a-select-option>
|
|
131
|
+
<a-select-option key="rangePicker">日期范围选择框</a-select-option>
|
|
132
|
+
<a-select-option key="monthPicker">月份选择框</a-select-option>
|
|
133
|
+
<a-select-option key="datePicker">单日选择框</a-select-option>
|
|
134
|
+
<!-- <a-select-option key="cascader">级联选择框(单个下拉)</a-select-option>-->
|
|
135
|
+
<a-select-option key="selects">级联选择框</a-select-option>
|
|
136
|
+
<a-select-option key="textarea">文本域</a-select-option>
|
|
137
|
+
<a-select-option key="file">文件上传</a-select-option>
|
|
138
|
+
<a-select-option key="image">图片上传</a-select-option>
|
|
139
|
+
<a-popover slot="suffixIcon" title="关于表单类型" placement="right">
|
|
140
|
+
<template slot="content">
|
|
141
|
+
<p>预览设置的表单类型</p>
|
|
142
|
+
<a-input-group compact style="width: 400px;">
|
|
143
|
+
<a-input value="输入框" style="width: 20%" readOnly/>
|
|
144
|
+
<a-input style="width: 80%" placeholder="请输入"/>
|
|
145
|
+
</a-input-group>
|
|
146
|
+
<br/>
|
|
147
|
+
<a-input-group compact style="width: 400px;">
|
|
148
|
+
<a-input value="选择框" style="width: 20%" readOnly/>
|
|
149
|
+
<a-select style="width: 80%" placeholder="请选择"/>
|
|
150
|
+
</a-input-group>
|
|
151
|
+
<br/>
|
|
152
|
+
<a-input-group compact style="width: 400px;">
|
|
153
|
+
<a-input value="多选框" style="width: 20%" readOnly/>
|
|
154
|
+
<a-checkbox-group style="margin-left: 10px;margin-top: 5px; width: 70%" :options="['数据1','数据2']"/>
|
|
155
|
+
</a-input-group>
|
|
156
|
+
<br/>
|
|
157
|
+
<a-input-group compact style="width: 400px;">
|
|
158
|
+
<a-input value="单选框" style="width: 20%" readOnly/>
|
|
159
|
+
<a-radio-group style="margin-left: 10px;margin-top: 5px; width: 70%" :options="[{label: '数据1', value: 'a'},{label: '数据2', value: 'b'}]" name="radioGroup" />
|
|
160
|
+
</a-input-group>
|
|
161
|
+
<br/>
|
|
162
|
+
<a-input-group compact style="width: 400px;">
|
|
163
|
+
<a-input value="日期范围选择框" style="width: 20%" readOnly/>
|
|
164
|
+
<a-range-picker style="width: 80%" :show-time="true" format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss" />
|
|
165
|
+
</a-input-group>
|
|
166
|
+
<br/>
|
|
167
|
+
<a-input-group compact style="width: 400px;">
|
|
168
|
+
<a-input value="月份选择框" style="width: 20%" readOnly/>
|
|
169
|
+
<a-month-picker style="width: 80%"/>
|
|
170
|
+
</a-input-group>
|
|
171
|
+
<br/>
|
|
172
|
+
<a-input-group compact style="width: 400px;">
|
|
173
|
+
<a-input value="单日选择框" style="width: 20%" readOnly/>
|
|
174
|
+
<a-date-picker style="width: 80%"/>
|
|
175
|
+
</a-input-group>
|
|
176
|
+
<br/>
|
|
177
|
+
<a-input-group compact style="width: 400px;">
|
|
178
|
+
<a-input value="级联选择框" style="width: 20%" readOnly/>
|
|
179
|
+
<a-cascader style="width: 80%" placeholder="请选择"/>
|
|
180
|
+
</a-input-group>
|
|
181
|
+
<br/>
|
|
182
|
+
<a-input-group compact style="width: 400px;">
|
|
183
|
+
<a-input value="文本域" style="width: 20%" readOnly/>
|
|
184
|
+
<a-textarea style="width: 80%" placeholder="请输入" :rows="1"/>
|
|
185
|
+
</a-input-group>
|
|
186
|
+
<br/>
|
|
187
|
+
<a-input-group compact style="width: 400px;">
|
|
188
|
+
<a-input value="文件上传" style="width: 20%" readOnly/>
|
|
189
|
+
<a-upload-dragger
|
|
190
|
+
name="file"
|
|
191
|
+
:multiple="true"
|
|
192
|
+
style="margin-left: 5px; width: 75%"
|
|
193
|
+
action="https://www.mocky.io/v2/5cc8019d300000980a055e76">
|
|
194
|
+
<p class="ant-upload-drag-icon">
|
|
195
|
+
<a-icon type="inbox" />
|
|
196
|
+
</p>
|
|
197
|
+
<p class="ant-upload-text">
|
|
198
|
+
点击或拖动文件到该区域上传
|
|
199
|
+
</p>
|
|
200
|
+
<p class="ant-upload-hint">
|
|
201
|
+
支持单个或多个文件
|
|
202
|
+
</p>
|
|
203
|
+
</a-upload-dragger>
|
|
204
|
+
</a-input-group>
|
|
205
|
+
<br/>
|
|
206
|
+
<a-input-group compact style="width: 400px;">
|
|
207
|
+
<a-input value="图片上传" style="width: 20%" readOnly/>
|
|
208
|
+
<a-upload style="margin-left: 5px; width: 75%" list-type="picture-card" :file-list="[]">
|
|
209
|
+
<a-icon type="plus" />
|
|
210
|
+
<div class="ant-upload-text">
|
|
211
|
+
Upload
|
|
212
|
+
</div>
|
|
213
|
+
</a-upload>
|
|
214
|
+
</a-input-group>
|
|
215
|
+
</template>
|
|
216
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
217
|
+
</a-popover>
|
|
218
|
+
</a-select>
|
|
219
|
+
</a-form-model-item>
|
|
220
|
+
</a-col>
|
|
221
|
+
<a-col :span="8">
|
|
222
|
+
<a-form-model-item
|
|
223
|
+
label="表单水印"
|
|
224
|
+
prop="placeholder"
|
|
225
|
+
v-if="item.formType !== 'checkbox' && item.formType !== 'radio' && item.formType !== 'file' && item.formType !== 'image'">
|
|
226
|
+
<a-input v-model="item.placeholder" placeholder="表单水印(placeholder),可选" />
|
|
227
|
+
</a-form-model-item>
|
|
228
|
+
</a-col>
|
|
229
|
+
<a-col :span="8">
|
|
230
|
+
<a-form-model-item label="表单查询方式" prop="queryType" v-if="dataMode.queryForm && dataMode.sqlQueryCondition">
|
|
231
|
+
<a-select v-model="item.queryType" placeholder="表单查询方式,可选">
|
|
232
|
+
<template v-for="queryTypeItem in queryTypeV">
|
|
233
|
+
<a-select-option :key="queryTypeItem.key">{{ queryTypeItem.label }}</a-select-option>
|
|
234
|
+
</template>
|
|
235
|
+
</a-select>
|
|
236
|
+
</a-form-model-item>
|
|
237
|
+
</a-col>
|
|
238
|
+
</a-row>
|
|
239
|
+
<a-row :gutter="16" v-if="item.formType === 'file' || item.formType === 'image'">
|
|
240
|
+
<a-col :span="8">
|
|
241
|
+
<a-form-model-item
|
|
242
|
+
label="允许上传文件数量"
|
|
243
|
+
prop="accept"
|
|
244
|
+
v-if="item.formType === 'file' || item.formType === 'image'">
|
|
245
|
+
<a-slider
|
|
246
|
+
v-model="item.acceptCount"
|
|
247
|
+
:min="1"
|
|
248
|
+
:max="20"
|
|
249
|
+
:marks="{ 1: '1', 3: '3', 5: '5', 10: '10', 15: '15', 20: '20'}"
|
|
250
|
+
:default-value="3"
|
|
251
|
+
/>
|
|
252
|
+
</a-form-model-item>
|
|
253
|
+
</a-col>
|
|
254
|
+
<a-col :span="8">
|
|
255
|
+
<a-form-model-item
|
|
256
|
+
label="文件上传模式"
|
|
257
|
+
prop="resUploadMode"
|
|
258
|
+
v-if="item.formType === 'file' || item.formType === 'image'">
|
|
259
|
+
<a-select v-model="item.resUploadMode" placeholder="文件上传模式,默认为服务器" @change="changeFormType(item)">
|
|
260
|
+
<a-select-option key="server">服务器</a-select-option>
|
|
261
|
+
<a-select-option key="oss">腾讯云对象存储</a-select-option>
|
|
262
|
+
<a-select-option key="base64" :disabled="item.formType === 'file'">Base64</a-select-option>
|
|
263
|
+
<a-popover slot="suffixIcon" title="关于资源上传模式" placement="right">
|
|
264
|
+
<template slot="content">
|
|
265
|
+
<p>指定文件上传到服务器,对象存储还是以base64方式存储</p>
|
|
266
|
+
<br/>
|
|
267
|
+
<p><span style="font-weight: bold">服务器:</span>文件上传到服务器,数据库需存储文件于服务器的路径</p>
|
|
268
|
+
<p><span style="font-weight: bold">对象存储:</span>文件上传到云对象存储,数据库需存储文件于对象存储的路径</p>
|
|
269
|
+
<p><span style="font-weight: bold">base64:</span>文件以base64字符串方式存入数据库中(仅图片上传表单支持)</p>
|
|
270
|
+
</template>
|
|
271
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
272
|
+
</a-popover>
|
|
273
|
+
</a-select>
|
|
274
|
+
</a-form-model-item>
|
|
275
|
+
</a-col>
|
|
276
|
+
<a-col :span="8">
|
|
277
|
+
<a-form-model-item
|
|
278
|
+
label="允许上传文件类型"
|
|
279
|
+
prop="accept"
|
|
280
|
+
v-if="item.formType === 'file'">
|
|
281
|
+
<a-input v-model="item.accept" placeholder="指定文件类型,默认不限制,可选">
|
|
282
|
+
<a-popover slot="suffix" title="关于允许上传文件类型" placement="bottom">
|
|
283
|
+
<template slot="content">
|
|
284
|
+
<p>指定允许上传的文件类型扩展名,如:.doc,.docx等,详情请参考<a target="_blank" @click="visitAcceptFile">允许上传文件类型</a></p>
|
|
285
|
+
</template>
|
|
286
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
287
|
+
</a-popover>
|
|
288
|
+
</a-input>
|
|
289
|
+
</a-form-model-item>
|
|
290
|
+
</a-col>
|
|
291
|
+
<!-- TODO 配置文件上传表单-所属模块 -->
|
|
292
|
+
<!-- TODO 配置文件上传表单-上传扩展目录Key -->
|
|
293
|
+
</a-row>
|
|
294
|
+
<a-row :gutter="16" v-if="item.formType === 'selects'">
|
|
295
|
+
<a-col :span="8">
|
|
296
|
+
<a-form-model-item label="是否根节点" prop="groupIndexView">
|
|
297
|
+
<a-radio-group defaultValue="None" v-model="item.groupIndexView" @change="groupIndexChange" default-value="false" button-style="solid">
|
|
298
|
+
<a-radio-button :value="1">
|
|
299
|
+
是
|
|
300
|
+
</a-radio-button>
|
|
301
|
+
<a-radio-button value="None">
|
|
302
|
+
否
|
|
303
|
+
</a-radio-button>
|
|
304
|
+
</a-radio-group>
|
|
305
|
+
</a-form-model-item>
|
|
306
|
+
</a-col>
|
|
307
|
+
<a-col :span="8" v-if="item.groupIndex !== 1">
|
|
308
|
+
<a-form-model-item label="数据所属节点" prop="groupIndex">
|
|
309
|
+
<a-select v-model="item.parent_title" placeholder="请选择父节点" ref="groupIndex" @change="parent_title_change">
|
|
310
|
+
<a-select-option v-for="item in parent_node" :key="item.key">{{ item.title }}</a-select-option>
|
|
311
|
+
<a-popover slot="suffixIcon" title="关于父节点" placement="bottom">
|
|
312
|
+
<template slot="content">
|
|
313
|
+
<p>多个下拉框为一组时,需要首先选择的为父节点</p>
|
|
314
|
+
</template>
|
|
315
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
316
|
+
</a-popover>
|
|
317
|
+
</a-select>
|
|
318
|
+
</a-form-model-item>
|
|
319
|
+
</a-col>
|
|
320
|
+
</a-row>
|
|
321
|
+
<a-row :gutter="16">
|
|
322
|
+
<a-col :span="8">
|
|
323
|
+
<a-form-model-item label="数据源类型" prop="selectType" v-if="item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == 1) || item.formType === 'cascader'">
|
|
324
|
+
<a-select v-model="item.selectType" placeholder="请选择数据源类型" @change="changeSelectKey(item)">
|
|
325
|
+
<a-select-option key="key">字典键</a-select-option>
|
|
326
|
+
<a-select-option key="fixArray">固定集合</a-select-option>
|
|
327
|
+
<a-select-option key="logic">业务逻辑</a-select-option>
|
|
328
|
+
<a-popover
|
|
329
|
+
slot="suffixIcon"
|
|
330
|
+
title="关于下拉框或级联框数据源类型"
|
|
331
|
+
placement="bottom">
|
|
332
|
+
<template slot="content">
|
|
333
|
+
<p>设置下拉框或级联框的数据源</p>
|
|
334
|
+
<p>数据源类型分为三种,你可以根据需要选择</p>
|
|
335
|
+
<p>字典键:选项从字典表(t_dictionary)获取,你只需要选择字典键的名称即可</p>
|
|
336
|
+
<p>业务逻辑名称:选项通过发起http请求调用指定的业务逻辑(Logic)接口获取</p>
|
|
337
|
+
<p>固定集合:选项为静态值,JSONArray格式</p>
|
|
338
|
+
<p>当表单类型为 " 级联选择框(多个下拉) " 是数据模式为 [{lable,value,children[{lable,value,children[]},{lable,value,children[]}]}] 形式</p>
|
|
339
|
+
<p>如:</p>
|
|
340
|
+
<json-viewer :value="DemoJson" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
|
|
341
|
+
</template>
|
|
342
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
343
|
+
</a-popover>
|
|
344
|
+
</a-select>
|
|
345
|
+
</a-form-model-item>
|
|
346
|
+
</a-col>
|
|
347
|
+
<a-col :span="8">
|
|
348
|
+
<a-form-model-item label="数据源" prop="selectKey" v-if="(item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == 1) || item.formType === 'cascader') && item.selectType">
|
|
349
|
+
<a-select
|
|
350
|
+
show-search
|
|
351
|
+
v-model="item.selectKey"
|
|
352
|
+
v-if="item.selectType === 'key'"
|
|
353
|
+
placeholder="请选择字典键"
|
|
354
|
+
:filter-option="filterOption"
|
|
355
|
+
@change="changeSelectKey(item)"
|
|
356
|
+
>
|
|
357
|
+
<template>
|
|
358
|
+
<a-select-option
|
|
359
|
+
v-for="(optionItem,index) in option"
|
|
360
|
+
:key="index"
|
|
361
|
+
:value="Object.keys(optionItem)[0]">{{ optionItem[Object.keys(optionItem)[0]] }}
|
|
362
|
+
</a-select-option>
|
|
363
|
+
</template>
|
|
364
|
+
</a-select>
|
|
365
|
+
<a-input v-model="item.selectKey" v-if="item.selectType === 'logic'" placeholder="请输入业务逻辑名称"/>
|
|
366
|
+
<a-textarea v-model="item.selectKey" v-if="item.selectType === 'fixArray'" placeholder="请录入数据源" />
|
|
367
|
+
</a-form-model-item>
|
|
368
|
+
</a-col>
|
|
369
|
+
<a-col :span="8">
|
|
370
|
+
<a-form-model-item label="数据外键字段名" prop="selectKeyName" v-if="item.formType === 'select'">
|
|
371
|
+
<a-input v-model="item.selectKeyName" placeholder="该列所在表在主表的外键名,可选">
|
|
372
|
+
<a-popover slot="suffix" title="关于数据外键字段名" placement="bottom">
|
|
373
|
+
<template slot="content">
|
|
374
|
+
<p>当该列所属表为主表的关联表,且存在主外键关联关系,你可以指定<span style="font-weight: bold">该列所在表在主表的外键名</span>,如:i.f_type_id</p>
|
|
375
|
+
<p>如果你的<a @click="$refs['key'].focus()">数据字段名</a>所属表为主表,或字段名已经是主表外键名时,不用设置该值</p>
|
|
376
|
+
<p>设置该参数是为了表单查询时可以通过外键id列而非具体值筛选数据</p>
|
|
377
|
+
<p>示例:</p>
|
|
378
|
+
<p>主表为t_userfiles表,别名为u,与t_gasbrand(气表品牌表)有关联关系,别名为g,数据字段名设置为g.f_gasbrand</p>
|
|
379
|
+
<p>如果指定了数据外键字段名,例如u.f_gasbrand_id,则使用数据外键字段名筛选数据,如果不指定该值,则使用<a @click="$refs['key'].focus()">数据字段名</a>筛选</p>
|
|
380
|
+
</template>
|
|
381
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
382
|
+
</a-popover>
|
|
383
|
+
</a-input>
|
|
384
|
+
</a-form-model-item>
|
|
385
|
+
</a-col>
|
|
386
|
+
</a-row>
|
|
387
|
+
<a-form-model-item label="数据源加载方式" prop="selectLoadType" v-if="item.formType === 'select' && item.selectType === 'logic'">
|
|
388
|
+
<a-row :guttor="16">
|
|
389
|
+
<a-col :span="8">
|
|
390
|
+
<a-radio-group v-model="item.lazyLoad" default-value="false" button-style="solid">
|
|
391
|
+
<a-radio-button value="true">
|
|
392
|
+
懒加载搜索
|
|
393
|
+
</a-radio-button>
|
|
394
|
+
<a-radio-button value="false">
|
|
395
|
+
一次性加载
|
|
396
|
+
</a-radio-button>
|
|
397
|
+
</a-radio-group>
|
|
398
|
+
</a-col>
|
|
399
|
+
</a-row>
|
|
400
|
+
</a-form-model-item>
|
|
401
|
+
<a-form-model-item label="表单校验类型" prop="rule">
|
|
402
|
+
<a-row :gutter="16">
|
|
403
|
+
<a-col :span="8" v-if="item.formType === 'input' || item.formType === 'textarea'">
|
|
404
|
+
<a-select v-model="item.rule.type" placeholder="校验类型,可选">
|
|
405
|
+
<a-select-option key="string">字符串</a-select-option>
|
|
406
|
+
<a-select-option key="number">数字</a-select-option>
|
|
407
|
+
<a-select-option key="boolean">布尔值</a-select-option>
|
|
408
|
+
<a-select-option key="regexp">正则表达式</a-select-option>
|
|
409
|
+
<a-select-option key="integer">整数</a-select-option>
|
|
410
|
+
<a-select-option key="float">小数</a-select-option>
|
|
411
|
+
<a-select-option key="array">数组或集合</a-select-option>
|
|
412
|
+
<a-select-option key="date">日期</a-select-option>
|
|
413
|
+
<a-select-option key="email">邮箱</a-select-option>
|
|
414
|
+
<a-popover slot="suffixIcon" title="关于表单校验类型" placement="bottom">
|
|
415
|
+
<template slot="content">
|
|
416
|
+
<p>设置表单项的校验类型,默认字符串类型</p>
|
|
417
|
+
<p>你也可以设置该表单项是否必填</p>
|
|
418
|
+
</template>
|
|
419
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
420
|
+
</a-popover>
|
|
421
|
+
</a-select>
|
|
422
|
+
</a-col>
|
|
423
|
+
<a-col :span="8">
|
|
424
|
+
<a-radio-group v-model="item.rule.required" default-value="false" button-style="solid">
|
|
425
|
+
<a-radio-button value="true">
|
|
426
|
+
必选项
|
|
427
|
+
</a-radio-button>
|
|
428
|
+
<a-radio-button value="false">
|
|
429
|
+
非必选项
|
|
430
|
+
</a-radio-button>
|
|
431
|
+
</a-radio-group>
|
|
432
|
+
</a-col>
|
|
433
|
+
</a-row>
|
|
434
|
+
</a-form-model-item>
|
|
435
|
+
<a-row :gutter="16" v-if="dataMode.addOrEditForm && dataMode.sqlQueryItem">
|
|
436
|
+
<a-col :span="8">
|
|
437
|
+
<a-form-model-item ref="addOrEdit" label="新增/修改场景选择" prop="addOrEdit">
|
|
438
|
+
<a-select v-model="item.addOrEdit" placeholder="请选择场景">
|
|
439
|
+
<a-select-option key="all">新增和修改</a-select-option>
|
|
440
|
+
<a-select-option key="add">仅支持新增</a-select-option>
|
|
441
|
+
<a-select-option key="edit">仅支持修改</a-select-option>
|
|
442
|
+
<a-select-option key="silenceAdd">静默新增(不生成表单)</a-select-option>
|
|
443
|
+
<a-popover
|
|
444
|
+
slot="suffixIcon"
|
|
445
|
+
title="关于新增/修改场景选择"
|
|
446
|
+
placement="bottom">
|
|
447
|
+
<template slot="content">
|
|
448
|
+
<p>设置表单项的新增/修改场景</p>
|
|
449
|
+
<p>静默新增类型用于非人为新增的数据,不会生成表单项,且必须设置字段用途</p>
|
|
450
|
+
</template>
|
|
451
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
452
|
+
</a-popover>
|
|
453
|
+
</a-select>
|
|
454
|
+
</a-form-model-item>
|
|
455
|
+
</a-col>
|
|
456
|
+
<a-col :span="8">
|
|
457
|
+
<a-form-model-item v-if="item.addOrEdit === 'silenceAdd'" ref="silencePurpose" label="字段用途" prop="silencePurpose">
|
|
458
|
+
<a-select v-model="item.silencePurpose" placeholder="请选择字段用途">
|
|
459
|
+
<a-select-option key="createTime">创建时间</a-select-option>
|
|
460
|
+
<a-select-option key="operator">创建/操作人</a-select-option>
|
|
461
|
+
<a-select-option key="orgId">组织机构ID</a-select-option>
|
|
462
|
+
<a-select-option key="customize">自定义</a-select-option>
|
|
463
|
+
<a-popover
|
|
464
|
+
slot="suffixIcon"
|
|
465
|
+
title="关于字段用途"
|
|
466
|
+
placement="bottom">
|
|
467
|
+
<template slot="content">
|
|
468
|
+
<p>用于静默新增时设置字段用途</p>
|
|
469
|
+
<p>在新增数据的表单提交时,页面会根据设置的字段用途获取相关数据并追加到表单中</p>
|
|
470
|
+
<p>当字段用途选择为<span style="font-weight: bold">自定义</span>时,必须指定一个业务逻辑(Logic)名称,表单提交前会将表单内容作为参数调用该Logic接口,并将Logic返回值作为表单值</p>
|
|
471
|
+
</template>
|
|
472
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
473
|
+
</a-popover>
|
|
474
|
+
</a-select>
|
|
475
|
+
</a-form-model-item>
|
|
476
|
+
</a-col>
|
|
477
|
+
<a-col :span="8">
|
|
478
|
+
<a-form-model-item v-if="item.silencePurpose === 'customize'" label="业务逻辑" prop="silenceSource">
|
|
479
|
+
<a-input v-model="item.silenceSource" placeholder="请输入业务逻辑名称"/>
|
|
480
|
+
</a-form-model-item>
|
|
481
|
+
</a-col>
|
|
482
|
+
</a-row>
|
|
483
|
+
</template>
|
|
484
|
+
<template v-if="dataMode.table">
|
|
485
|
+
<a-row :gutter="16">
|
|
486
|
+
<a-col :span="8">
|
|
487
|
+
<a-form-model-item label="作用域插槽" prop="slot">
|
|
488
|
+
<a-select v-model="item.slot.type" placeholder="插槽类型,可选">
|
|
489
|
+
<a-select-option key="default">不设置</a-select-option>
|
|
490
|
+
<a-select-option key="ellipsis">文本溢出省略</a-select-option>
|
|
491
|
+
<a-select-option key="badge">多彩徽标</a-select-option>
|
|
492
|
+
<a-select-option key="date">日期格式化</a-select-option>
|
|
493
|
+
<a-select-option key="dateTime">日期时间格式化</a-select-option>
|
|
494
|
+
<a-select-option key="action">操作列</a-select-option>
|
|
495
|
+
<a-popover slot="suffixIcon" title="关于作用域插槽" placement="bottom">
|
|
496
|
+
<template slot="content">
|
|
497
|
+
<p>你可以通过设置表格列的作用域插槽实现一些效果</p>
|
|
498
|
+
<p>如果没有指定,默认会设置为文本溢出省略(长度:16)</p>
|
|
499
|
+
<p>如果你选择文本溢出省略,需要设置文本溢出上限长度</p>
|
|
500
|
+
<p>如果你选择多彩徽标,需要设置徽标对应的数据样式字典键</p>
|
|
501
|
+
</template>
|
|
502
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
503
|
+
</a-popover>
|
|
504
|
+
</a-select>
|
|
505
|
+
</a-form-model-item>
|
|
506
|
+
</a-col>
|
|
507
|
+
<a-col :span="8">
|
|
508
|
+
<a-form-model-item label="表格列宽度" prop="width">
|
|
509
|
+
<a-popover
|
|
510
|
+
title="关于表格列宽度"
|
|
511
|
+
placement="bottom">
|
|
512
|
+
<template slot="content">
|
|
513
|
+
<p>当作用域插槽设置为文本溢出省略时,表格列宽度将自适应,计算方式为文本溢出上限长度 * 7 + 42</p>
|
|
514
|
+
<p>当作用域插槽设置为多彩徽标时,表格列宽度为固定为130</p>
|
|
515
|
+
<p>当作用域插槽设置为日期时间格式化时,表格列宽度为固定为160</p>
|
|
516
|
+
<p>当该列数据过长导致换行时,建议设置作用域插槽为文本溢出省略,或将表格列设置为固定宽度值</p>
|
|
517
|
+
</template>
|
|
518
|
+
<a-input-number style="width: 100%" v-model="item.width" placeholder="表格列宽度,可选"/>
|
|
519
|
+
</a-popover>
|
|
520
|
+
</a-form-model-item>
|
|
521
|
+
</a-col>
|
|
522
|
+
<a-col :span="8">
|
|
523
|
+
<a-form-model-item label="字段默认值" prop="default" v-if="dataMode.sqlQueryItem">
|
|
524
|
+
<a-input v-model="item.default" placeholder="当查询结果为null时,指定默认值,可选" />
|
|
525
|
+
</a-form-model-item>
|
|
526
|
+
</a-col>
|
|
527
|
+
</a-row>
|
|
528
|
+
<a-row :gutter="16">
|
|
529
|
+
<a-col :span="8">
|
|
530
|
+
<a-form-model-item label="文本溢出上限长度" prop="slotValue" v-if="item.slot.type === 'ellipsis'">
|
|
531
|
+
<a-input-number style="width: 100%" v-model="item.slotValue" placeholder="请输入文本溢出上限长度"/>
|
|
532
|
+
</a-form-model-item>
|
|
533
|
+
<a-form-model-item label="徽标字典键" prop="slotKeyMap" v-if="item.slot.type === 'badge'">
|
|
534
|
+
<a-input v-model="item.slotKeyMap" placeholder="请输入徽标字典键">
|
|
535
|
+
<a-popover
|
|
536
|
+
title="关于徽标字典键"
|
|
537
|
+
placement="bottom"
|
|
538
|
+
slot="suffix">
|
|
539
|
+
<template slot="content">
|
|
540
|
+
<p>如果你设置了表单类型为选择框,且数据源是字典键,该值会自动带出</p>
|
|
541
|
+
</template>
|
|
542
|
+
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
|
543
|
+
</a-popover>
|
|
544
|
+
</a-input>
|
|
545
|
+
</a-form-model-item>
|
|
546
|
+
<a-form-model-item label="操作列文本" prop="actionText" v-if="item.slot.type === 'action'">
|
|
547
|
+
<a-input v-model="item.actionText" placeholder="请输入操作列显示文本,默认为详情"/>
|
|
548
|
+
</a-form-model-item>
|
|
549
|
+
</a-col>
|
|
550
|
+
</a-row>
|
|
551
|
+
</template>
|
|
552
|
+
<a-alert style="margin-top: 5px" v-if="dataModeArrayData.length === 0" show-icon message="错误:请至少选择一种数据模式" type="error" />
|
|
553
|
+
<a-alert style="margin-top: 5px" v-if="dataMode.addOrEditForm && !dataMode.sqlQueryItem" show-icon message="错误:如果要生成新增/修改表单项,必须勾选生成SQL查询项" type="error" />
|
|
554
|
+
<a-alert style="margin-top: 5px" v-if="(item.formType === 'file' || item.formType === 'image') && !(!dataMode.table && !dataMode.sqlQueryCondition && !dataMode.queryForm)" show-icon message="错误:上传类表单的数据模式只能选择 生成新增/修改表单项 和 生成SQL查询项 " type="error" />
|
|
555
|
+
<a-alert style="margin-top: 5px" v-if="dataMode.queryForm && !dataMode.sqlQueryCondition" show-icon message="提示:您没有勾选生成SQL查询表达式,渲染的表单项不会生成SQL查询条件" type="info" />
|
|
556
|
+
<a-alert style="margin-top: 5px" v-if="dataMode.table && !dataMode.sqlQueryItem" show-icon message="提示:您没有勾选生成SQL查询项,渲染的表格列不会绑定SQL结果集数据" type="info" />
|
|
557
|
+
</a-form-model>
|
|
558
|
+
</a-modal>
|
|
559
|
+
<a-button type="primary" @click="view">操作</a-button>
|
|
560
|
+
</a-col>
|
|
561
|
+
<a-col :xl="10" :lg="12" :md="12" :sm="24" :xs="24">
|
|
562
|
+
<a-card :bordered="false" title="预览" size="small" style="overflow: auto">
|
|
563
|
+
<json-viewer :copyable="{copyText: '复制', copiedText: '已复制'}" :value="result" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
|
|
564
|
+
</a-card>
|
|
565
|
+
</a-col>
|
|
566
|
+
</a-row>
|
|
567
|
+
<a-modal
|
|
568
|
+
title="效果预览"
|
|
569
|
+
:width="isMobile ? screenWidth : screenWidth * 0.8"
|
|
570
|
+
:centered="true"
|
|
571
|
+
:visible="modelVisible"
|
|
572
|
+
:zIndex="1001"
|
|
573
|
+
@cancel="onModelClose"
|
|
574
|
+
:destroyOnClose="true">
|
|
575
|
+
<template slot="footer">
|
|
576
|
+
<a-button key="close" @click="onModelClose">
|
|
577
|
+
返回
|
|
578
|
+
</a-button>
|
|
579
|
+
<a-button key="submit" type="primary" @click="submit">
|
|
580
|
+
保存
|
|
581
|
+
</a-button>
|
|
582
|
+
</template>
|
|
583
|
+
<x-form-table
|
|
584
|
+
:view-mode="true"
|
|
585
|
+
:queryParamsJson="result">
|
|
586
|
+
</x-form-table>
|
|
587
|
+
</a-modal>
|
|
588
|
+
</a-drawer>
|
|
589
|
+
</template>
|
|
590
|
+
|
|
591
|
+
<script>
|
|
592
|
+
import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormItem'
|
|
593
|
+
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
|
|
594
|
+
import JsonViewer from 'vue-json-viewer'
|
|
595
|
+
import FileSaver from 'file-saver'
|
|
596
|
+
import { queryType } from '@/config/CreateQueryConfig'
|
|
597
|
+
import { mapState } from 'vuex'
|
|
598
|
+
import { post } from '@vue2-client/services/api/restTools'
|
|
599
|
+
import { commonApi } from '@vue2-client/services/api/common'
|
|
600
|
+
const DemoJson = [{ value: 'zhejiang', label: 'Zhejiang', children: [{ value: 'hangzhou', label: 'Hangzhou', children: [{ value: 'xihu', label: 'West Lake' }] }] }]
|
|
601
|
+
export default {
|
|
602
|
+
name: 'CreateQuery',
|
|
603
|
+
components: {
|
|
604
|
+
JsonViewer,
|
|
605
|
+
XFormTable,
|
|
606
|
+
XFormItem
|
|
607
|
+
},
|
|
608
|
+
data () {
|
|
609
|
+
return {
|
|
610
|
+
DemoJson,
|
|
611
|
+
// 页面宽度
|
|
612
|
+
screenWidth: document.documentElement.clientWidth,
|
|
613
|
+
// 效果预览模态框是否展示
|
|
614
|
+
modelVisible: false,
|
|
615
|
+
// 数据列配置模态框是否展示
|
|
616
|
+
dataColumnVisible: false,
|
|
617
|
+
// 数据列操作类型:新增,修改
|
|
618
|
+
type: '新增',
|
|
619
|
+
// 数据模式类型集合
|
|
620
|
+
dataModeArray: [
|
|
621
|
+
{ label: '生成查询表单项', value: 'queryForm' },
|
|
622
|
+
{ label: '生成表格列', value: 'table' },
|
|
623
|
+
{ label: '生成新增/修改表单项', value: 'addOrEditForm' },
|
|
624
|
+
{ label: '生成SQL查询项', value: 'sqlQueryItem' },
|
|
625
|
+
{ label: '生成SQL查询表达式', value: 'sqlQueryCondition' }
|
|
626
|
+
],
|
|
627
|
+
// 操作按钮状态集合
|
|
628
|
+
buttonStateArray: [
|
|
629
|
+
{ label: '新增', value: 'add' },
|
|
630
|
+
{ label: '修改', value: 'edit' },
|
|
631
|
+
{ label: '删除', value: 'delete' },
|
|
632
|
+
{ label: '导出', value: 'export' }
|
|
633
|
+
],
|
|
634
|
+
// 数据模式类型集合值
|
|
635
|
+
dataModeArrayData: ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition'],
|
|
636
|
+
// 操作按钮状态集合值
|
|
637
|
+
buttonStateData: ['add', 'edit', 'delete', 'export'],
|
|
638
|
+
labelCol: { span: 4 },
|
|
639
|
+
wrapperCol: { span: 14 },
|
|
640
|
+
form: {
|
|
641
|
+
tableName: '',
|
|
642
|
+
joinArray: {},
|
|
643
|
+
condition: {},
|
|
644
|
+
orderBy: '',
|
|
645
|
+
column: []
|
|
646
|
+
},
|
|
647
|
+
result: {},
|
|
648
|
+
item: {
|
|
649
|
+
key: '',
|
|
650
|
+
title: '',
|
|
651
|
+
slot: {},
|
|
652
|
+
rule: {
|
|
653
|
+
required: 'false'
|
|
654
|
+
},
|
|
655
|
+
dataModeArray: []
|
|
656
|
+
},
|
|
657
|
+
itemMap: {},
|
|
658
|
+
selectIndex: null,
|
|
659
|
+
selectType: undefined,
|
|
660
|
+
joinArray: [],
|
|
661
|
+
rules: {
|
|
662
|
+
tableName: [{ required: true, message: '请输入查询表名', trigger: 'blur' }],
|
|
663
|
+
orderBy: [{ required: true, message: '请输入排序方式', trigger: 'blur' }]
|
|
664
|
+
},
|
|
665
|
+
itemRules: {
|
|
666
|
+
key: [{ required: true, message: '请输入数据列名', trigger: 'blur' }],
|
|
667
|
+
title: [{ required: true, message: '请输入中文名称', trigger: 'blur' }],
|
|
668
|
+
selectType: [{ required: true, message: '请选择数据源类型', trigger: 'change' }],
|
|
669
|
+
selectKey: [{ required: true, message: '请输入数据源内容', trigger: 'blur' }],
|
|
670
|
+
slotValue: [{ required: true, message: '请输入文本溢出上限长度', trigger: 'blur' }],
|
|
671
|
+
slotKeyMap: [{ required: true, message: '请输入徽标字典键', trigger: 'blur' }],
|
|
672
|
+
silencePurpose: [{ required: true, message: '请选择字段用途', trigger: 'change' }],
|
|
673
|
+
silenceSource: [{ required: true, message: '请输入业务逻辑名称', trigger: 'blur' }],
|
|
674
|
+
group: [{ required: true, message: '请选择父节点', trigger: 'blur' }],
|
|
675
|
+
groupIndex: [{ required: true, message: '如果不是根节点请选择自己的父节点', trigger: 'blur' }]
|
|
676
|
+
|
|
677
|
+
},
|
|
678
|
+
// 字典键集合
|
|
679
|
+
option: []
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
mounted () {
|
|
683
|
+
this.initView()
|
|
684
|
+
},
|
|
685
|
+
computed: {
|
|
686
|
+
...mapState('setting', ['isMobile']),
|
|
687
|
+
parent_node () {
|
|
688
|
+
return this.form.column.filter(item => item.formType === 'selects' && item.key != this.item.key)
|
|
689
|
+
},
|
|
690
|
+
queryTypeV () {
|
|
691
|
+
if (this.item.formType) {
|
|
692
|
+
return queryType.filter(item => item.match.includes(this.item.formType))
|
|
693
|
+
}
|
|
694
|
+
return queryType
|
|
695
|
+
},
|
|
696
|
+
conditionJoinArray: function () {
|
|
697
|
+
const result = []
|
|
698
|
+
for (const item in this.form.joinArray) {
|
|
699
|
+
if (item !== '') {
|
|
700
|
+
result.push({
|
|
701
|
+
label: item,
|
|
702
|
+
value: item
|
|
703
|
+
})
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
if (result.length === 0) {
|
|
707
|
+
result.push({
|
|
708
|
+
label: '-',
|
|
709
|
+
value: '-'
|
|
710
|
+
})
|
|
711
|
+
}
|
|
712
|
+
return result
|
|
713
|
+
},
|
|
714
|
+
dataMode: function () {
|
|
715
|
+
const result = {
|
|
716
|
+
queryForm: false,
|
|
717
|
+
table: false,
|
|
718
|
+
addOrEditForm: false,
|
|
719
|
+
sqlQueryItem: false,
|
|
720
|
+
sqlQueryCondition: false
|
|
721
|
+
}
|
|
722
|
+
for (const item of this.dataModeArrayData) {
|
|
723
|
+
result[item] = true
|
|
724
|
+
}
|
|
725
|
+
return result
|
|
726
|
+
},
|
|
727
|
+
buttonState: function () {
|
|
728
|
+
const result = {
|
|
729
|
+
add: false,
|
|
730
|
+
edit: false,
|
|
731
|
+
delete: false,
|
|
732
|
+
export: false
|
|
733
|
+
}
|
|
734
|
+
for (const item of this.buttonStateData) {
|
|
735
|
+
result[item] = true
|
|
736
|
+
}
|
|
737
|
+
return result
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
props: {
|
|
741
|
+
visible: {
|
|
742
|
+
type: Boolean,
|
|
743
|
+
default: false
|
|
744
|
+
},
|
|
745
|
+
toEditJson: {
|
|
746
|
+
type: Object,
|
|
747
|
+
default: () => {}
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
watch: {
|
|
751
|
+
visible (rel) {
|
|
752
|
+
if (rel) {
|
|
753
|
+
this.initView()
|
|
754
|
+
}
|
|
755
|
+
if (rel && this.toEditJson) {
|
|
756
|
+
// 处理预设关联表
|
|
757
|
+
if (this.joinArray.length === 0) {
|
|
758
|
+
for (const key in this.toEditJson.joinArray) {
|
|
759
|
+
this.joinArray.push({
|
|
760
|
+
key: key,
|
|
761
|
+
value: this.toEditJson.joinArray[key]
|
|
762
|
+
})
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
// 处理具体表单项
|
|
766
|
+
this.form = Object.assign(
|
|
767
|
+
{
|
|
768
|
+
tableName: '',
|
|
769
|
+
joinArray: {},
|
|
770
|
+
condition: {},
|
|
771
|
+
orderBy: '',
|
|
772
|
+
column: []
|
|
773
|
+
}, this.toEditJson
|
|
774
|
+
)
|
|
775
|
+
for (const columnItem of this.form.column) {
|
|
776
|
+
// 数据模式兼容性处理
|
|
777
|
+
if (!(columnItem.dataMode || columnItem.dataModeArray)) {
|
|
778
|
+
columnItem.dataModeArray = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
779
|
+
} else if (columnItem.dataMode) {
|
|
780
|
+
if (columnItem.dataMode === 'all') {
|
|
781
|
+
columnItem.dataModeArray = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
782
|
+
} else if (columnItem.dataMode === 'form') {
|
|
783
|
+
columnItem.dataModeArray = ['queryForm', 'addOrEditForm', 'sqlQueryCondition']
|
|
784
|
+
} else if (columnItem.dataMode === 'table') {
|
|
785
|
+
columnItem.dataModeArray = ['table', 'sqlQueryItem']
|
|
786
|
+
} else if (columnItem.dataMode === 'table_form') {
|
|
787
|
+
columnItem.dataModeArray = ['table', 'sqlQueryItem', 'sqlQueryCondition']
|
|
788
|
+
} else if (columnItem.dataMode === 'only_form') {
|
|
789
|
+
columnItem.dataModeArray = ['queryForm']
|
|
790
|
+
} else if (columnItem.dataMode === 'only_table') {
|
|
791
|
+
columnItem.dataModeArray = ['table']
|
|
792
|
+
} else if (columnItem.dataMode === 'clear') {
|
|
793
|
+
columnItem.dataModeArray = ['sqlQueryItem', 'sqlQueryCondition']
|
|
794
|
+
} else if (columnItem.dataMode === 'only_add_modify') {
|
|
795
|
+
columnItem.dataModeArray = ['addOrEditForm', 'sqlQueryItem']
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
delete columnItem.dataMode
|
|
799
|
+
// 插槽兼容处理
|
|
800
|
+
if (columnItem.slot) {
|
|
801
|
+
if (columnItem.slot.value && columnItem.slot.type === 'ellipsis') {
|
|
802
|
+
columnItem.slotValue = columnItem.slot.value
|
|
803
|
+
} else if (columnItem.slot.keyMap && columnItem.slot.type === 'badge') {
|
|
804
|
+
columnItem.slotKeyMap = columnItem.slot.keyMap
|
|
805
|
+
} else if (columnItem.slot.actionText && columnItem.slot.type === 'action') {
|
|
806
|
+
columnItem.actionText = columnItem.slot.actionText
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
// 必选项兼容处理
|
|
810
|
+
if (columnItem.rule && !isNaN(columnItem.rule.required)) {
|
|
811
|
+
columnItem.rule.required = columnItem.rule.required.toString()
|
|
812
|
+
} else {
|
|
813
|
+
if (!columnItem.rule) {
|
|
814
|
+
columnItem.rule = {}
|
|
815
|
+
}
|
|
816
|
+
columnItem.rule.required = 'false'
|
|
817
|
+
}
|
|
818
|
+
// 下拉框数据源兼容处理
|
|
819
|
+
if ((columnItem.formType === 'select' || columnItem.formType === 'cascader') && columnItem.selectKey) {
|
|
820
|
+
// 数据源为logic
|
|
821
|
+
if (columnItem.selectKey.toString().startsWith('logic@')) {
|
|
822
|
+
columnItem.selectType = 'logic'
|
|
823
|
+
} else if (columnItem.selectKey instanceof Array || this.isJSON(columnItem.selectKey)) {
|
|
824
|
+
// 数据源为固定json集合
|
|
825
|
+
if (columnItem.selectKey instanceof Array) {
|
|
826
|
+
columnItem.selectKey = JSON.stringify(columnItem.selectKey)
|
|
827
|
+
}
|
|
828
|
+
columnItem.selectType = 'fixArray'
|
|
829
|
+
} else {
|
|
830
|
+
columnItem.selectType = 'key'
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
this.itemMap[columnItem.key] = Object.assign({
|
|
834
|
+
key: '',
|
|
835
|
+
title: '',
|
|
836
|
+
slot: {},
|
|
837
|
+
rule: {
|
|
838
|
+
required: 'false'
|
|
839
|
+
},
|
|
840
|
+
dataModeArray: []
|
|
841
|
+
}, columnItem)
|
|
842
|
+
}
|
|
843
|
+
// 处理操作按钮配置
|
|
844
|
+
if (this.toEditJson.buttonState) {
|
|
845
|
+
this.buttonStateData = []
|
|
846
|
+
for (const buttonStateKey of Object.keys(this.toEditJson.buttonState)) {
|
|
847
|
+
if (this.toEditJson.buttonState[buttonStateKey]) {
|
|
848
|
+
this.buttonStateData.push(buttonStateKey)
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
} else {
|
|
852
|
+
this.buttonStateData = ['add', 'edit', 'delete', 'export']
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
},
|
|
857
|
+
methods: {
|
|
858
|
+
parent_title_change (parentKey) {
|
|
859
|
+
const parentArr = this.form.column.filter(item => item.formType === 'selects' && item.key === parentKey)
|
|
860
|
+
if (parentArr.length === 1) {
|
|
861
|
+
this.item.groupIndex = parentArr[0].groupIndex + 1
|
|
862
|
+
this.item.group = parentArr[0].group
|
|
863
|
+
this.item.parent_title = parentArr[0].title
|
|
864
|
+
} else {
|
|
865
|
+
this.$message.error('数据字段中有字段别名相同,请检查!')
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
groupIndexChange ({ target }) {
|
|
869
|
+
if (target.value === 1) {
|
|
870
|
+
this.item.groupIndex = 1
|
|
871
|
+
if (this.item.title) {
|
|
872
|
+
this.item.group = this.item.title + '组'
|
|
873
|
+
} else {
|
|
874
|
+
this.item.groupIndex = ''
|
|
875
|
+
this.$message.error('请先输入字段中文名称!')
|
|
876
|
+
}
|
|
877
|
+
} else {
|
|
878
|
+
this.item.groupIndex = ''
|
|
879
|
+
}
|
|
880
|
+
},
|
|
881
|
+
// 初始化组件
|
|
882
|
+
initView () {
|
|
883
|
+
this.joinArray = []
|
|
884
|
+
this.result = {}
|
|
885
|
+
post(commonApi.getDictionaryParam, {}).then(res => {
|
|
886
|
+
this.option = res
|
|
887
|
+
})
|
|
888
|
+
},
|
|
889
|
+
onClose () {
|
|
890
|
+
this.$emit('update:visible', false)
|
|
891
|
+
},
|
|
892
|
+
filterOption (input, option) {
|
|
893
|
+
return (
|
|
894
|
+
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
895
|
+
)
|
|
896
|
+
},
|
|
897
|
+
onModelClose () {
|
|
898
|
+
this.modelVisible = false
|
|
899
|
+
},
|
|
900
|
+
addJoinItem () {
|
|
901
|
+
this.joinArray.push({
|
|
902
|
+
key: '',
|
|
903
|
+
value: ''
|
|
904
|
+
})
|
|
905
|
+
this.changeJoinArray()
|
|
906
|
+
},
|
|
907
|
+
removeJoinItem (index) {
|
|
908
|
+
this.joinArray.splice(index, 1)
|
|
909
|
+
this.changeJoinArray()
|
|
910
|
+
},
|
|
911
|
+
addColumnItem () {
|
|
912
|
+
this.type = '新增'
|
|
913
|
+
this.dataColumnVisible = true
|
|
914
|
+
},
|
|
915
|
+
editColumnItem (key, index) {
|
|
916
|
+
if (this.itemMap[key]) {
|
|
917
|
+
this.type = '修改'
|
|
918
|
+
this.item = this.itemMap[key]
|
|
919
|
+
if (this.item.formType === 'selects') {
|
|
920
|
+
// 因为 groupIndex 可能有很多值 单选框不行 赋给一个新的变量
|
|
921
|
+
this.item.groupIndexView = this.item.groupIndex === 1 ? 1 : 'None'
|
|
922
|
+
}
|
|
923
|
+
this.dataModeArrayData = this.item.dataModeArray
|
|
924
|
+
this.selectIndex = index
|
|
925
|
+
this.dataColumnVisible = true
|
|
926
|
+
} else {
|
|
927
|
+
this.$message.warn('编辑失败')
|
|
928
|
+
}
|
|
929
|
+
},
|
|
930
|
+
removeColumnItem (key, index) {
|
|
931
|
+
const _this = this
|
|
932
|
+
this.$confirm({
|
|
933
|
+
title: '您确定要删除该数据项?',
|
|
934
|
+
content: '删除的数据项无法恢复',
|
|
935
|
+
okText: '确定',
|
|
936
|
+
okType: 'danger',
|
|
937
|
+
cancelText: '取消',
|
|
938
|
+
onOk () {
|
|
939
|
+
delete _this.itemMap[key]
|
|
940
|
+
_this.form.column.splice(index, 1)
|
|
941
|
+
}
|
|
942
|
+
})
|
|
943
|
+
},
|
|
944
|
+
upColumnItem (key, index) {
|
|
945
|
+
const newIndex = index - 1
|
|
946
|
+
const itemA = this.form.column[newIndex]
|
|
947
|
+
const itemB = this.form.column[index]
|
|
948
|
+
this.form.column.splice(index, 1, itemA)
|
|
949
|
+
this.form.column.splice(newIndex, 1, itemB)
|
|
950
|
+
},
|
|
951
|
+
downColumnItem (key, index) {
|
|
952
|
+
const newIndex = index + 1
|
|
953
|
+
const itemA = this.form.column[newIndex]
|
|
954
|
+
const itemB = this.form.column[index]
|
|
955
|
+
this.form.column.splice(index, 1, itemA)
|
|
956
|
+
this.form.column.splice(newIndex, 1, itemB)
|
|
957
|
+
},
|
|
958
|
+
changeJoinArray () {
|
|
959
|
+
const joinArrayObject = {}
|
|
960
|
+
for (const item of this.joinArray) {
|
|
961
|
+
joinArrayObject[item.key] = item.value
|
|
962
|
+
}
|
|
963
|
+
this.form.joinArray = joinArrayObject
|
|
964
|
+
},
|
|
965
|
+
submitItem () {
|
|
966
|
+
this.$refs.itemForm.validate(valid => {
|
|
967
|
+
if (valid) {
|
|
968
|
+
if (this.dataModeArrayData.length === 0) {
|
|
969
|
+
this.$message.error('请至少选择一种数据模式')
|
|
970
|
+
return
|
|
971
|
+
}
|
|
972
|
+
if (this.dataMode.addOrEditForm && !this.dataMode.sqlQueryItem) {
|
|
973
|
+
this.$message.error('如果要生成新增/修改表单项,必须勾选生成SQL查询项')
|
|
974
|
+
return
|
|
975
|
+
}
|
|
976
|
+
if ((this.item.formType === 'file' || this.item.formType === 'image') && !(!this.dataMode.table && !this.dataMode.sqlQueryCondition && !this.dataMode.queryForm)) {
|
|
977
|
+
this.$message.error('上传类表单的数据模式只能选择 生成新增/修改表单项 和 生成SQL查询项')
|
|
978
|
+
return
|
|
979
|
+
}
|
|
980
|
+
this.itemHandle()
|
|
981
|
+
}
|
|
982
|
+
})
|
|
983
|
+
},
|
|
984
|
+
itemHandle () {
|
|
985
|
+
const str = JSON.stringify(this.item)
|
|
986
|
+
const item = JSON.parse(str)
|
|
987
|
+
this.itemMap[item.key] = JSON.parse(str)
|
|
988
|
+
this.itemMap[item.key].dataModeArray = this.dataModeArrayData
|
|
989
|
+
// 查询表单项或者新增/修改表单项
|
|
990
|
+
if (this.dataMode.queryForm || this.dataMode.addOrEditForm) {
|
|
991
|
+
if (!this.dataMode.sqlQueryItem || !this.dataMode.addOrEditForm) {
|
|
992
|
+
delete item.addOrEdit
|
|
993
|
+
delete item.silencePurpose
|
|
994
|
+
delete item.silenceSource
|
|
995
|
+
}
|
|
996
|
+
// 不生成SQL查询表达式,或者表单查询类型为=
|
|
997
|
+
if (!this.dataMode.sqlQueryCondition || (item.queryType && item.queryType === '=')) {
|
|
998
|
+
delete item.queryType
|
|
999
|
+
}
|
|
1000
|
+
// 表单类型为输入框
|
|
1001
|
+
if (item.formType && item.formType === 'input') {
|
|
1002
|
+
delete item.formType
|
|
1003
|
+
}
|
|
1004
|
+
// 校验类型
|
|
1005
|
+
if (item.rule.required) {
|
|
1006
|
+
item.rule.required = item.rule.required.toString() === 'true'
|
|
1007
|
+
} else {
|
|
1008
|
+
item.rule.required = false
|
|
1009
|
+
}
|
|
1010
|
+
// 下拉框
|
|
1011
|
+
if ((item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == '1') || item.formType === 'cascader') && item.selectKey) {
|
|
1012
|
+
// 数据源为logic
|
|
1013
|
+
if (item.selectType === 'logic') {
|
|
1014
|
+
// 如果已经有了 logic@ 将不再拼接
|
|
1015
|
+
if (item.selectKey.substring(0, 6) !== 'logic@') {
|
|
1016
|
+
item.selectKey = 'logic@' + item.selectKey
|
|
1017
|
+
}
|
|
1018
|
+
} else if (item.selectType === 'fixArray') {
|
|
1019
|
+
// 数据源为固定json集合
|
|
1020
|
+
if (!this.isJSON(item.selectKey)) {
|
|
1021
|
+
this.$message.warning('下拉框数据源不是JSON集合')
|
|
1022
|
+
return
|
|
1023
|
+
}
|
|
1024
|
+
delete item.lazyLoad
|
|
1025
|
+
} else {
|
|
1026
|
+
delete item.lazyLoad
|
|
1027
|
+
}
|
|
1028
|
+
if (item.formType !== 'selects') {
|
|
1029
|
+
delete item.selectType
|
|
1030
|
+
}
|
|
1031
|
+
} else {
|
|
1032
|
+
if (item.formType !== 'selects') {
|
|
1033
|
+
delete item.group
|
|
1034
|
+
delete item.groupIndex
|
|
1035
|
+
}
|
|
1036
|
+
delete item.selectType
|
|
1037
|
+
delete item.selectKey
|
|
1038
|
+
delete item.selectKeyName
|
|
1039
|
+
delete item.lazyLoad
|
|
1040
|
+
}
|
|
1041
|
+
} else {
|
|
1042
|
+
delete item.queryType
|
|
1043
|
+
delete item.formType
|
|
1044
|
+
delete item.addOrEdit
|
|
1045
|
+
delete item.silencePurpose
|
|
1046
|
+
delete item.silenceSource
|
|
1047
|
+
delete item.placeholder
|
|
1048
|
+
delete item.rule
|
|
1049
|
+
delete item.selectType
|
|
1050
|
+
delete item.selectKey
|
|
1051
|
+
delete item.selectKeyName
|
|
1052
|
+
delete item.lazyLoad
|
|
1053
|
+
}
|
|
1054
|
+
// 表格列
|
|
1055
|
+
if (this.dataMode.table) {
|
|
1056
|
+
if (item.slot.type && item.slot.type !== 'default') {
|
|
1057
|
+
if (item.slotValue && item.slot.type === 'ellipsis') {
|
|
1058
|
+
item.slot.value = item.slotValue
|
|
1059
|
+
} else if (item.slotKeyMap && item.slot.type === 'badge') {
|
|
1060
|
+
item.slot.keyMap = item.slotKeyMap
|
|
1061
|
+
} else if (item.actionText && item.slot.type === 'action') {
|
|
1062
|
+
item.slot.actionText = item.actionText
|
|
1063
|
+
}
|
|
1064
|
+
} else {
|
|
1065
|
+
delete item.slot
|
|
1066
|
+
}
|
|
1067
|
+
if (!item.width) {
|
|
1068
|
+
delete item.width
|
|
1069
|
+
}
|
|
1070
|
+
delete item.slotValue
|
|
1071
|
+
delete item.slotKeyMap
|
|
1072
|
+
delete item.actionText
|
|
1073
|
+
} else {
|
|
1074
|
+
delete item.slot
|
|
1075
|
+
delete item.slotValue
|
|
1076
|
+
delete item.slotKeyMap
|
|
1077
|
+
delete item.actionText
|
|
1078
|
+
delete item.width
|
|
1079
|
+
}
|
|
1080
|
+
// SQL查询项
|
|
1081
|
+
if (!this.dataMode.sqlQueryItem) {
|
|
1082
|
+
delete item.default
|
|
1083
|
+
}
|
|
1084
|
+
item.dataModeArray = this.dataModeArrayData
|
|
1085
|
+
if (this.type === '新增') {
|
|
1086
|
+
this.form.column.push(item)
|
|
1087
|
+
} else {
|
|
1088
|
+
this.form.column[this.selectIndex] = item
|
|
1089
|
+
}
|
|
1090
|
+
this.item = {
|
|
1091
|
+
key: '',
|
|
1092
|
+
title: '',
|
|
1093
|
+
slot: {},
|
|
1094
|
+
rule: {
|
|
1095
|
+
required: 'false'
|
|
1096
|
+
},
|
|
1097
|
+
dataModeArray: []
|
|
1098
|
+
}
|
|
1099
|
+
this.$message.success('增加成功')
|
|
1100
|
+
this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
1101
|
+
this.dataColumnVisible = false
|
|
1102
|
+
},
|
|
1103
|
+
// 判断是否为json字符串
|
|
1104
|
+
isJSON (str) {
|
|
1105
|
+
if (typeof str == 'string') {
|
|
1106
|
+
try {
|
|
1107
|
+
const obj = JSON.parse(str)
|
|
1108
|
+
return !!(typeof obj == 'object' && obj)
|
|
1109
|
+
} catch (e) {
|
|
1110
|
+
return false
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
exportJson () {
|
|
1115
|
+
const data = JSON.stringify(this.form, null, 2)
|
|
1116
|
+
const blob = new Blob([data], { type: 'application/json' })
|
|
1117
|
+
FileSaver.saveAs(blob, `Query.json`)
|
|
1118
|
+
this.$message.success('导出成功!')
|
|
1119
|
+
},
|
|
1120
|
+
viewHandle (then) {
|
|
1121
|
+
if (this.form.column.length === 0) {
|
|
1122
|
+
this.$message.error('你没有增加任何数据字段')
|
|
1123
|
+
return
|
|
1124
|
+
}
|
|
1125
|
+
this.result = JSON.parse(JSON.stringify(this.form))
|
|
1126
|
+
if (this.result.condition && (!this.result.condition.value || this.result.condition.value === '')) {
|
|
1127
|
+
delete this.result.condition
|
|
1128
|
+
}
|
|
1129
|
+
for (const item of this.result.column) {
|
|
1130
|
+
if (item.selectType === 'fixArray') {
|
|
1131
|
+
item.selectKey = JSON.parse(item.selectKey)
|
|
1132
|
+
}
|
|
1133
|
+
if (item.dataModeArray.length === 5) {
|
|
1134
|
+
delete item.dataModeArray
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
if (this.buttonStateData.length !== 4) {
|
|
1138
|
+
this.result.buttonState = this.buttonState
|
|
1139
|
+
}
|
|
1140
|
+
then()
|
|
1141
|
+
},
|
|
1142
|
+
view () {
|
|
1143
|
+
this.$refs.businessCreateForm.validate(valid => {
|
|
1144
|
+
if (valid) {
|
|
1145
|
+
this.viewHandle(() => {
|
|
1146
|
+
this.modelVisible = true
|
|
1147
|
+
})
|
|
1148
|
+
}
|
|
1149
|
+
})
|
|
1150
|
+
},
|
|
1151
|
+
submit () {
|
|
1152
|
+
this.onModelClose()
|
|
1153
|
+
this.$refs.businessCreateForm.validate(valid => {
|
|
1154
|
+
if (valid) {
|
|
1155
|
+
this.viewHandle(() => {
|
|
1156
|
+
// saveQueryParams
|
|
1157
|
+
this.$emit('saveQueryParams', this.result)
|
|
1158
|
+
})
|
|
1159
|
+
}
|
|
1160
|
+
})
|
|
1161
|
+
},
|
|
1162
|
+
modelCancel () {
|
|
1163
|
+
this.dataColumnVisible = false
|
|
1164
|
+
// 延迟是为了避免编辑数据窗口关闭时重置表单导致的闪烁
|
|
1165
|
+
setTimeout(() => {
|
|
1166
|
+
this.item = {
|
|
1167
|
+
key: '',
|
|
1168
|
+
title: '',
|
|
1169
|
+
slot: {},
|
|
1170
|
+
rule: {
|
|
1171
|
+
required: 'false'
|
|
1172
|
+
},
|
|
1173
|
+
dataModeArray: []
|
|
1174
|
+
}
|
|
1175
|
+
this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
|
|
1176
|
+
}, 100)
|
|
1177
|
+
},
|
|
1178
|
+
changeFormType (item) {
|
|
1179
|
+
if (item.formType === 'file' || item.formType === 'image') {
|
|
1180
|
+
this.dataModeArrayData = ['addOrEditForm', 'sqlQueryItem']
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1183
|
+
changeSelectKey (item) {
|
|
1184
|
+
if (item.selectType === 'key' && item.selectKey) {
|
|
1185
|
+
item.slot.type = 'badge'
|
|
1186
|
+
item.slotKeyMap = item.selectKey
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
visitAcceptFile () {
|
|
1190
|
+
window.open('https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input/file#attr-accept')
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
</script>
|
|
1195
|
+
<style lang="less" scoped>
|
|
1196
|
+
</style>
|