@wp1001/ui 2.9.13 → 3.0.0
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/@vant-D4fmGxs6.js +1 -3891
- package/index.html +28 -0
- package/index.js +1 -8419
- package/lib/tinymce/zh_CN.js +1 -0
- package/package.json +1 -1
- package/packages/assets/devtools-detector.js +1 -2
- package/packages/components/xarray/index.js +1 -64
- package/packages/components/xautorows/index.js +1 -35
- package/packages/components/xbutton/mobile.js +1 -3
- package/packages/components/xbutton/pc.js +1 -3
- package/packages/components/xbuttons/mobile.js +1 -51
- package/packages/components/xbuttons/pc.js +1 -51
- package/packages/components/xchart/constants.js +1 -58
- package/packages/components/xchart/index.js +1 -263
- package/packages/components/xchart/utils.js +1 -121
- package/packages/components/xcheckboxs/mobile.js +1 -58
- package/packages/components/xcheckboxs/pc.js +1 -49
- package/packages/components/xcol/mobile.js +1 -10
- package/packages/components/xcol/pc.js +1 -10
- package/packages/components/xdatepicker/mobile.js +1 -71
- package/packages/components/xdatepicker/pc.js +1 -9
- package/packages/components/xdialog/mobile.js +1 -60
- package/packages/components/xdialog/pc.js +1 -64
- package/packages/components/xdict/index.js +1 -47
- package/packages/components/xdistrictselect/mobile.js +1 -79
- package/packages/components/xdistrictselect/pc.js +1 -127
- package/packages/components/xform/mobile.js +1 -29
- package/packages/components/xform/pc.js +1 -42
- package/packages/components/xform/utils.js +1 -95
- package/packages/components/xformitem/mobile.js +1 -56
- package/packages/components/xformitem/pc.js +1 -72
- package/packages/components/xicon/mobile.js +1 -35
- package/packages/components/xicon/pc.js +1 -35
- package/packages/components/xinfo/index.js +1 -100
- package/packages/components/xlooper/index.js +1 -7
- package/packages/components/xpagination/mobile.js +1 -21
- package/packages/components/xpagination/pc.js +1 -21
- package/packages/components/xpicker/index.js +1 -38
- package/packages/components/xradios/mobile.js +1 -40
- package/packages/components/xradios/pc.js +1 -53
- package/packages/components/xrow/mobile.js +1 -9
- package/packages/components/xrow/pc.js +1 -9
- package/packages/components/xscan/mobile.js +1 -24
- package/packages/components/xscan/pc.js +1 -20
- package/packages/components/xsearcher/index.js +1 -198
- package/packages/components/xselect/mobile.js +1 -86
- package/packages/components/xselect/pc.js +1 -114
- package/packages/components/xselect/util.js +1 -66
- package/packages/components/xselectv2/index.js +1 -91
- package/packages/components/xtable/mobile.js +1 -108
- package/packages/components/xtable/pc.js +1 -143
- package/packages/components/xtable/searcher.js +1 -477
- package/packages/components/xtable/settings.js +1 -80
- package/packages/components/xtable/utils.js +1 -692
- package/packages/components/xtabletools/mobile.js +1 -25
- package/packages/components/xtabletools/pc.js +1 -18
- package/packages/components/xtablev2/index.js +1 -53
- package/packages/components/xtags/mobile.js +1 -17
- package/packages/components/xtags/pc.js +1 -17
- package/packages/components/xtinymce/index.js +1 -71
- package/packages/components/xuploader/xfileuploader.js +1 -48
- package/packages/components/xuploader/ximageuploader.js +1 -53
- package/packages/comps.js +1 -108
- package/packages/controllers/BaseController.js +1 -125
- package/packages/controllers/CrudController.js +1 -907
- package/packages/controllers/TempCrudController.js +1 -32
- package/packages/controllers/index.js +1 -15
- package/packages/directives/el-table-infinite-scroll.js +1 -55
- package/packages/directives/index.js +1 -5
- package/packages/index.js +1 -81
- package/packages/layout/breadcrumb/index.js +1 -41
- package/packages/layout/header/inner.js +1 -11
- package/packages/layout/screenlock/index.js +1 -129
- package/packages/layout/sidebar/item.js +1 -16
- package/packages/layout/sidebar/menu.js +1 -72
- package/packages/layout/tagsview/ScrollPane.js +1 -65
- package/packages/layout/tagsview/index.js +1 -169
- package/packages/plop/actions/make-fill-admin-partials-action.js +1 -95
- package/packages/plop/generators/make-admin-page.js +1 -39
- package/packages/plop/generators/make-database-admin-pages.js +1 -84
- package/packages/plop/generators/make-page-generator.js +1 -52
- package/packages/plop/generators/make-simple-page.js +1 -20
- package/packages/plop/plopfile.js +1 -24
- package/packages/plop/utils/index.js +1 -168
- package/packages/plop/utils/plop-utils.js +1 -86
- package/packages/utils/crypt.js +1 -24
- package/packages/utils/decorators.js +1 -67
- package/packages/utils/disallowDevtools.js +1 -53
- package/packages/utils/effects.js +1 -173
- package/packages/utils/funcs.js +1 -78
- package/packages/utils/index.js +1 -95
- package/packages/utils/message.js +1 -110
- package/packages/utils/middlewares.js +1 -86
- package/packages/utils/model.js +1 -71
- package/packages/utils/modelUtils.js +1 -203
- package/packages/utils/request.js +1 -57
- package/packages/utils/site.js +1 -33
- package/packages/vite-plugins.js +1 -141
- package/src/App.vue +134 -0
- package/src/main.js +1 -0
- package/src/request.js +1 -0
- package/style.css +1 -0
- package/vite.config.js +1 -0
- package/vite.lib.config.js +1 -0
- package/.env +0 -6
|
@@ -1,198 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { highdict } = StardustJs
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'XSearcher',
|
|
7
|
-
props: {
|
|
8
|
-
modelName: String,
|
|
9
|
-
params: Object,
|
|
10
|
-
titles: String | Array,
|
|
11
|
-
subTitles: String | Array,
|
|
12
|
-
header: Array,
|
|
13
|
-
operatesWidth: {
|
|
14
|
-
type: Number,
|
|
15
|
-
default: 80
|
|
16
|
-
},
|
|
17
|
-
modelValue: Boolean | Number | String | Array,
|
|
18
|
-
multiple: Boolean,
|
|
19
|
-
clearable: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: true
|
|
22
|
-
},
|
|
23
|
-
value: String,
|
|
24
|
-
title: String,
|
|
25
|
-
width: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: '660px'
|
|
28
|
-
},
|
|
29
|
-
fullscreen: Boolean,
|
|
30
|
-
hideSearcher: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: false
|
|
33
|
-
},
|
|
34
|
-
readonly: Boolean,
|
|
35
|
-
disabled: Boolean,
|
|
36
|
-
placeholder: String,
|
|
37
|
-
searcherPlaceholder: String,
|
|
38
|
-
emptyText: String,
|
|
39
|
-
formatTitle: Function,
|
|
40
|
-
formatSubTitle: Function
|
|
41
|
-
},
|
|
42
|
-
emits: ['update:modelValue', 'change', 'select'],
|
|
43
|
-
computed: {
|
|
44
|
-
_placeholder () {
|
|
45
|
-
return this.placeholder?.replace('输入', '选择') || '请选择'
|
|
46
|
-
},
|
|
47
|
-
_titles () {
|
|
48
|
-
return [this.titles].flat().filter(k => k)
|
|
49
|
-
},
|
|
50
|
-
_subTitles () {
|
|
51
|
-
return [this.subTitles].flat().filter(k => k)
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
data () {
|
|
55
|
-
return {
|
|
56
|
-
visible: false,
|
|
57
|
-
loading: false,
|
|
58
|
-
keywords: '',
|
|
59
|
-
list: []
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
watch: {
|
|
63
|
-
modelValue: {
|
|
64
|
-
immediate: true,
|
|
65
|
-
handler (value) {
|
|
66
|
-
value && this.provide?.resetValidation()
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
created () {
|
|
71
|
-
if (window.isMobile) {
|
|
72
|
-
injectVanFieldProvide(this)
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
methods: {
|
|
76
|
-
handleFocus (e) {
|
|
77
|
-
e.target.blur()
|
|
78
|
-
},
|
|
79
|
-
handleClear () {
|
|
80
|
-
if (this.readonly) return
|
|
81
|
-
const value = this.multiple ? [] : null
|
|
82
|
-
this.$emit('update:modelValue', value)
|
|
83
|
-
this.$emit('change', value)
|
|
84
|
-
this.$emit('select', value, value)
|
|
85
|
-
},
|
|
86
|
-
handleShow () {
|
|
87
|
-
if (this.readonly) return
|
|
88
|
-
this.visible = true
|
|
89
|
-
this.handleSearch()
|
|
90
|
-
},
|
|
91
|
-
async handleSearch () {
|
|
92
|
-
if (this.loading) return
|
|
93
|
-
this.loading = true
|
|
94
|
-
this.list = await (this.$attrs.search || this.search)(this.modelValue, this.keywords, this.list)
|
|
95
|
-
this.loading = false
|
|
96
|
-
},
|
|
97
|
-
handleSelect (item, index) {
|
|
98
|
-
if (this.multiple) {
|
|
99
|
-
const values = Array.isArray(this.modelValue) ? this.modelValue : (this.modelValue ? [this.modelValue] : [])
|
|
100
|
-
const value = item[this.value]
|
|
101
|
-
const index = values.indexOf(value)
|
|
102
|
-
if (index >= 0) {
|
|
103
|
-
values.splice(index, 1)
|
|
104
|
-
} else {
|
|
105
|
-
values.push(value)
|
|
106
|
-
}
|
|
107
|
-
this.$emit('update:modelValue', values)
|
|
108
|
-
this.$emit('change', values)
|
|
109
|
-
this.$emit('select', values, values.map(v => this.list.find(e => e[this.value] === v)))
|
|
110
|
-
return
|
|
111
|
-
}
|
|
112
|
-
if (this.modelValue === item[this.value]) {
|
|
113
|
-
this.handleClear()
|
|
114
|
-
} else {
|
|
115
|
-
this.$emit('update:modelValue', item[this.value])
|
|
116
|
-
this.$emit('change', item[this.value])
|
|
117
|
-
this.$emit('select', item[this.value], item)
|
|
118
|
-
}
|
|
119
|
-
this.visible = false
|
|
120
|
-
},
|
|
121
|
-
async search (modelValue, keywords) {
|
|
122
|
-
const attributes = this._titles.concat(this._subTitles)
|
|
123
|
-
const params = { ...this.params }
|
|
124
|
-
params.page ||= 1
|
|
125
|
-
params.limit ||= 20
|
|
126
|
-
params.attributes ||= attributes.includes(this.value) ? attributes : [...attributes, this.value]
|
|
127
|
-
params.where ||= {}
|
|
128
|
-
const ors = []
|
|
129
|
-
if (this.multiple && !Array.isArray(modelValue)) {
|
|
130
|
-
modelValue = modelValue ? [modelValue] : []
|
|
131
|
-
}
|
|
132
|
-
if (
|
|
133
|
-
modelValue != undefined && modelValue !== ''
|
|
134
|
-
&& !(this.multiple && !modelValue.length)
|
|
135
|
-
) {
|
|
136
|
-
if (this.multiple) {
|
|
137
|
-
ors.push({ [this.value]: { '[Op.in]': modelValue } })
|
|
138
|
-
} else {
|
|
139
|
-
ors.push({ [this.value]: modelValue })
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
keywords = keywords.split(' ').filter(k => k)
|
|
143
|
-
if (keywords.length) {
|
|
144
|
-
attributes.forEach(t => {
|
|
145
|
-
keywords.forEach(k => {
|
|
146
|
-
ors.push({ [t]: { '[Op.like]': `%${k}%` } })
|
|
147
|
-
})
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
delete params.where['[Op.or]']
|
|
151
|
-
if (ors.length) params.where['[Op.or]'] = ors
|
|
152
|
-
const list = await this.service.restful.search(this.modelName, params, 'data')
|
|
153
|
-
if (this.multiple) {
|
|
154
|
-
list.sort((a, b) => modelValue.indexOf(b[this.value]) - modelValue.indexOf(a[this.value]))
|
|
155
|
-
const values = list.map(ele => ele[this.value])
|
|
156
|
-
const leftValues = modelValue.filter(v => !values.includes(v))
|
|
157
|
-
if (leftValues.length) {
|
|
158
|
-
params.where = { [this.value]: { '[Op.in]': leftValues } }
|
|
159
|
-
const items = await this.service.restful.search(this.modelName, params, 'data')
|
|
160
|
-
list.push(...items)
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return list
|
|
164
|
-
},
|
|
165
|
-
calcTitles (item) {
|
|
166
|
-
if (this.formatTitle) return this.formatTitle(item)
|
|
167
|
-
return this._titles.map(key => highdict.get(item, key)).join(' | ')
|
|
168
|
-
},
|
|
169
|
-
calcSubTitles (item) {
|
|
170
|
-
if (this.formatSubTitle) return this.formatSubTitle(item)
|
|
171
|
-
return this._subTitles.map(key => highdict.get(item, key)).join(' | ')
|
|
172
|
-
},
|
|
173
|
-
calcColumns () {
|
|
174
|
-
const props = this.params?.attributes || [...this.titles, ...this.subTitles]
|
|
175
|
-
const columns = this.header.map((label, index) => {
|
|
176
|
-
const column = { prop: props[index], sortable: false }
|
|
177
|
-
if (typeof label === 'object') {
|
|
178
|
-
const { label: _label, ...others } = label
|
|
179
|
-
Object.assign(column, { label: _label, tableAttrs: others })
|
|
180
|
-
} else {
|
|
181
|
-
column.label = label
|
|
182
|
-
}
|
|
183
|
-
if (this.$slots.cell) {
|
|
184
|
-
column.tableAttrs ??= {}
|
|
185
|
-
column.tableAttrs.slot = 'cell'
|
|
186
|
-
}
|
|
187
|
-
return column
|
|
188
|
-
})
|
|
189
|
-
if (this.$slots.right) {
|
|
190
|
-
columns.push({
|
|
191
|
-
label: '操作', prop: 'operates', fixed: 'right', sortable: false,
|
|
192
|
-
tableAttrs: { slot: 'operates', width: this.operatesWidth * 1 }
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
return columns
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
1
|
+
const a42_0x4b3e31=a42_0x24d6;(function(_0x173ded,_0x1caf89){const _0x5b3b9f=a42_0x24d6,_0x57cb56=_0x173ded();while(!![]){try{const _0x5eea96=parseInt(_0x5b3b9f(0x128))/0x1*(parseInt(_0x5b3b9f(0x13c))/0x2)+-parseInt(_0x5b3b9f(0x144))/0x3*(parseInt(_0x5b3b9f(0x14c))/0x4)+parseInt(_0x5b3b9f(0x118))/0x5+-parseInt(_0x5b3b9f(0x14f))/0x6+parseInt(_0x5b3b9f(0x11e))/0x7+parseInt(_0x5b3b9f(0x133))/0x8+parseInt(_0x5b3b9f(0x138))/0x9*(parseInt(_0x5b3b9f(0x142))/0xa);if(_0x5eea96===_0x1caf89)break;else _0x57cb56['push'](_0x57cb56['shift']());}catch(_0x356757){_0x57cb56['push'](_0x57cb56['shift']());}}}(a42_0x22c8,0xcf2c2));import{injectVanFieldProvide}from'../../utils/funcs.js';function a42_0x22c8(){const _0x624082=['operatesWidth','cell','update:modelValue','service','4hcMuJR','modelName','loading','8534394puuynz','get','length','isMobile','[Op.or]','params','find','page','restful','keywords','tableAttrs','split','concat','list','XSearcher','assign','formatTitle','push','provide','1859140AKDCPE','subTitles','search','blur','titles','$emit','2572409bPaTSg','limit','formatSubTitle','$slots','value','right','handleSearch','readonly','visible','$attrs','1639aRvsmo','\x20|\x20','modelValue','_titles','includes','_subTitles','placeholder','handleClear','change','multiple','splice','7236624ZEvhPD','sort','isArray','operates','data','954RnBBrS','flat','请选择','map','302OkEGsY','filter','forEach','indexOf','label','660px','39400pQZgjj','select','114135dFITLA','where','attributes','join'];a42_0x22c8=function(){return _0x624082;};return a42_0x22c8();}const {highdict}=StardustJs;function a42_0x24d6(_0x396177,_0x3f9737){const _0x22c852=a42_0x22c8();return a42_0x24d6=function(_0x24d6dc,_0x1a0eb6){_0x24d6dc=_0x24d6dc-0x118;let _0x18476d=_0x22c852[_0x24d6dc];return _0x18476d;},a42_0x24d6(_0x396177,_0x3f9737);}export default{'name':a42_0x4b3e31(0x15d),'props':{'modelName':String,'params':Object,'titles':String|Array,'subTitles':String|Array,'header':Array,'operatesWidth':{'type':Number,'default':0x50},'modelValue':Boolean|Number|String|Array,'multiple':Boolean,'clearable':{'type':Boolean,'default':!![]},'value':String,'title':String,'width':{'type':String,'default':a42_0x4b3e31(0x141)},'fullscreen':Boolean,'hideSearcher':{'type':Boolean,'default':![]},'readonly':Boolean,'disabled':Boolean,'placeholder':String,'searcherPlaceholder':String,'emptyText':String,'formatTitle':Function,'formatSubTitle':Function},'emits':[a42_0x4b3e31(0x14a),a42_0x4b3e31(0x130),a42_0x4b3e31(0x143)],'computed':{'_placeholder'(){const _0x2be109=a42_0x4b3e31;return this[_0x2be109(0x12e)]?.['replace']('输入','选择')||_0x2be109(0x13a);},'_titles'(){const _0x5a6855=a42_0x4b3e31;return[this[_0x5a6855(0x11c)]][_0x5a6855(0x139)]()[_0x5a6855(0x13d)](_0x582030=>_0x582030);},'_subTitles'(){const _0x40f8fb=a42_0x4b3e31;return[this[_0x40f8fb(0x119)]][_0x40f8fb(0x139)]()[_0x40f8fb(0x13d)](_0x1488e2=>_0x1488e2);}},'data'(){return{'visible':![],'loading':![],'keywords':'','list':[]};},'watch':{'modelValue':{'immediate':!![],'handler'(_0x23ad6e){const _0x1825ee=a42_0x4b3e31;_0x23ad6e&&this[_0x1825ee(0x161)]?.['resetValidation']();}}},'created'(){const _0x15927f=a42_0x4b3e31;window[_0x15927f(0x152)]&&injectVanFieldProvide(this);},'methods':{'handleFocus'(_0xda2206){const _0x4f7962=a42_0x4b3e31;_0xda2206['target'][_0x4f7962(0x11b)]();},'handleClear'(){const _0x48db74=a42_0x4b3e31;if(this[_0x48db74(0x125)])return;const _0x5a6874=this[_0x48db74(0x131)]?[]:null;this[_0x48db74(0x11d)](_0x48db74(0x14a),_0x5a6874),this[_0x48db74(0x11d)](_0x48db74(0x130),_0x5a6874),this[_0x48db74(0x11d)]('select',_0x5a6874,_0x5a6874);},'handleShow'(){const _0x3db250=a42_0x4b3e31;if(this[_0x3db250(0x125)])return;this[_0x3db250(0x126)]=!![],this[_0x3db250(0x124)]();},async 'handleSearch'(){const _0x27fbc7=a42_0x4b3e31;if(this[_0x27fbc7(0x14e)])return;this[_0x27fbc7(0x14e)]=!![],this[_0x27fbc7(0x15c)]=await(this[_0x27fbc7(0x127)][_0x27fbc7(0x11a)]||this[_0x27fbc7(0x11a)])(this[_0x27fbc7(0x12a)],this[_0x27fbc7(0x158)],this[_0x27fbc7(0x15c)]),this[_0x27fbc7(0x14e)]=![];},'handleSelect'(_0xa1781e,_0x39e5ad){const _0x7c90d5=a42_0x4b3e31;if(this[_0x7c90d5(0x131)]){const _0x523d16=Array[_0x7c90d5(0x135)](this[_0x7c90d5(0x12a)])?this[_0x7c90d5(0x12a)]:this[_0x7c90d5(0x12a)]?[this[_0x7c90d5(0x12a)]]:[],_0x31b026=_0xa1781e[this[_0x7c90d5(0x122)]],_0x37465a=_0x523d16[_0x7c90d5(0x13f)](_0x31b026);_0x37465a>=0x0?_0x523d16[_0x7c90d5(0x132)](_0x37465a,0x1):_0x523d16[_0x7c90d5(0x160)](_0x31b026);this[_0x7c90d5(0x11d)](_0x7c90d5(0x14a),_0x523d16),this['$emit'](_0x7c90d5(0x130),_0x523d16),this[_0x7c90d5(0x11d)]('select',_0x523d16,_0x523d16[_0x7c90d5(0x13b)](_0x70d2a1=>this[_0x7c90d5(0x15c)][_0x7c90d5(0x155)](_0x5fa1a1=>_0x5fa1a1[this[_0x7c90d5(0x122)]]===_0x70d2a1)));return;}this['modelValue']===_0xa1781e[this[_0x7c90d5(0x122)]]?this[_0x7c90d5(0x12f)]():(this[_0x7c90d5(0x11d)](_0x7c90d5(0x14a),_0xa1781e[this['value']]),this[_0x7c90d5(0x11d)](_0x7c90d5(0x130),_0xa1781e[this['value']]),this[_0x7c90d5(0x11d)]('select',_0xa1781e[this[_0x7c90d5(0x122)]],_0xa1781e)),this[_0x7c90d5(0x126)]=![];},async 'search'(_0x2e04f2,_0x2dff34){const _0x41a602=a42_0x4b3e31,_0x258b13=this[_0x41a602(0x12b)][_0x41a602(0x15b)](this[_0x41a602(0x12d)]),_0x258590={...this[_0x41a602(0x154)]};_0x258590[_0x41a602(0x156)]||=0x1,_0x258590[_0x41a602(0x11f)]||=0x14,_0x258590[_0x41a602(0x146)]||=_0x258b13[_0x41a602(0x12c)](this['value'])?_0x258b13:[..._0x258b13,this[_0x41a602(0x122)]],_0x258590[_0x41a602(0x145)]||={};const _0x327ab4=[];this[_0x41a602(0x131)]&&!Array[_0x41a602(0x135)](_0x2e04f2)&&(_0x2e04f2=_0x2e04f2?[_0x2e04f2]:[]);_0x2e04f2!=undefined&&_0x2e04f2!==''&&!(this[_0x41a602(0x131)]&&!_0x2e04f2['length'])&&(this[_0x41a602(0x131)]?_0x327ab4[_0x41a602(0x160)]({[this['value']]:{'[Op.in]':_0x2e04f2}}):_0x327ab4[_0x41a602(0x160)]({[this['value']]:_0x2e04f2}));_0x2dff34=_0x2dff34[_0x41a602(0x15a)]('\x20')[_0x41a602(0x13d)](_0x172261=>_0x172261);_0x2dff34[_0x41a602(0x151)]&&_0x258b13[_0x41a602(0x13e)](_0xf76fed=>{const _0xc43032=_0x41a602;_0x2dff34[_0xc43032(0x13e)](_0x4c05f0=>{const _0x16dcd7=_0xc43032;_0x327ab4[_0x16dcd7(0x160)]({[_0xf76fed]:{'[Op.like]':'%'+_0x4c05f0+'%'}});});});delete _0x258590[_0x41a602(0x145)][_0x41a602(0x153)];if(_0x327ab4['length'])_0x258590[_0x41a602(0x145)][_0x41a602(0x153)]=_0x327ab4;const _0x1b4f91=await this['service'][_0x41a602(0x157)][_0x41a602(0x11a)](this['modelName'],_0x258590,_0x41a602(0x137));if(this['multiple']){_0x1b4f91[_0x41a602(0x134)]((_0x5514a1,_0x168130)=>_0x2e04f2[_0x41a602(0x13f)](_0x168130[this[_0x41a602(0x122)]])-_0x2e04f2[_0x41a602(0x13f)](_0x5514a1[this['value']]));const _0x259ed2=_0x1b4f91[_0x41a602(0x13b)](_0xf9eee8=>_0xf9eee8[this[_0x41a602(0x122)]]),_0x3ef90d=_0x2e04f2['filter'](_0x2c8df8=>!_0x259ed2['includes'](_0x2c8df8));if(_0x3ef90d['length']){_0x258590[_0x41a602(0x145)]={[this[_0x41a602(0x122)]]:{'[Op.in]':_0x3ef90d}};const _0x474653=await this[_0x41a602(0x14b)][_0x41a602(0x157)][_0x41a602(0x11a)](this[_0x41a602(0x14d)],_0x258590,_0x41a602(0x137));_0x1b4f91[_0x41a602(0x160)](..._0x474653);}}return _0x1b4f91;},'calcTitles'(_0x35b83f){const _0x5e05ff=a42_0x4b3e31;if(this[_0x5e05ff(0x15f)])return this[_0x5e05ff(0x15f)](_0x35b83f);return this[_0x5e05ff(0x12b)]['map'](_0x3e41dd=>highdict[_0x5e05ff(0x150)](_0x35b83f,_0x3e41dd))[_0x5e05ff(0x147)](_0x5e05ff(0x129));},'calcSubTitles'(_0x4cbec9){const _0x3938e9=a42_0x4b3e31;if(this[_0x3938e9(0x120)])return this[_0x3938e9(0x120)](_0x4cbec9);return this[_0x3938e9(0x12d)]['map'](_0x1ecbe3=>highdict['get'](_0x4cbec9,_0x1ecbe3))[_0x3938e9(0x147)]('\x20|\x20');},'calcColumns'(){const _0x51ecea=a42_0x4b3e31,_0x3eebb0=this[_0x51ecea(0x154)]?.['attributes']||[...this[_0x51ecea(0x11c)],...this[_0x51ecea(0x119)]],_0x5a6eb6=this['header'][_0x51ecea(0x13b)]((_0x41e494,_0x416670)=>{const _0x13f8dc=_0x51ecea,_0x2877c1={'prop':_0x3eebb0[_0x416670],'sortable':![]};if(typeof _0x41e494==='object'){const {label:_0xec1efe,..._0x2338f5}=_0x41e494;Object[_0x13f8dc(0x15e)](_0x2877c1,{'label':_0xec1efe,'tableAttrs':_0x2338f5});}else _0x2877c1[_0x13f8dc(0x140)]=_0x41e494;return this['$slots'][_0x13f8dc(0x149)]&&(_0x2877c1[_0x13f8dc(0x159)]??={},_0x2877c1[_0x13f8dc(0x159)]['slot']=_0x13f8dc(0x149)),_0x2877c1;});return this[_0x51ecea(0x121)][_0x51ecea(0x123)]&&_0x5a6eb6[_0x51ecea(0x160)]({'label':'操作','prop':_0x51ecea(0x136),'fixed':'right','sortable':![],'tableAttrs':{'slot':_0x51ecea(0x136),'width':this[_0x51ecea(0x148)]*0x1}}),_0x5a6eb6;}}};
|
|
@@ -1,86 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { remoteSearch } from './util.js'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: 'MobileXSelect',
|
|
6
|
-
inheritAttrs: false,
|
|
7
|
-
props: {
|
|
8
|
-
modelValue: Boolean | Number | String | Array,
|
|
9
|
-
modelName: String,
|
|
10
|
-
params: Object,
|
|
11
|
-
modelValue: Boolean | Number | String,
|
|
12
|
-
text: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: 'text'
|
|
15
|
-
},
|
|
16
|
-
value: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: 'value'
|
|
19
|
-
},
|
|
20
|
-
sort: Boolean | String,
|
|
21
|
-
options: Array | Object
|
|
22
|
-
},
|
|
23
|
-
emits: ['update:modelValue', 'change'],
|
|
24
|
-
computed: {
|
|
25
|
-
canEdit () {
|
|
26
|
-
return !this.$attrs.disabled && !this.$attrs.readonly
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
data () {
|
|
30
|
-
return {
|
|
31
|
-
visible: false,
|
|
32
|
-
_value: undefined,
|
|
33
|
-
_options: []
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
watch: {
|
|
37
|
-
modelValue: {
|
|
38
|
-
immediate: true,
|
|
39
|
-
handler (value) {
|
|
40
|
-
this._value = value
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
options: {
|
|
44
|
-
immediate: true,
|
|
45
|
-
deep: true,
|
|
46
|
-
handler () {
|
|
47
|
-
this._options = formatOptions(this.options, this)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
created () {
|
|
52
|
-
if (this.modelName) {
|
|
53
|
-
this.remoteSearch()
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
methods: {
|
|
57
|
-
formatOptions,
|
|
58
|
-
remoteSearch (query) {
|
|
59
|
-
if (!this.modelName) {
|
|
60
|
-
return this._options
|
|
61
|
-
}
|
|
62
|
-
remoteSearch(this.service.restful, query, this)
|
|
63
|
-
},
|
|
64
|
-
onShow () {
|
|
65
|
-
if (!this.canEdit) return
|
|
66
|
-
this.visible = true
|
|
67
|
-
},
|
|
68
|
-
onClick (e) {
|
|
69
|
-
if (!this.canEdit) return
|
|
70
|
-
if (!e.target.classList.contains('van-overlay')) {
|
|
71
|
-
this.onShow()
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
onConfirm () {
|
|
75
|
-
if (this._value == null || this._value === '') {
|
|
76
|
-
this._value = this._options[0].value
|
|
77
|
-
}
|
|
78
|
-
this.visible = false
|
|
79
|
-
this.$emit('update:modelValue', this._value)
|
|
80
|
-
this.$emit('change', this._value)
|
|
81
|
-
},
|
|
82
|
-
onChange (e) {
|
|
83
|
-
this._value = e.selectedValues[0]
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
1
|
+
var a43_0x4e7944=a43_0x1a0d;(function(_0x44f050,_0x2574c1){var _0x541b7a=a43_0x1a0d,_0x4ee40f=_0x44f050();while(!![]){try{var _0x3a3574=parseInt(_0x541b7a(0xd4))/0x1*(-parseInt(_0x541b7a(0xcf))/0x2)+-parseInt(_0x541b7a(0xdd))/0x3*(-parseInt(_0x541b7a(0xd8))/0x4)+-parseInt(_0x541b7a(0xe0))/0x5+parseInt(_0x541b7a(0xd9))/0x6*(-parseInt(_0x541b7a(0xe2))/0x7)+-parseInt(_0x541b7a(0xcd))/0x8+parseInt(_0x541b7a(0xe7))/0x9+parseInt(_0x541b7a(0xdc))/0xa;if(_0x3a3574===_0x2574c1)break;else _0x4ee40f['push'](_0x4ee40f['shift']());}catch(_0x1d8c67){_0x4ee40f['push'](_0x4ee40f['shift']());}}}(a43_0x3882,0x39014));import{formatOptions}from'../../utils/index.js';function a43_0x1a0d(_0x27331d,_0x24933c){var _0x388244=a43_0x3882();return a43_0x1a0d=function(_0x1a0dd8,_0x4af0d5){_0x1a0dd8=_0x1a0dd8-0xcd;var _0x4769a2=_0x388244[_0x1a0dd8];return _0x4769a2;},a43_0x1a0d(_0x27331d,_0x24933c);}import{remoteSearch}from'./util.js';export default{'name':a43_0x4e7944(0xe9),'inheritAttrs':![],'props':{'modelValue':Boolean|Number|String|Array,'modelName':String,'params':Object,'modelValue':Boolean|Number|String,'text':{'type':String,'default':'text'},'value':{'type':String,'default':'value'},'sort':Boolean|String,'options':Array|Object},'emits':[a43_0x4e7944(0xd1),a43_0x4e7944(0xde)],'computed':{'canEdit'(){var _0x28fd3d=a43_0x4e7944;return!this[_0x28fd3d(0xe6)][_0x28fd3d(0xd5)]&&!this[_0x28fd3d(0xe6)][_0x28fd3d(0xe8)];}},'data'(){return{'visible':![],'_value':undefined,'_options':[]};},'watch':{'modelValue':{'immediate':!![],'handler'(_0x48178c){var _0x58c3b3=a43_0x4e7944;this[_0x58c3b3(0xe4)]=_0x48178c;}},'options':{'immediate':!![],'deep':!![],'handler'(){var _0x2e1e75=a43_0x4e7944;this['_options']=formatOptions(this[_0x2e1e75(0xd2)],this);}}},'created'(){var _0x41c5a2=a43_0x4e7944;this[_0x41c5a2(0xda)]&&this[_0x41c5a2(0xe3)]();},'methods':{'formatOptions':formatOptions,'remoteSearch'(_0x4ec150){var _0x3251e1=a43_0x4e7944;if(!this[_0x3251e1(0xda)])return this[_0x3251e1(0xe1)];remoteSearch(this[_0x3251e1(0xd0)][_0x3251e1(0xce)],_0x4ec150,this);},'onShow'(){var _0x123b61=a43_0x4e7944;if(!this['canEdit'])return;this[_0x123b61(0xd7)]=!![];},'onClick'(_0xf54788){var _0x38abf3=a43_0x4e7944;if(!this['canEdit'])return;!_0xf54788[_0x38abf3(0xea)]['classList'][_0x38abf3(0xdb)](_0x38abf3(0xe5))&&this[_0x38abf3(0xdf)]();},'onConfirm'(){var _0x4e54ad=a43_0x4e7944;(this[_0x4e54ad(0xe4)]==null||this[_0x4e54ad(0xe4)]==='')&&(this[_0x4e54ad(0xe4)]=this['_options'][0x0][_0x4e54ad(0xd3)]),this['visible']=![],this[_0x4e54ad(0xd6)](_0x4e54ad(0xd1),this[_0x4e54ad(0xe4)]),this['$emit'](_0x4e54ad(0xde),this['_value']);},'onChange'(_0x48d53e){var _0x12fe9d=a43_0x4e7944;this[_0x12fe9d(0xe4)]=_0x48d53e['selectedValues'][0x0];}}};function a43_0x3882(){var _0x52e597=['onShow','1533100BdCrEq','_options','14InPaPj','remoteSearch','_value','van-overlay','$attrs','3647988xwyhoc','readonly','MobileXSelect','target','591456RXePNR','restful','244pontNT','service','update:modelValue','options','value','1631pUXaga','disabled','$emit','visible','12652hEndPr','323238xwiBwf','modelName','contains','2560740rloQLM','246jLauDz','change'];a43_0x3882=function(){return _0x52e597;};return a43_0x3882();}
|
|
@@ -1,114 +1 @@
|
|
|
1
|
-
import { markRaw }
|
|
2
|
-
import { formatOptions } from '../../utils/index.js'
|
|
3
|
-
import { remoteSearch, calcMainLabel, calcRemarkLabel } from './util.js'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'PcXSelect',
|
|
7
|
-
props: {
|
|
8
|
-
modelName: String,
|
|
9
|
-
params: Object,
|
|
10
|
-
modelValue: Boolean | Number | String,
|
|
11
|
-
plain: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: false
|
|
14
|
-
},
|
|
15
|
-
text: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: 'text'
|
|
18
|
-
},
|
|
19
|
-
labelTexts: Array,
|
|
20
|
-
value: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: 'value'
|
|
23
|
-
},
|
|
24
|
-
filterable: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: true
|
|
27
|
-
},
|
|
28
|
-
remote: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false
|
|
31
|
-
},
|
|
32
|
-
sort: Boolean | String,
|
|
33
|
-
options: Array | Object,
|
|
34
|
-
|
|
35
|
-
// 接收下面这几个属性,为了避免这些属性被绑定到当前组件根节点上,在下面会进行过滤传给子组件
|
|
36
|
-
platform: String
|
|
37
|
-
},
|
|
38
|
-
emits: ['update:modelValue'],
|
|
39
|
-
data () {
|
|
40
|
-
return {
|
|
41
|
-
loading: false,
|
|
42
|
-
_options: [],
|
|
43
|
-
list: []
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
computed: {
|
|
47
|
-
placeholder () {
|
|
48
|
-
if (this.$attrs.placeholder) return this.$attrs.placeholder
|
|
49
|
-
return this.remote ? '请搜索关键词以选择' : '请选择'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
watch: {
|
|
53
|
-
options: {
|
|
54
|
-
immediate: true,
|
|
55
|
-
deep: true,
|
|
56
|
-
handler () {
|
|
57
|
-
const ops = formatOptions(this.options, this)
|
|
58
|
-
if (!this.$slots.custom) {
|
|
59
|
-
ops.forEach((op, index) => {
|
|
60
|
-
op._main_ = calcMainLabel(this.options[index], this)
|
|
61
|
-
op._remark_ = calcRemarkLabel(this.options[index], this)
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
this._options = markRaw(ops)
|
|
65
|
-
this.list = this._options
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
created () {
|
|
70
|
-
const ps = this.remoteSearch()
|
|
71
|
-
const un = this.$watch(() => this.modelValue, value => {
|
|
72
|
-
if (!value) return
|
|
73
|
-
ps.then(this.remoteSearch)
|
|
74
|
-
un()
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
methods: {
|
|
78
|
-
formatOptions,
|
|
79
|
-
handleRemote (e) {
|
|
80
|
-
const keywords = e.target.value.trim()
|
|
81
|
-
if (keywords === this._last_keywords_) return
|
|
82
|
-
this._last_keywords_ = keywords
|
|
83
|
-
if (this.$attrs.remoteMethod) this.$attrs.remoteMethod(keywords)
|
|
84
|
-
else if (this.remoteSearch) this.remoteSearch(keywords)
|
|
85
|
-
},
|
|
86
|
-
onChange (value) {
|
|
87
|
-
this.$emit('update:modelValue', value)
|
|
88
|
-
},
|
|
89
|
-
filter (keywords) {
|
|
90
|
-
keywords = keywords.trim()
|
|
91
|
-
if (!keywords) {
|
|
92
|
-
return this.list = markRaw(this._options)
|
|
93
|
-
}
|
|
94
|
-
const isRemarking = !this.$slots.custom && this.labelTexts
|
|
95
|
-
this.list = markRaw(this._options.filter(op => {
|
|
96
|
-
let text = op.text
|
|
97
|
-
if (isRemarking) text += op._main_ + op._remark_
|
|
98
|
-
return text.includes(keywords)
|
|
99
|
-
}))
|
|
100
|
-
},
|
|
101
|
-
async remoteSearch (query) {
|
|
102
|
-
if (!this.remote && !this.modelName) {
|
|
103
|
-
return this._options
|
|
104
|
-
}
|
|
105
|
-
await remoteSearch(this.service.restful, query, this)
|
|
106
|
-
},
|
|
107
|
-
calcMainLabel (option) {
|
|
108
|
-
return calcMainLabel(option, this)
|
|
109
|
-
},
|
|
110
|
-
calcRemarkLabel (option) {
|
|
111
|
-
return calcRemarkLabel(option, this)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
1
|
+
const a44_0x1e9ec2=a44_0x37b8;function a44_0x81d0(){const _0x3a2b02=['options','326460TPqUvg','2SdyRBR','placeholder','_remark_','$attrs','1175169YiIWzF','modelValue','PcXSelect','2343VXLUZr','remoteMethod','77uuqSwK','text','includes','remote','55788CGgUjN','280084GZoefr','list','9yMfxrF','trim','_options','_last_keywords_','service','$emit','$watch','15xiBdkD','forEach','2779280vTqqag','custom','remoteSearch','113280JvbZAA','restful','update:modelValue','$slots','value','_main_','269886gAoTpS','then'];a44_0x81d0=function(){return _0x3a2b02;};return a44_0x81d0();}(function(_0x50175b,_0x5ed035){const _0x5929e3=a44_0x37b8,_0x5b9873=_0x50175b();while(!![]){try{const _0x7305a4=parseInt(_0x5929e3(0xb2))/0x1*(parseInt(_0x5929e3(0x96))/0x2)+-parseInt(_0x5929e3(0x9a))/0x3+parseInt(_0x5929e3(0xa4))/0x4*(-parseInt(_0x5929e3(0xad))/0x5)+-parseInt(_0x5929e3(0x92))/0x6*(parseInt(_0x5929e3(0x9f))/0x7)+-parseInt(_0x5929e3(0xaf))/0x8*(-parseInt(_0x5929e3(0xa6))/0x9)+-parseInt(_0x5929e3(0x95))/0xa+-parseInt(_0x5929e3(0x9d))/0xb*(-parseInt(_0x5929e3(0xa3))/0xc);if(_0x7305a4===_0x5ed035)break;else _0x5b9873['push'](_0x5b9873['shift']());}catch(_0x2d9f39){_0x5b9873['push'](_0x5b9873['shift']());}}}(a44_0x81d0,0x4e8a8));import{markRaw}from'vue';import{formatOptions}from'../../utils/index.js';import{remoteSearch,calcMainLabel,calcRemarkLabel}from'./util.js';function a44_0x37b8(_0x231e0f,_0x4c2729){const _0x81d0a5=a44_0x81d0();return a44_0x37b8=function(_0x37b8b7,_0x1adffd){_0x37b8b7=_0x37b8b7-0x8f;let _0x15920b=_0x81d0a5[_0x37b8b7];return _0x15920b;},a44_0x37b8(_0x231e0f,_0x4c2729);}export default{'name':a44_0x1e9ec2(0x9c),'props':{'modelName':String,'params':Object,'modelValue':Boolean|Number|String,'plain':{'type':Boolean,'default':![]},'text':{'type':String,'default':a44_0x1e9ec2(0xa0)},'labelTexts':Array,'value':{'type':String,'default':a44_0x1e9ec2(0x90)},'filterable':{'type':Boolean,'default':!![]},'remote':{'type':Boolean,'default':![]},'sort':Boolean|String,'options':Array|Object,'platform':String},'emits':['update:modelValue'],'data'(){return{'loading':![],'_options':[],'list':[]};},'computed':{'placeholder'(){const _0x5d42d5=a44_0x1e9ec2;if(this['$attrs'][_0x5d42d5(0x97)])return this[_0x5d42d5(0x99)]['placeholder'];return this['remote']?'请搜索关键词以选择':'请选择';}},'watch':{'options':{'immediate':!![],'deep':!![],'handler'(){const _0x327649=a44_0x1e9ec2,_0x1a1ef0=formatOptions(this[_0x327649(0x94)],this);!this[_0x327649(0x8f)][_0x327649(0xb0)]&&_0x1a1ef0[_0x327649(0xae)]((_0x546b1a,_0x514285)=>{const _0x32e085=_0x327649;_0x546b1a[_0x32e085(0x91)]=calcMainLabel(this[_0x32e085(0x94)][_0x514285],this),_0x546b1a[_0x32e085(0x98)]=calcRemarkLabel(this[_0x32e085(0x94)][_0x514285],this);}),this['_options']=markRaw(_0x1a1ef0),this[_0x327649(0xa5)]=this[_0x327649(0xa8)];}}},'created'(){const _0x1576f0=a44_0x1e9ec2,_0x398c5d=this[_0x1576f0(0xb1)](),_0x4e52d1=this[_0x1576f0(0xac)](()=>this[_0x1576f0(0x9b)],_0x3e896c=>{const _0x4648ad=_0x1576f0;if(!_0x3e896c)return;_0x398c5d[_0x4648ad(0x93)](this[_0x4648ad(0xb1)]),_0x4e52d1();});},'methods':{'formatOptions':formatOptions,'handleRemote'(_0x178b28){const _0x5c6a11=a44_0x1e9ec2,_0x162e27=_0x178b28['target']['value'][_0x5c6a11(0xa7)]();if(_0x162e27===this[_0x5c6a11(0xa9)])return;this[_0x5c6a11(0xa9)]=_0x162e27;if(this[_0x5c6a11(0x99)][_0x5c6a11(0x9e)])this[_0x5c6a11(0x99)][_0x5c6a11(0x9e)](_0x162e27);else{if(this[_0x5c6a11(0xb1)])this[_0x5c6a11(0xb1)](_0x162e27);}},'onChange'(_0x53f937){const _0xeddd31=a44_0x1e9ec2;this[_0xeddd31(0xab)](_0xeddd31(0xb4),_0x53f937);},'filter'(_0x3ad3ec){const _0x1990fe=a44_0x1e9ec2;_0x3ad3ec=_0x3ad3ec['trim']();if(!_0x3ad3ec)return this[_0x1990fe(0xa5)]=markRaw(this['_options']);const _0x555369=!this['$slots'][_0x1990fe(0xb0)]&&this['labelTexts'];this['list']=markRaw(this[_0x1990fe(0xa8)]['filter'](_0x3fd4e2=>{const _0x56d456=_0x1990fe;let _0x4b2057=_0x3fd4e2[_0x56d456(0xa0)];if(_0x555369)_0x4b2057+=_0x3fd4e2[_0x56d456(0x91)]+_0x3fd4e2[_0x56d456(0x98)];return _0x4b2057[_0x56d456(0xa1)](_0x3ad3ec);}));},async 'remoteSearch'(_0x50a558){const _0x135082=a44_0x1e9ec2;if(!this[_0x135082(0xa2)]&&!this['modelName'])return this[_0x135082(0xa8)];await remoteSearch(this[_0x135082(0xaa)][_0x135082(0xb3)],_0x50a558,this);},'calcMainLabel'(_0x3a0d11){return calcMainLabel(_0x3a0d11,this);},'calcRemarkLabel'(_0x568552){return calcRemarkLabel(_0x568552,this);}}};
|
|
@@ -1,66 +1 @@
|
|
|
1
|
-
const { highdict } =
|
|
2
|
-
|
|
3
|
-
const remoteSearch = async (restful, query, vm) => {
|
|
4
|
-
if (vm.loading || vm.options._loading) return
|
|
5
|
-
vm.loading = true
|
|
6
|
-
vm.options._loading = true
|
|
7
|
-
const keywords = query?.trim().split(' ').filter(k => k)
|
|
8
|
-
const { text = 'text', value = 'value', labelTexts, $props, $attrs, params = {} } = vm
|
|
9
|
-
params.attributes = [...new Set(params.attributes || [...(labelTexts || []), text, value])]
|
|
10
|
-
params.page ||= 1
|
|
11
|
-
params.limit ||= 20
|
|
12
|
-
params.where ||= {}
|
|
13
|
-
const ors = []
|
|
14
|
-
if (keywords?.length) {
|
|
15
|
-
if (labelTexts?.length > 1) {
|
|
16
|
-
labelTexts.forEach(t => {
|
|
17
|
-
keywords.forEach(k => {
|
|
18
|
-
ors.push({ [t]: { '[Op.like]': `%${k}%` } })
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
} else {
|
|
22
|
-
keywords.forEach(k => {
|
|
23
|
-
ors.push({ [text]: { '[Op.like]': `%${k}%` } })
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (ors.length) params.where['[Op.or]'] = ors
|
|
28
|
-
const data = await restful.search(vm.modelName, params, 'data')
|
|
29
|
-
if ($props.modelValue != undefined && $props.modelValue !== '') {
|
|
30
|
-
const values = Array.isArray($props.modelValue) ? $props.modelValue : [$props.modelValue]
|
|
31
|
-
const allValues = data.map(ele => ele[value])
|
|
32
|
-
const unfoundValues = values.filter(v => !allValues.includes(v))
|
|
33
|
-
if (unfoundValues.length) {
|
|
34
|
-
const unfoundData = await restful.search(vm.modelName, {
|
|
35
|
-
...params,
|
|
36
|
-
where: {
|
|
37
|
-
[value]: { '[Op.in]': unfoundValues }
|
|
38
|
-
}
|
|
39
|
-
}, 'data')
|
|
40
|
-
data.push(...unfoundData)
|
|
41
|
-
}
|
|
42
|
-
data.sort((a, b) => values.indexOf(b[value]) - values.indexOf(a[value]))
|
|
43
|
-
}
|
|
44
|
-
vm.options.splice(0, vm.options.length, ...data)
|
|
45
|
-
vm.loading = false
|
|
46
|
-
vm.options._loading = false
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const calcMainLabel = (option, vm) => {
|
|
50
|
-
if (!option || typeof option !== 'object') return option
|
|
51
|
-
if (!vm.labelTexts?.length) return highdict.get(option, vm.text)
|
|
52
|
-
return highdict.get(option, vm.labelTexts[0])
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const calcRemarkLabel = (option, vm) => {
|
|
56
|
-
if (!option || typeof option !== 'object') return ''
|
|
57
|
-
if (!vm.labelTexts || vm.labelTexts.length < 2) return ''
|
|
58
|
-
const labels = vm.labelTexts.slice(1).map(text => highdict.get(option, text))
|
|
59
|
-
return '(' + labels.join(' - ') + ')'
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export {
|
|
63
|
-
remoteSearch,
|
|
64
|
-
calcMainLabel,
|
|
65
|
-
calcRemarkLabel
|
|
66
|
-
}
|
|
1
|
+
(function(_0x51d385,_0xd27ba5){const _0x1ce1ab=a45_0x509a,_0xf27fe0=_0x51d385();while(!![]){try{const _0x19e1e8=-parseInt(_0x1ce1ab(0x111))/0x1*(parseInt(_0x1ce1ab(0x12c))/0x2)+-parseInt(_0x1ce1ab(0x11f))/0x3*(-parseInt(_0x1ce1ab(0x11b))/0x4)+parseInt(_0x1ce1ab(0x11c))/0x5+-parseInt(_0x1ce1ab(0x123))/0x6*(-parseInt(_0x1ce1ab(0x11a))/0x7)+-parseInt(_0x1ce1ab(0x116))/0x8+-parseInt(_0x1ce1ab(0x110))/0x9+parseInt(_0x1ce1ab(0x120))/0xa;if(_0x19e1e8===_0xd27ba5)break;else _0xf27fe0['push'](_0xf27fe0['shift']());}catch(_0x23f456){_0xf27fe0['push'](_0xf27fe0['shift']());}}}(a45_0x385d,0x5aec2));function a45_0x385d(){const _0x1863d7=['loading','attributes','6674130nmzpcL','410117AtZWlv','get','options','data','labelTexts','2232280pJeFCG','[Op.or]','page','text','249557pbvfPI','444pddRSh','764020VJCumR','forEach','map','2226NJiAaR','11758130fgLRdk','modelValue','object','66VTySTU','_loading','push','\x20-\x20','sort','filter','split','isArray','slice','2ATNjSX','trim','modelName','length','indexOf','splice','search'];a45_0x385d=function(){return _0x1863d7;};return a45_0x385d();}const {highdict}=StardustJs,remoteSearch=async(_0xd397cd,_0x4c1f1f,_0x8536f)=>{const _0x3c6112=a45_0x509a;if(_0x8536f[_0x3c6112(0x10e)]||_0x8536f['options'][_0x3c6112(0x124)])return;_0x8536f[_0x3c6112(0x10e)]=!![],_0x8536f[_0x3c6112(0x113)][_0x3c6112(0x124)]=!![];const _0x325786=_0x4c1f1f?.[_0x3c6112(0x12d)]()[_0x3c6112(0x129)]('\x20')[_0x3c6112(0x128)](_0x5b38f4=>_0x5b38f4),{text:text=_0x3c6112(0x119),value:value='value',labelTexts:_0x3ca5da,$props:_0xb3a97f,$attrs:_0x2398c3,params:params={}}=_0x8536f;params[_0x3c6112(0x10f)]=[...new Set(params[_0x3c6112(0x10f)]||[..._0x3ca5da||[],text,value])],params[_0x3c6112(0x118)]||=0x1,params['limit']||=0x14,params['where']||={};const _0x35f50e=[];_0x325786?.['length']&&(_0x3ca5da?.['length']>0x1?_0x3ca5da[_0x3c6112(0x11d)](_0x48fbb0=>{_0x325786['forEach'](_0x5818c9=>{const _0x567268=a45_0x509a;_0x35f50e[_0x567268(0x125)]({[_0x48fbb0]:{'[Op.like]':'%'+_0x5818c9+'%'}});});}):_0x325786[_0x3c6112(0x11d)](_0x14c308=>{const _0x15a445=_0x3c6112;_0x35f50e[_0x15a445(0x125)]({[text]:{'[Op.like]':'%'+_0x14c308+'%'}});}));if(_0x35f50e[_0x3c6112(0x12f)])params['where'][_0x3c6112(0x117)]=_0x35f50e;const _0x1cdfe6=await _0xd397cd[_0x3c6112(0x132)](_0x8536f[_0x3c6112(0x12e)],params,_0x3c6112(0x114));if(_0xb3a97f['modelValue']!=undefined&&_0xb3a97f[_0x3c6112(0x121)]!==''){const _0x2dae6d=Array[_0x3c6112(0x12a)](_0xb3a97f[_0x3c6112(0x121)])?_0xb3a97f[_0x3c6112(0x121)]:[_0xb3a97f[_0x3c6112(0x121)]],_0x3c5447=_0x1cdfe6[_0x3c6112(0x11e)](_0x54bfd7=>_0x54bfd7[value]),_0x280257=_0x2dae6d['filter'](_0x281707=>!_0x3c5447['includes'](_0x281707));if(_0x280257[_0x3c6112(0x12f)]){const _0x4f4cb1=await _0xd397cd[_0x3c6112(0x132)](_0x8536f[_0x3c6112(0x12e)],{...params,'where':{[value]:{'[Op.in]':_0x280257}}},_0x3c6112(0x114));_0x1cdfe6[_0x3c6112(0x125)](..._0x4f4cb1);}_0x1cdfe6[_0x3c6112(0x127)]((_0x142565,_0x139c5e)=>_0x2dae6d['indexOf'](_0x139c5e[value])-_0x2dae6d[_0x3c6112(0x130)](_0x142565[value]));}_0x8536f[_0x3c6112(0x113)][_0x3c6112(0x131)](0x0,_0x8536f[_0x3c6112(0x113)][_0x3c6112(0x12f)],..._0x1cdfe6),_0x8536f[_0x3c6112(0x10e)]=![],_0x8536f[_0x3c6112(0x113)][_0x3c6112(0x124)]=![];},calcMainLabel=(_0x5ca615,_0x2695e0)=>{const _0x17c6f6=a45_0x509a;if(!_0x5ca615||typeof _0x5ca615!==_0x17c6f6(0x122))return _0x5ca615;if(!_0x2695e0[_0x17c6f6(0x115)]?.[_0x17c6f6(0x12f)])return highdict[_0x17c6f6(0x112)](_0x5ca615,_0x2695e0[_0x17c6f6(0x119)]);return highdict[_0x17c6f6(0x112)](_0x5ca615,_0x2695e0[_0x17c6f6(0x115)][0x0]);},calcRemarkLabel=(_0x15327a,_0x4bcdd2)=>{const _0x54e0b5=a45_0x509a;if(!_0x15327a||typeof _0x15327a!==_0x54e0b5(0x122))return'';if(!_0x4bcdd2[_0x54e0b5(0x115)]||_0x4bcdd2[_0x54e0b5(0x115)][_0x54e0b5(0x12f)]<0x2)return'';const _0x25016c=_0x4bcdd2[_0x54e0b5(0x115)][_0x54e0b5(0x12b)](0x1)['map'](_0xd04cd0=>highdict[_0x54e0b5(0x112)](_0x15327a,_0xd04cd0));return'('+_0x25016c['join'](_0x54e0b5(0x126))+')';};function a45_0x509a(_0x97cd72,_0x398b89){const _0x385d06=a45_0x385d();return a45_0x509a=function(_0x509a09,_0x21369b){_0x509a09=_0x509a09-0x10e;let _0x3dfc72=_0x385d06[_0x509a09];return _0x3dfc72;},a45_0x509a(_0x97cd72,_0x398b89);}export{remoteSearch,calcMainLabel,calcRemarkLabel};
|
|
@@ -1,91 +1 @@
|
|
|
1
|
-
import { markRaw }
|
|
2
|
-
import { formatOptions } from '../../utils/index.js'
|
|
3
|
-
import { remoteSearch, calcMainLabel, calcRemarkLabel } from '../xselect/util.js'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'XSelectV2',
|
|
7
|
-
props: {
|
|
8
|
-
modelName: String,
|
|
9
|
-
params: Object,
|
|
10
|
-
plain: {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
default: false
|
|
13
|
-
},
|
|
14
|
-
text: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: 'text'
|
|
17
|
-
},
|
|
18
|
-
labelTexts: Array,
|
|
19
|
-
value: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: 'value'
|
|
22
|
-
},
|
|
23
|
-
filterable: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: true
|
|
26
|
-
},
|
|
27
|
-
remote: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
sort: Boolean | String,
|
|
32
|
-
options: Array | Object,
|
|
33
|
-
},
|
|
34
|
-
data () {
|
|
35
|
-
return {
|
|
36
|
-
loading: false,
|
|
37
|
-
_options: [],
|
|
38
|
-
list: []
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
watch: {
|
|
42
|
-
options: {
|
|
43
|
-
immediate: true,
|
|
44
|
-
deep: true,
|
|
45
|
-
handler () {
|
|
46
|
-
const ops = formatOptions(this.options, this)
|
|
47
|
-
if (!this.$slots.custom) {
|
|
48
|
-
ops.forEach((op, index) => {
|
|
49
|
-
op._main_ = calcMainLabel(this.options[index], this)
|
|
50
|
-
op._remark_ = calcRemarkLabel(this.options[index], this)
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
this._options = markRaw(ops)
|
|
54
|
-
this.list = this._options
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
created () {
|
|
59
|
-
if (this.modelName) {
|
|
60
|
-
this.remoteSearch()
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
methods: {
|
|
64
|
-
formatOptions,
|
|
65
|
-
handleRemote (e) {
|
|
66
|
-
const keywords = e.target.value.trim()
|
|
67
|
-
if (keywords === this._last_keywords_) return
|
|
68
|
-
this._last_keywords_ = keywords
|
|
69
|
-
if (this.$attrs.remoteMethod) this.$attrs.remoteMethod(keywords)
|
|
70
|
-
else if (this.remoteSearch) this.remoteSearch(keywords)
|
|
71
|
-
},
|
|
72
|
-
filter (keywords) {
|
|
73
|
-
keywords = keywords.trim()
|
|
74
|
-
if (!keywords) {
|
|
75
|
-
return this.list = markRaw(this._options)
|
|
76
|
-
}
|
|
77
|
-
const isCustom = !!this.$slots.custom
|
|
78
|
-
this.list = markRaw(this._options.filter(op => {
|
|
79
|
-
let text = op.text
|
|
80
|
-
if (!isCustom) text += op._main_ + op._remark_
|
|
81
|
-
return text.includes(keywords)
|
|
82
|
-
}))
|
|
83
|
-
},
|
|
84
|
-
remoteSearch (query) {
|
|
85
|
-
if (!this.remote && !this.modelName) {
|
|
86
|
-
return this._options
|
|
87
|
-
}
|
|
88
|
-
remoteSearch(this.service.restful, query, this)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
function a46_0x8717(){const _0x37dfe2=['modelName','30TQEVVI','557058EHvaYf','trim','XSelectV2','options','2233594gSoMBc','18459TnEcNb','138jzXzJU','3664LymgXo','_options','$attrs','remoteSearch','_remark_','filter','326058rTGEeJ','3MmJlJA','_main_','service','16nuwoXV','remoteMethod','text','remote','_last_keywords_','8850673qImsot','6321070sjtifK','forEach','$slots','list','217819NiOegF','restful','12ivZuUA','custom'];a46_0x8717=function(){return _0x37dfe2;};return a46_0x8717();}const a46_0x4af8b5=a46_0x55ce;(function(_0x15d1b1,_0x3b496b){const _0x49f61e=a46_0x55ce,_0x2595ad=_0x15d1b1();while(!![]){try{const _0x53528b=parseInt(_0x49f61e(0x127))/0x1*(-parseInt(_0x49f61e(0x126))/0x2)+-parseInt(_0x49f61e(0x13a))/0x3*(-parseInt(_0x49f61e(0x12a))/0x4)+-parseInt(_0x49f61e(0x130))/0x5+-parseInt(_0x49f61e(0x140))/0x6*(-parseInt(_0x49f61e(0x134))/0x7)+parseInt(_0x49f61e(0x120))/0x8*(parseInt(_0x49f61e(0x13f))/0x9)+-parseInt(_0x49f61e(0x139))/0xa*(parseInt(_0x49f61e(0x13e))/0xb)+parseInt(_0x49f61e(0x136))/0xc*(parseInt(_0x49f61e(0x12f))/0xd);if(_0x53528b===_0x3b496b)break;else _0x2595ad['push'](_0x2595ad['shift']());}catch(_0x1b0fe7){_0x2595ad['push'](_0x2595ad['shift']());}}}(a46_0x8717,0xaed77));function a46_0x55ce(_0x236696,_0x5ee5b1){const _0x87170e=a46_0x8717();return a46_0x55ce=function(_0x55cecf,_0x484af8){_0x55cecf=_0x55cecf-0x120;let _0x59f7b4=_0x87170e[_0x55cecf];return _0x59f7b4;},a46_0x55ce(_0x236696,_0x5ee5b1);}import{markRaw}from'vue';import{formatOptions}from'../../utils/index.js';import{remoteSearch,calcMainLabel,calcRemarkLabel}from'../xselect/util.js';export default{'name':a46_0x4af8b5(0x13c),'props':{'modelName':String,'params':Object,'plain':{'type':Boolean,'default':![]},'text':{'type':String,'default':a46_0x4af8b5(0x12c)},'labelTexts':Array,'value':{'type':String,'default':'value'},'filterable':{'type':Boolean,'default':!![]},'remote':{'type':Boolean,'default':![]},'sort':Boolean|String,'options':Array|Object},'data'(){return{'loading':![],'_options':[],'list':[]};},'watch':{'options':{'immediate':!![],'deep':!![],'handler'(){const _0x247ae5=a46_0x4af8b5,_0x35f904=formatOptions(this['options'],this);!this[_0x247ae5(0x132)][_0x247ae5(0x137)]&&_0x35f904[_0x247ae5(0x131)]((_0x2b2786,_0x218053)=>{const _0x3ba67d=_0x247ae5;_0x2b2786['_main_']=calcMainLabel(this[_0x3ba67d(0x13d)][_0x218053],this),_0x2b2786['_remark_']=calcRemarkLabel(this[_0x3ba67d(0x13d)][_0x218053],this);}),this[_0x247ae5(0x121)]=markRaw(_0x35f904),this[_0x247ae5(0x133)]=this[_0x247ae5(0x121)];}}},'created'(){const _0x55f776=a46_0x4af8b5;this[_0x55f776(0x138)]&&this[_0x55f776(0x123)]();},'methods':{'formatOptions':formatOptions,'handleRemote'(_0x579b3b){const _0x2e1a0e=a46_0x4af8b5,_0xd8952b=_0x579b3b['target']['value'][_0x2e1a0e(0x13b)]();if(_0xd8952b===this[_0x2e1a0e(0x12e)])return;this[_0x2e1a0e(0x12e)]=_0xd8952b;if(this[_0x2e1a0e(0x122)][_0x2e1a0e(0x12b)])this[_0x2e1a0e(0x122)]['remoteMethod'](_0xd8952b);else{if(this[_0x2e1a0e(0x123)])this[_0x2e1a0e(0x123)](_0xd8952b);}},'filter'(_0x3169dc){const _0x23098d=a46_0x4af8b5;_0x3169dc=_0x3169dc[_0x23098d(0x13b)]();if(!_0x3169dc)return this[_0x23098d(0x133)]=markRaw(this[_0x23098d(0x121)]);const _0x4553a8=!!this[_0x23098d(0x132)][_0x23098d(0x137)];this[_0x23098d(0x133)]=markRaw(this[_0x23098d(0x121)][_0x23098d(0x125)](_0x3ff1a7=>{const _0x5847c8=_0x23098d;let _0x3dc1a7=_0x3ff1a7[_0x5847c8(0x12c)];if(!_0x4553a8)_0x3dc1a7+=_0x3ff1a7[_0x5847c8(0x128)]+_0x3ff1a7[_0x5847c8(0x124)];return _0x3dc1a7['includes'](_0x3169dc);}));},'remoteSearch'(_0xe0cbe9){const _0x8e5035=a46_0x4af8b5;if(!this[_0x8e5035(0x12d)]&&!this['modelName'])return this[_0x8e5035(0x121)];remoteSearch(this[_0x8e5035(0x129)][_0x8e5035(0x135)],_0xe0cbe9,this);}}};
|