hd-idevvue3 3.0.3 → 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.
Files changed (147) hide show
  1. package/dist/assets/index.9c127719.css +1 -0
  2. package/dist/hd-idevvue3.mjs +3521 -3305
  3. package/dist/hd-idevvue3.umd.js +29 -29
  4. package/npminstall-debug.log +2 -10
  5. package/package.json +3 -1
  6. package/pnpm-lock.yaml +37 -4
  7. package/src/App.vue +11 -15
  8. package/src/assets/sound/notify.wav +0 -0
  9. package/src/demo/demo.vue +9 -10
  10. package/src/demo/dropdemo.vue +42 -43
  11. package/src/demo/extsets.vue +140 -39
  12. package/src/demo/formedit.vue +157 -145
  13. package/src/demo/hightquery.vue +263 -66
  14. package/src/demo/inlineedit.vue +129 -35
  15. package/src/demo/selfdrop.vue +32 -15
  16. package/src/directive/el-dragDialog/drag.js +13 -13
  17. package/src/directive/el-dragDialog/index.js +13 -13
  18. package/src/errorLog.js +3 -3
  19. package/src/hdcom/BigGrid.js +54 -48
  20. package/src/hdcom/BillShow.vue +84 -63
  21. package/src/hdcom/BillUpload.vue +144 -86
  22. package/src/hdcom/BtnRight.vue +26 -23
  23. package/src/hdcom/ErrHint.vue +36 -24
  24. package/src/hdcom/ExtendColumn.vue +97 -90
  25. package/src/hdcom/ExtendCommon.js +24 -13
  26. package/src/hdcom/ExtendForm.vue +107 -80
  27. package/src/hdcom/FacePicUpload.vue +59 -50
  28. package/src/hdcom/FaceRecTest.vue +87 -77
  29. package/src/hdcom/GridChart.vue +175 -162
  30. package/src/hdcom/GridExField.vue +328 -234
  31. package/src/hdcom/GridShow.vue +89 -39
  32. package/src/hdcom/HdAside.vue +192 -145
  33. package/src/hdcom/HdBtn.vue +44 -32
  34. package/src/hdcom/HdButton.vue +141 -117
  35. package/src/hdcom/HdComFaceRec.vue +80 -32
  36. package/src/hdcom/HdComGrid.vue +329 -229
  37. package/src/hdcom/HdComQuery.vue +179 -90
  38. package/src/hdcom/HdComQueryDetail.vue +159 -115
  39. package/src/hdcom/HdComSortDetail.vue +136 -130
  40. package/src/hdcom/HdDatePicker.vue +32 -16
  41. package/src/hdcom/HdDialog.vue +62 -44
  42. package/src/hdcom/HdDrop.vue +163 -138
  43. package/src/hdcom/HdFileUpload.vue +138 -119
  44. package/src/hdcom/HdFilterBox.vue +62 -62
  45. package/src/hdcom/HdFooter.vue +152 -119
  46. package/src/hdcom/HdForm.vue +276 -203
  47. package/src/hdcom/HdFormBtn.vue +81 -39
  48. package/src/hdcom/HdFormItem.vue +14 -10
  49. package/src/hdcom/HdGrid.vue +353 -156
  50. package/src/hdcom/HdGridEditBtn.vue +34 -20
  51. package/src/hdcom/HdGridExt.js +78 -47
  52. package/src/hdcom/HdGridSel.vue +227 -193
  53. package/src/hdcom/HdHeader.vue +149 -117
  54. package/src/hdcom/HdHotKey.vue +70 -67
  55. package/src/hdcom/HdInputHint.vue +40 -36
  56. package/src/hdcom/HdMain.vue +25 -27
  57. package/src/hdcom/HdMessage.vue +180 -171
  58. package/src/hdcom/HdNum.vue +67 -57
  59. package/src/hdcom/HdPopSel.vue +46 -24
  60. package/src/hdcom/HdRightMenu.vue +63 -61
  61. package/src/hdcom/HdSel/SelGridFieldcod.vue +46 -28
  62. package/src/hdcom/HdTableColumn.vue +156 -109
  63. package/src/hdcom/HdTempSave.vue +138 -116
  64. package/src/hdcom/HdTree.vue +89 -72
  65. package/src/hdcom/HdTreeTable/eval.js +8 -3
  66. package/src/hdcom/HdTreeTable/index.vue +229 -174
  67. package/src/hdcom/ImportExcel.vue +69 -34
  68. package/src/hdcom/index.js +39 -44
  69. package/src/idev.common.js +54 -47
  70. package/src/index.js +3 -6
  71. package/src/utils/HdQuery.js +25 -14
  72. package/src/utils/comutils.js +50 -28
  73. package/src/utils/gogocodeTransfer.js +59 -0
  74. package/src/utils/utils.js +30 -19
  75. package/src/vendor/Blob.js +187 -179
  76. package/src/vendor/Export2Excel.js +231 -220
  77. package/src/vendor/Export2Zip.js +25 -22
  78. package/src/views/layout/AppMain.vue +34 -32
  79. package/src/views/layout/HdLayout.vue +64 -52
  80. package/src/views/layout/header/ElasticSearch.vue +196 -159
  81. package/src/views/layout/header/HZRecorder.js +163 -135
  82. package/src/views/layout/header/HeaderSearch.vue +165 -145
  83. package/src/views/layout/header/Levelbar.vue +55 -49
  84. package/src/views/layout/header/MainHeader.vue +233 -189
  85. package/src/views/layout/header/Navbar.vue +74 -78
  86. package/src/views/layout/header/ScrollPane.vue +103 -81
  87. package/src/views/layout/header/TagsView.vue +169 -164
  88. package/src/views/layout/header/VocRec.vue +86 -78
  89. package/src/views/layout/header/changepswform.vue +98 -64
  90. package/src/views/layout/index.js +5 -7
  91. package/src/views/layout/menu/Hamburger.vue +63 -45
  92. package/src/views/layout/menu/HdMenu.vue +155 -118
  93. package/src/views/layout/menu/index.vue +21 -19
  94. package/src/views/privilege/commsg/commsg.vue +115 -41
  95. package/src/views/privilege/commsg/commsgOrgn.vue +40 -31
  96. package/src/views/privilege/commsg/commsgRole.vue +180 -109
  97. package/src/views/privilege/commsg/commsgform.vue +125 -101
  98. package/src/views/privilege/commsg/commsgiframe.vue +30 -23
  99. package/src/views/privilege/commsg/commsgto.vue +163 -84
  100. package/src/views/privilege/commsg/commsgtoform.vue +64 -58
  101. package/src/views/privilege/commsg/commsgtrans.vue +187 -115
  102. package/src/views/privilege/exfield/comexcolumn.vue +133 -43
  103. package/src/views/privilege/exfield/comexcolumnform.vue +85 -58
  104. package/src/views/privilege/exfield/comexfield.vue +15 -17
  105. package/src/views/privilege/exfield/comexfieldform.vue +71 -53
  106. package/src/views/privilege/exfield/comexfieldsub.vue +137 -46
  107. package/src/views/privilege/index.js +19 -20
  108. package/src/views/privilege/menu/comMenu.vue +49 -41
  109. package/src/views/privilege/menu/menu.vue +166 -49
  110. package/src/views/privilege/menu/menuinfo.vue +41 -34
  111. package/src/views/privilege/menu/rolelist.vue +78 -33
  112. package/src/views/privilege/menu/userlist.vue +76 -33
  113. package/src/views/privilege/mobile/authmobileupdate.vue +119 -43
  114. package/src/views/privilege/mobile/authmobileupdateform.vue +76 -46
  115. package/src/views/privilege/orgDept/authOrgn.vue +157 -65
  116. package/src/views/privilege/orgDept/authorgnform.vue +50 -38
  117. package/src/views/privilege/orgDept/orgDept.vue +38 -37
  118. package/src/views/privilege/orgDept/orgTree.vue +99 -88
  119. package/src/views/privilege/orgDept/orgnselect.vue +132 -111
  120. package/src/views/privilege/personDept/authuser.vue +197 -91
  121. package/src/views/privilege/personDept/authuserform.vue +123 -71
  122. package/src/views/privilege/personDept/facerec.vue +128 -83
  123. package/src/views/privilege/personDept/orgncascader.vue +134 -115
  124. package/src/views/privilege/personDept/personDept.vue +9 -7
  125. package/src/views/privilege/quartz/comquartzjob.vue +123 -38
  126. package/src/views/privilege/quartz/comquartzjobform.vue +67 -51
  127. package/src/views/privilege/quartz/comquartzlog.vue +116 -32
  128. package/src/views/privilege/role/btnRole.vue +123 -67
  129. package/src/views/privilege/role/menuRole.vue +65 -45
  130. package/src/views/privilege/role/orgnRole.vue +63 -41
  131. package/src/views/privilege/role/role.vue +26 -9
  132. package/src/views/privilege/role/rolelist.vue +114 -45
  133. package/src/views/privilege/role/roleselect.vue +34 -17
  134. package/src/views/privilege/search/comsearch.vue +164 -73
  135. package/src/views/privilege/search/menu.vue +38 -22
  136. package/src/views/privilege/syscode/syscode.vue +157 -69
  137. package/src/views/privilege/syscode/sysfield.vue +96 -43
  138. package/src/views/privilege/syscode/sysfieldframe.vue +30 -30
  139. package/src/views/privilege/syslog/menulog.vue +38 -22
  140. package/src/views/privilege/syslog/syslog.vue +145 -78
  141. package/src/views/privilege/syslog/syslogconfig.vue +91 -24
  142. package/src/views/privilege/syslog/syslogform.vue +45 -43
  143. package/src/views/privilege/syslog/syslogframe.vue +26 -26
  144. package/src/views/privilege/userRole/userRole.vue +187 -89
  145. package/vite.config.js +7 -0
  146. package/dist/assets/index.774ef40e.css +0 -1
  147. package/src/views/privilege.zip +0 -0
@@ -1,192 +1,201 @@
1
- <template>
2
- </template>
3
- <script>
1
+ <template></template>
4
2
 
3
+ <script>
4
+ /**
5
+ * websocket消息
6
+ * @module HdMessage
7
+ */
8
+ export default {
9
+ name: 'HdMessage',
10
+ data() {
11
+ return {
12
+ hdQuery: new HdQuery(this),
13
+ websocket: null,
14
+ }
15
+ },
5
16
  /**
6
- * websocket消息
7
- * @module HdMessage
17
+ * prop
18
+ * @prop {allProto} 完整格式 如 wss://gctos.huadong.net/ws,与ipAddr和port互斥
19
+ * @prop {String} ipAddr 有值时,使用该值,无值时,localhost下 为localhost:8080,其它用浏览器的url
20
+ * @prop {Event} msgRec 消息接收的事件,类型1的会弹出系统自带的消息框
8
21
  */
9
- export default {
10
- name: 'HdMessage',
11
- data() {
12
- return {
13
- hdQuery: new HdQuery(this),
14
- websocket: null,
22
+ props: ['ipAddr', 'port', 'allProto'],
23
+ mounted() {
24
+ window._tabOpen = (path) => {
25
+ //这里必须是全局的
26
+ if (path.indexOf('http') == 0) {
27
+ //http开头的在新窗口打开
28
+ window.open(path)
29
+ } else if (path.indexOf('iframe://') == 0) {
30
+ // this.$refs['commsgiframe'].show(path.substring(9));
31
+ } else {
32
+ this.$router.push({
33
+ path: path,
34
+ })
15
35
  }
16
- },
17
- /**
18
- * prop
19
- * @prop {allProto} 完整格式 如 wss://gctos.huadong.net/ws,与ipAddr和port互斥
20
- * @prop {String} ipAddr 有值时,使用该值,无值时,localhost下 为localhost:8080,其它用浏览器的url
21
- * @prop {Event} msgRec 消息接收的事件,类型1的会弹出系统自带的消息框
22
- */
23
- props: ['ipAddr', 'port', 'allProto'],
24
- mounted() {
25
- window._tabOpen = (path) => {//这里必须是全局的
26
- if (path.indexOf('http') == 0) {//http开头的在新窗口打开
27
- window.open(path);
28
- } else if(path.indexOf('iframe://') == 0) {
29
- // this.$refs['commsgiframe'].show(path.substring(9));
30
- } else {
31
- this.$router.push({
32
- path: path,
33
- });
34
- }
36
+ }
37
+ this.init()
38
+ this.readMessage()
39
+ },
40
+ methods: {
41
+ init() {
42
+ this.socketConnect()
43
+
44
+ // 连接发生错误的回调方法
45
+ this.websocket.onerror = () => {
46
+ this.websocket = -1
47
+ console.info('连接发生错误')
48
+ //this.doMsg("连接发生错误");
35
49
  }
36
- this.init()
37
- this.readMessage();
38
- },
39
- methods: {
40
- init() {
41
- this.socketConnect()
42
50
 
43
- // 连接发生错误的回调方法
44
- this.websocket.onerror = () => {
45
- this.websocket = -1
46
- console.info("连接发生错误")
47
- //this.doMsg("连接发生错误");
48
- };
51
+ // 连接成功建立的回调方法
52
+ this.websocket.onopen = () => {
53
+ console.info('websocket success')
54
+ this.doHeartConnect() //开启心跳连接
55
+ //this.doMsg("连接成功");
56
+ }
49
57
 
50
- // 连接成功建立的回调方法
51
- this.websocket.onopen = () => {
52
- console.info("websocket success")
53
- this.doHeartConnect()//开启心跳连接
54
- //this.doMsg("连接成功");
58
+ // 接收到消息的回调方法,此处添加处理接收消息方法,当前是将接收到的信息显示在网页上
59
+ this.websocket.onmessage = (event) => {
60
+ let msgObj = JSON.parse(event.data)
61
+ if (msgObj.msgType == -2) {
62
+ //单用户登录:退出到登录页
63
+ this.singleLoginNotify(msgObj)
64
+ return false
55
65
  }
56
-
57
- // 接收到消息的回调方法,此处添加处理接收消息方法,当前是将接收到的信息显示在网页上
58
- this.websocket.onmessage = (event) => {
59
- let msgObj = JSON.parse(event.data)
60
- if (msgObj.msgType == -2) {//单用户登录:退出到登录页
61
- this.singleLoginNotify(msgObj)
62
- return false
63
- }
64
- //未读消息加一
65
- this.$store.state.user.messageNum = this.$store.state.user.messageNum + 1;
66
- if (msgObj.msgType == 1) {//type 1为普通消息,默认提示,其它类型发送给业务系统判断
67
- this.doMsgObj(msgObj);
68
- }
69
- this.$emit('msgRec', msgObj)//父类处理事件
66
+ //未读消息加一
67
+ this.$store.state.user.messageNum =
68
+ this.$store.state.user.messageNum + 1
69
+ if (msgObj.msgType == 1) {
70
+ //type 1为普通消息,默认提示,其它类型发送给业务系统判断
71
+ this.doMsgObj(msgObj)
70
72
  }
73
+ this.$emit('msgRec', msgObj) //父类处理事件
74
+ }
71
75
 
72
- // 连接关闭的回调方法
73
- this.websocket.onclose = () => {
74
- console.info("websocket close,restart")
75
- if (this.websocket != -1) {//连接错误,停止使用
76
- this.websocket = null
77
- this.init()//重新连接
78
- }
76
+ // 连接关闭的回调方法
77
+ this.websocket.onclose = () => {
78
+ console.info('websocket close,restart')
79
+ if (this.websocket != -1) {
80
+ //连接错误,停止使用
81
+ this.websocket = null
82
+ this.init() //重新连接
79
83
  }
80
-
81
- }
82
- ,
83
- singleLoginNotify(msgObj) {
84
- this.$notify({
85
- title: '',
86
- message: this.$t('该账号已在其它地方登录,5秒后将退出系统'),
87
- duration: 5000,
88
- onClose: () => {
89
- this.$store.dispatch('LogOut').then(() => {
90
- location.reload()// 为了重新实例化vue-router对象 避免bug
91
- })
92
- }
93
- });
94
84
  }
95
- ,
96
- socketConnect() {
97
- // 判断当前浏览器是否支持WebSocket
98
- let inPort = this.port
99
- if ('WebSocket' in window) {
100
- if (!this.port) {
101
- inPort = '8080';
102
- }
103
- // let host = "127.0.0.1:8080" //window.location.host
104
- let host = window.location.host //window.location.host
105
- // 创建一个WebSocket连接,URL:127.0.0.1:8080/realTimeWebSocket/webSocket
106
- if (host.indexOf("localhost") >= 0) {
107
- host = "127.0.0.1:" + inPort
108
- }
109
- if (this.ipAddr) {
110
- host = this.ipAddr + ":" + inPort
111
- }
112
- if (this.allProto) {
113
- this.websocket = new WebSocket(this.allProto + "?token=" + this.$store.getters.token);
114
- } else {
115
- this.websocket = new WebSocket("ws://" + host + "/ws?token=" + this.$store.getters.token);
116
- }
85
+ },
86
+ singleLoginNotify(msgObj) {
87
+ this.$notify({
88
+ title: '',
89
+ message: this.$t('该账号已在其它地方登录,5秒后将退出系统'),
90
+ duration: 5000,
91
+ onClose: () => {
92
+ this.$store.dispatch('LogOut').then(() => {
93
+ location.reload() // 为了重新实例化vue-router对象 避免bug
94
+ })
95
+ },
96
+ })
97
+ },
98
+ socketConnect() {
99
+ // 判断当前浏览器是否支持WebSocket
100
+ let inPort = this.port
101
+ if ('WebSocket' in window) {
102
+ if (!this.port) {
103
+ inPort = '8080'
104
+ }
105
+ // let host = "127.0.0.1:8080" //window.location.host
106
+ let host = window.location.host //window.location.host
107
+ // 创建一个WebSocket连接,URL:127.0.0.1:8080/realTimeWebSocket/webSocket
108
+ if (host.indexOf('localhost') >= 0) {
109
+ host = '127.0.0.1:' + inPort
110
+ }
111
+ if (this.ipAddr) {
112
+ host = this.ipAddr + ':' + inPort
113
+ }
114
+ if (this.allProto) {
115
+ this.websocket = new WebSocket(
116
+ this.allProto + '?token=' + this.$store.getters.token
117
+ )
117
118
  } else {
118
- alert('当前浏览器 不支持WebSocket')
119
+ this.websocket = new WebSocket(
120
+ 'ws://' + host + '/ws?token=' + this.$store.getters.token
121
+ )
119
122
  }
120
- },
121
- readMessage() {
122
- this.hdQuery.query.readFlg = '0';
123
- this.hdQuery.rows = '1000';
124
- this.hdQuery.sort = 'sendTim'
123
+ } else {
124
+ alert('当前浏览器 不支持WebSocket')
125
+ }
126
+ },
127
+ readMessage() {
128
+ this.hdQuery.query.readFlg = '0'
129
+ this.hdQuery.rows = '1000'
130
+ this.hdQuery.sort = 'sendTim'
125
131
 
126
- this.$http.post('/webresources/login/com/ComMsg/find/rec', this.hdQuery).then(response => {
127
- if (response.data.total === 0) {
128
- return;
129
- }
130
- var msg = {};
131
- msg.title = this.$t('消息提示');
132
- msg.content = this.$t('您有{total}条未读消息', {total: response.data.total});
133
- msg.url = '/privilege/commsgto'
134
- this.$store.state.user.messageNum = response.data.total;
135
- this.doMsgObj(msg);
136
- // let data = response.data.rows;
137
- // for (let i = 0; i < data.length; i++) {
138
- // this.doMsgObj(data[i]);
139
- // }
132
+ this.$http
133
+ .post('/webresources/login/com/ComMsg/find/rec', this.hdQuery)
134
+ .then((response) => {
135
+ if (response.data.total === 0) {
136
+ return
140
137
  }
141
- )
138
+ var msg = {}
139
+ msg.title = this.$t('消息提示')
140
+ msg.content = this.$t('您有{total}条未读消息', {
141
+ total: response.data.total,
142
+ })
143
+ msg.url = '/privilege/commsgto'
144
+ this.$store.state.user.messageNum = response.data.total
145
+ this.doMsgObj(msg)
146
+ // let data = response.data.rows;
147
+ // for (let i = 0; i < data.length; i++) {
148
+ // this.doMsgObj(data[i]);
149
+ // }
150
+ })
151
+ },
152
+ doMsgObj(con) {
153
+ let msgcon = ''
154
+ if (con.url) {
155
+ msgcon = `<a onclick="_tabOpen('${con.url}')">${con.content}</a>`
156
+ } else {
157
+ msgcon = con.content
142
158
  }
143
- ,
144
- doMsgObj(con) {
145
- let msgcon = ""
146
- if (con.url) {
147
- msgcon = `<a onclick="_tabOpen('${con.url}')">${con.content}</a>`
148
- } else {
149
- msgcon = con.content
150
- }
151
- //document.getElementById("video").src=require('../assets/sound/notify.wav')
152
- //this.notify = new Audio(require('../assets/sound/notify.wav'));
153
- this.notify = new Audio(`/webresources/login/com/comwav/txtRead?text=${con.content}`);
154
- this.notify.play();
159
+ //document.getElementById("video").src=require('../assets/sound/notify.wav')
160
+ //this.notify = new Audio(require('../assets/sound/notify.wav'));
161
+ this.notify = new Audio(
162
+ `/webresources/login/com/comwav/txtRead?text=${con.content}`
163
+ )
164
+ this.notify.play()
155
165
 
156
- this.$notify({
157
- dangerouslyUseHTMLString: true,
158
- title: con.title,
159
- message: msgcon,
160
- duration: 10000,
161
- position: 'bottom-right'
162
- });
163
- if (!con.msgRecId) {
164
- con.msgRecId = con.recId;
165
- }
166
-
167
- //消息展示完不在把消息标为已读
168
- // this.$http.post('/webresources/login/com/ComMsg/read', {recId: con.msgRecId}).then(response => {
169
- // var data = response.data;
170
- // if (data.code != '1') {
171
- // this.$message({
172
- // type: 'error',
173
- // message: data.message
174
- // })
175
- // }
176
- // })
166
+ this.$notify({
167
+ dangerouslyUseHTMLString: true,
168
+ title: con.title,
169
+ message: msgcon,
170
+ duration: 10000,
171
+ position: 'bottom-right',
172
+ })
173
+ if (!con.msgRecId) {
174
+ con.msgRecId = con.recId
177
175
  }
178
- ,
179
- doHeartConnect() {
180
- setInterval(() => {
181
- try {
182
- if (this.websocket && this.websocket != -1) {
183
- this.websocket.send('ping')
184
- }
185
- } catch (e) {
186
- console.error(e)
176
+
177
+ //消息展示完不在把消息标为已读
178
+ // this.$http.post('/webresources/login/com/ComMsg/read', {recId: con.msgRecId}).then(response => {
179
+ // var data = response.data;
180
+ // if (data.code != '1') {
181
+ // this.$message({
182
+ // type: 'error',
183
+ // message: data.message
184
+ // })
185
+ // }
186
+ // })
187
+ },
188
+ doHeartConnect() {
189
+ setInterval(() => {
190
+ try {
191
+ if (this.websocket && this.websocket != -1) {
192
+ this.websocket.send('ping')
187
193
  }
188
- }, 30000)
189
- }
190
- }
191
- }
194
+ } catch (e) {
195
+ console.error(e)
196
+ }
197
+ }, 30000)
198
+ },
199
+ },
200
+ }
192
201
  </script>
@@ -1,69 +1,79 @@
1
1
  <template>
2
- <el-input :clearable="false" :disabled="disabled" :step="step" @blur="myblur" @change="mychange"
3
- class="hdnum" onkeypress='return( "e"!=(String.fromCharCode(event.keyCode).toLowerCase()))'
4
- ref="numInput" type="number"
5
- v-model.lazy="mynum"></el-input>
2
+ <el-input
3
+ :clearable="false"
4
+ :disabled="disabled"
5
+ :step="step"
6
+ @blur="myblur"
7
+ @change="mychange"
8
+ class="hdnum"
9
+ onkeypress='return( "e"!=(String.fromCharCode(event.keyCode).toLowerCase()))'
10
+ ref="numInput"
11
+ type="number"
12
+ v-model.lazy="mynum"
13
+ ></el-input>
6
14
  </template>
7
- <!-- onkeypress 是为了阻止e的输入html5的问题-->
15
+
8
16
  <script>
17
+ /**
18
+ * 输入区为数字时使用,请勿直接使用el-input(校验时空处理有问题)
19
+ * @module HdNum
20
+ */
21
+ export default {
22
+ name: 'HdNum',
23
+ data() {
24
+ return {
25
+ mynum: null,
26
+ }
27
+ },
28
+ inheritAttrs: false,
9
29
  /**
10
- * 输入区为数字时使用,请勿直接使用el-input(校验时空处理有问题)
11
- * @module HdNum
30
+ * Props 不继承任何属性
31
+ * @prop {int} value 值,组件使用 v-model=""
32
+ * @prop {int} step 步长
33
+ * @prop {boolean} disabled
34
+ * @change
35
+ * @blur
12
36
  */
13
- export default {
14
- name: 'HdNum',
15
- data() {
16
- return {
17
- mynum: null
37
+ props: ['value', 'step', 'disabled'],
38
+ methods: {
39
+ mychange(evt) {
40
+ if (typeof evt == 'undefined' || evt === '') {
41
+ // 空字符串设置为null
42
+ this.mynum = null
43
+ this.$emit('input', null)
44
+ } else {
45
+ this.mynum = parseFloat(evt)
46
+ this.$emit('input', parseFloat(evt))
47
+ }
48
+ this.$emit('change', evt)
49
+ },
50
+ myblur(evt) {
51
+ this.$emit('blur', evt)
52
+ },
53
+ isNumber(val) {
54
+ var regPos = /^\d+(\.\d+)?$/ //非负浮点数
55
+ var regNeg =
56
+ /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/ //负浮点数
57
+ if (regPos.test(val) || regNeg.test(val)) {
58
+ return true
59
+ } else {
60
+ return false
18
61
  }
19
62
  },
20
- inheritAttrs: false,
21
- /**
22
- * Props 不继承任何属性
23
- * @prop {int} value 值,组件使用 v-model=""
24
- * @prop {int} step 步长
25
- * @prop {boolean} disabled
26
- * @change
27
- * @blur
28
- */
29
- props: ['value', 'step', 'disabled'],
30
- methods: {
31
- mychange(evt) {
32
- if (typeof (evt) == 'undefined' || evt === '') { // 空字符串设置为null
33
- this.mynum = null
34
- this.$emit('input', null)
63
+ },
64
+ watch: {
65
+ // 给外层v-model赋值
66
+ value: {
67
+ handler: function (val, oldVal) {
68
+ if (val && this.isNumber(val)) {
69
+ this.mynum = parseFloat(val)
70
+ this.$emit('input', parseFloat(val))
35
71
  } else {
36
- this.mynum = parseFloat(evt)
37
- this.$emit('input', parseFloat(evt))
72
+ this.mynum = val
38
73
  }
39
- this.$emit('change', evt)
40
- },
41
- myblur(evt) {
42
- this.$emit('blur', evt)
43
74
  },
44
- isNumber(val) {
45
- var regPos = /^\d+(\.\d+)?$/; //非负浮点数
46
- var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
47
- if (regPos.test(val) || regNeg.test(val)) {
48
- return true;
49
- } else {
50
- return false;
51
- }
52
- }
75
+ immediate: true,
53
76
  },
54
- watch: {// 给外层v-model赋值
55
- value: {
56
- handler: function (val, oldVal) {
57
- if(val && this.isNumber(val)){
58
- this.mynum = parseFloat(val)
59
- this.$emit('input', parseFloat(val))
60
- } else {
61
- this.mynum = val
62
- }
63
- },
64
- immediate: true
65
- }
66
- }
67
- }
68
-
77
+ },
78
+ }
69
79
  </script>
@@ -1,44 +1,60 @@
1
1
  <template>
2
- <el-input v-bind="$attrs" v-on="$listeners" :placeholder="placeholder?placeholder:''" :value="txtVal" readonly
3
- @focus="$emit('focus')" :disabled="disabled"
4
- ref="sel" @mouseenter.native="doMouseEnter" @mouseleave.native="doMouseLeave" :clearable="false">
5
- <i slot="suffix" class="el-input__icon el-icon-circle-close" v-if="!threePointShow" @click.stop="doClear"
6
- style="cursor:pointer "></i>
7
- <i v-if="threePointShow" slot="suffix" class="el-input__icon el-icon-more" @click="$emit('pop')"
8
- style="cursor:pointer"></i>
2
+ <el-input
3
+ v-bind="$attrs"
4
+ v-on="$listeners"
5
+ :placeholder="placeholder ? placeholder : ''"
6
+ :model-value="txtVal"
7
+ readonly
8
+ @focus="$emit('focus')"
9
+ :disabled="disabled"
10
+ ref="sel"
11
+ @mouseenter.native="doMouseEnter"
12
+ @mouseleave.native="doMouseLeave"
13
+ :clearable="false"
14
+ >
15
+ <el-icon class="el-input__icon" style="cursor: pointer"
16
+ ><el-icon-circle-close
17
+ /></el-icon>
18
+ <el-icon class="el-input__icon" style="cursor: pointer"
19
+ ><el-icon-more
20
+ /></el-icon>
9
21
  </el-input>
10
22
  </template>
11
- <style>
12
- .lucencyInput .el-input__inner {
13
- border: 0px;
14
- }
15
- </style>
23
+
16
24
  <script>
17
- /**
18
- * 废弃,直接使用HdGridSel
19
- * @module HdPoPSel
20
- */
25
+ import {
26
+ CircleClose as ElIconCircleClose,
27
+ More as ElIconMore,
28
+ } from '@element-plus/icons'
21
29
  export default {
30
+ components: {
31
+ ElIconCircleClose,
32
+ ElIconMore,
33
+ },
22
34
  name: 'HdPoPSel',
23
35
  data() {
24
36
  return {
25
37
  popShow: this.show,
26
- threePointShow: true
38
+ threePointShow: true,
27
39
  }
28
40
  },
29
41
  inheritAttrs: false,
42
+ // 设置value为props属性-必须
30
43
  props: {
31
- show: Boolean, txtVal: String, idVal: String, placeholder: String, disabled: Boolean
32
- }, // 设置value为props属性-必须
44
+ show: Boolean,
45
+ txtVal: String,
46
+ idVal: String,
47
+ placeholder: String,
48
+ disabled: Boolean,
49
+ },
33
50
  mounted() {
34
- $(this.$parent.$el).find('.el-popover__reference').removeAttr('tabIndex')// 焦点用
51
+ $(this.$parent.$el).find('.el-popover__reference').removeAttr('tabIndex') // 焦点用
35
52
  },
36
53
  methods: {
37
54
  focus() {
38
55
  this.$refs.sel.focus()
39
56
  },
40
- doQuery() {
41
- },
57
+ doQuery() {},
42
58
  doClear() {
43
59
  this.$emit('clear')
44
60
  },
@@ -52,7 +68,13 @@ export default {
52
68
  },
53
69
  doMouseLeave() {
54
70
  this.threePointShow = true
55
- }
56
- }
71
+ },
72
+ },
57
73
  }
58
74
  </script>
75
+
76
+ <style>
77
+ .lucencyInput .el-input__inner {
78
+ border: 0px;
79
+ }
80
+ </style>