@leevan/jtui 2.0.32 → 2.0.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leevan/jtui",
3
- "version": "2.0.32",
3
+ "version": "2.0.34",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -0,0 +1,17 @@
1
+ /*
2
+ * @Author: leevan
3
+ * @Date: 2024-04-20 17:28:33
4
+ * @LastEditTime: 2024-04-20 17:28:36
5
+ * @LastEditors: leevan
6
+ * @FilePath: /jtui-pc/packages/Search-Type/index.js
7
+ */
8
+ // 导入组件,组件必须声明 name
9
+ import SearchType from './index.vue';
10
+
11
+ // 为组件提供 install 安装方法,供按需引入
12
+ SearchType.install = function (Vue) {
13
+ Vue.component(SearchType.name, SearchType)
14
+ }
15
+
16
+ // 导出组件
17
+ export default SearchType
@@ -0,0 +1,555 @@
1
+ <!--
2
+ * @Author: leevan
3
+ * @Date: 2024-04-20 17:23:32
4
+ * @LastEditTime: 2024-04-22 16:55:50
5
+ * @LastEditors: leevan
6
+ * @FilePath: /jt-system-manage/src/packages/Search-Type/index.vue
7
+ -->
8
+ <template>
9
+ <div class="search-tb" @keydown.enter="enterClick">
10
+ <div v-for="(im, index) in viewData" :key="index" class="search-tb-row">
11
+ <div style="display:inline-block">
12
+ <span v-if="index > 0">分组</span><el-checkbox v-if="index > 0" v-model="im.checked"></el-checkbox>
13
+ <el-radio-group style="margin-left:12px" v-if="index > 0" v-model="im.radio" size="mini">
14
+ <el-radio-button label="and">并且</el-radio-button>
15
+ <el-radio-button label="or">或者</el-radio-button>
16
+ </el-radio-group>
17
+
18
+ <span :style="{ marginLeft: index === 0 && viewData.length > 1 ? '189px' : 0 }" @click="getData">查询类型</span>
19
+ <el-select @change="typeChange(arguments, im)" size="mini" popper-class="max-height-popper search-base-slt"
20
+ v-model="im.search_type" placeholder="请选择">
21
+ <el-option v-for="(item, index) in options_type"
22
+ :key="index" :label="item.srname"
23
+ :value="item.rootpath">
24
+ </el-option>
25
+ </el-select>
26
+ </div>
27
+
28
+ <div style="display:inline-block" v-if="im.status == 1 || im.status == 2 || im.status == 8">
29
+ <jt-form-pc size="mini" id="form_s1" :collapseTags="true" :model="im.model" labelWidth="12"
30
+ @casChange="casChange(arguments, im)" :formConfig="im.formConfig">
31
+ </jt-form-pc>
32
+ </div>
33
+
34
+ <div style="display:inline-block;margin-left:10px;" v-if="im.status == 3 || im.status == 6">
35
+ <!-- <jt-form-pc size="mini" id="form_s2" :model="im.model_3"
36
+ labelWidth="12"
37
+ :formConfig="im.formConfig_3">
38
+ </jt-form-pc> -->
39
+ <el-input size="mini" v-model="im.model_3.input" placeholder="请输入"></el-input>
40
+ </div>
41
+
42
+ <div style="display:inline-block" v-if="im.status == 7">
43
+ <jt-form-pc size="mini" id="form_s3" :model="im.model_4" labelWidth="12" :formConfig="im.formConfig_4">
44
+ </jt-form-pc>
45
+ </div>
46
+
47
+ <div style="display:inline-block" v-if="im.status == 5">
48
+ <el-cascader-multi ref="type5Ref" style="margin-left:15px;width:300px" size="mini" collapse-tags
49
+ show-leaf-label :is-two-dimension-value="false" v-model="im.model_5.cascader"
50
+ :data="im.formConfig_5"> </el-cascader-multi>
51
+ </div>
52
+
53
+ <div style="display:inline-block;margin-left:12px;position:relative;"
54
+ v-if="im.status == 3 || im.status == 4 || im.status == 7">
55
+ <el-checkbox-group size="mini" v-model="im.stations">
56
+ <el-checkbox-button v-for="(item, index) in im.checkboxData" :key="index"
57
+ :label="item.value">{{ item.label }}</el-checkbox-button>
58
+ </el-checkbox-group>
59
+ </div>
60
+
61
+ <div style="display:inline-block;margin-left:12px;position:relative;"
62
+ v-if="im.status == 9">
63
+ <tree-select v-model="im.stations" :activeType="im.active_type"
64
+ :baseUrl="listuri"
65
+ :checked="im.checkboxData"/>
66
+ </div>
67
+
68
+ <div class="st-btns" v-show="options_type.length > 1 && options_type[0].value !== 'All'">
69
+ <i class="jtIcon iconjianshao" v-if="index > 0" @click="dec_type(index)"></i>
70
+ <i style="color:#586bd1;margin-left:6px;float: right;" class="jtIcon iconjia1" @click="add_type"></i>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </template>
75
+
76
+ <script>
77
+ import TreeSelect from './tree-select.vue'
78
+ export default {
79
+ name:'search-type',
80
+ components:{
81
+ TreeSelect
82
+ },
83
+ props: {
84
+ options_type: {
85
+ type: Array,
86
+ default: () => []
87
+ },
88
+ listuri: {
89
+ type: String,
90
+ default: '',
91
+ },
92
+ selected: {
93
+ type: String,
94
+ default: ''
95
+ }
96
+ },
97
+ data() {
98
+ return {
99
+ isInit: true,
100
+ viewData: [
101
+ {
102
+ active_type: null,
103
+ search_type: this.selected,
104
+ status: -1,
105
+ model: {
106
+ cascader: ''
107
+ },
108
+ model_3: {
109
+ input: ''
110
+ },
111
+ m_cas: [],
112
+ checkboxData: [],
113
+ stations: [],
114
+ formConfig: [
115
+ {
116
+ label: "",
117
+ modelKey: "cascader",
118
+ type: "cascader",
119
+ width: 300,
120
+ path: '',
121
+ childPath: '',
122
+ checkStrictly: false,
123
+ params: {},
124
+ placeholder: '',
125
+ multiple: true,
126
+ isEnd: true,
127
+ filterable: false
128
+ }
129
+ ],
130
+ formConfig_3: [
131
+ {
132
+ label: "",
133
+ modelKey: "input",
134
+ type: "input",
135
+ width: 200,
136
+ placeholder: '请输入关键字'
137
+ }
138
+ ],
139
+ model_4: {
140
+ select: ''
141
+ },
142
+ formConfig_4: [
143
+ {
144
+ label: "",
145
+ modelKey: "select",
146
+ type: "select_r",
147
+ width: 260,
148
+ options: [],
149
+ multiple: true,
150
+ collapse: true,
151
+ remoteMethod: () => { }
152
+ }
153
+ ],
154
+ model_5: {
155
+ cascader: []
156
+ },
157
+ formConfig_5: [],
158
+ }
159
+ ],
160
+
161
+ }
162
+ },
163
+ created() {
164
+ this.typeChange([this.selected], this.viewData[0])
165
+ },
166
+ methods: {
167
+ removeDuplicateObj(arr) {
168
+ let obj = {};
169
+ arr = arr.reduce((newArr, next) => {
170
+ obj[next.value] ? "" : (obj[next.value] = true && newArr.push(next));
171
+ return newArr;
172
+ }, []);
173
+ return arr;
174
+ },
175
+ // 监听本页面的回车事件
176
+ enterClick(e) {
177
+ if (e.keyCode === 13) {
178
+ this.$emit('initedData', this.getData());
179
+ }
180
+ },
181
+ add_type() {
182
+ this.viewData.push({
183
+ active_type: null,
184
+ checked: false,
185
+ search_type: '',
186
+ status: -1,
187
+ model: {
188
+ cascader: ''
189
+ },
190
+ model_3: {
191
+ input: ''
192
+ },
193
+ m_cas: [],
194
+ checkboxData: [],
195
+ stations: [],
196
+ radio: 'and',
197
+ formConfig: [
198
+ {
199
+ label: "",
200
+ modelKey: "cascader",
201
+ type: "cascader",
202
+ width: 300,
203
+ path: '',
204
+ childPath: '',
205
+ checkStrictly: false,
206
+ params: {},
207
+ placeholder: '',
208
+ multiple: true,
209
+ isEnd: true,
210
+ filterable: false
211
+ }
212
+ ],
213
+ formConfig_3: [
214
+ {
215
+ label: "",
216
+ modelKey: "input",
217
+ type: "input",
218
+ width: 200,
219
+ placeholder: '请输入关键字'
220
+ }
221
+ ],
222
+ model_4: {
223
+ select: ''
224
+ },
225
+ formConfig_4: [
226
+ {
227
+ label: "",
228
+ modelKey: "select",
229
+ type: "select_r",
230
+ width: 200,
231
+ options: [],
232
+ multiple: true,
233
+ collapse: true,
234
+ remoteMethod: () => { }
235
+ }
236
+ ],
237
+ model_5: {
238
+ cascader: []
239
+ },
240
+ formConfig_5: []
241
+ })
242
+ this.$emit('count', this.viewData.length);
243
+ this.$parentStore.state.main.JtMessage.emit('searchTypeAdd');
244
+ },
245
+ dec_type(index) {
246
+ this.viewData.splice(index, 1);
247
+ this.$emit('count', this.viewData.length);
248
+ this.$parentStore.state.main.JtMessage.emit('searchTypeAdd');
249
+ },
250
+ async typeChange(arg, im) {
251
+ const result = this.options_type.find(item => item.rootpath === arg[0]);
252
+ im.active_type = result;
253
+ im.status = -1;
254
+ im.formConfig[0].path = this.listuri;
255
+ im.formConfig[0].childPath = result.rootpath;
256
+ this.$nextTick(() => {
257
+ im.status = result.invlbz;
258
+ this.$nextTick(async () => {
259
+ if (result.invlbz === '1') {
260
+ im.formConfig[0].multiple = false;
261
+ } else if (result.invlbz === '2' || result.invlbz === '8') {
262
+ im.formConfig[0].multiple = true;
263
+ } else if (result.invlbz === '3') {
264
+ im.checkboxData = result.srfield;
265
+ im.stations = result.selected;
266
+ } else if (result.invlbz === '4') {
267
+ const { data: res } = await this.$axios.post(this.listuri + result.rootpath);
268
+ im.stations = res.filter(item => item.selected == '1').map(i => i.value);
269
+ im.checkboxData = res;
270
+ } else if (result.invlbz === '5') {
271
+ im.formConfig_5 = result.enumlists
272
+ if (Array.isArray(result.selected) && result.selected[0].label == '默认分组') {
273
+ im.model_5.cascader = result.selected[0].value
274
+ } else {
275
+ im.model_5.cascader = result.selected;
276
+ }
277
+ } else if (result.invlbz === '7') {
278
+ im.stations = result.selected;
279
+ im.formConfig_4[0].remoteMethod = (query) => (this.remoteMethod(query, im, result))
280
+ im.checkboxData = result.enumlists;
281
+ }else if(result.invlbz === '9') {
282
+ if(result.selected){
283
+ im.checkboxData = result.selected;
284
+ im.stations = result.selected;
285
+ }
286
+ }
287
+ this.$nextTick(() => {
288
+ if (this.isInit) {
289
+ this.$emit('initedData', this.getData());
290
+ this.isInit = false;
291
+ }
292
+ })
293
+ })
294
+
295
+ })
296
+ },
297
+ casChange(arg, im) {
298
+ const res = arg[0].map(item => item.value)
299
+ im.m_cas = res;
300
+ },
301
+ //获取查询下拉列表
302
+ getData() {
303
+ return this.viewData.map(this.handlerData);
304
+ },
305
+ handlerData(item, index) {
306
+ let pubObj = {
307
+ invlbz: item.status,
308
+ group: item.checked,
309
+ relation: item.radio,
310
+ }
311
+ switch (item.status) {
312
+ case '0': {
313
+ return Object.assign(pubObj, {
314
+ srfield: item.active_type.srfield,
315
+ invalue: item.active_type.srfield,
316
+ })
317
+ }
318
+ case '1': {
319
+ if (item.model.cascader.length === 0) {
320
+ return false
321
+ }
322
+ return Object.assign(pubObj, {
323
+ srfield: item.active_type.srfield,
324
+ invalue: item.model.cascader[0]
325
+ })
326
+ }
327
+ case '2': {
328
+ if (item.m_cas.length === 0) {
329
+ return false
330
+ }
331
+ let casParam;
332
+ if (item.active_type.invltp === '1') {
333
+ casParam = item.m_cas.map(items => `'${items}'`).join(',')
334
+ } else if (item.active_type.invltp === '2') {
335
+ casParam = item.m_cas.join(',');
336
+ }
337
+ return Object.assign(pubObj, {
338
+ srfield: item.active_type.srfield,
339
+ invalue: casParam
340
+ })
341
+ }
342
+ case '3': {
343
+ if (item.stations.length === 0 || item.model_3.input === '') {
344
+ return false
345
+ }
346
+ return Object.assign(pubObj, {
347
+ srfield: item.stations,
348
+ invalue: item.model_3.input
349
+ })
350
+ }
351
+ case '4': {
352
+ if (item.stations.length === 0) {
353
+ return false
354
+ }
355
+ return Object.assign(pubObj, {
356
+ srfield: item.active_type.srfield,
357
+ invalue: item.stations.join(',')
358
+ })
359
+ }
360
+ case '5': {
361
+ if (item.model_5.cascader.length === 0) {
362
+ return false
363
+ }
364
+ return Object.assign(pubObj, {
365
+ srfield: item.active_type.srfield,
366
+ invalue: item.model_5.cascader.join(',')
367
+ })
368
+ }
369
+ case '6': {
370
+ if (item.model_3.input === '') {
371
+ return false
372
+ }
373
+ return Object.assign(pubObj, {
374
+ srfield: item.active_type.srfield,
375
+ invalue: item.model_3.input
376
+ })
377
+ }
378
+ case '7': {
379
+ if (item.stations.length === 0 || item.model_4.select.length === 0) {
380
+ return false
381
+ }
382
+ let casParam;
383
+ if (item.active_type.invltp === '1') {
384
+ casParam = item.model_4.select.map(items => `'${items}'`).join(',')
385
+ } else if (item.active_type.invltp === '2') {
386
+ casParam = item.model_4.select.join(',');
387
+ }
388
+ return Object.assign(pubObj, {
389
+ srfield: item.active_type.srfield,
390
+ invalue: casParam
391
+ })
392
+ }
393
+ case '8': {
394
+ if (item.m_cas.length === 0) {
395
+ return false
396
+ }
397
+ let casParam;
398
+ if (item.active_type.invltp === '1') {
399
+ casParam = item.m_cas.map(items => `'${items}'`).join(',')
400
+ } else if (item.active_type.invltp === '2') {
401
+ casParam = item.m_cas.join(',');
402
+ }
403
+ return Object.assign(pubObj, {
404
+ srfield: item.active_type.srfield.replace(/invalue/, casParam),
405
+ invalue: casParam,
406
+ })
407
+ }
408
+ case '9': {
409
+ if(item.stations.length === 0){
410
+ return false
411
+ }
412
+ let casParam;
413
+ if (item.active_type.invltp === '1') {
414
+ casParam = item.stations.map(items => `'${items.id}'`).join(',')
415
+ } else if (item.active_type.invltp === '2') {
416
+ casParam = item.stations.join(',');
417
+ }
418
+ console.log(casParam)
419
+ return Object.assign(pubObj, {
420
+ srfield: item.active_type.srfield,
421
+ invalue: casParam
422
+ })
423
+ }
424
+ case -1: {
425
+ return false;
426
+ }
427
+ }
428
+ },
429
+ async remoteMethod(data, im, result) {
430
+ if (data == '') { im.formConfig_4[0].options = []; return; }
431
+ const { data: res1 } = await this.$axios.post(this.listuri + result.rootpath, {
432
+ searchs: im.stations,
433
+ invalue: data
434
+ });
435
+ im.formConfig_4[0].options = res1;
436
+ }
437
+ }
438
+ }
439
+ </script>
440
+
441
+ <style lang="scss" scoped>
442
+ span {
443
+ padding: 0 12px;
444
+ color:#666666;
445
+ font-size:14px;
446
+ }
447
+
448
+ .st-btns {
449
+ margin-left: auto;
450
+ margin-right: 10px;
451
+ width: 46px;
452
+ position: relative;
453
+
454
+ i {
455
+ font-size: 20px;
456
+ }
457
+ }
458
+
459
+ .search-tb-row {
460
+ height: 35px;
461
+ overflow: hidden;
462
+ display: flex;
463
+ align-items: center;
464
+ }
465
+
466
+ .search-tb-row ::v-deep .el-form-item {
467
+ margin: 0 !important;
468
+ }
469
+ </style>
470
+
471
+ <style>
472
+ .search-tb .el-cascader__tags,
473
+ .search-tb .el-select__tags {
474
+ flex-wrap: nowrap;
475
+ }
476
+
477
+ .search-tb .el-cascader__tags .el-tag,
478
+ .search-tb .el-select__tags .el-tag {
479
+ max-width: 75%;
480
+ }
481
+
482
+ .search-tb .el-tag:nth-child(1) .el-select__tags-text {
483
+ display: inline-block;
484
+ width: 120px;
485
+ overflow: hidden;
486
+ white-space: nowrap;
487
+ text-overflow: ellipsis;
488
+ }
489
+
490
+ .search-tb .el-tag:nth-child(2) {
491
+ position: relative;
492
+ left: 20px;
493
+ }
494
+
495
+ .search-tb .el-select__tags .el-tag .el-icon-close {
496
+ top: -5px;
497
+ }
498
+ .search-base-slt{
499
+ z-index:99999 !important;
500
+ }
501
+ </style>
502
+ <style lang="scss">
503
+ .multi-cascader-style{
504
+ max-height:60vh !important;
505
+ .elui-select-dropdown__wrap{
506
+ max-height:60vh !important;
507
+ }
508
+ .elui-select-dropdown__item{
509
+ height:auto !important;
510
+ .ground{
511
+ height:auto !important;
512
+ .floor-item{
513
+ height:100% !important;
514
+ &::-webkit-scrollbar {
515
+ width: 10px;
516
+ height: 10px;
517
+ display: none;
518
+ }
519
+ &:hover::-webkit-scrollbar{
520
+ display: block;
521
+ }
522
+ &::-webkit-scrollbar-thumb {
523
+ border-radius: 10px;
524
+ background:#989ba380;
525
+ }
526
+ }
527
+ ul{
528
+ &::-webkit-scrollbar {
529
+ width: 10px;
530
+ height: 10px;
531
+ display: none;
532
+ }
533
+ &:hover::-webkit-scrollbar{
534
+ display: block;
535
+ }
536
+ &::-webkit-scrollbar-thumb {
537
+ border-radius: 10px;
538
+ background:#989ba380;
539
+ }
540
+ .active-li{
541
+ color: #409EFF !important;
542
+ background-color:#f5f7fa !important;
543
+ }
544
+ .li-style{
545
+ &:hover{
546
+ color: #409EFF !important;
547
+ background-color:#f5f7fa !important;
548
+ }
549
+ }
550
+
551
+ }
552
+ }
553
+ }
554
+ }
555
+ </style>