vue2-client 1.6.48 → 1.6.49
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 +625 -622
- package/index.js +30 -30
- package/package.json +81 -81
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
- package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +733 -733
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +140 -140
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
- package/src/base-client/components/common/Upload/Upload.vue +168 -168
- package/src/base-client/components/common/XAddForm/XAddForm.vue +325 -325
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +279 -279
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XForm/XForm.vue +180 -180
- package/src/base-client/components/common/XForm/XFormItem.vue +513 -513
- package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
- package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
- package/src/base-client/components/common/XFormTable/XFormTable.vue +336 -336
- package/src/base-client/components/common/XFormTable/index.md +97 -97
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
- package/src/base-client/components/common/XTable/XTable.vue +6 -5
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
- package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
- package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
- package/src/base-client/plugins/AppData.js +76 -76
- package/src/base-client/plugins/GetLoginInfoService.js +179 -179
- package/src/base-client/plugins/PagedList.js +177 -177
- package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
- package/src/base-client/plugins/i18n-extend.js +32 -32
- package/src/components/Ellipsis/Ellipsis.vue +65 -65
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/STable/index.js +318 -318
- package/src/components/Trend/index.md +45 -45
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/checkbox/ImgCheckbox.vue +163 -163
- package/src/components/exception/ExceptionPage.vue +70 -70
- package/src/components/form/FormRow.vue +52 -52
- package/src/components/index.js +36 -36
- package/src/components/menu/SideMenu.vue +62 -62
- package/src/components/menu/menu.js +273 -273
- package/src/components/page/header/index.less +40 -40
- package/src/components/setting/Setting.vue +235 -235
- package/src/components/table/StandardTable.vue +141 -141
- package/src/components/table/advance/ActionColumns.vue +158 -158
- package/src/components/table/advance/SearchArea.vue +355 -355
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/components/tool/AvatarList.vue +68 -68
- package/src/components/tool/Drawer.vue +142 -142
- package/src/components/tool/TagSelect.vue +83 -83
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/CreateQueryConfig.js +307 -307
- package/src/config/default/admin.config.js +18 -18
- package/src/config/default/setting.config.js +46 -46
- package/src/config/replacer/resolve.config.js +67 -67
- package/src/layouts/CommonLayout.vue +42 -42
- package/src/layouts/ComponentLayoutOne.vue +47 -47
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +116 -116
- package/src/layouts/footer/PageFooter.vue +49 -49
- package/src/layouts/header/AdminHeader.vue +134 -134
- package/src/layouts/header/HeaderAvatar.vue +64 -64
- package/src/layouts/header/HeaderNotice.vue +176 -176
- package/src/layouts/header/HeaderSearch.vue +67 -67
- package/src/layouts/header/InstitutionDetail.vue +181 -181
- package/src/layouts/header/index.less +92 -92
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +379 -379
- package/src/mock/goods/index.js +108 -108
- package/src/pages/login/Login.vue +369 -366
- package/src/pages/report/ReportTable.js +124 -124
- package/src/pages/report/ReportTableHome.vue +28 -28
- package/src/pages/resourceManage/orgListManage.vue +98 -98
- package/src/pages/system/file/index.vue +317 -317
- package/src/pages/system/settings/index.vue +126 -126
- package/src/pages/system/settings/modifyPassword.vue +109 -109
- package/src/router/async/config.async.js +28 -28
- package/src/router/async/router.map.js +68 -68
- package/src/router/index.js +27 -27
- package/src/services/api/DictionaryDetailsViewApi.js +6 -6
- package/src/services/api/LogDetailsViewApi.js +10 -10
- package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
- package/src/services/api/TicketDetailsViewApi.js +34 -34
- package/src/services/api/cas.js +79 -79
- package/src/services/api/common.js +9 -0
- package/src/services/api/commonTempTable.js +10 -10
- package/src/services/api/index.js +17 -17
- package/src/services/api/logininfor/index.js +6 -6
- package/src/services/api/manage.js +8 -8
- package/src/services/apiService.js +14 -14
- package/src/services/user.js +67 -67
- package/src/store/modules/index.js +4 -4
- package/src/theme/default/nprogress.less +76 -76
- package/src/theme/default/style.less +58 -58
- package/src/utils/EncryptUtil.js +53 -53
- package/src/utils/colors.js +107 -107
- package/src/utils/excel/Blob.js +180 -180
- package/src/utils/excel/Export2Excel.js +141 -141
- package/src/utils/formatter.js +68 -68
- package/src/utils/i18n.js +80 -80
- package/src/utils/map-utils.js +37 -37
- package/src/utils/theme-color-replacer-extend.js +91 -91
- package/src/utils/themeUtil.js +100 -100
- package/src/utils/util.js +230 -230
- package/vue.config.js +106 -106
|
@@ -1,513 +1,513 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 输入框 -->
|
|
3
|
-
<x-form-col
|
|
4
|
-
v-if="attr.type === 'input'"
|
|
5
|
-
:flex="attr.flex">
|
|
6
|
-
<a-form-model-item
|
|
7
|
-
:ref="attr.model"
|
|
8
|
-
:label="attr.name"
|
|
9
|
-
:prop="attr.model">
|
|
10
|
-
<a-input v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
|
|
11
|
-
</a-form-model-item>
|
|
12
|
-
</x-form-col>
|
|
13
|
-
<!-- 下拉框 -->
|
|
14
|
-
<x-form-col
|
|
15
|
-
v-else-if="attr.type === 'select'"
|
|
16
|
-
:flex="attr.flex">
|
|
17
|
-
<a-form-model-item
|
|
18
|
-
:ref="attr.model"
|
|
19
|
-
:label="attr.name"
|
|
20
|
-
:prop="attr.model">
|
|
21
|
-
<a-select
|
|
22
|
-
v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
|
|
23
|
-
v-model="form[attr.model]"
|
|
24
|
-
:disabled="disabled"
|
|
25
|
-
:filter-option="filterOption"
|
|
26
|
-
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
27
|
-
:placeholder="attr.placeholder ? attr.placeholder : '请选择'"
|
|
28
|
-
show-search
|
|
29
|
-
>
|
|
30
|
-
<a-select-option
|
|
31
|
-
v-if="mode === '查询'"
|
|
32
|
-
key="999999"
|
|
33
|
-
value="全部">全部
|
|
34
|
-
</a-select-option>
|
|
35
|
-
<template v-if="attr.keys">
|
|
36
|
-
<a-select-option
|
|
37
|
-
v-for="(item,index) in attr.keys"
|
|
38
|
-
:key="index"
|
|
39
|
-
:value="item.value">
|
|
40
|
-
{{ item.label }}
|
|
41
|
-
</a-select-option>
|
|
42
|
-
</template>
|
|
43
|
-
<template v-else>
|
|
44
|
-
<template v-if="attr.keyName.indexOf('logic@') !== -1">
|
|
45
|
-
<a-select-option
|
|
46
|
-
v-for="(item,index) in option"
|
|
47
|
-
:key="index"
|
|
48
|
-
:value="item.value">{{ item.label }}
|
|
49
|
-
</a-select-option>
|
|
50
|
-
</template>
|
|
51
|
-
<template v-else>
|
|
52
|
-
<a-select-option
|
|
53
|
-
v-for="item in $appdata.getDictionaryList(attr.keyName)"
|
|
54
|
-
:key="item.value"
|
|
55
|
-
:value="item.value">
|
|
56
|
-
<!-- 徽标(badge) -->
|
|
57
|
-
<x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
|
|
58
|
-
</a-select-option>
|
|
59
|
-
</template>
|
|
60
|
-
</template>
|
|
61
|
-
</a-select>
|
|
62
|
-
<a-select
|
|
63
|
-
v-else
|
|
64
|
-
v-model="form[attr.model]"
|
|
65
|
-
:disabled="disabled"
|
|
66
|
-
:filter-option="filterOption"
|
|
67
|
-
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
68
|
-
:placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
|
|
69
|
-
show-search
|
|
70
|
-
@search="fetchFunction"
|
|
71
|
-
>
|
|
72
|
-
<a-spin v-if="searching" slot="notFoundContent" size="small" />
|
|
73
|
-
<a-select-option
|
|
74
|
-
v-if="mode === '查询'"
|
|
75
|
-
key="999999"
|
|
76
|
-
value="全部">全部
|
|
77
|
-
</a-select-option>
|
|
78
|
-
<a-select-option
|
|
79
|
-
v-for="(item,index) in option"
|
|
80
|
-
:key="index"
|
|
81
|
-
:value="item.value">{{ item.label }}
|
|
82
|
-
</a-select-option>
|
|
83
|
-
</a-select>
|
|
84
|
-
</a-form-model-item>
|
|
85
|
-
</x-form-col>
|
|
86
|
-
<!-- 多选框 -->
|
|
87
|
-
<x-form-col
|
|
88
|
-
v-else-if="attr.type === 'checkbox'"
|
|
89
|
-
:flex="attr.flex">
|
|
90
|
-
<a-form-model-item
|
|
91
|
-
:ref="attr.model"
|
|
92
|
-
:label="attr.name"
|
|
93
|
-
:prop="attr.model">
|
|
94
|
-
<a-select
|
|
95
|
-
v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
|
|
96
|
-
v-model="form[attr.model]"
|
|
97
|
-
:disabled="disabled"
|
|
98
|
-
:filter-option="filterOption"
|
|
99
|
-
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
100
|
-
:placeholder="attr.placeholder ? attr.placeholder : '请选择'"
|
|
101
|
-
mode="multiple"
|
|
102
|
-
show-search
|
|
103
|
-
allowClear
|
|
104
|
-
>
|
|
105
|
-
<template v-if="attr.keys">
|
|
106
|
-
<a-select-option
|
|
107
|
-
v-for="(item,index) in attr.keys"
|
|
108
|
-
:key="index"
|
|
109
|
-
:value="item.value">
|
|
110
|
-
{{ item.label }}
|
|
111
|
-
</a-select-option>
|
|
112
|
-
</template>
|
|
113
|
-
<template v-else>
|
|
114
|
-
<template v-if="attr.keyName.indexOf('logic@') !== -1">
|
|
115
|
-
<a-select-option
|
|
116
|
-
v-for="(item,index) in option"
|
|
117
|
-
:key="index"
|
|
118
|
-
:value="item.value">{{ item.label }}
|
|
119
|
-
</a-select-option>
|
|
120
|
-
</template>
|
|
121
|
-
<template v-else>
|
|
122
|
-
<a-select-option
|
|
123
|
-
v-for="item in $appdata.getDictionaryList(attr.keyName)"
|
|
124
|
-
:key="item.value"
|
|
125
|
-
:value="item.value">{{ item.text }}
|
|
126
|
-
</a-select-option>
|
|
127
|
-
</template>
|
|
128
|
-
</template>
|
|
129
|
-
</a-select>
|
|
130
|
-
<a-select
|
|
131
|
-
v-else
|
|
132
|
-
v-model="form[attr.model]"
|
|
133
|
-
:disabled="disabled"
|
|
134
|
-
:filter-option="filterOption"
|
|
135
|
-
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
136
|
-
:placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
|
|
137
|
-
mode="multiple"
|
|
138
|
-
show-search
|
|
139
|
-
allowClear
|
|
140
|
-
@search="fetchFunction"
|
|
141
|
-
>
|
|
142
|
-
<a-spin v-if="searching" slot="notFoundContent" size="small" />
|
|
143
|
-
<a-select-option
|
|
144
|
-
v-for="(item,index) in option"
|
|
145
|
-
:key="index"
|
|
146
|
-
:value="item.value">{{ item.label }}
|
|
147
|
-
</a-select-option>
|
|
148
|
-
</a-select>
|
|
149
|
-
</a-form-model-item>
|
|
150
|
-
</x-form-col>
|
|
151
|
-
<!-- 单选框 -->
|
|
152
|
-
<x-form-col
|
|
153
|
-
v-else-if="attr.type === 'radio'"
|
|
154
|
-
:flex="attr.flex">
|
|
155
|
-
<a-form-model-item
|
|
156
|
-
:ref="attr.model"
|
|
157
|
-
:label="attr.name"
|
|
158
|
-
:prop="attr.model">
|
|
159
|
-
<a-radio-group v-model="form[attr.model]">
|
|
160
|
-
<template v-if="attr.keys">
|
|
161
|
-
<a-radio v-for="(item,index) in attr.keys" :key="index" :value="item.value">
|
|
162
|
-
{{ item.label }}
|
|
163
|
-
</a-radio>
|
|
164
|
-
</template>
|
|
165
|
-
<template v-else>
|
|
166
|
-
<template v-if="attr.keyName.indexOf('logic@') !== -1">
|
|
167
|
-
<a-radio v-for="(item,index) in option" :key="index" :value="item.value">
|
|
168
|
-
{{ item.label }}
|
|
169
|
-
</a-radio>
|
|
170
|
-
</template>
|
|
171
|
-
<template v-else>
|
|
172
|
-
<a-radio v-for="(item,index) in $appdata.getDictionaryList(attr.keyName)" :key="index" :value="item.value">
|
|
173
|
-
{{ item.text }}
|
|
174
|
-
</a-radio>
|
|
175
|
-
</template>
|
|
176
|
-
</template>
|
|
177
|
-
</a-radio-group>
|
|
178
|
-
</a-form-model-item>
|
|
179
|
-
</x-form-col>
|
|
180
|
-
<!-- 日期范围选择器 -->
|
|
181
|
-
<x-form-col
|
|
182
|
-
v-else-if="attr.type === 'rangePicker'"
|
|
183
|
-
:flex="attr.flex">
|
|
184
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
185
|
-
<a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
|
|
186
|
-
</a-form-model-item>
|
|
187
|
-
</x-form-col>
|
|
188
|
-
<!-- 月份选择器 -->
|
|
189
|
-
<x-form-col
|
|
190
|
-
v-else-if="attr.type === 'monthPicker'"
|
|
191
|
-
:flex="attr.flex">
|
|
192
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
193
|
-
<a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
|
|
194
|
-
</a-form-model-item>
|
|
195
|
-
</x-form-col>
|
|
196
|
-
<!-- 年份选择器 -->
|
|
197
|
-
<x-form-col
|
|
198
|
-
v-else-if="attr.type === 'yearPicker'"
|
|
199
|
-
:flex="attr.flex">
|
|
200
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
201
|
-
<a-date-picker
|
|
202
|
-
v-model="form[attr.model]"
|
|
203
|
-
:disabled="disabled"
|
|
204
|
-
format="YYYY"
|
|
205
|
-
mode="year"
|
|
206
|
-
v-decorator="['year']"
|
|
207
|
-
placeholder="请选择年份"
|
|
208
|
-
:open="yearShowOne"
|
|
209
|
-
@openChange="openChangeOne"
|
|
210
|
-
@panelChange="panelChangeOne"/>
|
|
211
|
-
</a-form-model-item>
|
|
212
|
-
</x-form-col>
|
|
213
|
-
<!-- 日期选择器 -->
|
|
214
|
-
<x-form-col
|
|
215
|
-
v-else-if="attr.type === 'datePicker'"
|
|
216
|
-
:flex="attr.flex">
|
|
217
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
218
|
-
<a-date-picker
|
|
219
|
-
v-model="form[attr.model]"
|
|
220
|
-
:disabled="disabled"
|
|
221
|
-
format="YYYY-MM-DD"
|
|
222
|
-
:show-time="false"
|
|
223
|
-
valueFormat="YYYY-MM-DD"/>
|
|
224
|
-
</a-form-model-item>
|
|
225
|
-
</x-form-col>
|
|
226
|
-
<!-- 文本域 -->
|
|
227
|
-
<x-form-col
|
|
228
|
-
v-else-if="attr.type === 'textarea'"
|
|
229
|
-
:flex="{
|
|
230
|
-
xs: 24,
|
|
231
|
-
sm: 24,
|
|
232
|
-
md: 24,
|
|
233
|
-
lg: 24,
|
|
234
|
-
xl: 24,
|
|
235
|
-
xxl: 24
|
|
236
|
-
}">
|
|
237
|
-
<a-form-model-item
|
|
238
|
-
:ref="attr.model"
|
|
239
|
-
:label="attr.name"
|
|
240
|
-
:prop="attr.model">
|
|
241
|
-
<a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
|
|
242
|
-
</a-form-model-item>
|
|
243
|
-
</x-form-col>
|
|
244
|
-
<!-- 文件上传 -->
|
|
245
|
-
<x-form-col
|
|
246
|
-
v-else-if="attr.type === 'file' || attr.type === 'image'"
|
|
247
|
-
:flex="{
|
|
248
|
-
xs: 24,
|
|
249
|
-
sm: 24,
|
|
250
|
-
md: 24,
|
|
251
|
-
lg: 24,
|
|
252
|
-
xl: 24,
|
|
253
|
-
xxl: 24
|
|
254
|
-
}">
|
|
255
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
256
|
-
<upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
|
|
257
|
-
</a-form-model-item>
|
|
258
|
-
</x-form-col>
|
|
259
|
-
<!-- 省市区选择框 -->
|
|
260
|
-
<x-form-col
|
|
261
|
-
v-else-if="attr.type === 'citySelect'"
|
|
262
|
-
:flex="attr.flex">
|
|
263
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
264
|
-
<citySelect v-model="form[attr.model]" ></citySelect>
|
|
265
|
-
</a-form-model-item>
|
|
266
|
-
</x-form-col>
|
|
267
|
-
<!-- 地点搜索框 -->
|
|
268
|
-
<x-form-col
|
|
269
|
-
v-else-if="attr.type === 'addressSearch'"
|
|
270
|
-
:flex="attr.flex">
|
|
271
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
272
|
-
<address-search-combobox
|
|
273
|
-
v-model="searchResult"
|
|
274
|
-
:resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
|
|
275
|
-
searchResultType="Object"
|
|
276
|
-
@onSelect="form=Object.assign(form,JSON.parse(searchResult))"
|
|
277
|
-
></address-search-combobox>
|
|
278
|
-
</a-form-model-item>
|
|
279
|
-
</x-form-col>
|
|
280
|
-
<!-- 人员选择框 -->
|
|
281
|
-
<x-form-col
|
|
282
|
-
v-else-if="attr.type === 'personSetting'"
|
|
283
|
-
:flex="attr.flex">
|
|
284
|
-
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
285
|
-
<PersonSetting v-model="form[attr.model]" ></PersonSetting>
|
|
286
|
-
</a-form-model-item>
|
|
287
|
-
</x-form-col>
|
|
288
|
-
<!-- 树形选择框 -->
|
|
289
|
-
<x-form-col
|
|
290
|
-
v-else-if="attr.type === 'treeSelect'"
|
|
291
|
-
:flex="attr.flex">
|
|
292
|
-
<x-tree-select
|
|
293
|
-
ref="xTreeSelect">
|
|
294
|
-
</x-tree-select>
|
|
295
|
-
</x-form-col>
|
|
296
|
-
</template>
|
|
297
|
-
<script>
|
|
298
|
-
|
|
299
|
-
import { post } from '@vue2-client/services/api'
|
|
300
|
-
import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
|
|
301
|
-
import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
|
|
302
|
-
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
303
|
-
import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
|
|
304
|
-
import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
|
|
305
|
-
import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
|
|
306
|
-
import Upload from '@vue2-client/base-client/components/common/Upload'
|
|
307
|
-
import moment from 'moment'
|
|
308
|
-
import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
|
|
309
|
-
|
|
310
|
-
export default {
|
|
311
|
-
name: 'XFormItem',
|
|
312
|
-
components: {
|
|
313
|
-
XTreeSelect,
|
|
314
|
-
XFormCol,
|
|
315
|
-
XBadge,
|
|
316
|
-
CitySelect,
|
|
317
|
-
PersonSetting,
|
|
318
|
-
AddressSearchCombobox,
|
|
319
|
-
Upload
|
|
320
|
-
},
|
|
321
|
-
data () {
|
|
322
|
-
// 检索去抖
|
|
323
|
-
this.fetchFunction = debounce(this.fetchFunction, 800)
|
|
324
|
-
return {
|
|
325
|
-
option: [],
|
|
326
|
-
// 最后检索版本
|
|
327
|
-
lastFetchId: 0,
|
|
328
|
-
// 检索中
|
|
329
|
-
searching: false,
|
|
330
|
-
searchResult: '',
|
|
331
|
-
yearShowOne: false,
|
|
332
|
-
// moment
|
|
333
|
-
moment
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
props: {
|
|
337
|
-
attr: {
|
|
338
|
-
type: Object,
|
|
339
|
-
default: () => {
|
|
340
|
-
return {}
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
form: {
|
|
344
|
-
type: Object,
|
|
345
|
-
required: true
|
|
346
|
-
},
|
|
347
|
-
disabled: {
|
|
348
|
-
type: Boolean,
|
|
349
|
-
default: () => {
|
|
350
|
-
return false
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
mode: {
|
|
354
|
-
type: String,
|
|
355
|
-
default: () => {
|
|
356
|
-
return '查询'
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
files: {
|
|
360
|
-
type: Array,
|
|
361
|
-
default: () => {
|
|
362
|
-
return []
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
images: {
|
|
366
|
-
type: Array,
|
|
367
|
-
default: () => {
|
|
368
|
-
return []
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
serviceName: {
|
|
372
|
-
type: String,
|
|
373
|
-
default: 'af-system'
|
|
374
|
-
},
|
|
375
|
-
// 调用logic获取数据源的追加参数
|
|
376
|
-
getDataParams: {
|
|
377
|
-
type: Object,
|
|
378
|
-
default: undefined
|
|
379
|
-
}
|
|
380
|
-
},
|
|
381
|
-
created () {
|
|
382
|
-
this.init()
|
|
383
|
-
},
|
|
384
|
-
watch: {
|
|
385
|
-
attr: {
|
|
386
|
-
handler () {
|
|
387
|
-
this.init()
|
|
388
|
-
},
|
|
389
|
-
deep: true
|
|
390
|
-
},
|
|
391
|
-
form: {
|
|
392
|
-
handler (newVal) {
|
|
393
|
-
const value = newVal[this.attr.model]
|
|
394
|
-
const isEmpty = !value || !value.toString()
|
|
395
|
-
// 查询表单点击重置按钮时清空树形选择框选中状态
|
|
396
|
-
if (this.attr.type === 'treeSelect' && isEmpty) {
|
|
397
|
-
this.$refs.xTreeSelect.setValue(undefined)
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
deep: true
|
|
401
|
-
}
|
|
402
|
-
},
|
|
403
|
-
methods: {
|
|
404
|
-
init () {
|
|
405
|
-
if (this.mode === '新增/修改' && !this.attr.flex) {
|
|
406
|
-
this.attr.flex = {
|
|
407
|
-
xs: 24,
|
|
408
|
-
sm: 24,
|
|
409
|
-
md: 24,
|
|
410
|
-
lg: 12,
|
|
411
|
-
xl: 12,
|
|
412
|
-
xxl: 8
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
|
|
416
|
-
this.getData({}, res => {
|
|
417
|
-
this.option = res
|
|
418
|
-
if (this.attr.type === 'treeSelect') {
|
|
419
|
-
this.$refs.xTreeSelect.init({
|
|
420
|
-
option: this.option,
|
|
421
|
-
form: this.form,
|
|
422
|
-
queryType: this.attr.queryType,
|
|
423
|
-
name: this.attr.name,
|
|
424
|
-
model: this.attr.model,
|
|
425
|
-
mode: this.mode,
|
|
426
|
-
disabled: this.disabled
|
|
427
|
-
})
|
|
428
|
-
} else if (this.attr.type === 'radio') {
|
|
429
|
-
this.initRadioValue()
|
|
430
|
-
}
|
|
431
|
-
})
|
|
432
|
-
} else {
|
|
433
|
-
this.initRadioValue()
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
initRadioValue () {
|
|
437
|
-
const model = this.attr.model
|
|
438
|
-
if (this.mode === '新增/修改' && this.attr.type === 'radio' && !this.form[model]) {
|
|
439
|
-
if (this.attr.keys && this.attr.keys.length > 0) {
|
|
440
|
-
this.form[model] = this.attr.keys[0].value
|
|
441
|
-
} else if (this.option && this.option.length > 0) {
|
|
442
|
-
this.form[model] = this.option[0].value
|
|
443
|
-
} else if (this.attr.keyName) {
|
|
444
|
-
const list = this.$appdata.getDictionaryList(this.attr.keyName)
|
|
445
|
-
if (list.length > 0) {
|
|
446
|
-
this.form[model] = list[0].value
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
},
|
|
451
|
-
openChangeOne (status) {
|
|
452
|
-
if (status) {
|
|
453
|
-
this.yearShowOne = true
|
|
454
|
-
}
|
|
455
|
-
},
|
|
456
|
-
// 得到年份选择器的值
|
|
457
|
-
panelChangeOne (value) {
|
|
458
|
-
this.yearShowOne = false
|
|
459
|
-
this.form[this.attr.model] = value.format('YYYY')
|
|
460
|
-
},
|
|
461
|
-
// 文件框时设置上传组件的值
|
|
462
|
-
setFiles (fileIds) {
|
|
463
|
-
if (!this.form[this.attr.model]) {
|
|
464
|
-
this.form[this.attr.model] = []
|
|
465
|
-
}
|
|
466
|
-
this.form[this.attr.model] = [...fileIds]
|
|
467
|
-
},
|
|
468
|
-
// 懒加载检索方法
|
|
469
|
-
fetchFunction (value) {
|
|
470
|
-
this.lastFetchId += 1
|
|
471
|
-
const fetchId = this.lastFetchId
|
|
472
|
-
this.option = []
|
|
473
|
-
this.searching = true
|
|
474
|
-
this.getData({
|
|
475
|
-
word: value
|
|
476
|
-
}, res => {
|
|
477
|
-
if (fetchId !== this.lastFetchId) {
|
|
478
|
-
return
|
|
479
|
-
}
|
|
480
|
-
this.option = res
|
|
481
|
-
this.searching = false
|
|
482
|
-
})
|
|
483
|
-
},
|
|
484
|
-
// 获取数据
|
|
485
|
-
getData (value, callback) {
|
|
486
|
-
if (value !== '') {
|
|
487
|
-
const logicName = this.attr.keyName
|
|
488
|
-
const logic = logicName.substring(6)
|
|
489
|
-
// 调用logic前设置参数
|
|
490
|
-
if (this.getDataParams && this.getDataParams[this.attr.model]) {
|
|
491
|
-
Object.assign(value, this.getDataParams[this.attr.model])
|
|
492
|
-
}
|
|
493
|
-
post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
|
|
494
|
-
callback(res)
|
|
495
|
-
})
|
|
496
|
-
}
|
|
497
|
-
},
|
|
498
|
-
filterOption (input, option) {
|
|
499
|
-
const child = option.componentOptions.children[0]
|
|
500
|
-
if (child.text) {
|
|
501
|
-
return child.text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
502
|
-
} else if (child.elm.innerText) {
|
|
503
|
-
return child.elm.innerText.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
504
|
-
} else {
|
|
505
|
-
return child.child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
</script>
|
|
511
|
-
|
|
512
|
-
<style lang="less" scoped>
|
|
513
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 输入框 -->
|
|
3
|
+
<x-form-col
|
|
4
|
+
v-if="attr.type === 'input'"
|
|
5
|
+
:flex="attr.flex">
|
|
6
|
+
<a-form-model-item
|
|
7
|
+
:ref="attr.model"
|
|
8
|
+
:label="attr.name"
|
|
9
|
+
:prop="attr.model">
|
|
10
|
+
<a-input v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
|
|
11
|
+
</a-form-model-item>
|
|
12
|
+
</x-form-col>
|
|
13
|
+
<!-- 下拉框 -->
|
|
14
|
+
<x-form-col
|
|
15
|
+
v-else-if="attr.type === 'select'"
|
|
16
|
+
:flex="attr.flex">
|
|
17
|
+
<a-form-model-item
|
|
18
|
+
:ref="attr.model"
|
|
19
|
+
:label="attr.name"
|
|
20
|
+
:prop="attr.model">
|
|
21
|
+
<a-select
|
|
22
|
+
v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
|
|
23
|
+
v-model="form[attr.model]"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
:filter-option="filterOption"
|
|
26
|
+
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
27
|
+
:placeholder="attr.placeholder ? attr.placeholder : '请选择'"
|
|
28
|
+
show-search
|
|
29
|
+
>
|
|
30
|
+
<a-select-option
|
|
31
|
+
v-if="mode === '查询'"
|
|
32
|
+
key="999999"
|
|
33
|
+
value="全部">全部
|
|
34
|
+
</a-select-option>
|
|
35
|
+
<template v-if="attr.keys">
|
|
36
|
+
<a-select-option
|
|
37
|
+
v-for="(item,index) in attr.keys"
|
|
38
|
+
:key="index"
|
|
39
|
+
:value="item.value">
|
|
40
|
+
{{ item.label }}
|
|
41
|
+
</a-select-option>
|
|
42
|
+
</template>
|
|
43
|
+
<template v-else>
|
|
44
|
+
<template v-if="attr.keyName.indexOf('logic@') !== -1">
|
|
45
|
+
<a-select-option
|
|
46
|
+
v-for="(item,index) in option"
|
|
47
|
+
:key="index"
|
|
48
|
+
:value="item.value">{{ item.label }}
|
|
49
|
+
</a-select-option>
|
|
50
|
+
</template>
|
|
51
|
+
<template v-else>
|
|
52
|
+
<a-select-option
|
|
53
|
+
v-for="item in $appdata.getDictionaryList(attr.keyName)"
|
|
54
|
+
:key="item.value"
|
|
55
|
+
:value="item.value">
|
|
56
|
+
<!-- 徽标(badge) -->
|
|
57
|
+
<x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
|
|
58
|
+
</a-select-option>
|
|
59
|
+
</template>
|
|
60
|
+
</template>
|
|
61
|
+
</a-select>
|
|
62
|
+
<a-select
|
|
63
|
+
v-else
|
|
64
|
+
v-model="form[attr.model]"
|
|
65
|
+
:disabled="disabled"
|
|
66
|
+
:filter-option="filterOption"
|
|
67
|
+
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
68
|
+
:placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
|
|
69
|
+
show-search
|
|
70
|
+
@search="fetchFunction"
|
|
71
|
+
>
|
|
72
|
+
<a-spin v-if="searching" slot="notFoundContent" size="small" />
|
|
73
|
+
<a-select-option
|
|
74
|
+
v-if="mode === '查询'"
|
|
75
|
+
key="999999"
|
|
76
|
+
value="全部">全部
|
|
77
|
+
</a-select-option>
|
|
78
|
+
<a-select-option
|
|
79
|
+
v-for="(item,index) in option"
|
|
80
|
+
:key="index"
|
|
81
|
+
:value="item.value">{{ item.label }}
|
|
82
|
+
</a-select-option>
|
|
83
|
+
</a-select>
|
|
84
|
+
</a-form-model-item>
|
|
85
|
+
</x-form-col>
|
|
86
|
+
<!-- 多选框 -->
|
|
87
|
+
<x-form-col
|
|
88
|
+
v-else-if="attr.type === 'checkbox'"
|
|
89
|
+
:flex="attr.flex">
|
|
90
|
+
<a-form-model-item
|
|
91
|
+
:ref="attr.model"
|
|
92
|
+
:label="attr.name"
|
|
93
|
+
:prop="attr.model">
|
|
94
|
+
<a-select
|
|
95
|
+
v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
|
|
96
|
+
v-model="form[attr.model]"
|
|
97
|
+
:disabled="disabled"
|
|
98
|
+
:filter-option="filterOption"
|
|
99
|
+
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
100
|
+
:placeholder="attr.placeholder ? attr.placeholder : '请选择'"
|
|
101
|
+
mode="multiple"
|
|
102
|
+
show-search
|
|
103
|
+
allowClear
|
|
104
|
+
>
|
|
105
|
+
<template v-if="attr.keys">
|
|
106
|
+
<a-select-option
|
|
107
|
+
v-for="(item,index) in attr.keys"
|
|
108
|
+
:key="index"
|
|
109
|
+
:value="item.value">
|
|
110
|
+
{{ item.label }}
|
|
111
|
+
</a-select-option>
|
|
112
|
+
</template>
|
|
113
|
+
<template v-else>
|
|
114
|
+
<template v-if="attr.keyName.indexOf('logic@') !== -1">
|
|
115
|
+
<a-select-option
|
|
116
|
+
v-for="(item,index) in option"
|
|
117
|
+
:key="index"
|
|
118
|
+
:value="item.value">{{ item.label }}
|
|
119
|
+
</a-select-option>
|
|
120
|
+
</template>
|
|
121
|
+
<template v-else>
|
|
122
|
+
<a-select-option
|
|
123
|
+
v-for="item in $appdata.getDictionaryList(attr.keyName)"
|
|
124
|
+
:key="item.value"
|
|
125
|
+
:value="item.value">{{ item.text }}
|
|
126
|
+
</a-select-option>
|
|
127
|
+
</template>
|
|
128
|
+
</template>
|
|
129
|
+
</a-select>
|
|
130
|
+
<a-select
|
|
131
|
+
v-else
|
|
132
|
+
v-model="form[attr.model]"
|
|
133
|
+
:disabled="disabled"
|
|
134
|
+
:filter-option="filterOption"
|
|
135
|
+
:getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
|
|
136
|
+
:placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
|
|
137
|
+
mode="multiple"
|
|
138
|
+
show-search
|
|
139
|
+
allowClear
|
|
140
|
+
@search="fetchFunction"
|
|
141
|
+
>
|
|
142
|
+
<a-spin v-if="searching" slot="notFoundContent" size="small" />
|
|
143
|
+
<a-select-option
|
|
144
|
+
v-for="(item,index) in option"
|
|
145
|
+
:key="index"
|
|
146
|
+
:value="item.value">{{ item.label }}
|
|
147
|
+
</a-select-option>
|
|
148
|
+
</a-select>
|
|
149
|
+
</a-form-model-item>
|
|
150
|
+
</x-form-col>
|
|
151
|
+
<!-- 单选框 -->
|
|
152
|
+
<x-form-col
|
|
153
|
+
v-else-if="attr.type === 'radio'"
|
|
154
|
+
:flex="attr.flex">
|
|
155
|
+
<a-form-model-item
|
|
156
|
+
:ref="attr.model"
|
|
157
|
+
:label="attr.name"
|
|
158
|
+
:prop="attr.model">
|
|
159
|
+
<a-radio-group v-model="form[attr.model]">
|
|
160
|
+
<template v-if="attr.keys">
|
|
161
|
+
<a-radio v-for="(item,index) in attr.keys" :key="index" :value="item.value">
|
|
162
|
+
{{ item.label }}
|
|
163
|
+
</a-radio>
|
|
164
|
+
</template>
|
|
165
|
+
<template v-else>
|
|
166
|
+
<template v-if="attr.keyName.indexOf('logic@') !== -1">
|
|
167
|
+
<a-radio v-for="(item,index) in option" :key="index" :value="item.value">
|
|
168
|
+
{{ item.label }}
|
|
169
|
+
</a-radio>
|
|
170
|
+
</template>
|
|
171
|
+
<template v-else>
|
|
172
|
+
<a-radio v-for="(item,index) in $appdata.getDictionaryList(attr.keyName)" :key="index" :value="item.value">
|
|
173
|
+
{{ item.text }}
|
|
174
|
+
</a-radio>
|
|
175
|
+
</template>
|
|
176
|
+
</template>
|
|
177
|
+
</a-radio-group>
|
|
178
|
+
</a-form-model-item>
|
|
179
|
+
</x-form-col>
|
|
180
|
+
<!-- 日期范围选择器 -->
|
|
181
|
+
<x-form-col
|
|
182
|
+
v-else-if="attr.type === 'rangePicker'"
|
|
183
|
+
:flex="attr.flex">
|
|
184
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
185
|
+
<a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
|
|
186
|
+
</a-form-model-item>
|
|
187
|
+
</x-form-col>
|
|
188
|
+
<!-- 月份选择器 -->
|
|
189
|
+
<x-form-col
|
|
190
|
+
v-else-if="attr.type === 'monthPicker'"
|
|
191
|
+
:flex="attr.flex">
|
|
192
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
193
|
+
<a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
|
|
194
|
+
</a-form-model-item>
|
|
195
|
+
</x-form-col>
|
|
196
|
+
<!-- 年份选择器 -->
|
|
197
|
+
<x-form-col
|
|
198
|
+
v-else-if="attr.type === 'yearPicker'"
|
|
199
|
+
:flex="attr.flex">
|
|
200
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
201
|
+
<a-date-picker
|
|
202
|
+
v-model="form[attr.model]"
|
|
203
|
+
:disabled="disabled"
|
|
204
|
+
format="YYYY"
|
|
205
|
+
mode="year"
|
|
206
|
+
v-decorator="['year']"
|
|
207
|
+
placeholder="请选择年份"
|
|
208
|
+
:open="yearShowOne"
|
|
209
|
+
@openChange="openChangeOne"
|
|
210
|
+
@panelChange="panelChangeOne"/>
|
|
211
|
+
</a-form-model-item>
|
|
212
|
+
</x-form-col>
|
|
213
|
+
<!-- 日期选择器 -->
|
|
214
|
+
<x-form-col
|
|
215
|
+
v-else-if="attr.type === 'datePicker'"
|
|
216
|
+
:flex="attr.flex">
|
|
217
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
218
|
+
<a-date-picker
|
|
219
|
+
v-model="form[attr.model]"
|
|
220
|
+
:disabled="disabled"
|
|
221
|
+
format="YYYY-MM-DD"
|
|
222
|
+
:show-time="false"
|
|
223
|
+
valueFormat="YYYY-MM-DD"/>
|
|
224
|
+
</a-form-model-item>
|
|
225
|
+
</x-form-col>
|
|
226
|
+
<!-- 文本域 -->
|
|
227
|
+
<x-form-col
|
|
228
|
+
v-else-if="attr.type === 'textarea'"
|
|
229
|
+
:flex="{
|
|
230
|
+
xs: 24,
|
|
231
|
+
sm: 24,
|
|
232
|
+
md: 24,
|
|
233
|
+
lg: 24,
|
|
234
|
+
xl: 24,
|
|
235
|
+
xxl: 24
|
|
236
|
+
}">
|
|
237
|
+
<a-form-model-item
|
|
238
|
+
:ref="attr.model"
|
|
239
|
+
:label="attr.name"
|
|
240
|
+
:prop="attr.model">
|
|
241
|
+
<a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
|
|
242
|
+
</a-form-model-item>
|
|
243
|
+
</x-form-col>
|
|
244
|
+
<!-- 文件上传 -->
|
|
245
|
+
<x-form-col
|
|
246
|
+
v-else-if="attr.type === 'file' || attr.type === 'image'"
|
|
247
|
+
:flex="{
|
|
248
|
+
xs: 24,
|
|
249
|
+
sm: 24,
|
|
250
|
+
md: 24,
|
|
251
|
+
lg: 24,
|
|
252
|
+
xl: 24,
|
|
253
|
+
xxl: 24
|
|
254
|
+
}">
|
|
255
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
256
|
+
<upload :files="files" :images="images" :model="attr" :service-name="serviceName" @setFiles="setFiles"></upload>
|
|
257
|
+
</a-form-model-item>
|
|
258
|
+
</x-form-col>
|
|
259
|
+
<!-- 省市区选择框 -->
|
|
260
|
+
<x-form-col
|
|
261
|
+
v-else-if="attr.type === 'citySelect'"
|
|
262
|
+
:flex="attr.flex">
|
|
263
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
264
|
+
<citySelect v-model="form[attr.model]" ></citySelect>
|
|
265
|
+
</a-form-model-item>
|
|
266
|
+
</x-form-col>
|
|
267
|
+
<!-- 地点搜索框 -->
|
|
268
|
+
<x-form-col
|
|
269
|
+
v-else-if="attr.type === 'addressSearch'"
|
|
270
|
+
:flex="attr.flex">
|
|
271
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
272
|
+
<address-search-combobox
|
|
273
|
+
v-model="searchResult"
|
|
274
|
+
:resultKeys="{ address: attr.model, coords: `${attr.model}_lng_lat` }"
|
|
275
|
+
searchResultType="Object"
|
|
276
|
+
@onSelect="form=Object.assign(form,JSON.parse(searchResult))"
|
|
277
|
+
></address-search-combobox>
|
|
278
|
+
</a-form-model-item>
|
|
279
|
+
</x-form-col>
|
|
280
|
+
<!-- 人员选择框 -->
|
|
281
|
+
<x-form-col
|
|
282
|
+
v-else-if="attr.type === 'personSetting'"
|
|
283
|
+
:flex="attr.flex">
|
|
284
|
+
<a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
|
|
285
|
+
<PersonSetting v-model="form[attr.model]" ></PersonSetting>
|
|
286
|
+
</a-form-model-item>
|
|
287
|
+
</x-form-col>
|
|
288
|
+
<!-- 树形选择框 -->
|
|
289
|
+
<x-form-col
|
|
290
|
+
v-else-if="attr.type === 'treeSelect'"
|
|
291
|
+
:flex="attr.flex">
|
|
292
|
+
<x-tree-select
|
|
293
|
+
ref="xTreeSelect">
|
|
294
|
+
</x-tree-select>
|
|
295
|
+
</x-form-col>
|
|
296
|
+
</template>
|
|
297
|
+
<script>
|
|
298
|
+
|
|
299
|
+
import { post } from '@vue2-client/services/api'
|
|
300
|
+
import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
|
|
301
|
+
import XFormCol from '@vue2-client/base-client/components/common/XFormCol'
|
|
302
|
+
import XBadge from '@vue2-client/base-client/components/common/XBadge'
|
|
303
|
+
import CitySelect from '@vue2-client/base-client/components/common/CitySelect'
|
|
304
|
+
import PersonSetting from '@vue2-client/base-client/components/common/PersonSetting'
|
|
305
|
+
import AddressSearchCombobox from '@vue2-client/base-client/components/common/AddressSearchCombobox'
|
|
306
|
+
import Upload from '@vue2-client/base-client/components/common/Upload'
|
|
307
|
+
import moment from 'moment'
|
|
308
|
+
import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
|
|
309
|
+
|
|
310
|
+
export default {
|
|
311
|
+
name: 'XFormItem',
|
|
312
|
+
components: {
|
|
313
|
+
XTreeSelect,
|
|
314
|
+
XFormCol,
|
|
315
|
+
XBadge,
|
|
316
|
+
CitySelect,
|
|
317
|
+
PersonSetting,
|
|
318
|
+
AddressSearchCombobox,
|
|
319
|
+
Upload
|
|
320
|
+
},
|
|
321
|
+
data () {
|
|
322
|
+
// 检索去抖
|
|
323
|
+
this.fetchFunction = debounce(this.fetchFunction, 800)
|
|
324
|
+
return {
|
|
325
|
+
option: [],
|
|
326
|
+
// 最后检索版本
|
|
327
|
+
lastFetchId: 0,
|
|
328
|
+
// 检索中
|
|
329
|
+
searching: false,
|
|
330
|
+
searchResult: '',
|
|
331
|
+
yearShowOne: false,
|
|
332
|
+
// moment
|
|
333
|
+
moment
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
props: {
|
|
337
|
+
attr: {
|
|
338
|
+
type: Object,
|
|
339
|
+
default: () => {
|
|
340
|
+
return {}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
form: {
|
|
344
|
+
type: Object,
|
|
345
|
+
required: true
|
|
346
|
+
},
|
|
347
|
+
disabled: {
|
|
348
|
+
type: Boolean,
|
|
349
|
+
default: () => {
|
|
350
|
+
return false
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
mode: {
|
|
354
|
+
type: String,
|
|
355
|
+
default: () => {
|
|
356
|
+
return '查询'
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
files: {
|
|
360
|
+
type: Array,
|
|
361
|
+
default: () => {
|
|
362
|
+
return []
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
images: {
|
|
366
|
+
type: Array,
|
|
367
|
+
default: () => {
|
|
368
|
+
return []
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
serviceName: {
|
|
372
|
+
type: String,
|
|
373
|
+
default: 'af-system'
|
|
374
|
+
},
|
|
375
|
+
// 调用logic获取数据源的追加参数
|
|
376
|
+
getDataParams: {
|
|
377
|
+
type: Object,
|
|
378
|
+
default: undefined
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
created () {
|
|
382
|
+
this.init()
|
|
383
|
+
},
|
|
384
|
+
watch: {
|
|
385
|
+
attr: {
|
|
386
|
+
handler () {
|
|
387
|
+
this.init()
|
|
388
|
+
},
|
|
389
|
+
deep: true
|
|
390
|
+
},
|
|
391
|
+
form: {
|
|
392
|
+
handler (newVal) {
|
|
393
|
+
const value = newVal[this.attr.model]
|
|
394
|
+
const isEmpty = !value || !value.toString()
|
|
395
|
+
// 查询表单点击重置按钮时清空树形选择框选中状态
|
|
396
|
+
if (this.attr.type === 'treeSelect' && isEmpty) {
|
|
397
|
+
this.$refs.xTreeSelect.setValue(undefined)
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
deep: true
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
methods: {
|
|
404
|
+
init () {
|
|
405
|
+
if (this.mode === '新增/修改' && !this.attr.flex) {
|
|
406
|
+
this.attr.flex = {
|
|
407
|
+
xs: 24,
|
|
408
|
+
sm: 24,
|
|
409
|
+
md: 24,
|
|
410
|
+
lg: 12,
|
|
411
|
+
xl: 12,
|
|
412
|
+
xxl: 8
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
|
|
416
|
+
this.getData({}, res => {
|
|
417
|
+
this.option = res
|
|
418
|
+
if (this.attr.type === 'treeSelect') {
|
|
419
|
+
this.$refs.xTreeSelect.init({
|
|
420
|
+
option: this.option,
|
|
421
|
+
form: this.form,
|
|
422
|
+
queryType: this.attr.queryType,
|
|
423
|
+
name: this.attr.name,
|
|
424
|
+
model: this.attr.model,
|
|
425
|
+
mode: this.mode,
|
|
426
|
+
disabled: this.disabled
|
|
427
|
+
})
|
|
428
|
+
} else if (this.attr.type === 'radio') {
|
|
429
|
+
this.initRadioValue()
|
|
430
|
+
}
|
|
431
|
+
})
|
|
432
|
+
} else {
|
|
433
|
+
this.initRadioValue()
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
initRadioValue () {
|
|
437
|
+
const model = this.attr.model
|
|
438
|
+
if (this.mode === '新增/修改' && this.attr.type === 'radio' && !this.form[model]) {
|
|
439
|
+
if (this.attr.keys && this.attr.keys.length > 0) {
|
|
440
|
+
this.form[model] = this.attr.keys[0].value
|
|
441
|
+
} else if (this.option && this.option.length > 0) {
|
|
442
|
+
this.form[model] = this.option[0].value
|
|
443
|
+
} else if (this.attr.keyName) {
|
|
444
|
+
const list = this.$appdata.getDictionaryList(this.attr.keyName)
|
|
445
|
+
if (list.length > 0) {
|
|
446
|
+
this.form[model] = list[0].value
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
openChangeOne (status) {
|
|
452
|
+
if (status) {
|
|
453
|
+
this.yearShowOne = true
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
// 得到年份选择器的值
|
|
457
|
+
panelChangeOne (value) {
|
|
458
|
+
this.yearShowOne = false
|
|
459
|
+
this.form[this.attr.model] = value.format('YYYY')
|
|
460
|
+
},
|
|
461
|
+
// 文件框时设置上传组件的值
|
|
462
|
+
setFiles (fileIds) {
|
|
463
|
+
if (!this.form[this.attr.model]) {
|
|
464
|
+
this.form[this.attr.model] = []
|
|
465
|
+
}
|
|
466
|
+
this.form[this.attr.model] = [...fileIds]
|
|
467
|
+
},
|
|
468
|
+
// 懒加载检索方法
|
|
469
|
+
fetchFunction (value) {
|
|
470
|
+
this.lastFetchId += 1
|
|
471
|
+
const fetchId = this.lastFetchId
|
|
472
|
+
this.option = []
|
|
473
|
+
this.searching = true
|
|
474
|
+
this.getData({
|
|
475
|
+
word: value
|
|
476
|
+
}, res => {
|
|
477
|
+
if (fetchId !== this.lastFetchId) {
|
|
478
|
+
return
|
|
479
|
+
}
|
|
480
|
+
this.option = res
|
|
481
|
+
this.searching = false
|
|
482
|
+
})
|
|
483
|
+
},
|
|
484
|
+
// 获取数据
|
|
485
|
+
getData (value, callback) {
|
|
486
|
+
if (value !== '') {
|
|
487
|
+
const logicName = this.attr.keyName
|
|
488
|
+
const logic = logicName.substring(6)
|
|
489
|
+
// 调用logic前设置参数
|
|
490
|
+
if (this.getDataParams && this.getDataParams[this.attr.model]) {
|
|
491
|
+
Object.assign(value, this.getDataParams[this.attr.model])
|
|
492
|
+
}
|
|
493
|
+
post('/api/' + this.serviceName + '/logic/' + logic, value).then(res => {
|
|
494
|
+
callback(res)
|
|
495
|
+
})
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
filterOption (input, option) {
|
|
499
|
+
const child = option.componentOptions.children[0]
|
|
500
|
+
if (child.text) {
|
|
501
|
+
return child.text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
502
|
+
} else if (child.elm.innerText) {
|
|
503
|
+
return child.elm.innerText.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
504
|
+
} else {
|
|
505
|
+
return child.child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
</script>
|
|
511
|
+
|
|
512
|
+
<style lang="less" scoped>
|
|
513
|
+
</style>
|