|
|
|
|
@ -12,13 +12,13 @@
|
|
|
|
|
<header-content :auths="auths_auth_mixin">
|
|
|
|
|
<template #search>
|
|
|
|
|
<div style="display: flex">
|
|
|
|
|
<el-date-picker v-model="selectDate" size="small" style="width: 140px;"></el-date-picker>
|
|
|
|
|
<Button
|
|
|
|
|
style="margin-left: 10px"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="getTransfer"
|
|
|
|
|
>查询</Button
|
|
|
|
|
>
|
|
|
|
|
<el-date-picker v-model="selectDate" size="small" :clearable="false" style="width: 140px;" @change="getTransfer"></el-date-picker>
|
|
|
|
|
<!-- <Button-->
|
|
|
|
|
<!-- style="margin-left: 10px"-->
|
|
|
|
|
<!-- type="primary"-->
|
|
|
|
|
<!-- @click="getTransfer"-->
|
|
|
|
|
<!-- >查询</Button-->
|
|
|
|
|
<!-- >-->
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<Button type="primary" @click="exportDocx">导出</Button>
|
|
|
|
|
@ -31,16 +31,25 @@
|
|
|
|
|
<el-card>
|
|
|
|
|
<div class="title">{{ $moment(selectDate).format('YYYY-MM-DD') }}调度指令执行情况</div>
|
|
|
|
|
|
|
|
|
|
<div v-for="(item, index) in transfers" :key="item.id" class="item">
|
|
|
|
|
<div class="sub-title">{{ numberToChinese(index+1) }}. {{ item.equipment_id_equipments_id_relation ? item.equipment_id_equipments_id_relation.name : '' }}</div>
|
|
|
|
|
<div class="time">
|
|
|
|
|
<span>时间:</span>
|
|
|
|
|
<span>{{ $moment(item.act_start_time).format('YYYY-MM-DD HH:mm') }} - {{ $moment(item.act_end_time).format('HH:mm') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<span>{{ item.equipment_id_equipments_id_relation ? area(item.equipment_id_equipments_id_relation.area) : '' }}:</span>
|
|
|
|
|
<p style="text-indent: 30px;line-height: 1.2;padding: 20px 0;">{{ weather.weather }}</p>
|
|
|
|
|
|
|
|
|
|
<div v-for="(item, index) in showData" :key="item.value">
|
|
|
|
|
<div class="item" v-if="item._data.length > 0">
|
|
|
|
|
<div class="sub-title">{{ numberToChinese(index+1) }}. {{ item.key }}</div>
|
|
|
|
|
|
|
|
|
|
<span>{{ item.content }}</span>
|
|
|
|
|
<div v-for="(item1, index1) in item._data" :key="item1.id">
|
|
|
|
|
<div class="name">
|
|
|
|
|
{{index1+1}}.{{ item1.equipment_id_equipments_id_relation ? item1.equipment_id_equipments_id_relation.name : '' }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="time">
|
|
|
|
|
<span>时间:</span>
|
|
|
|
|
<span>{{ $moment(item1.act_start_time).format('YYYY-MM-DD HH:mm') }} - {{ $moment(item1.act_end_time).format('HH:mm') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<span>内容:</span>
|
|
|
|
|
<span>{{ item1.content }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
@ -58,11 +67,12 @@ import {
|
|
|
|
|
convertInchesToTwip
|
|
|
|
|
} from "docx";
|
|
|
|
|
import { saveAs } from 'file-saver';
|
|
|
|
|
import { index } from "@/api/system/baseForm";
|
|
|
|
|
import { index, save } from "@/api/system/baseForm";
|
|
|
|
|
import headerContent from "@/components/LxHeader/XyContent.vue";
|
|
|
|
|
import LxHeader from "@/components/LxHeader/index.vue";
|
|
|
|
|
import { authMixin } from "@/mixin/authMixin";
|
|
|
|
|
import { show } from "@/api/system/customFormField";
|
|
|
|
|
import { info, weather} from "@/api/other";
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
LxHeader,
|
|
|
|
|
@ -73,11 +83,56 @@ export default {
|
|
|
|
|
return {
|
|
|
|
|
types: [],
|
|
|
|
|
areas: [],
|
|
|
|
|
weather: {},
|
|
|
|
|
transfers: [],
|
|
|
|
|
showData: [],
|
|
|
|
|
selectDate: new Date(),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getWeatherInfo () {
|
|
|
|
|
let infoObj = {
|
|
|
|
|
weather: '',
|
|
|
|
|
water: '',
|
|
|
|
|
rain: '',
|
|
|
|
|
prevent: '',
|
|
|
|
|
early_warning: ''
|
|
|
|
|
}
|
|
|
|
|
const weatherInfo = await weather()
|
|
|
|
|
infoObj.weather = `${weatherInfo.weather},${weatherInfo.wD}${weatherInfo.wS},${weatherInfo.sendibleTemp}-${weatherInfo.temp}°C`
|
|
|
|
|
const infos = (await info({
|
|
|
|
|
date: this.$moment().format('YYYY-MM-DD')
|
|
|
|
|
}))[0]
|
|
|
|
|
infoObj.water = `${infos?.daily_water?.map(i => i.range + i.stnm + i.s_value + 'm,')?.toString()}`
|
|
|
|
|
infoObj.rain = `${infos?.daily_rain?.map(i => i.type + i.rain_value + 'mm,')?.toString()}`
|
|
|
|
|
|
|
|
|
|
this.weather = infoObj
|
|
|
|
|
|
|
|
|
|
await save({
|
|
|
|
|
table_name: 'waters',
|
|
|
|
|
date: this.$moment().format('YYYY-MM-DD'),
|
|
|
|
|
...infoObj
|
|
|
|
|
},false)
|
|
|
|
|
},
|
|
|
|
|
async getWeather () {
|
|
|
|
|
const res = (await index({
|
|
|
|
|
table_name: 'waters',
|
|
|
|
|
filter: [
|
|
|
|
|
{
|
|
|
|
|
key: 'date',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: this.$moment().format('YYYY-MM-DD')
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},false)).data[0]
|
|
|
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
|
await this.getWeatherInfo()
|
|
|
|
|
} else {
|
|
|
|
|
this.weather = res
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
numberToChinese (num) {
|
|
|
|
|
if (num == 10) {
|
|
|
|
|
return '十'
|
|
|
|
|
@ -142,23 +197,40 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async getTransfer () {
|
|
|
|
|
this.transfers = (await index({
|
|
|
|
|
table_name: "transfers",
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 999,
|
|
|
|
|
filter: [
|
|
|
|
|
{
|
|
|
|
|
key: 'start_time',
|
|
|
|
|
op: 'range',
|
|
|
|
|
value: `${this.$moment(this.selectDate).startOf('days').format('YYYY-MM-DD HH:mm:ss')},${this.$moment(this.selectDate).endOf('days').format('YYYY-MM-DD HH:mm:ss')}`
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: 7
|
|
|
|
|
try {
|
|
|
|
|
this.transfers = (await index({
|
|
|
|
|
table_name: "transfers",
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 999,
|
|
|
|
|
filter: [
|
|
|
|
|
{
|
|
|
|
|
key: 'start_time',
|
|
|
|
|
op: 'range',
|
|
|
|
|
value: `${this.$moment(this.selectDate).startOf('days').format('YYYY-MM-DD HH:mm:ss')},${this.$moment(this.selectDate).endOf('days').format('YYYY-MM-DD HH:mm:ss')}`
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'status',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: 7
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
})).data
|
|
|
|
|
|
|
|
|
|
this.showData = this.areas.map(i => {
|
|
|
|
|
return {
|
|
|
|
|
...i,
|
|
|
|
|
_data: []
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
})).data
|
|
|
|
|
})
|
|
|
|
|
this.transfers.forEach(item => {
|
|
|
|
|
let filterData = this.showData.find(i => i.value === item.equipment_id_equipments_id_relation.area)
|
|
|
|
|
if (filterData) {
|
|
|
|
|
filterData._data.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async exportDocx () {
|
|
|
|
|
@ -184,12 +256,12 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
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。",
|
|
|
|
|
text: this.weather.weather,
|
|
|
|
|
size: 18,
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}),
|
|
|
|
|
...this.transfers.map((i, index) => (
|
|
|
|
|
...this.showData.filter(i => (i._data && i._data.length>0)).map((i, index) => (
|
|
|
|
|
[
|
|
|
|
|
new Paragraph({
|
|
|
|
|
spacing: {
|
|
|
|
|
@ -198,27 +270,39 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
new TextRun({
|
|
|
|
|
text: `${this.numberToChinese(index+1)}、${i.equipment_id_equipments_id_relation?.name}`,
|
|
|
|
|
text: `${this.numberToChinese(index+1)}、${i.key}`,
|
|
|
|
|
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,
|
|
|
|
|
...i._data.map((i1, index1) => (
|
|
|
|
|
[
|
|
|
|
|
new Paragraph({
|
|
|
|
|
spacing: {
|
|
|
|
|
before: 200,
|
|
|
|
|
line: 200
|
|
|
|
|
},
|
|
|
|
|
indent: {
|
|
|
|
|
firstLine: convertInchesToTwip(0.5)
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
new TextRun({
|
|
|
|
|
text: `${index1+1}. ${i1.equipment_id_equipments_id_relation.name}`,
|
|
|
|
|
size: 24,
|
|
|
|
|
}),
|
|
|
|
|
new TextRun({
|
|
|
|
|
text: `\n时间: ${this.$moment(i1.act_start_time).format('YYYY-MM-DD HH:mm')} - ${this.$moment(i1.act_end_time).format('HH:mm')}`,
|
|
|
|
|
size: 18
|
|
|
|
|
}),
|
|
|
|
|
new TextRun({
|
|
|
|
|
text: `\n内容:${i1.content}`,
|
|
|
|
|
size: 18
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
))
|
|
|
|
|
]
|
|
|
|
|
)).flat()
|
|
|
|
|
]
|
|
|
|
|
@ -227,7 +311,7 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const blob = await Packer.toBlob(document)
|
|
|
|
|
saveAs(blob, 'test.docx')
|
|
|
|
|
saveAs(blob, `${this.$moment().format('YYYY-MM-DD')}调令.docx`)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@ -240,6 +324,7 @@ export default {
|
|
|
|
|
created() {
|
|
|
|
|
this.getArea()
|
|
|
|
|
this.getTransfer()
|
|
|
|
|
this.getWeather()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
@ -258,15 +343,21 @@ export default {
|
|
|
|
|
|
|
|
|
|
padding: 8px 0;
|
|
|
|
|
}
|
|
|
|
|
.name {
|
|
|
|
|
text-indent: 30px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
|
|
|
|
padding: 6px 0;
|
|
|
|
|
}
|
|
|
|
|
.time {
|
|
|
|
|
text-indent: 60px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
|
|
|
|
padding: 0 4px;
|
|
|
|
|
}
|
|
|
|
|
.content {
|
|
|
|
|
text-indent: 60px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
|
|
|
|
padding: 0 4px;
|
|
|
|
|
}
|
|
|
|
|
.item + .item {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
|