olp-table 5.3.4 → 5.3.5

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 (171) hide show
  1. package/package.json +12 -92
  2. package/.env.build +0 -1
  3. package/README.md +0 -26
  4. package/babel.config.js +0 -5
  5. package/jsconfig.json +0 -22
  6. package/public/favicon.ico +0 -0
  7. package/public/index.html +0 -17
  8. package/rmMode.bat +0 -1
  9. package/src/App.vue +0 -199
  10. package/src/api/crud.js +0 -22
  11. package/src/api/dist.js +0 -6
  12. package/src/assets/iconfont/iconfont.css +0 -20
  13. package/src/assets/iconfont/iconfont.json +0 -16
  14. package/src/assets/iconfont/iconfont.ttf +0 -0
  15. package/src/assets/iconfont/iconfont.woff +0 -0
  16. package/src/assets/iconfont/iconfont.woff2 +0 -0
  17. package/src/assets/logo.png +0 -0
  18. package/src/components/auto-height/index.vue +0 -75
  19. package/src/components/codemirror-tag.vue +0 -100
  20. package/src/components/lazy-load-select.vue +0 -107
  21. package/src/components/ol-dialog-excel.vue +0 -112
  22. package/src/components/ol-dialog-import.vue +0 -304
  23. package/src/components/ol-dialog-json.vue +0 -82
  24. package/src/components/ol-dialog-table.vue +0 -81
  25. package/src/components/ol-dialog-upload-file.vue +0 -208
  26. package/src/components/ol-dict-tag.vue +0 -271
  27. package/src/components/ol-select-dom.vue +0 -71
  28. package/src/components/ol-table-filter.vue +0 -28
  29. package/src/components/ol-table-render.vue +0 -44
  30. package/src/components/ol-table-select.vue +0 -150
  31. package/src/components/pinia-init.vue +0 -18
  32. package/src/components/table/model/ModelMixins.js +0 -43
  33. package/src/components/table/model/model-index.vue +0 -121
  34. package/src/components/table/model/ot-left-right.vue +0 -18
  35. package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
  36. package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
  37. package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
  38. package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
  39. package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
  40. package/src/components/table/model/ot-top-bottom.vue +0 -18
  41. package/src/components/table/model/splitpanesModel.css +0 -22
  42. package/src/components/table/model/splitpanesModel.vue +0 -54
  43. package/src/components/table/ol-form/index.vue +0 -537
  44. package/src/components/table/ol-form-v3/index.vue +0 -455
  45. package/src/components/table/ol-main-form-sub-table/index.vue +0 -601
  46. package/src/components/table/ol-pager/index.vue +0 -46
  47. package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
  48. package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
  49. package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
  50. package/src/components/table/ol-table/index.vue +0 -232
  51. package/src/components/table/ol-table-operate/index.vue +0 -61
  52. package/src/components/table/ol-table-search/index.vue +0 -17
  53. package/src/components/table/ol-table-tool-btn/index.vue +0 -60
  54. package/src/components/tree/components/o-tree.vue +0 -289
  55. package/src/components/tree/index.vue +0 -46
  56. package/src/components/v-component/index.vue +0 -43
  57. package/src/config/dev-config.js +0 -5
  58. package/src/config/prod-config.js +0 -5
  59. package/src/config/shared-config.js +0 -20
  60. package/src/data.js +0 -9378
  61. package/src/directives/permission/hasPermi.js +0 -63
  62. package/src/directives/permission/hasRole.js +0 -30
  63. package/src/main.js +0 -55
  64. package/src/mixins/VTMixin/DefaultMethods.js +0 -749
  65. package/src/mixins/VTMixin/OTMixinBody.js +0 -105
  66. package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
  67. package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -420
  68. package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -450
  69. package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
  70. package/src/mixins/VTMixin/OTMixinPager.js +0 -38
  71. package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
  72. package/src/mixins/VTMixin/index.js +0 -18
  73. package/src/package/index.js +0 -20
  74. package/src/plugins/axios.js +0 -61
  75. package/src/store/dict.js +0 -76
  76. package/src/store/dictType.js +0 -52
  77. package/src/store/permi.js +0 -45
  78. package/src/styles/common.scss +0 -37
  79. package/src/styles/index.scss +0 -48
  80. package/src/styles/theme.scss +0 -32
  81. package/src/utils/AESCRUDUtils.js +0 -87
  82. package/src/utils/DateUtils.js +0 -35
  83. package/src/utils/ExcelUtil.js +0 -159
  84. package/src/utils/TableSortUtil.js +0 -91
  85. package/src/utils/columnProp.js +0 -3
  86. package/src/utils/groupCompute.js +0 -68
  87. package/src/utils/http/httpFactory.js +0 -92
  88. package/src/utils/http/httpFactory2.js +0 -79
  89. package/src/utils/http/httpUtil.js +0 -123
  90. package/src/utils/http/httpUtils.js +0 -38
  91. package/src/utils/loadStyle.js +0 -14
  92. package/src/utils/message.js +0 -56
  93. package/src/utils/object.js +0 -80
  94. package/src/utils/security/TokenUtil.js +0 -19
  95. package/src/utils/tree.js +0 -54
  96. package/src/utils/util.js +0 -127
  97. package/src/views/Test/index.vue +0 -77
  98. package/src/views/Test/index2.vue +0 -33
  99. package/src/views/components/btn-config/index.vue +0 -202
  100. package/src/views/components/option-config/index.vue +0 -192
  101. package/src/views/db/chineseToEnglish.vue +0 -127
  102. package/src/views/db/filed.vue +0 -395
  103. package/src/views/db/index.vue +0 -192
  104. package/src/views/db/preview/index.vue +0 -139
  105. package/src/views/db/preview/left.vue +0 -204
  106. package/src/views/db/preview/right.vue +0 -466
  107. package/src/views/groupTable/index.vue +0 -137
  108. package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
  109. package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
  110. package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
  111. package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
  112. package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
  113. package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
  114. package/src/views/table/add-or-edit/config/data/column.js +0 -218
  115. package/src/views/table/add-or-edit/config/data/crud.js +0 -122
  116. package/src/views/table/add-or-edit/config/data/events.js +0 -109
  117. package/src/views/table/add-or-edit/config/data/method.js +0 -127
  118. package/src/views/table/add-or-edit/config/data/option.js +0 -725
  119. package/src/views/table/add-or-edit/config/data/page.js +0 -79
  120. package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
  121. package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
  122. package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1179
  123. package/src/views/table/add-or-edit/config/index.vue +0 -376
  124. package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
  125. package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
  126. package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
  127. package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
  128. package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
  129. package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
  130. package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
  131. package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
  132. package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
  133. package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
  134. package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
  135. package/src/views/table/add-or-edit/configOld/index.vue +0 -127
  136. package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
  137. package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
  138. package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
  139. package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
  140. package/src/views/table/add-or-edit/index.vue +0 -201
  141. package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
  142. package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
  143. package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
  144. package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
  145. package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
  146. package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
  147. package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
  148. package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
  149. package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
  150. package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
  151. package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
  152. package/src/views/table/index.vue +0 -43
  153. package/src/views/table/index2.vue +0 -199
  154. package/src/views/table/preview/index.vue +0 -29
  155. package/src/views/tree/components/config-core-data.vue +0 -85
  156. package/src/views/tree/components/config-core-table.vue +0 -362
  157. package/src/views/tree/components/config-core-tree/data/events.js +0 -95
  158. package/src/views/tree/components/config-core-tree/data/option.js +0 -88
  159. package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
  160. package/src/views/tree/components/config-core-tree/index.vue +0 -181
  161. package/src/views/tree/components/config-core.vue +0 -42
  162. package/src/views/tree/components/form-config/index.vue +0 -967
  163. package/src/views/tree/index.vue +0 -424
  164. package/vue.config.js +0 -44
  165. /package/{olp-table/demo.html → demo.html} +0 -0
  166. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
  167. /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
  168. /package/{olp-table/olp-table.common.js → olp-table.common.js} +0 -0
  169. /package/{olp-table/olp-table.css → olp-table.css} +0 -0
  170. /package/{olp-table/olp-table.umd.js → olp-table.umd.js} +0 -0
  171. /package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +0 -0
package/src/utils/tree.js DELETED
@@ -1,54 +0,0 @@
1
- /**
2
- * 构造树型结构数据
3
- * @param {*} data 数据源
4
- * @param {*} id id字段 默认 'id'
5
- * @param {*} parentId 父节点字段 默认 'parentId'
6
- * @param {*} children 孩子节点字段 默认 'children'
7
- */
8
- export const handleTree = (data, id, parentId, children) => {
9
- if (!Array.isArray(data)) {
10
- console.warn('data must be an array')
11
- return []
12
- }
13
- const config = {
14
- id: id || 'id',
15
- parentId: parentId || 'parentId',
16
- children: children || 'children'
17
- }
18
- const childrenListMap = {}
19
- const nodeIds = {}
20
- const tree = []
21
-
22
- for (const d of data) {
23
- const parentId = d[config.parentId]
24
- if (childrenListMap[parentId] == null) {
25
- childrenListMap[parentId] = []
26
- }
27
- nodeIds[d[config.id]] = d
28
- childrenListMap[parentId].push(d)
29
- }
30
-
31
- for (const d of data) {
32
- const parentId = d[config.parentId]
33
- if (nodeIds[parentId] == null) {
34
- tree.push(d)
35
- }
36
- }
37
-
38
- for (const t of tree) {
39
- adaptToChildrenList(t)
40
- }
41
-
42
- function adaptToChildrenList(o) {
43
- if (childrenListMap[o[config.id]] !== null) {
44
- o[config.children] = childrenListMap[o[config.id]]
45
- }
46
- if (o[config.children]) {
47
- for (const c of o[config.children]) {
48
- adaptToChildrenList(c)
49
- }
50
- }
51
- }
52
-
53
- return tree
54
- }
package/src/utils/util.js DELETED
@@ -1,127 +0,0 @@
1
- /**
2
- * 过滤对象中为空的属性
3
- * @param obj
4
- * @returns {*}
5
- */
6
- export function filterObj(obj) {
7
- if (!(typeof obj == 'object')) {
8
- return;
9
- }
10
-
11
- for ( let key in obj) {
12
- if (obj.hasOwnProperty(key)
13
- && (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
14
- delete obj[key];
15
- }
16
- }
17
- return obj;
18
- }
19
- /** 用于js增强事件,运行JS代码,可以传参 */
20
- // options 所需参数:
21
- // 参数名 类型 说明
22
- // vm VueComponent vue实例
23
- // event Object event对象
24
- // jsCode String 待执行的js代码
25
- // errorMessage String 执行出错后的提示(控制台)
26
- export function jsExpand(options = {}) {
27
-
28
- // 绑定到window上的keyName
29
- let windowKeyName = 'J_CLICK_EVENT_OPTIONS'
30
- if (typeof window[windowKeyName] != 'object') {
31
- window[windowKeyName] = {}
32
- }
33
-
34
- // 随机生成JS增强的执行id,防止冲突
35
- let id = randomString(16, 'qwertyuioplkjhgfdsazxcvbnm'.toUpperCase())
36
- // 封装按钮点击事件
37
- let code = `
38
- (function (o_${id}) {
39
- try {
40
- (function (globalEvent, vm) {
41
- ${options.jsCode}
42
- })(o_${id}.event, o_${id}.vm)
43
- } catch (e) {
44
- o_${id}.error(e)
45
- }
46
- o_${id}.done()
47
- })(window['${windowKeyName}']['EVENT_${id}'])
48
- `
49
- // 创建script标签
50
- const script = document.createElement('script')
51
- // 将需要传递的参数挂载到window对象上
52
- window[windowKeyName]['EVENT_' + id] = {
53
- vm: options.vm,
54
- event: options.event,
55
- // 当执行完成时,无论如何都会调用的回调事件
56
- done() {
57
- // 执行完后删除新增的 script 标签不会撤销执行结果(已产生的结果不会被撤销)
58
- script.outerHTML = ''
59
- delete window[windowKeyName]['EVENT_' + id]
60
- },
61
- // 当js运行出错的时候调用的事件
62
- error(e) {
63
- console.group(`${options.errorMessage || '用户自定义JS增强代码运行出错'}(${new Date()})`)
64
- console.error(e)
65
- console.groupEnd()
66
- }
67
- }
68
- // 将事件挂载到document中
69
- script.innerHTML = code
70
- document.body.appendChild(script)
71
- }
72
- /**
73
- * 随机生成字符串
74
- * @param length 字符串的长度
75
- * @param chats 可选字符串区间(只会生成传入的字符串中的字符)
76
- * @return string 生成的字符串
77
- */
78
- export function randomString(length, chats) {
79
- if (!length) length = 1
80
- if (!chats) chats = '0123456789qwertyuioplkjhgfdsazxcvbnm'
81
- let str = ''
82
- for (let i = 0; i < length; i++) {
83
- let num = randomNumber(0, chats.length - 1)
84
- str += chats[num]
85
- }
86
- return str
87
- }
88
- /**
89
- * 随机生成数字
90
- *
91
- * 示例:生成长度为 12 的随机数:randomNumber(12)
92
- * 示例:生成 3~23 之间的随机数:randomNumber(3, 23)
93
- *
94
- * @param1 最小值 | 长度
95
- * @param2 最大值
96
- * @return int 生成后的数字
97
- */
98
- export function randomNumber() {
99
- // 生成 最小值 到 最大值 区间的随机数
100
- const random = (min, max) => {
101
- return Math.floor(Math.random() * (max - min + 1) + min)
102
- }
103
- if (arguments.length === 1) {
104
- let [length] = arguments
105
- // 生成指定长度的随机数字,首位一定不是 0
106
- let nums = [...Array(length).keys()].map((i) => (i > 0 ? random(0, 9) : random(1, 9)))
107
- return parseInt(nums.join(''))
108
- } else if (arguments.length >= 2) {
109
- let [min, max] = arguments
110
- return random(min, max)
111
- } else {
112
- return Number.NaN
113
- }
114
- }
115
-
116
- export function sleep(time) {
117
- return new Promise((resolve) => setTimeout(resolve, time));
118
- }
119
- /**
120
- * 转换为大小驼峰命名
121
- * abc-efg => abcEfg
122
- */
123
- export const toCamelCase = str => {
124
- return str.indexOf('_') !== -1
125
- ? str.replace(/_([a-zA-Z])/g, ($0, $1) => $1.toUpperCase())
126
- : str
127
- }
@@ -1,77 +0,0 @@
1
- <template>
2
- <div>
3
- <vxe-form
4
- :data="formData"
5
- :items="formItems"
6
- titleColon
7
- @submit="submitEvent"
8
- @reset="resetEvent">
9
- <template #myregion="{ data, field }">
10
- <el-switch v-model="data[field]"></el-switch>
11
- </template>
12
- </vxe-form>
13
- </div>
14
- </template>
15
-
16
- <script setup>
17
- import { ref, reactive } from 'vue'
18
- import { VXETable } from 'vxe-table'
19
-
20
-
21
- const formData = reactive({
22
- name: '',
23
- nickname: '',
24
- sex: '0',
25
- role: '',
26
- age: 22,
27
- val1: [],
28
- val2: false,
29
- val3: '',
30
- flag: false,
31
- region: true
32
- })
33
-
34
- const formItems = ref([
35
- {
36
- title: '左侧',
37
- span: 12,
38
- children: [
39
- { field: 'name', title: '名称', span: 8, itemRender: { name: 'VxeInput', props: { placeholder: '请输入名称' } } },
40
- { field: 'sex', title: '性别', span: 8, itemRender: { name: 'VxeSelect', options: [{ value: '0', label: '女' }, { value: '1', label: '男' }], props: { placeholder: '请选择性别' } } },
41
- { field: 'role', title: '角色', span: 8, itemRender: { name: 'VxeInput', props: { placeholder: '请输入角色' } } },
42
- { field: 'age', title: '年龄', span: 24, itemRender: { name: 'VxeInput', props: { type: 'number', placeholder: '请输入年龄' } } },
43
- { field: 'val1', title: '复选框-组', span: 12, itemRender: { name: 'VxeCheckboxGroup', options: [{ label: '爬山', value: '11' }, { label: '健身', value: '22' }] } },
44
- { field: 'val2', title: '复选框', span: 12, itemRender: { name: 'VxeCheckbox' } },
45
- { field: 'val3', title: '单选框', span: 12, itemRender: { name: 'VxeRadioGroup', options: [{ label: '是', value: 'Y' }, { label: '否', value: 'N' }] } },
46
- { field: 'flag', title: '开关', span: 24, itemRender: { name: 'VxeSwitch', props: { openLabel: '是', closeLabel: '否' } } },
47
- { field: 'region', title: '地区', span: 24, itemRender: {}, slots: { default: 'myregion' } }
48
- ]
49
- },
50
- {
51
- title: '右侧',
52
- span: 12,
53
- children: [
54
- { field: 'nickname', title: '昵称', span: 24, itemRender: { name: 'VxeInput', props: { placeholder: '请输入昵称' } } }
55
- ]
56
- },
57
- {
58
- align: 'center',
59
- span: 24,
60
- itemRender: {
61
- name: '$buttons',
62
- children: [
63
- { props: { type: 'submit', content: '提交', status: 'primary' } },
64
- { props: { type: 'reset', content: '重置' } }
65
- ]
66
- }
67
- }
68
- ])
69
-
70
- const submitEvent= () => {
71
- VXETable.modal.message({ content: '保存成功', status: 'success' })
72
- }
73
-
74
- const resetEvent = () => {
75
- VXETable.modal.message({ content: '重置事件', status: 'info' })
76
- }
77
- </script>
@@ -1,33 +0,0 @@
1
- <template>
2
- <div style="height: calc(100vh - 30px)">
3
- <model-index uuid="1749619280421036032"/>
4
- </div>
5
- </template>
6
-
7
-
8
- <script>
9
-
10
- import ModelIndex from "@/components/table/model/model-index.vue";
11
-
12
- export default {
13
- name: 'olTable',
14
- components: {ModelIndex},
15
- data() {
16
- return {
17
- width: 0,
18
- height: 0,
19
- top: 0,
20
- left: 0
21
- }
22
- },
23
-
24
- methods: {
25
- resize(newRect) {
26
- this.width = newRect.width;
27
- this.height = newRect.height;
28
- this.top = newRect.top;
29
- this.left = newRect.left;
30
- }
31
- }
32
- }
33
- </script>
@@ -1,202 +0,0 @@
1
- <template>
2
- <vxe-grid
3
- v-bind="option"
4
- ref="tableRef"
5
- :data="$attrs.data">
6
- <template #toolbar_buttons>
7
- <el-button @click="onAdd">新增</el-button>
8
- </template>
9
- <template #switch_default="{ row,column }">
10
- <el-switch
11
- active-value="1"
12
- inactive-value="0"
13
- v-model="row[column.field]"
14
- />
15
- </template>
16
- <template #codemirror="{ row,column }">
17
- <olCodemirrorTag v-model="row[column.field]"/>
18
- </template>
19
- <template #operation="{ row,rowIndex }">
20
- <el-button @click="removeBtn(row, rowIndex)" type="danger" circle plain>
21
- <el-icon>
22
- <Delete/>
23
- </el-icon>
24
- </el-button>
25
- </template>
26
- </vxe-grid>
27
- </template>
28
- <script>
29
-
30
- import {getNewArrData, updateSortCall} from "@/utils/TableSortUtil";
31
-
32
- export default {
33
- name: "btnConfig",
34
- props: {
35
- type: {
36
- required: true,
37
- type: String
38
- }
39
- },
40
- data() {
41
- return {
42
- data: [],
43
- show: true,
44
- option: {
45
- expandConfig: {
46
- trigger: "cell"
47
- },
48
- rowConfig: {
49
- isCurrent: true
50
- },
51
- align: 'center',
52
- editConfig: {
53
- trigger: 'click',
54
- mode: 'row',
55
- showStatus: true
56
- },
57
- pagerConfig: {
58
- enabled: false
59
- },
60
- toolbarConfig: {
61
- slots: {
62
- buttons: 'toolbar_buttons'
63
- },
64
- },
65
- height: 300,
66
- index: true,
67
- searchBtn: false,
68
- emptyBtn: false,
69
- menu: false,
70
- header: false,
71
- columns: [
72
- {
73
- title: '序号',
74
- className: 'move',
75
- field: 'sort',
76
- width: 80,
77
- },
78
- {
79
- title: '按钮名称',
80
- field: 'name',
81
- editRender: {name: 'input'},
82
- },
83
- {
84
- title: '定义编码',
85
- field: 'code',
86
- editRender: {
87
- name: 'input', events: {
88
- change: ({row}) => {
89
- setTimeout(() => {
90
- row.clickCallBackMethod = row.code != '' ? row.code + "ButClick" : ''
91
- }, 150)
92
- }
93
- }
94
- },
95
- }, {
96
- title: '图标',
97
- field: 'icon',
98
- editRender: {name: 'input'},
99
- },
100
- {
101
- title: '主题',
102
- field: 'status',
103
- editRender: {name: 'input'},
104
- },
105
- {
106
- title: 'customFunction',
107
- field: 'customFunction',
108
- slots: {
109
- // 使用插槽模板渲染
110
- default: 'codemirror',
111
- },
112
- },
113
- {
114
- title: '回调方法',
115
- children: [
116
- {
117
- title: '单击(click)',
118
- field: 'clickCallBackMethod',
119
- }, {
120
- title: '显示(show)',
121
- field: 'showCallBack',
122
- }, {
123
- title: '禁用(disabled)',
124
- field: 'disabledCallBack',
125
- }
126
- ],
127
- }, {
128
- title: '操作',
129
- field: 'operation',
130
- width: 80,
131
- slots: {
132
- // 使用插槽模板渲染
133
- default: 'operation',
134
- }
135
- }
136
- ]
137
- },
138
- }
139
- },
140
- created() {
141
- this.$nextTick(() => {
142
- updateSortCall(this.$refs.tableRef, this.updateSort)
143
- })
144
- },
145
- methods: {
146
- updateSort(oldIndex, newIndex) {
147
- let newsArr = getNewArrData(oldIndex, newIndex, this.$attrs.data)
148
- this.$attrs.data.length = 0;
149
- this.$nextTick(() => {
150
- let index = 0;
151
- for (const obj of newsArr) {
152
- index++;
153
- obj.sort = index;
154
- this.$attrs.data.push(obj)
155
- }
156
- })
157
-
158
- },
159
- onAdd() {
160
- let newBtn = {
161
- name: '',
162
- code: '',
163
- defaultShow: '1',
164
- status: 'primary',
165
- deleted: 0,
166
- sort: this.$attrs.data.length
167
- }
168
- this.$attrs.data.push(newBtn);
169
- this.doSort();
170
- },
171
- removeBtnOper(code) {
172
- for (let i = 0; i < this.$attrs.data.length; i++) {
173
- if (this.$attrs.data[i].code == code) {
174
- this.$attrs.data.splice(i, 1)
175
- return;
176
- }
177
- }
178
- },
179
- doSort() {
180
- let sort = 0;
181
- for (let data of this.$attrs.data) {
182
- sort++;
183
- data.sort = sort;
184
- }
185
- this.$refs.tableRef.reloadData(this.$attrs.data)
186
- },
187
- removeBtn(rowIndex) {
188
- this.$attrs.data.splice(rowIndex, 1);
189
- this.doSort();
190
- this.$emit('updateValue', this.$attrs.data.map(o => o.code))
191
- }
192
- }
193
- }
194
-
195
- </script>
196
-
197
- <style lang="scss">
198
- .newBtn {
199
- background: #f2f8fe
200
- }
201
-
202
- </style>
@@ -1,192 +0,0 @@
1
- <template>
2
- <div>
3
- <vxe-grid
4
- v-bind="option"
5
- :data="data">
6
- <template #num1_default="{ row }">
7
- <el-switch v-if="row.t3 == 'boolean'" v-model="row.value"/>
8
- <el-input-number style="width: 100%;" v-else-if="row.t3 == 'number'"
9
- v-model="row.value"/>
10
- <el-radio-group v-else-if="row.t3.indexOf('/') != -1" v-model="row.value">
11
- <el-radio v-for="item in row.t3.toString().split('/')" :key="item" :label="item" :value="item">{{
12
- item
13
- }}
14
- </el-radio>
15
- </el-radio-group>
16
- <p v-else-if="row.t3 == 'any'"></p>
17
- <olCodemirrorTag v-else-if="row.t3 == 'function'" @open="onOpen(row)" v-model="row.value">
18
- <template #tip-header>
19
- <div style="background: #282C34">
20
- <el-alert style="background: rgba(0,0,0,0); color: white" type="info" :title="11" show-icon
21
- class="alert-padding" :closable="false">
22
- <template #title>
23
- <div><span></span><span>const {{ row.t5 }} = params</span></div>
24
- </template>
25
- </el-alert>
26
- </div>
27
- </template>
28
- </olCodemirrorTag>
29
- <el-input v-else style="width: 100%;" v-model="row.value"/>
30
- </template>
31
- </vxe-grid>
32
- </div>
33
- </template>
34
- <script>
35
-
36
- export default {
37
- name: "optionConfig",
38
- props: {
39
- dataSource: {
40
- type: Array,
41
- default: () => {
42
- return []
43
- }
44
- },
45
- height: {},
46
- defaultData: {
47
- type: Object,
48
- default: () => {
49
- return {}
50
- }
51
- }
52
- },
53
- data() {
54
- return {
55
- activeName: 'page',
56
- search: {},
57
- data: [],
58
- option: {
59
- height: 300,
60
- index: true,
61
- indexLabelClassName: '序号',
62
- searchBtn: false,
63
- emptyBtn: false,
64
- menu: false,
65
- cellBtn: true,
66
- header: false,
67
- resizable: true,
68
- treeConfig: {
69
- transform: true,
70
- rowField: '$index',
71
- parentField: 'parentId'
72
- },
73
- columns: [
74
- {
75
- title: '参数',
76
- field: 't1',
77
- width: 200,
78
- search: true,
79
- treeNode: true
80
- }, {
81
- title: '说明',
82
- field: 't2',
83
- search: true,
84
- width: 200,
85
- }, {
86
- title: '类型',
87
- field: 't3',
88
- width: 320,
89
- }, {
90
- title: '默认值',
91
- field: 't5',
92
- width: 200,
93
- }, {
94
- title: '当前值',
95
- field: 'value',
96
- cell: true,
97
- minWidth: 100,
98
- slots: {
99
- // 使用插槽模板渲染
100
- default: 'num1_default',
101
- }
102
- }]
103
- },
104
- }
105
- },
106
- watch: {
107
- search: {
108
- deep: true,
109
- handler() {
110
- let data = [];
111
- let keys = Object.keys(this.search);
112
- let i = 0;
113
- for (let key of keys) {
114
- if (this.search[key]) {
115
- i++;
116
- for (let obj of this.dataSource) {
117
- if (obj[key].indexOf(this.search[key]) != -1) {
118
- data.push(obj);
119
- }
120
- }
121
- }
122
- }
123
- if (i == 0) {
124
- this.data = this.dataSource;
125
- } else {
126
- this.data = data;
127
- }
128
- }
129
- },
130
- defaultData() {
131
- this.setDefaultData()
132
- }
133
- },
134
- methods: {
135
- setDefaultData() {
136
- if (this.data[0].$index == null || !this.data[0].parentId == null) {
137
- this.option.treeConfig = null
138
- this.option.columns[0].treeNode = false
139
- }
140
- this.data.forEach(item => {
141
- let obj = this.defaultData[item.t1];
142
- if (obj instanceof Array) {
143
- obj = JSON.stringify(obj)
144
- }
145
- if (obj != null) {
146
- if (!(obj instanceof Object)) {
147
- item.value = obj
148
- } else if (obj.isFunction) {
149
- item.value = obj.code
150
- } else if (item.children) {
151
- for (let child of item.children) {
152
- child.value = obj[child.t1]
153
- }
154
- }
155
- } else if (item.value == undefined && item.t3 != 'any' && item.t5 != undefined) {
156
- if (item.t3 != 'function') {
157
- item.value = item.t5
158
- }
159
- }
160
- })
161
- },
162
- setData(config, type) {
163
- let params = {};
164
- for (let data of this.data) {
165
- if (data.value != undefined && data.value.toString().trim() != '') {
166
- params[data.t1] = data.value;
167
- }
168
- }
169
- if (Object.keys(params) == 0) {
170
- return;
171
- }
172
- config[type] = params;
173
- },
174
- onOpen(row) {
175
- if (!row.value || row.value == "") {
176
- if (!row.noParams) {
177
- row.value = 'const ' + row.t5 + ' = params;\n'
178
- } else {
179
- row.value = row.t5 + '\n'
180
- }
181
- }
182
- }
183
- },
184
- created() {
185
- this.data = this.dataSource;
186
- this.setDefaultData()
187
- if (this.height) {
188
- this.option.height = this.height;
189
- }
190
- }
191
- }
192
- </script>