diff --git a/src/views/modules/base/smartExcel/cpts/excel-summary.vue b/src/views/modules/base/smartExcel/cpts/excel-summary.vue index 2d25cd514..8f6f58b50 100644 --- a/src/views/modules/base/smartExcel/cpts/excel-summary.vue +++ b/src/views/modules/base/smartExcel/cpts/excel-summary.vue @@ -12,7 +12,7 @@

提报的文件

-
+
{{ item.title }}周期更新表
({{ item.state }})
diff --git a/src/views/modules/base/smartExcel/cpts/excel-view.vue b/src/views/modules/base/smartExcel/cpts/excel-view.vue index 8b0336ae3..ebf75d9f1 100644 --- a/src/views/modules/base/smartExcel/cpts/excel-view.vue +++ b/src/views/modules/base/smartExcel/cpts/excel-view.vue @@ -76,39 +76,34 @@ export default { }, watch: {}, mounted() { - // this.initSocket() + this.initSocket() this.loadWorkBook() }, methods: { - loadWorkBook() { - // const { data, code, msg } = await requestGet(`/actual/base/luckySheet/workbook/load?workbookId=${this.workbookId}`) - // if (code === 0) { + async loadWorkBook() { + const data = await this.$http.post(`/actual/base/luckySheet/workbook/load?workbookId=${this.workbookId}`) window.luckysheet.destroy(); - // options.data = data.sheets; - // options.title = data.fileName; - const {id} = this.$store.state.user; - options.loadUrl = `http://219.146.91.110:30801/api/actual/base/luckySheet/workbook/load?wordbookId=${this.workbookId}` - options.updateUrl = `ws://219.146.91.110:30801/api/actual/base/ws/luckysheet/${this.workbookId}/${id}` + options.data = data.data; window.luckysheet.create({ ...options, hook: { cellEditBefore: this.handleCellEditBefore, - // cellUpdateBefore: this.handleCellUpdateBefore, + updated: this.handleCellUpdateBefore, sheetCreateAfter: this.handleSheetCreateAfter, cellUpdated: this.handleCellUpdated, }, }); - // } else { - // console.log(msg); - // } }, handleSheetCreateAfter(e) { console.log('setsheet', e); }, + isOpen(ws) { + return ws.readyState === ws.OPEN + }, 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 = new WebSocket(`ws://219.146.91.110:30801/api/actual/base/ws/luckysheet/${this.workbookId}/${id}`,token); this.socket.addEventListener('open', () => { console.log('WebSocket连接已打开'); }); @@ -119,15 +114,17 @@ export default { }); }, sendMessage(message) { - this.socket.send(JSON.stringify(message)); - this.newMessage = ''; + if (this.isOpen(this.socket)) { + this.socket.send(JSON.stringify(message)); + } else { + console.info('链接已经断开'); + } }, handleClickMenu(i) { this.menuActive = i; }, loadExcel() { var url = 'http://localhost:9001/epmet-work-pc/test.xlsx' - var that = this fetch(url).then(response => response.blob()) // 将响应转换为Blob .then(blob => { @@ -177,6 +174,7 @@ export default { let obj = { r, c, + t:'v', ...newValue } this.sendMessage(obj) @@ -187,8 +185,8 @@ export default { this.selectedCell = "第" + row + "行" + "第" + column + "列"; }, - handleCellUpdateBefore() { - this.selectedCell = ""; + handleCellUpdateBefore(e) { + console.log(e); }, handleTabClick(tab, event) { console.log(tab, event); diff --git a/src/views/modules/base/smartExcel/filling.vue b/src/views/modules/base/smartExcel/filling.vue index 959ba2506..9917f7c5d 100644 --- a/src/views/modules/base/smartExcel/filling.vue +++ b/src/views/modules/base/smartExcel/filling.vue @@ -143,14 +143,14 @@ export default { }, statusArray: [ { - label: '', - value: '' + label: '1', + value: '1' }, { - label: '', - value: '' + label: '1', + value: '2' }, { - label: '', - value: '' + label: '1', + value: '3' }, ], orgOptionProps, diff --git a/src/views/modules/base/smartExcel/index.vue b/src/views/modules/base/smartExcel/index.vue index fadb79b4b..1229e0bd8 100644 --- a/src/views/modules/base/smartExcel/index.vue +++ b/src/views/modules/base/smartExcel/index.vue @@ -253,7 +253,6 @@ export default { }, async getTableData() { const url = "/governance/icEventOld/list"; - console.log(this.formData, "formData"); if (Array.isArray(this.formData.agencyId) && this.formData.agencyId.length) { if (this.level == "grid") { this.formData.gridId = this.formData.agencyId[this.formData.agencyId.length - 1];