sh-view 2.7.8 → 2.8.0
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/other.js +8 -0
- package/package.json +4 -3
- package/packages/components/index.js +35 -35
- package/packages/components/{global-components/sh-alert → sh-alert}/index.vue +8 -15
- package/packages/components/{global-components/sh-badge → sh-badge}/index.vue +6 -5
- package/packages/components/{global-components/sh-calendar → sh-calendar}/index.vue +167 -36
- package/packages/components/{global-components/sh-date → sh-date}/index.vue +37 -9
- package/packages/components/{global-components/sh-drawer → sh-drawer}/index.vue +49 -27
- package/packages/components/{global-components/sh-form → sh-form}/js/useForm.js +2 -2
- package/packages/components/sh-header/index.vue +260 -0
- package/packages/components/sh-icon/css/font/icons.scss +135 -0
- package/packages/components/{global-components/sh-image → sh-image}/index.vue +2 -1
- package/packages/components/{global-components/sh-poptip → sh-poptip}/index.vue +1 -1
- package/packages/components/{global-components/sh-progress → sh-progress}/index.vue +2 -18
- package/packages/components/{global-components/sh-table → sh-table}/css/index.scss +18 -0
- package/packages/components/{global-components/sh-table → sh-table}/js/tableMethods.js +12 -20
- package/packages/components/{global-components/sh-table → sh-table}/js/useTable.js +4 -6
- package/packages/components/{global-components/sh-table → sh-table}/table.vue +217 -218
- package/packages/components/{global-components/sh-tabs → sh-tabs}/index.vue +97 -34
- package/packages/components/{global-components/sh-tree → sh-tree}/components/table-tree.vue +1 -2
- package/packages/components/{global-components/sh-tree → sh-tree}/css/index.scss +1 -0
- package/packages/components/{global-components/sh-tree → sh-tree}/index.vue +228 -217
- package/packages/components/{global-components/sh-tree → sh-tree}/mixin/treeProps.js +1 -1
- package/packages/index.js +39 -39
- package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-week-box.vue +126 -126
- package/packages/{components/other-components → other}/sh-menu/index.vue +3 -0
- package/packages/{components/other-components → other}/sh-menu/menu-item-content.vue +3 -3
- package/packages/other/sh-preview/components/sh-excel.vue +163 -0
- package/packages/{components/other-components → other}/sh-preview/index.vue +92 -89
- package/packages/vxeTable/css/index.scss +31 -8
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +70 -63
- package/packages/vxeTable/render/filters/vxe-filter-input.vue +26 -25
- package/packages/vxeTable/render/filters/vxe-filter-time.vue +26 -0
- package/packages/vxeTable/render/globalRenders.jsx +26 -7
- package/packages/vxeTable/render/mixin/filter-hooks.js +31 -13
- package/packages/components/global-components/sh-header/index.vue +0 -278
- package/packages/components/global-components/sh-icon/css/font/icons.scss +0 -135
- package/packages/components/other-components/sh-preview/components/sh-excel.vue +0 -929
- /package/packages/components/{global-components/sh-card → sh-card}/index.vue +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/index.vue +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/themes/dark.js +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/themes/dracula.js +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/themes/index.js +0 -0
- /package/packages/components/{global-components/sh-col → sh-col}/css/index.scss +0 -0
- /package/packages/components/{global-components/sh-col → sh-col}/index.vue +0 -0
- /package/packages/components/{global-components/sh-corner → sh-corner}/index.vue +0 -0
- /package/packages/components/{global-components/sh-count-to → sh-count-to}/index.vue +0 -0
- /package/packages/components/{global-components/sh-drawer → sh-drawer}/scrollbar.js +0 -0
- /package/packages/components/{global-components/sh-empty → sh-empty}/index.vue +0 -0
- /package/packages/components/{global-components/sh-form → sh-form}/form.vue +0 -0
- /package/packages/components/{global-components/sh-form → sh-form}/js/props.js +0 -0
- /package/packages/components/{global-components/sh-form → sh-form}/query.vue +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/icons.scss +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.svg +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.ttf +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.woff +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.woff2 +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.js +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.json +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.ttf +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.woff +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.woff2 +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/index.scss +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/index.vue +0 -0
- /package/packages/components/{global-components/sh-list → sh-list}/index.vue +0 -0
- /package/packages/components/{global-components/sh-loading → sh-loading}/index.vue +0 -0
- /package/packages/components/{global-components/sh-modal → sh-modal}/index.vue +0 -0
- /package/packages/components/{global-components/sh-noticebar → sh-noticebar}/index.vue +0 -0
- /package/packages/components/{global-components/sh-pull-refresh → sh-pull-refresh}/index.vue +0 -0
- /package/packages/components/{global-components/sh-result → sh-result}/index.vue +0 -0
- /package/packages/components/{global-components/sh-row → sh-row}/css/index.scss +0 -0
- /package/packages/components/{global-components/sh-row → sh-row}/index.vue +0 -0
- /package/packages/components/{global-components/sh-split → sh-split}/components/trigger.vue +0 -0
- /package/packages/components/{global-components/sh-split → sh-split}/index.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/components/importModal.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/components/sh-column.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/grid.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/js/excel_to_json.js +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/js/props.js +0 -0
- /package/packages/components/{global-components/sh-tag → sh-tag}/index.vue +0 -0
- /package/packages/components/{global-components/sh-toolbar → sh-toolbar}/index.vue +0 -0
- /package/packages/components/{global-components/sh-upload → sh-upload}/index.vue +0 -0
- /package/packages/components/{global-components/sh-upload → sh-upload}/js/ajax.js +0 -0
- /package/packages/components/{global-components/sh-water-fall → sh-water-fall}/index.vue +0 -0
- /package/packages/components/{global-components/sh-water-mark → sh-water-mark}/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/components/cron-content.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/css/index.scss +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/mixin/cron-emits.js +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/mixin/cron-hooks.js +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/mixin/cron-props.js +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-day-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-hour-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-minute-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-month-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-second-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-year-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/utils/index.js +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/langs/zh-Hans.js +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/content/default/content.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.inline.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.inline.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.mobile.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.mobile.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.mobile.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.mobile.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.shadowdom.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.shadowdom.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-menu/menu-group-content.vue +0 -0
- /package/packages/{components/other-components → other}/sh-menu-card/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-menu-card/menu-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-preview/components/sh-word.vue +0 -0
- /package/packages/{components/other-components → other}/sh-preview/js/data-hook.js +0 -0
- /package/packages/{components/other-components → other}/sh-preview/js/data-props.js +0 -0
- /package/packages/{components/other-components → other}/sh-system-tip/index.vue +0 -0
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-cron-config-list">
|
|
3
|
-
<vxe-radio-group v-model="type">
|
|
4
|
-
<div class="item">
|
|
5
|
-
<vxe-radio :label="TypeEnum.unset" v-bind="beforeRadioAttrs">不设置</vxe-radio>
|
|
6
|
-
<span class="tip-info">日和周只能设置其中之一</span>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="item">
|
|
9
|
-
<vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
|
|
10
|
-
<span> 从 </span>
|
|
11
|
-
<vxe-select v-model="valueRange.start" :options="weekOptions" v-bind="typeRangeSelectAttrs" />
|
|
12
|
-
<span> 至 </span>
|
|
13
|
-
<vxe-select v-model="valueRange.end" :options="weekOptions" v-bind="typeRangeSelectAttrs" />
|
|
14
|
-
</div>
|
|
15
|
-
<div class="item">
|
|
16
|
-
<vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
|
|
17
|
-
<span> 从 </span>
|
|
18
|
-
<vxe-select v-model="valueLoop.start" :options="weekOptions" v-bind="typeLoopSelectAttrs" />
|
|
19
|
-
<span> 至 </span>
|
|
20
|
-
<vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
|
|
21
|
-
</div>
|
|
22
|
-
<div class="item">
|
|
23
|
-
<vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
|
|
24
|
-
<div class="list">
|
|
25
|
-
<vxe-checkbox-group v-model="valueList">
|
|
26
|
-
<template v-for="i in specifyRange" :key="i">
|
|
27
|
-
<vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
|
|
28
|
-
</template>
|
|
29
|
-
</vxe-checkbox-group>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</vxe-radio-group>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script>
|
|
37
|
-
import { defineComponent, computed, getCurrentInstance, watch } from 'vue'
|
|
38
|
-
import cronProps from '../mixin/cron-props'
|
|
39
|
-
|
|
40
|
-
import
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
setup(props, context) {
|
|
70
|
-
const { proxy } = getCurrentInstance()
|
|
71
|
-
const { $vUtils } = proxy
|
|
72
|
-
const { emit, slots } = context
|
|
73
|
-
|
|
74
|
-
const useCron = cronHooks(props, context, proxy, {
|
|
75
|
-
defaultValue: '*',
|
|
76
|
-
minValue: 1,
|
|
77
|
-
maxValue: 7,
|
|
78
|
-
valueRange: { start: 1, end: 7 },
|
|
79
|
-
valueLoop: { start: 2, interval: 1 }
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
const disabledChoice = computed(() => {
|
|
83
|
-
return (props.day && props.day !== '?') || props.disabled
|
|
84
|
-
})
|
|
85
|
-
const weekOptions = computed(() => {
|
|
86
|
-
let options = []
|
|
87
|
-
for (let weekKey of Object.keys(WEEK_MAP_CN)) {
|
|
88
|
-
let weekName = WEEK_MAP_CN[weekKey]
|
|
89
|
-
options.push({
|
|
90
|
-
value: Number.parseInt(weekKey),
|
|
91
|
-
label: weekName
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
return options
|
|
95
|
-
})
|
|
96
|
-
const typeRangeSelectAttrs = computed(() => {
|
|
97
|
-
return {
|
|
98
|
-
class: ['cron-item-input'],
|
|
99
|
-
disabled: useCron.typeRangeAttrs.value.disabled
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
const typeLoopSelectAttrs = computed(() => {
|
|
103
|
-
return {
|
|
104
|
-
class: ['cron-item-input'],
|
|
105
|
-
disabled: useCron.typeLoopAttrs.value.disabled
|
|
106
|
-
}
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
watch(
|
|
110
|
-
() => props.day,
|
|
111
|
-
() => {
|
|
112
|
-
useCron.updateValue(disabledChoice.value ? '?' : useCron.computeValue.value)
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
...useCron,
|
|
118
|
-
weekOptions,
|
|
119
|
-
typeRangeSelectAttrs,
|
|
120
|
-
typeLoopSelectAttrs
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<style scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sh-cron-config-list">
|
|
3
|
+
<vxe-radio-group v-model="type">
|
|
4
|
+
<div class="item">
|
|
5
|
+
<vxe-radio :label="TypeEnum.unset" v-bind="beforeRadioAttrs">不设置</vxe-radio>
|
|
6
|
+
<span class="tip-info">日和周只能设置其中之一</span>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="item">
|
|
9
|
+
<vxe-radio :label="TypeEnum.range" v-bind="beforeRadioAttrs">区间</vxe-radio>
|
|
10
|
+
<span> 从 </span>
|
|
11
|
+
<vxe-select v-model="valueRange.start" :options="weekOptions" v-bind="typeRangeSelectAttrs" />
|
|
12
|
+
<span> 至 </span>
|
|
13
|
+
<vxe-select v-model="valueRange.end" :options="weekOptions" v-bind="typeRangeSelectAttrs" />
|
|
14
|
+
</div>
|
|
15
|
+
<div class="item">
|
|
16
|
+
<vxe-radio :label="TypeEnum.loop" v-bind="beforeRadioAttrs">循环</vxe-radio>
|
|
17
|
+
<span> 从 </span>
|
|
18
|
+
<vxe-select v-model="valueLoop.start" :options="weekOptions" v-bind="typeLoopSelectAttrs" />
|
|
19
|
+
<span> 至 </span>
|
|
20
|
+
<vxe-input v-model="valueLoop.interval" v-bind="typeLoopAttrs" />
|
|
21
|
+
</div>
|
|
22
|
+
<div class="item">
|
|
23
|
+
<vxe-radio :label="TypeEnum.specify" v-bind="beforeRadioAttrs">指定</vxe-radio>
|
|
24
|
+
<div class="list">
|
|
25
|
+
<vxe-checkbox-group v-model="valueList">
|
|
26
|
+
<template v-for="i in specifyRange" :key="i">
|
|
27
|
+
<vxe-checkbox :label="i" v-bind="typeSpecifyAttrs">{{ i }}</vxe-checkbox>
|
|
28
|
+
</template>
|
|
29
|
+
</vxe-checkbox-group>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</vxe-radio-group>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import { defineComponent, computed, getCurrentInstance, watch } from 'vue'
|
|
38
|
+
import cronProps from '../mixin/cron-props'
|
|
39
|
+
import cronHooks from '../mixin/cron-hooks'
|
|
40
|
+
import cronEmits from '../mixin/cron-emits'
|
|
41
|
+
const WEEK_MAP_EN = {
|
|
42
|
+
1: 'SUN',
|
|
43
|
+
2: 'MON',
|
|
44
|
+
3: 'TUE',
|
|
45
|
+
4: 'WED',
|
|
46
|
+
5: 'THU',
|
|
47
|
+
6: 'FRI',
|
|
48
|
+
7: 'SAT'
|
|
49
|
+
}
|
|
50
|
+
const WEEK_MAP_CN = {
|
|
51
|
+
1: '周日',
|
|
52
|
+
2: '周一',
|
|
53
|
+
3: '周二',
|
|
54
|
+
4: '周三',
|
|
55
|
+
5: '周四',
|
|
56
|
+
6: '周五',
|
|
57
|
+
7: '周六'
|
|
58
|
+
}
|
|
59
|
+
export default defineComponent({
|
|
60
|
+
name: 'CronWeekBox',
|
|
61
|
+
props: {
|
|
62
|
+
...cronProps,
|
|
63
|
+
day: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '*'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
emits: cronEmits,
|
|
69
|
+
setup(props, context) {
|
|
70
|
+
const { proxy } = getCurrentInstance()
|
|
71
|
+
const { $vUtils } = proxy
|
|
72
|
+
const { emit, slots } = context
|
|
73
|
+
|
|
74
|
+
const useCron = cronHooks(props, context, proxy, {
|
|
75
|
+
defaultValue: '*',
|
|
76
|
+
minValue: 1,
|
|
77
|
+
maxValue: 7,
|
|
78
|
+
valueRange: { start: 1, end: 7 },
|
|
79
|
+
valueLoop: { start: 2, interval: 1 }
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const disabledChoice = computed(() => {
|
|
83
|
+
return (props.day && props.day !== '?') || props.disabled
|
|
84
|
+
})
|
|
85
|
+
const weekOptions = computed(() => {
|
|
86
|
+
let options = []
|
|
87
|
+
for (let weekKey of Object.keys(WEEK_MAP_CN)) {
|
|
88
|
+
let weekName = WEEK_MAP_CN[weekKey]
|
|
89
|
+
options.push({
|
|
90
|
+
value: Number.parseInt(weekKey),
|
|
91
|
+
label: weekName
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
return options
|
|
95
|
+
})
|
|
96
|
+
const typeRangeSelectAttrs = computed(() => {
|
|
97
|
+
return {
|
|
98
|
+
class: ['cron-item-input'],
|
|
99
|
+
disabled: useCron.typeRangeAttrs.value.disabled
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
const typeLoopSelectAttrs = computed(() => {
|
|
103
|
+
return {
|
|
104
|
+
class: ['cron-item-input'],
|
|
105
|
+
disabled: useCron.typeLoopAttrs.value.disabled
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
watch(
|
|
110
|
+
() => props.day,
|
|
111
|
+
() => {
|
|
112
|
+
useCron.updateValue(disabledChoice.value ? '?' : useCron.computeValue.value)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
...useCron,
|
|
118
|
+
weekOptions,
|
|
119
|
+
typeRangeSelectAttrs,
|
|
120
|
+
typeLoopSelectAttrs
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<style scoped></style>
|
|
@@ -31,9 +31,9 @@ export default defineComponent({
|
|
|
31
31
|
const itemRef = ref()
|
|
32
32
|
|
|
33
33
|
const defaultIcon = computed(() => {
|
|
34
|
-
if (!props.menuLevel || props.menuLevel < 1) return 'md-folder'
|
|
35
|
-
else if (props.menuLevel === 1) return 'md-bookmark'
|
|
36
|
-
|
|
34
|
+
if (MenuInstance.props.defaultIcon && (!props.menuLevel || props.menuLevel < 1)) return 'md-folder'
|
|
35
|
+
else if (MenuInstance.props.defaultIcon && props.menuLevel === 1) return 'md-bookmark'
|
|
36
|
+
return ''
|
|
37
37
|
})
|
|
38
38
|
const iconType = computed(() => {
|
|
39
39
|
return props.menuItem.meta?.icon || props.menuItem.icon || defaultIcon.value
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { defineComponent, computed, getCurrentInstance, ref } from 'vue'
|
|
3
|
+
import dataHook from '../js/data-hook'
|
|
4
|
+
import dataProps from '../js/data-props'
|
|
5
|
+
import ExcelJS from 'exceljs'
|
|
6
|
+
import ExcelTable from '@wolf-table/table'
|
|
7
|
+
import '@wolf-table/table/dist/table.min.css'
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
name: 'ShExcel',
|
|
10
|
+
props: dataProps,
|
|
11
|
+
emits: ['rendered', 'error'],
|
|
12
|
+
setup(props, context) {
|
|
13
|
+
const { proxy } = getCurrentInstance()
|
|
14
|
+
const { $vUtils } = proxy
|
|
15
|
+
|
|
16
|
+
const wordBooks = ref([])
|
|
17
|
+
|
|
18
|
+
let defaultOption = {
|
|
19
|
+
scrollable: true,
|
|
20
|
+
resizable: true,
|
|
21
|
+
selectable: true,
|
|
22
|
+
editable: false,
|
|
23
|
+
copyable: true
|
|
24
|
+
}
|
|
25
|
+
const excelOptions = computed(() => {
|
|
26
|
+
return Object.assign({}, defaultOption, props.options)
|
|
27
|
+
})
|
|
28
|
+
const tabConfig = computed(() => {
|
|
29
|
+
return {
|
|
30
|
+
modelValue: wordBooks.value.length ? wordBooks.value[0].name : '',
|
|
31
|
+
options: wordBooks.value,
|
|
32
|
+
labelKey: 'name',
|
|
33
|
+
labelField: 'name',
|
|
34
|
+
placement: 'bottom',
|
|
35
|
+
type: 'card',
|
|
36
|
+
animated: false
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const getWorkBookByBuffer = async buffer => {
|
|
41
|
+
const wb = new ExcelJS.Workbook()
|
|
42
|
+
let workbook = await wb.xlsx.load(buffer)
|
|
43
|
+
let workbookData = []
|
|
44
|
+
workbook.eachSheet(sheet => {
|
|
45
|
+
// 构造数据源结构
|
|
46
|
+
let sheetData = { name: sheet.name, styles: [], cells: [], merges: [] }
|
|
47
|
+
for (let mergeRange in sheet._merges) {
|
|
48
|
+
sheetData.merges.push(sheet._merges[mergeRange].shortRange)
|
|
49
|
+
}
|
|
50
|
+
// 遍历行
|
|
51
|
+
sheet.eachRow((row, rowNumber) => {
|
|
52
|
+
let cellResult = {}
|
|
53
|
+
// includeEmpty = false 不包含空白单元格
|
|
54
|
+
row.eachCell({ includeEmpty: true }, function (cell, colNumber) {
|
|
55
|
+
let cellText = ''
|
|
56
|
+
if (cell.value && cell.value.result) {
|
|
57
|
+
// Excel 单元格有公式
|
|
58
|
+
cellText = cell.value.result
|
|
59
|
+
} else if (cell.value && cell.value.richText) {
|
|
60
|
+
// Excel 单元格是多行文本
|
|
61
|
+
for (let text in cell.value.richText) {
|
|
62
|
+
// 多行文本做累加
|
|
63
|
+
cellText += cell.value.richText[text].text
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
// Excel 单元格无公式
|
|
67
|
+
cellText = cell.value
|
|
68
|
+
}
|
|
69
|
+
// 解析单元格,包含样式
|
|
70
|
+
// 单元格存在背景色
|
|
71
|
+
if (cell.style?.fill?.fgColor?.argb) {
|
|
72
|
+
let cellBgcolor = cell.style.fill.fgColor.argb.trim().toLowerCase() //去掉前后空格
|
|
73
|
+
let argb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(cellBgcolor)
|
|
74
|
+
let rgb = `rgba(${parseInt(argb[2], 16)}, ${parseInt(argb[3], 16)}, ${parseInt(argb[4], 16)})`
|
|
75
|
+
let percent = (parseInt(argb[1], 16) / 255) * 100
|
|
76
|
+
cell.style.bgcolor = $vUtils.fade(rgb, percent)
|
|
77
|
+
}
|
|
78
|
+
// 字体颜色
|
|
79
|
+
if (cell.style?.font?.color?.argb) {
|
|
80
|
+
let cellcolor = cell.style.font.color.argb.trim().toLowerCase() //去掉前后空格
|
|
81
|
+
let argb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(cellcolor)
|
|
82
|
+
let rgb = `rgba(${parseInt(argb[2], 16)}, ${parseInt(argb[3], 16)}, ${parseInt(argb[4], 16)})`
|
|
83
|
+
let percent = (parseInt(argb[1], 16) / 255) * 100
|
|
84
|
+
cell.style.color = $vUtils.fade(rgb, percent)
|
|
85
|
+
}
|
|
86
|
+
// exceljs 对齐的格式转成能识别的对齐格式
|
|
87
|
+
if (cell.style?.alignment?.horizontal) {
|
|
88
|
+
cell.style.align = cell.style.alignment.horizontal
|
|
89
|
+
cell.style.valign = cell.style.alignment.vertical
|
|
90
|
+
}
|
|
91
|
+
// 单元格
|
|
92
|
+
cellResult = { value: cellText, style: sheetData.styles.length }
|
|
93
|
+
// 解析单元格,包含样式
|
|
94
|
+
sheetData.styles.push(cell.style)
|
|
95
|
+
sheetData.cells.push([rowNumber - 1, colNumber - 1, cellResult])
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
workbookData.push(sheetData)
|
|
99
|
+
})
|
|
100
|
+
return workbookData
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const domRender = async (data, container) => {
|
|
104
|
+
if (!data || typeof data === 'string') {
|
|
105
|
+
container.innerHTML = data
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
const { width, height } = container.getBoundingClientRect()
|
|
109
|
+
const buffer = await data.arrayBuffer()
|
|
110
|
+
const workData = await getWorkBookByBuffer(buffer)
|
|
111
|
+
wordBooks.value = workData
|
|
112
|
+
let tables = []
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
workData.forEach((sheet, sheetIndex) => {
|
|
115
|
+
let refName = `sheet${sheet.name}Ref`
|
|
116
|
+
sheet.workTable = ExcelTable.create(
|
|
117
|
+
proxy.$refs[refName][0],
|
|
118
|
+
() => width,
|
|
119
|
+
() => (height ? height - 32 : 300),
|
|
120
|
+
excelOptions.value
|
|
121
|
+
)
|
|
122
|
+
sheet.workTable.data(sheet).render()
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
return tables
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const useData = dataHook(props, context, proxy, {
|
|
129
|
+
domRender
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
...useData,
|
|
134
|
+
tabConfig
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<template>
|
|
141
|
+
<div ref="rootRef" class="sh-office-excel">
|
|
142
|
+
<sh-tabs v-bind="tabConfig">
|
|
143
|
+
<template #tabContent="tabs">
|
|
144
|
+
<template v-for="(tab, tabIndex) in tabs" :key="tabIndex">
|
|
145
|
+
<div style="position: relative; width: 100%">
|
|
146
|
+
<div :ref="`sheet${tab.name}Ref`"></div>
|
|
147
|
+
</div>
|
|
148
|
+
</template>
|
|
149
|
+
</template>
|
|
150
|
+
</sh-tabs>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<style lang="scss">
|
|
155
|
+
.sh-office-excel {
|
|
156
|
+
position: relative;
|
|
157
|
+
.wolf-table-scrollbar {
|
|
158
|
+
&.vertical {
|
|
159
|
+
opacity: 1 !important;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
@@ -1,89 +1,92 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-preview">
|
|
3
|
-
<component :is="componentName" v-bind="componentProps" :style="componentStyles" @rendered="onRendered" @error="onError" />
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
import { defineComponent, computed, defineAsyncComponent } from 'vue'
|
|
9
|
-
export default defineComponent({
|
|
10
|
-
name: 'ShPreview',
|
|
11
|
-
props: {
|
|
12
|
-
type: {
|
|
13
|
-
type: String
|
|
14
|
-
},
|
|
15
|
-
base: {
|
|
16
|
-
type: String
|
|
17
|
-
},
|
|
18
|
-
url: {
|
|
19
|
-
type: String
|
|
20
|
-
},
|
|
21
|
-
width: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: '100%'
|
|
24
|
-
},
|
|
25
|
-
height: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: '600px'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
emits: ['ready', 'error'],
|
|
31
|
-
setup(props, context) {
|
|
32
|
-
const { emit, slots } = context
|
|
33
|
-
const previewType = computed(() => {
|
|
34
|
-
if (props.type) {
|
|
35
|
-
return props.type.toLowerCase()
|
|
36
|
-
} else if (props.url) {
|
|
37
|
-
return props.url.substr(props.url.lastIndexOf('.') + 1).toLowerCase()
|
|
38
|
-
}
|
|
39
|
-
return ''
|
|
40
|
-
})
|
|
41
|
-
const componentName = computed(() => {
|
|
42
|
-
if (!props.url || !previewType.value) {
|
|
43
|
-
return 'div'
|
|
44
|
-
} else if (['word', 'doc', 'docx'].includes(previewType.value)) {
|
|
45
|
-
return defineAsyncComponent(() => import('./components/sh-word.vue'))
|
|
46
|
-
} else if (['excel', 'xlsx'].includes(previewType.value)) {
|
|
47
|
-
return defineAsyncComponent(() => import('./components/sh-excel.vue'))
|
|
48
|
-
}
|
|
49
|
-
return 'iframe'
|
|
50
|
-
})
|
|
51
|
-
const componentProps = computed(() => {
|
|
52
|
-
let srcPrefix = props.base || ''
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
emit('
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sh-preview">
|
|
3
|
+
<component :is="componentName" v-bind="componentProps" :style="componentStyles" @rendered="onRendered" @error="onError" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { defineComponent, computed, defineAsyncComponent } from 'vue'
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'ShPreview',
|
|
11
|
+
props: {
|
|
12
|
+
type: {
|
|
13
|
+
type: String
|
|
14
|
+
},
|
|
15
|
+
base: {
|
|
16
|
+
type: String
|
|
17
|
+
},
|
|
18
|
+
url: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
width: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: '100%'
|
|
24
|
+
},
|
|
25
|
+
height: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: '600px'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
emits: ['ready', 'error'],
|
|
31
|
+
setup(props, context) {
|
|
32
|
+
const { emit, slots } = context
|
|
33
|
+
const previewType = computed(() => {
|
|
34
|
+
if (props.type) {
|
|
35
|
+
return props.type.toLowerCase()
|
|
36
|
+
} else if (props.url) {
|
|
37
|
+
return props.url.substr(props.url.lastIndexOf('.') + 1).toLowerCase()
|
|
38
|
+
}
|
|
39
|
+
return ''
|
|
40
|
+
})
|
|
41
|
+
const componentName = computed(() => {
|
|
42
|
+
if (!props.url || !previewType.value) {
|
|
43
|
+
return 'div'
|
|
44
|
+
} else if (['word', 'doc', 'docx'].includes(previewType.value)) {
|
|
45
|
+
return defineAsyncComponent(() => import('./components/sh-word.vue'))
|
|
46
|
+
} else if (['excel', 'xlsx'].includes(previewType.value)) {
|
|
47
|
+
return defineAsyncComponent(() => import('./components/sh-excel.vue'))
|
|
48
|
+
}
|
|
49
|
+
return 'iframe'
|
|
50
|
+
})
|
|
51
|
+
const componentProps = computed(() => {
|
|
52
|
+
let srcPrefix = props.base || ''
|
|
53
|
+
let srcProps = {
|
|
54
|
+
src: srcPrefix + props.url,
|
|
55
|
+
frameborder: 0
|
|
56
|
+
}
|
|
57
|
+
if (componentName.value === 'iframe') {
|
|
58
|
+
srcProps.src += '#scrollbars=0&toolbar=0&statusbar=0'
|
|
59
|
+
}
|
|
60
|
+
return srcProps
|
|
61
|
+
})
|
|
62
|
+
const componentStyles = computed(() => {
|
|
63
|
+
return {
|
|
64
|
+
width: props.width,
|
|
65
|
+
height: props.height
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const onRendered = data => {
|
|
70
|
+
emit('ready', data)
|
|
71
|
+
}
|
|
72
|
+
const onError = data => {
|
|
73
|
+
emit('error', data)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
componentName,
|
|
78
|
+
componentProps,
|
|
79
|
+
componentStyles,
|
|
80
|
+
onRendered,
|
|
81
|
+
onError
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<style lang="scss" scoped>
|
|
88
|
+
.sh-preview {
|
|
89
|
+
position: relative;
|
|
90
|
+
overflow: auto;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
@@ -192,13 +192,37 @@ button:focus, .vxe-button.type--button:not(.is--disabled):focus{
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// 渲染器
|
|
195
|
-
.vxe-filter
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
.vxe-filter{
|
|
196
|
+
&--wrap{
|
|
197
|
+
padding: 8px;
|
|
198
|
+
box-sizing: border-box;
|
|
199
199
|
}
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
&--input{
|
|
201
|
+
}
|
|
202
|
+
&--list {
|
|
203
|
+
margin: 0;
|
|
204
|
+
padding: 0;
|
|
205
|
+
list-style: none;
|
|
206
|
+
&-head{
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
&-body{
|
|
210
|
+
overflow: auto;
|
|
211
|
+
height: 120px;
|
|
212
|
+
}
|
|
213
|
+
&-item{
|
|
214
|
+
padding: 2px 0;
|
|
215
|
+
display: block;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
&--top{
|
|
219
|
+
position: relative;
|
|
220
|
+
margin-bottom: 5px;
|
|
221
|
+
}
|
|
222
|
+
&--body{
|
|
223
|
+
}
|
|
224
|
+
&--footer{
|
|
225
|
+
margin-top: 5px;
|
|
202
226
|
padding: 5px 0 2px;
|
|
203
227
|
.vxe-button{
|
|
204
228
|
margin-left: 0;
|
|
@@ -231,7 +255,7 @@ button:focus, .vxe-button.type--button:not(.is--disabled):focus{
|
|
|
231
255
|
}
|
|
232
256
|
&.form-render {
|
|
233
257
|
display: inline-flex;
|
|
234
|
-
align-items:
|
|
258
|
+
align-items: stretch;
|
|
235
259
|
width: 100%;
|
|
236
260
|
vertical-align: middle;
|
|
237
261
|
.prefix, .suffix{
|
|
@@ -259,7 +283,6 @@ button:focus, .vxe-button.type--button:not(.is--disabled):focus{
|
|
|
259
283
|
min-width: 30px;
|
|
260
284
|
cursor: pointer;
|
|
261
285
|
user-select: none;
|
|
262
|
-
font-size: 20px;
|
|
263
286
|
border: 1px solid var(--vxe-input-border-color);
|
|
264
287
|
border-radius: var(--vxe-border-radius);
|
|
265
288
|
&.before{
|