nubomed-ui 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.env.bi +13 -0
- package/.env.terminal +13 -0
- package/.vscode/extensions.json +3 -0
- package/README.md +17 -0
- package/index.html +13 -0
- package/nubomed-ui/nubomed-ui.es.js +2005 -0
- package/nubomed-ui/nubomed-ui.umd.js +1 -0
- package/nubomed-ui/style.css +1 -0
- package/package.json +19 -7
- package/src/App.vue +31 -0
- package/src/bi-demos/Header.vue +29 -0
- package/src/bi-demos/Table.vue +69 -0
- package/src/bi-demos/index.vue +132 -0
- package/src/bi-packages/components/Box/images/corner-error.png +0 -0
- package/src/bi-packages/components/Box/images/corner-warning.png +0 -0
- package/src/bi-packages/components/Box/images/corner.png +0 -0
- package/src/bi-packages/components/Box/index.scss +86 -0
- package/src/bi-packages/components/Box/index.vue +53 -0
- package/src/bi-packages/components/Carousel/CarouselItem.vue +0 -0
- package/src/bi-packages/components/Carousel/index.vue +0 -0
- package/src/bi-packages/components/Header/images/left-bg.png +0 -0
- package/src/bi-packages/components/Header/images/logo.png +0 -0
- package/src/bi-packages/components/Header/images/right-bg.png +0 -0
- package/src/bi-packages/components/Header/index.scss +50 -0
- package/src/bi-packages/components/Header/index.vue +54 -0
- package/src/bi-packages/components/Table/TableColgroup.vue +43 -0
- package/src/bi-packages/components/Table/index copy.vue +107 -0
- package/src/bi-packages/components/Table/index.scss +118 -0
- package/src/bi-packages/components/Table/index.vue +108 -0
- package/src/bi-packages/components/TableColumn/index.scss +7 -0
- package/src/bi-packages/components/TableColumn/index.vue +60 -0
- package/src/bi-packages/fonts/OPPOSans-B.ttf +0 -0
- package/src/bi-packages/fonts/OPPOSans-M.ttf +0 -0
- package/src/bi-packages/fonts/font.scss +11 -0
- package/src/bi-packages/iconfont-svg/demo.css +539 -0
- package/src/bi-packages/iconfont-svg/demo_index.html +4811 -0
- package/src/bi-packages/iconfont-svg/iconfont.css +819 -0
- package/src/bi-packages/iconfont-svg/iconfont.js +1 -0
- package/src/bi-packages/iconfont-svg/iconfont.json +1416 -0
- package/src/bi-packages/iconfont-svg/iconfont.ttf +0 -0
- package/src/bi-packages/iconfont-svg/iconfont.woff +0 -0
- package/src/bi-packages/iconfont-svg/iconfont.woff2 +0 -0
- package/src/bi-packages/index.js +34 -0
- package/src/bi-packages/styles/mixin.scss +12 -0
- package/src/bi-packages/styles/var.scss +11 -0
- package/src/demos/ActionBar.vue +59 -0
- package/src/demos/Badge.vue +28 -0
- package/src/demos/Button copy.vue +302 -0
- package/src/demos/Button.vue +116 -0
- package/src/demos/ButtonGroup.vue +40 -0
- package/src/demos/Check.vue +29 -0
- package/src/demos/Dialog.vue +255 -0
- package/src/demos/Empty.vue +38 -0
- package/src/demos/FooterMenu.vue +49 -0
- package/src/demos/Header.vue +71 -0
- package/src/demos/Icons.vue +314 -0
- package/src/demos/Input.vue +87 -0
- package/src/demos/InputKeyboard.vue +30 -0
- package/src/demos/InputNumber.vue +34 -0
- package/src/demos/LeftMenu.vue +128 -0
- package/src/demos/Menus.vue +106 -0
- package/src/demos/OpenCabinetBall.vue +37 -0
- package/src/demos/Statusbar.vue +146 -0
- package/src/demos/Steps.vue +45 -0
- package/src/demos/Tost.vue +35 -0
- package/src/demos/button/button.md +19 -0
- package/src/demos/data/terList.json +145 -0
- package/src/demos/images/cabinets/H3000-D.png +0 -0
- package/src/demos/images/cabinets/H3000-R.png +0 -0
- package/src/demos/images/cabinets/H3000-Rh.png +0 -0
- package/src/demos/images/cabinets/H3000-Rh2.png +0 -0
- package/src/demos/images/cabinets/H3010-R.png +0 -0
- package/src/demos/index.vue +348 -0
- package/src/docs/icons/Icon.vue +72 -0
- package/src/docs/icons/icon.md +21 -0
- package/src/docs/index.html +15 -0
- package/src/docs/index.vue +301 -0
- package/src/main.js +23 -0
- package/src/packages/components/ActionBar/images/error.png +0 -0
- package/src/packages/components/ActionBar/images/loading.gif +0 -0
- package/src/packages/components/ActionBar/images/success.png +0 -0
- package/src/packages/components/ActionBar/images/warning.png +0 -0
- package/src/packages/components/ActionBar/images/warning_yellow.png +0 -0
- package/src/packages/components/ActionBar/index.scss +81 -0
- package/src/packages/components/ActionBar/index.vue +100 -0
- package/src/packages/components/Badge/index.scss +50 -0
- package/src/packages/components/Badge/index.vue +75 -0
- package/src/packages/components/Button/index.scss +241 -0
- package/src/packages/components/Button/index.vue +111 -0
- package/src/packages/components/ButtonGroup/index.scss +54 -0
- package/src/packages/components/ButtonGroup/index.vue +75 -0
- package/src/packages/components/Check/Cate.vue +138 -0
- package/src/packages/components/Check/index.scss +47 -0
- package/src/packages/components/Check/index.vue +105 -0
- package/src/packages/components/Dialog/images/error.png +0 -0
- package/src/packages/components/Dialog/images/success.png +0 -0
- package/src/packages/components/Dialog/images/warning-red.png +0 -0
- package/src/packages/components/Dialog/images/warning-yellow.png +0 -0
- package/src/packages/components/Dialog/index.scss +154 -0
- package/src/packages/components/Dialog/index.vue +305 -0
- package/src/packages/components/Empty/images/empty-abnormal.png +0 -0
- package/src/packages/components/Empty/images/empty-data.png +0 -0
- package/src/packages/components/Empty/images/empty-search.png +0 -0
- package/src/packages/components/Empty/index.vue +68 -0
- package/src/packages/components/Form/FormItem.vue +73 -0
- package/src/packages/components/Form/index.vue +76 -0
- package/src/packages/components/Icon/index.vue +30 -0
- package/src/packages/components/Input/index.scss +184 -0
- package/src/packages/components/Input/index.vue +189 -0
- package/src/packages/components/InputKeyboard/index.scss +63 -0
- package/src/packages/components/InputKeyboard/index.vue +117 -0
- package/src/packages/components/InputNumber/index.scss +103 -0
- package/src/packages/components/InputNumber/index.vue +160 -0
- package/src/packages/components/Menu/index.scss +559 -0
- package/src/packages/components/Menu/index.vue +211 -0
- package/src/packages/components/OpenCabinetBall/CabinetStatus.vue +94 -0
- package/src/packages/components/OpenCabinetBall/index.scss +204 -0
- package/src/packages/components/OpenCabinetBall/index.vue +113 -0
- package/src/packages/components/Statusbar/CabinetList.vue +125 -0
- package/src/packages/components/Statusbar/CabinetListStatus.vue +75 -0
- package/src/packages/components/Statusbar/CabinetListTempHum.vue +108 -0
- package/src/packages/components/Statusbar/index.scss +205 -0
- package/src/packages/components/Statusbar/index.vue +83 -0
- package/src/packages/components/Steps/index.scss +104 -0
- package/src/packages/components/Steps/index.vue +66 -0
- package/src/packages/components/SvgIcon/index.vue +41 -0
- package/src/packages/components/Toast/index.vue +72 -0
- package/src/packages/fonts/OPPOSans-B.ttf +0 -0
- package/src/packages/fonts/OPPOSans-M.ttf +0 -0
- package/src/packages/fonts/font.scss +11 -0
- package/src/packages/iconfont-svg/demo.css +539 -0
- package/src/packages/iconfont-svg/demo_index.html +4811 -0
- package/src/packages/iconfont-svg/iconfont.css +819 -0
- package/src/packages/iconfont-svg/iconfont.js +1 -0
- package/src/packages/iconfont-svg/iconfont.json +1416 -0
- package/src/packages/iconfont-svg/iconfont.ttf +0 -0
- package/src/packages/iconfont-svg/iconfont.woff +0 -0
- package/src/packages/iconfont-svg/iconfont.woff2 +0 -0
- package/src/packages/index.js +64 -0
- package/src/packages/styles/var.scss +24 -0
- package/src/utils/create.js +48 -0
- package/src/utils/index.js +13 -0
- package/src/utils/validate.js +3 -0
- package/vite.config.js +47 -0
- package/nubomed-ui.es.js +0 -152
- package/nubomed-ui.umd.js +0 -1
- package/style.css +0 -1
@@ -0,0 +1,105 @@
|
|
1
|
+
<!--
|
2
|
+
* @Author: chenghuan.dong
|
3
|
+
* @Date: 2023-07-10 17:51:28
|
4
|
+
* @LastEditors: chenghuan.dong
|
5
|
+
* @LastEditTime: 2023-08-07 09:05:04
|
6
|
+
* @Description: 多选按钮组
|
7
|
+
-->
|
8
|
+
<template>
|
9
|
+
<div class="nb-check-list">
|
10
|
+
<div class="nb-check-list__item">
|
11
|
+
<!-- 分类 -->
|
12
|
+
<nb-check-cate />
|
13
|
+
<!-- <div class="nb-check-list__item__cate">
|
14
|
+
<nb-icon class="nb-check-list__arrow" icon="caret-right" />
|
15
|
+
<nb-icon class="nb-check-list__item__cate__icon" icon="menu-in-store" />
|
16
|
+
<strong class="nb-check-list__item__cate__text"
|
17
|
+
>异常出库<small>2021/10/22</small></strong
|
18
|
+
>
|
19
|
+
<span class="nb-check-list__item__cate__count">
|
20
|
+
<slot name="count"></slot>
|
21
|
+
</span>
|
22
|
+
</div> -->
|
23
|
+
<!-- 分类下的列表 -->
|
24
|
+
<ul class="nb-check-list__item__details">
|
25
|
+
<li class="nb-check-list__item__detail">
|
26
|
+
<!-- 品名 -->
|
27
|
+
<div class="nb-check-list__item__detail__top">
|
28
|
+
<nb-icon
|
29
|
+
icon="caret-right"
|
30
|
+
class="nb-check-list__item__detail__arrow"
|
31
|
+
/>
|
32
|
+
<strong class="nb-check-list__item__detail__name"
|
33
|
+
>非覆膜快速交换胆道金属支架系统</strong
|
34
|
+
>
|
35
|
+
<span>状态</span>
|
36
|
+
</div>
|
37
|
+
<!-- 规格/型号 -->
|
38
|
+
</li>
|
39
|
+
</ul>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</template>
|
43
|
+
<script setup>
|
44
|
+
import NbCheckCate from "./Cate.vue";
|
45
|
+
import { ref, computed } from "vue";
|
46
|
+
import { createNamespace } from '../../../utils/create.js';
|
47
|
+
|
48
|
+
const [name, bem] = createNamespace("check-list");
|
49
|
+
|
50
|
+
// 定义名称
|
51
|
+
defineOptions({
|
52
|
+
name: "NbCheckList",
|
53
|
+
});
|
54
|
+
|
55
|
+
// 定义props
|
56
|
+
const props = defineProps({
|
57
|
+
// 值
|
58
|
+
modelValue: {
|
59
|
+
type: [String, Number, Object, Boolean],
|
60
|
+
default: "",
|
61
|
+
},
|
62
|
+
// 选中项绑定值
|
63
|
+
data: {
|
64
|
+
type: Array,
|
65
|
+
default: () => {
|
66
|
+
return [];
|
67
|
+
},
|
68
|
+
},
|
69
|
+
});
|
70
|
+
|
71
|
+
// 定义emits
|
72
|
+
const emits = defineEmits(["change"]);
|
73
|
+
|
74
|
+
// 输入框值
|
75
|
+
const inputValue = computed({
|
76
|
+
get: () => props.modelValue,
|
77
|
+
set: (value) => {
|
78
|
+
emits("update:modelValue", value);
|
79
|
+
},
|
80
|
+
});
|
81
|
+
|
82
|
+
// 样式
|
83
|
+
const itemClassess = (item) => {
|
84
|
+
return bem("item", {
|
85
|
+
checked: (inputValue.value || []).includes(item.value),
|
86
|
+
disabled: item.disabled,
|
87
|
+
});
|
88
|
+
};
|
89
|
+
|
90
|
+
// 点击按钮
|
91
|
+
const handleChange = (item) => {
|
92
|
+
const newValue = inputValue.value;
|
93
|
+
const index = newValue.findIndex((x) => x === item.value);
|
94
|
+
if (index > -1) {
|
95
|
+
newValue.splice(index, 1);
|
96
|
+
} else {
|
97
|
+
newValue.push(item.value);
|
98
|
+
}
|
99
|
+
emits("change", item);
|
100
|
+
};
|
101
|
+
</script>
|
102
|
+
|
103
|
+
<style lang="scss">
|
104
|
+
@import "./index.scss";
|
105
|
+
</style>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,154 @@
|
|
1
|
+
:root {
|
2
|
+
// 通用
|
3
|
+
--el-overlay-color-lighter: rgba(0, 0, 0, 0.7);
|
4
|
+
// 按Size
|
5
|
+
// size=large
|
6
|
+
--nb-dialog-large-width: 1600px;
|
7
|
+
--nb-dialog-large-height: 900px;
|
8
|
+
// size=medium
|
9
|
+
--nb-dialog-medium-width: 1000px;
|
10
|
+
--nb-dialog-medium-height: 640px;
|
11
|
+
// size=mini
|
12
|
+
--nb-dialog-mini-width: 720px;
|
13
|
+
--nb-dialog-mini-height: 520px;
|
14
|
+
}
|
15
|
+
|
16
|
+
.nb-overlay {
|
17
|
+
position: fixed;
|
18
|
+
top: 0;
|
19
|
+
right: 0;
|
20
|
+
bottom: 0;
|
21
|
+
left: 0;
|
22
|
+
z-index: 2000;
|
23
|
+
height: 100%;
|
24
|
+
background-color: var(--el-overlay-color-lighter);
|
25
|
+
overflow: auto;
|
26
|
+
}
|
27
|
+
|
28
|
+
.nb-dialog {
|
29
|
+
background: #ffffff;
|
30
|
+
border-radius: 16px;
|
31
|
+
overflow: hidden;
|
32
|
+
display: flex;
|
33
|
+
flex-direction: column;
|
34
|
+
margin-left: auto;
|
35
|
+
margin-right: auto;
|
36
|
+
position: relative;
|
37
|
+
&__close {
|
38
|
+
height: 42px;
|
39
|
+
width: 80px;
|
40
|
+
text-align: right;
|
41
|
+
position: absolute;
|
42
|
+
top: 40px;
|
43
|
+
right: 40px;
|
44
|
+
cursor: pointer;
|
45
|
+
.svg-icon {
|
46
|
+
width: 40px;
|
47
|
+
height: 40px;
|
48
|
+
color: #8b8ea0;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
&__header {
|
52
|
+
padding: 36px 40px 24px 40px;
|
53
|
+
display: flex;
|
54
|
+
align-items: center;
|
55
|
+
&__title {
|
56
|
+
flex: 1;
|
57
|
+
font-size: 28px;
|
58
|
+
line-height: 42px;
|
59
|
+
&--center {
|
60
|
+
text-align: center;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
&__body {
|
65
|
+
flex: 1;
|
66
|
+
width: 100%;
|
67
|
+
overflow: auto;
|
68
|
+
&--center {
|
69
|
+
display: flex;
|
70
|
+
flex-direction: column;
|
71
|
+
align-items: center;
|
72
|
+
justify-content: center;
|
73
|
+
text-align: center;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
&__footer {
|
77
|
+
width: 100%;
|
78
|
+
height: 100px;
|
79
|
+
box-shadow: 0px -6px 16px 0px rgba(24, 29, 65, 0.08);
|
80
|
+
display: flex;
|
81
|
+
align-items: center;
|
82
|
+
justify-content: space-between;
|
83
|
+
&__tips {
|
84
|
+
height: 100%;
|
85
|
+
font-size: 28px;
|
86
|
+
color: #00a572;
|
87
|
+
line-height: 42px;
|
88
|
+
flex: 1;
|
89
|
+
padding: 0 40px;
|
90
|
+
border-right: 1px solid #cad0e0;
|
91
|
+
display: flex;
|
92
|
+
align-items: center;
|
93
|
+
}
|
94
|
+
.nb-button {
|
95
|
+
flex: 1;
|
96
|
+
height: 100%;
|
97
|
+
border-radius: 0;
|
98
|
+
border: none;
|
99
|
+
font-size: 36px;
|
100
|
+
}
|
101
|
+
&--has-tips {
|
102
|
+
.nb-button {
|
103
|
+
width: 400px;
|
104
|
+
flex: inherit;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
&--large {
|
109
|
+
width: var(--nb-dialog-large-width);
|
110
|
+
height: var(--nb-dialog-large-height);
|
111
|
+
margin-top: 80px;
|
112
|
+
}
|
113
|
+
&--medium {
|
114
|
+
width: var(--nb-dialog-medium-width);
|
115
|
+
height: var(--nb-dialog-medium-height);
|
116
|
+
margin-top: 80px;
|
117
|
+
}
|
118
|
+
&--mini {
|
119
|
+
width: var(--nb-dialog-mini-width);
|
120
|
+
min-height: var(--nb-dialog-mini-height);
|
121
|
+
margin-top: 160px;
|
122
|
+
|
123
|
+
.nb-dialog__body__icon {
|
124
|
+
width: 160px;
|
125
|
+
height: 160px;
|
126
|
+
margin-bottom: 30px;
|
127
|
+
}
|
128
|
+
.nb-dialog__body__message {
|
129
|
+
font-size: 36px;
|
130
|
+
line-height: 54px;
|
131
|
+
}
|
132
|
+
.nb-dialog__body__desc {
|
133
|
+
font-size: 28px;
|
134
|
+
line-height: 42px;
|
135
|
+
margin-top: 8px;
|
136
|
+
color: var(--nb-font-color-5);
|
137
|
+
}
|
138
|
+
.nb-dialog__body__form {
|
139
|
+
width: 100%;
|
140
|
+
height: 100%;
|
141
|
+
display: flex;
|
142
|
+
flex-direction: column;
|
143
|
+
align-items: flex-end;
|
144
|
+
overflow-x: hidden;
|
145
|
+
overflow-y: auto;
|
146
|
+
.form__title {
|
147
|
+
text-align: center;
|
148
|
+
font-size: 36px;
|
149
|
+
line-height: 54px;
|
150
|
+
}
|
151
|
+
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|
@@ -0,0 +1,305 @@
|
|
1
|
+
<!--
|
2
|
+
* @Author: chenghuan.dong
|
3
|
+
* @Date: 2023-06-29 15:15:27
|
4
|
+
* @LastEditors: chenghuan.dong
|
5
|
+
* @LastEditTime: 2023-07-04 20:46:00
|
6
|
+
* @Description: 模态框
|
7
|
+
-->
|
8
|
+
<template>
|
9
|
+
<teleport to="body" :disabled="!appendToBody">
|
10
|
+
<transition name="dialog-fade" @after-enter="afterEnter" @after-leave="afterLeave" @before-leave="beforeLeave">
|
11
|
+
<div v-show="visible" :class="['nb-overlay', modalClass]" :z-index="zIndex">
|
12
|
+
<div :class="classes">
|
13
|
+
<!-- 头部 -->
|
14
|
+
<header v-if="title || $slots.title" :class="headerClasses">
|
15
|
+
<slot name="title">
|
16
|
+
<span :class="headerTitleClasses">{{ title }}</span>
|
17
|
+
</slot>
|
18
|
+
</header>
|
19
|
+
<span v-if="showClose" :class="bem('close')" @click="handleClose">
|
20
|
+
<svg-icon icon="close" />
|
21
|
+
</span>
|
22
|
+
<!-- 主体 -->
|
23
|
+
<div :class="bodyClasses">
|
24
|
+
<slot>
|
25
|
+
<img v-if="icon === 'success'" :class="bem('body__icon')" src="./images/success.png" />
|
26
|
+
<img v-if="icon === 'error'" :class="bem('body__icon')" src="./images/error.png" />
|
27
|
+
<img v-if="icon === 'warning-yellow'" :class="bem('body__icon')" src="./images/warning-yellow.png" />
|
28
|
+
<img v-if="icon === 'warning-red'" :class="bem('body__icon')" src="./images/warning-red.png" />
|
29
|
+
<div v-if="message" v-html="message" :class="bem('body__message')"></div>
|
30
|
+
<div v-if="desc" v-html="desc" :class="bem('body__desc')" :style="`color: ${descColor}`"></div>
|
31
|
+
</slot>
|
32
|
+
</div>
|
33
|
+
<!-- 底部 -->
|
34
|
+
<footer :class="footerClasses">
|
35
|
+
<slot name="footer">
|
36
|
+
<div v-if="footerTips" :class="bem('footer__tips')">{{ footerTips }}</div>
|
37
|
+
<nb-button
|
38
|
+
v-if="showCancelButton"
|
39
|
+
type="default"
|
40
|
+
:style="`color: ${cancelButtonColor}`"
|
41
|
+
@click="handleCancel"
|
42
|
+
>{{ cancelButtonText }}<template v-if="cancelButtonTime > -1">({{ cancelTime }}s)</template></nb-button
|
43
|
+
>
|
44
|
+
<nb-button v-if="showConfirmButton" type="primary" @click="handleConfirm"
|
45
|
+
>{{ confirmButtonText
|
46
|
+
}}<template v-if="confirmButtonTime > -1">({{ confirmTime }}s)</template></nb-button
|
47
|
+
>
|
48
|
+
</slot>
|
49
|
+
</footer>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</transition>
|
53
|
+
</teleport>
|
54
|
+
</template>
|
55
|
+
|
56
|
+
<script setup>
|
57
|
+
import { ref, computed, watch } from 'vue'
|
58
|
+
import { createNamespace } from '../../../utils/create.js'
|
59
|
+
import { isNumber } from '../../../utils/validate.js'
|
60
|
+
|
61
|
+
defineOptions({
|
62
|
+
name: 'NbDialog'
|
63
|
+
})
|
64
|
+
|
65
|
+
const props = defineProps({
|
66
|
+
// 尺寸
|
67
|
+
size: {
|
68
|
+
type: String,
|
69
|
+
default: 'medium'
|
70
|
+
},
|
71
|
+
// 自定义样式
|
72
|
+
customClass: {
|
73
|
+
type: String,
|
74
|
+
default: ''
|
75
|
+
},
|
76
|
+
// 标题, 也可通过具名 slot (见下表)传入
|
77
|
+
title: {
|
78
|
+
type: String,
|
79
|
+
default: ''
|
80
|
+
},
|
81
|
+
// 标题是否居中显示
|
82
|
+
titleCenter: {
|
83
|
+
type: String,
|
84
|
+
default: false
|
85
|
+
},
|
86
|
+
// header和body内容是否居中显示
|
87
|
+
center: {
|
88
|
+
type: Boolean,
|
89
|
+
default: false
|
90
|
+
},
|
91
|
+
// body的消息图标
|
92
|
+
icon: {
|
93
|
+
type: String
|
94
|
+
},
|
95
|
+
// body的消息内容
|
96
|
+
message: {
|
97
|
+
type: String
|
98
|
+
},
|
99
|
+
// body的消息描述
|
100
|
+
desc: {
|
101
|
+
type: String
|
102
|
+
},
|
103
|
+
// body的消息描述的字体颜色
|
104
|
+
descColor: {
|
105
|
+
type: String
|
106
|
+
},
|
107
|
+
// footer的左下角提示语,绿色字体
|
108
|
+
footerTips: {
|
109
|
+
type: String,
|
110
|
+
default: ''
|
111
|
+
},
|
112
|
+
// 是否显示取消按钮
|
113
|
+
showCancelButton: {
|
114
|
+
type: Boolean,
|
115
|
+
default: true
|
116
|
+
},
|
117
|
+
// 取消按钮的文本内容
|
118
|
+
cancelButtonText: {
|
119
|
+
type: String,
|
120
|
+
default: '取消'
|
121
|
+
},
|
122
|
+
// 取消按钮的文字颜色,默认浅灰色
|
123
|
+
cancelButtonColor: {
|
124
|
+
type: String,
|
125
|
+
default: ''
|
126
|
+
},
|
127
|
+
// 取消按钮是否开启倒计时
|
128
|
+
cancelButtonTime: {
|
129
|
+
type: Number,
|
130
|
+
default: -1
|
131
|
+
},
|
132
|
+
// 是否显示确定按钮
|
133
|
+
showConfirmButton: {
|
134
|
+
type: Boolean,
|
135
|
+
default: true
|
136
|
+
},
|
137
|
+
// 确定按钮的文本内容
|
138
|
+
confirmButtonText: {
|
139
|
+
type: String,
|
140
|
+
default: '确定'
|
141
|
+
},
|
142
|
+
// 确定按钮是否开启倒计时
|
143
|
+
confirmButtonTime: {
|
144
|
+
type: Number,
|
145
|
+
default: -1
|
146
|
+
},
|
147
|
+
fullscreen: {
|
148
|
+
type: Boolean,
|
149
|
+
default: false
|
150
|
+
},
|
151
|
+
// 右上角是否显示关闭按钮
|
152
|
+
showClose: {
|
153
|
+
type: Boolean,
|
154
|
+
default: false
|
155
|
+
},
|
156
|
+
appendToBody: {
|
157
|
+
type: Boolean,
|
158
|
+
default: false
|
159
|
+
},
|
160
|
+
beforeClose: {
|
161
|
+
type: Function
|
162
|
+
},
|
163
|
+
destroyOnClose: {
|
164
|
+
type: Boolean,
|
165
|
+
default: false
|
166
|
+
},
|
167
|
+
modal: {
|
168
|
+
type: Boolean,
|
169
|
+
default: true
|
170
|
+
},
|
171
|
+
openDelay: {
|
172
|
+
type: Number,
|
173
|
+
default: 0
|
174
|
+
},
|
175
|
+
closeDelay: {
|
176
|
+
type: Number,
|
177
|
+
default: 0
|
178
|
+
},
|
179
|
+
modelValue: {
|
180
|
+
type: Boolean,
|
181
|
+
default: false
|
182
|
+
},
|
183
|
+
modalClass: String,
|
184
|
+
width: {
|
185
|
+
type: [String, Number]
|
186
|
+
},
|
187
|
+
zIndex: {
|
188
|
+
type: Number
|
189
|
+
}
|
190
|
+
})
|
191
|
+
const slots = defineSlots()
|
192
|
+
|
193
|
+
// 定义emits
|
194
|
+
const emits = defineEmits(['opened', 'closed', 'close', 'cancel', 'confirm'])
|
195
|
+
|
196
|
+
const [name, bem] = createNamespace('dialog')
|
197
|
+
let cancelTimer = null
|
198
|
+
const cancelTime = ref(-1)
|
199
|
+
let confirmTimer = null
|
200
|
+
const confirmTime = ref(-1)
|
201
|
+
|
202
|
+
// 是否显示弹框
|
203
|
+
const visible = computed({
|
204
|
+
get: () => props.modelValue,
|
205
|
+
set: (value) => {
|
206
|
+
emits('update:modelValue', value)
|
207
|
+
}
|
208
|
+
})
|
209
|
+
|
210
|
+
// 监听弹框显示,开启倒计时
|
211
|
+
watch(visible, (val) => {
|
212
|
+
clearInterval(cancelTimer)
|
213
|
+
if (props.cancelButtonTime > -1 && props.showCancelButton) {
|
214
|
+
if (val) {
|
215
|
+
cancelTime.value = Number(JSON.parse(JSON.stringify(props.cancelButtonTime)))
|
216
|
+
cancelTimer = setInterval(() => {
|
217
|
+
cancelTime.value--
|
218
|
+
if (cancelTime.value <= 0) {
|
219
|
+
clearInterval(cancelTimer)
|
220
|
+
emits('cancel')
|
221
|
+
}
|
222
|
+
}, 1000)
|
223
|
+
} else {
|
224
|
+
clearInterval(cancelTimer)
|
225
|
+
}
|
226
|
+
}
|
227
|
+
clearInterval(confirmTimer)
|
228
|
+
if (props.confirmButtonTime > -1 && props.showConfirmButton) {
|
229
|
+
if (val) {
|
230
|
+
confirmTime.value = Number(JSON.parse(JSON.stringify(props.confirmButtonTime)))
|
231
|
+
confirmTimer = setInterval(() => {
|
232
|
+
confirmTime.value--
|
233
|
+
if (confirmTime.value <= 0) {
|
234
|
+
clearInterval(confirmTimer)
|
235
|
+
emits('confirm')
|
236
|
+
}
|
237
|
+
}, 1000)
|
238
|
+
} else {
|
239
|
+
clearInterval(confirmTimer)
|
240
|
+
}
|
241
|
+
}
|
242
|
+
})
|
243
|
+
|
244
|
+
// 样式
|
245
|
+
const classes = bem([props.customClass, props.size])
|
246
|
+
|
247
|
+
// header的样式
|
248
|
+
const headerClasses = computed(() => {
|
249
|
+
return bem('header')
|
250
|
+
})
|
251
|
+
|
252
|
+
// header的标题样式
|
253
|
+
const headerTitleClasses = computed(() => {
|
254
|
+
return bem('header__title', {
|
255
|
+
center: props.center || props.titleCenter
|
256
|
+
})
|
257
|
+
})
|
258
|
+
|
259
|
+
// body的样式
|
260
|
+
const bodyClasses = bem('body', {
|
261
|
+
center: props.center
|
262
|
+
})
|
263
|
+
|
264
|
+
// footer的样式
|
265
|
+
const footerClasses = computed(() => {
|
266
|
+
return bem('footer', {
|
267
|
+
'has-tips': props.footerTips
|
268
|
+
})
|
269
|
+
})
|
270
|
+
|
271
|
+
function afterEnter() {
|
272
|
+
emits('opened')
|
273
|
+
}
|
274
|
+
|
275
|
+
function afterLeave() {
|
276
|
+
emits('closed')
|
277
|
+
}
|
278
|
+
|
279
|
+
function beforeLeave() {
|
280
|
+
emits('close')
|
281
|
+
}
|
282
|
+
|
283
|
+
// 关闭弹框
|
284
|
+
const handleClose = () => {
|
285
|
+
emits('update:modelValue', false)
|
286
|
+
clearInterval(cancelTimer)
|
287
|
+
clearInterval(confirmTimer)
|
288
|
+
}
|
289
|
+
|
290
|
+
// 点击弹框的取消按钮
|
291
|
+
const handleCancel = () => {
|
292
|
+
clearInterval(cancelTimer)
|
293
|
+
emits('cancel')
|
294
|
+
}
|
295
|
+
|
296
|
+
// 点击弹框的确定按钮
|
297
|
+
const handleConfirm = () => {
|
298
|
+
clearInterval(confirmTimer)
|
299
|
+
emits('confirm')
|
300
|
+
}
|
301
|
+
</script>
|
302
|
+
|
303
|
+
<style lang="scss">
|
304
|
+
@import './index.scss';
|
305
|
+
</style>
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,68 @@
|
|
1
|
+
<!--
|
2
|
+
* @Author: chenghuan.dong
|
3
|
+
* @Date: 2022-12-24 19:25:39
|
4
|
+
* @LastEditors: chenghuan.dong
|
5
|
+
* @LastEditTime: 2023-06-29 18:29:05
|
6
|
+
* @Description: 空页面
|
7
|
+
-->
|
8
|
+
<template>
|
9
|
+
<div class="nb-empty" :class="[!!$slots.default ? bem(['slot']) : '']">
|
10
|
+
<img v-if="icon === 'data'" src="./images/empty-data.png" class="nb-empty-icon" />
|
11
|
+
<img v-else-if="icon === 'abnormal'" src="./images/empty-abnormal.png" class="nb-empty-icon" />
|
12
|
+
<img v-else src="./images/empty-search.png" class="nb-empty-icon" />
|
13
|
+
<p v-if="text" class="nb-empty-text">{{ text }}</p>
|
14
|
+
<slot></slot>
|
15
|
+
</div>
|
16
|
+
</template>
|
17
|
+
<script setup>
|
18
|
+
import { createNamespace } from '../../../utils/create.js'
|
19
|
+
// 定义名称
|
20
|
+
defineOptions({
|
21
|
+
name: 'NbEmpty'
|
22
|
+
})
|
23
|
+
|
24
|
+
// 定义props
|
25
|
+
const props = defineProps({
|
26
|
+
// 定义Props
|
27
|
+
// 提示语
|
28
|
+
text: {
|
29
|
+
type: String,
|
30
|
+
default: ''
|
31
|
+
},
|
32
|
+
// 类型 search data abnormal
|
33
|
+
icon: {
|
34
|
+
type: String,
|
35
|
+
default: 'search',
|
36
|
+
validator(value) {
|
37
|
+
return ['search', 'data', 'abnormal'].includes(value)
|
38
|
+
}
|
39
|
+
}
|
40
|
+
})
|
41
|
+
|
42
|
+
const [name, bem] = createNamespace('empty')
|
43
|
+
</script>
|
44
|
+
|
45
|
+
<style lang="scss" scoped>
|
46
|
+
.nb-empty {
|
47
|
+
display: flex;
|
48
|
+
flex-direction: column;
|
49
|
+
align-items: center;
|
50
|
+
justify-content: center;
|
51
|
+
width: 100%;
|
52
|
+
height: 100%;
|
53
|
+
.nb-empty-icon {
|
54
|
+
width: 500px;
|
55
|
+
height: 500px;
|
56
|
+
}
|
57
|
+
.nb-empty-text {
|
58
|
+
font-size: 32px;
|
59
|
+
line-height: 48px;
|
60
|
+
margin-top: 30px;
|
61
|
+
}
|
62
|
+
&--slot {
|
63
|
+
.nb-empty-text {
|
64
|
+
margin-bottom: 32px;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
</style>
|