Browse Source

bug#1868智能填表,需要支持如图所示多行表头匹配字段的情况

feture-12345
mk 6 months ago
parent
commit
f3718280a9
  1. BIN
      src/assets/img/tips.jpg
  2. 49
      src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue

BIN
src/assets/img/tips.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

49
src/views/modules/base/smartExcel/cpts/excel-template-confirmation.vue

@ -1,15 +1,22 @@
<template> <template>
<!-- 确认模板 --> <el-dialog title="模板确认" :visible.sync="showTemplate" width="50%" :close-on-click-modal="false" :modal="false">
<div class=''> <div id="luckysheet1" v-if="showTemplate"></div>
<el-dialog title="模板确认" :visible.sync="showTemplate" width="50%" :close-on-click-modal="false">
<div id="luckysheet1" v-if="showTemplate"></div> <span slot="footer" class="dialog-footer">
<span slot="footer" class="dialog-footer"> <el-button @click="handleCancel"> </el-button>
<el-button @click="handleCancel"> </el-button> <el-button type="primary" @click="handleConfirm"> </el-button>
<el-button type="primary" @click="handleConfirm"> </el-button> </span>
</span>
</el-dialog> <!-- 嵌套的 el-dialog -->
</div> <el-dialog title="操作提示" :visible.sync="showTips" width="50%" :close-on-click-modal="false" :modal="false">
</template> <p style="color: #df3d3d;">目前数据提报模板只支持单行表头请按下图示例表格修改为单行表头重新上传</p>
<img :src="`${require('@/assets/img/tips.jpg')}`" style="width: 90%;" alt="">
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirmInnerAndCancel">我知道了</el-button>
</span>
</el-dialog>
</el-dialog>
</template>
<script> <script>
import LuckyExcel from 'luckyexcel'; import LuckyExcel from 'luckyexcel';
@ -17,7 +24,9 @@ import options from "@/utils/luckysheetConfig.js";
export default { export default {
data() { data() {
return {}; return {
showTips:false
};
}, },
created() { }, created() { },
methods: { methods: {
@ -67,8 +76,18 @@ export default {
this.$emit('handelHideTemplate') this.$emit('handelHideTemplate')
}, },
handleConfirm(){ handleConfirm(){
let boolean = this.exportJson.sheets[0].data[1].every(item => !item || !item.v);
console.log(boolean);
if(boolean){
this.$emit('saveLuckysheetJson',this.exportJson) this.$emit('saveLuckysheetJson',this.exportJson)
} }else{
this.showTips = true
}
},
handleConfirmInnerAndCancel(){
this.showTips = false;
this.$emit('handelHideTemplate')
},
}, },
mounted() { mounted() {
console.log(this.fileUrl, 'fileUrl===');//'http://localhost:9001/epmet-work-pc/test1.xlsx' console.log(this.fileUrl, 'fileUrl===');//'http://localhost:9001/epmet-work-pc/test1.xlsx'
@ -76,8 +95,8 @@ export default {
/^https:\/\/elink-esua-epdc\.oss-cn-qingdao\.aliyuncs\.com/, /^https:\/\/elink-esua-epdc\.oss-cn-qingdao\.aliyuncs\.com/,
`${location.origin}` `${location.origin}`
); );
this.urlToFile(newUrl,this.fileName) // this.urlToFile(newUrl,this.fileName)
// this.urlToFile('http://localhost:9001/epmet-work-pc/test1.xlsx',this.fileName) this.urlToFile('http://localhost:9001/epmet-work-pc/test1.xlsx',this.fileName)
}, },
props: { props: {

Loading…
Cancel
Save