hd-idevvue3 3.0.2 → 3.0.4
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/dist/assets/index.9c127719.css +1 -0
- package/dist/hd-idevvue3.mjs +3521 -3305
- package/dist/hd-idevvue3.umd.js +29 -29
- package/npminstall-debug.log +2 -10
- package/package.json +4 -2
- package/pnpm-lock.yaml +37 -4
- package/src/App.vue +11 -15
- package/src/assets/sound/notify.wav +0 -0
- package/src/demo/demo.vue +9 -10
- package/src/demo/dropdemo.vue +42 -43
- package/src/demo/extsets.vue +140 -39
- package/src/demo/formedit.vue +157 -145
- package/src/demo/hightquery.vue +263 -66
- package/src/demo/inlineedit.vue +129 -35
- package/src/demo/selfdrop.vue +32 -15
- package/src/directive/el-dragDialog/drag.js +13 -13
- package/src/directive/el-dragDialog/index.js +13 -13
- package/src/errorLog.js +3 -3
- package/src/hdcom/BigGrid.js +54 -48
- package/src/hdcom/BillShow.vue +84 -63
- package/src/hdcom/BillUpload.vue +144 -86
- package/src/hdcom/BtnRight.vue +26 -23
- package/src/hdcom/ErrHint.vue +36 -24
- package/src/hdcom/ExtendColumn.vue +97 -90
- package/src/hdcom/ExtendCommon.js +24 -13
- package/src/hdcom/ExtendForm.vue +107 -80
- package/src/hdcom/FacePicUpload.vue +59 -50
- package/src/hdcom/FaceRecTest.vue +87 -77
- package/src/hdcom/GridChart.vue +175 -162
- package/src/hdcom/GridExField.vue +328 -234
- package/src/hdcom/GridShow.vue +89 -39
- package/src/hdcom/HdAside.vue +192 -145
- package/src/hdcom/HdBtn.vue +44 -32
- package/src/hdcom/HdButton.vue +141 -117
- package/src/hdcom/HdComFaceRec.vue +80 -32
- package/src/hdcom/HdComGrid.vue +329 -229
- package/src/hdcom/HdComQuery.vue +179 -90
- package/src/hdcom/HdComQueryDetail.vue +159 -115
- package/src/hdcom/HdComSortDetail.vue +136 -130
- package/src/hdcom/HdDatePicker.vue +32 -16
- package/src/hdcom/HdDialog.vue +62 -44
- package/src/hdcom/HdDrop.vue +163 -138
- package/src/hdcom/HdFileUpload.vue +138 -119
- package/src/hdcom/HdFilterBox.vue +62 -62
- package/src/hdcom/HdFooter.vue +152 -119
- package/src/hdcom/HdForm.vue +276 -203
- package/src/hdcom/HdFormBtn.vue +81 -39
- package/src/hdcom/HdFormItem.vue +14 -10
- package/src/hdcom/HdGrid.vue +353 -156
- package/src/hdcom/HdGridEditBtn.vue +34 -20
- package/src/hdcom/HdGridExt.js +78 -47
- package/src/hdcom/HdGridSel.vue +227 -193
- package/src/hdcom/HdHeader.vue +149 -117
- package/src/hdcom/HdHotKey.vue +70 -67
- package/src/hdcom/HdInputHint.vue +40 -36
- package/src/hdcom/HdMain.vue +25 -27
- package/src/hdcom/HdMessage.vue +180 -171
- package/src/hdcom/HdNum.vue +67 -57
- package/src/hdcom/HdPopSel.vue +46 -24
- package/src/hdcom/HdRightMenu.vue +63 -61
- package/src/hdcom/HdSel/SelGridFieldcod.vue +46 -28
- package/src/hdcom/HdTableColumn.vue +156 -109
- package/src/hdcom/HdTempSave.vue +138 -116
- package/src/hdcom/HdTree.vue +89 -72
- package/src/hdcom/HdTreeTable/eval.js +8 -3
- package/src/hdcom/HdTreeTable/index.vue +229 -174
- package/src/hdcom/ImportExcel.vue +69 -34
- package/src/hdcom/index.js +39 -44
- package/src/idev.common.js +54 -47
- package/src/index.js +3 -6
- package/src/utils/HdQuery.js +25 -14
- package/src/utils/comutils.js +50 -28
- package/src/utils/gogocodeTransfer.js +59 -0
- package/src/utils/utils.js +30 -19
- package/src/vendor/Blob.js +187 -179
- package/src/vendor/Export2Excel.js +231 -220
- package/src/vendor/Export2Zip.js +25 -22
- package/src/views/layout/AppMain.vue +34 -32
- package/src/views/layout/HdLayout.vue +64 -52
- package/src/views/layout/header/ElasticSearch.vue +196 -159
- package/src/views/layout/header/HZRecorder.js +163 -135
- package/src/views/layout/header/HeaderSearch.vue +165 -145
- package/src/views/layout/header/Levelbar.vue +55 -49
- package/src/views/layout/header/MainHeader.vue +233 -189
- package/src/views/layout/header/Navbar.vue +74 -78
- package/src/views/layout/header/ScrollPane.vue +103 -81
- package/src/views/layout/header/TagsView.vue +169 -164
- package/src/views/layout/header/VocRec.vue +86 -78
- package/src/views/layout/header/changepswform.vue +98 -64
- package/src/views/layout/index.js +5 -7
- package/src/views/layout/menu/Hamburger.vue +63 -45
- package/src/views/layout/menu/HdMenu.vue +155 -118
- package/src/views/layout/menu/index.vue +21 -19
- package/src/views/privilege/commsg/commsg.vue +115 -41
- package/src/views/privilege/commsg/commsgOrgn.vue +40 -31
- package/src/views/privilege/commsg/commsgRole.vue +180 -109
- package/src/views/privilege/commsg/commsgform.vue +125 -101
- package/src/views/privilege/commsg/commsgiframe.vue +30 -23
- package/src/views/privilege/commsg/commsgto.vue +163 -84
- package/src/views/privilege/commsg/commsgtoform.vue +64 -58
- package/src/views/privilege/commsg/commsgtrans.vue +187 -115
- package/src/views/privilege/exfield/comexcolumn.vue +133 -43
- package/src/views/privilege/exfield/comexcolumnform.vue +85 -58
- package/src/views/privilege/exfield/comexfield.vue +15 -17
- package/src/views/privilege/exfield/comexfieldform.vue +71 -53
- package/src/views/privilege/exfield/comexfieldsub.vue +137 -46
- package/src/views/privilege/index.js +19 -20
- package/src/views/privilege/menu/comMenu.vue +49 -41
- package/src/views/privilege/menu/menu.vue +166 -49
- package/src/views/privilege/menu/menuinfo.vue +41 -34
- package/src/views/privilege/menu/rolelist.vue +78 -33
- package/src/views/privilege/menu/userlist.vue +76 -33
- package/src/views/privilege/mobile/authmobileupdate.vue +119 -43
- package/src/views/privilege/mobile/authmobileupdateform.vue +76 -46
- package/src/views/privilege/orgDept/authOrgn.vue +157 -65
- package/src/views/privilege/orgDept/authorgnform.vue +50 -38
- package/src/views/privilege/orgDept/orgDept.vue +38 -37
- package/src/views/privilege/orgDept/orgTree.vue +99 -88
- package/src/views/privilege/orgDept/orgnselect.vue +132 -111
- package/src/views/privilege/personDept/authuser.vue +197 -91
- package/src/views/privilege/personDept/authuserform.vue +123 -71
- package/src/views/privilege/personDept/facerec.vue +128 -83
- package/src/views/privilege/personDept/orgncascader.vue +134 -115
- package/src/views/privilege/personDept/personDept.vue +9 -7
- package/src/views/privilege/quartz/comquartzjob.vue +123 -38
- package/src/views/privilege/quartz/comquartzjobform.vue +67 -51
- package/src/views/privilege/quartz/comquartzlog.vue +116 -32
- package/src/views/privilege/role/btnRole.vue +123 -67
- package/src/views/privilege/role/menuRole.vue +65 -45
- package/src/views/privilege/role/orgnRole.vue +63 -41
- package/src/views/privilege/role/role.vue +26 -9
- package/src/views/privilege/role/rolelist.vue +114 -45
- package/src/views/privilege/role/roleselect.vue +34 -17
- package/src/views/privilege/search/comsearch.vue +164 -73
- package/src/views/privilege/search/menu.vue +38 -22
- package/src/views/privilege/syscode/syscode.vue +157 -69
- package/src/views/privilege/syscode/sysfield.vue +96 -43
- package/src/views/privilege/syscode/sysfieldframe.vue +30 -30
- package/src/views/privilege/syslog/menulog.vue +38 -22
- package/src/views/privilege/syslog/syslog.vue +145 -78
- package/src/views/privilege/syslog/syslogconfig.vue +91 -24
- package/src/views/privilege/syslog/syslogform.vue +45 -43
- package/src/views/privilege/syslog/syslogframe.vue +26 -26
- package/src/views/privilege/userRole/userRole.vue +187 -89
- package/vite.config.js +7 -0
- package/dist/assets/index.774ef40e.css +0 -1
- package/src/views/privilege.zip +0 -0
package/src/idev.common.js
CHANGED
|
@@ -2,59 +2,65 @@ import hdcom from './hdcom'
|
|
|
2
2
|
import comutils from './utils/comutils'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
5
|
install(Vue, options, inElement) {
|
|
7
|
-
|
|
8
6
|
try {
|
|
9
7
|
let ver = require('../package.json').version
|
|
10
8
|
console.info('您现在使用的是hd-idevvue2:' + ver)
|
|
11
|
-
} catch (e) {
|
|
12
|
-
}
|
|
9
|
+
} catch (e) {}
|
|
13
10
|
|
|
14
11
|
//滚动去掉高亮事件,提升虚拟滚动条性能
|
|
15
|
-
inElement.Table.components.TableBody.methods.handleMouseEnter =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
;(inElement.Table.components.TableBody.methods.handleMouseEnter =
|
|
13
|
+
function handleMouseEnter(index) {
|
|
14
|
+
//去掉eltable的hover事件
|
|
15
|
+
if (this.store.states.hoverRow != 'locked') {
|
|
16
|
+
this.store.commit('setHoverRow', index)
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
19
|
+
(inElement.Table.components.TableBody.methods.handleMouseLeave =
|
|
20
|
+
function handleMouseLeave(index) {
|
|
21
|
+
//去掉eltable的hover事件
|
|
22
|
+
if (this.store.states.hoverRow != 'locked') {
|
|
23
|
+
this.store.commit('setHoverRow', null)
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
(inElement.Table.components.TableBody.methods.getColspanRealWidth =
|
|
27
|
+
function getColspanRealWidth(columns, colspan, index) {
|
|
28
|
+
if (colspan < 1) {
|
|
29
|
+
return columns[index].realWidth
|
|
30
|
+
}
|
|
31
|
+
const widthArr = columns
|
|
32
|
+
.map(({ realWidth }) => realWidth)
|
|
33
|
+
.slice(index, index + colspan)
|
|
34
|
+
return widthArr.reduce((acc, width) => acc + width, 0)
|
|
35
|
+
}),
|
|
36
|
+
(inElement.Input.props.clearable = {
|
|
37
|
+
// clearable默认生效
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: true,
|
|
40
|
+
})
|
|
41
|
+
inElement.Input.props.value = {
|
|
42
|
+
// 不写会出现undefined
|
|
38
43
|
type: [String, Number],
|
|
39
|
-
default: ''
|
|
44
|
+
default: '',
|
|
40
45
|
}
|
|
41
46
|
//element ui自身组件进行了扩展,如果使用纯原生的可以使用Ex***,或者自己import
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
window.$vueApp.component('ExFooter', inElement.Footer)
|
|
48
|
+
window.$vueApp.component('ExMain', inElement.Main)
|
|
49
|
+
window.$vueApp.component('ExAside', inElement.Aside)
|
|
50
|
+
window.$vueApp.component('ExHeader', inElement.Header)
|
|
51
|
+
window.$vueApp.component('ExDialog', inElement.Dialog) //这里引入,然后HdDialog调用,保证了一个vue对象,zIndex才能正常
|
|
52
|
+
window.$vueApp.component('ExFormItem', inElement.FormItem)
|
|
53
|
+
window.$vueApp.component('ExFormItem', inElement.FormItem)
|
|
54
|
+
window.$vueApp.component('ExButton', inElement.Button)
|
|
55
|
+
window.$vueApp.component('ExTableColumn', inElement.TableColumn)
|
|
56
|
+
window.$vueApp.component('ExDatePicker', inElement.DatePicker)
|
|
57
|
+
window.$vueApp.use(inElement, options)
|
|
58
|
+
window.$vueApp.use(comutils)
|
|
59
|
+
window.$vueApp.use(hdcom)
|
|
60
|
+
window.$vueApp.config.globalProperties.$message = function (options) {
|
|
61
|
+
// 消息默认值
|
|
56
62
|
if (!options.duration) {
|
|
57
|
-
if(options.type==
|
|
63
|
+
if (options.type == 'error') {
|
|
58
64
|
options.duration = 3000
|
|
59
65
|
} else {
|
|
60
66
|
options.duration = 5000
|
|
@@ -65,8 +71,9 @@ export default {
|
|
|
65
71
|
}
|
|
66
72
|
inElement.Message(options)
|
|
67
73
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
window.$vueApp.config.globalProperties.$message.closeAll =
|
|
75
|
+
inElement.Message.closeAll
|
|
76
|
+
window.$vueApp.config.globalProperties.$message.close =
|
|
77
|
+
inElement.Message.close
|
|
78
|
+
},
|
|
71
79
|
}
|
|
72
|
-
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
1
|
import common from './idev.common'
|
|
3
2
|
import privilege from './views/privilege'
|
|
4
3
|
import layout from './views/layout'
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
|
-
|
|
8
6
|
install(Vue, options, inElement) {
|
|
9
7
|
common.install(Vue, options, inElement)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
8
|
+
window.$vueApp.use(privilege)
|
|
9
|
+
window.$vueApp.use(layout)
|
|
10
|
+
},
|
|
13
11
|
}
|
|
14
|
-
|
package/src/utils/HdQuery.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export default (st, pageRows, queryMethod) => {
|
|
1
|
+
export default (st, pageRows, queryMethod) => {
|
|
2
|
+
//st页面this对象,pageRows,每页显示行数,queryMethod如果默认查询不是doQuery需要指定字符串
|
|
2
3
|
let _thisst = st
|
|
3
4
|
let query = {}
|
|
4
5
|
let page = 1
|
|
@@ -9,27 +10,37 @@ export default (st, pageRows, queryMethod) => {//st页面this对象,pageRows,每
|
|
|
9
10
|
let q = ''
|
|
10
11
|
let sort = ''
|
|
11
12
|
let order = 'desc'
|
|
12
|
-
let selObj = []//checkbox勾选的对象
|
|
13
|
-
let doQueryMethod = queryMethod
|
|
13
|
+
let selObj = [] //checkbox勾选的对象
|
|
14
|
+
let doQueryMethod = queryMethod
|
|
15
|
+
? '_thisst.' + queryMethod + '()'
|
|
16
|
+
: '_thisst.doQuery()'
|
|
14
17
|
|
|
15
18
|
let outObj = {
|
|
19
|
+
query,
|
|
20
|
+
page,
|
|
21
|
+
rows,
|
|
22
|
+
q,
|
|
23
|
+
sort,
|
|
24
|
+
order,
|
|
25
|
+
selObj,
|
|
26
|
+
doQueryMethod,
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
query[key] = value
|
|
22
|
-
},
|
|
28
|
+
add: (key, value) => {
|
|
29
|
+
//没啥用
|
|
30
|
+
query[key] = value
|
|
31
|
+
},
|
|
23
32
|
setThis(st) {
|
|
24
33
|
_thisst = st
|
|
25
34
|
},
|
|
26
|
-
doSizeChg(val) {
|
|
35
|
+
doSizeChg(val) {
|
|
36
|
+
//显示行数切换
|
|
27
37
|
outObj.rows = val
|
|
28
38
|
return eval(doQueryMethod)
|
|
29
39
|
|
|
30
40
|
//st.doQuery()
|
|
31
41
|
},
|
|
32
|
-
doCurPageChange(val) {
|
|
42
|
+
doCurPageChange(val) {
|
|
43
|
+
//页码切换
|
|
33
44
|
outObj.page = val
|
|
34
45
|
|
|
35
46
|
return eval(doQueryMethod)
|
|
@@ -44,11 +55,11 @@ export default (st, pageRows, queryMethod) => {//st页面this对象,pageRows,每
|
|
|
44
55
|
outObj.sort = ''
|
|
45
56
|
outObj.order = ''
|
|
46
57
|
}
|
|
47
|
-
if (!noQuery) {
|
|
58
|
+
if (!noQuery) {
|
|
59
|
+
//true 不查询,适合列表一加载时
|
|
48
60
|
return eval(doQueryMethod)
|
|
49
61
|
}
|
|
50
|
-
}
|
|
62
|
+
},
|
|
51
63
|
}
|
|
52
64
|
return outObj
|
|
53
65
|
}
|
|
54
|
-
|
package/src/utils/comutils.js
CHANGED
|
@@ -1,40 +1,64 @@
|
|
|
1
|
-
function genRules(
|
|
1
|
+
function genRules(
|
|
2
|
+
isRequired,
|
|
3
|
+
minLength,
|
|
4
|
+
maxLength,
|
|
5
|
+
type = 'string',
|
|
6
|
+
decimalNum
|
|
7
|
+
) {
|
|
8
|
+
// decimalNum=0是整数
|
|
2
9
|
const result = []
|
|
3
10
|
if (isRequired) {
|
|
4
|
-
const msg = {message: this.$t('此处必填'), required: true}
|
|
11
|
+
const msg = { message: this.$t('此处必填'), required: true }
|
|
5
12
|
result.push(msg)
|
|
6
13
|
}
|
|
7
14
|
if (type == 'string') {
|
|
8
15
|
if (minLength) {
|
|
9
|
-
result.push({
|
|
16
|
+
result.push({
|
|
17
|
+
min: minLength,
|
|
18
|
+
message: this.$t('字符长度不能小于x个字符', [minLength]),
|
|
19
|
+
})
|
|
10
20
|
}
|
|
11
21
|
if (maxLength) {
|
|
12
|
-
result.push({
|
|
22
|
+
result.push({
|
|
23
|
+
max: maxLength,
|
|
24
|
+
message: this.$t('字符长度不能大于x个字符', [maxLength]),
|
|
25
|
+
})
|
|
13
26
|
}
|
|
14
27
|
} else if (type == 'number') {
|
|
15
|
-
result.push({type: 'number', message: this.$t('必须为数字')})
|
|
28
|
+
result.push({ type: 'number', message: this.$t('必须为数字') })
|
|
16
29
|
if (minLength != null) {
|
|
17
|
-
result.push({
|
|
30
|
+
result.push({
|
|
31
|
+
type: 'number',
|
|
32
|
+
min: minLength,
|
|
33
|
+
message: this.$t('数字不能小于') + minLength,
|
|
34
|
+
})
|
|
18
35
|
}
|
|
19
36
|
if (maxLength) {
|
|
20
|
-
result.push({
|
|
37
|
+
result.push({
|
|
38
|
+
type: 'number',
|
|
39
|
+
max: maxLength,
|
|
40
|
+
message: this.$t('数字不能大于') + maxLength,
|
|
41
|
+
})
|
|
21
42
|
}
|
|
22
|
-
if (decimalNum) {
|
|
43
|
+
if (decimalNum) {
|
|
44
|
+
// 非0时,有小数
|
|
23
45
|
const reg = new RegExp('^(\\-|\\+?)\\d+(\\.\\d{0,' + decimalNum + '})?$')
|
|
24
|
-
result.push({
|
|
25
|
-
|
|
46
|
+
result.push({
|
|
47
|
+
pattern: reg,
|
|
48
|
+
message: this.$t('小数最多x位', [decimalNum]),
|
|
49
|
+
})
|
|
26
50
|
}
|
|
27
51
|
if (decimalNum === 0) {
|
|
28
52
|
const reg = new RegExp('(^-?\\d+$)')
|
|
29
|
-
result.push({pattern: reg, message: this.$t('请输入整数')}
|
|
30
|
-
)
|
|
53
|
+
result.push({ pattern: reg, message: this.$t('请输入整数') })
|
|
31
54
|
}
|
|
32
55
|
}
|
|
33
56
|
|
|
34
57
|
return result
|
|
35
58
|
}
|
|
36
59
|
|
|
37
|
-
function ckFt(value) {
|
|
60
|
+
function ckFt(value) {
|
|
61
|
+
// checkbox展示用
|
|
38
62
|
if (value == '1') {
|
|
39
63
|
return '√'
|
|
40
64
|
} else {
|
|
@@ -42,57 +66,55 @@ function ckFt(value) { // checkbox展示用
|
|
|
42
66
|
}
|
|
43
67
|
}
|
|
44
68
|
|
|
45
|
-
|
|
46
69
|
function date() {
|
|
47
70
|
return
|
|
48
71
|
}
|
|
49
72
|
|
|
50
73
|
export default {
|
|
51
|
-
|
|
52
74
|
install(Vue) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
window.$vueApp.config.globalProperties.$r = genRules
|
|
76
|
+
window.$vueApp.config.globalProperties.$ckFt = ckFt
|
|
77
|
+
window.$vueApp.config.globalProperties.$date = {
|
|
56
78
|
type: 'date',
|
|
57
79
|
placeholder: '选择日期',
|
|
58
80
|
format: 'yyyy-MM-dd',
|
|
59
81
|
valueFormat: 'yyyy-MM-dd',
|
|
60
|
-
style: {width: '100%'}
|
|
82
|
+
style: { width: '100%' },
|
|
61
83
|
}
|
|
62
|
-
|
|
84
|
+
window.$vueApp.config.globalProperties.$time = {
|
|
63
85
|
type: 'datetime',
|
|
64
86
|
placeholder: '选择时间',
|
|
65
87
|
format: 'yyyy-MM-dd HH:mm',
|
|
66
88
|
valueFormat: 'yyyy-MM-dd HH:mm',
|
|
67
|
-
style: {width: '100%'}
|
|
89
|
+
style: { width: '100%' },
|
|
68
90
|
}
|
|
69
|
-
|
|
91
|
+
window.$vueApp.config.globalProperties.$simdate = {
|
|
70
92
|
type: 'date',
|
|
71
93
|
placeholder: '选择日期',
|
|
72
94
|
format: 'yy-MM-dd',
|
|
73
95
|
valueFormat: 'yyyy-MM-dd',
|
|
74
|
-
style: {width: '100%'}
|
|
96
|
+
style: { width: '100%' },
|
|
75
97
|
}
|
|
76
|
-
|
|
98
|
+
window.$vueApp.config.globalProperties.$simtime = {
|
|
77
99
|
type: 'datetime',
|
|
78
100
|
placeholder: '选择时间',
|
|
79
101
|
format: 'yy-MM-dd HH:mm',
|
|
80
102
|
valueFormat: 'yyyy-MM-dd HH:mm',
|
|
81
|
-
style: {width: '100%'}
|
|
103
|
+
style: { width: '100%' },
|
|
82
104
|
}
|
|
83
|
-
|
|
105
|
+
window.$vueApp.config.globalProperties.$simdateshow = (v) => {
|
|
84
106
|
if (v) {
|
|
85
107
|
return v.substring(2, 10)
|
|
86
108
|
} else {
|
|
87
109
|
return ''
|
|
88
110
|
}
|
|
89
111
|
}
|
|
90
|
-
|
|
112
|
+
window.$vueApp.config.globalProperties.$simtimeshow = (v) => {
|
|
91
113
|
if (v) {
|
|
92
114
|
return v.substring(2)
|
|
93
115
|
} else {
|
|
94
116
|
return ''
|
|
95
117
|
}
|
|
96
118
|
}
|
|
97
|
-
}
|
|
119
|
+
},
|
|
98
120
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const eventRegistryMap = new WeakMap()
|
|
2
|
+
function getRegistry(instance) {
|
|
3
|
+
let events = eventRegistryMap.get(instance)
|
|
4
|
+
if (!events) {
|
|
5
|
+
eventRegistryMap.set(instance, (events = Object.create(null)))
|
|
6
|
+
}
|
|
7
|
+
return events
|
|
8
|
+
}
|
|
9
|
+
export function $on(instance, event, fn) {
|
|
10
|
+
if (Array.isArray(event)) {
|
|
11
|
+
event.forEach((e) => $on(instance, e, fn))
|
|
12
|
+
} else {
|
|
13
|
+
const events = getRegistry(instance)
|
|
14
|
+
;(events[event] || (events[event] = [])).push(fn)
|
|
15
|
+
}
|
|
16
|
+
return instance
|
|
17
|
+
}
|
|
18
|
+
export function $once(instance, event, fn) {
|
|
19
|
+
const wrapped = (...args) => {
|
|
20
|
+
$off(instance, event, wrapped)
|
|
21
|
+
fn.call(instance, ...args)
|
|
22
|
+
}
|
|
23
|
+
wrapped.fn = fn
|
|
24
|
+
$on(instance, event, wrapped)
|
|
25
|
+
return instance
|
|
26
|
+
}
|
|
27
|
+
export function $off(instance, event, fn) {
|
|
28
|
+
const vm = instance
|
|
29
|
+
// all
|
|
30
|
+
if (!event) {
|
|
31
|
+
eventRegistryMap.set(instance, Object.create(null))
|
|
32
|
+
return vm
|
|
33
|
+
}
|
|
34
|
+
// array of events
|
|
35
|
+
if (Array.isArray(event)) {
|
|
36
|
+
event.forEach((e) => $off(instance, e, fn))
|
|
37
|
+
return vm
|
|
38
|
+
}
|
|
39
|
+
// specific event
|
|
40
|
+
const events = getRegistry(instance)
|
|
41
|
+
const cbs = events[event]
|
|
42
|
+
if (!cbs) {
|
|
43
|
+
return vm
|
|
44
|
+
}
|
|
45
|
+
if (!fn) {
|
|
46
|
+
events[event] = undefined
|
|
47
|
+
return vm
|
|
48
|
+
}
|
|
49
|
+
events[event] = cbs.filter((cb) => !(cb === fn || cb.fn === fn))
|
|
50
|
+
return vm
|
|
51
|
+
}
|
|
52
|
+
export function $emit(instance, event, ...args) {
|
|
53
|
+
instance && instance.$emit && instance.$emit(event, ...args)
|
|
54
|
+
const cbs = getRegistry(instance)[event]
|
|
55
|
+
if (cbs) {
|
|
56
|
+
cbs.map((cb) => cb.apply(instance, args))
|
|
57
|
+
}
|
|
58
|
+
return instance
|
|
59
|
+
}
|
package/src/utils/utils.js
CHANGED
|
@@ -6,15 +6,21 @@ Date.prototype.format = function (format) {
|
|
|
6
6
|
'm+': this.getMinutes(),
|
|
7
7
|
's+': this.getSeconds(),
|
|
8
8
|
'q+': Math.floor((this.getMonth() + 3) / 3), // quarter
|
|
9
|
-
|
|
9
|
+
S: this.getMilliseconds(),
|
|
10
10
|
}
|
|
11
11
|
if (/(y+)/.test(format)) {
|
|
12
|
-
format = format.replace(
|
|
12
|
+
format = format.replace(
|
|
13
|
+
RegExp.$1,
|
|
14
|
+
(this.getFullYear() + '').substr(4 - RegExp.$1.length)
|
|
15
|
+
)
|
|
13
16
|
}
|
|
14
17
|
for (var i in args) {
|
|
15
18
|
var n = args[i]
|
|
16
19
|
if (new RegExp('(' + i + ')').test(format)) {
|
|
17
|
-
format = format.replace(
|
|
20
|
+
format = format.replace(
|
|
21
|
+
RegExp.$1,
|
|
22
|
+
RegExp.$1.length == 1 ? n : ('00' + n).substr(('' + n).length)
|
|
23
|
+
)
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
return format
|
|
@@ -36,17 +42,17 @@ String.prototype.formatStr = function (format) {
|
|
|
36
42
|
}
|
|
37
43
|
if (!date instanceof Date) return
|
|
38
44
|
var dict = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
yyyy: date.getFullYear(),
|
|
46
|
+
M: date.getMonth() + 1,
|
|
47
|
+
d: date.getDate(),
|
|
48
|
+
H: date.getHours(),
|
|
49
|
+
m: date.getMinutes(),
|
|
50
|
+
s: date.getSeconds(),
|
|
51
|
+
MM: ('' + (date.getMonth() + 101)).substr(1),
|
|
52
|
+
dd: ('' + (date.getDate() + 100)).substr(1),
|
|
53
|
+
HH: ('' + (date.getHours() + 100)).substr(1),
|
|
54
|
+
mm: ('' + (date.getMinutes() + 100)).substr(1),
|
|
55
|
+
ss: ('' + (date.getSeconds() + 100)).substr(1),
|
|
50
56
|
}
|
|
51
57
|
return format.replace(/(yyyy|MM?|dd?|HH?|ss?|mm?)/g, function () {
|
|
52
58
|
return dict[arguments[0]]
|
|
@@ -58,10 +64,16 @@ String.prototype.replaceAll = function (oldStr, newStr) {
|
|
|
58
64
|
// 遍历整个数组,移除匹配item的元素,使用强比较===,给第二个参数的话就从头开始找到第一个匹配item元素移除后返回;
|
|
59
65
|
// 如有找到元素返回处理后的数组自身,如果没有找到过就返回undefined;
|
|
60
66
|
Array.prototype.remove = function (item, all) {
|
|
61
|
-
let result,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
let result,
|
|
68
|
+
isType = Object.prototype.toString,
|
|
69
|
+
i,
|
|
70
|
+
len,
|
|
71
|
+
start,
|
|
72
|
+
hasLast = arguments[2]
|
|
73
|
+
;(start = 0), (len = this.length)
|
|
74
|
+
for (i = start; i < len; ) {
|
|
75
|
+
var isPass = true,
|
|
76
|
+
inx
|
|
65
77
|
if (!hasLast) {
|
|
66
78
|
inx = i
|
|
67
79
|
} else {
|
|
@@ -102,4 +114,3 @@ Array.prototype.removeone = function (item) {
|
|
|
102
114
|
}
|
|
103
115
|
return -1
|
|
104
116
|
}
|
|
105
|
-
|