@wp1001/ui 2.9.13 → 3.0.1
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/pc.vue +1 -1
- 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
|
+
function a42_0x24de(_0x54e2b6,_0x225455){const _0x501938=a42_0x5019();return a42_0x24de=function(_0x24de8e,_0x13efec){_0x24de8e=_0x24de8e-0x9c;let _0xef4b9=_0x501938[_0x24de8e];return _0xef4b9;},a42_0x24de(_0x54e2b6,_0x225455);}const a42_0x27553f=a42_0x24de;(function(_0x38a735,_0x40933b){const _0x4ef875=a42_0x24de,_0x3727a=_0x38a735();while(!![]){try{const _0x410f93=parseInt(_0x4ef875(0xa1))/0x1*(-parseInt(_0x4ef875(0xca))/0x2)+parseInt(_0x4ef875(0xb2))/0x3+parseInt(_0x4ef875(0xcc))/0x4+parseInt(_0x4ef875(0xcf))/0x5+parseInt(_0x4ef875(0xdf))/0x6*(parseInt(_0x4ef875(0xce))/0x7)+parseInt(_0x4ef875(0x9f))/0x8*(parseInt(_0x4ef875(0xd9))/0x9)+parseInt(_0x4ef875(0xb7))/0xa*(-parseInt(_0x4ef875(0xaa))/0xb);if(_0x410f93===_0x40933b)break;else _0x3727a['push'](_0x3727a['shift']());}catch(_0x1c2084){_0x3727a['push'](_0x3727a['shift']());}}}(a42_0x5019,0xe5e6a));import{injectVanFieldProvide}from'../../utils/funcs.js';const {highdict}=StardustJs;function a42_0x5019(){const _0x1b206d=['map','select','resetValidation','formatSubTitle','16NToUJY','$slots','1zXOCBr','handleClear','operates','\x20|\x20','value','right','tableAttrs','find','modelValue','1425182jFLPvD','placeholder','data','get','titles','length','list','replace','4202838ntzUQa','multiple','isArray','forEach','isMobile','260sGWKhQ','where','update:modelValue','split','sort','[Op.or]','limit','target','params','_titles','formatTitle','modelName','label','$attrs','blur','change','handleSearch','search','loading','200426zZMHCc','indexOf','3131624YnQCZl','visible','9268CZkSJq','3131285FFEKEM','subTitles','service','660px','cell','XSearcher','provide','keywords','concat','请选择','6081651BqrCsp','slot','readonly','_subTitles','flat','push','1128ddLfdW','join','splice','filter','operatesWidth','$emit','header','includes','object'];a42_0x5019=function(){return _0x1b206d;};return a42_0x5019();}export default{'name':a42_0x27553f(0xd4),'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_0x27553f(0xd2)},'fullscreen':Boolean,'hideSearcher':{'type':Boolean,'default':![]},'readonly':Boolean,'disabled':Boolean,'placeholder':String,'searcherPlaceholder':String,'emptyText':String,'formatTitle':Function,'formatSubTitle':Function},'emits':[a42_0x27553f(0xb9),a42_0x27553f(0xc6),a42_0x27553f(0x9c)],'computed':{'_placeholder'(){const _0x477b7b=a42_0x27553f;return this[_0x477b7b(0xab)]?.[_0x477b7b(0xb1)]('输入','选择')||_0x477b7b(0xd8);},'_titles'(){const _0x402013=a42_0x27553f;return[this[_0x402013(0xae)]][_0x402013(0xdd)]()[_0x402013(0xe2)](_0x1630d2=>_0x1630d2);},'_subTitles'(){const _0x1ec0d0=a42_0x27553f;return[this[_0x1ec0d0(0xd0)]][_0x1ec0d0(0xdd)]()[_0x1ec0d0(0xe2)](_0x1c3201=>_0x1c3201);}},'data'(){return{'visible':![],'loading':![],'keywords':'','list':[]};},'watch':{'modelValue':{'immediate':!![],'handler'(_0x3f6a0f){const _0x63f27a=a42_0x27553f;_0x3f6a0f&&this[_0x63f27a(0xd5)]?.[_0x63f27a(0x9d)]();}}},'created'(){const _0x3b1518=a42_0x27553f;window[_0x3b1518(0xb6)]&&injectVanFieldProvide(this);},'methods':{'handleFocus'(_0x43ec47){const _0x29e237=a42_0x27553f;_0x43ec47[_0x29e237(0xbe)][_0x29e237(0xc5)]();},'handleClear'(){const _0x10df05=a42_0x27553f;if(this[_0x10df05(0xdb)])return;const _0x3edd67=this['multiple']?[]:null;this[_0x10df05(0xe4)](_0x10df05(0xb9),_0x3edd67),this['$emit'](_0x10df05(0xc6),_0x3edd67),this[_0x10df05(0xe4)](_0x10df05(0x9c),_0x3edd67,_0x3edd67);},'handleShow'(){const _0x482a98=a42_0x27553f;if(this[_0x482a98(0xdb)])return;this[_0x482a98(0xcd)]=!![],this[_0x482a98(0xc7)]();},async 'handleSearch'(){const _0x3d937a=a42_0x27553f;if(this[_0x3d937a(0xc9)])return;this[_0x3d937a(0xc9)]=!![],this[_0x3d937a(0xb0)]=await(this[_0x3d937a(0xc4)][_0x3d937a(0xc8)]||this[_0x3d937a(0xc8)])(this['modelValue'],this[_0x3d937a(0xd6)],this[_0x3d937a(0xb0)]),this['loading']=![];},'handleSelect'(_0x1753a3,_0x1a36e6){const _0x116ea6=a42_0x27553f;if(this[_0x116ea6(0xb3)]){const _0x5e96ea=Array['isArray'](this['modelValue'])?this[_0x116ea6(0xa9)]:this[_0x116ea6(0xa9)]?[this[_0x116ea6(0xa9)]]:[],_0x184dbd=_0x1753a3[this['value']],_0x51245a=_0x5e96ea[_0x116ea6(0xcb)](_0x184dbd);_0x51245a>=0x0?_0x5e96ea[_0x116ea6(0xe1)](_0x51245a,0x1):_0x5e96ea[_0x116ea6(0xde)](_0x184dbd);this[_0x116ea6(0xe4)]('update:modelValue',_0x5e96ea),this[_0x116ea6(0xe4)]('change',_0x5e96ea),this[_0x116ea6(0xe4)](_0x116ea6(0x9c),_0x5e96ea,_0x5e96ea['map'](_0x458416=>this[_0x116ea6(0xb0)][_0x116ea6(0xa8)](_0x242486=>_0x242486[this['value']]===_0x458416)));return;}this[_0x116ea6(0xa9)]===_0x1753a3[this[_0x116ea6(0xa5)]]?this[_0x116ea6(0xa2)]():(this[_0x116ea6(0xe4)](_0x116ea6(0xb9),_0x1753a3[this[_0x116ea6(0xa5)]]),this[_0x116ea6(0xe4)](_0x116ea6(0xc6),_0x1753a3[this[_0x116ea6(0xa5)]]),this['$emit'](_0x116ea6(0x9c),_0x1753a3[this['value']],_0x1753a3)),this[_0x116ea6(0xcd)]=![];},async 'search'(_0x51da10,_0x3c3d38){const _0x3f5d34=a42_0x27553f,_0x4b7667=this[_0x3f5d34(0xc0)][_0x3f5d34(0xd7)](this[_0x3f5d34(0xdc)]),_0x4a2e6f={...this['params']};_0x4a2e6f['page']||=0x1,_0x4a2e6f[_0x3f5d34(0xbd)]||=0x14,_0x4a2e6f['attributes']||=_0x4b7667[_0x3f5d34(0xe6)](this['value'])?_0x4b7667:[..._0x4b7667,this[_0x3f5d34(0xa5)]],_0x4a2e6f[_0x3f5d34(0xb8)]||={};const _0xb0eb82=[];this[_0x3f5d34(0xb3)]&&!Array[_0x3f5d34(0xb4)](_0x51da10)&&(_0x51da10=_0x51da10?[_0x51da10]:[]);_0x51da10!=undefined&&_0x51da10!==''&&!(this[_0x3f5d34(0xb3)]&&!_0x51da10['length'])&&(this[_0x3f5d34(0xb3)]?_0xb0eb82[_0x3f5d34(0xde)]({[this[_0x3f5d34(0xa5)]]:{'[Op.in]':_0x51da10}}):_0xb0eb82[_0x3f5d34(0xde)]({[this[_0x3f5d34(0xa5)]]:_0x51da10}));_0x3c3d38=_0x3c3d38[_0x3f5d34(0xba)]('\x20')[_0x3f5d34(0xe2)](_0x351da2=>_0x351da2);_0x3c3d38['length']&&_0x4b7667[_0x3f5d34(0xb5)](_0x42837f=>{const _0x3fb03e=_0x3f5d34;_0x3c3d38[_0x3fb03e(0xb5)](_0x4fa537=>{const _0x360ab5=_0x3fb03e;_0xb0eb82[_0x360ab5(0xde)]({[_0x42837f]:{'[Op.like]':'%'+_0x4fa537+'%'}});});});delete _0x4a2e6f[_0x3f5d34(0xb8)]['[Op.or]'];if(_0xb0eb82[_0x3f5d34(0xaf)])_0x4a2e6f[_0x3f5d34(0xb8)][_0x3f5d34(0xbc)]=_0xb0eb82;const _0x377281=await this['service']['restful'][_0x3f5d34(0xc8)](this['modelName'],_0x4a2e6f,_0x3f5d34(0xac));if(this[_0x3f5d34(0xb3)]){_0x377281[_0x3f5d34(0xbb)]((_0x965b6c,_0x45824c)=>_0x51da10['indexOf'](_0x45824c[this[_0x3f5d34(0xa5)]])-_0x51da10[_0x3f5d34(0xcb)](_0x965b6c[this[_0x3f5d34(0xa5)]]));const _0x1e9c04=_0x377281[_0x3f5d34(0xe8)](_0x3d4486=>_0x3d4486[this[_0x3f5d34(0xa5)]]),_0x534bef=_0x51da10[_0x3f5d34(0xe2)](_0x2ecdbc=>!_0x1e9c04[_0x3f5d34(0xe6)](_0x2ecdbc));if(_0x534bef[_0x3f5d34(0xaf)]){_0x4a2e6f[_0x3f5d34(0xb8)]={[this[_0x3f5d34(0xa5)]]:{'[Op.in]':_0x534bef}};const _0x2ff519=await this[_0x3f5d34(0xd1)]['restful'][_0x3f5d34(0xc8)](this[_0x3f5d34(0xc2)],_0x4a2e6f,_0x3f5d34(0xac));_0x377281['push'](..._0x2ff519);}}return _0x377281;},'calcTitles'(_0x4c66f9){const _0x5913ac=a42_0x27553f;if(this[_0x5913ac(0xc1)])return this[_0x5913ac(0xc1)](_0x4c66f9);return this[_0x5913ac(0xc0)][_0x5913ac(0xe8)](_0x3bcfbf=>highdict[_0x5913ac(0xad)](_0x4c66f9,_0x3bcfbf))[_0x5913ac(0xe0)](_0x5913ac(0xa4));},'calcSubTitles'(_0x213daf){const _0x35c766=a42_0x27553f;if(this[_0x35c766(0x9e)])return this[_0x35c766(0x9e)](_0x213daf);return this[_0x35c766(0xdc)]['map'](_0x325f24=>highdict[_0x35c766(0xad)](_0x213daf,_0x325f24))[_0x35c766(0xe0)](_0x35c766(0xa4));},'calcColumns'(){const _0x5a5f7c=a42_0x27553f,_0x552863=this[_0x5a5f7c(0xbf)]?.['attributes']||[...this[_0x5a5f7c(0xae)],...this[_0x5a5f7c(0xd0)]],_0x290fd6=this[_0x5a5f7c(0xe5)][_0x5a5f7c(0xe8)]((_0x19c53f,_0x49a131)=>{const _0x3771a0=_0x5a5f7c,_0x3be271={'prop':_0x552863[_0x49a131],'sortable':![]};if(typeof _0x19c53f===_0x3771a0(0xe7)){const {label:_0x50b502,..._0x3dd488}=_0x19c53f;Object['assign'](_0x3be271,{'label':_0x50b502,'tableAttrs':_0x3dd488});}else _0x3be271[_0x3771a0(0xc3)]=_0x19c53f;return this[_0x3771a0(0xa0)]['cell']&&(_0x3be271[_0x3771a0(0xa7)]??={},_0x3be271['tableAttrs'][_0x3771a0(0xda)]=_0x3771a0(0xd3)),_0x3be271;});return this[_0x5a5f7c(0xa0)][_0x5a5f7c(0xa6)]&&_0x290fd6[_0x5a5f7c(0xde)]({'label':'操作','prop':_0x5a5f7c(0xa3),'fixed':'right','sortable':![],'tableAttrs':{'slot':_0x5a5f7c(0xa3),'width':this[_0x5a5f7c(0xe3)]*0x1}}),_0x290fd6;}}};
|
|
@@ -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
|
+
function a43_0x2258(){var _0x2d087d=['$emit','classList','17895100KkQryx','_options','canEdit','value','options','MobileXSelect','1473165YaixrI','15443271Whvfpf','update:modelValue','onShow','selectedValues','88210vtzWjh','$attrs','370070LDSusJ','remoteSearch','modelName','restful','12bYdhGe','text','8pdxhGA','disabled','3253984Gupfob','contains','visible','target','readonly','11429019FPpYYy','_value','396LGppYf'];a43_0x2258=function(){return _0x2d087d;};return a43_0x2258();}function a43_0x3eb5(_0x2e5406,_0x582ebd){var _0x2258ed=a43_0x2258();return a43_0x3eb5=function(_0x3eb575,_0x2d68f4){_0x3eb575=_0x3eb575-0xf2;var _0x13f6e7=_0x2258ed[_0x3eb575];return _0x13f6e7;},a43_0x3eb5(_0x2e5406,_0x582ebd);}var a43_0x54df65=a43_0x3eb5;(function(_0x51a992,_0x43480b){var _0x5b6c73=a43_0x3eb5,_0x2dfcad=_0x51a992();while(!![]){try{var _0x39cbf8=parseInt(_0x5b6c73(0x10c))/0x1+parseInt(_0x5b6c73(0xf5))/0x2+parseInt(_0x5b6c73(0x105))/0x3*(-parseInt(_0x5b6c73(0x110))/0x4)+-parseInt(_0x5b6c73(0x10a))/0x5*(parseInt(_0x5b6c73(0xfc))/0x6)+parseInt(_0x5b6c73(0xfa))/0x7+parseInt(_0x5b6c73(0xf3))/0x8*(parseInt(_0x5b6c73(0x106))/0x9)+-parseInt(_0x5b6c73(0xff))/0xa;if(_0x39cbf8===_0x43480b)break;else _0x2dfcad['push'](_0x2dfcad['shift']());}catch(_0x36cc5f){_0x2dfcad['push'](_0x2dfcad['shift']());}}}(a43_0x2258,0xe047b));import{formatOptions}from'../../utils/index.js';import{remoteSearch}from'./util.js';export default{'name':a43_0x54df65(0x104),'inheritAttrs':![],'props':{'modelValue':Boolean|Number|String|Array,'modelName':String,'params':Object,'modelValue':Boolean|Number|String,'text':{'type':String,'default':a43_0x54df65(0xf2)},'value':{'type':String,'default':'value'},'sort':Boolean|String,'options':Array|Object},'emits':[a43_0x54df65(0x107),'change'],'computed':{'canEdit'(){var _0x3767ae=a43_0x54df65;return!this[_0x3767ae(0x10b)][_0x3767ae(0xf4)]&&!this[_0x3767ae(0x10b)][_0x3767ae(0xf9)];}},'data'(){return{'visible':![],'_value':undefined,'_options':[]};},'watch':{'modelValue':{'immediate':!![],'handler'(_0x227f55){this['_value']=_0x227f55;}},'options':{'immediate':!![],'deep':!![],'handler'(){var _0x152c25=a43_0x54df65;this[_0x152c25(0x100)]=formatOptions(this[_0x152c25(0x103)],this);}}},'created'(){var _0x4de285=a43_0x54df65;this[_0x4de285(0x10e)]&&this[_0x4de285(0x10d)]();},'methods':{'formatOptions':formatOptions,'remoteSearch'(_0x20cc16){var _0x6fca12=a43_0x54df65;if(!this[_0x6fca12(0x10e)])return this[_0x6fca12(0x100)];remoteSearch(this['service'][_0x6fca12(0x10f)],_0x20cc16,this);},'onShow'(){var _0xee9fbf=a43_0x54df65;if(!this[_0xee9fbf(0x101)])return;this[_0xee9fbf(0xf7)]=!![];},'onClick'(_0x118928){var _0x4f3a54=a43_0x54df65;if(!this['canEdit'])return;!_0x118928[_0x4f3a54(0xf8)][_0x4f3a54(0xfe)][_0x4f3a54(0xf6)]('van-overlay')&&this[_0x4f3a54(0x108)]();},'onConfirm'(){var _0x617f40=a43_0x54df65;(this[_0x617f40(0xfb)]==null||this[_0x617f40(0xfb)]==='')&&(this[_0x617f40(0xfb)]=this[_0x617f40(0x100)][0x0][_0x617f40(0x102)]),this[_0x617f40(0xf7)]=![],this['$emit'](_0x617f40(0x107),this[_0x617f40(0xfb)]),this[_0x617f40(0xfd)]('change',this[_0x617f40(0xfb)]);},'onChange'(_0xe89956){var _0x3e4f99=a43_0x54df65;this[_0x3e4f99(0xfb)]=_0xe89956[_0x3e4f99(0x109)][0x0];}}};
|
|
@@ -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_0x29d200=a44_0x5892;(function(_0x13b75c,_0x3c46a5){const _0x569c10=a44_0x5892,_0x2d7ff5=_0x13b75c();while(!![]){try{const _0x231f56=-parseInt(_0x569c10(0x8a))/0x1*(parseInt(_0x569c10(0x7b))/0x2)+-parseInt(_0x569c10(0x8c))/0x3*(-parseInt(_0x569c10(0x81))/0x4)+parseInt(_0x569c10(0x7e))/0x5+-parseInt(_0x569c10(0x70))/0x6+-parseInt(_0x569c10(0x91))/0x7+parseInt(_0x569c10(0x89))/0x8+-parseInt(_0x569c10(0x77))/0x9*(parseInt(_0x569c10(0x73))/0xa);if(_0x231f56===_0x3c46a5)break;else _0x2d7ff5['push'](_0x2d7ff5['shift']());}catch(_0x51ba63){_0x2d7ff5['push'](_0x2d7ff5['shift']());}}}(a44_0x2b3d,0x603ac));function a44_0x2b3d(){const _0x47d916=['value','options','text','1299846NvJPcg','custom','_remark_','50770PplafT','trim','then','$watch','423PMOAJm','placeholder','请选择','请搜索关键词以选择','6xaNiIO','_main_','filter','292415AhjFQq','update:modelValue','remote','228bFPCMp','includes','modelName','$slots','forEach','_options','labelTexts','PcXSelect','6026248KgiKTh','29075HFidWe','service','38586NSnYif','list','$emit','$attrs','remoteMethod','4257799hLxzTh','_last_keywords_','remoteSearch'];a44_0x2b3d=function(){return _0x47d916;};return a44_0x2b3d();}function a44_0x5892(_0x27e69e,_0x8ca3d7){const _0x2b3d45=a44_0x2b3d();return a44_0x5892=function(_0x589298,_0x4af812){_0x589298=_0x589298-0x6e;let _0x46d047=_0x2b3d45[_0x589298];return _0x46d047;},a44_0x5892(_0x27e69e,_0x8ca3d7);}import{markRaw}from'vue';import{formatOptions}from'../../utils/index.js';import{remoteSearch,calcMainLabel,calcRemarkLabel}from'./util.js';export default{'name':a44_0x29d200(0x88),'props':{'modelName':String,'params':Object,'modelValue':Boolean|Number|String,'plain':{'type':Boolean,'default':![]},'text':{'type':String,'default':'text'},'labelTexts':Array,'value':{'type':String,'default':a44_0x29d200(0x94)},'filterable':{'type':Boolean,'default':!![]},'remote':{'type':Boolean,'default':![]},'sort':Boolean|String,'options':Array|Object,'platform':String},'emits':[a44_0x29d200(0x7f)],'data'(){return{'loading':![],'_options':[],'list':[]};},'computed':{'placeholder'(){const _0x2bd7bf=a44_0x29d200;if(this['$attrs'][_0x2bd7bf(0x78)])return this[_0x2bd7bf(0x8f)][_0x2bd7bf(0x78)];return this[_0x2bd7bf(0x80)]?_0x2bd7bf(0x7a):_0x2bd7bf(0x79);}},'watch':{'options':{'immediate':!![],'deep':!![],'handler'(){const _0x36d890=a44_0x29d200,_0x2f7329=formatOptions(this[_0x36d890(0x6e)],this);!this[_0x36d890(0x84)]['custom']&&_0x2f7329[_0x36d890(0x85)]((_0x23c73b,_0x41b262)=>{const _0x663dc7=_0x36d890;_0x23c73b['_main_']=calcMainLabel(this[_0x663dc7(0x6e)][_0x41b262],this),_0x23c73b[_0x663dc7(0x72)]=calcRemarkLabel(this['options'][_0x41b262],this);}),this[_0x36d890(0x86)]=markRaw(_0x2f7329),this['list']=this['_options'];}}},'created'(){const _0x287aeb=a44_0x29d200,_0x186ac4=this['remoteSearch'](),_0x42240f=this[_0x287aeb(0x76)](()=>this['modelValue'],_0xe0ed93=>{const _0x12dfe7=_0x287aeb;if(!_0xe0ed93)return;_0x186ac4[_0x12dfe7(0x75)](this[_0x12dfe7(0x93)]),_0x42240f();});},'methods':{'formatOptions':formatOptions,'handleRemote'(_0x45115a){const _0x153811=a44_0x29d200,_0x350ea8=_0x45115a['target'][_0x153811(0x94)][_0x153811(0x74)]();if(_0x350ea8===this[_0x153811(0x92)])return;this[_0x153811(0x92)]=_0x350ea8;if(this['$attrs'][_0x153811(0x90)])this[_0x153811(0x8f)][_0x153811(0x90)](_0x350ea8);else{if(this[_0x153811(0x93)])this[_0x153811(0x93)](_0x350ea8);}},'onChange'(_0x3531c7){const _0x1cc97b=a44_0x29d200;this[_0x1cc97b(0x8e)](_0x1cc97b(0x7f),_0x3531c7);},'filter'(_0x3fe605){const _0x2f10c2=a44_0x29d200;_0x3fe605=_0x3fe605[_0x2f10c2(0x74)]();if(!_0x3fe605)return this[_0x2f10c2(0x8d)]=markRaw(this[_0x2f10c2(0x86)]);const _0x181263=!this[_0x2f10c2(0x84)][_0x2f10c2(0x71)]&&this[_0x2f10c2(0x87)];this[_0x2f10c2(0x8d)]=markRaw(this[_0x2f10c2(0x86)][_0x2f10c2(0x7d)](_0x2e3c75=>{const _0x537dcb=_0x2f10c2;let _0x4e434e=_0x2e3c75[_0x537dcb(0x6f)];if(_0x181263)_0x4e434e+=_0x2e3c75[_0x537dcb(0x7c)]+_0x2e3c75[_0x537dcb(0x72)];return _0x4e434e[_0x537dcb(0x82)](_0x3fe605);}));},async 'remoteSearch'(_0x10e3b2){const _0x21b483=a44_0x29d200;if(!this[_0x21b483(0x80)]&&!this[_0x21b483(0x83)])return this[_0x21b483(0x86)];await remoteSearch(this[_0x21b483(0x8b)]['restful'],_0x10e3b2,this);},'calcMainLabel'(_0x304744){return calcMainLabel(_0x304744,this);},'calcRemarkLabel'(_0x4ff4a5){return calcRemarkLabel(_0x4ff4a5,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(_0x46464d,_0x57cb80){const _0x26ae49=a45_0x202d,_0x493399=_0x46464d();while(!![]){try{const _0x1db0ff=-parseInt(_0x26ae49(0xb6))/0x1+parseInt(_0x26ae49(0xb2))/0x2*(parseInt(_0x26ae49(0xa4))/0x3)+parseInt(_0x26ae49(0xab))/0x4+-parseInt(_0x26ae49(0x96))/0x5+parseInt(_0x26ae49(0x9b))/0x6*(-parseInt(_0x26ae49(0x99))/0x7)+parseInt(_0x26ae49(0xad))/0x8+parseInt(_0x26ae49(0xa3))/0x9;if(_0x1db0ff===_0x57cb80)break;else _0x493399['push'](_0x493399['shift']());}catch(_0x141ce1){_0x493399['push'](_0x493399['shift']());}}}(a45_0x3889,0x6d76e));function a45_0x202d(_0x20d681,_0x29c97d){const _0x3889ab=a45_0x3889();return a45_0x202d=function(_0x202dad,_0x399383){_0x202dad=_0x202dad-0x95;let _0x1d24c6=_0x3889ab[_0x202dad];return _0x1d24c6;},a45_0x202d(_0x20d681,_0x29c97d);}const {highdict}=StardustJs,remoteSearch=async(_0x4e0654,_0xe8ff05,_0x97c266)=>{const _0x5a9bab=a45_0x202d;if(_0x97c266[_0x5a9bab(0xa0)]||_0x97c266[_0x5a9bab(0xa7)][_0x5a9bab(0x9e)])return;_0x97c266['loading']=!![],_0x97c266['options']['_loading']=!![];const _0x2cb6e0=_0xe8ff05?.[_0x5a9bab(0xa8)]()['split']('\x20')[_0x5a9bab(0xb1)](_0x14eec1=>_0x14eec1),{text:text=_0x5a9bab(0xa6),value:value=_0x5a9bab(0x95),labelTexts:_0x1ff51a,$props:_0x7de1ad,$attrs:_0x211e89,params:params={}}=_0x97c266;params['attributes']=[...new Set(params[_0x5a9bab(0x97)]||[..._0x1ff51a||[],text,value])],params['page']||=0x1,params[_0x5a9bab(0xb7)]||=0x14,params[_0x5a9bab(0xb3)]||={};const _0x55e7c6=[];_0x2cb6e0?.[_0x5a9bab(0xaa)]&&(_0x1ff51a?.[_0x5a9bab(0xaa)]>0x1?_0x1ff51a[_0x5a9bab(0x9a)](_0x561771=>{const _0x1ec9f8=_0x5a9bab;_0x2cb6e0[_0x1ec9f8(0x9a)](_0x212adf=>{const _0x117ff8=_0x1ec9f8;_0x55e7c6[_0x117ff8(0xae)]({[_0x561771]:{'[Op.like]':'%'+_0x212adf+'%'}});});}):_0x2cb6e0['forEach'](_0x2569c3=>{_0x55e7c6['push']({[text]:{'[Op.like]':'%'+_0x2569c3+'%'}});}));if(_0x55e7c6[_0x5a9bab(0xaa)])params[_0x5a9bab(0xb3)]['[Op.or]']=_0x55e7c6;const _0x1ae7c3=await _0x4e0654[_0x5a9bab(0x98)](_0x97c266[_0x5a9bab(0xa9)],params,_0x5a9bab(0xb4));if(_0x7de1ad[_0x5a9bab(0x9c)]!=undefined&&_0x7de1ad['modelValue']!==''){const _0x4cf01e=Array[_0x5a9bab(0x9f)](_0x7de1ad['modelValue'])?_0x7de1ad[_0x5a9bab(0x9c)]:[_0x7de1ad[_0x5a9bab(0x9c)]],_0x56b833=_0x1ae7c3['map'](_0x50bc2a=>_0x50bc2a[value]),_0x4139e0=_0x4cf01e[_0x5a9bab(0xb1)](_0x3d40e8=>!_0x56b833[_0x5a9bab(0x9d)](_0x3d40e8));if(_0x4139e0[_0x5a9bab(0xaa)]){const _0x2b5bd6=await _0x4e0654[_0x5a9bab(0x98)](_0x97c266[_0x5a9bab(0xa9)],{...params,'where':{[value]:{'[Op.in]':_0x4139e0}}},'data');_0x1ae7c3[_0x5a9bab(0xae)](..._0x2b5bd6);}_0x1ae7c3['sort']((_0x3422b4,_0x46dfae)=>_0x4cf01e['indexOf'](_0x46dfae[value])-_0x4cf01e[_0x5a9bab(0xa5)](_0x3422b4[value]));}_0x97c266['options'][_0x5a9bab(0xa1)](0x0,_0x97c266[_0x5a9bab(0xa7)][_0x5a9bab(0xaa)],..._0x1ae7c3),_0x97c266[_0x5a9bab(0xa0)]=![],_0x97c266[_0x5a9bab(0xa7)][_0x5a9bab(0x9e)]=![];},calcMainLabel=(_0x16bfd1,_0x3c8ab4)=>{const _0x43e54d=a45_0x202d;if(!_0x16bfd1||typeof _0x16bfd1!=='object')return _0x16bfd1;if(!_0x3c8ab4[_0x43e54d(0xac)]?.[_0x43e54d(0xaa)])return highdict['get'](_0x16bfd1,_0x3c8ab4[_0x43e54d(0xa6)]);return highdict['get'](_0x16bfd1,_0x3c8ab4[_0x43e54d(0xac)][0x0]);},calcRemarkLabel=(_0x1556f1,_0x3380ec)=>{const _0x14e4c5=a45_0x202d;if(!_0x1556f1||typeof _0x1556f1!==_0x14e4c5(0xaf))return'';if(!_0x3380ec[_0x14e4c5(0xac)]||_0x3380ec[_0x14e4c5(0xac)]['length']<0x2)return'';const _0x60d4ea=_0x3380ec[_0x14e4c5(0xac)][_0x14e4c5(0xa2)](0x1)[_0x14e4c5(0xb5)](_0x399bad=>highdict['get'](_0x1556f1,_0x399bad));return'('+_0x60d4ea[_0x14e4c5(0xb0)]('\x20-\x20')+')';};export{remoteSearch,calcMainLabel,calcRemarkLabel};function a45_0x3889(){const _0x1530eb=['join','filter','8HhvJLt','where','data','map','884175eGgfND','limit','value','4030315sZxwWc','attributes','search','5892831MjTBIs','forEach','6pvSchg','modelValue','includes','_loading','isArray','loading','splice','slice','11825145WzglhZ','528543cXgVxZ','indexOf','text','options','trim','modelName','length','967812YnXVjs','labelTexts','5758840HriOty','push','object'];a45_0x3889=function(){return _0x1530eb;};return a45_0x3889();}
|
|
@@ -1,91 +1 @@
|
|
|
1
|
-
|
|
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
|
+
const a46_0x170e89=a46_0x4d8c;(function(_0xdc54c1,_0x4a96e9){const _0x447d59=a46_0x4d8c,_0x4714ba=_0xdc54c1();while(!![]){try{const _0x3fd2e3=-parseInt(_0x447d59(0x15f))/0x1+parseInt(_0x447d59(0x153))/0x2*(parseInt(_0x447d59(0x152))/0x3)+parseInt(_0x447d59(0x150))/0x4+parseInt(_0x447d59(0x159))/0x5+-parseInt(_0x447d59(0x151))/0x6+-parseInt(_0x447d59(0x148))/0x7+parseInt(_0x447d59(0x14e))/0x8;if(_0x3fd2e3===_0x4a96e9)break;else _0x4714ba['push'](_0x4714ba['shift']());}catch(_0x4bcb07){_0x4714ba['push'](_0x4714ba['shift']());}}}(a46_0x4c91,0x20fa3));function a46_0x4d8c(_0x6c523b,_0x1807e3){const _0x4c9151=a46_0x4c91();return a46_0x4d8c=function(_0x4d8c65,_0x47901c){_0x4d8c65=_0x4d8c65-0x146;let _0x1c4a79=_0x4c9151[_0x4d8c65];return _0x1c4a79;},a46_0x4d8c(_0x6c523b,_0x1807e3);}import{markRaw}from'vue';function a46_0x4c91(){const _0x3e10cd=['includes','filter','remoteSearch','trim','58397iZkqAH','forEach','service','$slots','_remark_','1873270UAQFAT','options','restful','modelName','remoteMethod','custom','1178408Eojgpq','value','344544XPvrYy','645066pmLktL','588813OTiceZ','2TviUgJ','text','list','target','$attrs','_main_','694425kOpEsu','_options'];a46_0x4c91=function(){return _0x3e10cd;};return a46_0x4c91();}import{formatOptions}from'../../utils/index.js';import{remoteSearch,calcMainLabel,calcRemarkLabel}from'../xselect/util.js';export default{'name':'XSelectV2','props':{'modelName':String,'params':Object,'plain':{'type':Boolean,'default':![]},'text':{'type':String,'default':a46_0x170e89(0x154)},'labelTexts':Array,'value':{'type':String,'default':a46_0x170e89(0x14f)},'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 _0x2859b=a46_0x170e89,_0x3e4523=formatOptions(this[_0x2859b(0x149)],this);!this[_0x2859b(0x146)][_0x2859b(0x14d)]&&_0x3e4523[_0x2859b(0x160)]((_0x262631,_0x59c2d7)=>{const _0xdf0157=_0x2859b;_0x262631[_0xdf0157(0x158)]=calcMainLabel(this[_0xdf0157(0x149)][_0x59c2d7],this),_0x262631[_0xdf0157(0x147)]=calcRemarkLabel(this[_0xdf0157(0x149)][_0x59c2d7],this);}),this[_0x2859b(0x15a)]=markRaw(_0x3e4523),this[_0x2859b(0x155)]=this[_0x2859b(0x15a)];}}},'created'(){const _0x42913f=a46_0x170e89;this[_0x42913f(0x14b)]&&this[_0x42913f(0x15d)]();},'methods':{'formatOptions':formatOptions,'handleRemote'(_0x7b2b73){const _0x58a8db=a46_0x170e89,_0x4cf20a=_0x7b2b73[_0x58a8db(0x156)][_0x58a8db(0x14f)][_0x58a8db(0x15e)]();if(_0x4cf20a===this['_last_keywords_'])return;this['_last_keywords_']=_0x4cf20a;if(this[_0x58a8db(0x157)][_0x58a8db(0x14c)])this[_0x58a8db(0x157)][_0x58a8db(0x14c)](_0x4cf20a);else{if(this[_0x58a8db(0x15d)])this[_0x58a8db(0x15d)](_0x4cf20a);}},'filter'(_0x1f9029){const _0x524caf=a46_0x170e89;_0x1f9029=_0x1f9029[_0x524caf(0x15e)]();if(!_0x1f9029)return this['list']=markRaw(this[_0x524caf(0x15a)]);const _0x5e732e=!!this[_0x524caf(0x146)]['custom'];this[_0x524caf(0x155)]=markRaw(this[_0x524caf(0x15a)][_0x524caf(0x15c)](_0x1cd866=>{const _0x4af7bc=_0x524caf;let _0x128374=_0x1cd866['text'];if(!_0x5e732e)_0x128374+=_0x1cd866['_main_']+_0x1cd866['_remark_'];return _0x128374[_0x4af7bc(0x15b)](_0x1f9029);}));},'remoteSearch'(_0x212eca){const _0x3e8acc=a46_0x170e89;if(!this['remote']&&!this[_0x3e8acc(0x14b)])return this['_options'];remoteSearch(this[_0x3e8acc(0x161)][_0x3e8acc(0x14a)],_0x212eca,this);}}};
|