diff --git a/public/index.html b/public/index.html index 310ece896..7c357efad 100644 --- a/public/index.html +++ b/public/index.html @@ -57,6 +57,13 @@ console.log('============调试版本:1.0.3') console.log('nodeEnv', window.SITE_CONFIG['nodeEnv']) + $.ajaxSetup({ + headers: { + "Authorization": window.localStorage.token, + "token":window.localStorage.token + } + }); + diff --git a/src/utils/luckysheetConfig.js b/src/utils/luckysheetConfig.js index 6b14d9e5a..f0f5f4998 100644 --- a/src/utils/luckysheetConfig.js +++ b/src/utils/luckysheetConfig.js @@ -41,9 +41,10 @@ const options = { findAndReplace: true, //查找替换 protection: true, // 工作表保护 print: true, //打印 + allowUpdate:true, }, showinfobar: true, //是否显示顶部信息栏 - showsheetbar: true, //是否显示底部sheet页按钮 + showsheetbar: false, //是否显示底部sheet页按钮 hook: { //钩子函数 diff --git a/src/views/modules/base/smartExcel/cpts/excel-add.vue b/src/views/modules/base/smartExcel/cpts/excel-add.vue index c40515dd4..1c38a1e66 100644 --- a/src/views/modules/base/smartExcel/cpts/excel-add.vue +++ b/src/views/modules/base/smartExcel/cpts/excel-add.vue @@ -7,17 +7,17 @@ 返回 - - + + - - + + - - + + 一次性 每周 -
{{ item.name }} @@ -20,72 +12,17 @@
- 自动检测 + 自动检测
- 驳回重提 + 驳回重提 审核存档
- + @@ -99,12 +36,7 @@ import { requestPost, requestGet } from "@/js/dai/request"; export default { data() { return { - drawer: false, - direction: 'rtl', selectedCell: '', - activeName: 'first', - radio1: '1', - radio2: '1', menuList: [ { name: '2024年11月第三周(已提交)' @@ -124,7 +56,6 @@ export default { ], menuActive: 0, socket: null, - }; }, props: { @@ -145,44 +76,49 @@ export default { }, watch: {}, mounted() { - this.initSocket() + // this.initSocket() this.loadWorkBook() }, - methods: { - async loadWorkBook() { - const { data, code, msg } = await requestGet(`/actual/base/luckySheet/workbook/load?workbookId=${this.workbookId}`) - if (code === 0) { + loadWorkBook() { + // const { data, code, msg } = await requestGet(`/actual/base/luckySheet/workbook/load?workbookId=${this.workbookId}`) + // if (code === 0) { window.luckysheet.destroy(); - options.data = data + // 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}` window.luckysheet.create({ ...options, hook: { cellEditBefore: this.handleCellEditBefore, // cellUpdateBefore: this.handleCellUpdateBefore, - sheetCreateAfter: this.handleSheetCreateAfter + sheetCreateAfter: this.handleSheetCreateAfter, + cellUpdated: this.handleCellUpdated, }, }); - } else { - console.log(msg); - } + // } else { + // console.log(msg); + // } }, handleSheetCreateAfter(e) { console.log('setsheet', e); }, initSocket() { - this.socket = new WebSocket(''); + 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() { - const message = { - sender: '客户端' - }; + sendMessage(message) { this.socket.send(JSON.stringify(message)); this.newMessage = ''; }, @@ -234,85 +170,24 @@ export default { // }, - handleFileChange(file, newFileList) { - const selectedFile = file.raw; - if (!(selectedFile instanceof File)) { - console.error('传入了非文件对象'); - return; - } + - if (selectedFile.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { - console.log('文件是xlsx类型'); - } else { - console.error('不是xlsx文件'); - return; + handleCellUpdated(r, c, oldValue, newValue, isRefresh) { + console.log(r, c, oldValue, newValue, isRefresh, '--11') + let obj = { + r, + c, + ...newValue } - this.loadExcel(); - // let filename = selectedFile.name.replace(/\.[^/.]+$/, ""); // 去除文件扩展名 - // let reader = new FileReader(); - - // reader.onload = async (e) => { - // let fileData = e.target.result; - // try { - - // LuckyExcel.transformExcelToLucky(fileData, async (exportJson, luckysheetfile) => { - // console.log(exportJson.sheets) - // creatExcel(filename, JSON.stringify(exportJson.sheets)) - // }); - // } catch (e) { - // console.error(e); - // } - // }; - - // reader.onerror = function() { - // console.error("File could not be read! Code " + reader.error.code); - // }; - - // reader.readAsArrayBuffer(selectedFile); - }, - - // creatExcel(title, content){ - // const options = { - // container: 'luckysheet', // 设定DOM容器的id - // title: 'excel 表格', // 设定表格名称 - // lang: 'zh', // 设定表格语言 - // hook: { - // updated: (e) => { - // //监听更新,并在1s后自动保存 - // $('#luckysheet_info_detail_save').text("已修改") - // let title = $('#luckysheet_info_detail_input').val(); - // let content = luckysheet.getAllSheets(); - // //去除临时数据,减小体积 - // for (let i in content) - // content[i].data = undefined - // console.log(title) - // console.log(content) - // } - // }, - - // } - // options.data = JSON.parse(content) - // options.title = title; - - // window.luckysheet.create(options) - // } - handleClose(done) { - done(); - // this.$confirm('确认关闭?') - // .then(_ => { - // done(); - // }) - // .catch(_ => { }); + this.sendMessage(obj) }, handleCellEditBefore(e) { - console.log(e, 'seeeeeee'); - this.drawer = true; + 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.drawer = false; this.selectedCell = ""; }, handleTabClick(tab, event) { @@ -323,6 +198,7 @@ export default { }, }, beforeDestroy() { + this.$store.state.sidebarFold = false; if (this.socket) { this.socket.close(); } diff --git a/src/views/modules/base/smartExcel/cpts/filling-info.vue b/src/views/modules/base/smartExcel/cpts/filling-info.vue new file mode 100644 index 000000000..12d82b4ec --- /dev/null +++ b/src/views/modules/base/smartExcel/cpts/filling-info.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/src/views/modules/base/smartExcel/cpts/filling-smart.vue b/src/views/modules/base/smartExcel/cpts/filling-smart.vue new file mode 100644 index 000000000..e69de29bb diff --git a/src/views/modules/base/smartExcel/filling.vue b/src/views/modules/base/smartExcel/filling.vue index 472a05f28..959ba2506 100644 --- a/src/views/modules/base/smartExcel/filling.vue +++ b/src/views/modules/base/smartExcel/filling.vue @@ -10,12 +10,12 @@ :show-all-levels="false" @change="handleChangeAgency" clearable>
- + - + @@ -56,36 +56,25 @@ - - - - - - + label="发布时间"> @@ -99,7 +88,7 @@
- +
@@ -109,10 +98,10 @@