hbte-saas-ui 0.0.1
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/.browserslistrc +3 -0
- package/.editorconfig +7 -0
- package/.env.development +1 -0
- package/.env.lib +1 -0
- package/.eslintrc.js +14 -0
- package/.prettierrc +3 -0
- package/README.md +53 -0
- package/babel.config.js +3 -0
- package/docs/.vuepress/config.js +23 -0
- package/docs/.vuepress/styles/index.styl +4 -0
- package/docs/AdvQuery.md +26 -0
- package/docs/CustomQuery.md +21 -0
- package/docs/EditArea.md +16 -0
- package/docs/FilterDrop.md +29 -0
- package/docs/FullTable.md +68 -0
- package/docs/Pagination.md +22 -0
- package/docs/QueryForm.md +27 -0
- package/docs/README.md +17 -0
- package/docs/Table.md +58 -0
- package/docs/ToolGroup.md +32 -0
- package/examples/App.vue +97 -0
- package/examples/image/hb-image-viewer/3k.jpg +0 -0
- package/examples/image/hb-image-viewer/a.jpg +0 -0
- package/examples/image/hb-image-viewer/b.jpg +0 -0
- package/examples/main.js +39 -0
- package/examples/mock/authority.js +1108 -0
- package/examples/mock/dept.js +4001 -0
- package/examples/mock/fulltable.js +407 -0
- package/examples/mock/organizeData.js +18965 -0
- package/examples/router/index.js +111 -0
- package/examples/views/ElementCpTest.vue +299 -0
- package/examples/views/Fragment.vue +196 -0
- package/examples/views/HBAdvQuery.vue +150 -0
- package/examples/views/HBAuthority.vue +339 -0
- package/examples/views/HBDialog.vue +39 -0
- package/examples/views/HBEditarea.vue +350 -0
- package/examples/views/HBFilterDrop.vue +72 -0
- package/examples/views/HBFloatFooter.vue +42 -0
- package/examples/views/HBFullTable.vue +751 -0
- package/examples/views/HBImageViewer.vue +57 -0
- package/examples/views/HBNavMenu.vue +37 -0
- package/examples/views/HBOrganizeDialog.vue +133 -0
- package/examples/views/HBPagination.vue +80 -0
- package/examples/views/HBSelectVague.vue +57 -0
- package/examples/views/HBToolgroup.vue +29 -0
- package/examples/views/HBTopBar.vue +16 -0
- package/lib/demo.html +10 -0
- package/lib/fonts/iconfont.9e99af35.ttf +0 -0
- package/lib/hbte-ui.common.js +38291 -0
- package/lib/hbte-ui.css +1 -0
- package/lib/hbte-ui.umd.js +38301 -0
- package/lib/hbte-ui.umd.min.js +21 -0
- package/lib/img/nodata.f87d17c1.png +0 -0
- package/lib/img/user-logo--default.a53bd193.png +0 -0
- package/package.json +40 -0
- package/packages/adv-query/index.js +5 -0
- package/packages/adv-query/src/main.vue +294 -0
- package/packages/area-select/index.js +7 -0
- package/packages/area-select/src/main.vue +37 -0
- package/packages/authority/index.js +5 -0
- package/packages/authority/src/main.vue +606 -0
- package/packages/config.js +3 -0
- package/packages/custom-query/index.js +5 -0
- package/packages/custom-query/src/main.vue +80 -0
- package/packages/dialog/index.js +7 -0
- package/packages/dialog/src/main.vue +176 -0
- package/packages/edit-area/index.js +13 -0
- package/packages/edit-area/src/config.js +3 -0
- package/packages/edit-area/src/main.vue +304 -0
- package/packages/edit-area/src/simulateEvent.js +219 -0
- package/packages/filter-drop/index.js +6 -0
- package/packages/filter-drop/src/main.vue +107 -0
- package/packages/float-footer/index.js +7 -0
- package/packages/float-footer/src/main.vue +40 -0
- package/packages/fragment/index.js +7 -0
- package/packages/fragment/src/main.vue +74 -0
- package/packages/fragment/src/old.vue +144 -0
- package/packages/full-table/index.js +6 -0
- package/packages/full-table/src/config.js +14 -0
- package/packages/full-table/src/main.vue +141 -0
- package/packages/image-viewer/index.js +8 -0
- package/packages/image-viewer/src/main.js +14 -0
- package/packages/image-viewer/src/main.vue +138 -0
- package/packages/image-viewer/src/svg/cancel.svg +2 -0
- package/packages/image-viewer/src/svg/delete.svg +2 -0
- package/packages/image-viewer/src/svg/download.svg +2 -0
- package/packages/image-viewer/src/svg/rotate.svg +77 -0
- package/packages/image-viewer/src/svg/scaledown.svg +71 -0
- package/packages/image-viewer/src/svg/scaleup.svg +72 -0
- package/packages/index.js +43 -0
- package/packages/nav-menu/index.js +7 -0
- package/packages/nav-menu/src/main.vue +277 -0
- package/packages/organize-dialog/index.js +5 -0
- package/packages/organize-dialog/src/main.vue +427 -0
- package/packages/pagination/index.js +6 -0
- package/packages/pagination/src/main.vue +145 -0
- package/packages/query-form/index.js +5 -0
- package/packages/query-form/src/main.vue +142 -0
- package/packages/select-vague/index.js +5 -0
- package/packages/select-vague/src/main.vue +80 -0
- package/packages/table/index.js +5 -0
- package/packages/table/src/main.vue +265 -0
- package/packages/theme-chalk/adv-query.scss +107 -0
- package/packages/theme-chalk/authority.scss +103 -0
- package/packages/theme-chalk/common/elementCover.scss +722 -0
- package/packages/theme-chalk/common/flex.scss +66 -0
- package/packages/theme-chalk/common/global.scss +147 -0
- package/packages/theme-chalk/common/reset.scss +92 -0
- package/packages/theme-chalk/common/var.scss +46 -0
- package/packages/theme-chalk/custom-query.scss +10 -0
- package/packages/theme-chalk/dialog.scss +9 -0
- package/packages/theme-chalk/edit-area.scss +119 -0
- package/packages/theme-chalk/filter-drop.scss +81 -0
- package/packages/theme-chalk/float-footer.scss +14 -0
- package/packages/theme-chalk/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/fragment.scss +51 -0
- package/packages/theme-chalk/full-table.scss +40 -0
- package/packages/theme-chalk/icon.scss +96 -0
- package/packages/theme-chalk/image-viewer.scss +94 -0
- package/packages/theme-chalk/images/company-logo--default.png +0 -0
- package/packages/theme-chalk/images/nodata.png +0 -0
- package/packages/theme-chalk/images/user-logo--default.png +0 -0
- package/packages/theme-chalk/index.scss +21 -0
- package/packages/theme-chalk/nav-menu.scss +205 -0
- package/packages/theme-chalk/organize-dialog.scss +170 -0
- package/packages/theme-chalk/pagination.scss +91 -0
- package/packages/theme-chalk/select.scss +8 -0
- package/packages/theme-chalk/table.scss +102 -0
- package/packages/theme-chalk/tool-group.scss +105 -0
- package/packages/theme-chalk/top-bar.scss +195 -0
- package/packages/tool-group/index.js +13 -0
- package/packages/tool-group/src/config.js +40 -0
- package/packages/tool-group/src/main.vue +93 -0
- package/packages/top-bar/index.js +7 -0
- package/packages/top-bar/src/main.vue +280 -0
- package/public/index.html +20 -0
- package/vue.config.js +6 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 事件模拟工具
|
|
3
|
+
* 提供给编辑控件使用,处理一些常规控件无法处理的情景
|
|
4
|
+
* 目前仅支持focus和tap
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// 配置
|
|
8
|
+
const CONFIG = {
|
|
9
|
+
/** 忽略以下class,避免类似点击elementUI的select下拉浮层时触发到事件 */
|
|
10
|
+
ignoreClass: [
|
|
11
|
+
"el-popper", // body上弹窗
|
|
12
|
+
"el-select-dropdown", // 下拉弹窗
|
|
13
|
+
"el-form-item__content", // input控件区域
|
|
14
|
+
],
|
|
15
|
+
/** tap判断最大距离(px)和时间(ms) */
|
|
16
|
+
tapMaxRange: 45,
|
|
17
|
+
tapMaxTime: 300,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// 事件数组队列管理
|
|
21
|
+
const MANAGER = {
|
|
22
|
+
focus: {
|
|
23
|
+
queue: [
|
|
24
|
+
// {
|
|
25
|
+
// el: div,
|
|
26
|
+
// events: [...callback]
|
|
27
|
+
// }
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
tap: {
|
|
31
|
+
queue: [],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 模拟focus,情景为点击绑定节点及其子节点之外的地方时触发
|
|
37
|
+
* 解决部分elementUI控件不支持focus事件,以及change、blur事件异常的问题
|
|
38
|
+
*/
|
|
39
|
+
const eventFocus = function (e) {
|
|
40
|
+
let tempNode = e.target;
|
|
41
|
+
const nodeList = MANAGER.focus.queue.map((item) => item.el);
|
|
42
|
+
while (tempNode.nodeName !== "HTML") {
|
|
43
|
+
let partenIndex;
|
|
44
|
+
if (
|
|
45
|
+
nodeList.find((item, index) => {
|
|
46
|
+
partenIndex = index;
|
|
47
|
+
return tempNode === item;
|
|
48
|
+
})
|
|
49
|
+
) {
|
|
50
|
+
// 点击到了目标节点内部取消触发
|
|
51
|
+
nodeList.splice(partenIndex, 1);
|
|
52
|
+
} else if (CONFIG.ignoreClass.find((str) => tempNode.className.indexOf(str) !== -1)) {
|
|
53
|
+
// 忽略指定节点
|
|
54
|
+
return;
|
|
55
|
+
} else {
|
|
56
|
+
// 未找到该class继续往上找
|
|
57
|
+
tempNode = tempNode.parentNode;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// 递归到html结束循环,剩余没有匹配到的节点触发事件
|
|
61
|
+
MANAGER.focus.queue.forEach((item) => {
|
|
62
|
+
if (nodeList.indexOf(item.el) !== -1) {
|
|
63
|
+
item.events.forEach((fn) => fn(e));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 模拟tap,情景为点击时间小于指定毫秒,以及移动距离不超过指定像素时触发
|
|
70
|
+
* 解决输入时选择文本移动到了节点之外的情景
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
const tapCache = {
|
|
74
|
+
listen: false,
|
|
75
|
+
startX: null,
|
|
76
|
+
moveX: null,
|
|
77
|
+
startY: null,
|
|
78
|
+
moveY: null,
|
|
79
|
+
startTime: null,
|
|
80
|
+
moveTime: null,
|
|
81
|
+
};
|
|
82
|
+
const eventTapMouseDown = function (e) {
|
|
83
|
+
tapCache.listen = true;
|
|
84
|
+
tapCache.startX = e.clientX;
|
|
85
|
+
tapCache.startY = e.clientY;
|
|
86
|
+
tapCache.startTime = Date.now();
|
|
87
|
+
tapCache.moveX = 0;
|
|
88
|
+
tapCache.moveY = 0;
|
|
89
|
+
tapCache.moveTime = 0;
|
|
90
|
+
};
|
|
91
|
+
const eventTapMouseMove = function (e) {
|
|
92
|
+
if (tapCache.listen) {
|
|
93
|
+
tapCache.moveX = e.clientX - tapCache.startX;
|
|
94
|
+
tapCache.moveY = e.clientY - tapCache.startY;
|
|
95
|
+
tapCache.moveTime = Date.now() - tapCache.startTime;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const eventTapMouseUp = function (e) {
|
|
99
|
+
if (tapCache.listen) {
|
|
100
|
+
const moveX = tapCache.moveX;
|
|
101
|
+
const moveY = tapCache.moveY;
|
|
102
|
+
const moveTime = tapCache.moveTime;
|
|
103
|
+
if (
|
|
104
|
+
Math.abs(moveX) <= CONFIG.tapMaxRange &&
|
|
105
|
+
Math.abs(moveY) <= CONFIG.tapMaxRange &&
|
|
106
|
+
Math.abs(moveTime) <= CONFIG.tapMaxTime
|
|
107
|
+
) {
|
|
108
|
+
// 查找事件源节点或者其父节点,是否存在于队列之中
|
|
109
|
+
let tempNode = e.target;
|
|
110
|
+
const nodeList = [tempNode];
|
|
111
|
+
if (tempNode.nodeName !== "HTML") {
|
|
112
|
+
do {
|
|
113
|
+
tempNode = tempNode.parentNode;
|
|
114
|
+
nodeList.push(tempNode);
|
|
115
|
+
} while (tempNode.nodeName !== "HTML");
|
|
116
|
+
}
|
|
117
|
+
// 执行点击到的事件队列
|
|
118
|
+
MANAGER.tap.queue.forEach((item) => {
|
|
119
|
+
if (nodeList.indexOf(item.el) !== -1) {
|
|
120
|
+
item.events.forEach((fn) => fn(e));
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// 重置
|
|
125
|
+
tapCache.listen = false;
|
|
126
|
+
tapCache.startX = null;
|
|
127
|
+
tapCache.moveX = null;
|
|
128
|
+
tapCache.startY = null;
|
|
129
|
+
tapCache.moveY = null;
|
|
130
|
+
tapCache.startTime = null;
|
|
131
|
+
tapCache.moveTime = null;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 队列绑定与解绑
|
|
137
|
+
*/
|
|
138
|
+
const bindEvent = function (event, node, fn) {
|
|
139
|
+
if (!Object.prototype.hasOwnProperty.call(MANAGER, event)) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
const targetEvent = MANAGER[event];
|
|
143
|
+
if (node && typeof node === "object" && typeof fn === "function") {
|
|
144
|
+
// 推入事件队列
|
|
145
|
+
let targetNode = targetEvent.queue.find((item) => item.el === node);
|
|
146
|
+
if (!targetNode) {
|
|
147
|
+
targetNode = {
|
|
148
|
+
el: node,
|
|
149
|
+
events: [fn],
|
|
150
|
+
};
|
|
151
|
+
targetEvent.queue.push(targetNode);
|
|
152
|
+
}
|
|
153
|
+
let targetFn = targetNode.events.find((item) => item === fn);
|
|
154
|
+
if (!targetFn) {
|
|
155
|
+
targetNode.events.push(fn);
|
|
156
|
+
targetFn = fn;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const unBindEvent = function (event, node, fn) {
|
|
161
|
+
if (!Object.prototype.hasOwnProperty.call(MANAGER, event)) {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
const targetEvent = MANAGER[event];
|
|
165
|
+
if (arguments.length === 1) {
|
|
166
|
+
// 不传参数表示全部移除
|
|
167
|
+
targetEvent.queue = [];
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (node && typeof node === "object") {
|
|
171
|
+
let targetNode = targetEvent.queue.find((item) => item.el === node);
|
|
172
|
+
if (targetNode) {
|
|
173
|
+
if (arguments.length === 2) {
|
|
174
|
+
// 不传fn表示移除所有事件
|
|
175
|
+
targetNode.events = [];
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (typeof fn === "function") {
|
|
179
|
+
// 移除指定fn
|
|
180
|
+
targetNode.events = targetNode.events.filter((item) => item !== fn);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 初始化,在html上绑定focus
|
|
188
|
+
*/
|
|
189
|
+
const init = function () {
|
|
190
|
+
const htmlNode = document.getElementsByTagName("html")[0];
|
|
191
|
+
// 初始化tap
|
|
192
|
+
htmlNode.addEventListener("mousedown", eventTapMouseDown);
|
|
193
|
+
htmlNode.addEventListener("mousemove", eventTapMouseMove);
|
|
194
|
+
htmlNode.addEventListener("mouseup", eventTapMouseUp);
|
|
195
|
+
// 初始化focus
|
|
196
|
+
bindEvent("tap", htmlNode, eventFocus); // 使用tap代理click
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
init();
|
|
200
|
+
|
|
201
|
+
// 提供给外部
|
|
202
|
+
// window.__simulateEvent__ = {
|
|
203
|
+
// bindFocus,
|
|
204
|
+
// unBindFocus,
|
|
205
|
+
// bindTap,
|
|
206
|
+
// unBindTap,
|
|
207
|
+
// };
|
|
208
|
+
export const bindFocus = function (node, fn) {
|
|
209
|
+
return bindEvent("focus", node, fn);
|
|
210
|
+
};
|
|
211
|
+
export const unBindFocus = function (node, fn) {
|
|
212
|
+
return unBindEvent("focus", node, fn);
|
|
213
|
+
};
|
|
214
|
+
export const bindTap = function (node, fn) {
|
|
215
|
+
return bindEvent("tap", node, fn);
|
|
216
|
+
};
|
|
217
|
+
export const unBindTap = function (node, fn) {
|
|
218
|
+
return unBindEvent("tap", node, fn);
|
|
219
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="hb-filterdrop"
|
|
4
|
+
:class="disabledFilter ? 'hb-filterdrop--disabled' : ''"
|
|
5
|
+
>
|
|
6
|
+
<el-dropdown
|
|
7
|
+
ref="dropdown"
|
|
8
|
+
trigger="click"
|
|
9
|
+
:placement="placement"
|
|
10
|
+
:indeterminate="true"
|
|
11
|
+
:hide-on-click="false"
|
|
12
|
+
@visible-change="visibleEvent"
|
|
13
|
+
>
|
|
14
|
+
<span class="changeData">
|
|
15
|
+
<slot name="dropdown"> </slot>
|
|
16
|
+
</span>
|
|
17
|
+
<el-dropdown-menu
|
|
18
|
+
slot="dropdown"
|
|
19
|
+
class="hb-filterdrop__dropdown-selectMenu"
|
|
20
|
+
>
|
|
21
|
+
<DragAble
|
|
22
|
+
class="hb-filterdrop__main-darggable"
|
|
23
|
+
v-model="checkList"
|
|
24
|
+
infinite-scroll-immediate="false"
|
|
25
|
+
infinite-scroll-disabled="false"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="hb-filterdrop__darggable-selectItem"
|
|
29
|
+
:style="{ display: item.always ? 'none' : '' }"
|
|
30
|
+
v-for="(item, index) in checkList"
|
|
31
|
+
:key="index"
|
|
32
|
+
>
|
|
33
|
+
<el-checkbox
|
|
34
|
+
class="hb-filterdrop__custom-drop-checkbox"
|
|
35
|
+
v-if="item.currentSelect !== undefined"
|
|
36
|
+
v-model="item.currentSelect"
|
|
37
|
+
>
|
|
38
|
+
{{ item.label }}
|
|
39
|
+
</el-checkbox>
|
|
40
|
+
</div>
|
|
41
|
+
</DragAble>
|
|
42
|
+
|
|
43
|
+
<div class="hb-filterdrop__custom-dropdown-btn">
|
|
44
|
+
<el-button :loading="loading" type="primary" @click="save"
|
|
45
|
+
>保存</el-button
|
|
46
|
+
>
|
|
47
|
+
<el-button @click="close">取消</el-button>
|
|
48
|
+
</div>
|
|
49
|
+
</el-dropdown-menu>
|
|
50
|
+
</el-dropdown>
|
|
51
|
+
<div class="hb-filterdrop__cover" v-if="disabledFilter"></div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
import dragable from "vuedraggable";
|
|
57
|
+
export default {
|
|
58
|
+
name: "HbFilterdrop",
|
|
59
|
+
componentName: "HbFilterdrop",
|
|
60
|
+
inheritAttrs: false,
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
checkList: [],
|
|
64
|
+
loading: false,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
props: {
|
|
68
|
+
// 列配置
|
|
69
|
+
columns: {
|
|
70
|
+
type: Array,
|
|
71
|
+
default: () => [],
|
|
72
|
+
},
|
|
73
|
+
// 弹出位置 同element
|
|
74
|
+
placement: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: "bottom-end",
|
|
77
|
+
},
|
|
78
|
+
// 是否禁用
|
|
79
|
+
disabledFilter: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
save() {
|
|
86
|
+
this.$emit("columnsChange", this.checkList);
|
|
87
|
+
this.$refs.dropdown.hide();
|
|
88
|
+
},
|
|
89
|
+
close() {
|
|
90
|
+
this.$refs.dropdown.hide();
|
|
91
|
+
},
|
|
92
|
+
onOpen() {
|
|
93
|
+
this.checkList = this.$lodash.cloneDeep(this.columns);
|
|
94
|
+
},
|
|
95
|
+
onClose() {
|
|
96
|
+
//还原list
|
|
97
|
+
this.checkList = this.$lodash.cloneDeep(this.columns);
|
|
98
|
+
},
|
|
99
|
+
visibleEvent(e) {
|
|
100
|
+
e ? this.onOpen() : null;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
components: {
|
|
104
|
+
DragAble: dragable,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hb-float-footer" :style="{ zIndex }">
|
|
3
|
+
<slot name="footer">
|
|
4
|
+
<el-button @click="exist">{{ label.exist }}</el-button>
|
|
5
|
+
<el-button @click="confirm" type="primary">{{ label.confirm }}</el-button>
|
|
6
|
+
</slot>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: "HbFloatFooter",
|
|
12
|
+
componentName: "HbFloatFooter",
|
|
13
|
+
data() {
|
|
14
|
+
return {};
|
|
15
|
+
},
|
|
16
|
+
methods: {
|
|
17
|
+
confirm() {
|
|
18
|
+
this.$emit("confirm");
|
|
19
|
+
},
|
|
20
|
+
exist() {
|
|
21
|
+
this.$emit("exist");
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
label: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => {
|
|
28
|
+
return {
|
|
29
|
+
confirm: "确定",
|
|
30
|
+
exist: "取消",
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
zIndex: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 100,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//借鑫哥组件edit-area重写的碎片化编辑
|
|
2
|
+
<template>
|
|
3
|
+
<div class="hb-fragment">
|
|
4
|
+
<el-row :gutter="20" class="hb-fragment__layout">
|
|
5
|
+
<el-col
|
|
6
|
+
:lg="{ span: item.entireLine ? 24 : '4-8' }"
|
|
7
|
+
:sm="{ span: item.entireLine ? 24 : 8 }"
|
|
8
|
+
:xs="{ span: item.entireLine ? 24 : 12 }"
|
|
9
|
+
:style="{ paddingBottom }"
|
|
10
|
+
v-for="(item, index) in detailData"
|
|
11
|
+
:key="index"
|
|
12
|
+
>
|
|
13
|
+
<p class="hb-fragment__title">{{ item.name }}</p>
|
|
14
|
+
<!-- <div :class="{ 'text-overflow': !entireLine }" :title="value">
|
|
15
|
+
<a
|
|
16
|
+
v-if="item.hyperLink && item.value"
|
|
17
|
+
:href="
|
|
18
|
+
item.value.includes('http') || item.value.includes('https')
|
|
19
|
+
? item.value
|
|
20
|
+
: '//' + item.value
|
|
21
|
+
"
|
|
22
|
+
target="_blank"
|
|
23
|
+
>{{ item.value || "---" }}</a
|
|
24
|
+
>
|
|
25
|
+
<span v-esle>
|
|
26
|
+
{{ item.value || "---" }}
|
|
27
|
+
</span>
|
|
28
|
+
</div> -->
|
|
29
|
+
<div class="hb-fragment__value">
|
|
30
|
+
<div v-if="item.edit">
|
|
31
|
+
{{ item.value || "---" }}
|
|
32
|
+
</div>
|
|
33
|
+
<hb-editarea
|
|
34
|
+
v-else
|
|
35
|
+
:type="item.type"
|
|
36
|
+
:value.sync="item.value"
|
|
37
|
+
:validate="item.validate"
|
|
38
|
+
:insert="item.insert"
|
|
39
|
+
:change="item.change"
|
|
40
|
+
:optList="item.optList"
|
|
41
|
+
:multiple="item.multiple"
|
|
42
|
+
>
|
|
43
|
+
</hb-editarea>
|
|
44
|
+
</div>
|
|
45
|
+
</el-col>
|
|
46
|
+
</el-row>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
export default {
|
|
52
|
+
name: "HbFragment",
|
|
53
|
+
componentName: "HbFragment",
|
|
54
|
+
props: {
|
|
55
|
+
//传入的接口数据,需要处理为统一字段格式
|
|
56
|
+
detailData: {
|
|
57
|
+
type: Array,
|
|
58
|
+
default: () => [],
|
|
59
|
+
},
|
|
60
|
+
//布局下padding
|
|
61
|
+
paddingBottom: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "20px",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
data() {
|
|
67
|
+
return {};
|
|
68
|
+
},
|
|
69
|
+
mounted() {},
|
|
70
|
+
methods: {},
|
|
71
|
+
};
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style></style>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="hb-fragment background"
|
|
4
|
+
ref="fragment"
|
|
5
|
+
:style="{ paddingBottom }"
|
|
6
|
+
@dblclick="startEdit"
|
|
7
|
+
@mouseenter="iconShow = true"
|
|
8
|
+
@mouseleave="iconShow = false"
|
|
9
|
+
>
|
|
10
|
+
<span class="hb-fragment__title">
|
|
11
|
+
{{ fragObj.title }}
|
|
12
|
+
</span>
|
|
13
|
+
<span
|
|
14
|
+
><i class="el-icon-edit" v-show="iconShow && !edit && disabled"></i
|
|
15
|
+
></span>
|
|
16
|
+
<el-tooltip effect="dark" :content="fragObj.show" placement="top-start">
|
|
17
|
+
<div class="hb-fragment__value" v-if="!edit && disabled">
|
|
18
|
+
{{ editType == "input" ? fragObj.value : fragObj.show }}
|
|
19
|
+
</div>
|
|
20
|
+
</el-tooltip>
|
|
21
|
+
<div class="hb-fragment__value--writable" v-if="edit && disabled">
|
|
22
|
+
<slot :name="fragObj.key">
|
|
23
|
+
<el-input
|
|
24
|
+
v-if="editType == 'input'"
|
|
25
|
+
v-model="fragObj.value"
|
|
26
|
+
ref="input"
|
|
27
|
+
clearable
|
|
28
|
+
@blur="submit"
|
|
29
|
+
></el-input>
|
|
30
|
+
<el-select
|
|
31
|
+
v-if="editType == 'select'"
|
|
32
|
+
v-model="fragObj.value"
|
|
33
|
+
@change="submit"
|
|
34
|
+
ref="select"
|
|
35
|
+
>
|
|
36
|
+
<el-option
|
|
37
|
+
v-for="item in option"
|
|
38
|
+
:key="item.code"
|
|
39
|
+
:label="item.name"
|
|
40
|
+
:value="item.code"
|
|
41
|
+
>
|
|
42
|
+
</el-option>
|
|
43
|
+
</el-select>
|
|
44
|
+
<el-date-picker
|
|
45
|
+
v-if="editType == 'datepicker'"
|
|
46
|
+
v-model="fragObj.value"
|
|
47
|
+
type="date"
|
|
48
|
+
value-format="yyyy-MM-dd"
|
|
49
|
+
ref="datepicker"
|
|
50
|
+
placeholder="选择日期"
|
|
51
|
+
@blur="submit"
|
|
52
|
+
>
|
|
53
|
+
</el-date-picker>
|
|
54
|
+
</slot>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
export default {
|
|
61
|
+
name: "HbFragMentOld",
|
|
62
|
+
componentName: "HbFragMentOld",
|
|
63
|
+
props: {
|
|
64
|
+
//基本数据结构,包括渲染的标题title\字段名key\字段值value\展示值show
|
|
65
|
+
fragObj: {
|
|
66
|
+
type: Object,
|
|
67
|
+
default: () => ({
|
|
68
|
+
title: "",
|
|
69
|
+
value: "",
|
|
70
|
+
key: "",
|
|
71
|
+
show: "",
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
//是否可以编辑,默认为是
|
|
75
|
+
disabled: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: true,
|
|
78
|
+
},
|
|
79
|
+
//组件类型
|
|
80
|
+
editType: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "input",
|
|
83
|
+
},
|
|
84
|
+
//下拉框中的option,支持数据字典名以及数组
|
|
85
|
+
option: {
|
|
86
|
+
type: [String, Array],
|
|
87
|
+
default: "",
|
|
88
|
+
},
|
|
89
|
+
//布局下padding
|
|
90
|
+
paddingBottom: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "0",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
data() {
|
|
96
|
+
return {
|
|
97
|
+
edit: false,
|
|
98
|
+
iconShow: false,
|
|
99
|
+
timer: "",
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
// mounted() {
|
|
103
|
+
// document.addEventListener("click", (e) => {
|
|
104
|
+
// const selectBox = this.$refs.fragment;
|
|
105
|
+
// if (!selectBox.contains(e.target)) {
|
|
106
|
+
// console.log("点击了外部");
|
|
107
|
+
// this.edit = false;
|
|
108
|
+
// }
|
|
109
|
+
// });
|
|
110
|
+
// },
|
|
111
|
+
methods: {
|
|
112
|
+
startEdit() {
|
|
113
|
+
this.edit = true;
|
|
114
|
+
this.$nextTick(() => {
|
|
115
|
+
this.editType == "input" && this.$refs.input.focus();
|
|
116
|
+
this.editType == "select" && this.$refs.select.focus();
|
|
117
|
+
this.editType == "datepicker" && this.$refs.date.focus();
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
// //下拉框相关事件
|
|
121
|
+
// selectFocus() {
|
|
122
|
+
// clearTimeout(this.timer);
|
|
123
|
+
// console.log("触发聚焦");
|
|
124
|
+
// },
|
|
125
|
+
// selectChange() {
|
|
126
|
+
// this.$refs.select.focus();
|
|
127
|
+
// // this.edit = false;
|
|
128
|
+
// console.log("触发改变");
|
|
129
|
+
// },
|
|
130
|
+
// selectBlur() {
|
|
131
|
+
// this.timer = setTimeout(() => {
|
|
132
|
+
// console.log("失焦了");
|
|
133
|
+
// this.edit = false;
|
|
134
|
+
// this.$emit("selectSubmit", this.fragObj);
|
|
135
|
+
// }, 100);
|
|
136
|
+
// },
|
|
137
|
+
//通用失焦
|
|
138
|
+
submit() {
|
|
139
|
+
this.edit = false;
|
|
140
|
+
this.$emit("update");
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
</script>
|