imatrix-ui 0.2.3-up → 0.2.5-up
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +1033 -1118
- package/lib/super-ui.umd.cjs +25 -31
- package/package.json +33 -34
- package/packages/super-grid/src/normal-column.vue +1224 -1221
- package/packages/super-nine-grid/src/super-nine-grid.vue +1188 -1164
- package/packages/super-nine-grid/src/utils.js +264 -264
- package/src/permission.js +160 -160
- package/src/router/index.js +110 -110
- package/src/store/modules/permission.js +145 -145
- package/src/styles/theme/dark-blue/button.scss +6 -0
- package/src/styles/theme/dark-blue/index.scss +6 -5
- package/src/styles/theme/dark-blue/pagination.scss +4 -0
- package/src/utils/auth-api.js +161 -159
- package/src/utils/util.js +544 -539
- package/src/views/layout/components/Menubar/SidebarItem.vue +164 -164
- package/src/views/layout/components/Sidebar/SidebarItem.vue +135 -135
|
@@ -1,264 +1,264 @@
|
|
|
1
|
-
import store from './store'
|
|
2
|
-
import * as Vue from 'vue'
|
|
3
|
-
export function getColumnValues(data, prop) {
|
|
4
|
-
const values = []
|
|
5
|
-
for (const obj of data) {
|
|
6
|
-
values.push(obj[prop])
|
|
7
|
-
}
|
|
8
|
-
return values
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* 返回的数组表示当前列每行的合并情况:[3,0,0,1,1]表示1到3行合并,四五行不合并
|
|
12
|
-
* @param {Array} data 列表数据
|
|
13
|
-
* @param {String} prop 列名
|
|
14
|
-
*/
|
|
15
|
-
export function getSpanValuesForColumn(data, prop) {
|
|
16
|
-
const spanArr = []
|
|
17
|
-
let pos = 0
|
|
18
|
-
for (let i = 0; i < data.length; i++) {
|
|
19
|
-
if (i === 0) {
|
|
20
|
-
spanArr.push(1)
|
|
21
|
-
pos = 0
|
|
22
|
-
} else {
|
|
23
|
-
// 判断当前元素与上一个元素是否相同
|
|
24
|
-
if (data[i][prop] === data[i - 1][prop]) {
|
|
25
|
-
spanArr[pos] += 1
|
|
26
|
-
spanArr.push(0)
|
|
27
|
-
} else {
|
|
28
|
-
spanArr.push(1)
|
|
29
|
-
pos = i
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return spanArr
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function getFirstEditableColumn(listCode) {
|
|
37
|
-
if (!listCode) {
|
|
38
|
-
listCode = store.get('_nine_list_code')
|
|
39
|
-
}
|
|
40
|
-
if (listCode && listCode.indexOf('~') < 0) {
|
|
41
|
-
// 拼接默认的九宫格gridId
|
|
42
|
-
listCode = listCode + '~' + '_nineGrid'
|
|
43
|
-
}
|
|
44
|
-
for (const column of store.get(listCode).columns) {
|
|
45
|
-
if (column.editable) {
|
|
46
|
-
return column.prop
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return null
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const ArrowKeyAction = {
|
|
53
|
-
getIndex(prop) {
|
|
54
|
-
let i = 0
|
|
55
|
-
for (const column of store.columns) {
|
|
56
|
-
if (column.prop === prop) {
|
|
57
|
-
return i
|
|
58
|
-
} else {
|
|
59
|
-
i++
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
getLeftColumn(prop) {
|
|
64
|
-
const index = ArrowKeyAction.getIndex(prop)
|
|
65
|
-
let i = 0
|
|
66
|
-
for (i = index - 1; i >= 0; i--) {
|
|
67
|
-
if (store.columns[i].editable) {
|
|
68
|
-
return store.columns[i].prop
|
|
69
|
-
} else {
|
|
70
|
-
return null
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
}
|
|
75
|
-
export { ArrowKeyAction }
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 是否是行编辑时的属性
|
|
79
|
-
* @param {*} event
|
|
80
|
-
*/
|
|
81
|
-
export function isHasEditOption(event, listCode) {
|
|
82
|
-
if (!listCode) {
|
|
83
|
-
listCode = store.get('_nine_list_code')
|
|
84
|
-
}
|
|
85
|
-
if (listCode && listCode.indexOf('~') < 0) {
|
|
86
|
-
// 拼接默认的九宫格gridId
|
|
87
|
-
listCode = listCode + '~' + '_nineGrid'
|
|
88
|
-
}
|
|
89
|
-
const gridParams = store.get(listCode)
|
|
90
|
-
if (
|
|
91
|
-
gridParams.options.lineEditOptions &&
|
|
92
|
-
gridParams.options.lineEditOptions[event]
|
|
93
|
-
) {
|
|
94
|
-
return true
|
|
95
|
-
}
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function isEditOptionFunction(event, listCode) {
|
|
100
|
-
if (!listCode) {
|
|
101
|
-
listCode = store.get('_nine_list_code')
|
|
102
|
-
}
|
|
103
|
-
if (listCode && listCode.indexOf('~') < 0) {
|
|
104
|
-
// 拼接默认的九宫格gridId
|
|
105
|
-
listCode = listCode + '~' + '_nineGrid'
|
|
106
|
-
}
|
|
107
|
-
const gridParams = store.get(listCode)
|
|
108
|
-
if (
|
|
109
|
-
gridParams.options.lineEditOptions &&
|
|
110
|
-
typeof gridParams.options.lineEditOptions[event] === 'function'
|
|
111
|
-
) {
|
|
112
|
-
return true
|
|
113
|
-
}
|
|
114
|
-
return false
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* 是否是行编辑时的属性
|
|
119
|
-
* @param {*} event
|
|
120
|
-
*/
|
|
121
|
-
export function isHasOptionFunction(event, listCode) {
|
|
122
|
-
if (!listCode) {
|
|
123
|
-
listCode = store.get('_nine_list_code')
|
|
124
|
-
}
|
|
125
|
-
if (listCode && listCode.indexOf('~') < 0) {
|
|
126
|
-
// 拼接默认的九宫格gridId
|
|
127
|
-
listCode = listCode + '~' + '_nineGrid'
|
|
128
|
-
}
|
|
129
|
-
const gridParams = store.get(listCode)
|
|
130
|
-
if (gridParams.options && typeof gridParams.options[event] === 'function') {
|
|
131
|
-
return true
|
|
132
|
-
}
|
|
133
|
-
return false
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function isOptionFunction(props, listCode) {
|
|
137
|
-
if (!listCode) {
|
|
138
|
-
listCode = store.get('_nine_list_code')
|
|
139
|
-
}
|
|
140
|
-
if (listCode && listCode.indexOf('~') < 0) {
|
|
141
|
-
// 拼接默认的九宫格gridId
|
|
142
|
-
listCode = listCode + '~' + '_nineGrid'
|
|
143
|
-
}
|
|
144
|
-
const gridParams = store.get(listCode)
|
|
145
|
-
if (props.indexOf('.') > 0) {
|
|
146
|
-
let optionProp = gridParams.options
|
|
147
|
-
const propsArr = props.split('.')
|
|
148
|
-
for (let i = 0; i < propsArr.length; i++) {
|
|
149
|
-
const event = propsArr[i]
|
|
150
|
-
if (optionProp) {
|
|
151
|
-
if (typeof optionProp[event] === 'function') {
|
|
152
|
-
return true
|
|
153
|
-
} else {
|
|
154
|
-
optionProp = optionProp[event]
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
return false
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
161
|
-
if (gridParams.options && typeof gridParams.options[event] === 'function') {
|
|
162
|
-
return true
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* 获得控制表格需要的参数
|
|
169
|
-
*/
|
|
170
|
-
export function getGridParams() {
|
|
171
|
-
const gridParams = {
|
|
172
|
-
columns: [],
|
|
173
|
-
gridData: [],
|
|
174
|
-
orgGridData: [], // 行编辑保存时使用
|
|
175
|
-
showValidateError: true, // 是否可以显示验证信息,防止同时弹出两个验证信息的
|
|
176
|
-
options: {
|
|
177
|
-
// id: '_nineGrid', // 九宫格组件的元素id,影响格子拖动功能,当tab页签中有多个九宫格时必须配置该属性,如果当前页面中只有一个九宫格组件,不配也可以
|
|
178
|
-
// 附加参数
|
|
179
|
-
// extraParam: {},
|
|
180
|
-
// 表格及数据均加载完成后
|
|
181
|
-
// gridComplete: function(gridData, columns) {}, // gridData, columns
|
|
182
|
-
// 刚请求到字段配置,没有请求数据时,可以通过该方法修改表头或添加自定义表头
|
|
183
|
-
// loadBeforeSend: function(columns, settings) { return true }, // columns, settings(列表所有设置,包括字段设置、分页设置、查询设置、行编辑设置)
|
|
184
|
-
// 数据加载失败的回调方法
|
|
185
|
-
// loadError: function(code, error) {}, // code, error
|
|
186
|
-
// 数据请求成功后,表格记录显示前的回调方法,该方法主要是处理业务数据,比如:处理xss攻击
|
|
187
|
-
// gridDataLoaded: function(data) { return data },
|
|
188
|
-
// 查询组件需要的一些参数
|
|
189
|
-
// search: {
|
|
190
|
-
// // 属性自定义组件,当不是行编辑时,查询框需要自定义控件时
|
|
191
|
-
// customSearchElements: function(column) { return null },
|
|
192
|
-
// labelWidth: '150px',
|
|
193
|
-
// fieldNum: 4, // 查询的每行排放的字段个数,默认是4个字段
|
|
194
|
-
// },
|
|
195
|
-
// isSql:false, // 是否是sql查询数据内容。在使用sql语句查询表内容时,否则会导致列表字段的值不显示,都显示为空
|
|
196
|
-
// initSearchForm: [], // 初始查询条件,格式同“查询”按钮封装的json格式
|
|
197
|
-
// multiple: true/false,// 是否多选,默认以列表管理中配置的为准
|
|
198
|
-
// initSortInfo: {prop:'',order: 'ASC/DESC'},// 默认排序字段,和排序方式
|
|
199
|
-
// pageSizes: '20,30,50,100',// 可选行数
|
|
200
|
-
// initSearch: true/false, // 初始化时是否查询,默认是查询
|
|
201
|
-
// isHiddenSearchForm: false, //查询时,是否隐藏查询区域,不配置默认是显示的
|
|
202
|
-
// isHasCreate: true/false, // 是否显示新建按钮
|
|
203
|
-
// createPermission: 'a.b.c', // 新建按钮的资源编码,用于控制新建按钮的权限
|
|
204
|
-
// props: {imageUrl:'prop1', content:'prop1', title:'prop2', subTitle:'prop3'}, // 九宫格中图片、标题、副标题属性名配置
|
|
205
|
-
// operations: [ // 按钮区按钮信息
|
|
206
|
-
// {
|
|
207
|
-
// name:'修改',
|
|
208
|
-
// icon:'el-icon-edit',
|
|
209
|
-
// event: this.updateItem,
|
|
210
|
-
// permission:'sss.ddd.ddds'
|
|
211
|
-
// },
|
|
212
|
-
// {
|
|
213
|
-
// name:'删除',
|
|
214
|
-
// icon:'el-icon-delete',
|
|
215
|
-
// event: this.deleteItem
|
|
216
|
-
// },
|
|
217
|
-
// {
|
|
218
|
-
// name:'设为模板',
|
|
219
|
-
// icon:'el-icon-document-copy',
|
|
220
|
-
// event: this.setToTemplate
|
|
221
|
-
// }
|
|
222
|
-
// ]
|
|
223
|
-
},
|
|
224
|
-
}
|
|
225
|
-
return
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export function addDynamicProp(target, prop, propValue) {
|
|
229
|
-
const nestedProp = prop.split('.')
|
|
230
|
-
if (nestedProp.length === 1) {
|
|
231
|
-
if (propValue !== undefined) {
|
|
232
|
-
target[prop] = propValue
|
|
233
|
-
} else {
|
|
234
|
-
target[prop] = null
|
|
235
|
-
}
|
|
236
|
-
return
|
|
237
|
-
}
|
|
238
|
-
// 如果是嵌套属性,就要逐层添加空对象,起点是searchForm,属性每多一层嵌套,parent就前进一层,到倒数第二层为止
|
|
239
|
-
let parent = target
|
|
240
|
-
for (let i = 0; i < nestedProp.length - 1; i++) {
|
|
241
|
-
if (parent[nestedProp[i]] === undefined) {
|
|
242
|
-
parent[nestedProp[i]] = {}
|
|
243
|
-
}
|
|
244
|
-
parent = parent[nestedProp[i]]
|
|
245
|
-
}
|
|
246
|
-
if (propValue !== undefined) {
|
|
247
|
-
parent[nestedProp[nestedProp.length - 1]] = propValue
|
|
248
|
-
} else {
|
|
249
|
-
parent[nestedProp[nestedProp.length - 1]] = null
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export function getTableHeight(showSearch, searchForm) {
|
|
254
|
-
if (showSearch === true) {
|
|
255
|
-
let searchHeight = 0
|
|
256
|
-
if (searchForm) {
|
|
257
|
-
// 获得查询区高度
|
|
258
|
-
searchHeight = searchForm.$el.offsetHeight
|
|
259
|
-
}
|
|
260
|
-
return window.innerHeight - searchHeight - 165
|
|
261
|
-
} else {
|
|
262
|
-
return window.innerHeight - 165
|
|
263
|
-
}
|
|
264
|
-
}
|
|
1
|
+
import store from './store'
|
|
2
|
+
import * as Vue from 'vue'
|
|
3
|
+
export function getColumnValues(data, prop) {
|
|
4
|
+
const values = []
|
|
5
|
+
for (const obj of data) {
|
|
6
|
+
values.push(obj[prop])
|
|
7
|
+
}
|
|
8
|
+
return values
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 返回的数组表示当前列每行的合并情况:[3,0,0,1,1]表示1到3行合并,四五行不合并
|
|
12
|
+
* @param {Array} data 列表数据
|
|
13
|
+
* @param {String} prop 列名
|
|
14
|
+
*/
|
|
15
|
+
export function getSpanValuesForColumn(data, prop) {
|
|
16
|
+
const spanArr = []
|
|
17
|
+
let pos = 0
|
|
18
|
+
for (let i = 0; i < data.length; i++) {
|
|
19
|
+
if (i === 0) {
|
|
20
|
+
spanArr.push(1)
|
|
21
|
+
pos = 0
|
|
22
|
+
} else {
|
|
23
|
+
// 判断当前元素与上一个元素是否相同
|
|
24
|
+
if (data[i][prop] === data[i - 1][prop]) {
|
|
25
|
+
spanArr[pos] += 1
|
|
26
|
+
spanArr.push(0)
|
|
27
|
+
} else {
|
|
28
|
+
spanArr.push(1)
|
|
29
|
+
pos = i
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return spanArr
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function getFirstEditableColumn(listCode) {
|
|
37
|
+
if (!listCode) {
|
|
38
|
+
listCode = store.get('_nine_list_code')
|
|
39
|
+
}
|
|
40
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
41
|
+
// 拼接默认的九宫格gridId
|
|
42
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
43
|
+
}
|
|
44
|
+
for (const column of store.get(listCode).columns) {
|
|
45
|
+
if (column.editable) {
|
|
46
|
+
return column.prop
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const ArrowKeyAction = {
|
|
53
|
+
getIndex(prop) {
|
|
54
|
+
let i = 0
|
|
55
|
+
for (const column of store.columns) {
|
|
56
|
+
if (column.prop === prop) {
|
|
57
|
+
return i
|
|
58
|
+
} else {
|
|
59
|
+
i++
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
getLeftColumn(prop) {
|
|
64
|
+
const index = ArrowKeyAction.getIndex(prop)
|
|
65
|
+
let i = 0
|
|
66
|
+
for (i = index - 1; i >= 0; i--) {
|
|
67
|
+
if (store.columns[i].editable) {
|
|
68
|
+
return store.columns[i].prop
|
|
69
|
+
} else {
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
export { ArrowKeyAction }
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 是否是行编辑时的属性
|
|
79
|
+
* @param {*} event
|
|
80
|
+
*/
|
|
81
|
+
export function isHasEditOption(event, listCode) {
|
|
82
|
+
if (!listCode) {
|
|
83
|
+
listCode = store.get('_nine_list_code')
|
|
84
|
+
}
|
|
85
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
86
|
+
// 拼接默认的九宫格gridId
|
|
87
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
88
|
+
}
|
|
89
|
+
const gridParams = store.get(listCode)
|
|
90
|
+
if (
|
|
91
|
+
gridParams.options.lineEditOptions &&
|
|
92
|
+
gridParams.options.lineEditOptions[event]
|
|
93
|
+
) {
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
96
|
+
return false
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function isEditOptionFunction(event, listCode) {
|
|
100
|
+
if (!listCode) {
|
|
101
|
+
listCode = store.get('_nine_list_code')
|
|
102
|
+
}
|
|
103
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
104
|
+
// 拼接默认的九宫格gridId
|
|
105
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
106
|
+
}
|
|
107
|
+
const gridParams = store.get(listCode)
|
|
108
|
+
if (
|
|
109
|
+
gridParams.options.lineEditOptions &&
|
|
110
|
+
typeof gridParams.options.lineEditOptions[event] === 'function'
|
|
111
|
+
) {
|
|
112
|
+
return true
|
|
113
|
+
}
|
|
114
|
+
return false
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 是否是行编辑时的属性
|
|
119
|
+
* @param {*} event
|
|
120
|
+
*/
|
|
121
|
+
export function isHasOptionFunction(event, listCode) {
|
|
122
|
+
if (!listCode) {
|
|
123
|
+
listCode = store.get('_nine_list_code')
|
|
124
|
+
}
|
|
125
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
126
|
+
// 拼接默认的九宫格gridId
|
|
127
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
128
|
+
}
|
|
129
|
+
const gridParams = store.get(listCode)
|
|
130
|
+
if (gridParams.options && typeof gridParams.options[event] === 'function') {
|
|
131
|
+
return true
|
|
132
|
+
}
|
|
133
|
+
return false
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function isOptionFunction(props, listCode) {
|
|
137
|
+
if (!listCode) {
|
|
138
|
+
listCode = store.get('_nine_list_code')
|
|
139
|
+
}
|
|
140
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
141
|
+
// 拼接默认的九宫格gridId
|
|
142
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
143
|
+
}
|
|
144
|
+
const gridParams = store.get(listCode)
|
|
145
|
+
if (props.indexOf('.') > 0) {
|
|
146
|
+
let optionProp = gridParams.options
|
|
147
|
+
const propsArr = props.split('.')
|
|
148
|
+
for (let i = 0; i < propsArr.length; i++) {
|
|
149
|
+
const event = propsArr[i]
|
|
150
|
+
if (optionProp) {
|
|
151
|
+
if (typeof optionProp[event] === 'function') {
|
|
152
|
+
return true
|
|
153
|
+
} else {
|
|
154
|
+
optionProp = optionProp[event]
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
return false
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
if (gridParams.options && typeof gridParams.options[event] === 'function') {
|
|
162
|
+
return true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 获得控制表格需要的参数
|
|
169
|
+
*/
|
|
170
|
+
export function getGridParams() {
|
|
171
|
+
const gridParams = {
|
|
172
|
+
columns: [],
|
|
173
|
+
gridData: [],
|
|
174
|
+
orgGridData: [], // 行编辑保存时使用
|
|
175
|
+
showValidateError: true, // 是否可以显示验证信息,防止同时弹出两个验证信息的
|
|
176
|
+
options: {
|
|
177
|
+
// id: '_nineGrid', // 九宫格组件的元素id,影响格子拖动功能,当tab页签中有多个九宫格时必须配置该属性,如果当前页面中只有一个九宫格组件,不配也可以
|
|
178
|
+
// 附加参数
|
|
179
|
+
// extraParam: {},
|
|
180
|
+
// 表格及数据均加载完成后
|
|
181
|
+
// gridComplete: function(gridData, columns) {}, // gridData, columns
|
|
182
|
+
// 刚请求到字段配置,没有请求数据时,可以通过该方法修改表头或添加自定义表头
|
|
183
|
+
// loadBeforeSend: function(columns, settings) { return true }, // columns, settings(列表所有设置,包括字段设置、分页设置、查询设置、行编辑设置)
|
|
184
|
+
// 数据加载失败的回调方法
|
|
185
|
+
// loadError: function(code, error) {}, // code, error
|
|
186
|
+
// 数据请求成功后,表格记录显示前的回调方法,该方法主要是处理业务数据,比如:处理xss攻击
|
|
187
|
+
// gridDataLoaded: function(data) { return data },
|
|
188
|
+
// 查询组件需要的一些参数
|
|
189
|
+
// search: {
|
|
190
|
+
// // 属性自定义组件,当不是行编辑时,查询框需要自定义控件时
|
|
191
|
+
// customSearchElements: function(column) { return null },
|
|
192
|
+
// labelWidth: '150px',
|
|
193
|
+
// fieldNum: 4, // 查询的每行排放的字段个数,默认是4个字段
|
|
194
|
+
// },
|
|
195
|
+
// isSql:false, // 是否是sql查询数据内容。在使用sql语句查询表内容时,否则会导致列表字段的值不显示,都显示为空
|
|
196
|
+
// initSearchForm: [], // 初始查询条件,格式同“查询”按钮封装的json格式
|
|
197
|
+
// multiple: true/false,// 是否多选,默认以列表管理中配置的为准
|
|
198
|
+
// initSortInfo: {prop:'',order: 'ASC/DESC'},// 默认排序字段,和排序方式
|
|
199
|
+
// pageSizes: '20,30,50,100',// 可选行数
|
|
200
|
+
// initSearch: true/false, // 初始化时是否查询,默认是查询
|
|
201
|
+
// isHiddenSearchForm: false, //查询时,是否隐藏查询区域,不配置默认是显示的
|
|
202
|
+
// isHasCreate: true/false, // 是否显示新建按钮
|
|
203
|
+
// createPermission: 'a.b.c', // 新建按钮的资源编码,用于控制新建按钮的权限
|
|
204
|
+
// props: {imageUrl:'prop1', content:'prop1', title:'prop2', subTitle:'prop3'}, // 九宫格中图片、标题、副标题属性名配置
|
|
205
|
+
// operations: [ // 按钮区按钮信息
|
|
206
|
+
// {
|
|
207
|
+
// name:'修改',
|
|
208
|
+
// icon:'el-icon-edit',
|
|
209
|
+
// event: this.updateItem,
|
|
210
|
+
// permission:'sss.ddd.ddds'
|
|
211
|
+
// },
|
|
212
|
+
// {
|
|
213
|
+
// name:'删除',
|
|
214
|
+
// icon:'el-icon-delete',
|
|
215
|
+
// event: this.deleteItem
|
|
216
|
+
// },
|
|
217
|
+
// {
|
|
218
|
+
// name:'设为模板',
|
|
219
|
+
// icon:'el-icon-document-copy',
|
|
220
|
+
// event: this.setToTemplate
|
|
221
|
+
// }
|
|
222
|
+
// ]
|
|
223
|
+
},
|
|
224
|
+
}
|
|
225
|
+
return Vue.reactive(gridParams)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function addDynamicProp(target, prop, propValue) {
|
|
229
|
+
const nestedProp = prop.split('.')
|
|
230
|
+
if (nestedProp.length === 1) {
|
|
231
|
+
if (propValue !== undefined) {
|
|
232
|
+
target[prop] = propValue
|
|
233
|
+
} else {
|
|
234
|
+
target[prop] = null
|
|
235
|
+
}
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
// 如果是嵌套属性,就要逐层添加空对象,起点是searchForm,属性每多一层嵌套,parent就前进一层,到倒数第二层为止
|
|
239
|
+
let parent = target
|
|
240
|
+
for (let i = 0; i < nestedProp.length - 1; i++) {
|
|
241
|
+
if (parent[nestedProp[i]] === undefined) {
|
|
242
|
+
parent[nestedProp[i]] = {}
|
|
243
|
+
}
|
|
244
|
+
parent = parent[nestedProp[i]]
|
|
245
|
+
}
|
|
246
|
+
if (propValue !== undefined) {
|
|
247
|
+
parent[nestedProp[nestedProp.length - 1]] = propValue
|
|
248
|
+
} else {
|
|
249
|
+
parent[nestedProp[nestedProp.length - 1]] = null
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export function getTableHeight(showSearch, searchForm) {
|
|
254
|
+
if (showSearch === true) {
|
|
255
|
+
let searchHeight = 0
|
|
256
|
+
if (searchForm) {
|
|
257
|
+
// 获得查询区高度
|
|
258
|
+
searchHeight = searchForm.$el.offsetHeight
|
|
259
|
+
}
|
|
260
|
+
return window.innerHeight - searchHeight - 165
|
|
261
|
+
} else {
|
|
262
|
+
return window.innerHeight - 165
|
|
263
|
+
}
|
|
264
|
+
}
|