@bdsoft/element 1.1.13 → 1.1.14
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/index.html +13 -0
- package/index.js +6 -6
- package/package.json +19 -23
- package/src/App.vue +28 -0
- package/src/assets/css/element.scss +196 -0
- package/src/assets/css/layout.scss +215 -0
- package/src/assets/css/tailwind.scss +67 -0
- package/src/assets/images/banner.gif +0 -0
- package/src/assets/images/banner.png +0 -0
- package/src/assets/images/bg1.svg +22 -0
- package/src/assets/images/bg2.png +0 -0
- package/src/assets/images/ff.png +0 -0
- package/src/assets/images/home-file1.png +0 -0
- package/src/assets/images/ky.png +0 -0
- package/src/assets/images/menu/add.png +0 -0
- package/src/assets/images/menu/del.png +0 -0
- package/src/assets/images/menu/down.png +0 -0
- package/src/assets/images/menu/dr.png +0 -0
- package/src/assets/images/menu/edit.png +0 -0
- package/src/assets/images/menu/kx.png +0 -0
- package/src/assets/images/menu/mb.png +0 -0
- package/src/assets/images/menu/pz.png +0 -0
- package/src/assets/images/menu/save.png +0 -0
- package/src/assets/images/menu/sj.png +0 -0
- package/src/assets/images/menu/sjk.png +0 -0
- package/src/assets/images/menu/up.png +0 -0
- package/src/assets/images/po-i.png +0 -0
- package/src/assets/images/po1-i1.png +0 -0
- package/src/assets/images/po1-i2.png +0 -0
- package/src/assets/images/po1-i3.png +0 -0
- package/src/assets/images/po1-i4.png +0 -0
- package/src/assets/images/po1-i5.png +0 -0
- package/src/assets/images/po1-i6.png +0 -0
- package/src/assets/images/po1-i7.png +0 -0
- package/src/assets/images/po1-i8.png +0 -0
- package/src/assets/images/po2-i1.png +0 -0
- package/src/assets/images/po2-i2.png +0 -0
- package/src/assets/images/po3-i1.png +0 -0
- package/src/assets/images/po4-i1.png +0 -0
- package/src/assets/images/po5-i1.png +0 -0
- package/src/assets/images/po6-i1.png +0 -0
- package/src/assets/images/po6-i2.png +0 -0
- package/src/assets/images/po7-i1.png +0 -0
- package/src/assets/images/tj1.png +0 -0
- package/src/assets/images/tj2.png +0 -0
- package/src/assets/images/tj3.png +0 -0
- package/src/components/3dcloudwords/index.js +346 -0
- package/src/components/3dcloudwords/index.vue +99 -0
- package/src/components/3dcloudwords/readme.md +66 -0
- package/src/components/badge/index.js +167 -0
- package/src/components/badge/index.scss +166 -0
- package/src/components/badge/index.vue +98 -0
- package/src/components/badge/readme.md +18 -0
- package/src/components/basic/Finish.vue +107 -0
- package/src/components/basic/button.vue +19 -0
- package/src/components/basic/readme.md +7 -0
- package/src/components/button/index.vue +48 -0
- package/src/components/button/readme.md +62 -0
- package/src/components/carousel/index.vue +104 -0
- package/src/components/carousel/readme.md +12 -0
- package/src/components/chartconfig/index.vue +141 -0
- package/src/components/chartconfig/readme.md +25 -0
- package/src/components/contextMenu/hookContxtMenu.js +41 -0
- package/src/components/contextMenu/index.vue +245 -0
- package/src/components/contextMenu/readme.md +55 -0
- package/src/components/contextMenu/useElementBounding.js +40 -0
- package/src/components/countup/countUp.js +196 -0
- package/src/components/countup/index.vue +114 -0
- package/src/components/countup/readme.md +9 -0
- package/src/components/empty/assets/build.png +0 -0
- package/src/components/empty/assets/emptybg.gif +0 -0
- package/src/components/empty/assets/emptybg.png +0 -0
- package/src/components/empty/assets/emptybg2.jpg +0 -0
- package/src/components/empty/assets/emptybg3.jpg +0 -0
- package/src/components/empty/assets/wuxiao.png +0 -0
- package/src/components/empty/assets/wuxiao.webp +0 -0
- package/src/components/empty/building.vue +117 -0
- package/src/components/empty/empty.vue +120 -0
- package/src/components/empty/index.js +12 -0
- package/src/components/empty/invalid.vue +56 -0
- package/src/components/error/Error.vue +79 -0
- package/src/components/error/readme.md +20 -0
- package/src/components/form/Form.vue +84 -0
- package/src/components/form/FormItem.vue +143 -0
- package/src/components/form/data.js +52 -0
- package/src/components/form/readme.md +69 -0
- package/src/components/layout/banner.vue +412 -0
- package/src/components/layout/bar.vue +43 -0
- package/src/components/layout/layout1.vue +60 -0
- package/src/components/layout/layout2.vue +134 -0
- package/src/components/layout/layout3.vue +107 -0
- package/src/components/layout/layout4.vue +66 -0
- package/src/components/layout/nav.vue +333 -0
- package/src/components/layout/readme.md +61 -0
- package/src/components/loading/index.vue +122 -0
- package/src/components/loading/readme.md +6 -0
- package/src/components/notice/NoticeList.vue +198 -0
- package/src/components/notice/NoticeListPaging.vue +281 -0
- package/src/components/notice/NoticeView.vue +92 -0
- package/src/components/notice/readme.md +1 -0
- package/src/components/pagination/index.vue +100 -0
- package/src/components/pagination/readme.md +19 -0
- package/src/components/pagination/scroll-to.js +51 -0
- package/src/components/progress/bar.vue +72 -0
- package/src/components/progress/progress.vue +58 -0
- package/src/components/screenfull/index.js +3 -0
- package/src/components/screenfull/index.vue +65 -0
- package/src/components/screenfull/package.json +15 -0
- package/src/components/screenfull/readme.md +6 -0
- package/src/components/statisticalCount/index.vue +80 -0
- package/src/components/statisticalCount/readme.md +21 -0
- package/src/components/username/index.vue +79 -0
- package/src/components/username/readme.md +22 -0
- package/src/components/username//346/225/210/346/236/234/345/233/276.png +0 -0
- package/src/global/index.ts +6 -0
- package/src/global/register-properties.ts +10 -0
- package/src/index.js +88 -0
- package/src/utils/coms/load.jsx +10 -0
- package/src/utils/func.js +32 -0
- package/src/utils/hookDialog.js +38 -0
- package/src/utils/hookPage.js +49 -0
- package/src/utils/index.js +5 -0
- package/src/utils/lib/console.js +39 -0
- package/src/utils/lib/debounce.js +19 -0
- package/src/utils/lib/deepextend.js +51 -0
- package/src/utils/lib/deepset.js +14 -0
- package/src/utils/lib/extend.js +28 -0
- package/src/utils/lib/index.js +13 -0
- package/src/utils/lib/json.js +90 -0
- package/src/utils/lib/mergeprops.js +62 -0
- package/src/utils/lib/mitt.js +43 -0
- package/src/utils/lib/modify.js +8 -0
- package/src/utils/lib/slot.js +19 -0
- package/src/utils/lib/toarray.js +5 -0
- package/src/utils/lib/tocase.js +11 -0
- package/src/utils/lib/todate.js +10 -0
- package/src/utils/lib/toline.js +10 -0
- package/src/utils/lib/tostring.js +7 -0
- package/src/utils/lib/type.js +45 -0
- package/src/utils/lib/unique.js +6 -0
- package/src/utils/message.js +164 -0
- package/src/utils/type.js +45 -0
- package/src/xm_components/HeadSearch/hook/hookSearch.js +96 -0
- package/src/xm_components/HeadSearch/index.vue +206 -0
- package/src/xm_components/HeadSearch/readme.md +12 -0
- package/src/xm_components/HeadSearch//346/220/234/347/264/242/345/210/227/350/241/250.png +0 -0
- package/src/xm_components/Milestone/index.vue +213 -0
- package/src/xm_components/Milestone/readme.md +15 -0
- package/src/xm_components/MultiStatisticalCard/image.png +0 -0
- package/src/xm_components/MultiStatisticalCard/index.vue +114 -0
- package/src/xm_components/MultiStatisticalCard/readme.md +29 -0
- package/src/xm_components/StatisticalCard/image.png +0 -0
- package/src/xm_components/StatisticalCard/index.vue +196 -0
- package/src/xm_components/StatisticalCard/readme.md +41 -0
- package/src/xm_components/readme.md +1 -0
- package/vite.config.js +58 -0
- package/dist/BdElement.js +0 -23432
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ElMessage, ElMessageBox, ElNotification, ElLoading, ElButton, ElIcon } from 'element-plus'
|
|
2
|
+
import { Warning } from '@element-plus/icons-vue'
|
|
3
|
+
import { h } from 'vue'
|
|
4
|
+
// !!!如果有方法报错 在执行方法外面添加nextTrick函数处理
|
|
5
|
+
export function showsuccess(msg, duration = 3000, showClose = true) {
|
|
6
|
+
ElMessage({
|
|
7
|
+
message: msg || '保存成功',
|
|
8
|
+
type: 'success',
|
|
9
|
+
duration: duration,
|
|
10
|
+
showClose: showClose
|
|
11
|
+
})
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function showerror(msg, duration = 3000, showClose = true) {
|
|
15
|
+
ElMessage({
|
|
16
|
+
message: msg || '保存失败',
|
|
17
|
+
type: 'error',
|
|
18
|
+
duration: duration,
|
|
19
|
+
showClose: showClose
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function showwarning(msg, duration = 3000, showClose = true, clostFn) {
|
|
24
|
+
ElMessage({
|
|
25
|
+
message: msg || '警告内容',
|
|
26
|
+
type: 'warning',
|
|
27
|
+
duration: duration,
|
|
28
|
+
showClose: showClose,
|
|
29
|
+
onClose: clostFn
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function showinfo(msg, duration = 3000, showClose = true) {
|
|
34
|
+
ElMessage({
|
|
35
|
+
message: msg || '提示信息',
|
|
36
|
+
duration: duration,
|
|
37
|
+
showClose: showClose
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function hideloading(msg) {
|
|
42
|
+
ElMessage.closeAll()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function showconfirm(done, confirmtitle = '确认关闭?', showtext = { title: '提示', confirmButtonText: '确定', cancelButtonText: '取消' }, cancle) {
|
|
46
|
+
return ElMessageBox.confirm(confirmtitle, showtext.title, {
|
|
47
|
+
confirmButtonText: showtext.confirmButtonText,
|
|
48
|
+
cancelButtonText: showtext.cancelButtonText,
|
|
49
|
+
distinguishCancelAndClose: true,
|
|
50
|
+
type: 'warning'
|
|
51
|
+
})
|
|
52
|
+
.then((_) => {
|
|
53
|
+
done(_)
|
|
54
|
+
})
|
|
55
|
+
.catch((_) => {
|
|
56
|
+
console.info('showconfirm catch')
|
|
57
|
+
console.info(_)
|
|
58
|
+
cancle && cancle(_)
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 信息提示框
|
|
64
|
+
* @param {*} msg
|
|
65
|
+
* @param {*} type
|
|
66
|
+
* @param {*} title
|
|
67
|
+
* @param {*} position
|
|
68
|
+
* @param {*} dangerouslyUseHTMLString
|
|
69
|
+
*/
|
|
70
|
+
export function shownotiinfo(msg, type = 'info', title = '提示', position = 'bottom-right', dangerouslyUseHTMLString = false) {
|
|
71
|
+
ElNotification({
|
|
72
|
+
title: title,
|
|
73
|
+
position: position,
|
|
74
|
+
message: msg,
|
|
75
|
+
dangerouslyUseHTMLString: dangerouslyUseHTMLString,
|
|
76
|
+
type: type
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function showconfirminfo(msg = '确认删除?', showtext = { type: '', position: 'bottom-right', title: '提示', dangerouslyUseHTMLString: true }, fn1, fn2) {
|
|
81
|
+
// 按钮
|
|
82
|
+
const btn1 = h(ElButton, {
|
|
83
|
+
innerText: '立即刷新',
|
|
84
|
+
type: 'primary',
|
|
85
|
+
size: 'small',
|
|
86
|
+
style: { marginLeft: '16px', float: 'right' },
|
|
87
|
+
onclick: (_) => {
|
|
88
|
+
fn1(_)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
const btn2 = h(ElButton, {
|
|
92
|
+
innerText: '暂不更新',
|
|
93
|
+
style: { float: 'right' },
|
|
94
|
+
size: 'small',
|
|
95
|
+
onclick: (_) => {
|
|
96
|
+
fn2(_)
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
// 信息div
|
|
100
|
+
const div = h('div', { style: { marginLeft: '8px', marginBottom: '16px', marginTop: '16px' } }, msg)
|
|
101
|
+
// 图标
|
|
102
|
+
const icon1 = h(Warning)
|
|
103
|
+
const icon = h(ElIcon, { style: { fontSize: '18px' } }, [icon1])
|
|
104
|
+
// 整体div
|
|
105
|
+
const msgDiv = h('div', { style: { display: 'flex', alignItems: 'center' } }, [icon, div])
|
|
106
|
+
ElNotification({
|
|
107
|
+
class: 'custom-notification',
|
|
108
|
+
title: showtext.title,
|
|
109
|
+
position: showtext.position,
|
|
110
|
+
dangerouslyUseHTMLString: showtext.dangerouslyUseHTMLString,
|
|
111
|
+
message: h('div', [msgDiv, btn1, btn2]),
|
|
112
|
+
type: showtext.type,
|
|
113
|
+
duration: 0,
|
|
114
|
+
showClose: false
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function showalert(done, alertMsg = 'This is a message', type = 'info', showtext = { title: '提示', confirmButtonText: '确定' }) {
|
|
119
|
+
return ElMessageBox.alert(alertMsg, showtext.title, {
|
|
120
|
+
confirmButtonText: showtext.confirmButtonText,
|
|
121
|
+
type: type
|
|
122
|
+
})
|
|
123
|
+
.then((_) => {
|
|
124
|
+
done(_)
|
|
125
|
+
})
|
|
126
|
+
.catch((_) => {
|
|
127
|
+
console.info('showalert catch')
|
|
128
|
+
console.info(_)
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function confirm(confirmtitle = '确认关闭?') {
|
|
133
|
+
return ElMessageBox.confirm(confirmtitle)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function showloading(msg, duration = 0, showClose = true) {
|
|
137
|
+
ElMessage({
|
|
138
|
+
// <svg viewBox="0 0 1024 1024" focusable="false" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg>
|
|
139
|
+
icon: 'loadsvg',
|
|
140
|
+
message: msg || '正在保存,请稍后...',
|
|
141
|
+
duration: duration,
|
|
142
|
+
showClose: showClose
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// loading加载 closeLoading
|
|
147
|
+
let loadingObj = null
|
|
148
|
+
export function showLoading(msg, parm) {
|
|
149
|
+
let _parm = parm || {}
|
|
150
|
+
loadingObj = ElLoading.service({
|
|
151
|
+
// 默认配置
|
|
152
|
+
lock: true,
|
|
153
|
+
text: '加载中...',
|
|
154
|
+
spinner: 'el-icon-loading',
|
|
155
|
+
background: 'rgba(0, 0, 0, 0.7)',
|
|
156
|
+
// 展开 _parm,其属性会覆盖上面的默认配置
|
|
157
|
+
..._parm
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function closeLoading() {
|
|
162
|
+
loadingObj.close()
|
|
163
|
+
}
|
|
164
|
+
export { ElMessage, ElMessageBox, ElNotification, ElLoading }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const is = {
|
|
2
|
+
type(arg, type) {
|
|
3
|
+
return Object.prototype.toString.call(arg) === '[object ' + type + ']'
|
|
4
|
+
},
|
|
5
|
+
Undef(v) {
|
|
6
|
+
return v === undefined || v === null
|
|
7
|
+
},
|
|
8
|
+
Element(arg) {
|
|
9
|
+
return typeof arg === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg)
|
|
10
|
+
},
|
|
11
|
+
trueArray(data) {
|
|
12
|
+
return Array.isArray(data) && data.length > 0;
|
|
13
|
+
},
|
|
14
|
+
Function(v) {
|
|
15
|
+
const type = this.getType(v);
|
|
16
|
+
return type === 'Function' || type === 'AsyncFunction';
|
|
17
|
+
},
|
|
18
|
+
getType(v) {
|
|
19
|
+
const str = Object.prototype.toString.call(v)
|
|
20
|
+
return /^\[object (.*)\]$/.exec(str)[1]
|
|
21
|
+
},
|
|
22
|
+
empty(value) {
|
|
23
|
+
if (value === undefined || value === null) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (Array.isArray(value) && Array.isArray(value) && !value.length) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return typeof value === 'string' && !value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(t => {
|
|
36
|
+
is[t] = function (arg) {
|
|
37
|
+
return is.type(arg, t);
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export function hasProperty(rule, k) {
|
|
42
|
+
return ({}).hasOwnProperty.call(rule, k)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default is;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ref, reactive, onMounted, nextTick } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {*} prefix 前缀,解决项目冲突
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export default function useSearrch(prefix = '') {
|
|
9
|
+
const searchkeysArr = ref([])
|
|
10
|
+
const search_drop = ref(false)
|
|
11
|
+
const keyName = ref('')
|
|
12
|
+
/**
|
|
13
|
+
* 获取缓存搜索数据
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
const getStorageKeys = () => {
|
|
17
|
+
var keys = localStorage.getItem('searchRerportkeys')
|
|
18
|
+
|
|
19
|
+
if (keys && keys !== 'undefined' && keys !== 'null') {
|
|
20
|
+
keys = JSON.parse(keys)
|
|
21
|
+
return keys
|
|
22
|
+
}
|
|
23
|
+
return []
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 鼠标foucs
|
|
28
|
+
*/
|
|
29
|
+
const focusfns = (type) => {
|
|
30
|
+
searchkeysArr.value = getStorageKeys()
|
|
31
|
+
|
|
32
|
+
if (type === 1 && searchkeysArr.value.length > 0) {
|
|
33
|
+
search_drop.value = true
|
|
34
|
+
} else {
|
|
35
|
+
setTimeout(function () {
|
|
36
|
+
nextTick(function () {
|
|
37
|
+
search_drop.value = false
|
|
38
|
+
})
|
|
39
|
+
}, 200)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 保存搜索记录
|
|
45
|
+
* @param {*} key
|
|
46
|
+
*/
|
|
47
|
+
const setSearchKeys = (key) => {
|
|
48
|
+
if (!key || key == null || key == '' || key == 'null') return
|
|
49
|
+
let keys = localStorage.getItem('searchRerportkeys')
|
|
50
|
+
|
|
51
|
+
if (keys && keys !== 'undefined' && keys !== '{}') {
|
|
52
|
+
keys = JSON.parse(keys)
|
|
53
|
+
|
|
54
|
+
if (keys.length > 5 && keys instanceof Array) {
|
|
55
|
+
keys.splice(0, 1)
|
|
56
|
+
}
|
|
57
|
+
keys.push(key)
|
|
58
|
+
|
|
59
|
+
let keys2 = [...new Set(keys)]
|
|
60
|
+
|
|
61
|
+
localStorage.setItem('searchRerportkeys', JSON.stringify(keys2))
|
|
62
|
+
} else {
|
|
63
|
+
keys = []
|
|
64
|
+
keys.push(key)
|
|
65
|
+
localStorage.setItem('searchRerportkeys', JSON.stringify(keys))
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 在hookSearch.js中添加
|
|
70
|
+
const deleteSearchItem = (index) => {
|
|
71
|
+
debugger
|
|
72
|
+
// 删除数组中对应索引的记录
|
|
73
|
+
searchkeysArr.value.splice(index, 1)
|
|
74
|
+
// 同步更新本地存储
|
|
75
|
+
localStorage.setItem('searchRerportkeys', JSON.stringify(searchkeysArr.value))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 赋值文本
|
|
80
|
+
* @param {*} val
|
|
81
|
+
*/
|
|
82
|
+
const setTxt = (val) => {
|
|
83
|
+
keyName.value = val
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
keyName,
|
|
88
|
+
searchkeysArr,
|
|
89
|
+
search_drop,
|
|
90
|
+
focusfns,
|
|
91
|
+
setTxt,
|
|
92
|
+
deleteSearchItem,
|
|
93
|
+
setSearchKeys,
|
|
94
|
+
getStorageKeys
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @FileDescription: 搜索组件 todo
|
|
3
|
+
* @Author: 李兵泉
|
|
4
|
+
* @Date: 2021-06-08 09 时
|
|
5
|
+
* @LastEditors: 最后更新作者
|
|
6
|
+
* @LastEditTime: 最后更新时间
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="search_warp">
|
|
11
|
+
<img :src="logoUrl" v-if="logoUrl"
|
|
12
|
+
style="width: 40px; height: 40px;margin-right: 5px; vertical-align: middle; cursor: pointer" alt=""
|
|
13
|
+
@click="gohome" />
|
|
14
|
+
<div class="ipt_search">
|
|
15
|
+
<el-input :placeholder="placeholderTxt" v-model="keyName" clearable @focus="focusfns(1)" @blur="focusfns(-1)"
|
|
16
|
+
@keyup.enter="debouncedClick">
|
|
17
|
+
<template #append>
|
|
18
|
+
<el-button class="SearchBtn" @click="debouncedClick" type="primary" icon="Search">搜索</el-button>
|
|
19
|
+
</template>
|
|
20
|
+
</el-input>
|
|
21
|
+
<!-- 搜索记录 -->
|
|
22
|
+
<div v-show="search_drop" class="search_drop" v-if="searchkeysArr && searchkeysArr != ''">
|
|
23
|
+
<ul>
|
|
24
|
+
<li v-for="(item, index) in searchkeysArr" :key="index">
|
|
25
|
+
<span class="search-item-text" @click="setTxt(item)">{{ item }}</span>
|
|
26
|
+
<el-icon class="delete-btn" @click.stop="deleteSearchItem(index)">
|
|
27
|
+
<Delete />
|
|
28
|
+
</el-icon>
|
|
29
|
+
</li>
|
|
30
|
+
</ul>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
<!-- 搜索记录 -->
|
|
36
|
+
|
|
37
|
+
<div v-if="groupData && groupData != ''" class="ipt_search_tip">
|
|
38
|
+
搜索结果数:
|
|
39
|
+
<span v-show="props.ismodule">{{ Object.keys(groupData).length }}个系统, </span>
|
|
40
|
+
{{ searchNum }} 个相关页面模块
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
<script setup>
|
|
44
|
+
import { ref, reactive, computed, onMounted } from 'vue';
|
|
45
|
+
import { getUrlKey, debounce } from '../../../utils/func.js';
|
|
46
|
+
|
|
47
|
+
const emits = defineEmits(['getSearchList']);
|
|
48
|
+
//
|
|
49
|
+
import useSearrch from './hook/hookSearch.js';
|
|
50
|
+
// hook
|
|
51
|
+
const { keyName, searchkeysArr, search_drop, getStorageKeys, focusfns, setSearchKeys, deleteSearchItem, setTxt } = useSearrch();
|
|
52
|
+
|
|
53
|
+
const props = defineProps({
|
|
54
|
+
ismodule: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
// logo url
|
|
59
|
+
logoUrl: {
|
|
60
|
+
type: String,
|
|
61
|
+
// default: 'http://123.129.65.205:18012/RabbitDocService/Doc/ptIcon/View?filePath=20250911/006.png'
|
|
62
|
+
},
|
|
63
|
+
placeholderTxt: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '请输入搜索内容'
|
|
66
|
+
},
|
|
67
|
+
groupData: {
|
|
68
|
+
type: Object
|
|
69
|
+
},
|
|
70
|
+
searchNum: {
|
|
71
|
+
type: Number
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// 跳转到首页搜索
|
|
75
|
+
const gohome = () => {
|
|
76
|
+
// router.push('/');
|
|
77
|
+
};
|
|
78
|
+
onMounted(() => {
|
|
79
|
+
// 是否有限取浏览器中的值 isQueryFirst==>f
|
|
80
|
+
let keymc = getUrlKey('txtKey') || '';
|
|
81
|
+
|
|
82
|
+
setTxt(keymc);
|
|
83
|
+
// getModuleList(true);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 触发上层搜索 keyName
|
|
88
|
+
* 处理防抖
|
|
89
|
+
*/
|
|
90
|
+
const getModuleList = (isfirst = false) => {
|
|
91
|
+
focusfns(-1);
|
|
92
|
+
// setCookieKey('searchKey', keyName.value);
|
|
93
|
+
setSearchKeys(keyName.value || '');
|
|
94
|
+
emits('getSearchList', keyName.value, isfirst);
|
|
95
|
+
};
|
|
96
|
+
// 防抖处理
|
|
97
|
+
const debouncedClick = debounce(getModuleList, 500);
|
|
98
|
+
|
|
99
|
+
defineExpose({
|
|
100
|
+
setTxt,
|
|
101
|
+
debouncedClick
|
|
102
|
+
});
|
|
103
|
+
</script>
|
|
104
|
+
<style lang="scss" scoped>
|
|
105
|
+
.search_warp {
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ipt_search {
|
|
112
|
+
width: 700px;
|
|
113
|
+
height: 40px;
|
|
114
|
+
position: relative;
|
|
115
|
+
|
|
116
|
+
// 样式重写
|
|
117
|
+
:deep(.el-input__inner) {
|
|
118
|
+
height: 40px !important;
|
|
119
|
+
outline: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:deep(.el-input-group__append) {
|
|
123
|
+
background: linear-gradient(136deg, #286aff, #4e6ef2, #7274f9, #9f66ff);
|
|
124
|
+
// border: 1px solid #ffffff !important;
|
|
125
|
+
color: #fff;
|
|
126
|
+
height: 40px;
|
|
127
|
+
margin-top: 1px;
|
|
128
|
+
box-shadow: none;
|
|
129
|
+
font-size: 17px;
|
|
130
|
+
border-radius: 0 8px 8px 0;
|
|
131
|
+
border: 0;
|
|
132
|
+
outline-width: 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:deep(.el-button [class*='el-icon'] + span) {
|
|
136
|
+
vertical-align: 3px;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ipt_search_tip {
|
|
141
|
+
margin-left: 50px;
|
|
142
|
+
color: #ccc;
|
|
143
|
+
font-size: 13px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.search_drop {
|
|
147
|
+
position: absolute;
|
|
148
|
+
z-index: 99999;
|
|
149
|
+
width: 100%;
|
|
150
|
+
left: 2px;
|
|
151
|
+
max-width: 605px;
|
|
152
|
+
border: solid 1px #e4e7ed;
|
|
153
|
+
border-radius: 4px;
|
|
154
|
+
background-color: #fff;
|
|
155
|
+
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
156
|
+
box-sizing: border-box;
|
|
157
|
+
|
|
158
|
+
ul {
|
|
159
|
+
list-style: none;
|
|
160
|
+
padding: 6px 0;
|
|
161
|
+
margin: 0;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
text-align: left;
|
|
164
|
+
|
|
165
|
+
li {
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
padding: 0 20px;
|
|
168
|
+
position: relative;
|
|
169
|
+
white-space: nowrap;
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
text-overflow: ellipsis;
|
|
172
|
+
color: #606266;
|
|
173
|
+
height: 34px;
|
|
174
|
+
line-height: 34px;
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
position: relative;
|
|
178
|
+
padding-right: 50px; // 给删除按钮留出空间
|
|
179
|
+
|
|
180
|
+
.search-item-text {
|
|
181
|
+
display: inline-block;
|
|
182
|
+
width: calc(100% - 40px);
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
text-overflow: ellipsis;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.delete-btn {
|
|
188
|
+
position: absolute;
|
|
189
|
+
right: 5px;
|
|
190
|
+
top: 50%;
|
|
191
|
+
transform: translateY(-50%);
|
|
192
|
+
width: 30px;
|
|
193
|
+
height: 24px;
|
|
194
|
+
padding: 0;
|
|
195
|
+
background: transparent;
|
|
196
|
+
color: #909399;
|
|
197
|
+
|
|
198
|
+
&:hover {
|
|
199
|
+
color: #f56c6c;
|
|
200
|
+
background: transparent;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</style>
|