@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,477 +1 @@
|
|
|
1
|
-
import render, { OPS, COMPONENT_OPS } from './searcher.jsx'
|
|
2
|
-
import { Message, Confirm, Prompt } from '../../utils/index.js'
|
|
3
|
-
|
|
4
|
-
const { storage } = StardustBrowser
|
|
5
|
-
const { deepCopy } = StardustJs.funcs
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
name: 'Searcher',
|
|
9
|
-
props: {
|
|
10
|
-
uid: String,
|
|
11
|
-
columns: Array,
|
|
12
|
-
config: Object
|
|
13
|
-
},
|
|
14
|
-
emits: ['search', 'save'],
|
|
15
|
-
data () {
|
|
16
|
-
return {
|
|
17
|
-
visible: false,
|
|
18
|
-
activeName: 'search',
|
|
19
|
-
sortableColumns: [],
|
|
20
|
-
sortOptions: [
|
|
21
|
-
{ text: '升序', value: 'asc' },
|
|
22
|
-
{ text: '降序', value: 'desc' }
|
|
23
|
-
],
|
|
24
|
-
sorts: [],
|
|
25
|
-
conditionNo: 1,
|
|
26
|
-
conditions: [],
|
|
27
|
-
expression: '',
|
|
28
|
-
viewName: '',
|
|
29
|
-
views: [],
|
|
30
|
-
tourGuide: {
|
|
31
|
-
visible: false,
|
|
32
|
-
steps: [
|
|
33
|
-
{
|
|
34
|
-
target: '.views-select', title: '1. 选择视图',
|
|
35
|
-
description: `
|
|
36
|
-
<div style="color: var(--el-color-danger)">视图,是一组查询条件。</div>
|
|
37
|
-
这里选择下拉框里的某个视图,然后可以利用此视图进行数据查询。<br><br>
|
|
38
|
-
如果还没有自定义的视图,则需要添加。鼠标放到下拉框上,点击下拉框右侧的小叉号,以取消选中当前的默认视图,然后才能去新增条件,并保存为新的视图。<br><br>
|
|
39
|
-
<div style="color: var(--el-color-success)">现在,请试着点击下拉框右侧的小叉号。</div>
|
|
40
|
-
`
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
target: '.add-condition', title: '2. 新增条件',
|
|
44
|
-
description: `
|
|
45
|
-
这里可添加任意多个查询条件,每个条件可:
|
|
46
|
-
<ol style="list-style: disc; padding-left: 13px;">
|
|
47
|
-
<li>选择任意字段</li>
|
|
48
|
-
<li>选择任意查询方式</li>
|
|
49
|
-
<li>填写任意值,或选择任意选项、时间</li>
|
|
50
|
-
</ol>
|
|
51
|
-
然后,任意组合这些查询条件,从而可进行任意查询。<br><br>
|
|
52
|
-
<div style="color: var(--el-color-success)">现在,请试着点击"新增条件"按钮。</div>
|
|
53
|
-
`
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
target: '.x-select.field-select', title: '3. 选择字段',
|
|
57
|
-
description: `
|
|
58
|
-
这里有所有你需要查看、操作的字段,可以选择其中任意一个。<br><br>
|
|
59
|
-
<div style="color: var(--el-color-success)">现在,请试着选择某个字段。</div>
|
|
60
|
-
`
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
target: '.x-select.condition-select', title: '4. 选择查询方式',
|
|
64
|
-
description: `
|
|
65
|
-
这里有所有你需要用到的查询方式,不同的字段类型对应着不同的查询方式,可选择提供的任意一个方式。<br><br>
|
|
66
|
-
<div style="color: var(--el-color-success)">现在,请试着选择某个查询方式。</div>
|
|
67
|
-
`
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
target: '.value-container', title: '5. 填写值/选择选项、时间',
|
|
71
|
-
description: `
|
|
72
|
-
这里填写你要查询的关键词,或选择对应的下拉选项,或选择时间。<br><br>
|
|
73
|
-
<div style="color: var(--el-color-success)">现在,请试着填写某个关键词,或选择某个选项、时间。</div>
|
|
74
|
-
`
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
target: '.condition-expression', title: '6. 组合查询条件',
|
|
78
|
-
description: `
|
|
79
|
-
鉴于你可以添加多个条件,每个条件可任意组合,且支持数学逻辑中的“与”、“或”关系。<br>
|
|
80
|
-
这里就需要明确表达出你想用哪几个条件来查询,并且这些条件是以什么样的方式来组合。<br>
|
|
81
|
-
示例如下:<br>
|
|
82
|
-
<ol style="list-style: disc; padding-left: 13px;">
|
|
83
|
-
<li>条件1、条件2、条件3同时成立,表达式为:<span style="color: var(--el-color-warning)">1 and 2 and 3</span></li>
|
|
84
|
-
<li>条件1、条件2同时成立,或者条件3成立,表达式为:<span style="color: var(--el-color-warning)">(1 and 2) or 3</span></li>
|
|
85
|
-
<li>条件1、条件2同时成立,或条件2、条件3同时成立,表达式为:<span style="color: var(--el-color-warning)">(1 and 2) or (2 and 3)</span></li>
|
|
86
|
-
</ol>
|
|
87
|
-
<div style="color: var(--el-color-primary)">你想简单查询,表达式就非常简单。如果你想复杂查询,那么表达式就需要按需填写了。</div>
|
|
88
|
-
<br>
|
|
89
|
-
<div style="color: var(--el-color-success)">
|
|
90
|
-
现在,请试着填写表达式。如果你刚刚只添加了一个条件,且其序号为1,那么这里的表达式暂时填写
|
|
91
|
-
<span style="color: var(--el-color-warning)">1</span>
|
|
92
|
-
就好
|
|
93
|
-
</div>
|
|
94
|
-
`
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
target: '.save-view', title: '7. 保存视图',
|
|
98
|
-
description: `
|
|
99
|
-
刚才你已经新增了若干个条件,并且填写了条件表达式。现在可以保存这些条件为视图,这样下次可以直接选择此视图方便地查询数据。<br><br>
|
|
100
|
-
<div style="color: var(--el-color-success)">现在,点击“保存当前视图”按钮,并为其填写一个合适的名字。</div>
|
|
101
|
-
`
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
target: '.searcher.pc-x-drawer .el-drawer__footer .el-button--primary', title: '8. 查询数据',
|
|
105
|
-
description: `
|
|
106
|
-
现在,上面已经有了查询条件,试着点击“查询”按钮,即可查询数据了。
|
|
107
|
-
`
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
computed: {
|
|
114
|
-
key () {
|
|
115
|
-
return `Searcher[${this.uid}]`
|
|
116
|
-
},
|
|
117
|
-
currentView () {
|
|
118
|
-
return this.views.find(v => v.name === this.viewName)
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
watch: {
|
|
122
|
-
config: 'init'
|
|
123
|
-
},
|
|
124
|
-
created () {
|
|
125
|
-
this.init()
|
|
126
|
-
},
|
|
127
|
-
render,
|
|
128
|
-
methods: {
|
|
129
|
-
init () {
|
|
130
|
-
let { views = [], viewName, ...others } = this.uid && storage.local.getJson(this.key, {}) || {}
|
|
131
|
-
if (this.config.views) {
|
|
132
|
-
this.config.views.forEach(view => view.is_system = true)
|
|
133
|
-
views = this.config.views.concat(views)
|
|
134
|
-
}
|
|
135
|
-
if (views.length && !viewName) viewName = views[0].name
|
|
136
|
-
Object.assign(this, { views, viewName })
|
|
137
|
-
|
|
138
|
-
const settings = storage.local.getJson('Settings[' + this.uid + ']')
|
|
139
|
-
if (settings?.viewName) this.viewName = settings.viewName
|
|
140
|
-
|
|
141
|
-
this.sortableColumns = this.columns.filter(col => !col.virtual)
|
|
142
|
-
|
|
143
|
-
if (this.viewName) {
|
|
144
|
-
this.handleSelectView(this.viewName)
|
|
145
|
-
} else {
|
|
146
|
-
this.setCurrentView(this.config.traditional ? this.config : others)
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
open () {
|
|
150
|
-
this.visible = true
|
|
151
|
-
},
|
|
152
|
-
close () {
|
|
153
|
-
this.visible = false
|
|
154
|
-
},
|
|
155
|
-
getCurrentView () {
|
|
156
|
-
return {
|
|
157
|
-
sorts: this.sorts,
|
|
158
|
-
conditionNo: this.conditionNo,
|
|
159
|
-
conditions: this.conditions.map(con => {
|
|
160
|
-
const { item, ops, component, ...others } = con
|
|
161
|
-
return others
|
|
162
|
-
}),
|
|
163
|
-
expression: this.expression
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
saveCache () {
|
|
167
|
-
const cache = { views: this.views.filter(view => !view.is_system) }
|
|
168
|
-
if (this.viewName && this.currentView) {
|
|
169
|
-
cache.viewName = this.viewName
|
|
170
|
-
Object.assign(this.currentView, this.getCurrentView())
|
|
171
|
-
} else {
|
|
172
|
-
Object.assign(cache, this.getCurrentView())
|
|
173
|
-
}
|
|
174
|
-
storage.local.setJson(this.key, cache)
|
|
175
|
-
},
|
|
176
|
-
setCurrentView (view) {
|
|
177
|
-
if (!view) return
|
|
178
|
-
view.conditions?.forEach(con => {
|
|
179
|
-
const { prop, op, value, universal } = con
|
|
180
|
-
con.item = this.columns.find(col => col.prop === prop)
|
|
181
|
-
this.handleSelectField(con, prop)
|
|
182
|
-
this.handleSelectOp(con, op)
|
|
183
|
-
con.value = value
|
|
184
|
-
const comp = con.item.comp || con.component
|
|
185
|
-
con.ops = COMPONENT_OPS[universal ? 'universal' : comp].map(key => OPS[key])
|
|
186
|
-
})
|
|
187
|
-
if (!view.conditionNo && view.conditions?.length) {
|
|
188
|
-
view.conditionNo = Math.max.apply(null, view.conditions.map(con => con.no)) + 1
|
|
189
|
-
}
|
|
190
|
-
this.viewName = view.name
|
|
191
|
-
Object.assign(this, view)
|
|
192
|
-
},
|
|
193
|
-
handleSearch () {
|
|
194
|
-
let params = null
|
|
195
|
-
try {
|
|
196
|
-
params = this.calcParams()
|
|
197
|
-
} catch (err) {
|
|
198
|
-
Message.w(err.toString())
|
|
199
|
-
return false
|
|
200
|
-
}
|
|
201
|
-
this.uid && params && this.saveCache()
|
|
202
|
-
params = params || { where: {} }
|
|
203
|
-
params.page = 1
|
|
204
|
-
this.$emit('search', params)
|
|
205
|
-
this.visible = false
|
|
206
|
-
return true
|
|
207
|
-
},
|
|
208
|
-
handleReset () {
|
|
209
|
-
const view = {
|
|
210
|
-
sorts: [],
|
|
211
|
-
conditionNo: 1,
|
|
212
|
-
conditions: [],
|
|
213
|
-
expression: ''
|
|
214
|
-
}
|
|
215
|
-
Object.assign(this, view)
|
|
216
|
-
this.setCurrentView(view)
|
|
217
|
-
},
|
|
218
|
-
calcParams () {
|
|
219
|
-
const tree = this.calcTree()
|
|
220
|
-
if (!tree) return
|
|
221
|
-
const parse = (tree, where) => {
|
|
222
|
-
const branch = []
|
|
223
|
-
const type = '[Op.' + tree.type + ']'
|
|
224
|
-
where[type] = branch
|
|
225
|
-
for (let item of tree.items) {
|
|
226
|
-
if (typeof item === 'string') {
|
|
227
|
-
const condition = this.conditions.find(con => con.no === item * 1)
|
|
228
|
-
if (!condition) {
|
|
229
|
-
throw '条件不存在: ' + item
|
|
230
|
-
} else {
|
|
231
|
-
if (!this.checkFilled(condition)) {
|
|
232
|
-
if (this.config.traditional || this.config.ignoreUnfilled) continue
|
|
233
|
-
throw '条件不完整: ' + item
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
branch.push(this.parseCondition(condition))
|
|
237
|
-
} else {
|
|
238
|
-
const sub = {}
|
|
239
|
-
branch.push(sub)
|
|
240
|
-
parse(item, sub)
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (!branch.length) delete where[type]
|
|
244
|
-
}
|
|
245
|
-
const where = {}
|
|
246
|
-
parse(tree, where)
|
|
247
|
-
const params = { where }
|
|
248
|
-
if (this.sorts.length) {
|
|
249
|
-
params.order = deepCopy(this.sorts)
|
|
250
|
-
}
|
|
251
|
-
return params
|
|
252
|
-
},
|
|
253
|
-
calcTree (normalize = true) {
|
|
254
|
-
const expression = this.expression.trim()
|
|
255
|
-
.replaceAll('&&', 'and')
|
|
256
|
-
.replaceAll('||', 'or')
|
|
257
|
-
.replace(/and/ig, 'and')
|
|
258
|
-
.replace(/or/ig, 'or')
|
|
259
|
-
if (!expression) return null
|
|
260
|
-
const symbols = expression.split(/(\(|\)|\s)/).filter(p => p.trim())
|
|
261
|
-
|
|
262
|
-
const calc = (tree, symbols) => {
|
|
263
|
-
while (symbols.length) {
|
|
264
|
-
const ele = symbols.shift()
|
|
265
|
-
if (['and', 'or'].includes(ele)) {
|
|
266
|
-
if (tree.type && tree.type !== ele) {
|
|
267
|
-
throw '串联不同逻辑表达式请使用小括号区分'
|
|
268
|
-
}
|
|
269
|
-
tree.type = ele
|
|
270
|
-
} else if (ele === '(') {
|
|
271
|
-
const item = { type: '', items: [] }
|
|
272
|
-
tree.items.push(item)
|
|
273
|
-
item._parent = tree
|
|
274
|
-
calc(item, symbols)
|
|
275
|
-
break
|
|
276
|
-
} else if (ele === ')') {
|
|
277
|
-
calc(tree._parent, symbols)
|
|
278
|
-
delete tree._parent
|
|
279
|
-
} else {
|
|
280
|
-
tree.items.push(ele)
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
const tree = { type: '', items: [] }
|
|
285
|
-
calc(tree, symbols)
|
|
286
|
-
if (normalize) {
|
|
287
|
-
tree.type ||= 'and'
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
return tree
|
|
291
|
-
},
|
|
292
|
-
calcExpression (tree) {
|
|
293
|
-
const calc = (branch) => {
|
|
294
|
-
if (!branch) return ''
|
|
295
|
-
if (typeof branch === 'string') return branch
|
|
296
|
-
const { type, items } = branch
|
|
297
|
-
if (!items.length) return ''
|
|
298
|
-
return '(' + items.map(calc).filter(e => e).join(' ' + type + ' ') + ')'
|
|
299
|
-
}
|
|
300
|
-
let expression = calc(tree).slice(1, -1)
|
|
301
|
-
while (/\(\d+\)/.test(expression)) {
|
|
302
|
-
expression = expression.replace(/\((\d+)\)/g, '$1')
|
|
303
|
-
}
|
|
304
|
-
return expression
|
|
305
|
-
},
|
|
306
|
-
parseCondition (condition) {
|
|
307
|
-
let { item, component, prop, op, value } = condition
|
|
308
|
-
const where = {}
|
|
309
|
-
if (op === 'special') {
|
|
310
|
-
const isNot = value.startsWith('NOT_')
|
|
311
|
-
const isNe = value.startsWith('NE_')
|
|
312
|
-
if (value.includes('NULL')) {
|
|
313
|
-
value = null
|
|
314
|
-
} else if (value.includes('BLANK')) {
|
|
315
|
-
value = ''
|
|
316
|
-
}
|
|
317
|
-
if (isNot) {
|
|
318
|
-
value = { '[Op.not]': value }
|
|
319
|
-
} else if (isNe) {
|
|
320
|
-
value = { '[Op.ne]': value }
|
|
321
|
-
}
|
|
322
|
-
where[prop] = value
|
|
323
|
-
return where
|
|
324
|
-
}
|
|
325
|
-
if (op === 'like' || op === 'notLike') {
|
|
326
|
-
value = '%' + value + '%'
|
|
327
|
-
}
|
|
328
|
-
if (op === 'in' || op === 'notIn') {
|
|
329
|
-
if (!item.options) {
|
|
330
|
-
value = value.split(',')
|
|
331
|
-
if (component === 'ElInputNumber' || component === 'el-input-number' || condition.type === 'number') {
|
|
332
|
-
value = value.map(Number)
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
where[prop] = { [`[Op.${op}]`]: value }
|
|
337
|
-
return where
|
|
338
|
-
},
|
|
339
|
-
checkFilled (condition) {
|
|
340
|
-
if (!condition.prop || !condition.op) {
|
|
341
|
-
return false
|
|
342
|
-
}
|
|
343
|
-
const value = Array.isArray(condition.value) ? condition.value : [condition.value]
|
|
344
|
-
return value.length && value.every(ele => {
|
|
345
|
-
return typeof ele !== 'string' || ele.length
|
|
346
|
-
})
|
|
347
|
-
},
|
|
348
|
-
handleAdd () {
|
|
349
|
-
this.conditions.push({
|
|
350
|
-
no: this.conditionNo ++,
|
|
351
|
-
prop: '',
|
|
352
|
-
op: '',
|
|
353
|
-
value: '',
|
|
354
|
-
component: 'ElInput',
|
|
355
|
-
ops: [],
|
|
356
|
-
item: {}
|
|
357
|
-
})
|
|
358
|
-
},
|
|
359
|
-
handleDelete (index) {
|
|
360
|
-
const no = this.conditions[index].no + ''
|
|
361
|
-
const tree = this.calcTree(false)
|
|
362
|
-
const remove = (branch) => {
|
|
363
|
-
if (!branch) return
|
|
364
|
-
for (let i = branch.items.length - 1; i >= 0; i--) {
|
|
365
|
-
if (branch.items[i] === no) {
|
|
366
|
-
branch.items.splice(i, 1)
|
|
367
|
-
} else if (typeof branch.items[i] === 'object') {
|
|
368
|
-
remove(branch.items[i])
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
remove(tree)
|
|
373
|
-
this.expression = this.calcExpression(tree)
|
|
374
|
-
this.conditions.splice(index, 1)
|
|
375
|
-
},
|
|
376
|
-
handleSelectField (condition, value) {
|
|
377
|
-
condition.value = ''
|
|
378
|
-
condition.prop = value
|
|
379
|
-
condition.item = this.columns.find(col => col.prop === condition.prop) || {}
|
|
380
|
-
const { options, type, formAttrs = {} } = condition.item
|
|
381
|
-
const config = { ...condition.item, ...formAttrs }
|
|
382
|
-
const {
|
|
383
|
-
comp, universal,
|
|
384
|
-
visible, canAdd, canEdit, required, slot, span,
|
|
385
|
-
tableAttrs, formAttrs: fa, tagTypes, tagValues, width, minWidth,
|
|
386
|
-
disabled, readonly,
|
|
387
|
-
...others
|
|
388
|
-
} = config
|
|
389
|
-
others.clearable ??= true
|
|
390
|
-
condition.config = others
|
|
391
|
-
condition.component = comp ||
|
|
392
|
-
options && 'XSelect' ||
|
|
393
|
-
type === 'number' && 'ElInputNumber' ||
|
|
394
|
-
'ElInput'
|
|
395
|
-
condition.ops = COMPONENT_OPS[universal ? 'universal' : condition.component].map(key => OPS[key])
|
|
396
|
-
condition.op = condition.ops[0].value
|
|
397
|
-
if (condition.component === 'ElDatePicker') {
|
|
398
|
-
condition.component = 'ElInput'
|
|
399
|
-
others.type = 'date'
|
|
400
|
-
}
|
|
401
|
-
if (others.type === 'textarea') delete others.type
|
|
402
|
-
},
|
|
403
|
-
handleSelectOp (condition, value) {
|
|
404
|
-
condition.op = value
|
|
405
|
-
if (value === 'between') {
|
|
406
|
-
condition.value = ['', '']
|
|
407
|
-
} else if (['in', 'notIn'].includes(value)) {
|
|
408
|
-
condition.value = []
|
|
409
|
-
}
|
|
410
|
-
if (
|
|
411
|
-
value === 'special'
|
|
412
|
-
|| !['between', 'in', 'notIn'].includes(value) && Array.isArray(value)
|
|
413
|
-
) {
|
|
414
|
-
condition.value = ''
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
handleSelectView (name) {
|
|
418
|
-
if (!name) {
|
|
419
|
-
this.handleReset()
|
|
420
|
-
} else {
|
|
421
|
-
const view = this.views.find(v => v.name === name)
|
|
422
|
-
if (!view) {
|
|
423
|
-
this.viewName = ''
|
|
424
|
-
this.handleReset()
|
|
425
|
-
return this.saveCache()
|
|
426
|
-
}
|
|
427
|
-
this.setCurrentView(deepCopy(view))
|
|
428
|
-
}
|
|
429
|
-
},
|
|
430
|
-
async handleSaveView () {
|
|
431
|
-
const view = this.getCurrentView()
|
|
432
|
-
let isSystem = false
|
|
433
|
-
if (this.viewName && this.currentView) {
|
|
434
|
-
isSystem = this.currentView.is_system
|
|
435
|
-
if (!isSystem) {
|
|
436
|
-
Object.assign(this.currentView, view)
|
|
437
|
-
this.saveCache()
|
|
438
|
-
Message.s('视图保存成功')
|
|
439
|
-
return
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
let name = await Prompt({
|
|
443
|
-
title: '提示',
|
|
444
|
-
message: (isSystem ? '系统视图不可修改,可保存为新视图,' : '') + '请输入新视图名称'
|
|
445
|
-
})
|
|
446
|
-
name = name.trim()
|
|
447
|
-
if (!name) return
|
|
448
|
-
if (this.views.some(v => v.name === name)) {
|
|
449
|
-
return Message.w('视图名称 ' + name + ' 已存在,请重新输入')
|
|
450
|
-
}
|
|
451
|
-
this.views.push({ name, ...view })
|
|
452
|
-
this.viewName = name
|
|
453
|
-
this.handleSelectView(name)
|
|
454
|
-
this.saveCache()
|
|
455
|
-
Message.s('视图保存成功')
|
|
456
|
-
},
|
|
457
|
-
async handleDeleteView (view, index, e) {
|
|
458
|
-
e.stopPropagation()
|
|
459
|
-
if (!await Confirm.w({ title: '提示', message: `确定删除查询视图 ${view.name} 吗?` })) return
|
|
460
|
-
if (this.viewName === view.name) {
|
|
461
|
-
this.viewName = ''
|
|
462
|
-
this.handleReset()
|
|
463
|
-
}
|
|
464
|
-
this.views.splice(index, 1)
|
|
465
|
-
this.saveCache()
|
|
466
|
-
Message.s(`视图 [${view.name}] 已删除`)
|
|
467
|
-
},
|
|
468
|
-
handleSearchView (view) {
|
|
469
|
-
this.setCurrentView(view)
|
|
470
|
-
if (!this.handleSearch()) return
|
|
471
|
-
this.$emit('save', { viewName: view.name })
|
|
472
|
-
},
|
|
473
|
-
handleAddSort () {
|
|
474
|
-
this.sorts.push([this.sortableColumns[0].prop, 'asc'])
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
1
|
+
const a49_0x3107c=a49_0x2a51;function a49_0x2a51(_0x1ebf30,_0x1bc4b0){const _0x1599fa=a49_0x1599();return a49_0x2a51=function(_0x2a5187,_0x7ffa40){_0x2a5187=_0x2a5187-0x171;let _0xa33d45=_0x1599fa[_0x2a5187];return _0xa33d45;},a49_0x2a51(_0x1ebf30,_0x1bc4b0);}(function(_0x359962,_0x51d1ea){const _0x3f1960=a49_0x2a51,_0x11397d=_0x359962();while(!![]){try{const _0xae8023=-parseInt(_0x3f1960(0x188))/0x1+-parseInt(_0x3f1960(0x1d8))/0x2+-parseInt(_0x3f1960(0x1cd))/0x3*(-parseInt(_0x3f1960(0x1cb))/0x4)+-parseInt(_0x3f1960(0x1b6))/0x5*(parseInt(_0x3f1960(0x1d9))/0x6)+-parseInt(_0x3f1960(0x18b))/0x7+-parseInt(_0x3f1960(0x172))/0x8*(parseInt(_0x3f1960(0x184))/0x9)+parseInt(_0x3f1960(0x18a))/0xa;if(_0xae8023===_0x51d1ea)break;else _0x11397d['push'](_0x11397d['shift']());}catch(_0x5c7f12){_0x11397d['push'](_0x11397d['shift']());}}}(a49_0x1599,0x81bfa));import a49_0x3ca6fe,{OPS,COMPONENT_OPS}from'./searcher.jsx';import{Message,Confirm,Prompt}from'../../utils/index.js';const {storage}=StardustBrowser,{deepCopy}=StardustJs[a49_0x3107c(0x17f)];function a49_0x1599(){const _0x28ab37=['2.\x20新增条件','config','splice',']\x20已删除','conditions','saveCache','.condition-expression','sorts','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20现在,上面已经有了查询条件,试着点击“查询”按钮,即可查询数据了。\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','max','notIn','value','el-input-number','number','includes','确定删除查询视图\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20刚才你已经新增了若干个条件,并且填写了条件表达式。现在可以保存这些条件为视图,这样下次可以直接选择此视图方便地查询数据。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>现在,点击“保存当前视图”按钮,并为其填写一个合适的名字。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','prop','.x-select.field-select','calcParams','串联不同逻辑表达式请使用小括号区分','date','handleReset','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20这里有所有你需要查看、操作的字段,可以选择其中任意一个。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>现在,请试着选择某个字段。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','calcExpression','init','handleSelectOp','and','like','currentView','[Op.','items','.x-select.condition-select','type','clearable','Settings[','_parent','请输入新视图名称','trim','5eCjgOW','columns','setJson','notLike','5.\x20填写值/选择选项、时间','comp','search','textarea','conditionNo','getJson','special','save','ElInputNumber','some','virtual','Searcher','setCurrentView','between','order','视图保存成功','.searcher.pc-x-drawer\x20.el-drawer__footer\x20.el-button--primary','4rinNCm','traditional','1874997TtZzaN','page','desc','视图名称\x20','key','is_system','Searcher[','expression','6.\x20组合查询条件','checkFilled','join','1241622qXXBFf','43134nAEmGz','local','replaceAll','startsWith','uid','handleSelectView','push','XSelect','\x20已存在,请重新输入','parseCondition','filter','handleSelectField','forEach','views','item','系统视图不可修改,可保存为新视图,','4.\x20选择查询方式','.value-container','universal','assign','isArray','NE_','88VdnFiz','viewName','$emit','find','visible','component','name','map','NOT_','ElDatePicker','length','ElInput','slice','funcs','.add-condition','7.\x20保存视图','ops','1.\x20选择视图','544581PTQcyS','\x20吗?','3.\x20选择字段','stopPropagation','898173IDpxWz','getCurrentView','29778810izIyJs','6157606SzRvyt','条件不存在:\x20','calcTree','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20这里有所有你需要用到的查询方式,不同的字段类型对应着不同的查询方式,可选择提供的任意一个方式。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>现在,请试着选择某个查询方式。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];a49_0x1599=function(){return _0x28ab37;};return a49_0x1599();}export default{'name':a49_0x3107c(0x1c5),'props':{'uid':String,'columns':Array,'config':Object},'emits':[a49_0x3107c(0x1bc),'save'],'data'(){const _0x42e5f2=a49_0x3107c;return{'visible':![],'activeName':'search','sortableColumns':[],'sortOptions':[{'text':'升序','value':'asc'},{'text':'降序','value':_0x42e5f2(0x1cf)}],'sorts':[],'conditionNo':0x1,'conditions':[],'expression':'','viewName':'','views':[],'tourGuide':{'visible':![],'steps':[{'target':'.views-select','title':_0x42e5f2(0x183),'description':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-danger)\x22>视图,是一组查询条件。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20这里选择下拉框里的某个视图,然后可以利用此视图进行数据查询。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20如果还没有自定义的视图,则需要添加。鼠标放到下拉框上,点击下拉框右侧的小叉号,以取消选中当前的默认视图,然后才能去新增条件,并保存为新的视图。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>现在,请试着点击下拉框右侧的小叉号。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'},{'target':_0x42e5f2(0x180),'title':_0x42e5f2(0x18f),'description':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20这里可添加任意多个查询条件,每个条件可:\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ol\x20style=\x22list-style:\x20disc;\x20padding-left:\x2013px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li>选择任意字段</li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li>选择任意查询方式</li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li>填写任意值,或选择任意选项、时间</li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</ol>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20然后,任意组合这些查询条件,从而可进行任意查询。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>现在,请试着点击\x22新增条件\x22按钮。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'},{'target':_0x42e5f2(0x1a1),'title':_0x42e5f2(0x186),'description':_0x42e5f2(0x1a6)},{'target':_0x42e5f2(0x1af),'title':_0x42e5f2(0x1e9),'description':_0x42e5f2(0x18e)},{'target':_0x42e5f2(0x1ea),'title':_0x42e5f2(0x1ba),'description':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20这里填写你要查询的关键词,或选择对应的下拉选项,或选择时间。<br><br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>现在,请试着填写某个关键词,或选择某个选项、时间。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'},{'target':_0x42e5f2(0x195),'title':_0x42e5f2(0x1d5),'description':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20鉴于你可以添加多个条件,每个条件可任意组合,且支持数学逻辑中的“与”、“或”关系。<br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20这里就需要明确表达出你想用哪几个条件来查询,并且这些条件是以什么样的方式来组合。<br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20示例如下:<br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<ol\x20style=\x22list-style:\x20disc;\x20padding-left:\x2013px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li>条件1、条件2、条件3同时成立,表达式为:<span\x20style=\x22color:\x20var(--el-color-warning)\x22>1\x20and\x202\x20and\x203</span></li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li>条件1、条件2同时成立,或者条件3成立,表达式为:<span\x20style=\x22color:\x20var(--el-color-warning)\x22>(1\x20and\x202)\x20or\x203</span></li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li>条件1、条件2同时成立,或条件2、条件3同时成立,表达式为:<span\x20style=\x22color:\x20var(--el-color-warning)\x22>(1\x20and\x202)\x20or\x20(2\x20and\x203)</span></li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</ol>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-primary)\x22>你想简单查询,表达式就非常简单。如果你想复杂查询,那么表达式就需要按需填写了。</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22color:\x20var(--el-color-success)\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20现在,请试着填写表达式。如果你刚刚只添加了一个条件,且其序号为1,那么这里的表达式暂时填写\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20style=\x22color:\x20var(--el-color-warning)\x22>1</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20就好\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'},{'target':'.save-view','title':_0x42e5f2(0x181),'description':_0x42e5f2(0x19f)},{'target':_0x42e5f2(0x1ca),'title':'8.\x20查询数据','description':_0x42e5f2(0x197)}]}};},'computed':{'key'(){const _0x45a07b=a49_0x3107c;return _0x45a07b(0x1d3)+this[_0x45a07b(0x1dd)]+']';},'currentView'(){const _0x1b919c=a49_0x3107c;return this['views'][_0x1b919c(0x175)](_0x2f2803=>_0x2f2803[_0x1b919c(0x178)]===this['viewName']);}},'watch':{'config':a49_0x3107c(0x1a8)},'created'(){const _0x37091c=a49_0x3107c;this[_0x37091c(0x1a8)]();},'render':a49_0x3ca6fe,'methods':{'init'(){const _0x20d110=a49_0x3107c;let {views:views=[],viewName:_0x40666b,..._0x231875}=this[_0x20d110(0x1dd)]&&storage['local'][_0x20d110(0x1bf)](this[_0x20d110(0x1d1)],{})||{};this[_0x20d110(0x190)][_0x20d110(0x1e6)]&&(this[_0x20d110(0x190)][_0x20d110(0x1e6)][_0x20d110(0x1e5)](_0x3bc0db=>_0x3bc0db[_0x20d110(0x1d2)]=!![]),views=this['config'][_0x20d110(0x1e6)]['concat'](views));if(views[_0x20d110(0x17c)]&&!_0x40666b)_0x40666b=views[0x0]['name'];Object[_0x20d110(0x1ec)](this,{'views':views,'viewName':_0x40666b});const _0x129a3b=storage[_0x20d110(0x1da)][_0x20d110(0x1bf)](_0x20d110(0x1b2)+this[_0x20d110(0x1dd)]+']');if(_0x129a3b?.[_0x20d110(0x173)])this[_0x20d110(0x173)]=_0x129a3b[_0x20d110(0x173)];this['sortableColumns']=this[_0x20d110(0x1b7)][_0x20d110(0x1e3)](_0x161bc1=>!_0x161bc1[_0x20d110(0x1c4)]),this[_0x20d110(0x173)]?this[_0x20d110(0x1de)](this[_0x20d110(0x173)]):this[_0x20d110(0x1c6)](this[_0x20d110(0x190)][_0x20d110(0x1cc)]?this[_0x20d110(0x190)]:_0x231875);},'open'(){const _0x5e5845=a49_0x3107c;this[_0x5e5845(0x176)]=!![];},'close'(){const _0x59b38d=a49_0x3107c;this[_0x59b38d(0x176)]=![];},'getCurrentView'(){const _0x4cad18=a49_0x3107c;return{'sorts':this[_0x4cad18(0x196)],'conditionNo':this[_0x4cad18(0x1be)],'conditions':this[_0x4cad18(0x193)][_0x4cad18(0x179)](_0x1e9faf=>{const {item:_0x2e1f49,ops:_0x943012,component:_0x1b0370,..._0x3d2bcf}=_0x1e9faf;return _0x3d2bcf;}),'expression':this[_0x4cad18(0x1d4)]};},'saveCache'(){const _0x30e578=a49_0x3107c,_0x2c9137={'views':this[_0x30e578(0x1e6)][_0x30e578(0x1e3)](_0x178e14=>!_0x178e14[_0x30e578(0x1d2)])};this['viewName']&&this['currentView']?(_0x2c9137[_0x30e578(0x173)]=this[_0x30e578(0x173)],Object[_0x30e578(0x1ec)](this[_0x30e578(0x1ac)],this[_0x30e578(0x189)]())):Object[_0x30e578(0x1ec)](_0x2c9137,this[_0x30e578(0x189)]()),storage['local'][_0x30e578(0x1b8)](this[_0x30e578(0x1d1)],_0x2c9137);},'setCurrentView'(_0x56dd71){const _0x22bb8f=a49_0x3107c;if(!_0x56dd71)return;_0x56dd71[_0x22bb8f(0x193)]?.['forEach'](_0x3c8664=>{const _0x117578=_0x22bb8f,{prop:_0x292362,op:_0x204fef,value:_0x40e4fc,universal:_0x584c89}=_0x3c8664;_0x3c8664['item']=this[_0x117578(0x1b7)][_0x117578(0x175)](_0x41d91e=>_0x41d91e[_0x117578(0x1a0)]===_0x292362),this[_0x117578(0x1e4)](_0x3c8664,_0x292362),this[_0x117578(0x1a9)](_0x3c8664,_0x204fef),_0x3c8664[_0x117578(0x19a)]=_0x40e4fc;const _0x7b3b8=_0x3c8664['item'][_0x117578(0x1bb)]||_0x3c8664['component'];_0x3c8664[_0x117578(0x182)]=COMPONENT_OPS[_0x584c89?'universal':_0x7b3b8][_0x117578(0x179)](_0x5c280c=>OPS[_0x5c280c]);}),!_0x56dd71[_0x22bb8f(0x1be)]&&_0x56dd71['conditions']?.[_0x22bb8f(0x17c)]&&(_0x56dd71[_0x22bb8f(0x1be)]=Math[_0x22bb8f(0x198)]['apply'](null,_0x56dd71[_0x22bb8f(0x193)][_0x22bb8f(0x179)](_0x23d500=>_0x23d500['no']))+0x1),this[_0x22bb8f(0x173)]=_0x56dd71[_0x22bb8f(0x178)],Object[_0x22bb8f(0x1ec)](this,_0x56dd71);},'handleSearch'(){const _0x16694e=a49_0x3107c;let _0x41681a=null;try{_0x41681a=this[_0x16694e(0x1a2)]();}catch(_0x44a1a4){return Message['w'](_0x44a1a4['toString']()),![];}return this['uid']&&_0x41681a&&this[_0x16694e(0x194)](),_0x41681a=_0x41681a||{'where':{}},_0x41681a[_0x16694e(0x1ce)]=0x1,this[_0x16694e(0x174)](_0x16694e(0x1bc),_0x41681a),this[_0x16694e(0x176)]=![],!![];},'handleReset'(){const _0x9734e0={'sorts':[],'conditionNo':0x1,'conditions':[],'expression':''};Object['assign'](this,_0x9734e0),this['setCurrentView'](_0x9734e0);},'calcParams'(){const _0x124f61=a49_0x3107c,_0x3b69db=this[_0x124f61(0x18d)]();if(!_0x3b69db)return;const _0x5c745d=(_0x5c5c56,_0x5ba614)=>{const _0x2b7ade=_0x124f61,_0x148167=[],_0x52ba6f=_0x2b7ade(0x1ad)+_0x5c5c56['type']+']';_0x5ba614[_0x52ba6f]=_0x148167;for(let _0x18bed2 of _0x5c5c56[_0x2b7ade(0x1ae)]){if(typeof _0x18bed2==='string'){const _0x5b31b0=this[_0x2b7ade(0x193)][_0x2b7ade(0x175)](_0x903e41=>_0x903e41['no']===_0x18bed2*0x1);if(!_0x5b31b0)throw _0x2b7ade(0x18c)+_0x18bed2;else{if(!this[_0x2b7ade(0x1d6)](_0x5b31b0)){if(this['config'][_0x2b7ade(0x1cc)]||this[_0x2b7ade(0x190)]['ignoreUnfilled'])continue;throw'条件不完整:\x20'+_0x18bed2;}}_0x148167[_0x2b7ade(0x1df)](this[_0x2b7ade(0x1e2)](_0x5b31b0));}else{const _0x56cc7c={};_0x148167['push'](_0x56cc7c),_0x5c745d(_0x18bed2,_0x56cc7c);}}if(!_0x148167['length'])delete _0x5ba614[_0x52ba6f];},_0x3e6b8c={};_0x5c745d(_0x3b69db,_0x3e6b8c);const _0x2afbfa={'where':_0x3e6b8c};return this['sorts']['length']&&(_0x2afbfa[_0x124f61(0x1c8)]=deepCopy(this['sorts'])),_0x2afbfa;},'calcTree'(_0x361029=!![]){const _0x28bdb1=a49_0x3107c,_0xfcab23=this['expression'][_0x28bdb1(0x1b5)]()[_0x28bdb1(0x1db)]('&&',_0x28bdb1(0x1aa))[_0x28bdb1(0x1db)]('||','or')['replace'](/and/ig,_0x28bdb1(0x1aa))['replace'](/or/ig,'or');if(!_0xfcab23)return null;const _0x32bee4=_0xfcab23['split'](/(\(|\)|\s)/)[_0x28bdb1(0x1e3)](_0x308409=>_0x308409[_0x28bdb1(0x1b5)]()),_0x38f7f2=(_0x3cc787,_0x5e4239)=>{const _0xdee131=_0x28bdb1;while(_0x5e4239[_0xdee131(0x17c)]){const _0x464987=_0x5e4239['shift']();if([_0xdee131(0x1aa),'or'][_0xdee131(0x19d)](_0x464987)){if(_0x3cc787[_0xdee131(0x1b0)]&&_0x3cc787[_0xdee131(0x1b0)]!==_0x464987)throw _0xdee131(0x1a3);_0x3cc787[_0xdee131(0x1b0)]=_0x464987;}else{if(_0x464987==='('){const _0x348a8a={'type':'','items':[]};_0x3cc787[_0xdee131(0x1ae)][_0xdee131(0x1df)](_0x348a8a),_0x348a8a['_parent']=_0x3cc787,_0x38f7f2(_0x348a8a,_0x5e4239);break;}else _0x464987===')'?(_0x38f7f2(_0x3cc787[_0xdee131(0x1b3)],_0x5e4239),delete _0x3cc787[_0xdee131(0x1b3)]):_0x3cc787['items'][_0xdee131(0x1df)](_0x464987);}}},_0x29adeb={'type':'','items':[]};return _0x38f7f2(_0x29adeb,_0x32bee4),_0x361029&&(_0x29adeb['type']||=_0x28bdb1(0x1aa)),_0x29adeb;},'calcExpression'(_0x3d6af5){const _0x4ed66f=a49_0x3107c,_0x30daba=_0x1af18e=>{const _0xe648bc=a49_0x2a51;if(!_0x1af18e)return'';if(typeof _0x1af18e==='string')return _0x1af18e;const {type:_0x233483,items:_0x178f22}=_0x1af18e;if(!_0x178f22[_0xe648bc(0x17c)])return'';return'('+_0x178f22['map'](_0x30daba)[_0xe648bc(0x1e3)](_0x97c905=>_0x97c905)[_0xe648bc(0x1d7)]('\x20'+_0x233483+'\x20')+')';};let _0x15ce88=_0x30daba(_0x3d6af5)[_0x4ed66f(0x17e)](0x1,-0x1);while(/\(\d+\)/['test'](_0x15ce88)){_0x15ce88=_0x15ce88['replace'](/\((\d+)\)/g,'$1');}return _0x15ce88;},'parseCondition'(_0x79477a){const _0x14140b=a49_0x3107c;let {item:_0x493eb2,component:_0x3075d3,prop:_0x408652,op:_0x4b7d28,value:_0x536a61}=_0x79477a;const _0x1a16a6={};if(_0x4b7d28==='special'){const _0x3f90ca=_0x536a61[_0x14140b(0x1dc)](_0x14140b(0x17a)),_0x36101f=_0x536a61['startsWith'](_0x14140b(0x171));if(_0x536a61['includes']('NULL'))_0x536a61=null;else _0x536a61[_0x14140b(0x19d)]('BLANK')&&(_0x536a61='');if(_0x3f90ca)_0x536a61={'[Op.not]':_0x536a61};else _0x36101f&&(_0x536a61={'[Op.ne]':_0x536a61});return _0x1a16a6[_0x408652]=_0x536a61,_0x1a16a6;}return(_0x4b7d28===_0x14140b(0x1ab)||_0x4b7d28===_0x14140b(0x1b9))&&(_0x536a61='%'+_0x536a61+'%'),(_0x4b7d28==='in'||_0x4b7d28===_0x14140b(0x199))&&(!_0x493eb2['options']&&(_0x536a61=_0x536a61['split'](','),(_0x3075d3===_0x14140b(0x1c2)||_0x3075d3===_0x14140b(0x19b)||_0x79477a[_0x14140b(0x1b0)]===_0x14140b(0x19c))&&(_0x536a61=_0x536a61[_0x14140b(0x179)](Number)))),_0x1a16a6[_0x408652]={['[Op.'+_0x4b7d28+']']:_0x536a61},_0x1a16a6;},'checkFilled'(_0x451b8a){const _0x381634=a49_0x3107c;if(!_0x451b8a[_0x381634(0x1a0)]||!_0x451b8a['op'])return![];const _0xb9c37a=Array[_0x381634(0x1ed)](_0x451b8a[_0x381634(0x19a)])?_0x451b8a[_0x381634(0x19a)]:[_0x451b8a[_0x381634(0x19a)]];return _0xb9c37a['length']&&_0xb9c37a['every'](_0x3725bb=>{const _0x35a545=_0x381634;return typeof _0x3725bb!=='string'||_0x3725bb[_0x35a545(0x17c)];});},'handleAdd'(){const _0x438e68=a49_0x3107c;this[_0x438e68(0x193)][_0x438e68(0x1df)]({'no':this[_0x438e68(0x1be)]++,'prop':'','op':'','value':'','component':_0x438e68(0x17d),'ops':[],'item':{}});},'handleDelete'(_0x1dfad5){const _0x1cb8e9=a49_0x3107c,_0xcdbe3d=this[_0x1cb8e9(0x193)][_0x1dfad5]['no']+'',_0x38c1eb=this[_0x1cb8e9(0x18d)](![]),_0x2dd1c9=_0x4908d3=>{const _0x256f1e=_0x1cb8e9;if(!_0x4908d3)return;for(let _0x2debe6=_0x4908d3['items']['length']-0x1;_0x2debe6>=0x0;_0x2debe6--){if(_0x4908d3['items'][_0x2debe6]===_0xcdbe3d)_0x4908d3[_0x256f1e(0x1ae)][_0x256f1e(0x191)](_0x2debe6,0x1);else typeof _0x4908d3[_0x256f1e(0x1ae)][_0x2debe6]==='object'&&_0x2dd1c9(_0x4908d3[_0x256f1e(0x1ae)][_0x2debe6]);}};_0x2dd1c9(_0x38c1eb),this[_0x1cb8e9(0x1d4)]=this[_0x1cb8e9(0x1a7)](_0x38c1eb),this['conditions'][_0x1cb8e9(0x191)](_0x1dfad5,0x1);},'handleSelectField'(_0x1f6d9c,_0x3c61aa){const _0x1212d6=a49_0x3107c;_0x1f6d9c[_0x1212d6(0x19a)]='',_0x1f6d9c[_0x1212d6(0x1a0)]=_0x3c61aa,_0x1f6d9c[_0x1212d6(0x1e7)]=this[_0x1212d6(0x1b7)][_0x1212d6(0x175)](_0x5c1afe=>_0x5c1afe['prop']===_0x1f6d9c[_0x1212d6(0x1a0)])||{};const {options:_0x8ecf2c,type:_0x6f850d,formAttrs:formAttrs={}}=_0x1f6d9c['item'],_0x3bbd6f={..._0x1f6d9c[_0x1212d6(0x1e7)],...formAttrs},{comp:_0x3c698f,universal:_0x499817,visible:_0x373ef0,canAdd:_0x5c1f6e,canEdit:_0xad3514,required:_0x576f28,slot:_0x205847,span:_0x5c47d6,tableAttrs:_0x300fbf,formAttrs:_0x5ba299,tagTypes:_0x15bf62,tagValues:_0x4efa99,width:_0x1f14ad,minWidth:_0x2004f9,disabled:_0xd1b362,readonly:_0x3ae5d5,..._0x579b6a}=_0x3bbd6f;_0x579b6a[_0x1212d6(0x1b1)]??=!![],_0x1f6d9c[_0x1212d6(0x190)]=_0x579b6a,_0x1f6d9c[_0x1212d6(0x177)]=_0x3c698f||_0x8ecf2c&&_0x1212d6(0x1e0)||_0x6f850d==='number'&&_0x1212d6(0x1c2)||_0x1212d6(0x17d),_0x1f6d9c[_0x1212d6(0x182)]=COMPONENT_OPS[_0x499817?_0x1212d6(0x1eb):_0x1f6d9c[_0x1212d6(0x177)]][_0x1212d6(0x179)](_0x3e56fb=>OPS[_0x3e56fb]),_0x1f6d9c['op']=_0x1f6d9c['ops'][0x0]['value'];_0x1f6d9c[_0x1212d6(0x177)]===_0x1212d6(0x17b)&&(_0x1f6d9c[_0x1212d6(0x177)]=_0x1212d6(0x17d),_0x579b6a[_0x1212d6(0x1b0)]=_0x1212d6(0x1a4));if(_0x579b6a[_0x1212d6(0x1b0)]===_0x1212d6(0x1bd))delete _0x579b6a[_0x1212d6(0x1b0)];},'handleSelectOp'(_0x4ce084,_0x341d8a){const _0x23c464=a49_0x3107c;_0x4ce084['op']=_0x341d8a;if(_0x341d8a==='between')_0x4ce084['value']=['',''];else['in',_0x23c464(0x199)][_0x23c464(0x19d)](_0x341d8a)&&(_0x4ce084[_0x23c464(0x19a)]=[]);(_0x341d8a===_0x23c464(0x1c0)||![_0x23c464(0x1c7),'in','notIn'][_0x23c464(0x19d)](_0x341d8a)&&Array[_0x23c464(0x1ed)](_0x341d8a))&&(_0x4ce084[_0x23c464(0x19a)]='');},'handleSelectView'(_0x5b8aa5){const _0x385ed1=a49_0x3107c;if(!_0x5b8aa5)this[_0x385ed1(0x1a5)]();else{const _0x8ea3bf=this[_0x385ed1(0x1e6)][_0x385ed1(0x175)](_0x2780ce=>_0x2780ce[_0x385ed1(0x178)]===_0x5b8aa5);if(!_0x8ea3bf)return this[_0x385ed1(0x173)]='',this[_0x385ed1(0x1a5)](),this[_0x385ed1(0x194)]();this[_0x385ed1(0x1c6)](deepCopy(_0x8ea3bf));}},async 'handleSaveView'(){const _0x41f6cc=a49_0x3107c,_0x2249e8=this[_0x41f6cc(0x189)]();let _0x2e59cd=![];if(this['viewName']&&this[_0x41f6cc(0x1ac)]){_0x2e59cd=this[_0x41f6cc(0x1ac)]['is_system'];if(!_0x2e59cd){Object[_0x41f6cc(0x1ec)](this[_0x41f6cc(0x1ac)],_0x2249e8),this['saveCache'](),Message['s'](_0x41f6cc(0x1c9));return;}}let _0xa19673=await Prompt({'title':'提示','message':(_0x2e59cd?_0x41f6cc(0x1e8):'')+_0x41f6cc(0x1b4)});_0xa19673=_0xa19673['trim']();if(!_0xa19673)return;if(this[_0x41f6cc(0x1e6)][_0x41f6cc(0x1c3)](_0x1fbec7=>_0x1fbec7[_0x41f6cc(0x178)]===_0xa19673))return Message['w'](_0x41f6cc(0x1d0)+_0xa19673+_0x41f6cc(0x1e1));this['views'][_0x41f6cc(0x1df)]({'name':_0xa19673,..._0x2249e8}),this[_0x41f6cc(0x173)]=_0xa19673,this[_0x41f6cc(0x1de)](_0xa19673),this[_0x41f6cc(0x194)](),Message['s'](_0x41f6cc(0x1c9));},async 'handleDeleteView'(_0x284aec,_0x95ed18,_0x158948){const _0x4e6e93=a49_0x3107c;_0x158948[_0x4e6e93(0x187)]();if(!await Confirm['w']({'title':'提示','message':_0x4e6e93(0x19e)+_0x284aec['name']+_0x4e6e93(0x185)}))return;this['viewName']===_0x284aec[_0x4e6e93(0x178)]&&(this['viewName']='',this['handleReset']()),this[_0x4e6e93(0x1e6)][_0x4e6e93(0x191)](_0x95ed18,0x1),this[_0x4e6e93(0x194)](),Message['s']('视图\x20['+_0x284aec[_0x4e6e93(0x178)]+_0x4e6e93(0x192));},'handleSearchView'(_0x4d51a0){const _0x4966c4=a49_0x3107c;this[_0x4966c4(0x1c6)](_0x4d51a0);if(!this['handleSearch']())return;this['$emit'](_0x4966c4(0x1c1),{'viewName':_0x4d51a0['name']});},'handleAddSort'(){const _0x5558e3=a49_0x3107c;this[_0x5558e3(0x196)][_0x5558e3(0x1df)]([this['sortableColumns'][0x0]['prop'],'asc']);}}};
|
|
@@ -1,80 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
name: 'Settings',
|
|
5
|
-
props: {
|
|
6
|
-
modelValue: Object
|
|
7
|
-
},
|
|
8
|
-
emits: ['update:modelValue', 'reset', 'init', 'save'],
|
|
9
|
-
data () {
|
|
10
|
-
return {
|
|
11
|
-
activeName: 'columns',
|
|
12
|
-
columns: []
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
computed: {
|
|
16
|
-
hideColumns () {
|
|
17
|
-
const value = this.$attrs['hide-settings-columns']
|
|
18
|
-
return value === '' || value === true
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
watch: {
|
|
22
|
-
modelValue: {
|
|
23
|
-
handler (value) {
|
|
24
|
-
this.columns = value.columns.map(col => {
|
|
25
|
-
return {
|
|
26
|
-
...col,
|
|
27
|
-
show: col.show !== false,
|
|
28
|
-
width: col.width || col.minWidth
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
},
|
|
32
|
-
immediate: true
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
async mounted () {
|
|
36
|
-
await window.DynamicLibs?.use('Sortable')
|
|
37
|
-
this.initDraggable()
|
|
38
|
-
},
|
|
39
|
-
beforeUnmount () {
|
|
40
|
-
this.sortable?.destroy()
|
|
41
|
-
},
|
|
42
|
-
methods: {
|
|
43
|
-
initDraggable () {
|
|
44
|
-
const dict = {}
|
|
45
|
-
this.columns.forEach(col => dict[col.prop] = col)
|
|
46
|
-
this.sortable = new window.Sortable(this.$refs.colsTable, {
|
|
47
|
-
sort: true,
|
|
48
|
-
draggable: '.row',
|
|
49
|
-
onEnd: (e) => {
|
|
50
|
-
const props = [...e.to.querySelectorAll('.row')].map(e => e.dataset.prop)
|
|
51
|
-
this.columns = props.map(p => dict[p])
|
|
52
|
-
this.update()
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
},
|
|
56
|
-
async handleResetColumns () {
|
|
57
|
-
if (!await Confirm.w({ message: '确定重置吗?', title: '警告' })) return
|
|
58
|
-
this.columns = []
|
|
59
|
-
this.update()
|
|
60
|
-
this.$emit('init')
|
|
61
|
-
},
|
|
62
|
-
handleToggle (column) {
|
|
63
|
-
column.show = !column.show
|
|
64
|
-
this.update()
|
|
65
|
-
},
|
|
66
|
-
update () {
|
|
67
|
-
this.columns.forEach(col => {
|
|
68
|
-
col.hide = !col.show
|
|
69
|
-
})
|
|
70
|
-
const modelValue = {
|
|
71
|
-
...this.modelValue,
|
|
72
|
-
columns: this.columns.map(col => {
|
|
73
|
-
const { prop, label, show, hide, width } = col
|
|
74
|
-
return { prop, label, show, hide, width }
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
this.$emit('save', modelValue)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
1
|
+
function a50_0x1624(){const _0x43c4bf=['init','initDraggable','use','DynamicLibs','columns','Sortable','hide','map','5642586AKwNke','Settings','modelValue','681312SGUTzH','colsTable','destroy','update:modelValue','dataset','update','reset','$attrs','prop','3383002BzjCqd','forEach','$emit','2039005WSgOXK','show','2pynwFw','.row','4WVlsdn','845610CwkNIf','minWidth','save','757054pFZYEK','sortable','8JRMIFL','3427458FEltJo','querySelectorAll'];a50_0x1624=function(){return _0x43c4bf;};return a50_0x1624();}const a50_0x38f1d9=a50_0xf641;function a50_0xf641(_0x318ad5,_0x30f49e){const _0x16248e=a50_0x1624();return a50_0xf641=function(_0xf641c0,_0x1a768c){_0xf641c0=_0xf641c0-0x1cf;let _0x46eb08=_0x16248e[_0xf641c0];return _0x46eb08;},a50_0xf641(_0x318ad5,_0x30f49e);}(function(_0x571f5d,_0x1c62d5){const _0x62e317=a50_0xf641,_0x6c24c4=_0x571f5d();while(!![]){try{const _0x583455=parseInt(_0x62e317(0x1df))/0x1+parseInt(_0x62e317(0x1d9))/0x2*(-parseInt(_0x62e317(0x1ef))/0x3)+-parseInt(_0x62e317(0x1db))/0x4*(-parseInt(_0x62e317(0x1d7))/0x5)+-parseInt(_0x62e317(0x1e2))/0x6+parseInt(_0x62e317(0x1d4))/0x7*(-parseInt(_0x62e317(0x1e1))/0x8)+parseInt(_0x62e317(0x1ec))/0x9+-parseInt(_0x62e317(0x1dc))/0xa;if(_0x583455===_0x1c62d5)break;else _0x6c24c4['push'](_0x6c24c4['shift']());}catch(_0x282c65){_0x6c24c4['push'](_0x6c24c4['shift']());}}}(a50_0x1624,0x67e8f));import{Confirm}from'../../utils/message.js';export default{'name':a50_0x38f1d9(0x1ed),'props':{'modelValue':Object},'emits':[a50_0x38f1d9(0x1f2),a50_0x38f1d9(0x1d1),a50_0x38f1d9(0x1e4),a50_0x38f1d9(0x1de)],'data'(){const _0x34e690=a50_0x38f1d9;return{'activeName':_0x34e690(0x1e8),'columns':[]};},'computed':{'hideColumns'(){const _0x4ca79e=a50_0x38f1d9,_0x3d7f01=this[_0x4ca79e(0x1d2)]['hide-settings-columns'];return _0x3d7f01===''||_0x3d7f01===!![];}},'watch':{'modelValue':{'handler'(_0x1fdf2b){const _0x4309d9=a50_0x38f1d9;this[_0x4309d9(0x1e8)]=_0x1fdf2b['columns']['map'](_0x8dcba7=>{const _0x1a3c4e=_0x4309d9;return{..._0x8dcba7,'show':_0x8dcba7['show']!==![],'width':_0x8dcba7['width']||_0x8dcba7[_0x1a3c4e(0x1dd)]};});},'immediate':!![]}},async 'mounted'(){const _0x56dda9=a50_0x38f1d9;await window[_0x56dda9(0x1e7)]?.[_0x56dda9(0x1e6)](_0x56dda9(0x1e9)),this[_0x56dda9(0x1e5)]();},'beforeUnmount'(){const _0x191d1f=a50_0x38f1d9;this[_0x191d1f(0x1e0)]?.[_0x191d1f(0x1f1)]();},'methods':{'initDraggable'(){const _0x48d9b6=a50_0x38f1d9,_0x53387c={};this[_0x48d9b6(0x1e8)][_0x48d9b6(0x1d5)](_0x3046d7=>_0x53387c[_0x3046d7[_0x48d9b6(0x1d3)]]=_0x3046d7),this['sortable']=new window[(_0x48d9b6(0x1e9))](this['$refs'][_0x48d9b6(0x1f0)],{'sort':!![],'draggable':_0x48d9b6(0x1da),'onEnd':_0x43cbb8=>{const _0xd55c13=_0x48d9b6,_0x287248=[..._0x43cbb8['to'][_0xd55c13(0x1e3)](_0xd55c13(0x1da))][_0xd55c13(0x1eb)](_0x5af26b=>_0x5af26b[_0xd55c13(0x1cf)][_0xd55c13(0x1d3)]);this['columns']=_0x287248[_0xd55c13(0x1eb)](_0x231a8e=>_0x53387c[_0x231a8e]),this[_0xd55c13(0x1d0)]();}});},async 'handleResetColumns'(){const _0x1df33f=a50_0x38f1d9;if(!await Confirm['w']({'message':'确定重置吗?','title':'警告'}))return;this[_0x1df33f(0x1e8)]=[],this[_0x1df33f(0x1d0)](),this['$emit'](_0x1df33f(0x1e4));},'handleToggle'(_0x21d251){const _0x1b08db=a50_0x38f1d9;_0x21d251['show']=!_0x21d251[_0x1b08db(0x1d8)],this[_0x1b08db(0x1d0)]();},'update'(){const _0x442b76=a50_0x38f1d9;this['columns'][_0x442b76(0x1d5)](_0x3a6eec=>{const _0x44e4a5=_0x442b76;_0x3a6eec[_0x44e4a5(0x1ea)]=!_0x3a6eec[_0x44e4a5(0x1d8)];});const _0x1a9efc={...this[_0x442b76(0x1ee)],'columns':this[_0x442b76(0x1e8)][_0x442b76(0x1eb)](_0x4749ab=>{const {prop:_0x503d08,label:_0x5d601f,show:_0x14f029,hide:_0x426a22,width:_0xd59984}=_0x4749ab;return{'prop':_0x503d08,'label':_0x5d601f,'show':_0x14f029,'hide':_0x426a22,'width':_0xd59984};})};this[_0x442b76(0x1d6)](_0x442b76(0x1de),_0x1a9efc);}}};
|