@bytenew/bn-bus-ui 1.1.463 → 1.1.464

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.
Files changed (167) hide show
  1. package/dist/assocTableSearch-Bfe96864.js +349 -0
  2. package/dist/assocTableSearch.css +1 -0
  3. package/dist/bn-bus-ui.es.js +65 -0
  4. package/dist/bn-bus-ui.umd.js +49 -0
  5. package/dist/chooseIPaasData-COrrvQKZ.js +391 -0
  6. package/dist/chooseIPaasData.css +1 -0
  7. package/dist/defaultSet-CzN1ec_d.js +297 -0
  8. package/dist/defaultSet.css +1 -0
  9. package/dist/fileFormData-D_Q1vylE.js +53 -0
  10. package/dist/formItemFooter-BvptZj_u.js +108 -0
  11. package/dist/formItemFooter.css +1 -0
  12. package/dist/funcExprDialog-BguNs9fl.js +139 -0
  13. package/dist/funcExprDialog.css +1 -0
  14. package/dist/index-0oB7QocU.js +44 -0
  15. package/dist/index-69fRP0M8.js +89 -0
  16. package/dist/index-BdklTJtF.js +66 -0
  17. package/dist/index-Bu3jHlby.js +45 -0
  18. package/dist/index-BxWx5kpG.js +89 -0
  19. package/dist/index-C5LQ0OSs.js +183 -0
  20. package/dist/index-C8YhrrUN.js +51 -0
  21. package/dist/index-COuPCIzB.js +45 -0
  22. package/dist/index-CSvVyjxx.js +178 -0
  23. package/dist/index-DCv51EXX.js +109 -0
  24. package/dist/index-DUSI6MuC.js +135 -0
  25. package/dist/index-DVzxs2vR.js +58 -0
  26. package/dist/index-Dd4b8zNb.js +746 -0
  27. package/dist/index-Md-ZlkCW.js +66 -0
  28. package/dist/index-hsSIY2FP.js +221 -0
  29. package/dist/index-n13-H3_Y.js +118 -0
  30. package/dist/index-wUl5aPUD.js +64 -0
  31. package/dist/index.css +1 -0
  32. package/dist/index2.css +1 -0
  33. package/dist/index3.css +1 -0
  34. package/dist/index4.css +1 -0
  35. package/dist/index5.css +1 -0
  36. package/dist/index6.css +1 -0
  37. package/dist/index7.css +1 -0
  38. package/dist/install-CNjs0u5x.js +23299 -0
  39. package/dist/install.css +1 -0
  40. package/dist/setOption-CXOifQcx.js +329 -0
  41. package/dist/setOption.css +1 -0
  42. package/dist/setRelationOption-C7VDhej7.js +5217 -0
  43. package/dist/setRelationOption.css +1 -0
  44. package/package.json +4 -20
  45. package/install.js +0 -134
  46. package/packages/BnAddress/index.vue +0 -141
  47. package/packages/BnAddressParse/index.vue +0 -75
  48. package/packages/BnAdvancedFilter/BnFilterView.vue +0 -145
  49. package/packages/BnAdvancedFilter/index.vue +0 -345
  50. package/packages/BnAdvancedFilter/util.js +0 -171
  51. package/packages/BnCascader/BnCascader.vue +0 -543
  52. package/packages/BnCascader/BnCascaderPanel.vue +0 -1331
  53. package/packages/BnCascader/cascaderDisplay.js +0 -102
  54. package/packages/BnCheck/BnCheck.vue +0 -253
  55. package/packages/BnColumnConfig/columnConfigDialog.vue +0 -134
  56. package/packages/BnColumnConfig/component/childrenFormSetting/assocTable.vue +0 -143
  57. package/packages/BnColumnConfig/component/childrenFormSetting/assocTableSearch.vue +0 -314
  58. package/packages/BnColumnConfig/component/childrenFormSetting/index.vue +0 -243
  59. package/packages/BnColumnConfig/component/defaultSet/defaultSet.vue +0 -114
  60. package/packages/BnColumnConfig/component/defaultSet/stringDefault.vue +0 -210
  61. package/packages/BnColumnConfig/component/funcExprDialog/funcExprDialog.vue +0 -126
  62. package/packages/BnColumnConfig/component/packageFilter/index.vue +0 -141
  63. package/packages/BnColumnConfig/component/paraExplainSet/index.vue +0 -156
  64. package/packages/BnColumnConfig/component/setOption/setOption.vue +0 -321
  65. package/packages/BnColumnConfig/component/setRelationOption/ConditionList.vue +0 -277
  66. package/packages/BnColumnConfig/component/setRelationOption/LevelHeader.vue +0 -144
  67. package/packages/BnColumnConfig/component/setRelationOption/setRelationOption.vue +0 -642
  68. package/packages/BnColumnConfig/data.js +0 -129
  69. package/packages/BnColumnConfig/index.scss +0 -23
  70. package/packages/BnColumnConfig/index.vue +0 -309
  71. package/packages/BnCondVal/BnCondVal.vue +0 -112
  72. package/packages/BnCondVal/itemVal/dateRegVal.vue +0 -39
  73. package/packages/BnCondVal/itemVal/dateVal.vue +0 -39
  74. package/packages/BnCondVal/itemVal/numRegVal.vue +0 -67
  75. package/packages/BnCondVal/itemVal/numVal.vue +0 -44
  76. package/packages/BnCondVal/itemVal/relationVal.vue +0 -73
  77. package/packages/BnCondVal/itemVal/selectColumnVal.vue +0 -58
  78. package/packages/BnCondVal/itemVal/selectVal.vue +0 -59
  79. package/packages/BnCondVal/itemVal/stringVal.vue +0 -156
  80. package/packages/BnCondition/index.vue +0 -551
  81. package/packages/BnCondition/util.js +0 -232
  82. package/packages/BnDatePicker/BnDatePicker.vue +0 -194
  83. package/packages/BnDrop/BnDrop.vue +0 -917
  84. package/packages/BnEmptyTip/BnEmptyTip.vue +0 -107
  85. package/packages/BnExportOrder/BnExportOrder.vue +0 -241
  86. package/packages/BnExportOrder/validatorCode.vue +0 -94
  87. package/packages/BnFileView/BnFileView.vue +0 -271
  88. package/packages/BnFileView/FileDetail.vue +0 -125
  89. package/packages/BnFileView/videoPreview.vue +0 -70
  90. package/packages/BnFilterOption/BnFilterOption.vue +0 -160
  91. package/packages/BnFunExpr/BnFunExpr.vue +0 -608
  92. package/packages/BnImportOrder/BnImportOrder.vue +0 -323
  93. package/packages/BnImportTemplate/BnImportTemplate.vue +0 -866
  94. package/packages/BnImportTemplate/assets/merge_tip_img.png +0 -0
  95. package/packages/BnImportTemplate/assets/sheet_tip.png +0 -0
  96. package/packages/BnImportTemplate/assets/xls.png +0 -0
  97. package/packages/BnImportTemplate/components/ImportTemplateTrigger.vue +0 -198
  98. package/packages/BnImportTemplate/components/TemplateEditDialog.vue +0 -340
  99. package/packages/BnImportTemplate/components/TemplateFieldsConfig.vue +0 -401
  100. package/packages/BnImportTemplate/components/TemplateListDialog.vue +0 -297
  101. package/packages/BnInpNum/BnInpNum.vue +0 -165
  102. package/packages/BnMenus/BnMenus.vue +0 -502
  103. package/packages/BnMenus/MenuItem.vue +0 -321
  104. package/packages/BnOrderCard/BnOrderCard.vue +0 -389
  105. package/packages/BnOrderCard/orderRemark.vue +0 -178
  106. package/packages/BnOrderCard/util.js +0 -94
  107. package/packages/BnOrderDetail/BnOrderDetail.vue +0 -338
  108. package/packages/BnOrderDetail/filterLogByUser.vue +0 -108
  109. package/packages/BnOrderDetail/orderLogs.vue +0 -53
  110. package/packages/BnOrderDetail/showSubForm/index.vue +0 -41
  111. package/packages/BnOrderDetail/showSubForm/showChildTable.vue +0 -61
  112. package/packages/BnOrderDetail/showSubForm/showTimeLine.vue +0 -131
  113. package/packages/BnOrderDetail/showSubForm/tableCellCopy.vue +0 -84
  114. package/packages/BnOrderShare/index.vue +0 -378
  115. package/packages/BnOrderShare/shareUrlInp.vue +0 -54
  116. package/packages/BnRadio/BnRadio.vue +0 -181
  117. package/packages/BnRelation/BnRelation.vue +0 -120
  118. package/packages/BnSelect/BnSelect.vue +0 -485
  119. package/packages/BnSmartForm/BnBatchForm.vue +0 -334
  120. package/packages/BnSmartForm/BnBatchFormDialog.vue +0 -423
  121. package/packages/BnSmartForm/BnSmartElf/elfLog/index.vue +0 -57
  122. package/packages/BnSmartForm/BnSmartElf/index.vue +0 -95
  123. package/packages/BnSmartForm/BnSmartFormPsychic.js +0 -629
  124. package/packages/BnSmartForm/BnSmartFormUtil.js +0 -524
  125. package/packages/BnSmartForm/addressForm/index.vue +0 -73
  126. package/packages/BnSmartForm/checkboxForm/index.vue +0 -99
  127. package/packages/BnSmartForm/childrenForm/childFormFile.vue +0 -237
  128. package/packages/BnSmartForm/childrenForm/childrenFormBody.vue +0 -260
  129. package/packages/BnSmartForm/childrenForm/index.vue +0 -110
  130. package/packages/BnSmartForm/childrenForm/searchInventory.vue +0 -115
  131. package/packages/BnSmartForm/chooseAssocTable/chooseAssocTable.vue +0 -451
  132. package/packages/BnSmartForm/chooseAssocTable/chooseChildGood.vue +0 -229
  133. package/packages/BnSmartForm/chooseAssocTable/tableCellCopy.vue +0 -84
  134. package/packages/BnSmartForm/chooseChildOrder/chooseChildOrder.vue +0 -158
  135. package/packages/BnSmartForm/chooseIPaasData/chooseIPaasData.vue +0 -307
  136. package/packages/BnSmartForm/chooseIPaasData/tableCellCopy.vue +0 -84
  137. package/packages/BnSmartForm/choosePackage/choosePackage.vue +0 -361
  138. package/packages/BnSmartForm/dateDualForm/index.vue +0 -37
  139. package/packages/BnSmartForm/dateForm/index.vue +0 -38
  140. package/packages/BnSmartForm/fileForm/fileFormData.js +0 -50
  141. package/packages/BnSmartForm/fileForm/index.vue +0 -240
  142. package/packages/BnSmartForm/formItemFooter/formItemFooter.vue +0 -38
  143. package/packages/BnSmartForm/formItemTop/formItemTop.vue +0 -42
  144. package/packages/BnSmartForm/index.vue +0 -1201
  145. package/packages/BnSmartForm/numberForm/index.vue +0 -63
  146. package/packages/BnSmartForm/radioForm/index.vue +0 -72
  147. package/packages/BnSmartForm/receiveForm/index.vue +0 -112
  148. package/packages/BnSmartForm/relationForm/index.vue +0 -82
  149. package/packages/BnSmartForm/scoreForm/index.vue +0 -39
  150. package/packages/BnSmartForm/selectForm/index.vue +0 -55
  151. package/packages/BnSmartForm/showValForm/index.vue +0 -42
  152. package/packages/BnSmartForm/showValForm/showValFormTable.vue +0 -104
  153. package/packages/BnSmartForm/smartFormsCommon.scss +0 -43
  154. package/packages/BnSmartForm/stringForm/index.vue +0 -170
  155. package/packages/BnVirtPopover/index.vue +0 -319
  156. package/packages/BnWebLog/BnWebLog.vue +0 -140
  157. package/packages/BnWorkSettingDrop/advancedOptions.js +0 -112
  158. package/packages/BnWorkSettingDrop/benBenAIUtil.js +0 -89
  159. package/packages/BnWorkSettingDrop/index.vue +0 -292
  160. package/packages/font/iconfont.css +0 -243
  161. package/packages/font/iconfont.ttf +0 -0
  162. package/packages/font/iconfont.woff +0 -0
  163. package/packages/font/iconfont.woff2 +0 -0
  164. package/utils/addressParse-old.js +0 -645
  165. package/utils/addressParse.js +0 -735
  166. package/utils/config.js +0 -68
  167. package/utils/index.js +0 -1171
@@ -1,120 +0,0 @@
1
- <!--
2
- 具有级联属性的条件设置,入联动组件、地址组件
3
- 参数列表:
4
- 选传: collapseTags:Boolean //多选模式下是否折叠Tag
5
- 选传: disabled:Boolean //是否禁止输入
6
- 选传: propsParams:{} //级联配置
7
- 选传: clearable:Boolean //是否支持清空选项
8
- 选传: filterable:Boolean //是否支持筛选
9
- 选传: showAllLevels:Boolean //输入框中是否显示选中值的完整路径/物流需求:联动组件必须选到最后一级
10
-
11
- -->
12
- <template>
13
- <el-cascader :size="size" popper-class="bnRelation" ref="cascader" v-model="value" :placeholder="placeholder"
14
- :options="options" :props="relationProps" @visible-change="visibleChange" :filterable="filterable"
15
- :collapse-tags="collapseTags" :separator="separator" :disabled="disabled"
16
- :clearable="clearable" :show-all-levels="showAllLevels">
17
- </el-cascader>
18
- </template>
19
-
20
- <script>
21
- export default {
22
- name: "bnRelation",
23
- props: {
24
- // value数据绑定
25
- modelValue: [Array],
26
- // size大小
27
- size: String,
28
- // 联动选项列表默认层级嵌套[{label,value,children:[]}]
29
- options: {
30
- type: Array,
31
- default() {
32
- return []
33
- }
34
- },
35
- // 是否多选
36
- multiple: Boolean,
37
- // 可以选择任意层级
38
- checkStrictly: Boolean,
39
- // 级联数据对象结构
40
- optionProps: Object,
41
- // 联动组件的配置项
42
- props: {
43
- type: Object,
44
- },
45
- // 收起展示选中的数据
46
- collapseTags: {
47
- type: Boolean,
48
- default: true
49
- },
50
- // 禁用
51
- disabled: {
52
- type: Boolean,
53
- default: false
54
- },
55
- // 可清空
56
- clearable: {
57
- type: Boolean,
58
- default: true
59
- },
60
- // 可清空
61
- filterable: {
62
- type: Boolean,
63
- default: false
64
- },
65
- // 选择框中是否展示完整路径
66
- showAllLevels: {
67
- type: Boolean,
68
- default: true
69
- },
70
- // 分隔符
71
- separator: {default: '-'},
72
- //提示
73
- placeholder: {
74
- type: String,
75
- default: '请选择'
76
- },
77
- },
78
- data() {
79
- return {
80
- }
81
- },
82
- methods: {
83
- /**
84
- * 打开关闭弹框
85
- * */
86
- visibleChange(e) {
87
- if (!e) {
88
- this.$emit("update:modelValue", this.value);
89
- }
90
- this.$emit('visibleChange', e)
91
- },
92
- },
93
- computed: {
94
- // select的value
95
- value: {
96
- get() {
97
- return this.modelValue || []
98
- },
99
- set(v) {
100
- this.$emit("update:modelValue", v);
101
- },
102
- },
103
- // 属性配置
104
- relationProps() {
105
- return {
106
- ...this.props,
107
- ...this.optionProps,
108
- multiple: this.multiple || this.props?.multiple,
109
- checkStrictly: this.checkStrictly || this.props?.checkStrictly,
110
- };
111
- }
112
- },
113
- }
114
- </script>
115
-
116
- <style>
117
- .bnRelation .el-scrollbar__wrap {
118
- max-height: 300px;
119
- }
120
- </style>
@@ -1,485 +0,0 @@
1
- <template>
2
- <el-select v-model="val" :placeholder="placeholder" filterable reserveKeyword ref="selectRef"
3
- :value-on-clear="''" @visible-change="openChange" :no-data-text="noDataText"
4
- :value-key="optionProps.value" :multiple="multiple" :collapseTags="collapseTags"
5
- :collapse-tags-tooltip="collapseTagsTooltip" @popup-scroll="scrollMore"
6
- :max-collapse-tags="maxCollapseTags"
7
- :multipleLimit="multipleLimit" :filter-method="filterMethod"
8
- :props="optionProps" :size="size" :disabled="disabled" :clearable="clearable">
9
- <el-option v-for="item in temporaryOption"
10
- :value="labelInValue?item:item[optionProps.value]"
11
- :key="`temporary-${item[optionProps.value]}`" v-show="false"
12
- :label="item[optionProps.label]"></el-option>
13
- <el-option v-for="item in optionList" :key="item[optionProps.value]" :label="item[optionProps.label]"
14
- :disabled="item.disabled"
15
- :value="labelInValue?item:item[optionProps.value]"/>
16
- <div class="emptyLoading" v-show="loading">加载中</div>
17
- <div class="w-text-center w-padding-tb10 w-color-gray" v-show="!loading && optionList.length == 0">未搜索到数据
18
- </div>
19
- <template #footer v-if="multiple && checkedAll">
20
- <div class="bnDrop-body-footer w-flex-center">
21
- <BnCheck :true-data="999" :is-checked="isCheckedAll" @click="checkAll">
22
- <div class="w-flex-center w-flex-column-gap4 w-text-over w-font14 w-color-black6">
23
- <span class="w-margin-left4">{{ !val || val?.length == 0 ? '全选' : `已选${val?.length}项` }}</span>
24
- <span class="">已加载{{ optionList.length }}/{{ total }}项</span>
25
- </div>
26
- </BnCheck>
27
- </div>
28
- </template>
29
- </el-select>
30
- </template>
31
-
32
- <script>
33
- import {cloneDeep, debounce, isEmpty} from "lodash";
34
-
35
- export default {
36
- name: "BnSelect",
37
- props: {
38
- //最终选中的value
39
- modelValue: {},
40
- //选项列表
41
- options: {
42
- type: Array,
43
- default: function () {
44
- return []
45
- }
46
- },
47
- // 占位符
48
- placeholder: {
49
- type: String,
50
- default: "请选择"
51
- },
52
- // option基础结构
53
- optionProps: {
54
- default() {
55
- return {
56
- value: 'id',
57
- label: 'title'
58
- };
59
- }
60
- },
61
- // 输入框尺寸
62
- size: {},
63
- // 是否禁用
64
- disabled: Boolean,
65
- // 是否可以清空选项
66
- clearable: {
67
- type: Boolean,
68
- default: true
69
- },
70
- // 支持外部查询的方法,使用者传进来
71
- postFunc: Function,
72
- // 搜索的请求参数
73
- postData: {
74
- type: Object,
75
- default() {
76
- return {}
77
- }
78
- },
79
- // 通过外部传入的链接进行参数请求
80
- pathUrl: {
81
- type: String,
82
- default: ''
83
- },
84
- // 查询条件列表的key名 内部数据源且分页情况下才有用
85
- searchKey: {
86
- type: String,
87
- default: 'condition'
88
- },
89
- // 无数据提示
90
- noDataText: {
91
- type: String,
92
- default: '无数据'
93
- },
94
- // 搜索是否是分页
95
- isPage: {
96
- type: Boolean,
97
- default: true
98
- },
99
- // 分页器参数配置
100
- pageProps: {
101
- default() {
102
- return {
103
- pageNum: 'pageNum',
104
- pageSize: 'pageSize',
105
- };
106
- }
107
- },
108
- // 是否多选
109
- multiple: Boolean,
110
- // 多选时用户最多可以选择的项目数,为 0 则不限制
111
- multipleLimit: {
112
- type: Number,
113
- default: 0
114
- },
115
- // 多选时是否将选中值收起展示
116
- collapseTags: {
117
- type: Boolean,
118
- default: true
119
- },
120
- // 收起时默认展示几个tag
121
- maxCollapseTags: {
122
- type: Number,
123
- default: 1
124
- },
125
- // 鼠标悬浮展示所有收起的内容
126
- collapseTagsTooltip: {
127
- type: Boolean,
128
- default: false
129
- },
130
- checkedAll: {// 是否支持全选
131
- type: Boolean,
132
- default: true
133
- },
134
- // 在返回选项时,是否将 label 和 value 一并返回
135
- labelInValue: {
136
- type: Boolean,
137
- default: true
138
- },
139
- // 数据结构,当labelInValue=true时,返回的对象中都需要那些字段。不传就返回全部
140
- valueProps: {
141
- type: Array,
142
- },
143
- // 是否在组件初始化的时候加载options,反之在打开弹框时加载
144
- isInitOptions: {
145
- type: Boolean,
146
- default: true
147
- },
148
- // 是否将value以json字符串形式与外部交互
149
- valueToJson: {
150
- type: Boolean,
151
- default: false
152
- },
153
- },
154
- data() {
155
- return {
156
- // 是否加载过options
157
- isInit: false,
158
- // 加载动画
159
- loading: false,
160
- // 查询
161
- queryValue: '',
162
- // 分页信息
163
- pageData: {
164
- pageNum: 1,
165
- pageSize: 20
166
- },
167
- // 总长度
168
- total: 0,
169
- // 接口远程获取的options
170
- remoteOptions: [],
171
- // 静态下拉列表,前端分页
172
- staticOptions: [],
173
- };
174
- },
175
- mounted() {
176
- if (this.isInitOptions) {
177
- this.initRemote();
178
- }
179
- },
180
- watch: {
181
- // 监控选项变化
182
- options: {
183
- handler(newVal) {
184
- // 重新计算总数
185
- this.total = newVal.length;
186
- // 如果总数大于 40,进行分页
187
- if (this.total > 40 && !this.pathUrl) {
188
- this.pageData.pageNum = 1; // 重置页码
189
- this.staticOptions = this.catchPage(); // 重新计算分页
190
- } else {
191
- // 否则直接赋值
192
- this.staticOptions = [...newVal];
193
- }
194
- },
195
- deep: true, // 深度监听
196
- immediate: true, // 组件初始化时立即执行
197
- },
198
- postData:{
199
- handler(n,o) {
200
- this.initRemote()
201
- },
202
- deep: true,
203
- }
204
- },
205
- methods: {
206
- /**
207
- * 初始化远程数据
208
- * */
209
- initRemote() {
210
- if (this.pathUrl) {
211
- this.pageData.pageNum = 1;
212
- this.remoteOptions = []
213
- this.isInit = true;
214
- this.loadOptions()
215
- }
216
- },
217
- /**
218
- * 下拉框打开关闭
219
- * */
220
- openChange(e) {
221
- // 打开弹框时
222
- // 设置了远程获取选项
223
- // 并且设置了点击弹框再初始化选项
224
- // 并且没有被初始化过,
225
- if (e && this.pathUrl && (!this.isInit || !this.isInitOptions)) {
226
- // 初始化远程数据
227
- this.initRemote()
228
- }
229
- },
230
- /**
231
- * 多选时判断全部选中
232
- * */
233
- isCheckedAll() {
234
- let val = this.val || []
235
- let option = this.optionList.map(i => i[this.optionProps.value])
236
-
237
- if (this.labelInValue) {
238
- val = this.val ? this.val.map(i => i[this.optionProps.value]) : []
239
- }
240
-
241
- // 长度不同或为空,直接返回 false
242
- if (option.length !== val.length || option.length === 0) {
243
- return false;
244
- }
245
-
246
- // 使用 Set 优化性能:将 val 转为 Set,has() 查找是 O(1),比 includes() 的 O(n) 快很多
247
- const valSet = new Set(val);
248
- return option.every(item => valSet.has(item));
249
- },
250
- /**
251
- * 全选/取消全选
252
- * */
253
- checkAll() {
254
- // 判断当前是否全选
255
- const isAllChecked = this.isCheckedAll();
256
-
257
- if (isAllChecked) {
258
- // 如果已经全选,则取消全选
259
- this.val = [];
260
- } else {
261
- // 如果未全选,则全选当前已加载的所有选项
262
- if (this.labelInValue) {
263
- // labelInValue 为 true 时,返回完整的对象数组
264
- this.val = [...this.optionList];
265
- } else {
266
- // labelInValue 为 false 时,只返回 value 数组
267
- this.val = this.optionList.map(i => i[this.optionProps.value]);
268
- }
269
- }
270
- },
271
- /**
272
- * 滚动加载
273
- * */
274
- scrollMore: debounce(function (e) {
275
- let scrollTop = 0;
276
- try {
277
- scrollTop = this.$refs.selectRef.popperRef.querySelector('.el-select-dropdown__wrap').scrollTop-50;
278
- }catch (e) {
279
- console.log('未获取到select的列表DOM')
280
- }
281
- if (this.optionList.length < this.total && !this.loading && e.scrollTop>0 && e.scrollTop>scrollTop) {
282
- // 远程获取
283
- if (this.pathUrl) {
284
- if (this.isPage) {
285
- this.pageData.pageNum++;
286
- this.loadOptions();
287
- }
288
- } else {
289
- // 本地分页
290
- this.pageData.pageNum++;
291
- this.staticOptions = [...this.staticOptions, ...this.catchPage()]
292
- }
293
- }
294
- }, 500),
295
- /**
296
- * 快速搜索选项
297
- * @param {String} val 搜索的值
298
- */
299
- filterMethod: debounce(function (val) {
300
- if (this.queryValue != val) {
301
- this.queryValue = val;
302
- // 选项列表被初始化过
303
- this.pageData.pageNum = 1;
304
- if (this.pathUrl && this.isPage) {
305
- this.loadOptions();
306
- }
307
- }
308
- }, 500),
309
- /**
310
- * 远程加载options
311
- * @param Object post 组件外部传入的筛选条件
312
- * */
313
- loadOptions() {
314
- if (!this.postFunc) {
315
- console.log("selectPro:没有远程调用的方法")
316
- this.loading = false;
317
- return false;
318
- }
319
- this.loading = true;
320
- let postData = cloneDeep(this.postData);
321
- // 查询条件列表的key名 内部数据源且分页情况下才有用
322
- postData[this.searchKey] = this.queryValue;
323
- if (this.isPage) {
324
- postData[this.pageProps.pageNum] = this.pageData.pageNum;
325
- postData[this.pageProps.pageSize] = this.pageData.pageSize;
326
- }
327
- this.postFunc(this.pathUrl, postData).then(res => {
328
- this.loading = false;
329
- if (!res.code && res.data) {
330
- // 计算静态列表搜索后的长度
331
- let staticLength = 0
332
- if(this.queryValue && this.options?.length>0){
333
- let s = this.options.filter(item => item[this.optionProps.label].indexOf(this.queryValue) > -1);
334
- staticLength = s?s.length:0
335
- }
336
- if (this.isPage) {
337
- this.total = res.data.total + staticLength;
338
- let list = res.data.results || []
339
- let arr = list.map(i => {
340
- let opt = {...i}
341
- if (!i[this.optionProps.value] && i.id) {
342
- opt[this.optionProps.value] = i.id
343
- }
344
- return opt
345
- });
346
- if (this.pageData.pageNum == 1) {
347
- this.remoteOptions = [...arr]
348
- } else {
349
- this.remoteOptions = [...this.remoteOptions, ...arr]
350
- }
351
- } else {
352
- this.remoteOptions = res.data.map(i => {
353
- let opt = {...i}
354
- if (!i[this.optionProps.value] && i.id) {
355
- opt[this.optionProps.value] = i.id
356
- }
357
- return opt
358
- });
359
- this.total = this.remoteOptions.length + staticLength;
360
- }
361
- } else {
362
- // 请求失败,下次进来重新继续请求
363
- this.isInit = false;
364
- this.remoteOptions = []
365
- this.total = 0
366
- this.pageData.pageNum = 1
367
- }
368
- })
369
- },
370
- /**
371
- * 前端手动分页
372
- * */
373
- catchPage(page) {
374
- this.loading = true
375
- this.pageData.pageNum = page || this.pageData.pageNum;
376
- let start = (this.pageData.pageNum - 1) * this.pageData.pageSize;
377
- let end = this.pageData.pageNum * this.pageData.pageSize;
378
- let setTime = setTimeout(() => {
379
- this.loading = false
380
- clearTimeout(setTime)
381
- setTime = null;
382
- }, 300)
383
- return this.options.slice(start, end);
384
- },
385
- /**
386
- * 如果value是对象,然会value的时候把对象组装好再返回。
387
- * */
388
- getValObj(val) {
389
- if (this.valueProps) {
390
- let obj = {};
391
- this.valueProps.forEach(key => {
392
- obj[key] = val[key];
393
- });
394
- return obj
395
- } else {
396
- return val;
397
- }
398
- },
399
- },
400
- computed: {
401
- // select的value
402
- val: {
403
- get() {
404
- let value = this.modelValue;
405
- if (this.valueToJson && value != null && value !== '') {
406
- try {
407
- value = typeof value === 'string' ? JSON.parse(value) : value;
408
- } catch (e) {
409
- value = this.multiple ? [] : null;
410
- }
411
- }
412
- // value为空 处理为null
413
- if (this.labelInValue && isEmpty(value)) {
414
- return null;
415
- } else {
416
- // value不为空,但是多选缺传入了其他类型,处理为[]
417
- if (this.multiple && !Array.isArray(value)) {
418
- return []
419
- }
420
- // 其他情况直接返回value
421
- return value
422
- }
423
- },
424
- set(v) {
425
- let result;
426
- if (this.labelInValue) {
427
- if (this.multiple) {
428
- result = v.map(item => {
429
- return this.getValObj(item)
430
- })
431
- } else {
432
- result = this.getValObj(v)
433
- }
434
- } else {
435
- result = v;
436
- }
437
- this.$emit("update:modelValue", this.valueToJson ? JSON.stringify(result) : result);
438
- },
439
- },
440
- // 最终展示的下拉列表
441
- optionList: {
442
- get() {
443
- let options = [...this.staticOptions, ...this.remoteOptions];
444
- if (this.queryValue) {
445
- options = [...this.options, ...this.remoteOptions].filter(item => item[this.optionProps.label].indexOf(this.queryValue) > -1)
446
- }
447
- return options;
448
- },
449
- set(val) {
450
- return val;
451
- }
452
- },
453
- // 隐藏展示的下拉列表
454
- temporaryOption: {
455
- get() {
456
- if (!isEmpty(this.modelValue)) {
457
- if (this.labelInValue) {
458
- let values = Array.isArray(this.modelValue) ? this.modelValue : [this.modelValue];
459
- return values.filter(item => !this.optionList.some(option =>
460
- option[this.optionProps.value] === (this.labelInValue ? item[this.optionProps.value] : item)
461
- ));
462
- } else if (this.options && this.options.length) {
463
- return this.options.filter(item => this.modelValue.includes(item[this.optionProps.value]));
464
- }
465
- } else {
466
- return []
467
- }
468
- },
469
- set(val) {
470
- return val;
471
- }
472
- },
473
- },
474
- }
475
- </script>
476
-
477
- <style scoped lang="scss">
478
- .emptyLoading {
479
- height: 32px;
480
- line-height: 32px;
481
- color: #888;
482
- font-size: 12px;
483
- text-align: center;
484
- }
485
- </style>