|
@ -36,7 +36,6 @@ import { requestPost, requestGet } from "@/js/dai/request"; |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
selectedCell: '', |
|
|
|
|
|
menuList: [ |
|
|
menuList: [ |
|
|
{ |
|
|
{ |
|
|
name: '2024年11月第三周(已提交)' |
|
|
name: '2024年11月第三周(已提交)' |
|
@ -76,17 +75,13 @@ export default { |
|
|
}, |
|
|
}, |
|
|
watch: {}, |
|
|
watch: {}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
// this.initSocket() |
|
|
|
|
|
this.$nextTick(()=>{ |
|
|
this.$nextTick(()=>{ |
|
|
this.loadWorkBook() |
|
|
this.loadWorkBook() |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
loadWorkBook() { |
|
|
loadWorkBook() { |
|
|
// const { data, code, msg } = await requestPost(`/actual/base/luckySheet/workbook/load?workbookId=${this.workbookId}`) |
|
|
|
|
|
// if (code === 0) { |
|
|
|
|
|
window.luckysheet.destroy(); |
|
|
window.luckysheet.destroy(); |
|
|
// options.title = data.fileName; |
|
|
|
|
|
const {id} = this.$store.state.user; |
|
|
const {id} = this.$store.state.user; |
|
|
options.gridKey = this.workbookId; |
|
|
options.gridKey = this.workbookId; |
|
|
options.allowUpdate = true; |
|
|
options.allowUpdate = true; |
|
@ -97,35 +92,13 @@ export default { |
|
|
...options, |
|
|
...options, |
|
|
hook: { |
|
|
hook: { |
|
|
cellEditBefore: this.handleCellEditBefore, |
|
|
cellEditBefore: this.handleCellEditBefore, |
|
|
// cellUpdateBefore: this.handleCellUpdateBefore, |
|
|
|
|
|
sheetCreateAfter: this.handleSheetCreateAfter, |
|
|
sheetCreateAfter: this.handleSheetCreateAfter, |
|
|
// cellUpdated: this.handleCellUpdated, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
// } else { |
|
|
|
|
|
// console.log(msg); |
|
|
|
|
|
// } |
|
|
|
|
|
}, |
|
|
}, |
|
|
handleSheetCreateAfter(e) { |
|
|
handleSheetCreateAfter(e) { |
|
|
console.log('setsheet', e); |
|
|
console.log('setsheet', e); |
|
|
}, |
|
|
}, |
|
|
initSocket() { |
|
|
|
|
|
const {id} = this.$store.state.user;//${location.origin} |
|
|
|
|
|
const token = localStorage.getItem("token") |
|
|
|
|
|
this.socket = new WebSocket(`ws://192.168.1.144/api/actual/base/ws/luckysheet/${this.workbookId}/${id}`,token); |
|
|
|
|
|
this.socket.addEventListener('open', () => { |
|
|
|
|
|
console.log('WebSocket连接已打开'); |
|
|
|
|
|
}); |
|
|
|
|
|
this.socket.addEventListener('message', (event) => { |
|
|
|
|
|
console.log(event, '接收到消息了'); |
|
|
|
|
|
const message = JSON.parse(event.data); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
sendMessage(message) { |
|
|
|
|
|
this.socket.send(JSON.stringify(message)); |
|
|
|
|
|
this.newMessage = ''; |
|
|
|
|
|
}, |
|
|
|
|
|
handleClickMenu(i) { |
|
|
handleClickMenu(i) { |
|
|
this.menuActive = i; |
|
|
this.menuActive = i; |
|
|
}, |
|
|
}, |
|
@ -164,36 +137,6 @@ export default { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
// //保存 |
|
|
|
|
|
// tableSave() { |
|
|
|
|
|
// var json = window.luckysheet.getAllSheets(); //获取表格的全部数据 |
|
|
|
|
|
// exportExcel(json, "名字").then(res => { |
|
|
|
|
|
// //拿到表格的blob方便下一步操作 |
|
|
|
|
|
// console.log(res, '--11') |
|
|
|
|
|
// }) |
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleCellUpdated(r, c, oldValue, newValue, isRefresh) { |
|
|
|
|
|
console.log(r, c, oldValue, newValue, isRefresh, '--11') |
|
|
|
|
|
let obj = { |
|
|
|
|
|
r, |
|
|
|
|
|
c, |
|
|
|
|
|
...newValue |
|
|
|
|
|
} |
|
|
|
|
|
// this.sendMessage(obj) |
|
|
|
|
|
}, |
|
|
|
|
|
handleCellEditBefore(e) { |
|
|
|
|
|
console.log(e, '--11') |
|
|
|
|
|
let column = parseInt(e[0].column[0]) + 1, row = parseInt(e[0].row[0]) + 1; |
|
|
|
|
|
this.selectedCell = "第" + row + "行" + "第" + column + "列"; |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
handleCellUpdateBefore() { |
|
|
|
|
|
this.selectedCell = ""; |
|
|
|
|
|
}, |
|
|
|
|
|
handleTabClick(tab, event) { |
|
|
handleTabClick(tab, event) { |
|
|
console.log(tab, event); |
|
|
console.log(tab, event); |
|
|
}, |
|
|
}, |
|
|