Showing
8 changed files
with
548 additions
and
27 deletions
src/api/caPreReviewImport.js
0 → 100644
| 1 | +import service from "../utils/request"; | ||
| 2 | +import request from '@/utils/request' | ||
| 3 | + | ||
| 4 | +export function downLoadTemplate(template) { | ||
| 5 | + return request({ | ||
| 6 | + url:'/caPreReviewImport/downLoadTemplate?template=' + template, | ||
| 7 | + method:'get', | ||
| 8 | + responseType:'blob', | ||
| 9 | + }) | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +export function importcaPreReview(file, type){ | ||
| 13 | + let formData = new FormData(); | ||
| 14 | + formData.append("file", file); | ||
| 15 | + formData.append("type", type); | ||
| 16 | + return request({ | ||
| 17 | + url:'/caPreReviewImport/importcaPreReview', | ||
| 18 | + method:'post', | ||
| 19 | + data:formData | ||
| 20 | + }) | ||
| 21 | +} |
| ... | @@ -17,4 +17,31 @@ export function findCargoData(data) { | ... | @@ -17,4 +17,31 @@ export function findCargoData(data) { |
| 17 | data: data | 17 | data: data |
| 18 | }) | 18 | }) |
| 19 | } | 19 | } |
| 20 | +//货物预审查询 | ||
| 21 | +export function findCagroPreData(data) { | ||
| 22 | + return request({ | ||
| 23 | + url: '/cargo/findCagroPreData', | ||
| 24 | + method: 'post', | ||
| 25 | + data: data | ||
| 26 | + }) | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +//货物配舱查询 | ||
| 30 | +export function findCargoAllocationData(data) { | ||
| 31 | + return request({ | ||
| 32 | + url: '/cargo/findCargoAllocationData', | ||
| 33 | + method: 'post', | ||
| 34 | + data: data | ||
| 35 | + }) | ||
| 36 | +} | ||
| 37 | + | ||
| 20 | 38 | ||
| 39 | +//导出excel | ||
| 40 | +export function downloadExcel(data) { | ||
| 41 | + return request({ | ||
| 42 | + url: '/cargo/excel', | ||
| 43 | + method: 'post', | ||
| 44 | + data: data, | ||
| 45 | + responseType: 'blob', | ||
| 46 | + }) | ||
| 47 | +} | ... | ... |
| ... | @@ -8,6 +8,7 @@ const mimeMap = { | ... | @@ -8,6 +8,7 @@ const mimeMap = { |
| 8 | // const baseUrl = 'https://imacuat.zmd.apac.fedex.com/IMAC2' //uat服务器 | 8 | // const baseUrl = 'https://imacuat.zmd.apac.fedex.com/IMAC2' //uat服务器 |
| 9 | const baseUrl = 'http://47.103.140.98:7001/IMAC2' //阿里云服务器 | 9 | const baseUrl = 'http://47.103.140.98:7001/IMAC2' //阿里云服务器 |
| 10 | // const baseUrl = 'http://192.168.1.133:7001/IMAC2' //测试服务器 | 10 | // const baseUrl = 'http://192.168.1.133:7001/IMAC2' //测试服务器 |
| 11 | + | ||
| 11 | export function downLoadZip(str, filename) { | 12 | export function downLoadZip(str, filename) { |
| 12 | var url = baseUrl + str | 13 | var url = baseUrl + str |
| 13 | axios({ | 14 | axios({ |
| ... | @@ -19,50 +20,87 @@ export function downLoadZip(str, filename) { | ... | @@ -19,50 +20,87 @@ export function downLoadZip(str, filename) { |
| 19 | resolveBlob(res, mimeMap.zip) | 20 | resolveBlob(res, mimeMap.zip) |
| 20 | }) | 21 | }) |
| 21 | } | 22 | } |
| 22 | -export function cargoXlsx(str, data) { | 23 | + |
| 24 | +/** | ||
| 25 | + * 解析blob响应内容并下载 | ||
| 26 | + * @param {*} res blob响应内容 | ||
| 27 | + * @param {String} mimeType MIME类型 | ||
| 28 | + */ | ||
| 29 | + export function resolveBlob(res, mimeType) { | ||
| 30 | + const aLink = document.createElement('a') | ||
| 31 | + var blob = new Blob([res], { type: mimeType }) | ||
| 32 | + // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名; | ||
| 33 | + var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*') | ||
| 34 | + var contentDisposition = decodeURI(res.headers['content-disposition']) | ||
| 35 | + var result = patt.exec(contentDisposition) | ||
| 36 | + var fileName = result[1] | ||
| 37 | + fileName = fileName.replace(/\"/g, '') | ||
| 38 | + aLink.href = URL.createObjectURL(blob) | ||
| 39 | + aLink.setAttribute('download', fileName) // 设置下载文件名称 | ||
| 40 | + document.body.appendChild(aLink) | ||
| 41 | + aLink.click() | ||
| 42 | + document.body.removeChild(aLink); | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +// excel导出请求 | ||
| 46 | +export function downLoadXlsx(str, data,fileName) { | ||
| 23 | var url = baseUrl + str | 47 | var url = baseUrl + str |
| 24 | - return new Promise((resolve,rej)=>{ | 48 | + return new Promise((resolve,reject)=>{ |
| 25 | axios({ | 49 | axios({ |
| 26 | method: 'post', | 50 | method: 'post', |
| 27 | url: url, | 51 | url: url, |
| 28 | data: data, | 52 | data: data, |
| 29 | responseType: 'blob', | 53 | responseType: 'blob', |
| 30 | headers: { 'Authorization': getToken() } | 54 | headers: { 'Authorization': getToken() } |
| 55 | + // headers: { 'Authorization': decodeURIComponent(getToken()) } | ||
| 56 | + //uat环境token需要做url解码处理 | ||
| 31 | }).then(res => { | 57 | }).then(res => { |
| 32 | if (res.status === 200) { | 58 | if (res.status === 200) { |
| 33 | - cargoTableXlsx(res) | 59 | + downLoadExcal(res,fileName) |
| 34 | } | 60 | } |
| 35 | - resolve() | 61 | + resolve(res) |
| 36 | }).catch((err)=>{ | 62 | }).catch((err)=>{ |
| 37 | - rej(err) | 63 | + reject(err) |
| 38 | }) | 64 | }) |
| 39 | }) | 65 | }) |
| 40 | } | 66 | } |
| 41 | -/** | 67 | + |
| 42 | - * 解析blob响应内容并下载 | 68 | +//excel导出下载 |
| 43 | - * @param {*} res blob响应内容 | 69 | +export function downLoadExcal(val,filename) { |
| 44 | - * @param {String} mimeType MIME类型 | ||
| 45 | - */ | ||
| 46 | -export function resolveBlob(res, mimeType) { | ||
| 47 | const aLink = document.createElement('a') | 70 | const aLink = document.createElement('a') |
| 48 | - var blob = new Blob([res], { type: mimeType }) | 71 | + const fileName = filename+".xlsx" |
| 49 | - // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名; | 72 | + aLink.href = URL.createObjectURL(val.data) |
| 50 | - var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*') | ||
| 51 | - var contentDisposition = decodeURI(res.headers['content-disposition']) | ||
| 52 | - var result = patt.exec(contentDisposition) | ||
| 53 | - var fileName = result[1] | ||
| 54 | - fileName = fileName.replace(/\"/g, '') | ||
| 55 | - aLink.href = URL.createObjectURL(blob) | ||
| 56 | aLink.setAttribute('download', fileName) // 设置下载文件名称 | 73 | aLink.setAttribute('download', fileName) // 设置下载文件名称 |
| 57 | document.body.appendChild(aLink) | 74 | document.body.appendChild(aLink) |
| 58 | aLink.click() | 75 | aLink.click() |
| 59 | document.body.removeChild(aLink); | 76 | document.body.removeChild(aLink); |
| 60 | } | 77 | } |
| 61 | 78 | ||
| 62 | -//货物查询表导出 | 79 | +//航班预审导出 |
| 63 | -export function cargoTableXlsx(val) { | 80 | +export function cargoXlsxPre(str, data) { |
| 81 | + var url = baseUrl + str | ||
| 82 | + return new Promise((resolve,reject)=>{ | ||
| 83 | + axios({ | ||
| 84 | + method: 'post', | ||
| 85 | + url: url, | ||
| 86 | + data: data, | ||
| 87 | + responseType: 'blob', | ||
| 88 | + headers: { 'Authorization': getToken() } | ||
| 89 | + }).then(res => { | ||
| 90 | + if (res.status === 200) { | ||
| 91 | + cargoTableXlsxPre(res) | ||
| 92 | + } | ||
| 93 | + resolve() | ||
| 94 | + }).catch((err)=>{ | ||
| 95 | + reject(err) | ||
| 96 | + }) | ||
| 97 | + }) | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +//航班预审导出 | ||
| 101 | +export function cargoTableXlsxPre(val) { | ||
| 64 | const aLink = document.createElement('a') | 102 | const aLink = document.createElement('a') |
| 65 | - const fileName = "货物查询表.xlsx" | 103 | + const fileName = "航班预审表.xlsx" |
| 66 | aLink.href = URL.createObjectURL(val.data) | 104 | aLink.href = URL.createObjectURL(val.data) |
| 67 | aLink.setAttribute('download', fileName) // 设置下载文件名称 | 105 | aLink.setAttribute('download', fileName) // 设置下载文件名称 |
| 68 | document.body.appendChild(aLink) | 106 | document.body.appendChild(aLink) | ... | ... |
| ... | @@ -288,7 +288,6 @@ | ... | @@ -288,7 +288,6 @@ |
| 288 | }, | 288 | }, |
| 289 | /** 删除 启用 停用按钮操作 */ | 289 | /** 删除 启用 停用按钮操作 */ |
| 290 | handleDeleteorPlayorpause(row, status, statusText) { | 290 | handleDeleteorPlayorpause(row, status, statusText) { |
| 291 | - // debugger | ||
| 292 | //删除前需要停用 | 291 | //删除前需要停用 |
| 293 | if (status === 0 && row.status != '3') { | 292 | if (status === 0 && row.status != '3') { |
| 294 | this.$message({ | 293 | this.$message({ | ... | ... |
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + <el-form :model="queryParams" :inline="true" label-width="90px"> | ||
| 4 | + <el-row> | ||
| 5 | + <el-col :span="8"> | ||
| 6 | + <el-form-item label="航班号:"> | ||
| 7 | + <el-input | ||
| 8 | + type="textarea" | ||
| 9 | + v-model="fltNo" | ||
| 10 | + clearable | ||
| 11 | + size="small" | ||
| 12 | + class="formItem" | ||
| 13 | + placeholder="AC001;AC002" | ||
| 14 | + > | ||
| 15 | + </el-input> | ||
| 16 | + </el-form-item> | ||
| 17 | + </el-col> | ||
| 18 | + <el-col :span="8"> | ||
| 19 | + <el-form-item label="航班日期从" prop="fltDateStart"> | ||
| 20 | + <el-date-picker | ||
| 21 | + value-format="yyyy-MM-dd" | ||
| 22 | + v-model="queryParams.fltDateStart" | ||
| 23 | + type="date" | ||
| 24 | + placeholder="选择日期" | ||
| 25 | + > | ||
| 26 | + </el-date-picker> | ||
| 27 | + </el-form-item> | ||
| 28 | + </el-col> | ||
| 29 | + <el-col :span="8"> | ||
| 30 | + <el-form-item label="到" prop="fltDateEnd"> | ||
| 31 | + <el-date-picker | ||
| 32 | + value-format="yyyy-MM-dd" | ||
| 33 | + v-model="queryParams.fltDateEnd" | ||
| 34 | + type="date" | ||
| 35 | + placeholder="选择日期" | ||
| 36 | + > | ||
| 37 | + </el-date-picker> | ||
| 38 | + </el-form-item> | ||
| 39 | + </el-col> | ||
| 40 | + </el-row> | ||
| 41 | + <el-row> | ||
| 42 | + <el-col :span="8"> | ||
| 43 | + <el-form-item label="运单号:"> | ||
| 44 | + <el-input | ||
| 45 | + size="small" | ||
| 46 | + clearable | ||
| 47 | + type="textarea" | ||
| 48 | + v-model="queryParams.waybillNo" | ||
| 49 | + class="formItem" | ||
| 50 | + placeholder="xxxx;xxxx" | ||
| 51 | + ></el-input> | ||
| 52 | + </el-form-item> | ||
| 53 | + </el-col> | ||
| 54 | + <el-col :span="8"> | ||
| 55 | + <el-form-item label="站点"> | ||
| 56 | + <el-input | ||
| 57 | + type="textarea" | ||
| 58 | + v-model="siteName" | ||
| 59 | + class="formItem" | ||
| 60 | + placeholder="PVG;PEK" | ||
| 61 | + clearable | ||
| 62 | + size="small" | ||
| 63 | + > | ||
| 64 | + </el-input> | ||
| 65 | + </el-form-item> | ||
| 66 | + </el-col> | ||
| 67 | + <el-col :span="8"> | ||
| 68 | + <el-form-item label="URSA:"> | ||
| 69 | + <el-input | ||
| 70 | + clearable | ||
| 71 | + size="small" | ||
| 72 | + type="textarea" | ||
| 73 | + v-model="ursa" | ||
| 74 | + class="formItem" | ||
| 75 | + placeholder="S_;P_;E2" | ||
| 76 | + > | ||
| 77 | + </el-input> | ||
| 78 | + </el-form-item> | ||
| 79 | + </el-col> | ||
| 80 | + </el-row> | ||
| 81 | + <el-row> | ||
| 82 | + <el-col :span="24"> | ||
| 83 | + <el-switch | ||
| 84 | + v-model="queryParams.reExport" | ||
| 85 | + active-color="#13ce66" | ||
| 86 | + active-text="重新导出" | ||
| 87 | + style="padding-left: 35px" | ||
| 88 | + > | ||
| 89 | + </el-switch> | ||
| 90 | + </el-col> | ||
| 91 | + </el-row> | ||
| 92 | + <br /> | ||
| 93 | + <el-form-item style="margin-top: 33px"> | ||
| 94 | + <el-button | ||
| 95 | + type="primary" | ||
| 96 | + icon="el-icon-search" | ||
| 97 | + size="mini" | ||
| 98 | + @click="handleQuery" | ||
| 99 | + >搜索</el-button | ||
| 100 | + > | ||
| 101 | + <el-button | ||
| 102 | + type="warning" | ||
| 103 | + :disabled="tableData.length == 0" | ||
| 104 | + @click="xlse()" | ||
| 105 | + :loading="downLoadingTip.downloading" | ||
| 106 | + icon="el-icon-download" | ||
| 107 | + size="mini" | ||
| 108 | + >{{ | ||
| 109 | + downLoadingTip.downloading ? downLoadingTip.tip : "导出" | ||
| 110 | + }}</el-button | ||
| 111 | + > | ||
| 112 | + </el-form-item> | ||
| 113 | + </el-form> | ||
| 114 | + | ||
| 115 | + <el-table | ||
| 116 | + max-height="500" | ||
| 117 | + highlight-current-row | ||
| 118 | + border | ||
| 119 | + stripe | ||
| 120 | + v-loading="loading" | ||
| 121 | + :data="tableData" | ||
| 122 | + > | ||
| 123 | + <el-table-column | ||
| 124 | + label="运单号" | ||
| 125 | + align="center" | ||
| 126 | + prop="waybillNo" | ||
| 127 | + width="120" | ||
| 128 | + /> | ||
| 129 | + <el-table-column | ||
| 130 | + label="品牌描述" | ||
| 131 | + align="center" | ||
| 132 | + prop="nameDescription" | ||
| 133 | + width="120" | ||
| 134 | + /> | ||
| 135 | + <el-table-column | ||
| 136 | + label="航班日期" | ||
| 137 | + align="center" | ||
| 138 | + prop="fltDate" | ||
| 139 | + width="130" | ||
| 140 | + /> | ||
| 141 | + <el-table-column label="航班号" align="center" prop="fltNo" /> | ||
| 142 | + <el-table-column | ||
| 143 | + label="航班路线" | ||
| 144 | + align="center" | ||
| 145 | + prop="route" | ||
| 146 | + width="150" | ||
| 147 | + /> | ||
| 148 | + <el-table-column | ||
| 149 | + label="配置航班类型" | ||
| 150 | + align="center" | ||
| 151 | + prop="kindName" | ||
| 152 | + width="130" | ||
| 153 | + /> | ||
| 154 | + <el-table-column label="尺寸" align="center" prop="sizeStr" /> | ||
| 155 | + <el-table-column label="件数" align="center" prop="qty" /> | ||
| 156 | + <el-table-column label="实际重量" align="center" prop="actualWeight" /> | ||
| 157 | + <el-table-column | ||
| 158 | + label="创建时间" | ||
| 159 | + align="center" | ||
| 160 | + prop="createTime" | ||
| 161 | + width="180" | ||
| 162 | + /> | ||
| 163 | + </el-table> | ||
| 164 | + <pagination | ||
| 165 | + v-show="total > 0" | ||
| 166 | + :total="total" | ||
| 167 | + layout=" prev, pager, next, jumper, sizes,total" | ||
| 168 | + :page.sync="queryParams.pageNum" | ||
| 169 | + :limit.sync="queryParams.limitSize" | ||
| 170 | + @pagination="findAllFltData" | ||
| 171 | + /> | ||
| 172 | + </div> | ||
| 173 | +</template> | ||
| 174 | + | ||
| 175 | +<script> | ||
| 176 | +import { findCagroPreData } from "@/api/cargoSelect"; | ||
| 177 | +import { cargoXlsxPre } from "@/utils/zipdownload"; | ||
| 178 | +export default { | ||
| 179 | + name: "caExportPreQualification", | ||
| 180 | + data() { | ||
| 181 | + return { | ||
| 182 | + //导出 | ||
| 183 | + downLoadingTip: { | ||
| 184 | + tip: "", | ||
| 185 | + downloading: false, | ||
| 186 | + }, | ||
| 187 | + tableData: [], //表格数据 | ||
| 188 | + // 遮罩层 | ||
| 189 | + loading: false, | ||
| 190 | + // 弹出层标题 | ||
| 191 | + title: "", | ||
| 192 | + // 总条数 | ||
| 193 | + total: 0, | ||
| 194 | + // 原航班规则数据 | ||
| 195 | + findAllFltDatList: [], | ||
| 196 | + // 新增修改查看规则弹出层 | ||
| 197 | + open: false, | ||
| 198 | + // 查询参数 | ||
| 199 | + queryParams: { | ||
| 200 | + limitStart: 0, //当前条数【代表第几条数据 +1开始】 | ||
| 201 | + pageNum: 1, | ||
| 202 | + limitSize: 20, //一页显示多少条数据 | ||
| 203 | + fltDateStart: undefined, //航班日期开始 | ||
| 204 | + fltDateEnd: undefined, //航班日期结束 | ||
| 205 | + reExport: false, | ||
| 206 | + //航班号 | ||
| 207 | + fltNo: null, | ||
| 208 | + //运单号 | ||
| 209 | + waybillNo: "", | ||
| 210 | + //站点 | ||
| 211 | + siteName: "", | ||
| 212 | + //ursa | ||
| 213 | + ursa: "", | ||
| 214 | + }, | ||
| 215 | + // 表单校验 | ||
| 216 | + rules: {}, | ||
| 217 | + }; | ||
| 218 | + }, | ||
| 219 | + created() {}, | ||
| 220 | + methods: { | ||
| 221 | + // 导出表格 | ||
| 222 | + xlse() { | ||
| 223 | + this.downLoadingTip.downloading = true; | ||
| 224 | + this.downLoadingTip.tip = "正在导出结果集请耐心等待"; | ||
| 225 | + let cargoXlse = { title: "航班预审表", cargoExportPreQueryDto: {} }; | ||
| 226 | + cargoXlse.cargoExportPreQueryDto = JSON.parse( | ||
| 227 | + JSON.stringify(this.queryParams) | ||
| 228 | + ); | ||
| 229 | + cargoXlse.cargoExportPreQueryDto.limitStart = 0; | ||
| 230 | + cargoXlse.cargoExportPreQueryDto.limitSize = -1; | ||
| 231 | + cargoXlsxPre("/cargo/excelPre", cargoXlse) | ||
| 232 | + .then(() => { | ||
| 233 | + this.downLoadingTip.downloading = false; | ||
| 234 | + this.downLoadingTip.tip = ""; | ||
| 235 | + this.progress = 100; | ||
| 236 | + }) | ||
| 237 | + .catch(() => { | ||
| 238 | + this.downLoadingTip.downloading = false; | ||
| 239 | + this.downLoadingTip.tip = ""; | ||
| 240 | + }); | ||
| 241 | + }, | ||
| 242 | + | ||
| 243 | + /** 搜索按钮操作 */ | ||
| 244 | + handleQuery() { | ||
| 245 | + this.queryParams.pageNum = 1; | ||
| 246 | + this.queryParams.start = 0; | ||
| 247 | + this.findAllFltData(); | ||
| 248 | + }, | ||
| 249 | + /** 预审信息查寻*/ | ||
| 250 | + findAllFltData() { | ||
| 251 | + this.loading = true; | ||
| 252 | + if (this.queryParams.pageNum > 1) { | ||
| 253 | + this.queryParams.limitStart = | ||
| 254 | + (this.queryParams.pageNum - 1) * this.queryParams.limitSize; | ||
| 255 | + } else { | ||
| 256 | + this.queryParams.limitStart = 0; | ||
| 257 | + } | ||
| 258 | + findCagroPreData(this.queryParams).then((response) => { | ||
| 259 | + if (response.code == 200) { | ||
| 260 | + this.tableData = response.data.list; | ||
| 261 | + this.total = response.data.totalCount; | ||
| 262 | + this.loading = false; | ||
| 263 | + } else { | ||
| 264 | + this.msgError(response.msg); | ||
| 265 | + } | ||
| 266 | + }); | ||
| 267 | + }, | ||
| 268 | + }, | ||
| 269 | + computed: { | ||
| 270 | + fltNo: { | ||
| 271 | + get: function () { | ||
| 272 | + return this.queryParams.fltNo; | ||
| 273 | + }, | ||
| 274 | + set: function (val) { | ||
| 275 | + this.queryParams.fltNo = val.toUpperCase(); | ||
| 276 | + }, | ||
| 277 | + }, | ||
| 278 | + siteName: { | ||
| 279 | + get: function () { | ||
| 280 | + return this.queryParams.siteName; | ||
| 281 | + }, | ||
| 282 | + set: function (val) { | ||
| 283 | + this.queryParams.siteName = val.toUpperCase(); | ||
| 284 | + }, | ||
| 285 | + }, | ||
| 286 | + ursa: { | ||
| 287 | + get: function () { | ||
| 288 | + return this.queryParams.ursa; | ||
| 289 | + }, | ||
| 290 | + set: function (val) { | ||
| 291 | + this.queryParams.ursa = val.toUpperCase(); | ||
| 292 | + }, | ||
| 293 | + }, | ||
| 294 | + }, | ||
| 295 | +}; | ||
| 296 | +</script> | ||
| 297 | + | ||
| 298 | +<style scoped> | ||
| 299 | +.tips { | ||
| 300 | + float: right; | ||
| 301 | + color: #606266; | ||
| 302 | + font-size: 14px; | ||
| 303 | + margin-right: 40px; | ||
| 304 | +} | ||
| 305 | +.formItem { | ||
| 306 | + width: 100%; | ||
| 307 | + max-width: 300px; | ||
| 308 | +} | ||
| 309 | +</style> |
| 1 | +<template> | ||
| 2 | + <div style="margin: 20px"> | ||
| 3 | + <el-form :inline="true" :model="form" class="demo-form-inline" size="small"> | ||
| 4 | + <el-form-item> | ||
| 5 | + <el-upload action="/caPreReviewImport/importFlight" name="file" :http-request="uploadExcel" | ||
| 6 | + :on-remove="handleRemove" :limit="1" :on-exceed="handleExceed" :file-list="fileList" accept=".xlsx" | ||
| 7 | + class="upload-demo"> | ||
| 8 | + <el-button type="primary">点击上传</el-button> | ||
| 9 | + </el-upload> | ||
| 10 | + </el-form-item> | ||
| 11 | + <el-form-item> | ||
| 12 | + <el-button type="primary" @click="downloadTempleate">下载模板</el-button> | ||
| 13 | + </el-form-item> | ||
| 14 | + </el-form> | ||
| 15 | + <div style="font-size: 12px; font-weight: 700"> | ||
| 16 | + 提示:<span style="color: #0000ff">以下为所提交的数据或出错信息</span> | ||
| 17 | + </div> | ||
| 18 | + <el-table ref="filterTable" :data="tableData" style="width: 100%; margin-top: 20px" size="small" border> | ||
| 19 | + <el-table-column label="行号" prop="line" fixed width="50" align="center"> | ||
| 20 | + </el-table-column> | ||
| 21 | + <el-table-column label="错误信息" prop="errorMessage" fixed width="300"> | ||
| 22 | + <template slot-scope="scope"> | ||
| 23 | + <div v-for="(m, key) in scope.row.errorMessage" :key="key"> | ||
| 24 | + {{ m }} | ||
| 25 | + </div> | ||
| 26 | + </template> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column v-if="tableData.length == 0"></el-table-column> | ||
| 29 | + <el-table-column v-if="tableData.length > 0" label="运单号" align="center" prop="A" /> | ||
| 30 | + <el-table-column v-if="tableData.length > 0" label="品名描述" align="center" prop="B" /> | ||
| 31 | + <el-table-column v-if="tableData.length > 0" label="航班日期" align="center" prop="C" /> | ||
| 32 | + <el-table-column v-if="tableData.length > 0" label="航班号" align="center" prop="D" /> | ||
| 33 | + <el-table-column v-if="tableData.length > 0" label="预审意见" align="center" prop="E" /> | ||
| 34 | + <!-- <el-table-column v-for="(value, key) in this.tableData[0]" :key="key" | ||
| 35 | + v-if="key != 'errorMessage' && key != 'line'" :label="key" :prop="key" width="120"></el-table-column>--> | ||
| 36 | + </el-table> | ||
| 37 | + </div> | ||
| 38 | +</template> | ||
| 39 | +</div> | ||
| 40 | +</template> | ||
| 41 | +<script> | ||
| 42 | + import { | ||
| 43 | + downLoadTemplate, | ||
| 44 | + importcaPreReview, | ||
| 45 | + } from "@/api/caPreReviewImport"; | ||
| 46 | + export default { | ||
| 47 | + data() { | ||
| 48 | + return { | ||
| 49 | + flightType: [], | ||
| 50 | + form: { | ||
| 51 | + type: "", | ||
| 52 | + region: "", | ||
| 53 | + }, | ||
| 54 | + fileList: [], | ||
| 55 | + tableData: [], | ||
| 56 | + }; | ||
| 57 | + }, | ||
| 58 | + methods: { | ||
| 59 | + downloadTempleate() { | ||
| 60 | + | ||
| 61 | + let fileName = "航班预审导入模板.xlsx"; | ||
| 62 | + downLoadTemplate().then((res) => { | ||
| 63 | + if (res) { | ||
| 64 | + const blob = new Blob([res]); | ||
| 65 | + const link = document.createElement("a"); //创建a标签 | ||
| 66 | + link.download = fileName; //a标签添加属性 | ||
| 67 | + link.style.display = "none"; | ||
| 68 | + link.href = URL.createObjectURL(blob); | ||
| 69 | + document.body.appendChild(link); | ||
| 70 | + link.click(); //执行下载 | ||
| 71 | + URL.revokeObjectURL(link.href); //释放url | ||
| 72 | + document.body.removeChild(link); //释放标签 | ||
| 73 | + } else { | ||
| 74 | + this.$message.error("下载失败"); | ||
| 75 | + } | ||
| 76 | + }); | ||
| 77 | + | ||
| 78 | + }, | ||
| 79 | + uploadExcel(option) { | ||
| 80 | + //上传excel | ||
| 81 | + const file = option.file; | ||
| 82 | + console.log(option); | ||
| 83 | + importcaPreReview(file, this.form.type).then((res) => { | ||
| 84 | + if (res.code != 200) { | ||
| 85 | + if (res.code == 603) { | ||
| 86 | + this.$alert(res.msg, "提示", { | ||
| 87 | + confirmButtonText: "确定", | ||
| 88 | + type: "warning", | ||
| 89 | + }); | ||
| 90 | + } else { | ||
| 91 | + this.$message.error(res.msg); | ||
| 92 | + this.tableData = res.data; | ||
| 93 | + } | ||
| 94 | + } else { | ||
| 95 | + this.$message.success("导入成功"); | ||
| 96 | + this.tableData = res.data; | ||
| 97 | + } | ||
| 98 | + }); | ||
| 99 | + }, | ||
| 100 | + handleRemove(file, fileList) { | ||
| 101 | + //清掉上传的文件 | ||
| 102 | + this.tableData = []; | ||
| 103 | + this.fileList = []; | ||
| 104 | + }, | ||
| 105 | + handleExceed(files) { | ||
| 106 | + //重复上传文件 | ||
| 107 | + let file = {}; | ||
| 108 | + file.file = files[0]; | ||
| 109 | + file.name = files[0].name; | ||
| 110 | + this.fileList = []; | ||
| 111 | + this.fileList.push(file); | ||
| 112 | + this.uploadExcel(file); | ||
| 113 | + }, | ||
| 114 | + }, | ||
| 115 | + created() { | ||
| 116 | + | ||
| 117 | + }, | ||
| 118 | + }; | ||
| 119 | +</script> | ||
| 120 | +<style rel="stylesheet/scss" lang="scss"> | ||
| 121 | + .upload-demo { | ||
| 122 | + float: right; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + .el-upload-list { | ||
| 126 | + display: inline-block; | ||
| 127 | + margin-left: 10px; | ||
| 128 | + vertical-align: top; | ||
| 129 | + } | ||
| 130 | +</style> |
| ... | @@ -475,13 +475,11 @@ | ... | @@ -475,13 +475,11 @@ |
| 475 | findFltConditionData() { | 475 | findFltConditionData() { |
| 476 | findFltConditionDataApi().then(response => { | 476 | findFltConditionDataApi().then(response => { |
| 477 | if (response.code == 200) { | 477 | if (response.code == 200) { |
| 478 | - // debugger | ||
| 479 | //航班种类 | 478 | //航班种类 |
| 480 | this.flightKindlist = response.data.flightKind; | 479 | this.flightKindlist = response.data.flightKind; |
| 481 | //航班类型 | 480 | //航班类型 |
| 482 | this.flightTypelist = response.data.flightType; | 481 | this.flightTypelist = response.data.flightType; |
| 483 | //航班状态 | 482 | //航班状态 |
| 484 | - // debugger | ||
| 485 | this.flightStatuslist = response.data.flightStatus; | 483 | this.flightStatuslist = response.data.flightStatus; |
| 486 | 484 | ||
| 487 | } else { | 485 | } else { |
| ... | @@ -659,7 +657,6 @@ | ... | @@ -659,7 +657,6 @@ |
| 659 | submitForm: function() { | 657 | submitForm: function() { |
| 660 | this.$refs["form"].validate(valid => { | 658 | this.$refs["form"].validate(valid => { |
| 661 | if (valid) { | 659 | if (valid) { |
| 662 | - //debugger | ||
| 663 | let formdata = JSON.parse(JSON.stringify(this.form)); | 660 | let formdata = JSON.parse(JSON.stringify(this.form)); |
| 664 | 661 | ||
| 665 | //高价百分比和低价百分比和不可以大于100 | 662 | //高价百分比和低价百分比和不可以大于100 | ... | ... |
-
Please register or login to post a comment