From 416eb6356e6fca5d633597bba18958ae664ad6c6 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Fri, 15 Mar 2024 17:20:21 +0800 Subject: [PATCH] fix: 走航报告下载修改 --- src/views/dailyreport/index.vue | 232 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 143 insertions(+), 89 deletions(-) diff --git a/src/views/dailyreport/index.vue b/src/views/dailyreport/index.vue index fd08f10..1eb87b7 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="���������������" @@ -37,9 +48,11 @@ <el-select v-if="equipChoose1==='car'" v-model="carInput" + collapse-tags + multiple clearable placeholder="������������������" - style="width: 180px;display: inline-block" + style="width: 280px;display: inline-block" > <el-option v-for="(item,index) in carMac" @@ -118,6 +131,11 @@ label="������������" /> <el-table-column + prop="mac" + align="center" + label="mac" + /> + <el-table-column prop="time" align="center" label="������������" @@ -159,7 +177,7 @@ :visible.sync="openBox" > <div class="openTop"> - <el-select + <!-- <el-select v-model="cityChoose2" placeholder="���������������" > @@ -169,7 +187,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="���������������" @@ -783,7 +812,7 @@ </template> <script> -import { exportDocx } from '@/utils/exportImageFile' +// import { exportDocx } from '@/utils/exportImageFile' import { exportUAVImage } from '@/utils/exportUAVImage' import requestObj from '@/utils/request' import Map from '@/components/PlanMap/Map' @@ -792,28 +821,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: [{ @@ -832,7 +846,7 @@ }], carInput2: '', // ������������������������������ carMac: [], // ���������mac������ - carInput: '', // ������������������������������ + carInput: [], // ������������������������������ areaInput3: '', // ������������ value1: [new Date(), new Date()], // ������������������ value2: [new Date(), new Date()], // ������������1 @@ -1052,6 +1066,7 @@ immediate: true }, created () { + this.getRegion() // ��������������� this.$request({ url: 'cruiser/selectCruisers', @@ -1062,29 +1077,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 @@ -1113,12 +1178,13 @@ }, // ��������������������� selectExport () { + console.log(this.carInput) this.selectTime = this.newTime(this.value1) if (this.cityChoose && this.equipChoose1 && this.selectTime[1]) { // ���������������or��������� - var mac = '' + var mac = null if (this.equipChoose1 === 'car') { - mac = this.carInput + mac = this.carInput.join(',') } else { mac = this.planSelect } @@ -1142,12 +1208,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 @@ -1211,11 +1280,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) @@ -1284,12 +1356,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) @@ -1324,39 +1399,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) }) @@ -1436,11 +1487,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) @@ -1878,7 +1932,7 @@ } </script> -<style scoped> +<style scoped > .dailyreport{ width: 100%; height: 100%; @@ -1888,9 +1942,9 @@ width: 0; } .dailyTop{ - width: 80%; + text-align: center; margin:auto; - padding: 1%; + padding: 10px 0; margin-bottom: 3%; } .dailyDown{ -- Gitblit v1.8.0