sh-view 2.6.2 → 2.6.4
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/package.json +1 -1
- package/packages/components/global-components/sh-form/form.vue +110 -108
- package/packages/components/global-components/sh-form/js/useForm.js +3 -0
- package/packages/components/global-components/sh-form/query.vue +70 -68
- package/packages/components/global-components/sh-table/components/sh-column.vue +69 -69
- package/packages/components/global-components/sh-table/grid.vue +160 -159
- package/packages/components/global-components/sh-table/js/useTable.js +12 -6
- package/packages/components/global-components/sh-table/table.vue +218 -217
- package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -177
- package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -99
- package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -66
- package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -66
- package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -66
- package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -66
- package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -125
- package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -57
- package/packages/components/other-components/sh-preview/components/sh-excel.vue +929 -927
- package/packages/components/other-components/sh-preview/components/sh-word.vue +78 -76
- package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +28 -26
- package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -42
- package/packages/vxeTable/render/cell/vxe-render-code.vue +36 -34
- package/packages/vxeTable/render/cell/vxe-render-goption.vue +104 -103
- package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -19
- package/packages/vxeTable/render/cell/vxe-render-input.vue +53 -52
- package/packages/vxeTable/render/cell/vxe-render-money.vue +33 -31
- package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -26
- package/packages/vxeTable/render/cell/vxe-render-radio.vue +28 -26
- package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -42
- package/packages/vxeTable/render/cell/vxe-render-select.vue +52 -51
- package/packages/vxeTable/render/cell/vxe-render-switch.vue +28 -26
- package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -50
- package/packages/vxeTable/render/cell/vxe-render-textarea.vue +28 -26
- package/packages/vxeTable/render/cell/vxe-render-time.vue +44 -41
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +63 -60
- package/packages/vxeTable/render/cell/vxe-render-upload.vue +28 -26
- package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -23
- package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -21
- package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -28
- package/packages/vxeTable/render/header/vxe-header-money.vue +31 -29
- package/packages/vxeTable/render/mixin/cell-hooks.js +4 -1
package/package.json
CHANGED
|
@@ -1,108 +1,110 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sh-vxe-form" :class="{ readonly: readonly, disabled: disabled }">
|
|
3
|
-
<vxe-form
|
|
4
|
-
ref="formRef"
|
|
5
|
-
:key="renderKey"
|
|
6
|
-
v-bind="formBindConfig"
|
|
7
|
-
@submit="onFormSubmit"
|
|
8
|
-
@submit-invalid="onFormSubmitInvalid"
|
|
9
|
-
@reset="onFormReset"
|
|
10
|
-
@collapse="onFormCollapse"
|
|
11
|
-
@edit-closed="onFormEditClosed"
|
|
12
|
-
@prefix-click="onPrefixClick"
|
|
13
|
-
@suffix-click="onSuffixClick">
|
|
14
|
-
<div v-if="footer" class="sh-common-footer">
|
|
15
|
-
<div class="sh-common-footer-left">
|
|
16
|
-
<slot name="formLeft"></slot>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="sh-common-footer-right">
|
|
19
|
-
<slot name="formRight"></slot>
|
|
20
|
-
<vxe-button v-ripple type="submit" status="primary" :size="size" :disabled="disabled || loading">
|
|
21
|
-
{{ globalConfig?.submitBtnText || '确认' }}
|
|
22
|
-
</vxe-button>
|
|
23
|
-
<vxe-button v-ripple type="reset" :size="size">{{ globalConfig?.resetBtnText || '重置' }}</vxe-button>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
<template v-for="slot in Object.keys(slots)" #[slot]="scope">
|
|
27
|
-
<!-- 以之前的名字命名插槽,同时把数据原样绑定 -->
|
|
28
|
-
<slot :name="slot" v-bind="scope"></slot>
|
|
29
|
-
</template>
|
|
30
|
-
</vxe-form>
|
|
31
|
-
</div>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script>
|
|
35
|
-
import { defineComponent, getCurrentInstance } from 'vue'
|
|
36
|
-
import props from './js/props'
|
|
37
|
-
import useForm from './js/useForm'
|
|
38
|
-
export default defineComponent({
|
|
39
|
-
name: 'ShForm',
|
|
40
|
-
props: props,
|
|
41
|
-
emits: ['submit', 'reset', 'edit-closed', 'submit-invalid', 'collapse', 'prefix-click', 'suffix-click'],
|
|
42
|
-
setup(props, context) {
|
|
43
|
-
const { proxy } = getCurrentInstance()
|
|
44
|
-
const useFormHooks = useForm(props, context, proxy, true)
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.vxe-input.is--disabled .vxe-input--
|
|
80
|
-
.vxe-input.is--disabled .vxe-input--
|
|
81
|
-
.vxe-input.is--disabled .vxe-input--suffix
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sh-vxe-form" :class="{ readonly: readonly, disabled: disabled }">
|
|
3
|
+
<vxe-form
|
|
4
|
+
ref="formRef"
|
|
5
|
+
:key="renderKey"
|
|
6
|
+
v-bind="formBindConfig"
|
|
7
|
+
@submit="onFormSubmit"
|
|
8
|
+
@submit-invalid="onFormSubmitInvalid"
|
|
9
|
+
@reset="onFormReset"
|
|
10
|
+
@collapse="onFormCollapse"
|
|
11
|
+
@edit-closed="onFormEditClosed"
|
|
12
|
+
@prefix-click="onPrefixClick"
|
|
13
|
+
@suffix-click="onSuffixClick">
|
|
14
|
+
<div v-if="footer" class="sh-common-footer">
|
|
15
|
+
<div class="sh-common-footer-left">
|
|
16
|
+
<slot name="formLeft"></slot>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="sh-common-footer-right">
|
|
19
|
+
<slot name="formRight"></slot>
|
|
20
|
+
<vxe-button v-ripple type="submit" status="primary" :size="size" :disabled="disabled || loading">
|
|
21
|
+
{{ globalConfig?.submitBtnText || '确认' }}
|
|
22
|
+
</vxe-button>
|
|
23
|
+
<vxe-button v-ripple type="reset" :size="size">{{ globalConfig?.resetBtnText || '重置' }}</vxe-button>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<template v-for="slot in Object.keys(slots)" #[slot]="scope">
|
|
27
|
+
<!-- 以之前的名字命名插槽,同时把数据原样绑定 -->
|
|
28
|
+
<slot :name="slot" v-bind="scope"></slot>
|
|
29
|
+
</template>
|
|
30
|
+
</vxe-form>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import { defineComponent, getCurrentInstance } from 'vue'
|
|
36
|
+
import props from './js/props'
|
|
37
|
+
import useForm from './js/useForm'
|
|
38
|
+
export default defineComponent({
|
|
39
|
+
name: 'ShForm',
|
|
40
|
+
props: props,
|
|
41
|
+
emits: ['submit', 'reset', 'edit-closed', 'submit-invalid', 'collapse', 'prefix-click', 'suffix-click'],
|
|
42
|
+
setup(props, context) {
|
|
43
|
+
const { proxy } = getCurrentInstance()
|
|
44
|
+
const useFormHooks = useForm(props, context, proxy, true)
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
...useFormHooks
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss">
|
|
54
|
+
.sh-vxe-form {
|
|
55
|
+
position: relative;
|
|
56
|
+
&.readonly {
|
|
57
|
+
.vxe-form {
|
|
58
|
+
.vxe-input--inner[disabled],
|
|
59
|
+
.vxe-textarea--inner[disabled] {
|
|
60
|
+
cursor: auto;
|
|
61
|
+
color: #333;
|
|
62
|
+
background-color: var(--vxe-table-body-background-color);
|
|
63
|
+
border-color: var(--vxe-primary-lighten-color);
|
|
64
|
+
}
|
|
65
|
+
.vxe-checkbox.is--disabled {
|
|
66
|
+
cursor: auto;
|
|
67
|
+
color: #333;
|
|
68
|
+
& > input + .vxe-checkbox--icon {
|
|
69
|
+
background-color: var(--vxe-table-body-background-color);
|
|
70
|
+
border-color: var(--vxe-primary-lighten-color);
|
|
71
|
+
}
|
|
72
|
+
& > input + .vxe-checkbox--icon:before {
|
|
73
|
+
border-color: var(--vxe-primary-color);
|
|
74
|
+
}
|
|
75
|
+
& > input + .vxe-checkbox--icon + .vxe-checkbox--label {
|
|
76
|
+
color: #333;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
.vxe-input.is--disabled .vxe-input--date-picker-suffix,
|
|
80
|
+
.vxe-input.is--disabled .vxe-input--number-suffix,
|
|
81
|
+
.vxe-input.is--disabled .vxe-input--password-suffix,
|
|
82
|
+
.vxe-input.is--disabled .vxe-input--search-suffix,
|
|
83
|
+
.vxe-input.is--disabled .vxe-input--suffix {
|
|
84
|
+
cursor: auto;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
.vxe-form {
|
|
89
|
+
.vxe-form--gather.shFormTitleItem {
|
|
90
|
+
border: 1px solid var(--vxe-table-border-color);
|
|
91
|
+
}
|
|
92
|
+
.vxe-form--item {
|
|
93
|
+
&.shFormTitleItem {
|
|
94
|
+
padding: 0.2em 0.8em;
|
|
95
|
+
border-left: 5px solid var(--vxe-primary-color);
|
|
96
|
+
margin-bottom: 0.5em;
|
|
97
|
+
.vxe-form--item-inner {
|
|
98
|
+
min-height: auto;
|
|
99
|
+
.vxe-form--item-title {
|
|
100
|
+
max-width: 100%;
|
|
101
|
+
.vxe-form--item-title-postfix {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
@@ -120,6 +120,9 @@ export default function (props, context, proxy, isForm) {
|
|
|
120
120
|
if (!isForm && formItemsArr.length > props.globalConfig.formToggleNum && props.globalConfig.formToggle) {
|
|
121
121
|
formToggleBtnShow.value = true // 显示展开全部按钮
|
|
122
122
|
formBtnCollapsed(false)
|
|
123
|
+
} else if (!formItems.value.length) {
|
|
124
|
+
// tag: vxe-form在 item监听时数据length为0时没有刷新视图补充
|
|
125
|
+
refreshRender()
|
|
123
126
|
}
|
|
124
127
|
initFormData()
|
|
125
128
|
}
|
|
@@ -1,68 +1,70 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<vxe-form
|
|
3
|
-
ref="formRef"
|
|
4
|
-
:key="renderKey"
|
|
5
|
-
class="sh-query"
|
|
6
|
-
:class="formCollapsed ? 'sh-query-collapsed-open' : 'sh-query-collapsed-close'"
|
|
7
|
-
v-bind="formBindConfig"
|
|
8
|
-
@submit="onFormSubmit"
|
|
9
|
-
@submit-invalid="onFormSubmitInvalid"
|
|
10
|
-
@reset="onFormReset"
|
|
11
|
-
@collapse="onFormCollapse"
|
|
12
|
-
@edit-closed="onFormEditClosed"
|
|
13
|
-
@prefix-click="onPrefixClick"
|
|
14
|
-
@suffix-click="onSuffixClick">
|
|
15
|
-
<div v-if="footer" class="sh-query-buttons">
|
|
16
|
-
<div class="sh-query-buttons-left"><slot name="footLeft"></slot></div>
|
|
17
|
-
<div class="sh-query-buttons-right">
|
|
18
|
-
<slot name="footRight"></slot>
|
|
19
|
-
<vxe-button v-ripple type="submit" status="primary" :size="size" icon="vxe-icon-search">{{ globalConfig?.submitBtnText || '查询' }}</vxe-button>
|
|
20
|
-
<vxe-button v-ripple type="reset" :size="size" icon="vxe-icon-repeat">{{ globalConfig?.resetBtnText || '重置' }}</vxe-button>
|
|
21
|
-
<vxe-button v-if="formToggleBtnShow" v-ripple :size="size" :icon="formCollapsed ? 'vxe-icon-caret-up' : 'vxe-icon-caret-down'" @click="formBtnCollapsed(!formCollapsed, true)">
|
|
22
|
-
{{ formCollapsed ? '收起' : '展开全部' }}
|
|
23
|
-
</vxe-button>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</vxe-form>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
import { defineComponent, getCurrentInstance } from 'vue'
|
|
31
|
-
import props from './js/props'
|
|
32
|
-
import useForm from './js/useForm'
|
|
33
|
-
export default defineComponent({
|
|
34
|
-
name: 'ShQuery',
|
|
35
|
-
props: props,
|
|
36
|
-
emits: ['submit', 'reset', 'edit-closed', 'submit-invalid', 'collapse', 'prefix-click', 'suffix-click'],
|
|
37
|
-
setup(props, context) {
|
|
38
|
-
const { proxy } = getCurrentInstance()
|
|
39
|
-
const useFormHooks = useForm(props, context, proxy)
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
&.sh-query-collapsed-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<vxe-form
|
|
3
|
+
ref="formRef"
|
|
4
|
+
:key="renderKey"
|
|
5
|
+
class="sh-query"
|
|
6
|
+
:class="formCollapsed ? 'sh-query-collapsed-open' : 'sh-query-collapsed-close'"
|
|
7
|
+
v-bind="formBindConfig"
|
|
8
|
+
@submit="onFormSubmit"
|
|
9
|
+
@submit-invalid="onFormSubmitInvalid"
|
|
10
|
+
@reset="onFormReset"
|
|
11
|
+
@collapse="onFormCollapse"
|
|
12
|
+
@edit-closed="onFormEditClosed"
|
|
13
|
+
@prefix-click="onPrefixClick"
|
|
14
|
+
@suffix-click="onSuffixClick">
|
|
15
|
+
<div v-if="footer" class="sh-query-buttons">
|
|
16
|
+
<div class="sh-query-buttons-left"><slot name="footLeft"></slot></div>
|
|
17
|
+
<div class="sh-query-buttons-right">
|
|
18
|
+
<slot name="footRight"></slot>
|
|
19
|
+
<vxe-button v-ripple type="submit" status="primary" :size="size" icon="vxe-icon-search">{{ globalConfig?.submitBtnText || '查询' }}</vxe-button>
|
|
20
|
+
<vxe-button v-ripple type="reset" :size="size" icon="vxe-icon-repeat">{{ globalConfig?.resetBtnText || '重置' }}</vxe-button>
|
|
21
|
+
<vxe-button v-if="formToggleBtnShow" v-ripple :size="size" :icon="formCollapsed ? 'vxe-icon-caret-up' : 'vxe-icon-caret-down'" @click="formBtnCollapsed(!formCollapsed, true)">
|
|
22
|
+
{{ formCollapsed ? '收起' : '展开全部' }}
|
|
23
|
+
</vxe-button>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</vxe-form>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import { defineComponent, getCurrentInstance } from 'vue'
|
|
31
|
+
import props from './js/props'
|
|
32
|
+
import useForm from './js/useForm'
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
name: 'ShQuery',
|
|
35
|
+
props: props,
|
|
36
|
+
emits: ['submit', 'reset', 'edit-closed', 'submit-invalid', 'collapse', 'prefix-click', 'suffix-click'],
|
|
37
|
+
setup(props, context) {
|
|
38
|
+
const { proxy } = getCurrentInstance()
|
|
39
|
+
const useFormHooks = useForm(props, context, proxy)
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
...useFormHooks
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<style lang="scss" scoped>
|
|
49
|
+
.sh-query {
|
|
50
|
+
width: 100%;
|
|
51
|
+
background: var(--primary-weak-color);
|
|
52
|
+
&.sh-query-collapsed-close {
|
|
53
|
+
}
|
|
54
|
+
&.sh-query-collapsed-open {
|
|
55
|
+
}
|
|
56
|
+
.sh-query-buttons {
|
|
57
|
+
border-top: 1px solid var(--vxe-table-border-color);
|
|
58
|
+
padding: 5px;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
.sh-query-buttons-left {
|
|
64
|
+
flex: 1;
|
|
65
|
+
}
|
|
66
|
+
.sh-query-buttons-right {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { computed, defineComponent, getCurrentInstance, h, inject, ref, resolveComponent, renderSlot } from 'vue'
|
|
3
|
-
import { turnColumnItemFilters } from '../js/tableMethods'
|
|
4
|
-
export default defineComponent({
|
|
5
|
-
name: 'ShColumn',
|
|
6
|
-
props: {
|
|
7
|
-
column: {
|
|
8
|
-
type: Object
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
setup(props, context) {
|
|
12
|
-
const { proxy } = getCurrentInstance()
|
|
13
|
-
const { $vUtils } = proxy
|
|
14
|
-
const shTable = inject('ShTableInstance')
|
|
15
|
-
|
|
16
|
-
const isGroup = computed(() => {
|
|
17
|
-
return proxy.hasChildren(props.column)
|
|
18
|
-
})
|
|
19
|
-
const columnConfig = computed(() => {
|
|
20
|
-
let renderObj = { name: props.column.renderName, props: props.column.renderProps }
|
|
21
|
-
let config = Object.assign({}, shTable.columnObjConfig, props.column)
|
|
22
|
-
if (props.column.readonly) {
|
|
23
|
-
config.cellRender = config.cellRender || renderObj
|
|
24
|
-
} else {
|
|
25
|
-
config.editRender = config.editRender || renderObj
|
|
26
|
-
}
|
|
27
|
-
if (config.renderName === '$vMoney' && props.column.renderProps.bill) {
|
|
28
|
-
config.filter = false
|
|
29
|
-
config.headerClassName += ' header-bill-cell'
|
|
30
|
-
}
|
|
31
|
-
if (config.filter === true || Number(config.filter) === 1) {
|
|
32
|
-
shTable.turnColumnItemFilters(config, renderObj.props)
|
|
33
|
-
}
|
|
34
|
-
return $vUtils.omit(config, ['renderName', 'renderProps', 'renderRequire', 'requireProps'])
|
|
35
|
-
})
|
|
36
|
-
const groupConfig = computed(() => {
|
|
37
|
-
return $vUtils.omit(columnConfig.value, ['children', 'cellRender', 'editRender'])
|
|
38
|
-
})
|
|
39
|
-
const renderVN = () => {
|
|
40
|
-
let columnSlots = {}
|
|
41
|
-
if (props.column.slots) {
|
|
42
|
-
Object.keys(props.column.slots).map(key => {
|
|
43
|
-
columnSlots[key] = shTable.slots[props.column.slots[key]]
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
if (isGroup.value) {
|
|
47
|
-
let childrenList = props.column.children.map(child => {
|
|
48
|
-
return h(resolveComponent('sh-column'), { column: child })
|
|
49
|
-
})
|
|
50
|
-
columnSlots.default = () => childrenList
|
|
51
|
-
return h(resolveComponent('vxe-colgroup'), groupConfig.value, columnSlots)
|
|
52
|
-
}
|
|
53
|
-
return h(resolveComponent('vxe-column'), columnConfig.value, columnSlots)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
isGroup,
|
|
58
|
-
columnConfig,
|
|
59
|
-
groupConfig,
|
|
60
|
-
renderVN
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
render() {
|
|
64
|
-
return this.renderVN()
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<style scoped lang="scss"></style>
|
|
1
|
+
<script>
|
|
2
|
+
import { computed, defineComponent, getCurrentInstance, h, inject, ref, resolveComponent, renderSlot } from 'vue'
|
|
3
|
+
import { turnColumnItemFilters } from '../js/tableMethods'
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: 'ShColumn',
|
|
6
|
+
props: {
|
|
7
|
+
column: {
|
|
8
|
+
type: Object
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
setup(props, context) {
|
|
12
|
+
const { proxy } = getCurrentInstance()
|
|
13
|
+
const { $vUtils } = proxy
|
|
14
|
+
const shTable = inject('ShTableInstance')
|
|
15
|
+
|
|
16
|
+
const isGroup = computed(() => {
|
|
17
|
+
return proxy.hasChildren(props.column)
|
|
18
|
+
})
|
|
19
|
+
const columnConfig = computed(() => {
|
|
20
|
+
let renderObj = { name: props.column.renderName, props: props.column.renderProps }
|
|
21
|
+
let config = Object.assign({}, shTable.columnObjConfig, props.column)
|
|
22
|
+
if (props.column.readonly) {
|
|
23
|
+
config.cellRender = config.cellRender || renderObj
|
|
24
|
+
} else {
|
|
25
|
+
config.editRender = config.editRender || renderObj
|
|
26
|
+
}
|
|
27
|
+
if (config.renderName === '$vMoney' && props.column.renderProps.bill) {
|
|
28
|
+
config.filter = false
|
|
29
|
+
config.headerClassName += ' header-bill-cell'
|
|
30
|
+
}
|
|
31
|
+
if (config.filter === true || Number(config.filter) === 1) {
|
|
32
|
+
shTable.turnColumnItemFilters(config, renderObj.props)
|
|
33
|
+
}
|
|
34
|
+
return $vUtils.omit(config, ['renderName', 'renderProps', 'renderRequire', 'requireProps'])
|
|
35
|
+
})
|
|
36
|
+
const groupConfig = computed(() => {
|
|
37
|
+
return $vUtils.omit(columnConfig.value, ['children', 'cellRender', 'editRender'])
|
|
38
|
+
})
|
|
39
|
+
const renderVN = () => {
|
|
40
|
+
let columnSlots = {}
|
|
41
|
+
if (props.column.slots) {
|
|
42
|
+
Object.keys(props.column.slots).map(key => {
|
|
43
|
+
columnSlots[key] = shTable.slots[props.column.slots[key]]
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
if (isGroup.value) {
|
|
47
|
+
let childrenList = props.column.children.map(child => {
|
|
48
|
+
return h(resolveComponent('sh-column'), { column: child })
|
|
49
|
+
})
|
|
50
|
+
columnSlots.default = () => childrenList
|
|
51
|
+
return h(resolveComponent('vxe-colgroup'), { ...groupConfig.value }, columnSlots)
|
|
52
|
+
}
|
|
53
|
+
return h(resolveComponent('vxe-column'), { ...columnConfig.value }, columnSlots)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
isGroup,
|
|
58
|
+
columnConfig,
|
|
59
|
+
groupConfig,
|
|
60
|
+
renderVN
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
render() {
|
|
64
|
+
return this.renderVN()
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style scoped lang="scss"></style>
|