@wp1001/ui 2.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/.env +6 -0
  2. package/@vant-D4fmGxs6.js +3891 -0
  3. package/index.js +8419 -0
  4. package/package.json +59 -0
  5. package/packages/assets/devtools-detector.js +2 -0
  6. package/packages/components/xarray/index.js +64 -0
  7. package/packages/components/xarray/xarray.vue +57 -0
  8. package/packages/components/xautorows/index.js +35 -0
  9. package/packages/components/xautorows/xautorows.vue +29 -0
  10. package/packages/components/xbutton/mobile.js +3 -0
  11. package/packages/components/xbutton/mobile.vue +9 -0
  12. package/packages/components/xbutton/pc.js +3 -0
  13. package/packages/components/xbutton/pc.vue +9 -0
  14. package/packages/components/xbuttons/mobile.js +51 -0
  15. package/packages/components/xbuttons/mobile.vue +12 -0
  16. package/packages/components/xbuttons/pc.js +51 -0
  17. package/packages/components/xbuttons/pc.vue +16 -0
  18. package/packages/components/xchart/constants.js +58 -0
  19. package/packages/components/xchart/index.js +263 -0
  20. package/packages/components/xchart/utils.js +121 -0
  21. package/packages/components/xchart/xchart.vue +173 -0
  22. package/packages/components/xcheckboxs/mobile.js +58 -0
  23. package/packages/components/xcheckboxs/mobile.vue +38 -0
  24. package/packages/components/xcheckboxs/pc.js +49 -0
  25. package/packages/components/xcheckboxs/pc.vue +42 -0
  26. package/packages/components/xcol/mobile.js +10 -0
  27. package/packages/components/xcol/mobile.vue +9 -0
  28. package/packages/components/xcol/pc.js +10 -0
  29. package/packages/components/xcol/pc.vue +9 -0
  30. package/packages/components/xdatepicker/mobile.js +71 -0
  31. package/packages/components/xdatepicker/mobile.vue +44 -0
  32. package/packages/components/xdatepicker/pc.js +9 -0
  33. package/packages/components/xdatepicker/pc.vue +12 -0
  34. package/packages/components/xdialog/mobile.js +60 -0
  35. package/packages/components/xdialog/mobile.vue +43 -0
  36. package/packages/components/xdialog/pc.js +64 -0
  37. package/packages/components/xdialog/pc.vue +51 -0
  38. package/packages/components/xdict/index.js +47 -0
  39. package/packages/components/xdict/xdict.vue +9 -0
  40. package/packages/components/xdistrictselect/mobile.js +79 -0
  41. package/packages/components/xdistrictselect/mobile.vue +28 -0
  42. package/packages/components/xdistrictselect/pc.js +127 -0
  43. package/packages/components/xdistrictselect/pc.vue +32 -0
  44. package/packages/components/xform/mobile.js +29 -0
  45. package/packages/components/xform/mobile.vue +43 -0
  46. package/packages/components/xform/pc.js +42 -0
  47. package/packages/components/xform/pc.vue +76 -0
  48. package/packages/components/xform/utils.js +95 -0
  49. package/packages/components/xformitem/mobile.js +56 -0
  50. package/packages/components/xformitem/mobile.vue +3 -0
  51. package/packages/components/xformitem/pc.js +72 -0
  52. package/packages/components/xformitem/pc.vue +10 -0
  53. package/packages/components/xformitem/utils.jsx +181 -0
  54. package/packages/components/xicon/mobile.js +35 -0
  55. package/packages/components/xicon/mobile.vue +9 -0
  56. package/packages/components/xicon/pc.js +35 -0
  57. package/packages/components/xicon/pc.vue +11 -0
  58. package/packages/components/xinfo/index.js +100 -0
  59. package/packages/components/xinfo/xinfo.vue +140 -0
  60. package/packages/components/xlooper/index.js +7 -0
  61. package/packages/components/xlooper/xlooper.vue +20 -0
  62. package/packages/components/xpagination/mobile.js +21 -0
  63. package/packages/components/xpagination/mobile.vue +31 -0
  64. package/packages/components/xpagination/pc.js +21 -0
  65. package/packages/components/xpagination/pc.vue +16 -0
  66. package/packages/components/xpicker/index.js +38 -0
  67. package/packages/components/xpicker/xpicker.vue +29 -0
  68. package/packages/components/xradios/mobile.js +40 -0
  69. package/packages/components/xradios/mobile.vue +22 -0
  70. package/packages/components/xradios/pc.js +53 -0
  71. package/packages/components/xradios/pc.vue +43 -0
  72. package/packages/components/xrow/mobile.js +9 -0
  73. package/packages/components/xrow/mobile.vue +23 -0
  74. package/packages/components/xrow/pc.js +9 -0
  75. package/packages/components/xrow/pc.vue +22 -0
  76. package/packages/components/xscan/mobile.js +24 -0
  77. package/packages/components/xscan/mobile.vue +21 -0
  78. package/packages/components/xscan/pc.js +20 -0
  79. package/packages/components/xscan/pc.vue +18 -0
  80. package/packages/components/xsearcher/index.js +198 -0
  81. package/packages/components/xsearcher/xsearcher.vue +170 -0
  82. package/packages/components/xselect/mobile.js +86 -0
  83. package/packages/components/xselect/mobile.vue +24 -0
  84. package/packages/components/xselect/pc.js +114 -0
  85. package/packages/components/xselect/pc.vue +55 -0
  86. package/packages/components/xselect/util.js +66 -0
  87. package/packages/components/xselectv2/index.js +91 -0
  88. package/packages/components/xselectv2/xselectv2.vue +46 -0
  89. package/packages/components/xtable/mobile.js +108 -0
  90. package/packages/components/xtable/mobile.vue +246 -0
  91. package/packages/components/xtable/pc.js +143 -0
  92. package/packages/components/xtable/pc.vue +421 -0
  93. package/packages/components/xtable/searcher.js +477 -0
  94. package/packages/components/xtable/searcher.jsx +330 -0
  95. package/packages/components/xtable/searcher.vue +133 -0
  96. package/packages/components/xtable/settings.js +80 -0
  97. package/packages/components/xtable/settings.vue +77 -0
  98. package/packages/components/xtable/utils.js +692 -0
  99. package/packages/components/xtabletools/mobile.js +25 -0
  100. package/packages/components/xtabletools/mobile.vue +126 -0
  101. package/packages/components/xtabletools/pc.js +18 -0
  102. package/packages/components/xtabletools/pc.vue +135 -0
  103. package/packages/components/xtablev2/index.js +53 -0
  104. package/packages/components/xtablev2/utils.jsx +214 -0
  105. package/packages/components/xtablev2/xtablev2.vue +147 -0
  106. package/packages/components/xtags/mobile.js +17 -0
  107. package/packages/components/xtags/mobile.vue +21 -0
  108. package/packages/components/xtags/pc.js +17 -0
  109. package/packages/components/xtags/pc.vue +22 -0
  110. package/packages/components/xtinymce/index.js +71 -0
  111. package/packages/components/xtinymce/xtinymce.vue +9 -0
  112. package/packages/components/xuploader/xfileuploader.js +48 -0
  113. package/packages/components/xuploader/xfileuploader.vue +54 -0
  114. package/packages/components/xuploader/ximageuploader.js +53 -0
  115. package/packages/components/xuploader/ximageuploader.vue +52 -0
  116. package/packages/comps.js +108 -0
  117. package/packages/controllers/BaseController.js +125 -0
  118. package/packages/controllers/CrudController.js +907 -0
  119. package/packages/controllers/TempCrudController.js +32 -0
  120. package/packages/controllers/index.js +15 -0
  121. package/packages/directives/el-table-infinite-scroll.js +55 -0
  122. package/packages/directives/index.js +5 -0
  123. package/packages/index.js +81 -0
  124. package/packages/index.scss +4 -0
  125. package/packages/layout/breadcrumb/breadcrumb.vue +31 -0
  126. package/packages/layout/breadcrumb/index.js +41 -0
  127. package/packages/layout/header/header.vue +281 -0
  128. package/packages/layout/header/inner.js +11 -0
  129. package/packages/layout/header/inner.vue +3 -0
  130. package/packages/layout/mobile-menu.vue +83 -0
  131. package/packages/layout/mobile-tabs.vue +54 -0
  132. package/packages/layout/pc.vue +85 -0
  133. package/packages/layout/screenlock/index.js +129 -0
  134. package/packages/layout/screenlock/screenlock.vue +85 -0
  135. package/packages/layout/sidebar/item.js +16 -0
  136. package/packages/layout/sidebar/item.vue +16 -0
  137. package/packages/layout/sidebar/menu.js +72 -0
  138. package/packages/layout/sidebar/menu.vue +106 -0
  139. package/packages/layout/sidebar/sidebar.vue +147 -0
  140. package/packages/layout/tagsview/ScrollPane.js +65 -0
  141. package/packages/layout/tagsview/ScrollPane.vue +24 -0
  142. package/packages/layout/tagsview/index.js +169 -0
  143. package/packages/layout/tagsview/index.vue +124 -0
  144. package/packages/plop/actions/make-fill-admin-partials-action.js +95 -0
  145. package/packages/plop/generators/make-admin-page.js +39 -0
  146. package/packages/plop/generators/make-database-admin-pages.js +84 -0
  147. package/packages/plop/generators/make-page-generator.js +52 -0
  148. package/packages/plop/generators/make-simple-page.js +20 -0
  149. package/packages/plop/plopfile.js +24 -0
  150. package/packages/plop/templates/admin_page/controller.js +3 -0
  151. package/packages/plop/templates/admin_page/model.js +24 -0
  152. package/packages/plop/templates/admin_page/{{snakeCase pagename}}-scoped.scss +3 -0
  153. package/packages/plop/templates/admin_page/{{snakeCase pagename}}.vue +11 -0
  154. package/packages/plop/templates/simple_page/controller.js +3 -0
  155. package/packages/plop/templates/simple_page/model.js +6 -0
  156. package/packages/plop/templates/simple_page/{{snakeCase pagename}}-scoped.scss +3 -0
  157. package/packages/plop/templates/simple_page/{{snakeCase pagename}}.vue +7 -0
  158. package/packages/plop/utils/index.js +168 -0
  159. package/packages/plop/utils/plop-utils.js +86 -0
  160. package/packages/styles/common.scss +137 -0
  161. package/packages/styles/element-ui.scss +142 -0
  162. package/packages/styles/vant.scss +133 -0
  163. package/packages/styles/variables.scss +23 -0
  164. package/packages/utils/crypt.js +24 -0
  165. package/packages/utils/decorators.js +67 -0
  166. package/packages/utils/disallowDevtools.js +53 -0
  167. package/packages/utils/effects.js +173 -0
  168. package/packages/utils/funcs.js +78 -0
  169. package/packages/utils/index.js +95 -0
  170. package/packages/utils/message.js +110 -0
  171. package/packages/utils/middlewares.js +86 -0
  172. package/packages/utils/model.js +71 -0
  173. package/packages/utils/modelUtils.js +203 -0
  174. package/packages/utils/request.js +57 -0
  175. package/packages/utils/site.js +33 -0
  176. package/packages/vite-plugins.js +141 -0
  177. package/publish.sh +12 -0
@@ -0,0 +1,29 @@
1
+ <script>
2
+ export { default } from './index.js'
3
+ </script>
4
+
5
+ <template>
6
+ <div
7
+ @click="$emit('show')"
8
+ :class="`x-picker__${modelValue ? 'value' : 'placeholder'}`"
9
+ >
10
+ {{ text }}
11
+ </div>
12
+ <van-popup
13
+ class="x-picker"
14
+ :class="isMobile ? 'mobile-x-picker' : 'pc-x-picker'"
15
+ round
16
+ position="bottom"
17
+ teleport="body"
18
+ v-bind="$attrs"
19
+ v-model:show="visible"
20
+ >
21
+ <van-picker
22
+ :modelValue="value"
23
+ :title="$attrs.title"
24
+ :columns
25
+ @cancel="$emit('cancel')"
26
+ @confirm="onConfirm"
27
+ />
28
+ </van-popup>
29
+ </template>
@@ -0,0 +1,40 @@
1
+ import { formatOptions } from '../../utils/index.js'
2
+
3
+ export default {
4
+ name: 'MobileXRadios',
5
+ inheritAttrs: false,
6
+ props: {
7
+ text: {
8
+ type: String,
9
+ default: 'text'
10
+ },
11
+ plain: {
12
+ type: Boolean,
13
+ default: false
14
+ },
15
+ value: {
16
+ type: String,
17
+ default: 'value'
18
+ },
19
+ direction: {
20
+ type: String,
21
+ default: 'horizontal'
22
+ },
23
+ sort: Boolean | String,
24
+ options: Array | Object
25
+ },
26
+ data () {
27
+ return {
28
+ _options: []
29
+ }
30
+ },
31
+ watch: {
32
+ options: {
33
+ immediate: true,
34
+ deep: true,
35
+ handler () {
36
+ this._options = formatOptions(this.options, this)
37
+ }
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,22 @@
1
+ <script>
2
+ export { default } from './mobile.js'
3
+ </script>
4
+
5
+ <template>
6
+ <van-radio-group
7
+ class="x-radios mobile-x-radios"
8
+ :class="plain ? 'mobile-x-radios--plain' : ''"
9
+ v-bind="$attrs"
10
+ :direction
11
+ >
12
+ <van-radio
13
+ v-for="option in _options"
14
+ v-bind="$attrs"
15
+ :disabled="option.raw?.disabled"
16
+ :key="option.text"
17
+ :name="option.value"
18
+ >
19
+ {{ option.text }}
20
+ </van-radio>
21
+ </van-radio-group>
22
+ </template>
@@ -0,0 +1,53 @@
1
+ import { formatOptions } from '../../utils/index.js'
2
+
3
+ export default {
4
+ name: 'PcXRadios',
5
+ inheritAttrs: false,
6
+ props: {
7
+ modelValue: Number | String,
8
+ plain: {
9
+ type: Boolean,
10
+ default: false
11
+ },
12
+ text: {
13
+ type: String,
14
+ default: 'text'
15
+ },
16
+ value: {
17
+ type: String,
18
+ default: 'value'
19
+ },
20
+ button: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ sort: Boolean | String,
25
+ options: Array | Object,
26
+ },
27
+ emits: ['update:modelValue', 'change'],
28
+ data () {
29
+ return {
30
+ _options: []
31
+ }
32
+ },
33
+ computed: {
34
+ attrs () {
35
+ const {
36
+ clearable,
37
+ platform,
38
+ placeholder,
39
+ ...others
40
+ } = this.$attrs
41
+ return others
42
+ }
43
+ },
44
+ watch: {
45
+ options: {
46
+ immediate: true,
47
+ deep: true,
48
+ handler () {
49
+ this._options = formatOptions(this.options, this)
50
+ }
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,43 @@
1
+ <script>
2
+ export { default } from './pc.js'
3
+ </script>
4
+
5
+ <template>
6
+ <el-radio-group
7
+ class="x-radios pc-x-radios"
8
+ :class="plain ? 'pc-x-radios--plain' : ''"
9
+ v-bind="attrs"
10
+ :modelValue
11
+ @update:modelValue="value => $emit('update:modelValue', value)"
12
+ @change="$emit('change', $event)"
13
+ >
14
+ <component
15
+ :is="button ? 'el-radio-button' : 'el-radio'"
16
+ v-for="option in _options"
17
+ v-bind="attrs"
18
+ :disabled="option.raw?.disabled"
19
+ :key="option.text"
20
+ :value="option.value"
21
+ >
22
+ <slot
23
+ v-if="$slots.custom"
24
+ name="custom"
25
+ :option
26
+ :raw="option.raw"
27
+ />
28
+ <span v-else>{{ option.text }}</span>
29
+ </component>
30
+ </el-radio-group>
31
+ </template>
32
+
33
+ <style lang="scss" scoped>
34
+ .pc-x-radios--plain {
35
+ :deep(.el-radio) {
36
+ margin-right: 20px;
37
+ font-weight: normal;
38
+ .el-radio__input {
39
+ display: none;
40
+ }
41
+ }
42
+ }
43
+ </style>
@@ -0,0 +1,9 @@
1
+ export default {
2
+ name: 'MobileXRow',
3
+ props: {
4
+ cols: {
5
+ type: Array,
6
+ default: []
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,23 @@
1
+ <script>
2
+ export { default } from './mobile.js'
3
+ </script>
4
+
5
+ <template>
6
+ <van-row class="x-row mobile-x-row">
7
+ <mobile-x-col
8
+ v-for="(col, index) in cols"
9
+ v-bind="col"
10
+ :span="col.xs ?? col.span"
11
+ :key="index"
12
+ >
13
+ <slot
14
+ v-if="col.slot || $attrs.slot"
15
+ :name="col.slot || $attrs.slot"
16
+ :col
17
+ />
18
+ <span v-else>{{ col.text }}</span>
19
+ </mobile-x-col>
20
+
21
+ <slot v-if="cols.length === 0" />
22
+ </van-row>
23
+ </template>
@@ -0,0 +1,9 @@
1
+ export default {
2
+ name: 'PcXRow',
3
+ props: {
4
+ cols: {
5
+ type: Array,
6
+ default: []
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,22 @@
1
+ <script>
2
+ export { default } from './pc.js'
3
+ </script>
4
+
5
+ <template>
6
+ <el-row class="x-row pc-x-row">
7
+ <pc-x-col
8
+ v-for="(col, index) in cols"
9
+ v-bind="col"
10
+ :key="index"
11
+ >
12
+ <slot
13
+ v-if="col.slot || $attrs.slot"
14
+ :name="col.slot || $attrs.slot"
15
+ :col
16
+ />
17
+ <span v-else>{{ col.text }}</span>
18
+ </pc-x-col>
19
+
20
+ <slot v-if="cols.length === 0" />
21
+ </el-row>
22
+ </template>
@@ -0,0 +1,24 @@
1
+ export default {
2
+ name: 'MobileXScan',
3
+ props: {
4
+ modelValue: String,
5
+ _label: {
6
+ type: String,
7
+ default: '扫码'
8
+ },
9
+ readonly: {
10
+ type: Boolean,
11
+ default: false
12
+ }
13
+ },
14
+ emits: ['update:modelValue'],
15
+ methods: {
16
+ handleClick () {
17
+ this.readonly && this.handleScan()
18
+ },
19
+ async handleScan () {
20
+ const code = await StardustBrowser.funcs.scanCode()
21
+ this.$emit('update:modelValue', code)
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,21 @@
1
+ <script>
2
+ export { default } from './mobile.js'
3
+ </script>
4
+
5
+ <template>
6
+ <van-field
7
+ placeholder="点此扫码"
8
+ class="x-scan mobile-x-scan"
9
+ v-bind="$attrs"
10
+ :label="_label"
11
+ :modelValue
12
+ :readonly
13
+ style="padding: 0;"
14
+ @update:modelValue="v => $emit('update:modelValue', v)"
15
+ @click.native="handleClick"
16
+ >
17
+ <template #right-icon>
18
+ <van-icon name="scan" @click.native="handleScan" />
19
+ </template>
20
+ </van-field>
21
+ </template>
@@ -0,0 +1,20 @@
1
+ export default {
2
+ name: 'PcXScan',
3
+ props: {
4
+ modelValue: String,
5
+ readonly: {
6
+ type: Boolean,
7
+ default: false
8
+ }
9
+ },
10
+ emits: ['update:modelValue'],
11
+ methods: {
12
+ handleClick () {
13
+ this.readonly && this.handleScan()
14
+ },
15
+ async handleScan () {
16
+ const code = await StardustBrowser.funcs.scanCode()
17
+ this.$emit('update:modelValue', code)
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,18 @@
1
+ <script>
2
+ export { default } from './pc.js'
3
+ </script>
4
+
5
+ <template>
6
+ <el-input
7
+ class="x-scan pc-x-scan"
8
+ v-bind="$attrs"
9
+ :modelValue
10
+ :readonly
11
+ @update:modelValue="v => $emit('update:modelValue', v)"
12
+ @click.native="handleClick"
13
+ >
14
+ <template #append>
15
+ <el-button icon="CameraFilled" @click="handleScan" />
16
+ </template>
17
+ </el-input>
18
+ </template>
@@ -0,0 +1,198 @@
1
+ import { injectVanFieldProvide } from '../../utils/funcs.js'
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
+ }