zyf-model-engine 0.0.1 → 0.0.2
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/build/getEnv.d.ts +13 -0
- package/build/plugins.d.ts +7 -0
- package/build/proxy.d.ts +11 -0
- package/index.html +2 -100
- package/manifest.webmanifest +1 -0
- package/package.json +3 -94
- package/registerSW.js +1 -0
- package/src/api/config/servicePort.d.ts +2 -0
- package/src/api/enums/httpEnum.d.ts +29 -0
- package/src/api/helper/axiosCancel.d.ts +21 -0
- package/src/api/helper/axiosFileCancel.d.ts +27 -0
- package/src/api/helper/checkStatus.d.ts +6 -0
- package/src/api/index.d.ts +26 -0
- package/src/api/interface/index.d.ts +18 -0
- package/src/components/CTree/interface/index.d.ts +6 -0
- package/src/components/Grid/interface/index.d.ts +5 -0
- package/src/components/ProTable/interface/index.d.ts +66 -0
- package/src/config/index.d.ts +5 -0
- package/src/config/nprogress.d.ts +3 -0
- package/src/config/piniaPersist.d.ts +10 -0
- package/src/config/serviceLoading.d.ts +5 -0
- package/src/enums/httpEnum.d.ts +19 -0
- package/src/hooks/interface/index.d.ts +30 -0
- package/src/hooks/useOnline.d.ts +6 -0
- package/src/hooks/useTable.d.ts +47 -0
- package/src/main.d.ts +1 -0
- package/src/stores/commonStore.d.ts +2 -0
- package/src/stores/index.d.ts +2 -0
- package/src/stores/interface/index.d.ts +1 -0
- package/src/utils/color.d.ts +28 -0
- package/src/utils/commonUtils.d.ts +63 -0
- package/src/utils/errorHandler.d.ts +5 -0
- package/src/utils/is.d.ts +82 -0
- package/src/utils/layoutUtils.d.ts +44 -0
- package/src/utils/localUtils.d.ts +24 -0
- package/src/utils/serviceDict.d.ts +7 -0
- package/style.css +1 -0
- package/sw.js +1 -0
- package/vite.config.d.ts +2 -0
- package/workbox-3e911b1d.js +1 -0
- package/zyf-model-engine.mjs +45118 -0
- package/zyf-model-engine.umd.js +81 -0
- package/.editorconfig +0 -15
- package/.env +0 -13
- package/.env.development +0 -20
- package/.env.production +0 -25
- package/.env.test +0 -25
- package/.eslintignore +0 -15
- package/.eslintrc-auto-import.json +0 -65
- package/.eslintrc.cjs +0 -66
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -5
- package/.prettierignore +0 -9
- package/.prettierrc.cjs +0 -41
- package/.stylelintignore +0 -4
- package/.stylelintrc.cjs +0 -40
- package/.vscode/extensions.json +0 -14
- package/.vscode/settings.json +0 -92
- package/CHANGELOG.md +0 -246
- package/LICENSE +0 -21
- package/README.md +0 -205
- package/auto-imports.d.ts +0 -132
- package/build/getEnv.ts +0 -46
- package/build/plugins.ts +0 -138
- package/build/proxy.ts +0 -28
- package/commitlint.config.cjs +0 -84
- package/components.d.ts +0 -28
- package/lint-staged.config.cjs +0 -8
- package/postcss.config.cjs +0 -5
- package/src/App.vue +0 -16
- package/src/api/config/servicePort.ts +0 -3
- package/src/api/enums/httpEnum.ts +0 -35
- package/src/api/helper/axiosCancel.ts +0 -50
- package/src/api/helper/axiosFileCancel.ts +0 -62
- package/src/api/helper/checkStatus.ts +0 -97
- package/src/api/index.ts +0 -142
- package/src/api/interface/index.ts +0 -27
- package/src/assets/global-icons/icon-demo.svg +0 -1
- package/src/assets/iconfont/iconfont.scss +0 -44
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/images/empty-img.png +0 -0
- package/src/assets/option-icons/add.svg +0 -1
- package/src/assets/option-icons/check.svg +0 -1
- package/src/assets/option-icons/config.svg +0 -1
- package/src/assets/option-icons/del.svg +0 -1
- package/src/assets/option-icons/detail.svg +0 -1
- package/src/assets/option-icons/edit.svg +0 -2
- package/src/assets/option-icons/export.svg +0 -1
- package/src/assets/option-icons/folder.svg +0 -1
- package/src/assets/option-icons/full-screen.svg +0 -1
- package/src/assets/option-icons/more.svg +0 -1
- package/src/assets/option-icons/return.svg +0 -1
- package/src/assets/option-icons/search.svg +0 -1
- package/src/components/CSvgIcon/index.scss +0 -23
- package/src/components/CSvgIcon/index.vue +0 -74
- package/src/components/CTree/index.scss +0 -48
- package/src/components/CTree/index.vue +0 -176
- package/src/components/CTree/interface/index.ts +0 -6
- package/src/components/Dialog/index.scss +0 -74
- package/src/components/Dialog/index.vue +0 -87
- package/src/components/Empty/index.scss +0 -16
- package/src/components/Empty/index.vue +0 -43
- package/src/components/Grid/components/GridItem.vue +0 -68
- package/src/components/Grid/index.vue +0 -167
- package/src/components/Grid/interface/index.ts +0 -6
- package/src/components/Loading/index.scss +0 -67
- package/src/components/Loading/index.vue +0 -13
- package/src/components/Overflow/index.vue +0 -76
- package/src/components/ProTable/components/ColSetting.vue +0 -45
- package/src/components/ProTable/components/Pagination.vue +0 -29
- package/src/components/ProTable/components/SearchForm/components/SearchFormItem.vue +0 -93
- package/src/components/ProTable/components/SearchForm/index.scss +0 -12
- package/src/components/ProTable/components/SearchForm/index.vue +0 -91
- package/src/components/ProTable/components/TableColumn.vue +0 -56
- package/src/components/ProTable/index.scss +0 -14
- package/src/components/ProTable/index.vue +0 -274
- package/src/components/ProTable/interface/index.ts +0 -86
- package/src/components/ScrollBox/index.vue +0 -44
- package/src/components/SvgIcon/index.vue +0 -20
- package/src/components/Tabs/index.vue +0 -142
- package/src/config/index.ts +0 -12
- package/src/config/nprogress.ts +0 -12
- package/src/config/piniaPersist.ts +0 -19
- package/src/config/serviceLoading.ts +0 -45
- package/src/enums/httpEnum.ts +0 -24
- package/src/hooks/interface/index.ts +0 -32
- package/src/hooks/useOnline.ts +0 -27
- package/src/hooks/useTable.ts +0 -167
- package/src/main.ts +0 -35
- package/src/plugins/button/button.vue +0 -56
- package/src/plugins/index.js +0 -26
- package/src/plugins/index.vue +0 -24
- package/src/plugins/msg/msg.vue +0 -56
- package/src/stores/commonStore.ts +0 -9
- package/src/stores/index.ts +0 -8
- package/src/stores/interface/index.ts +0 -1
- package/src/styles/common.scss +0 -87
- package/src/styles/element.scss +0 -233
- package/src/styles/reset.scss +0 -20
- package/src/styles/var.scss +0 -2
- package/src/typings/global.d.ts +0 -37
- package/src/typings/window.d.ts +0 -8
- package/src/utils/color.ts +0 -59
- package/src/utils/commonUtils.ts +0 -175
- package/src/utils/errorHandler.ts +0 -28
- package/src/utils/is.ts +0 -147
- package/src/utils/layoutUtils.ts +0 -83
- package/src/utils/localUtils.ts +0 -42
- package/src/utils/serviceDict.ts +0 -9
- package/src/vite-env.d.ts +0 -6
- package/tsconfig.json +0 -50
- package/vite.config.ts +0 -76
- /package/{public/logo.png → logo.png} +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
.dialog-box {
|
|
2
|
-
:deep(.my-dialog) {
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
.el-dialog__header {
|
|
6
|
-
padding: 20px;
|
|
7
|
-
padding-right: 36px;
|
|
8
|
-
margin: 0;
|
|
9
|
-
border-bottom: 1px solid #eeeeee;
|
|
10
|
-
.el-dialog__title {
|
|
11
|
-
font-size: 16px;
|
|
12
|
-
font-weight: bold;
|
|
13
|
-
line-height: 19px;
|
|
14
|
-
color: #333333;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
.el-dialog__body {
|
|
18
|
-
position: relative;
|
|
19
|
-
box-sizing: border-box;
|
|
20
|
-
flex: 1;
|
|
21
|
-
padding: 0 !important;
|
|
22
|
-
.dialog-body {
|
|
23
|
-
padding: 20px 0 20px 20px;
|
|
24
|
-
.dialog-close-icon {
|
|
25
|
-
position: absolute;
|
|
26
|
-
top: 20px;
|
|
27
|
-
right: 20px;
|
|
28
|
-
z-index: 1;
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
}
|
|
31
|
-
.dialog-close-icon:hover {
|
|
32
|
-
color: $primary-color;
|
|
33
|
-
}
|
|
34
|
-
> div {
|
|
35
|
-
width: 100%;
|
|
36
|
-
max-height: 760px;
|
|
37
|
-
padding-right: 20px;
|
|
38
|
-
overflow-y: auto;
|
|
39
|
-
}
|
|
40
|
-
.btn-group {
|
|
41
|
-
display: flex;
|
|
42
|
-
justify-content: flex-end;
|
|
43
|
-
.el-button {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
padding-right: 14px;
|
|
47
|
-
padding-left: 14px;
|
|
48
|
-
.icon {
|
|
49
|
-
width: 16px;
|
|
50
|
-
height: 16px;
|
|
51
|
-
margin-right: 4px;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
.el-dialog__footer {
|
|
58
|
-
padding: 0 30px 30px;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
:deep(.hide-title) {
|
|
62
|
-
.el-dialog__header {
|
|
63
|
-
display: none !important;
|
|
64
|
-
}
|
|
65
|
-
.dialog-body {
|
|
66
|
-
> div {
|
|
67
|
-
width: 100%;
|
|
68
|
-
max-height: 800px;
|
|
69
|
-
padding-right: 30px;
|
|
70
|
-
overflow-y: auto;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="dialog-box" v-if="visible">
|
|
3
|
-
<el-dialog
|
|
4
|
-
:model-value="visible"
|
|
5
|
-
:width="toWidthRatio()"
|
|
6
|
-
align-center
|
|
7
|
-
:title="title"
|
|
8
|
-
:before-close="onClose"
|
|
9
|
-
:destroy-on-close="true"
|
|
10
|
-
:show-close="showCloseIcon"
|
|
11
|
-
:class="hideTitle ? 'my-dialog hide-title' : 'my-dialog'"
|
|
12
|
-
:modal="modal"
|
|
13
|
-
:close-on-click-modal="closeOnClickModal"
|
|
14
|
-
:append-to-body="appendToBody"
|
|
15
|
-
close-on-press-escape
|
|
16
|
-
>
|
|
17
|
-
<template #header v-if="slotHeader">
|
|
18
|
-
<slot name="header"></slot>
|
|
19
|
-
</template>
|
|
20
|
-
<div class="dialog-body" :style="{ width: '100%' }">
|
|
21
|
-
<section v-if="hideTitle" class="dialog-close-icon" @click="onClose">
|
|
22
|
-
<Close style="width: 1em; height: 1em" />
|
|
23
|
-
</section>
|
|
24
|
-
<slot></slot>
|
|
25
|
-
</div>
|
|
26
|
-
<template #footer v-if="slotFooter">
|
|
27
|
-
<slot name="footer"></slot>
|
|
28
|
-
</template>
|
|
29
|
-
</el-dialog>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script setup lang="ts">
|
|
34
|
-
const props = defineProps({
|
|
35
|
-
visible: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
required: true
|
|
38
|
-
},
|
|
39
|
-
title: {
|
|
40
|
-
type: String,
|
|
41
|
-
default: () => "默认标题"
|
|
42
|
-
},
|
|
43
|
-
width: {
|
|
44
|
-
type: [Number, String],
|
|
45
|
-
default: () => 600
|
|
46
|
-
},
|
|
47
|
-
showCloseIcon: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: () => true
|
|
50
|
-
},
|
|
51
|
-
// 控制是否隐藏 header 栏, 默认为 true
|
|
52
|
-
hideTitle: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: () => false
|
|
55
|
-
},
|
|
56
|
-
modal: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: () => true
|
|
59
|
-
},
|
|
60
|
-
appendToBody: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: () => false
|
|
63
|
-
},
|
|
64
|
-
closeOnClickModal: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: () => true
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const emit = defineEmits(["onClose"]);
|
|
71
|
-
//判断<slot/>是否有传值
|
|
72
|
-
const slotHeader = !!useSlots().header;
|
|
73
|
-
const slotFooter = !!useSlots().footer;
|
|
74
|
-
const toWidthRatio = () => {
|
|
75
|
-
return typeof props.width === "number" ? (props.width / 1920) * 100 + "vw" : props.width;
|
|
76
|
-
};
|
|
77
|
-
const onClose = () => {
|
|
78
|
-
if (axiosFileController.size() > 0) {
|
|
79
|
-
axiosFileController.removeAllPending();
|
|
80
|
-
}
|
|
81
|
-
emit("onClose");
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style scoped lang="scss">
|
|
86
|
-
@import "./index.scss";
|
|
87
|
-
</style>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
.empty-box {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 100%;
|
|
8
|
-
p {
|
|
9
|
-
margin: 0;
|
|
10
|
-
margin-top: 9px;
|
|
11
|
-
font-size: 14px;
|
|
12
|
-
font-weight: 400;
|
|
13
|
-
line-height: 16px;
|
|
14
|
-
color: #999999;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="emptyRef" class="empty-box flx-center" :style="{ width, height }">
|
|
3
|
-
<img src="../../assets/images/empty-img.png" alt="" :style="refSize" />
|
|
4
|
-
<p class="title">{{ title }}</p>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
width: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: () => "100%"
|
|
12
|
-
},
|
|
13
|
-
height: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: () => "100%"
|
|
16
|
-
},
|
|
17
|
-
imgStyle: {
|
|
18
|
-
type: Object,
|
|
19
|
-
default: () => {}
|
|
20
|
-
},
|
|
21
|
-
title: {
|
|
22
|
-
type: String,
|
|
23
|
-
default: () => "暂无数据"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const emptyRef = ref();
|
|
27
|
-
const refSize = ref<Record<string, any>>({
|
|
28
|
-
height: "30%"
|
|
29
|
-
});
|
|
30
|
-
watchEffect(() => {
|
|
31
|
-
if (emptyRef.value) {
|
|
32
|
-
refSize.value =
|
|
33
|
-
emptyRef.value.offsetHeight > emptyRef.value.offsetWidth
|
|
34
|
-
? { width: "30%" }
|
|
35
|
-
: {
|
|
36
|
-
height: "30%"
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
</script>
|
|
41
|
-
<style scoped lang="scss">
|
|
42
|
-
@import "./index.scss";
|
|
43
|
-
</style>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-show="isShow" :style="style">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
<script setup lang="ts" name="GridItem">
|
|
7
|
-
import { computed, inject, Ref, ref, useAttrs, watch } from "vue";
|
|
8
|
-
import { BreakPoint, Responsive } from "../interface/index";
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
offset?: number;
|
|
12
|
-
span?: number;
|
|
13
|
-
suffix?: boolean;
|
|
14
|
-
xs?: Responsive;
|
|
15
|
-
sm?: Responsive;
|
|
16
|
-
md?: Responsive;
|
|
17
|
-
lg?: Responsive;
|
|
18
|
-
xl?: Responsive;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
22
|
-
offset: 0,
|
|
23
|
-
span: 1,
|
|
24
|
-
suffix: false,
|
|
25
|
-
xs: undefined,
|
|
26
|
-
sm: undefined,
|
|
27
|
-
md: undefined,
|
|
28
|
-
lg: undefined,
|
|
29
|
-
xl: undefined
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const attrs = useAttrs() as { index: string };
|
|
33
|
-
const isShow = ref(true);
|
|
34
|
-
|
|
35
|
-
// 注入断点
|
|
36
|
-
const breakPoint = inject<Ref<BreakPoint>>("breakPoint", ref("xl"));
|
|
37
|
-
const shouldHiddenIndex = inject<Ref<number>>("shouldHiddenIndex", ref(-1));
|
|
38
|
-
watch(
|
|
39
|
-
() => [shouldHiddenIndex.value, breakPoint.value],
|
|
40
|
-
n => {
|
|
41
|
-
if (!!attrs.index) {
|
|
42
|
-
isShow.value = !(n[0] !== -1 && parseInt(attrs.index) >= Number(n[0]));
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
{ immediate: true }
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const gap = inject("gap", 0);
|
|
49
|
-
const cols = inject("cols", ref(4));
|
|
50
|
-
const style = computed(() => {
|
|
51
|
-
let span = props[breakPoint.value]?.span ?? props.span;
|
|
52
|
-
let offset = props[breakPoint.value]?.offset ?? props.offset;
|
|
53
|
-
if (props.suffix) {
|
|
54
|
-
return {
|
|
55
|
-
gridColumnStart: cols.value - span - offset + 1,
|
|
56
|
-
gridColumnEnd: `span ${span + offset}`,
|
|
57
|
-
marginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : "unset"
|
|
58
|
-
};
|
|
59
|
-
} else {
|
|
60
|
-
return {
|
|
61
|
-
gridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${
|
|
62
|
-
span + offset > cols.value ? cols.value : span + offset
|
|
63
|
-
}`,
|
|
64
|
-
marginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : "unset"
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
</script>
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :style="style">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts" name="Grid">
|
|
8
|
-
import {
|
|
9
|
-
ref,
|
|
10
|
-
watch,
|
|
11
|
-
useSlots,
|
|
12
|
-
computed,
|
|
13
|
-
provide,
|
|
14
|
-
onBeforeMount,
|
|
15
|
-
onMounted,
|
|
16
|
-
onUnmounted,
|
|
17
|
-
onDeactivated,
|
|
18
|
-
onActivated,
|
|
19
|
-
VNodeArrayChildren,
|
|
20
|
-
VNode
|
|
21
|
-
} from "vue";
|
|
22
|
-
import type { BreakPoint } from "./interface/index";
|
|
23
|
-
|
|
24
|
-
type Props = {
|
|
25
|
-
cols?: number | Record<BreakPoint, number>;
|
|
26
|
-
collapsed?: boolean;
|
|
27
|
-
collapsedRows?: number;
|
|
28
|
-
gap?: [number, number] | number;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
32
|
-
cols: () => ({ xs: 1, sm: 2, md: 2, lg: 3, xl: 4 }),
|
|
33
|
-
collapsed: false,
|
|
34
|
-
collapsedRows: 1,
|
|
35
|
-
gap: 0
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
onBeforeMount(() => props.collapsed && findIndex());
|
|
39
|
-
onMounted(() => {
|
|
40
|
-
resize({ target: { innerWidth: window.innerWidth } } as unknown as UIEvent);
|
|
41
|
-
window.addEventListener("resize", resize);
|
|
42
|
-
});
|
|
43
|
-
onActivated(() => {
|
|
44
|
-
resize({ target: { innerWidth: window.innerWidth } } as unknown as UIEvent);
|
|
45
|
-
window.addEventListener("resize", resize);
|
|
46
|
-
});
|
|
47
|
-
onUnmounted(() => {
|
|
48
|
-
window.removeEventListener("resize", resize);
|
|
49
|
-
});
|
|
50
|
-
onDeactivated(() => {
|
|
51
|
-
window.removeEventListener("resize", resize);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// 监听屏幕变化
|
|
55
|
-
const resize = (e: UIEvent) => {
|
|
56
|
-
let width = (e.target as Window).innerWidth;
|
|
57
|
-
switch (!!width) {
|
|
58
|
-
case width < 768:
|
|
59
|
-
breakPoint.value = "xs";
|
|
60
|
-
break;
|
|
61
|
-
case width >= 768 && width < 992:
|
|
62
|
-
breakPoint.value = "sm";
|
|
63
|
-
break;
|
|
64
|
-
case width >= 992 && width < 1200:
|
|
65
|
-
breakPoint.value = "md";
|
|
66
|
-
break;
|
|
67
|
-
case width >= 1200 && width < 1920:
|
|
68
|
-
breakPoint.value = "lg";
|
|
69
|
-
break;
|
|
70
|
-
case width >= 1920:
|
|
71
|
-
breakPoint.value = "xl";
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// 注入 gap 间距
|
|
77
|
-
provide("gap", Array.isArray(props.gap) ? props.gap[0] : props.gap);
|
|
78
|
-
|
|
79
|
-
// 注入响应式断点
|
|
80
|
-
let breakPoint = ref<BreakPoint>("xl");
|
|
81
|
-
provide("breakPoint", breakPoint);
|
|
82
|
-
|
|
83
|
-
// 注入要开始折叠的 index
|
|
84
|
-
const hiddenIndex = ref(-1);
|
|
85
|
-
provide("shouldHiddenIndex", hiddenIndex);
|
|
86
|
-
|
|
87
|
-
// 注入 cols
|
|
88
|
-
const gridCols = computed(() => {
|
|
89
|
-
if (typeof props.cols === "object") return props.cols[breakPoint.value] ?? props.cols;
|
|
90
|
-
return props.cols;
|
|
91
|
-
});
|
|
92
|
-
provide("cols", gridCols);
|
|
93
|
-
|
|
94
|
-
// 寻找需要开始折叠的字段 index
|
|
95
|
-
const slots = useSlots().default!();
|
|
96
|
-
|
|
97
|
-
const findIndex = () => {
|
|
98
|
-
let fields: VNodeArrayChildren = [];
|
|
99
|
-
let suffix: VNode | null = null;
|
|
100
|
-
slots.forEach((slot: any) => {
|
|
101
|
-
// suffix
|
|
102
|
-
if (typeof slot.type === "object" && slot.type.name === "GridItem" && slot.props?.suffix !== undefined) suffix = slot;
|
|
103
|
-
// slot children
|
|
104
|
-
if (typeof slot.type === "symbol" && Array.isArray(slot.children)) fields.push(...slot.children);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// 计算 suffix 所占用的列
|
|
108
|
-
let suffixCols = 0;
|
|
109
|
-
if (suffix) {
|
|
110
|
-
suffixCols =
|
|
111
|
-
((suffix as VNode).props![breakPoint.value]?.span ?? (suffix as VNode).props?.span ?? 1) +
|
|
112
|
-
((suffix as VNode).props![breakPoint.value]?.offset ?? (suffix as VNode).props?.offset ?? 0);
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
let find = false;
|
|
116
|
-
fields.reduce((prev = 0, current, index) => {
|
|
117
|
-
prev +=
|
|
118
|
-
((current as VNode)!.props![breakPoint.value]?.span ?? (current as VNode)!.props?.span ?? 1) +
|
|
119
|
-
((current as VNode)!.props![breakPoint.value]?.offset ?? (current as VNode)!.props?.offset ?? 0);
|
|
120
|
-
if (Number(prev) > props.collapsedRows * (gridCols.value as any) - suffixCols) {
|
|
121
|
-
hiddenIndex.value = index;
|
|
122
|
-
find = true;
|
|
123
|
-
throw "find it";
|
|
124
|
-
}
|
|
125
|
-
return prev;
|
|
126
|
-
}, 0);
|
|
127
|
-
if (!find) hiddenIndex.value = -1;
|
|
128
|
-
} catch (e) {
|
|
129
|
-
// console.warn(e);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// 断点变化时 执行 findIndex
|
|
134
|
-
watch(
|
|
135
|
-
() => breakPoint.value,
|
|
136
|
-
() => {
|
|
137
|
-
if (props.collapsed) findIndex();
|
|
138
|
-
}
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
// 监听 collapsed
|
|
142
|
-
watch(
|
|
143
|
-
() => props.collapsed,
|
|
144
|
-
value => {
|
|
145
|
-
if (value) return findIndex();
|
|
146
|
-
hiddenIndex.value = -1;
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
// 设置间距
|
|
151
|
-
const gridGap = computed(() => {
|
|
152
|
-
if (typeof props.gap === "number") return `${props.gap}px`;
|
|
153
|
-
if (Array.isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;
|
|
154
|
-
return "unset";
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// 设置 style
|
|
158
|
-
const style = computed(() => {
|
|
159
|
-
return {
|
|
160
|
-
display: "grid",
|
|
161
|
-
gridGap: gridGap.value,
|
|
162
|
-
gridTemplateColumns: `repeat(${gridCols.value}, minmax(0, 1fr))`
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
defineExpose({ breakPoint });
|
|
167
|
-
</script>
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
.loading-box {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 100%;
|
|
8
|
-
.loading-wrap {
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
padding: 98px;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
.dot {
|
|
16
|
-
position: relative;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
display: inline-block;
|
|
19
|
-
width: 32px;
|
|
20
|
-
height: 32px;
|
|
21
|
-
font-size: 32px;
|
|
22
|
-
transform: rotate(45deg);
|
|
23
|
-
animation: ant-rotate 1.2s infinite linear;
|
|
24
|
-
}
|
|
25
|
-
.dot i {
|
|
26
|
-
position: absolute;
|
|
27
|
-
display: block;
|
|
28
|
-
width: 14px;
|
|
29
|
-
height: 14px;
|
|
30
|
-
background-color: var(--el-color-primary);
|
|
31
|
-
border-radius: 100%;
|
|
32
|
-
opacity: 0.3;
|
|
33
|
-
transform: scale(0.75);
|
|
34
|
-
transform-origin: 50% 50%;
|
|
35
|
-
animation: ant-spin-move 1s infinite linear alternate;
|
|
36
|
-
}
|
|
37
|
-
.dot i:nth-child(1) {
|
|
38
|
-
top: 0;
|
|
39
|
-
left: 0;
|
|
40
|
-
}
|
|
41
|
-
.dot i:nth-child(2) {
|
|
42
|
-
top: 0;
|
|
43
|
-
right: 0;
|
|
44
|
-
animation-delay: 0.4s;
|
|
45
|
-
}
|
|
46
|
-
.dot i:nth-child(3) {
|
|
47
|
-
right: 0;
|
|
48
|
-
bottom: 0;
|
|
49
|
-
animation-delay: 0.8s;
|
|
50
|
-
}
|
|
51
|
-
.dot i:nth-child(4) {
|
|
52
|
-
bottom: 0;
|
|
53
|
-
left: 0;
|
|
54
|
-
animation-delay: 1.2s;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@keyframes ant-rotate {
|
|
58
|
-
to {
|
|
59
|
-
transform: rotate(405deg);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
@keyframes ant-spin-move {
|
|
64
|
-
to {
|
|
65
|
-
opacity: 1;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="loading-box">
|
|
3
|
-
<div class="loading-wrap">
|
|
4
|
-
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
|
|
5
|
-
</div>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts" name="Loading"></script>
|
|
10
|
-
|
|
11
|
-
<style scoped lang="scss">
|
|
12
|
-
@import "./index.scss";
|
|
13
|
-
</style>
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tooltip
|
|
3
|
-
popper-class="custom-over-flow"
|
|
4
|
-
:visible="isShowTooltip"
|
|
5
|
-
:content="text.toString()"
|
|
6
|
-
effect="light"
|
|
7
|
-
placement="top"
|
|
8
|
-
:enterable="enterable"
|
|
9
|
-
:hide-after="100"
|
|
10
|
-
>
|
|
11
|
-
<div class="text" :style="customStyle" @mouseenter="e => showTooltip(e)" @mouseout="hideTooltip">
|
|
12
|
-
{{ text }}
|
|
13
|
-
</div>
|
|
14
|
-
</el-tooltip>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
const props = defineProps({
|
|
19
|
-
text: {
|
|
20
|
-
type: [String, Number],
|
|
21
|
-
default: () => "-"
|
|
22
|
-
},
|
|
23
|
-
customStyle: {
|
|
24
|
-
type: [String, Object],
|
|
25
|
-
default: () => ""
|
|
26
|
-
},
|
|
27
|
-
enterable: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: () => true
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const isShowTooltip = ref(false);
|
|
34
|
-
|
|
35
|
-
const showTooltip = (e: any) => {
|
|
36
|
-
isShowTooltip.value = textRange(e.target);
|
|
37
|
-
};
|
|
38
|
-
const hideTooltip = () => {
|
|
39
|
-
isShowTooltip.value = false;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const textRange = (el: any) => {
|
|
43
|
-
const textContent = el;
|
|
44
|
-
const targetW = textContent.getBoundingClientRect().width;
|
|
45
|
-
const range = document.createRange();
|
|
46
|
-
range.setStart(textContent, 0);
|
|
47
|
-
range.setEnd(textContent, textContent.childNodes.length);
|
|
48
|
-
const rangeWidth = range.getBoundingClientRect().width;
|
|
49
|
-
return rangeWidth > targetW;
|
|
50
|
-
};
|
|
51
|
-
</script>
|
|
52
|
-
<style lang="scss" scoped>
|
|
53
|
-
.text {
|
|
54
|
-
box-sizing: border-box;
|
|
55
|
-
flex: 1;
|
|
56
|
-
max-width: 100%;
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
text-overflow: ellipsis;
|
|
59
|
-
white-space: nowrap;
|
|
60
|
-
vertical-align: middle;
|
|
61
|
-
> * {
|
|
62
|
-
vertical-align: middle;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
p {
|
|
66
|
-
margin: 0;
|
|
67
|
-
}
|
|
68
|
-
</style>
|
|
69
|
-
<style lang="scss">
|
|
70
|
-
.custom-over-flow {
|
|
71
|
-
> span:nth-child(1) {
|
|
72
|
-
display: inline-block;
|
|
73
|
-
max-width: 800px !important;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 列设置 -->
|
|
3
|
-
<el-drawer v-model="drawerVisible" title="列设置" size="450px">
|
|
4
|
-
<div class="table-main">
|
|
5
|
-
<el-table :data="colSetting" :border="true" row-key="prop" default-expand-all :tree-props="{ children: '_children' }">
|
|
6
|
-
<el-table-column prop="label" align="center" label="列名" />
|
|
7
|
-
<el-table-column v-slot="scope" prop="isShow" align="center" label="显示">
|
|
8
|
-
<el-switch v-model="scope.row.isShow"></el-switch>
|
|
9
|
-
</el-table-column>
|
|
10
|
-
<el-table-column v-slot="scope" prop="sortable" align="center" label="排序">
|
|
11
|
-
<el-switch v-model="scope.row.sortable"></el-switch>
|
|
12
|
-
</el-table-column>
|
|
13
|
-
<template #empty>
|
|
14
|
-
<div class="table-empty">
|
|
15
|
-
<img src="@/assets/images/notData.png" alt="notData" />
|
|
16
|
-
<div>暂无可配置列</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
</el-table>
|
|
20
|
-
</div>
|
|
21
|
-
</el-drawer>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script setup lang="ts" name="ColSetting">
|
|
25
|
-
import { ref } from "vue";
|
|
26
|
-
import { ColumnProps } from "@/components/ProTable/interface";
|
|
27
|
-
|
|
28
|
-
defineProps<{ colSetting: ColumnProps[] }>();
|
|
29
|
-
|
|
30
|
-
const drawerVisible = ref<boolean>(false);
|
|
31
|
-
|
|
32
|
-
const openColSetting = () => {
|
|
33
|
-
drawerVisible.value = true;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
defineExpose({
|
|
37
|
-
openColSetting
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style scoped lang="scss">
|
|
42
|
-
.cursor-move {
|
|
43
|
-
cursor: move;
|
|
44
|
-
}
|
|
45
|
-
</style>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- 分页组件 -->
|
|
3
|
-
<el-pagination
|
|
4
|
-
:background="true"
|
|
5
|
-
:current-page="pageable.page"
|
|
6
|
-
:page-size="pageable.limit"
|
|
7
|
-
:page-sizes="[10, 25, 50, 100]"
|
|
8
|
-
:total="pageable.total"
|
|
9
|
-
layout="total, sizes, prev, pager, next, jumper"
|
|
10
|
-
@size-change="handleSizeChange"
|
|
11
|
-
@current-change="handleCurrentChange"
|
|
12
|
-
></el-pagination>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts" name="Pagination">
|
|
16
|
-
interface Pageable {
|
|
17
|
-
page: number;
|
|
18
|
-
limit: number;
|
|
19
|
-
total: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface PaginationProps {
|
|
23
|
-
pageable: Pageable;
|
|
24
|
-
handleSizeChange: (size: number) => void;
|
|
25
|
-
handleCurrentChange: (currentPage: number) => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
defineProps<PaginationProps>();
|
|
29
|
-
</script>
|