|
|
|
@ -24,6 +24,13 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #export>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
@click="exportExcel(new Date().getTime().toString())"
|
|
|
|
|
|
|
|
>导出</Button
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</header-content>
|
|
|
|
</header-content>
|
|
|
|
</slot>
|
|
|
|
</slot>
|
|
|
|
</LxHeader>
|
|
|
|
</LxHeader>
|
|
|
|
@ -69,7 +76,7 @@
|
|
|
|
<!-- <span>3×5m3/s</span>-->
|
|
|
|
<!-- <span>3×5m3/s</span>-->
|
|
|
|
<!-- </template>-->
|
|
|
|
<!-- </template>-->
|
|
|
|
<!-- </el-table-column>-->
|
|
|
|
<!-- </el-table-column>-->
|
|
|
|
<el-table-column :label="weekRange[i]" header-align="center" v-for="i in 6">
|
|
|
|
<el-table-column :label="weekRange[i]" header-align="center" v-for="(n,i) in 6">
|
|
|
|
<el-table-column prop="x1" :label="weekName[i]" min-width="220" header-align="center">
|
|
|
|
<el-table-column prop="x1" :label="weekName[i]" min-width="220" header-align="center">
|
|
|
|
<template #default="{ row }">
|
|
|
|
<template #default="{ row }">
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
@ -97,6 +104,8 @@
|
|
|
|
import { authMixin } from "@/mixin/authMixin";
|
|
|
|
import { authMixin } from "@/mixin/authMixin";
|
|
|
|
import LxHeader from "@/components/LxHeader";
|
|
|
|
import LxHeader from "@/components/LxHeader";
|
|
|
|
import {AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph, TextRun} from "docx";
|
|
|
|
import {AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph, TextRun} from "docx";
|
|
|
|
|
|
|
|
import * as XLSX from "xlsx";
|
|
|
|
|
|
|
|
import { saveAs } from "file-saver";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
mixins: [authMixin],
|
|
|
|
mixins: [authMixin],
|
|
|
|
components: {
|
|
|
|
components: {
|
|
|
|
@ -246,87 +255,33 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
async exportDocx () {
|
|
|
|
async exportExcel(sheetName) {
|
|
|
|
const makeText = (dayData) => {
|
|
|
|
if (this.tableData) {
|
|
|
|
let children = [];
|
|
|
|
const data = this.tableData.map(i => ([
|
|
|
|
children.push(
|
|
|
|
this.areas.get(i.equipment.area),
|
|
|
|
new Paragraph({
|
|
|
|
i.equipment.name,
|
|
|
|
text: `${this.$moment(this.selectDate).format('YYYY年MM月DD日')}调度指令执行情况`,
|
|
|
|
'河道处',
|
|
|
|
heading: HeadingLevel.HEADING_1,
|
|
|
|
...i._sortData.map(j => ((j.length > 0) ? j.map(k => (`${ this.$moment(k.act_start_time).format('HH:mm') } ~ ${ this.$moment(k.act_end_time).format('HH:mm') } ${ k.content || " " } ${ this.abilities.get(k.leibie) }\n`)).toString() : "")
|
|
|
|
alignment: AlignmentType.CENTER,
|
|
|
|
)])
|
|
|
|
spacing: {
|
|
|
|
);
|
|
|
|
after: 400
|
|
|
|
data.unshift(["所属区域","工程名称","管理单位",...this.weekName]);
|
|
|
|
}
|
|
|
|
data.unshift(["所属区域","工程名称","管理单位",...this.weekRange]);
|
|
|
|
})
|
|
|
|
const wb = XLSX.utils.book_new();
|
|
|
|
)
|
|
|
|
let ws = XLSX.utils.aoa_to_sheet(data);
|
|
|
|
|
|
|
|
ws["!merges"] = [{ s: { r: 0, c: 0 }, e: { r: 1, c: 0 } },{ s: { r: 0, c: 1 }, e: { r: 1, c: 1 } },{ s: { r: 0, c: 2 }, e: { r: 1, c: 2 } }]
|
|
|
|
|
|
|
|
ws["!cols"] = [{ wch: 30 }, { wch: 30 },{ wch: 10 },{ wch: 50 },{ wch: 50 },{ wch: 50 },{ wch: 50 },{ wch: 50 },{ wch: 50 },{ wch: 50 }]
|
|
|
|
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
|
|
|
|
|
|
const wbout = XLSX.write(wb, {
|
|
|
|
|
|
|
|
bookType: "xlsx",
|
|
|
|
|
|
|
|
bookSST: true,
|
|
|
|
|
|
|
|
type: "array",
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
saveAs(
|
|
|
|
|
|
|
|
new Blob([wbout], { type: "application/octet-stream" }),
|
|
|
|
|
|
|
|
`${sheetName}.xlsx`
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const document = new Document({
|
|
|
|
},
|
|
|
|
sections: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
new Paragraph({
|
|
|
|
|
|
|
|
text: `${this.$moment(this.selectDate).format('YYYY年MM月DD日')}调度指令执行情况`,
|
|
|
|
|
|
|
|
heading: HeadingLevel.HEADING_1,
|
|
|
|
|
|
|
|
alignment: AlignmentType.CENTER,
|
|
|
|
|
|
|
|
spacing: {
|
|
|
|
|
|
|
|
after: 400
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
new Paragraph({
|
|
|
|
|
|
|
|
indent: {
|
|
|
|
|
|
|
|
firstLine: convertInchesToTwip(0.5)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
spacing: {
|
|
|
|
|
|
|
|
before: 200,
|
|
|
|
|
|
|
|
line: 500
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
new TextRun({
|
|
|
|
|
|
|
|
text: "今日小雨转晴,北风2级,气温22℃~29℃。水情信息:8:00新塘3.06m,环城河北3.02m,觅渡桥2.99m,人民桥3.00m;16:00新塘3.03m,环城河北2.90m,觅渡桥2.92m,人民桥2.95m。",
|
|
|
|
|
|
|
|
size: 18,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
...this.transfers.map((i, index) => (
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
new Paragraph({
|
|
|
|
|
|
|
|
spacing: {
|
|
|
|
|
|
|
|
before: 200,
|
|
|
|
|
|
|
|
line: 400
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
new TextRun({
|
|
|
|
|
|
|
|
text: `${this.numberToChinese(index+1)}、${i.equipment_id_equipments_id_relation?.name}`,
|
|
|
|
|
|
|
|
size: 28,
|
|
|
|
|
|
|
|
bold: true,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
new Paragraph({
|
|
|
|
|
|
|
|
spacing: {
|
|
|
|
|
|
|
|
before: 200,
|
|
|
|
|
|
|
|
line: 400
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
indent: {
|
|
|
|
|
|
|
|
firstLine: convertInchesToTwip(0.5)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
new TextRun({
|
|
|
|
|
|
|
|
text: `1、时间:${this.$moment(i.act_start_time).format('YYYY-MM-DD HH:mm')} - ${this.$moment(i.act_end_time).format('YYYY-MM-DD HH:mm')} 2、实际执行情况:${i.content}`,
|
|
|
|
|
|
|
|
size: 18,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
)).flat()
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const blob = await Packer.toBlob(document)
|
|
|
|
|
|
|
|
saveAs(blob, 'test.docx')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
this.getAbility()
|
|
|
|
this.getAbility()
|
|
|
|
|