| | |
| | | <el-button type="primary" @click="fnPrint('是')">打印</el-button> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-button type="success" @click="exportExcel">Excel导出</el-button> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-button type="primary" @click="fnCanelPrint()">撤销生成</el-button> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | |
| | | |
| | | } |
| | | |
| | | function dateFormat(fmt, date) { |
| | | let ret; |
| | | const opt = { |
| | | "Y+": date.getFullYear().toString(), |
| | | "m+": (date.getMonth() + 1).toString(), |
| | | "d+": date.getDate().toString(), |
| | | "H+": date.getHours().toString(), |
| | | "M+": date.getMinutes().toString(), |
| | | "S+": date.getSeconds().toString() |
| | | }; |
| | | for (let k in opt) { |
| | | ret = new RegExp("(" + k + ")").exec(fmt); |
| | | if (ret) { |
| | | fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0"))) |
| | | } |
| | | } |
| | | return fmt; |
| | | } |
| | | |
| | | function exportExcel() { |
| | | if (selectList.value.length === 0) { |
| | | ElementPlus.ElMessage({ |
| | | message: "请先选择要导出的数据", |
| | | type: 'error' |
| | | }); |
| | | return; |
| | | } |
| | | var tableHtml = CreateTable(selectList.value); |
| | | var html = "<html><head><meta charset='utf-8' /></head><body>" + tableHtml + "</body></html>"; |
| | | var blob = new Blob(['\ufeff' + html], { type: 'application/vnd.ms-excel;charset=utf-8;' }); |
| | | var link = document.createElement('a'); |
| | | var url = URL.createObjectURL(blob); |
| | | link.href = url; |
| | | link.download = "生产领料单_" + dateFormat("YYYYmmddHHMMSS", new Date()) + ".xls"; |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | URL.revokeObjectURL(url); |
| | | } |
| | | |
| | | |
| | | |
| | | function handleSizeChange(val) { |
| | |
| | | page, |
| | | fnPrint, |
| | | fnPrintView, |
| | | exportExcel, |
| | | fnCanelPrint, |
| | | fnCanelPrintRed, |
| | | fnPrintRed, |