zydx-plus 1.4.23 → 1.6.25
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/src/components/buttonGroup/index.js +6 -0
- package/src/components/buttonGroup/src/buttonGroup.vue +215 -0
- package/src/components/tipBox/index.js +7 -9
- package/src/components/tipBox/src/main.vue +23 -2
- package/src/components/tipBox/src/zydxStyle.css +9 -3
- package/src/components/treeList/index.js +6 -0
- package/src/components/treeList/src/treeList.vue +87 -0
- package/src/index.js +12 -3
package/package.json
CHANGED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
|
|
2
|
+
<script>
|
|
3
|
+
import { defineComponent } from 'vue';
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: 'zydx-button-group',
|
|
6
|
+
props: {
|
|
7
|
+
buttons: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
accordian: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
data() {
|
|
17
|
+
return {
|
|
18
|
+
active_state: [],
|
|
19
|
+
is_show_search: false,
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
mounted() {
|
|
23
|
+
this.active_state = this.buttons.map(() => false)
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
trackClick(idx) {
|
|
27
|
+
if (this.accordian) {
|
|
28
|
+
this.active_state = this.active_state.map((_, i) => {
|
|
29
|
+
if (i === idx) {
|
|
30
|
+
return this.active_state[i] = !this.active_state[i]
|
|
31
|
+
} else {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
} else {
|
|
36
|
+
this.active_state[idx] = !this.active_state[idx]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
onInputChange({ event, accept = '*', file_size = 2, cb }) {
|
|
41
|
+
let file = event.target.files[0]
|
|
42
|
+
let accept_list = accept.split(',')
|
|
43
|
+
if (file.size > file_size * 1024 * 1024) {
|
|
44
|
+
this.$messages({
|
|
45
|
+
title: '提示',
|
|
46
|
+
promptContent: `文件大小不能超过${file_size}M`,
|
|
47
|
+
cancelShow: false,
|
|
48
|
+
})
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
if (!accept_list.includes(file.type)) {
|
|
52
|
+
this.$messages({
|
|
53
|
+
title: '提示',
|
|
54
|
+
promptContent: `请选择${accept_list.join('、')}格式的文件`,
|
|
55
|
+
cancelShow: false,
|
|
56
|
+
})
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
cb(file)
|
|
60
|
+
},
|
|
61
|
+
showSearch: function () {
|
|
62
|
+
this.is_show_search = true
|
|
63
|
+
},
|
|
64
|
+
handleClose: function () {
|
|
65
|
+
this.is_show_search = false
|
|
66
|
+
},
|
|
67
|
+
handleSearch: function () {
|
|
68
|
+
this.$emit('search', this.$el.querySelector('.search_input').value)
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
render() {
|
|
72
|
+
const { trackClick, onInputChange, showSearch, handleSearch, handleClose, is_show_search } = this
|
|
73
|
+
const render = ({ type, name, accept = '', file_size, flip = null, onClick, disabled, idx }) => {
|
|
74
|
+
let active_name = flip ? flip : name
|
|
75
|
+
switch (type) {
|
|
76
|
+
case 'button':
|
|
77
|
+
return <button
|
|
78
|
+
class={this.active_state[idx] ? 'z-button active' : 'z-button'}
|
|
79
|
+
onClick={() => { onClick(); trackClick(idx) }
|
|
80
|
+
}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
>
|
|
83
|
+
{this.active_state[idx] ? active_name : name}
|
|
84
|
+
</button>
|
|
85
|
+
case 'file':
|
|
86
|
+
return <label class="z-button">
|
|
87
|
+
<span>{name}</span>
|
|
88
|
+
<input type="file" class="hidden" onClick={(e) => e.target.value = null} onChange={(e) => onInputChange({ event: e, accept, file_size, cb: onClick })}></input>
|
|
89
|
+
</label>
|
|
90
|
+
case 'search':
|
|
91
|
+
return is_show_search
|
|
92
|
+
?
|
|
93
|
+
<div class="search_container">
|
|
94
|
+
<input type="text" class="search_input"></input>
|
|
95
|
+
<div class="icons">
|
|
96
|
+
<span class="search" onClick={handleSearch}>
|
|
97
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="#333" d="m19.6 21l-6.3-6.3q-.75.6-1.725.95Q10.6 16 9.5 16q-2.725 0-4.612-1.887Q3 12.225 3 9.5q0-2.725 1.888-4.613Q6.775 3 9.5 3t4.613 1.887Q16 6.775 16 9.5q0 1.1-.35 2.075q-.35.975-.95 1.725l6.3 6.3ZM9.5 14q1.875 0 3.188-1.312Q14 11.375 14 9.5q0-1.875-1.312-3.188Q11.375 5 9.5 5Q7.625 5 6.312 6.312Q5 7.625 5 9.5q0 1.875 1.312 3.188Q7.625 14 9.5 14Z" /></svg>
|
|
98
|
+
</span>
|
|
99
|
+
<span class="separator"></span>
|
|
100
|
+
<span class="close" onClick={handleClose}>
|
|
101
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="#333" d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6Z" /></svg>
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
: <button
|
|
106
|
+
class="z-button"
|
|
107
|
+
onClick={showSearch}
|
|
108
|
+
>
|
|
109
|
+
{name}
|
|
110
|
+
</button>
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return (
|
|
114
|
+
<div class="z-button-group">
|
|
115
|
+
{
|
|
116
|
+
this.buttons
|
|
117
|
+
.map(({ onClick, disabled, file_size, accept, flip, type = "button", name }, idx) => {
|
|
118
|
+
return render({ type, name, accept, file_size, flip, onClick, disabled, idx })
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<style scoped>
|
|
129
|
+
.z-button-group {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
width: auto;
|
|
134
|
+
height: 30px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.z-button {
|
|
138
|
+
margin: 1px;
|
|
139
|
+
width: auto;
|
|
140
|
+
min-width: 60px;
|
|
141
|
+
max-width: 60px;
|
|
142
|
+
text-overflow: ellipsis;
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
height: 20px;
|
|
146
|
+
background-color: #FFFFFF;
|
|
147
|
+
color: #000000;
|
|
148
|
+
border: #000000 1px solid;
|
|
149
|
+
line-height: 18px;
|
|
150
|
+
border-radius: 3px;
|
|
151
|
+
font-size: 12px !important;
|
|
152
|
+
letter-spacing: 0px !important;
|
|
153
|
+
text-align: center;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
padding: 0 5px;
|
|
156
|
+
font-weight: normal;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.search_container {
|
|
160
|
+
width: 180px;
|
|
161
|
+
height: 20px;
|
|
162
|
+
border: 1px solid #ccc;
|
|
163
|
+
border-radius: 2px;
|
|
164
|
+
padding-right: 40px;
|
|
165
|
+
display: flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
position: relative;
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.search_container .icons {
|
|
172
|
+
position: absolute;
|
|
173
|
+
right: 0;
|
|
174
|
+
top: 0;
|
|
175
|
+
height: 18px;
|
|
176
|
+
width: 40px;
|
|
177
|
+
gap: 3px;
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.search_container .icons .separator {
|
|
183
|
+
width: 1px;
|
|
184
|
+
height: 14px;
|
|
185
|
+
background-color: #ccc;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.search_container .icons .search,
|
|
189
|
+
.search_container .icons .close {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
cursor: pointer;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.search_input {
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 18px;
|
|
199
|
+
border: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.z-button.active {
|
|
203
|
+
color: #00ff00 !important;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.z-button:disabled {
|
|
207
|
+
background-color: #ffffff;
|
|
208
|
+
color: #717171;
|
|
209
|
+
border: #717171 1px solid;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.hidden {
|
|
213
|
+
display: none;
|
|
214
|
+
}
|
|
215
|
+
</style>
|
|
@@ -13,16 +13,14 @@ const Confirm = ({ type, url ,title, promptContent, middle, cancelShow, inputArr
|
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
14
|
// 2. 点击确认按钮,触发resolve同时销毁组件
|
|
15
15
|
const submit = () => {
|
|
16
|
-
let val =
|
|
16
|
+
let val = []
|
|
17
17
|
if(type === 'input') {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return x.selectValue
|
|
25
|
-
})
|
|
18
|
+
for(let i=0; i< inputArr.length; i++) {
|
|
19
|
+
if(inputArr[i].type === 'input' || inputArr[i].type === 'calender') {
|
|
20
|
+
val.push(inputArr[i].value)
|
|
21
|
+
}else {
|
|
22
|
+
val.push(inputArr[i].selectValue)
|
|
23
|
+
}
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
render(null, container)
|
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
<div class="tip-input" v-for="(item,index) in inputArr" :key="index">
|
|
16
16
|
<span>{{ item.name }}</span>
|
|
17
17
|
<input v-if="item.type === 'input'" type="text" :placeholder="item.placeholder" v-model="item.value" :disabled="item.disabled" />
|
|
18
|
-
<
|
|
18
|
+
<div style="display: inline-block;">
|
|
19
|
+
<Select v-if="item.type === 'select'" :options="item.option" v-model:value="item.selectValue"></Select>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="cal" v-if="item.type === 'calender'">
|
|
22
|
+
<input type="text" :placeholder="item.placeholder" @focus="focus" v-model="item.value" :disabled="item.disabled" />
|
|
23
|
+
<Calendar v-if="tip" style="top: 35px;" @confirm="confirm($event,item)"></Calendar>
|
|
24
|
+
</div>
|
|
19
25
|
<div v-if="item.type === 'text'" class="text">{{ item.value }}</div>
|
|
20
26
|
</div>
|
|
21
27
|
</div>
|
|
@@ -32,9 +38,15 @@
|
|
|
32
38
|
|
|
33
39
|
<script>
|
|
34
40
|
import Select from '../../select/src/select.vue'
|
|
41
|
+
import Calendar from '../../calendar/src/Calendar'
|
|
35
42
|
export default {
|
|
36
43
|
name: 'zydx-tip-box',
|
|
37
|
-
components: {Select},
|
|
44
|
+
components: {Select,Calendar},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
tip: false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
38
50
|
props: {
|
|
39
51
|
type: { // 弹窗的提示标题
|
|
40
52
|
type: String,
|
|
@@ -73,6 +85,15 @@ export default {
|
|
|
73
85
|
type: Function,
|
|
74
86
|
default: () => {}
|
|
75
87
|
}
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
focus() {
|
|
91
|
+
this.tip = true
|
|
92
|
+
},
|
|
93
|
+
confirm(e,data) {
|
|
94
|
+
data.value = e.start
|
|
95
|
+
this.tip = false
|
|
96
|
+
},
|
|
76
97
|
}
|
|
77
98
|
}
|
|
78
99
|
</script>
|
|
@@ -100,14 +100,16 @@ font-size: 12px;
|
|
|
100
100
|
line-height: 30px;
|
|
101
101
|
padding-right: 10px;
|
|
102
102
|
}
|
|
103
|
-
.tip-input
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
103
|
+
.tip-input input{
|
|
104
|
+
width: 211px;
|
|
105
|
+
height: 32px;
|
|
106
106
|
box-sizing: border-box;
|
|
107
107
|
font-size: 16px;
|
|
108
108
|
outline: none;
|
|
109
109
|
padding-left: 10px;
|
|
110
110
|
border: 1px solid #ccc;
|
|
111
|
+
border-radius: 3px;
|
|
112
|
+
box-shadow: 0 1px 0 1px rgb(0 0 0 / 4%);
|
|
111
113
|
}
|
|
112
114
|
.tip-input>select{
|
|
113
115
|
width: 210px;
|
|
@@ -124,3 +126,7 @@ font-size: 12px;
|
|
|
124
126
|
width: 210px;
|
|
125
127
|
text-align: left;
|
|
126
128
|
}
|
|
129
|
+
.cal{
|
|
130
|
+
display: inline-block;
|
|
131
|
+
position: relative;
|
|
132
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="list">
|
|
3
|
+
<div class="list-cont">
|
|
4
|
+
<div class="list-li" @click="listTap(item,index)" :class="{'list-active': active === index}" v-for="(item,index) in list" :key="index">
|
|
5
|
+
<div class="list-title">
|
|
6
|
+
<span>{{ index + 1 }}. {{ item[column[0].label] }}</span>
|
|
7
|
+
<button v-if="delShow" @click="del(item)">删除</button>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="list-li-cont" v-if="active === index">
|
|
10
|
+
<p v-for="(it,ind) in column.slice(1, column.length)" :key="ind">{{ it.name }}:{{ item[it.label] }}</p>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: "zydx-tree-list",
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
active: 0,
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
list: { // 数据列表
|
|
27
|
+
type: Array,
|
|
28
|
+
default: () => []
|
|
29
|
+
},
|
|
30
|
+
column: { // 数据列表
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
delShow: { //是否显示取消按钮
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
del() {
|
|
41
|
+
this.$emit('del',data)
|
|
42
|
+
},
|
|
43
|
+
listTap(data,index) {
|
|
44
|
+
this.active = index
|
|
45
|
+
this.$emit('confirm',data)
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style scoped>
|
|
52
|
+
.list-title{
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
line-height: 30px;
|
|
56
|
+
}
|
|
57
|
+
.list-title>span{
|
|
58
|
+
flex: 1;
|
|
59
|
+
}
|
|
60
|
+
.list-title>button{
|
|
61
|
+
margin-left: 5px;
|
|
62
|
+
margin-top: 4px;
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
background-color: transparent;
|
|
65
|
+
border: 1px solid #000;
|
|
66
|
+
border-radius: 3px;
|
|
67
|
+
padding: 2px 5px;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
height: 22px;
|
|
70
|
+
min-width: 60px;
|
|
71
|
+
}
|
|
72
|
+
.list{
|
|
73
|
+
padding: 0 10px;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
}
|
|
76
|
+
.list-li>span{
|
|
77
|
+
font-size: 16px;
|
|
78
|
+
line-height: 30px;
|
|
79
|
+
}
|
|
80
|
+
.list-li-cont{
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
padding-left: 10px;
|
|
83
|
+
}
|
|
84
|
+
.list-active{
|
|
85
|
+
color: #e20808;
|
|
86
|
+
}
|
|
87
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -8,6 +8,9 @@ import Pagination from './components/pagination/index';
|
|
|
8
8
|
import Select from './components/select/index';
|
|
9
9
|
import Year from './components/year/index';
|
|
10
10
|
import Table from './components/data_table/index';
|
|
11
|
+
import buttonGroup from './components/buttonGroup/index';
|
|
12
|
+
import spinner from './components/spinner/index';
|
|
13
|
+
import treeList from './components/treeList/index';
|
|
11
14
|
|
|
12
15
|
const components = [
|
|
13
16
|
Calendar,
|
|
@@ -18,7 +21,9 @@ const components = [
|
|
|
18
21
|
Pagination,
|
|
19
22
|
Select,
|
|
20
23
|
Year,
|
|
21
|
-
Table
|
|
24
|
+
Table,
|
|
25
|
+
buttonGroup,
|
|
26
|
+
treeList
|
|
22
27
|
];
|
|
23
28
|
|
|
24
29
|
function install(app) {
|
|
@@ -26,13 +31,15 @@ function install(app) {
|
|
|
26
31
|
app.component(component.name, component);
|
|
27
32
|
});
|
|
28
33
|
app.config.globalProperties.$message = Message
|
|
34
|
+
app.config.globalProperties.$spinner = spinner
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
export default {
|
|
32
|
-
version: '1.
|
|
38
|
+
version: '1.6.25',
|
|
33
39
|
install,
|
|
34
40
|
Calendar,
|
|
35
41
|
Message,
|
|
42
|
+
spinner,
|
|
36
43
|
Switch,
|
|
37
44
|
menuTree,
|
|
38
45
|
coloring,
|
|
@@ -40,6 +47,8 @@ export default {
|
|
|
40
47
|
Pagination,
|
|
41
48
|
Select,
|
|
42
49
|
Year,
|
|
43
|
-
Table
|
|
50
|
+
Table,
|
|
51
|
+
buttonGroup,
|
|
52
|
+
treeList
|
|
44
53
|
};
|
|
45
54
|
|