imatrix-ui 0.1.4-up → 0.1.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/components/index.js +4 -1
- package/components/plugins/export-data-new.js +4 -4
- package/components/plugins/export-data.js +4 -4
- package/components/plugins/index.js +1 -0
- package/components/rich-editor/index.vue +12 -11
- package/components/super-grid/normal-column.vue +1 -1
- package/components/super-nine-grid/apis.js +108 -0
- package/components/super-nine-grid/custom-formatter.js +73 -0
- package/components/super-nine-grid/formatter.js +134 -0
- package/components/super-nine-grid/search-form-number.vue +35 -0
- package/components/super-nine-grid/search-form.vue +700 -0
- package/components/super-nine-grid/search-methods.js +151 -0
- package/components/super-nine-grid/store.js +3 -0
- package/components/super-nine-grid/super-grid-service.js +106 -0
- package/components/super-nine-grid/super-nine-grid.vue +1163 -0
- package/components/super-nine-grid/utils.js +264 -0
- package/package.json +3 -4
package/components/index.js
CHANGED
|
@@ -4,10 +4,11 @@ import FsPreview from './fs-preview/fs-preview.vue'
|
|
|
4
4
|
import RichEditor from './rich-editor/index.vue'
|
|
5
5
|
import DynamicSourceSelect from './dynamic-source-select/dynamic-source-select.vue'
|
|
6
6
|
import customPlugin from './plugins/index'
|
|
7
|
+
import SuperNineGrid from './super-nine-grid/super-nine-grid.vue'
|
|
7
8
|
import SvgIcon from './svg-icon'
|
|
8
9
|
|
|
9
10
|
// 按需引入
|
|
10
|
-
export { Button, SuperGrid, FsPreview, RichEditor, DynamicSourceSelect }
|
|
11
|
+
export { Button, SuperGrid, FsPreview, RichEditor, DynamicSourceSelect,SuperNineGrid }
|
|
11
12
|
|
|
12
13
|
const component = [
|
|
13
14
|
Button,
|
|
@@ -15,11 +16,13 @@ const component = [
|
|
|
15
16
|
FsPreview,
|
|
16
17
|
RichEditor,
|
|
17
18
|
DynamicSourceSelect,
|
|
19
|
+
SuperNineGrid,
|
|
18
20
|
SvgIcon,
|
|
19
21
|
]
|
|
20
22
|
|
|
21
23
|
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
|
|
22
24
|
const install = function(Vue) {
|
|
25
|
+
console.log('%c描述-165233','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px','执行挂载');
|
|
23
26
|
Vue.directive('prevent-reclick', PreventReclick)
|
|
24
27
|
Vue.use(customPlugin)
|
|
25
28
|
if (install.installed) return
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Vue from 'vue'
|
|
2
|
-
import store from '../super-grid/
|
|
3
|
-
import { getExtraParam } from '../super-grid/
|
|
4
|
-
import nineGridStore from '../super-nine-grid/
|
|
5
|
-
import { Message } from 'element-
|
|
2
|
+
import store from '../super-grid/store'
|
|
3
|
+
import { getExtraParam } from '../super-grid/utils'
|
|
4
|
+
import nineGridStore from '../super-nine-grid/store'
|
|
5
|
+
import { ElMessage as Message } from 'element-plus'
|
|
6
6
|
import { packageEnumAndBeanColumnValueSets } from '../utils/value-set'
|
|
7
7
|
import { getI18n } from '../../src/utils/util'
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Vue from 'vue'
|
|
2
|
-
import store from '../super-grid/
|
|
3
|
-
import { getExtraParam } from '../super-grid/
|
|
4
|
-
import nineGridStore from '../super-nine-grid/
|
|
5
|
-
import { Message } from 'element-
|
|
2
|
+
import store from '../super-grid/store'
|
|
3
|
+
import { getExtraParam } from '../super-grid/utils'
|
|
4
|
+
import nineGridStore from '../super-nine-grid/store'
|
|
5
|
+
import { ElMessage as Message } from 'element-plus'
|
|
6
6
|
import { packageEnumAndBeanColumnValueSets } from '../utils/value-set'
|
|
7
7
|
import { getI18n } from '../../src/utils/util'
|
|
8
8
|
/**
|
|
@@ -4,6 +4,7 @@ import publicMethodService from './public-method'
|
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
install: function (Vue, options) {
|
|
7
|
+
console.log('%c描述-160910','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px','挂载');
|
|
7
8
|
Vue.config.globalProperties.$exportData = ExportService.exportData
|
|
8
9
|
Vue.config.globalProperties.$isInIframe = publicMethodService.isInIframe
|
|
9
10
|
Vue.config.globalProperties.$escapeHtml = publicMethodService.escapeHtml
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<main id="sample">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
<!--<Editor-->
|
|
4
|
+
<!-- api-key="no-api-key"-->
|
|
5
|
+
<!-- :init="{-->
|
|
6
|
+
<!-- plugins: 'lists link image table code help wordcount'-->
|
|
7
|
+
<!-- }"-->
|
|
8
|
+
<!--/>-->
|
|
9
9
|
</main>
|
|
10
10
|
</template>
|
|
11
11
|
<style scoped>
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
</style>
|
|
26
26
|
<script>
|
|
27
|
-
|
|
27
|
+
// TODO 富文本编辑器需调整
|
|
28
|
+
// import Editor from '@tinymce/tinymce-vue'
|
|
28
29
|
export default {
|
|
29
30
|
name: 'RichEditor',
|
|
30
31
|
components: {
|
|
31
|
-
Editor,
|
|
32
|
+
// Editor,
|
|
32
33
|
},
|
|
33
34
|
props: {
|
|
34
35
|
entity: {
|
|
@@ -68,13 +69,13 @@ export default {
|
|
|
68
69
|
},
|
|
69
70
|
},
|
|
70
71
|
data() {
|
|
71
|
-
|
|
72
|
+
|
|
72
73
|
return {
|
|
73
|
-
|
|
74
|
+
|
|
74
75
|
}
|
|
75
76
|
},
|
|
76
77
|
watch: {
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
},
|
|
79
80
|
created() {},
|
|
80
81
|
mounted() {
|
|
@@ -447,7 +447,7 @@ import RichEditorViewer from '../rich-editor/viewer.vue'
|
|
|
447
447
|
export default {
|
|
448
448
|
setup(){
|
|
449
449
|
const { proxy } = getCurrentInstance()
|
|
450
|
-
console.log('%c描述-231513','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',proxy);
|
|
450
|
+
console.log('%c描述-231513','color:#2E3435;background:#F8BB07;padding:3px;border-radius:2px',proxy.$escapeHtml);
|
|
451
451
|
return{
|
|
452
452
|
proxy
|
|
453
453
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { $on, $off, $once, $emit } from '../utils/gogocodeTransfer'
|
|
2
|
+
import store from './store'
|
|
3
|
+
const apis = {
|
|
4
|
+
// 刷新列表数据
|
|
5
|
+
refresh() {
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
if (this.$refs) {
|
|
8
|
+
// 刷新列表数据
|
|
9
|
+
if (this.$refs.sf) {
|
|
10
|
+
this.search(this.$refs.sf.searchParams, true)
|
|
11
|
+
.then(() => resolve())
|
|
12
|
+
.catch((error) => reject(error))
|
|
13
|
+
} else {
|
|
14
|
+
this.search(null, true)
|
|
15
|
+
.then(() => resolve())
|
|
16
|
+
.catch((error) => reject(error))
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
resolve()
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
// 显示查询
|
|
24
|
+
showSearchForm() {
|
|
25
|
+
this.showSearch = true
|
|
26
|
+
$emit(this, 'showSearch')
|
|
27
|
+
},
|
|
28
|
+
// 取消查询
|
|
29
|
+
cancelSearch() {
|
|
30
|
+
this.showSearch = false
|
|
31
|
+
$emit(this, 'cancelSearch')
|
|
32
|
+
},
|
|
33
|
+
// 获得查询条件
|
|
34
|
+
getSearchForm() {
|
|
35
|
+
const gridParams = store.get(this.storeId)
|
|
36
|
+
if (gridParams.searchForm) {
|
|
37
|
+
return gridParams.searchForm
|
|
38
|
+
} else {
|
|
39
|
+
return []
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
// 获得列表所有数据
|
|
43
|
+
getGridData(listCode) {
|
|
44
|
+
if (!listCode) {
|
|
45
|
+
listCode = store.get('_nine_list_code')
|
|
46
|
+
}
|
|
47
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
48
|
+
// 拼接默认的九宫格gridId
|
|
49
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
50
|
+
}
|
|
51
|
+
const gridParams = store.get(listCode)
|
|
52
|
+
return gridParams.gridData
|
|
53
|
+
},
|
|
54
|
+
// 获得字段配置
|
|
55
|
+
getColumns(listCode) {
|
|
56
|
+
if (!listCode) {
|
|
57
|
+
listCode = store.get('_nine_list_code')
|
|
58
|
+
}
|
|
59
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
60
|
+
// 拼接默认的九宫格gridId
|
|
61
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
62
|
+
}
|
|
63
|
+
const gridParams = store.get(listCode)
|
|
64
|
+
return gridParams.columns
|
|
65
|
+
},
|
|
66
|
+
// listCode 列表编码~gridId,例如:MMS_BUSSINESS_SYSTEM~grid1
|
|
67
|
+
getPagination(listCode) {
|
|
68
|
+
if (!listCode) {
|
|
69
|
+
listCode = store.get('_nine_list_code')
|
|
70
|
+
}
|
|
71
|
+
if (listCode && listCode.indexOf('~') < 0) {
|
|
72
|
+
// 拼接默认的九宫格gridId
|
|
73
|
+
listCode = listCode + '~' + '_nineGrid'
|
|
74
|
+
}
|
|
75
|
+
const gridParams = store.get(listCode)
|
|
76
|
+
return gridParams.pagination
|
|
77
|
+
},
|
|
78
|
+
// 获得选中的记录集合
|
|
79
|
+
getSelections() {
|
|
80
|
+
return this.selections
|
|
81
|
+
},
|
|
82
|
+
// 获得选中的记录id集合
|
|
83
|
+
getSelectionIds() {
|
|
84
|
+
return this.selectionIds
|
|
85
|
+
},
|
|
86
|
+
// 清空选中的记录
|
|
87
|
+
clearSelections() {
|
|
88
|
+
this.selections = []
|
|
89
|
+
this.selectionIds = []
|
|
90
|
+
this.selectionModels = {}
|
|
91
|
+
this.currentId = null
|
|
92
|
+
},
|
|
93
|
+
// 单选时获得选中的记录
|
|
94
|
+
getSelection() {
|
|
95
|
+
if (this.selections && this.selections.length > 0) {
|
|
96
|
+
return this.selections[0]
|
|
97
|
+
}
|
|
98
|
+
return null
|
|
99
|
+
},
|
|
100
|
+
// 单选时获得选中的记录id集合
|
|
101
|
+
getSelectionId() {
|
|
102
|
+
if (this.selectionIds && this.selectionIds.length > 0) {
|
|
103
|
+
return this.selectionIds[0]
|
|
104
|
+
}
|
|
105
|
+
return null
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
export default apis
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// import Vue from 'vue'
|
|
2
|
+
import { doFormat } from './formatter'
|
|
3
|
+
const customFormatter = {
|
|
4
|
+
isObjectProp(prop) {
|
|
5
|
+
if (prop.indexOf('.') > 0) {
|
|
6
|
+
return true
|
|
7
|
+
} else {
|
|
8
|
+
return false
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
objectPropOriginalValue(row, prop) {
|
|
13
|
+
try {
|
|
14
|
+
// console.log('---super-grid--objectPropOriginalValue--')
|
|
15
|
+
let objValue = row
|
|
16
|
+
const props = prop.split('.')
|
|
17
|
+
props.forEach((subProp) => {
|
|
18
|
+
if (objValue) {
|
|
19
|
+
objValue = objValue[subProp]
|
|
20
|
+
} else {
|
|
21
|
+
objValue = ''
|
|
22
|
+
throw objValue
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
return objValue
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// console.log(e)
|
|
28
|
+
return ''
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
objectPropValue(row, column, prop) {
|
|
33
|
+
// console.log('---super-grid--objectPropValue--')
|
|
34
|
+
const val = doFormat(column, this.objectPropOriginalValue(row, prop))
|
|
35
|
+
return val
|
|
36
|
+
},
|
|
37
|
+
getColumnValue(row, column) {
|
|
38
|
+
const prop = column.prop
|
|
39
|
+
let originalValue = row[prop]
|
|
40
|
+
if (this.isObjectProp(prop)) {
|
|
41
|
+
originalValue = this.objectPropOriginalValue(row, prop)
|
|
42
|
+
}
|
|
43
|
+
const formatValue = doFormat(column, originalValue)
|
|
44
|
+
return { originalValue, formatValue }
|
|
45
|
+
},
|
|
46
|
+
onClickFun(row, column, onClick, rowIndex) {
|
|
47
|
+
const values = this.getColumnValue(row, column)
|
|
48
|
+
onClick.call(
|
|
49
|
+
this,
|
|
50
|
+
values.originalValue,
|
|
51
|
+
values.formatValue,
|
|
52
|
+
row,
|
|
53
|
+
column,
|
|
54
|
+
rowIndex
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
isShowButtonFun(entity, button) {
|
|
58
|
+
const isShowFun = button.isShow
|
|
59
|
+
if (isShowFun === undefined) {
|
|
60
|
+
return true
|
|
61
|
+
}
|
|
62
|
+
if (typeof isShowFun === 'function') {
|
|
63
|
+
let isShow = isShowFun.call(this, entity, button)
|
|
64
|
+
if (isShow === undefined) {
|
|
65
|
+
isShow = true
|
|
66
|
+
}
|
|
67
|
+
return isShow
|
|
68
|
+
} else {
|
|
69
|
+
return isShowFun
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
export default customFormatter
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
const formatter = {
|
|
2
|
+
number: function (value, options) {
|
|
3
|
+
// 小数位数
|
|
4
|
+
const precision = options.precision
|
|
5
|
+
// 是否显示千分位
|
|
6
|
+
const isDelimiter = options.delimiter
|
|
7
|
+
// 是否显示科学计数法
|
|
8
|
+
const scientific = options.scientific
|
|
9
|
+
// 几位开始计算
|
|
10
|
+
let scientificNum = options.scientificNum
|
|
11
|
+
if (value != null) {
|
|
12
|
+
if (precision > 0) {
|
|
13
|
+
// 表示有小数
|
|
14
|
+
value = parseFloat(value)
|
|
15
|
+
value = value.toFixed(precision)
|
|
16
|
+
}
|
|
17
|
+
if (isDelimiter) {
|
|
18
|
+
value = value.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
|
|
19
|
+
}
|
|
20
|
+
if (scientific != null) {
|
|
21
|
+
let isScientific = false
|
|
22
|
+
if (scientificNum) {
|
|
23
|
+
scientificNum = parseInt(scientificNum)
|
|
24
|
+
} else {
|
|
25
|
+
scientificNum = 11
|
|
26
|
+
}
|
|
27
|
+
if (value.length >= scientificNum) {
|
|
28
|
+
isScientific = true
|
|
29
|
+
}
|
|
30
|
+
if (isScientific) {
|
|
31
|
+
value = '' + value
|
|
32
|
+
value = parseFloat(value)
|
|
33
|
+
value = value.toExponential() // 转换为标准的科学计数法形式(字符串)
|
|
34
|
+
// const tmpArray = eformat.match(/\d(?:\.(\d*))?e([+-]\d+)/) // 分离出小数值和指数值
|
|
35
|
+
// value = value.toFixed(Math.max(0, (tmpArray[1] || '').length - tmpArray[2]))
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return value
|
|
41
|
+
},
|
|
42
|
+
currency: function (value, options) {
|
|
43
|
+
// 单位:$ 或 ¥
|
|
44
|
+
const sign = options.sign
|
|
45
|
+
return sign + this.number(value, options)
|
|
46
|
+
},
|
|
47
|
+
date: function (value, options) {
|
|
48
|
+
// format格式,例如:yyyy-m-d,yyyy-m-d hh:mm:ss等等
|
|
49
|
+
const format = options.format
|
|
50
|
+
if (value != null) {
|
|
51
|
+
const date = new Date(value)
|
|
52
|
+
var y = date.getFullYear()
|
|
53
|
+
var m = date.getMonth() + 1
|
|
54
|
+
var d = date.getDate()
|
|
55
|
+
var h = date.getHours()
|
|
56
|
+
var min = date.getMinutes()
|
|
57
|
+
var s = date.getSeconds()
|
|
58
|
+
if (m < 10) {
|
|
59
|
+
m = '0' + m
|
|
60
|
+
}
|
|
61
|
+
if (d < 10) {
|
|
62
|
+
d = '0' + d
|
|
63
|
+
}
|
|
64
|
+
if (h < 10) {
|
|
65
|
+
h = '0' + h
|
|
66
|
+
}
|
|
67
|
+
if (min < 10) {
|
|
68
|
+
min = '0' + min
|
|
69
|
+
}
|
|
70
|
+
if (s < 10) {
|
|
71
|
+
s = '0' + s
|
|
72
|
+
}
|
|
73
|
+
return format
|
|
74
|
+
.replace('yyyy', y)
|
|
75
|
+
.replace('m', m)
|
|
76
|
+
.replace('d', d)
|
|
77
|
+
.replace('hh', h)
|
|
78
|
+
.replace('mm', min)
|
|
79
|
+
.replace('ss', s)
|
|
80
|
+
}
|
|
81
|
+
return value
|
|
82
|
+
},
|
|
83
|
+
time: function (value, options) {
|
|
84
|
+
return this.date(value, options)
|
|
85
|
+
},
|
|
86
|
+
percent: function (value, options) {
|
|
87
|
+
return this.number(value, options) + '%'
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function doFormat(column, value) {
|
|
92
|
+
if (value === undefined || column === undefined) {
|
|
93
|
+
return value
|
|
94
|
+
}
|
|
95
|
+
// 先处理值设置再处理格式化设置:即会对值设置的结果进行格式化设置
|
|
96
|
+
if (column.valueSet !== undefined) {
|
|
97
|
+
const item = column.valueSet.filter((item) => {
|
|
98
|
+
return item.value === value + ''
|
|
99
|
+
})
|
|
100
|
+
if (item.length > 0) {
|
|
101
|
+
// 数据库的原始值要显示成label值,后续对这个label进行格式化(不是处理原始值)
|
|
102
|
+
value = item[0].label
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// 获得默认的格式设置
|
|
106
|
+
if (column.formatter === undefined) {
|
|
107
|
+
if (column.dataType === 'DATE') {
|
|
108
|
+
// 默认的“DATE”类型的格式设置
|
|
109
|
+
column.formatter = {
|
|
110
|
+
type: 'date',
|
|
111
|
+
options: {
|
|
112
|
+
format: 'yyyy-m-d',
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
} else if (column.dataType === 'TIME') {
|
|
116
|
+
// 默认的“TIME”类型的格式设置
|
|
117
|
+
column.formatter = {
|
|
118
|
+
type: 'time',
|
|
119
|
+
options: {
|
|
120
|
+
format: 'yyyy-m-d hh:mm:ss',
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const columnFormatter = column.formatter
|
|
126
|
+
if (
|
|
127
|
+
columnFormatter !== undefined &&
|
|
128
|
+
formatter[columnFormatter.type] !== undefined
|
|
129
|
+
) {
|
|
130
|
+
return formatter[columnFormatter.type](value, columnFormatter.options)
|
|
131
|
+
} else {
|
|
132
|
+
return value
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-input-number v-model="number1" @change="setValue()" />
|
|
4
|
+
<span>---</span>
|
|
5
|
+
<el-input-number v-model="number2" @change="setValue()" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { $on, $off, $once, $emit } from '../utils/gogocodeTransfer'
|
|
11
|
+
export default {
|
|
12
|
+
props: {
|
|
13
|
+
r: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: null,
|
|
16
|
+
},
|
|
17
|
+
n: {
|
|
18
|
+
type: Number,
|
|
19
|
+
default: null,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
number1: null,
|
|
25
|
+
number2: null,
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
setValue() {
|
|
30
|
+
$emit(this, 'setValue', [this.number1, this.number2], this.r, this.n)
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
emits: ['setValue'],
|
|
34
|
+
}
|
|
35
|
+
</script>
|