excel基础信息

Raod 3 years ago
parent cf7721fd8a
commit 0d1d40e4cc

@ -90,56 +90,6 @@
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane v-if="dialogVisible"
label="二维码配置"
name="second">
<el-form ref="qrCodeForm"
:model="qrCodeForm"
label-width="60px">
<el-form-item label="二维码内容">
<el-input v-model="qrCodeForm.content" />
</el-form-item>
<el-form-item label="宽度">
<el-input v-model="qrCodeForm.width" />
</el-form-item>
<el-form-item label="高度">
<el-input v-model="qrCodeForm.height" />
</el-form-item>
<el-form-item label="前景色">
<ColorPicker v-model="qrCodeForm.colorDark"
@change="(val) => changed(val,qrCodeForm.colorDark)" />
</el-form-item>
<el-form-item label="背景色">
<ColorPicker v-model="qrCodeForm.colorLight"
@change="(val) => changed(val,qrCodeForm.colorLight)" />
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane v-if="dialogBarCode"
label="条形码配置"
name="second">
<el-form ref="barCodeForm"
:model="barCodeForm"
label-width="60px">
<el-form-item label="条形码内容">
<el-input v-model="barCodeForm.content" />
</el-form-item>
<el-form-item label="宽度">
<el-input v-model="barCodeForm.width" />
</el-form-item>
<el-form-item label="高度">
<el-input v-model="barCodeForm.height" />
</el-form-item>
<el-form-item label="前景色">
<ColorPicker v-model="barCodeForm.lineColor"
@change="(val) => changed(val,barCodeForm.lineColor)" />
</el-form-item>
<el-form-item label="背景色">
<ColorPicker v-model="barCodeForm.background"
@change="(val) => changed(val,barCodeForm.background)" />
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
</div>
@ -168,52 +118,8 @@
class="dialog-footer">
<el-button @click="outerVisible = false"> </el-button>
<el-button type="primary"
@click="checkDataSet()">确定</el-button>
</div>
</el-dialog>
<el-dialog title="打印设置"
:visible.sync="printVisible"
width="30%"
:before-close="handleClose">
<el-form label-position="right"
label-width="90px"
:model="formPrintSetting">
<el-row>
<el-col :span="24">
<el-form-item label="纸张大小">
<el-select v-model="formPrintSetting.size"
placeholder="请选择打印尺寸"
@change="onPaperChange">
<el-option v-for="(item, index) in paperList"
:key="index"
:index="index"
:value="item.paper"
:label="getPaperText(item)" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item label="对应像素">
<el-input v-model="formPrintSetting.pixel1"
disabled />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label=" "
label-width="12px">
<el-input v-model="formPrintSetting.pixel2"
disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer"
class="dialog-footer">
<el-button @click="printVisible = false"> </el-button>
<el-button type="primary"
@click="getWindowDpi()">确定</el-button>
@click="checkDataSet()">确定
</el-button>
</div>
</el-dialog>
</div>
@ -325,14 +231,13 @@ export default {
}
},
mounted () {},
mounted() {
},
created() {
this.reportCode = this.$route.query.reportCode
this.accessKey = this.$route.query.accessKey
this.loadDataSet()
this.design()
this.initPaperList()
this.getWindowDpi()
},
methods: {
handleClose() {
@ -384,6 +289,10 @@ export default {
// console.log("cellDragStop-draggableFieldLabel", that);
luckysheet.setCellValue(postion.r, postion.c, that.draggableFieldLabel)
},
cellMousedown: function (cell, postion, sheetFile, ctx) {
that.rightForm.coordinate = postion.r + "," + postion.c
that.rightForm.value = cell == null ? '' : cell.v;
},
},
data: [
{
@ -537,173 +446,7 @@ export default {
}
}
},
//
changed (val, key) {
},
testClick () {
console.log('sdsdsddsd')
},
//
getEmitParam () {
return {
paper: this.formPrintSetting.size,
width: this.formPrintSetting.width,
height: this.formPrintSetting.height,
isBackend: this.isBackend
}
},
//
onPaperChange (value) {
const arr = this.paperList.filter(item => {
return item.paper === value
})
this.resetForm(arr[0])
},
resetForm: function (param) {
if (param) {
this.paper = param.paper
this.width = param.width
this.height = param.height
this.formPrintSetting.pixel1 = this.getPxWidth(param.width) + 'px'
this.formPrintSetting.pixel2 = this.getPxHeight(param.height) + 'px'
if (param.definition) {
this.definition = param.definition
}
if (param.isBackend === true || param.isBackend === false) {
this.isBackend = param.isBackend
}
}
},
getPaperText (item) {
return item.paper + '' + item.width + 'mm x ' + item.height + 'mm'
},
initPaperList () {
let printPaper = []
if (this.config) {
const config2 = JSON.parse(this.config)
if (config2 && config2['printPaper']) {
printPaper = config2['printPaper']
}
}
const arr = []
for (const item of this.pixelList) {
arr.push(item)
}
for (const item of printPaper) {
arr.push({
paper: item.title, width: item['size'][0], height: item['size'][1]
})
}
this.paperList = [...arr]
},
// dpi
getWindowDpi () {
// 25.41 1=25.41mm 96windowdpi,mac:72
this.printVisible = false
// eslint-disable-next-line no-array-constructor
const arrDPI = new Array()
if (window.screen.deviceXDPI != undefined) {
arrDPI[0] = window.screen.deviceXDPI
arrDPI[1] = window.screen.deviceYDPI
} else {
const tmpNode = document.createElement('div')
tmpNode.style.cssText = 'width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden'
document.body.appendChild(tmpNode)
arrDPI[0] = parseInt(tmpNode.offsetWidth)
arrDPI[1] = parseInt(tmpNode.offsetHeight)
tmpNode.parentNode.removeChild(tmpNode)
}
this.dpi = [...arrDPI]
},
//
getPxWidth (width) {
let margin = 10
if (this.isBackend == true) {
margin = 0
}
return Math.ceil((width - margin * 2) / 25.41 * this.dpi[0])
},
//
getPxHeight (height) {
let margin = 10
if (this.isBackend == true) {
margin = 0
}
return Math.ceil((height - margin * 2) / 25.41 * this.dpi[1])
},
uploadExcel (evt) {
const files = evt.target.files
if (files == null || files.length == 0) {
alert('No files wait for import')
return
}
const name = files[0].name
const suffixArr = name.split('.'); const suffix = suffixArr[suffixArr.length - 1]
if (suffix != 'xlsx') {
alert('Currently only supports the import of xlsx files')
return
}
LuckyExcel.transformExcelToLucky(files[0], function (exportJson, luckysheetfile) {
if (exportJson.sheets == null || exportJson.sheets.length == 0) {
alert('Failed to read the content of the excel file, currently does not support xls files!')
return
}
window.luckysheet.destroy()
window.luckysheet.create({
container: 'luckysheet', // luckysheet is the container id
showinfobar: false,
data: exportJson.sheets,
title: exportJson.info.name,
userInfo: exportJson.info.name.creator
})
})
},
selectExcel (evt) {
const value = this.selected
const name = evt.target.options[evt.target.selectedIndex].innerText
if (value == '') {
return
}
LuckyExcel.transformExcelToLuckyByUrl(value, name, (exportJson, luckysheetfile) => {
if (exportJson.sheets == null || exportJson.sheets.length == 0) {
alert('Failed to read the content of the excel file, currently does not support xls files!')
return
}
window.luckysheet.destroy()
window.luckysheet.create({
container: 'luckysheet', // luckysheet is the container id
showinfobar: false,
data: exportJson.sheets,
title: exportJson.info.name,
userInfo: exportJson.info.name.creator
})
})
},
downloadExcel () {
const value = this.selected
if (value.length == 0) {
alert('Please select a demo file')
return
}
var elemIF = document.getElementById('Lucky-download-frame')
if (elemIF == null) {
elemIF = document.createElement('iframe')
elemIF.style.display = 'none'
elemIF.id = 'Lucky-download-frame'
document.body.appendChild(elemIF)
}
elemIF.src = value
}
},
}
</script>
@ -718,26 +461,32 @@ export default {
#barCode {
display: none;
}
.yulancopy {
font-size: 16px;
}
.baocun {
font-size: 17px;
}
.el-collapse {
position: relative;
border-top: 0 solid #e6ebf5;
border-bottom: 0 solid #e6ebf5;
}
.el-collapse-item__header {
border-bottom: 0 solid #e6ebf5 !important;
}
.delect-all {
position: absolute;
top: 10px;
right: 30px;
color: #333;
}
.push_btn {
position: absolute;
z-index: 100;

Loading…
Cancel
Save