From 4595b8b5a9c7afdeff9929022bfa3ca31a24ce06 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 15 Mar 2024 13:10:52 +0800
Subject: [PATCH] fix: 走航报告下载修改
---
src/views/dailyreport/index.vue | 216 +++++++++++++++++++++++++++++++++--------------------
1 files changed, 133 insertions(+), 83 deletions(-)
diff --git a/src/views/dailyreport/index.vue b/src/views/dailyreport/index.vue
index 891afa0..c4cec12 100644
--- a/src/views/dailyreport/index.vue
+++ b/src/views/dailyreport/index.vue
@@ -2,7 +2,7 @@
<div class="dailyreport">
<div class="dailyBox">
<div class="dailyTop">
- <el-select
+ <!-- <el-select
v-model="cityChoose"
placeholder="���������������"
>
@@ -12,7 +12,18 @@
:label="item.label"
:value="item.value"
/>
- </el-select>
+ </el-select> -->
+ <el-cascader
+ ref="myCascader"
+ v-model="newRegion"
+ placeholder=""
+ :options="options"
+ :props="{ checkStrictly: true }"
+ clearable
+ change-on-select
+ style="flex: 1"
+ @change="getCity"
+ />
<el-select
v-model="equipChoose1"
placeholder="���������������"
@@ -118,6 +129,11 @@
label="������������"
/>
<el-table-column
+ prop="mac"
+ align="center"
+ label="mac"
+ />
+ <el-table-column
prop="time"
align="center"
label="������������"
@@ -159,7 +175,7 @@
:visible.sync="openBox"
>
<div class="openTop">
- <el-select
+ <!-- <el-select
v-model="cityChoose2"
placeholder="���������������"
>
@@ -169,7 +185,18 @@
:label="item.label"
:value="item.value"
/>
- </el-select>
+ </el-select> -->
+ <el-cascader
+ ref="myUpCascader"
+ v-model="newUpRegion"
+ placeholder=""
+ :options="options"
+ :props="{ checkStrictly: true }"
+ clearable
+ change-on-select
+ style="flex: 1"
+ @change="getUpCity"
+ />
<el-select
v-model="equipChoose2"
placeholder="���������������"
@@ -792,30 +819,13 @@
data () {
return {
handSelectData: [],
- cityChoose: 'gx', // ������������������������������
- cityChoose2: 'gx', // ���������������������������
- cityOptions: [
- {
- value: 'gx',
- label: '���������'
- }
- // , {
- // value: 'gx',
- // label: '���������'
- // }, {
- // value: 'hn',
- // label: '���������'
- // }
- ],
- cityOptions2: [{
- value: 'gx',
- label: '���������'
- }
- // {
- // value: 'hn',
- // label: '���������'
- // }
- ],
+ options: [],
+ newRegion: [],
+ newUpRegion: [],
+ cityForm: {},
+ cityUpForm: {},
+ cityChoose: '', // ������������������������������
+ cityChoose2: '', // ���������������������������
equipChoose1: 'car',
equipChoose2: 'car',
equipOptions1: [{
@@ -1054,6 +1064,7 @@
immediate: true
},
created () {
+ this.getRegion()
// ���������������
this.$request({
url: 'cruiser/selectCruisers',
@@ -1064,29 +1075,79 @@
}).catch(err => {
console.log(err)
})
- // ���������������
- // this.$request({
- // url: 'uav/getUavDaily',
- // method: 'get'
- // }).then(res => {
- // this.planMac = res.data
- // }).catch(err => {
- // console.log(err)
- // })
},
methods: {
+ getCity () {
+ console.log('this.$refs.myCascader.getCheckedNodes()[0]', this.$refs.myCascader.getCheckedNodes()[0])
+ if (this.newRegion.length > 0) { // ������������������������������change������������������������������������������������������������������������������
+ const { label: org, value: orgid } =
+ this.$refs.myCascader.getCheckedNodes()[0]
+ this.cityForm = { org, orgid }
+ console.log('this.cityForm', this.cityForm)
+ this.cityChoose = orgid
+ } else {
+ this.cityForm = {}
+ this.cityChoose = ''
+ }
+ },
+ getUpCity () {
+ if (this.newUpRegion.length > 0) { // ������������������������������change������������������������������������������������������������������������������
+ const { label: org, value: orgid } =
+ this.$refs.myUpCascader.getCheckedNodes()[0]
+ this.cityUpForm = { org, orgid }
+ console.log('this.cityUpForm', this.cityUpForm)
+ this.cityChoose2 = orgid
+ } else {
+ this.cityUpForm = {}
+ this.cityChoose2 = ''
+ }
+ },
+ getRegion () {
+ this.$request({
+ url: '/organization/getMapPath',
+ method: 'get',
+ params: {
+ organizationId: this.$store.state.orgId
+ }
+ })
+ .then((res) => {
+ const data = res.data
+ for (let i = 0; i < data.length; i++) {
+ this.options.push({
+ value: data[i].provinceCode,
+ label: data[i].provinceName
+ })
+ this.options[i].children = []
+ for (let j = 0; j < data[i].cities.length; j++) {
+ this.options[i].children.push({
+ value: data[i].cities[j].cityCode,
+ label: data[i].cities[j].cityName
+ })
+ // ���������������������
+ if (data[i].cities[j].cityCode !== 320900) {
+ this.options[i].children[j].children = []
+ for (let k = 0; k < data[i].cities[j].areas.length; k++) {
+ this.options[i].children[j].children.push({
+ value: data[i].cities[j].areas[k].areaCode,
+ label: data[i].cities[j].areas[k].areaName
+ })
+ }
+ }
+ }
+ }
+ })
+ .catch((err) => {
+ // console.log('������Region������')
+ console.log(err)
+ })
+ // console.log('������Region������')
+ },
handleSelectionChange (e) {
this.handSelectData = e.map(i => i.id)
console.log('this.handSelectData', this.handSelectData)
},
// ������������
exportDom () {
- // const url1 = `http://47.99.64.149:8081//static/img/7f633687-8321-4f89-bffc-9a52f94cfb77.jpg`
- // const url2 = `http://47.99.64.149:8081//static/img/7f633687-8321-4f89-bffc-9a52f94cfb77.jpg`
- // const url3 = `http://47.99.64.149:8081//static/img/7f633687-8321-4f89-bffc-9a52f94cfb77.jpg`
- // const url4 = `http://47.99.64.149:8081//static/img/7f633687-8321-4f89-bffc-9a52f94cfb77.jpg`
- // this.UAVReport.fileLists[1] = [url1, url2]
- // this.UAVReport.fileLists[3] = [url3, url4, url3]
const baseUrl = `${requestObj.baseUrl}/static/img/`
var images = [['7f633687-8321-4f89-bffc-9a52f94cfb77.jpg', '7f633687-8321-4f89-bffc-9a52f94cfb77.jpg'], [], [], ['7f633687-8321-4f89-bffc-9a52f94cfb77.jpg', '7f633687-8321-4f89-bffc-9a52f94cfb77.jpg', '7f633687-8321-4f89-bffc-9a52f94cfb77.jpg'], [], [], [], []]
var info = 0
@@ -1115,6 +1176,7 @@
},
// ���������������������
selectExport () {
+ console.log(this.cityChoose)
this.selectTime = this.newTime(this.value1)
if (this.cityChoose && this.equipChoose1 && this.selectTime[1]) {
// ���������������or���������
@@ -1144,12 +1206,15 @@
}
info.map(v => {
var time = v.time.split('-').join('')
- v.name = `���������������������������${time}`
+
// if (this.cityChoose === 'gx') {
// v.name = `���������������������������${time}`
+ // } else if (this.cityChoose === 'yc') {
+ // v.name = `���������������������������${time}`
// } else {
// v.name = `���������������������������${time}`
// }
+ v.name = this.cityForm.org + `${time}`
})
info.sort((a, b) => { return b.time.split('-').join('') - a.time.split('-').join('') })
this.tableData = info
@@ -1213,11 +1278,14 @@
this.equipChoose1 = this.equipChoose2
this.cityChoose = this.cityChoose2
var reportInfo = res.data
- if (this.cityChoose2 === 'gx') {
- reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
- } else {
- reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
- }
+ // if (this.cityChoose2 === 'gx') {
+ // reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
+ // } else if (this.cityChoose === 'yc') {
+ // reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
+ // } else {
+ // reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
+ // }
+ reportInfo.name = this.cityForm.org + '������������������' + reportInfo.time.split('-').join('')
this.tableData = [reportInfo]
} else if (res.code === -47) {
this.$message(res.message)
@@ -1286,12 +1354,15 @@
this.equipChoose1 = this.equipChoose2
this.cityChoose = this.cityChoose2
var reportInfo = res.data
- reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
+
// if (this.cityChoose === 'gx') {
// reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
+ // } else if (this.cityChoose === 'yc') {
+ // reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
// } else {
// reportInfo.name = '���������������������������' + reportInfo.time.split('-').join('')
// }
+ reportInfo.name = this.cityForm.org + '������������������' + reportInfo.time.split('-').join('')
this.tableData = [reportInfo]
} else if (res.code === -47) {
this.$message(res.message)
@@ -1326,39 +1397,15 @@
ids: this.handSelectData
}
}).then(res => {
- this.getOutExcel('���������������������������.docx', res)
- // const baseUrl = `${requestObj.baseUrl}/static/img/`
- // var imagesObj = res.data.images
- // this.sailingReport = { ...this.sailingReport, ...res.data.code }
- // // const url1 = `http://47.99.64.149:8081//static/img/7f633687-8321-4f89-bffc-9a52f94cfb77.jpg`
- // if (imagesObj) {
- // for (let i = 0; i < imagesObj.length; i++) {
- // this.sailingReport.fileLists[i] = [{ url: baseUrl + imagesObj[i] }]
- // }
- // }
- // this.sailingReport.index = imagesObj.length
- // var data2 = obj.date.split('-')
- // this.sailingReport.date2 = data2[0] + '���' + data2[1] + '���' + data2[2] + '���'
- // var time = []
- // for (let i = 0; i < res.data.code.time.length; i++) {
- // time.push(res.data.code.time[i])
- // }
- // this.sailingReport.time0 = time[0]
- // if (time.length === 2) {
- // this.sailingReport.time1 = time[1]
- // }
- // if (time.length === 3) {
- // this.sailingReport.time1 = time[1]
- // this.sailingReport.time2 = time[2]
- // }
// if (this.cityChoose === 'gx') {
// this.sailingReport.city = '���������'
+ // } else if (this.cityChoose === 'yc') {
+ // this.sailingReport.city = '���������'
// } else {
// this.sailingReport.city = '���������'
// }
- // exportDocx('/sailingReport1.docx', this.sailingReport, `${obj.name}.docx`)���������������
- // ������
- // exportDocx('/yanchengReport.docx', this.sailingReport, `${obj.name}.docx`)
+ this.sailingReport.city = this.cityForm.org
+ this.getOutExcel(`${this.sailingReport.city}.docx`, res)
}).catch(err => {
console.log(err)
})
@@ -1438,11 +1485,14 @@
this.UAVReport.time1 = time[1]
this.UAVReport.time2 = time[2]
}
- if (this.cityChoose === 'gx') {
- this.UAVReport.city = '���������'
- } else {
- this.UAVReport.city = '���������'
- }
+ // if (this.cityChoose === 'yc') {
+ // this.UAVReport.city = '���������'
+ // } else if (this.cityChoose === 'gx') {
+ // this.UAVReport.city = '���������'
+ // } else {
+ // this.UAVReport.city = '���������'
+ // }
+ this.UAVReport.city = this.cityForm.org
exportUAVImage('/UAVReport.docx', this.UAVReport, `${obj.name}.docx`)
}).catch(err => {
console.log(err)
--
Gitblit v1.8.0