|
|
@@ -475,7 +475,9 @@ export default {
|
|
|
grooveList: [],
|
|
|
hadDoSearch: false,
|
|
|
clickCount: 0, // 列表点击次数
|
|
|
- timer: null
|
|
|
+ timer: null,
|
|
|
+ initOneButtons: [],
|
|
|
+ initDblButtons: [],
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -637,7 +639,6 @@ export default {
|
|
|
this.selectionAll = this.selection ? JSON.parse(JSON.stringify(this.selection)) : []
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
// 标识当前行的唯一键的名称
|
|
|
const { listData } = this
|
|
|
// 总选择里面的key集合
|
|
|
@@ -648,7 +649,6 @@ export default {
|
|
|
} else {
|
|
|
selectionAll.push(this.selectionAll)
|
|
|
}
|
|
|
-
|
|
|
// 获取当前页选中的id
|
|
|
const selectIds = []
|
|
|
if (this.multiple) {
|
|
|
@@ -973,7 +973,6 @@ export default {
|
|
|
this.action = buttonType
|
|
|
this.position = position
|
|
|
this.selection = selection
|
|
|
-
|
|
|
// 前置事件
|
|
|
this.beforeScript(command, position, selection, data, () => {
|
|
|
let src = ''
|
|
|
@@ -1308,6 +1307,12 @@ export default {
|
|
|
btn.position = 'manage'
|
|
|
manageButtons.push(btn)
|
|
|
}
|
|
|
+ if(btn.clickToSync='单击'){
|
|
|
+ this.initOneButtons.push(btn)
|
|
|
+ }
|
|
|
+ if(btn.clickToSync='双击'){
|
|
|
+ this.initDblButtons.push(btn)
|
|
|
+ }
|
|
|
})
|
|
|
let rowHandle = null
|
|
|
|
|
|
@@ -1458,11 +1463,13 @@ export default {
|
|
|
// eslint-disable-next-line no-eval
|
|
|
initAddDataCont: rf.initAddDataCont ? obj : null,
|
|
|
reportPath: rf.reportPath,
|
|
|
+ clickToSync:rf.clickToSync,
|
|
|
mode: mode,
|
|
|
rightIcon: rightIcon,
|
|
|
menus: menus,
|
|
|
disabled: disabled,
|
|
|
- hidden: hidden
|
|
|
+ hidden: hidden,
|
|
|
+ position: rf.position
|
|
|
}
|
|
|
},
|
|
|
// 自定义格式数据事件
|
|
|
@@ -1933,24 +1940,14 @@ export default {
|
|
|
* @description 行点击时触发的事件
|
|
|
*/
|
|
|
handleRowClick (row, event, column) {
|
|
|
- // if (this.selectionType === 'radio') {
|
|
|
- // this.setSelectionRadio(row)
|
|
|
- // this.$emit('selection-change', row)
|
|
|
- // } else {
|
|
|
- // this.$refs.elTable.toggleRowSelection(row)
|
|
|
- // }
|
|
|
- // this.$emit('row-click', row, event, column)
|
|
|
- // console.log('1941 row',row)
|
|
|
- // console.log('1941 event',event)
|
|
|
- // console.log('1941 column',column)
|
|
|
this.clickCount++;
|
|
|
// 判断点击次数,如果是首次点击,则启动延时器
|
|
|
if (this.clickCount === 1) {
|
|
|
- this.timer = setTimeout(() => {
|
|
|
- // 执行单击操作
|
|
|
- this.handleRowOneclick(row, event, column)
|
|
|
- this.clickCount=0
|
|
|
- }, 300); // 设置延时时间,单位为毫秒
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ // 执行单击操作
|
|
|
+ this.handleRowOneclick(row, event, column)
|
|
|
+ this.clickCount=0
|
|
|
+ }, 300); // 设置延时时间,单位为毫秒
|
|
|
} else {
|
|
|
// 如果点击次数大于1,则说明是双击操作,清除延时器,并执行双击操作
|
|
|
clearTimeout(this.timer);
|
|
|
@@ -1962,23 +1959,54 @@ export default {
|
|
|
* @description 行单击时触发的事件
|
|
|
*/
|
|
|
handleRowOneclick (row, event, column) {
|
|
|
- // this.$emit('row-dblclick', row, event)
|
|
|
- console.log('1954 一次row',row)
|
|
|
- console.log('1954 一次event',event)
|
|
|
- console.log('1954 一次column',column)
|
|
|
-
|
|
|
- JTemplate._handleRowClickEvent(this, row, event, column,'NO')
|
|
|
-
|
|
|
+ if(event.label !=='操作'){
|
|
|
+ this.setRowEvent('单击',row)
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* @description 行双击时触发的事件
|
|
|
*/
|
|
|
handleRowDblclick (row, event, column) {
|
|
|
- // this.$emit('row-dblclick', row, event)
|
|
|
- console.log('1954 双击',row)
|
|
|
- JTemplate._handleRowClickEvent(this, row, event, column,'YES')
|
|
|
+ if(event.label !=='操作'){
|
|
|
+ this.setRowEvent('双击',row)
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
+ setRowEvent (operation,row) {
|
|
|
+ // operation = '单击'
|
|
|
+ const functionButtons = this.template.buttons ? this.template.buttons.function_buttons || [] : []
|
|
|
+ if(!functionButtons.length){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const btnIndex = functionButtons.findIndex(item => item.clickToSync === operation);
|
|
|
+ if(btnIndex === -1 ){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 获取拥有点击同步事件按钮的索引位置,该位置是区分是manage,还是toolbar的按钮里的位置
|
|
|
+ // 先给位置按钮区分成两个数组
|
|
|
+ const managBtn = functionButtons.filter(item => item.position === 'manage')
|
|
|
+ const toolbarBtn = functionButtons.filter(item => item.position === 'toolbar')
|
|
|
+ const buttonAct = this.buildButton(functionButtons[btnIndex],btnIndex)
|
|
|
+ const buttonTypeAct = buttonAct.button_type !=='custom' ? buttonAct.button_type : buttonAct.code
|
|
|
+ let indexAct = 0
|
|
|
+ let selectAct = ''
|
|
|
+ let dataAct = ''
|
|
|
+ switch (buttonAct.position) {
|
|
|
+ case 'manage':
|
|
|
+ selectAct = row.id_
|
|
|
+ dataAct = row
|
|
|
+ indexAct = managBtn.findIndex(item => item.button_type === buttonAct.key)
|
|
|
+ break;
|
|
|
+ case 'toolbar':
|
|
|
+ selectAct = [row.id_ ]
|
|
|
+ dataAct = [row]
|
|
|
+ indexAct = toolbarBtn.findIndex(item => item.button_type === buttonAct.key)
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // conso
|
|
|
+ this.handleAction (buttonTypeAct, buttonAct.position, selectAct, dataAct, indexAct, buttonAct)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|