|
@@ -57,7 +57,7 @@ export default class HTableForm {
|
|
|
},
|
|
|
methods: {
|
|
|
//鼠标右键菜单
|
|
|
- contextmenuClick(event) {
|
|
|
+ contextmenuClick(a, b, c, d, e, f, event) {
|
|
|
event.preventDefault();
|
|
|
},
|
|
|
//鼠标右键事件
|
|
@@ -262,22 +262,36 @@ export default class HTableForm {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //设置表单样式
|
|
|
+ static setFormStyle(key, name = 'hc-red-border', add = false) {
|
|
|
+ const dom = document.getElementById(key)
|
|
|
+ let parent = dom?.parentElement ?? ''
|
|
|
+ if (dom.tagName === 'INPUT') {
|
|
|
+ parent = parent?.parentElement ?? ''
|
|
|
+ this.setFormClass(parent, name, add)
|
|
|
+ } else if (dom.tagName === 'TEXTAREA') {
|
|
|
+ this.setFormClass(dom, name, add)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static setFormClass(dom, name = 'hc-red-border', add = false) {
|
|
|
+ const classStr = dom.getAttribute('class')
|
|
|
+ const classArr = classStr.split(' ')
|
|
|
+ const index = classArr.indexOf(name)
|
|
|
+ if (index === -1 && add) {
|
|
|
+ classArr.push(name)
|
|
|
+ } else if (index !== -1 && false) {
|
|
|
+ classArr.splice(index, 1)
|
|
|
+ }
|
|
|
+ dom.setAttribute('class', classArr.join(' '))
|
|
|
+ }
|
|
|
+
|
|
|
//设置选中样式
|
|
|
static setCheckKeyStyle(key, remove = false) {
|
|
|
- const dom = document.getElementById(key);
|
|
|
- const parent = dom?.parentElement ?? ''
|
|
|
- if (parent && !remove) {
|
|
|
- if (dom.tagName === 'INPUT') {
|
|
|
- parent.style = '--el-input-border-color: #1ECC95; box-shadow: 0 0 0 2px #1ECC95 inset;'
|
|
|
- } else if (dom.tagName === 'TEXTAREA') {
|
|
|
- dom.style = '--el-input-border-color: #1ECC95; box-shadow: 0 0 0 2px #1ECC95 inset;'
|
|
|
- }
|
|
|
- } else if (parent && remove) {
|
|
|
- if (dom.tagName === 'INPUT') {
|
|
|
- parent.style = ''
|
|
|
- } else if (dom.tagName === 'TEXTAREA') {
|
|
|
- dom.style = ''
|
|
|
- }
|
|
|
+ if (remove) {
|
|
|
+ this.setFormStyle(key, 'hc-green-border')
|
|
|
+ } else {
|
|
|
+ this.setFormStyle(key, 'hc-green-border', true)
|
|
|
}
|
|
|
}
|
|
|
|