Browse Source

先顺序找到第一条数据为空的做数据填充

luckysheet-xiaowang-Intelligen
mk 7 months ago
parent
commit
fdeb135f7f
  1. 105
      src/views/modules/base/smartExcel/cpts/excel-view.vue

105
src/views/modules/base/smartExcel/cpts/excel-view.vue

@ -3,8 +3,8 @@
<div class='flex el-card'>
<div class="left_menu flex flex-y">
<el-button type="text" round @click="handelClickBack" icon="el-icon-back">返回</el-button>
<div :class="{ 'menu_item': true, 'active': menuActive === index }" v-for="(item, index) in menuList"
:key="index" @click="handleClickMenu(index)">
<div :class="{ 'menu_item': true, 'active': menuActive === index }" v-for="(item, index) in menuList" :key="index"
@click="handleClickMenu(index)">
<span>{{ item.name }}</span>
<i class="el-icon-arrow-right"></i>
</div>
@ -73,14 +73,14 @@ export default {
},
watch: {},
mounted() {
this.$nextTick(()=>{
this.$nextTick(() => {
this.loadWorkBook()
})
},
methods: {
loadWorkBook() {
window.luckysheet.destroy();
const {id} = this.$store.state.user;
const { id } = this.$store.state.user;
options.gridKey = this.workbookId;
options.allowUpdate = true;
options.loadUrl = `http://219.146.91.110:30801/api/actual/base/luckySheet/workbook/load?workbookId=${this.workbookId}`
@ -141,60 +141,66 @@ export default {
handelClickBack() {
this.$emit('close')
},
getAllTables(){
console.log(luckysheet.getAllSheets());
let currentTable = luckysheet.getAllSheets().filter(item=>item.status === '1')
getAllTables() {
let list = luckysheet.getAllSheets()
let currentTable = list.filter(item => item.status == '1')
const findFirstAllNullIndex = (arr) => {
return arr.findIndex(subArray => Array.isArray(subArray) && subArray.every(item => item === null));
};
this.sheetR = findFirstAllNullIndex(currentTable[0].data)
if(this.sheetR != -1){
this.updataSheet()
}else{
luckysheet.insertRow(currentTable[0].data.length,5)
}
},
updataSheet() {
let arr = [
{
1:'张三1',
2:'证件类型1',
3:'1234',
4:'456',
5:'国籍',
6:'性别',
7:'出生日期',
8:'所属社区',
9:'所属网格',
10:'所属小区',
11:'楼栋名称',
12:'单元号',
13:'门牌号',
14:'人房关系',
15:'人户状况',
16:'与户主关系',
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:'民族'
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)=>{
for(let k in item){
arr.forEach((item, index) => {
for (let k in item) {
// index +1 + this.sheetR()
luckysheet.setCellValue(index+1, k - 1, item[k])
luckysheet.setCellValue(index+this.sheetR, k - 1, item[k])
}
})
// 17
},
updataSheet(){
},
},
beforeDestroy() {
@ -213,6 +219,7 @@ export default {
box-sizing: border-box;
width: calc(100% - 40px);
}
.luckysheet-wrap {
margin: 10px;
padding: 0px;

Loading…
Cancel
Save