From 2a1dec235b8751d7454d143ad4322a8d7c1d223a Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Thu, 16 Jan 2025 17:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E5=86=99=E5=85=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/luckysheetConfig.js | 40 --- src/views/components/resiSearch.vue | 9 +- .../smartExcel/cpts/excel-upload-data.vue | 290 ++++++++++++++---- .../base/smartExcel/cpts/excel-view.vue | 146 ++++----- .../base/smartExcel/cpts/hose-search.vue | 130 ++++++++ 5 files changed, 431 insertions(+), 184 deletions(-) create mode 100644 src/views/modules/base/smartExcel/cpts/hose-search.vue diff --git a/src/utils/luckysheetConfig.js b/src/utils/luckysheetConfig.js index ee2850a99..5e0d790ed 100644 --- a/src/utils/luckysheetConfig.js +++ b/src/utils/luckysheetConfig.js @@ -3,46 +3,6 @@ const options = { container: 'luckysheet', // 设定DOM容器的id lang: 'zh', // 设定表格语言 showtoolbar: true, //是否显示工具栏 - showtoolbarConfig: { - //自定义配置工具栏 - undoRedo: true, // 撤销重做,注意撤销重做是两个按钮,由这一个配置决定显示还是隐藏 - paintFormat: true, //格式刷 - currencyFormat: false, //货币格式 - percentageFormat: false, //百分比格式 - numberDecrease: false, // '减少小数位数' - numberIncrease: false, // '增加小数位数' - moreFormats: false, // '更多格式' - font: true, // '字体' - fontSize: true, // '字号大小' - bold: true, // '粗体(Ctrl + B)' - italic: true, // '斜体(Ctrl + I)' - strikethrough: true, //删除线(Alt + Shift + 5) - underline: true, // 下划线(Alt + Shift + 6) - textColor: true, //文本颜色 - fillColor: true, // 单元格颜色 - border: true, // 边框 - mergeCell: true, //合并单元格 - horizontalAlignMode: true, //水平对齐方式 - verticalAlignMode: true, //垂直对齐方式 - textWrapMode: false, //换行方式 - textRotateMode: false, //文本旋转方式 - image: false, //插入图片 - link: false, //插入链接 - chart: false, //图表(图标隐藏,但是如果配置了chart插件,右击仍然可以新建图表) - postil: false, //批注 - pivotTable: true, //数据透视表 - function: true, //公式 - frozenMode: true, //冻结方式 - sortAndFilter: true, //排序和筛选 - conditionalFormat: true, //条件格式 - dataVerification: true, //数据验证 - splitColumn: false, //分列 - screenshot: false, //截图 - findAndReplace: true, //查找替换 - protection: true, // 工作表保护 - print: true, //打印 - - }, showinfobar: true, //是否显示顶部信息栏 showsheetbar: true, //是否显示底部sheet页按钮 cellRightClickConfig:{ diff --git a/src/views/components/resiSearch.vue b/src/views/components/resiSearch.vue index bcf041504..2f15f98c8 100644 --- a/src/views/components/resiSearch.vue +++ b/src/views/components/resiSearch.vue @@ -34,7 +34,7 @@
-
- - - - - +
+ + + + + +
+
+ + + + +
(5-30个字符)
+
+ + +
+
+
+ + {{ item.name }} + + +
-
- - -
111
- +
+
+ + + + + + + + + + + + +
+
+
+
- - 上一步 - 下一步 - +
+ +
+
+ + 上一步 + 下一步 +
- - - \ No newline at end of file + \ No newline at end of file diff --git a/src/views/modules/base/smartExcel/cpts/excel-view.vue b/src/views/modules/base/smartExcel/cpts/excel-view.vue index 6c334074e..b7189f51b 100644 --- a/src/views/modules/base/smartExcel/cpts/excel-view.vue +++ b/src/views/modules/base/smartExcel/cpts/excel-view.vue @@ -6,7 +6,7 @@
- {{ item.name }}{{pageType}} + {{ item.name }}
@@ -14,19 +14,19 @@
- 自动检测 + 自动检测 智能填表
驳回重提 审核存档 - 保存 + 保存
- - + +
@@ -86,7 +86,6 @@ export default { computed: { tableHeight() { return (this.clientHeight - 140) + 'px' - }, ...mapGetters(['clientHeight', 'resolution']), }, @@ -105,8 +104,37 @@ export default { }) }, methods: { + async saveUploadForm(val){ + const url = '/actual/base/residentBaseInfo/exportOneSheet' + const {data,code,msg} = await requestPost(url,val) + if(code === 0){ + this.showUploadData = false + this.updataSheet(data) + }else{ + console.log(msg); + + } + }, onClickUplond(){ - this.showUploadData=true + this.showUploadData=true; + let list = luckysheet.getAllSheets() + this.currentTable = list.filter(item => item.status == '1') + + const findLastNonNullIndex = (arr) => { + for (let i = arr.length - 1; i >= 0; i--) { + const subArray = arr[i]; + // 判断:是数组,且至少有一个不为 null 的元素 + if (Array.isArray(subArray) && subArray.some(item => item !== null && item.v && item.v !== null&& item.v !== '')) { + return i; // 返回下标 + } + } + return -1; // 如果没有符合条件的,返回 -1 + }; + this.sheetR = findLastNonNullIndex(this.currentTable[0].data) + if(this.sheetR != -1){ + luckysheet.insertRow(this.currentTable[0].data.length,5) + // this.updataSheet() + } }, handelUploadData(){ this.showUploadData=false @@ -153,7 +181,7 @@ export default { uploadExcel(files) { if (files == null || files.length == 0) return alert('没有文件等待导入'); - let name = files[0].name;// + let name = files[0].name; let suffixArr = name.split('.'), suffix = suffixArr[suffixArr.length - 1]; debugger @@ -177,69 +205,49 @@ export default { handelClickBack() { this.$emit('close') }, - getAllTables() { - let list = luckysheet.getAllSheets() - this.currentTable = list.filter(item => item.status == '1') - - const findLastNonNullIndex = (arr) => { - for (let i = arr.length - 1; i >= 0; i--) { - const subArray = arr[i]; - // 判断:是数组,且至少有一个不为 null 的元素 - if (Array.isArray(subArray) && subArray.some(item => item !== null && item.v && item.v !== null&& item.v !== '')) { - return i; // 返回下标 - } - } - return -1; // 如果没有符合条件的,返回 -1 - }; - this.sheetR = findLastNonNullIndex(this.currentTable[0].data) - console.log(this.sheetR); - if(this.sheetR != -1){ - luckysheet.insertRow(this.currentTable[0].data.length,5) - this.updataSheet() - } - }, - updataSheet() { + + updataSheet(list) { let arr = [ - { - 1: '张三1', - 2: '证件类型1', - 3: '1234', - 4: '456', - 5: '国籍', - 6: '性别', - 7: '出生日期', - 8: '所属社区', - 9: '所属网格', - 10: '所属小区', - 11: '楼栋名称', - 12: '单元号', - 13: '门牌号', - 14: '人房关系', - 15: '人户状况', - 16: '与户主关系', - 17: '民族' - }, - { - 1: '张三12', - 2: '证件类型12', - 3: '12342', - 4: '4562', - 5: '国籍2', - 6: '性别2', - 7: '出生日期2', - 8: '所属社区2', - 9: '所属网格2', - 10: '所属小区2', - 11: '楼栋名称2', - 12: '单元号2', - 13: '门牌号2', - 14: '人房关系2', - 15: '人户状况2', - 16: '与户主关系2', - 17: '民族' - } + // { + // 1: '张三1', + // 2: '证件类型1', + // 3: '1234', + // 4: '456', + // 5: '国籍', + // 6: '性别', + // 7: '出生日期', + // 8: '所属社区', + // 9: '所属网格', + // 10: '所属小区', + // 11: '楼栋名称', + // 12: '单元号', + // 13: '门牌号', + // 14: '人房关系', + // 15: '人户状况', + // 16: '与户主关系', + // 17: '民族' + // }, + // { + // 1: '张三12', + // 2: '证件类型12', + // 3: '12342', + // 4: '4562', + // 5: '国籍2', + // 6: '性别2', + // 7: '出生日期2', + // 8: '所属社区2', + // 9: '所属网格2', + // 10: '所属小区2', + // 11: '楼栋名称2', + // 12: '单元号2', + // 13: '门牌号2', + // 14: '人房关系2', + // 15: '人户状况2', + // 16: '与户主关系2', + // 17: '民族' + // } ] - arr.forEach((item, index) => { + list.forEach((item, index) => { luckysheet.insertRow(this.currentTable[0].data.length,1) for (let k in item) { luckysheet.setCellValue(index+this.sheetR + 1, k - 1, item[k]) diff --git a/src/views/modules/base/smartExcel/cpts/hose-search.vue b/src/views/modules/base/smartExcel/cpts/hose-search.vue new file mode 100644 index 000000000..6c51a0c1b --- /dev/null +++ b/src/views/modules/base/smartExcel/cpts/hose-search.vue @@ -0,0 +1,130 @@ + + + + +