jinhui.wang

pre-mde配舱页面增加

1 +import request from '@/utils/request'
2 +import axios from 'axios';
3 +import settings from "@/settings"
4 +import { getToken } from '@/utils/auth'
5 +
6 +//模板下载
7 +export function downLoadTemplate(template) {
8 + return request({
9 + url: '/flightInfoImport/downLoadTemplate?template=' + template,
10 + method: 'get',
11 + responseType: 'blob',
12 + })
13 +}
14 +
15 +//航班目的地批量导入
16 +/**
17 + * @param file * 文件
18 + * @param beginDate * 时间
19 + */
20 +export function importFlightDestination(file, date) {
21 + let formData = new FormData();
22 + formData.append("file", file);
23 + formData.append("beginDate", date);
24 + return axios({
25 + method: 'post',
26 + url: settings.baseURL + '/flightDestination/importFlightDestination',
27 + headers: { 'Authorization': 'Bearer ' + getToken() },
28 + data: formData
29 + })
30 + // return request({
31 + // url: '/flightDestination/importFlightDestination',
32 + // method: 'post',
33 + // data: formData
34 + // })
35 +}
36 +
37 +//URSA目的地批量导入
38 +/**
39 + * @param file * 文件
40 + * @param beginDate * 时间
41 + */
42 +export function importUrsaDestination(file, date) {
43 + let formData = new FormData();
44 + formData.append("file", file);
45 + formData.append("beginDate", date);
46 + return axios({
47 + method: 'post',
48 + url: settings.baseURL + '/ursaDestination/importUrsaDestination',
49 + headers: { 'Authorization': 'Bearer ' + getToken() },
50 + data: formData
51 + })
52 + // return request({
53 + // url: '/ursaDestination/importUrsaDestination',
54 + // method: 'post',
55 + // data: formData
56 + // })
57 +}
58 +
59 +//航班目的地查询
60 +/**
61 + * @param page * 页数
62 + * @param size * 长度
63 + * @param area 地区
64 + * @param fltNo 航班号
65 + */
66 +export function searchFlightDestination(data) {
67 + return request({
68 + url: '/flightDestination/searchFlightDestination',
69 + method: 'post',
70 + data: data
71 + })
72 +}
73 +
74 +//URSA目的地查询
75 +/**
76 + * @param page * 页数
77 + * @param size * 长度
78 + * @param area 地区
79 + * @param ursa ursa list
80 + */
81 +export function searchUrsaDestination(data) {
82 + return request({
83 + url: '/ursaDestination/searchUrsaDestination',
84 + method: 'post',
85 + data: data
86 + })
87 +}
...\ No newline at end of file ...\ No newline at end of file
1 +<template>
2 + <div style="margin: 20px">
3 + <el-form ref="selectForm" :model="formData" class="form-header" label-position="right" label-width="auto"
4 + size="small">
5 + <el-row>
6 + <el-col :span="6">
7 + <el-form-item label="航班号">
8 + <el-input type="text" v-model="formData.fltNo" placeholder="请输入航班号"></el-input>
9 + </el-form-item>
10 + </el-col>
11 + <el-col :span="6">
12 + <el-form-item label="地区">
13 + <el-input type="text" v-model="formData.area" placeholder="请输入地区"></el-input>
14 + </el-form-item>
15 + </el-col>
16 + </el-row>
17 + <el-row>
18 + <el-col :span="20">
19 + <el-row>
20 + <el-col :span="6">
21 + <el-form-item label="生效日期" prop="beginDate" :rules="rules">
22 + <el-date-picker class="formItem" v-model="formData.beginDate" type="date"
23 + placeholder="选择日期" value-format="yyyy-MM-dd" clearable>
24 + </el-date-picker>
25 + </el-form-item>
26 + </el-col>
27 + <el-col :span="12">
28 + <el-upload action="/flightInfoImport/importFlight" name="file" :http-request="uploadExcel"
29 + :on-remove="handleRemove" :limit="1" :on-exceed="handleExceed" :file-list="fileList"
30 + accept=".xlsx" class="upload-demo" v-hasPermi="['base:flightImport:importFlight']"
31 + :disabled="formData.beginDate==null">
32 + <el-button type="primary" icon="el-icon-upload2" size="small" @click="upload">导入Excel
33 + </el-button>
34 + </el-upload>
35 + </el-col>
36 + </el-row>
37 + </el-col>
38 + </el-row>
39 + </el-form>
40 + <div style="width:100%;display: flex;margin-bottom:10px">
41 + <el-button type="primary" size="small" icon="el-icon-search" :loading="tableLoading" @click="selection(1)">
42 + 查询</el-button>
43 + <el-button type="primary" icon="el-icon-download" size="small" @click="downloadTempleate"
44 + v-hasPermi="['base:flightImport:exportExcel']">
45 + 下载模板
46 + </el-button>
47 + </div>
48 + <Tables ref="flightToArea" ductName="flightToArea" :selection="false" :selectFixed="false" :order='true'
49 + :height="tableHeight" :data="tableData" :headerData="tableHeaders" :page="formData.page" :pageSizes="[20]"
50 + :totalCount="total" :loading="tableLoading" @currentChange="currentChange"
51 + layout="total,prev, pager, next, jumper, ->">
52 + </Tables>
53 + </div>
54 +</template>
55 +
56 +<script>
57 +import {
58 + downLoadTemplate,
59 + importFlightDestination,
60 + searchFlightDestination
61 +} from "@/api/preMdeConfig";
62 +
63 +export default {
64 + name: "FlightToArea",
65 + data() {
66 + return {
67 + formData: {
68 + fltNo: null,
69 + area: null,
70 + beginDate: null,
71 + page: 1,
72 + },
73 + tableData: [],
74 + errorData: [],
75 + tableHeaders: this.tableHeaders['flightToArea'],
76 + tableHeight: null,
77 + total: 0,
78 + flightType: [],
79 + form: {
80 + type: "",
81 + region: "",
82 + },
83 + rules: {
84 + validator: (rule, value, callback) => {
85 + if (this.formData.beginDate == null) {
86 + callback(new Error('上传前请选择生效时间'))
87 + }
88 + },
89 + trigger: 'change'
90 + },
91 + fileList: [],
92 + tableLoading: false,
93 + };
94 + },
95 + created() {
96 + },
97 + mounted() {
98 + this.tableHeight = window.innerHeight - this.$refs.selectForm.$el.offsetHeight - 170
99 + this.selection(1)
100 + },
101 + activated() {
102 + },
103 + methods: {
104 + selection(val) {
105 + this.tableData = []
106 + this.tableLoading = true
107 + if (val === 1) {
108 + this.formData.page = 1
109 + }
110 + let obj = {
111 + fltNo: this.formData.fltNo,
112 + area: this.formData.area,
113 + page: this.formData.page,
114 + size: 20
115 + }
116 + searchFlightDestination(obj).then(res => {
117 + this.tableLoading = false
118 + if (res.code === 200) {
119 + this.tableData = res.data.list
120 + this.total = res.data.total
121 + }
122 + }).catch(err => {
123 + this.tableLoading = false
124 + console.log(err)
125 + })
126 + },
127 + downloadTempleate() {
128 + let downloadType = "flightDestination";
129 + let fileName = "航班目的地模板.xlsx";
130 + downLoadTemplate(downloadType).then((res) => {
131 + if (res) {
132 + const blob = new Blob([res]);
133 + const link = document.createElement("a"); //创建a标签
134 + link.download = fileName; //a标签添加属性
135 + link.style.display = "none";
136 + link.href = URL.createObjectURL(blob);
137 + document.body.appendChild(link);
138 + link.click(); //执行下载
139 + URL.revokeObjectURL(link.href); //释放url
140 + document.body.removeChild(link); //释放标签
141 + } else {
142 + this.$message.error("下载失败");
143 + }
144 + });
145 + },
146 + uploadExcel(option) {
147 + //上传excel
148 + const file = option.file;
149 + importFlightDestination(file, this.formData.beginDate).then((res) => {
150 + if (res.data.code != 200) {
151 + if (res.data.code == 603) {
152 + this.$alert(res.msg, "提示", {
153 + confirmButtonText: "确定",
154 + type: "warning",
155 + });
156 + } else {
157 + this.msgWarning(res.data.msg);
158 + if (res.data.data && res.data.data.length > 0) {
159 + this.errorData = res.data.data;
160 + this.$router.push({ name: 'UpDateResult', params: { data: this.errorData, from: 'FlightToArea' } })
161 + }
162 + }
163 + } else {
164 + this.msgSuccess("导入成功");
165 + this.selection()
166 + }
167 + });
168 + },
169 + handleRemove(file, fileList) {
170 + //清掉上传的文件
171 + this.fileList = [];
172 + this.selection()
173 + },
174 + handleExceed(files) {
175 + //重复上传文件
176 + let file = {};
177 + file.file = files[0];
178 + file.name = files[0].name;
179 + this.fileList = [];
180 + this.fileList.push(file);
181 + this.uploadExcel(file);
182 + },
183 + currentChange(val) {
184 + this.formData.page = val.page
185 + this.selection()
186 + },
187 + upload() {
188 + this.$refs.selectForm.validateField('beginDate')
189 + }
190 + },
191 +};
192 +</script>
193 +<style rel="stylesheet/scss" lang="scss">
194 +.upload-demo {
195 + display: flex;
196 + margin-left: 10px;
197 + float: none !important;
198 +}
199 +
200 +.el-upload-list {
201 + display: inline-block;
202 + margin-left: 10px;
203 + vertical-align: top;
204 +}
205 +</style>
...\ No newline at end of file ...\ No newline at end of file
1 +<template>
2 + <div>
3 + <el-button class="ml20 mb20" size="small" icon="el-icon-back" @click="close">返 回</el-button>
4 + <el-table ref="filterTable" class="mt20" :data="tableData" size="small" border>
5 + <el-table-column label="行号" prop="line" width="50" align="center">
6 + </el-table-column>
7 + <el-table-column label="错误信息" prop="errorMessage" width="200">
8 + <template slot-scope="scope">
9 + <div v-for="(m, key) in scope.row.errorMessage" :key="key">
10 + {{ m }}
11 + </div>
12 + </template>
13 + </el-table-column>
14 + <el-table-column v-if="tableData.length == 0"></el-table-column>
15 + <el-table-column v-for="(value, key) in this.tableData[0]" :key="key"
16 + v-if="key != 'errorMessage' && key != 'line'" header-align="center" align="center" :label="key"
17 + :prop="key"></el-table-column>
18 + </el-table>
19 +
20 + </div>
21 +</template>
22 +
23 +<script>
24 +
25 +export default {
26 + name: 'UpDateResult',
27 + data() {
28 + return {
29 + tableData: [],
30 + fromRoute: ''
31 + }
32 + },
33 + created() {
34 + this.tableData = this.$route.params.data
35 + this.fromRoute = this.$route.params.from
36 + },
37 + wactch: {
38 + dialogVisible(val) {
39 + if (val) {
40 + }
41 + }
42 + },
43 + methods: {
44 + close() {
45 + this.$store.state.tagsView.visitedViews.splice(
46 + this.$store.state.tagsView.visitedViews.findIndex(
47 + (item) => item.path === this.$route.path
48 + ),
49 + );
50 + this.$router.push({ name: this.fromRoute })
51 + }
52 + }
53 +}
54 +</script>
55 +
56 +<style lang="scss" scoped>
57 +
58 +</style>
...\ No newline at end of file ...\ No newline at end of file
1 +<template>
2 + <div style="margin: 20px">
3 + <el-form ref="selectForm" :model="formData" class="form-header" label-position="right" label-width="auto"
4 + size="small">
5 + <el-row>
6 + <el-col :span="6">
7 + <el-form-item label="URSA">
8 + <el-input type="textarea" v-model="formData.ursa" placeholder="URSA之间用分号分隔,例:F2;F3;P_" rows="2">
9 + </el-input>
10 + </el-form-item>
11 + </el-col>
12 + <el-col :span="6">
13 + <el-form-item label="地区">
14 + <el-input type="text" v-model="formData.area" placeholder="请输入地区"></el-input>
15 + </el-form-item>
16 + </el-col>
17 + </el-row>
18 + <el-row>
19 + <el-col :span="20">
20 + <el-row>
21 + <el-col :span="6">
22 + <el-form-item label="生效日期" prop="beginDate" :rules="rules">
23 + <el-date-picker class="formItem" v-model="formData.beginDate" type="date"
24 + placeholder="选择日期" value-format="yyyy-MM-dd" clearable>
25 + </el-date-picker>
26 + </el-form-item>
27 + </el-col>
28 + <el-col :span="12">
29 + <el-upload action="/flightInfoImport/importFlight" name="file" :http-request="uploadExcel"
30 + :on-remove="handleRemove" :limit="1" :on-exceed="handleExceed" :file-list="fileList"
31 + accept=".xlsx" class="upload-demo" v-hasPermi="['base:flightImport:importFlight']"
32 + :disabled="formData.beginDate==null">
33 + <el-button type="primary" icon="el-icon-upload2" size="small" @click="upload">导入Excel
34 + </el-button>
35 + </el-upload>
36 + </el-col>
37 + </el-row>
38 + </el-col>
39 + </el-row>
40 + </el-form>
41 + <div style="width:100%;display: flex;margin-bottom:10px">
42 + <el-button type="primary" size="small" icon="el-icon-search" :loading="tableLoading" @click="selection(1)">
43 + 查询</el-button>
44 + <el-button type="primary" icon="el-icon-download" size="small" @click="downloadTempleate"
45 + v-hasPermi="['base:flightImport:exportExcel']">
46 + 下载模板
47 + </el-button>
48 + </div>
49 + <Tables ref="flightToArea" ductName="flightToArea" :selection="false" :selectFixed="false" :order='true'
50 + :height="tableHeight" :data="tableData" :headerData="tableHeaders" :page="formData.page" :pageSizes="[20]"
51 + :totalCount="total" :loading="tableLoading" @currentChange="currentChange"
52 + layout="total,prev, pager, next, jumper, ->">
53 + </Tables>
54 + </div>
55 +</template>
56 +
57 +<script>
58 +import {
59 + downLoadTemplate,
60 + importUrsaDestination,
61 + searchUrsaDestination
62 +} from "@/api/preMdeConfig";
63 +
64 +export default {
65 + name: "UrsaToArea",
66 + data() {
67 + return {
68 + formData: {
69 + ursa: null,
70 + area: null,
71 + page: 1,
72 + },
73 + tableData: [],
74 + errorData: [],
75 + tableHeaders: this.tableHeaders['ursaToArea'],
76 + tableHeight: null,
77 + total: 0,
78 + flightType: [],
79 + form: {
80 + type: "",
81 + region: "",
82 + },
83 + rules: {
84 + validator: (rule, value, callback) => {
85 + if (this.formData.beginDate == null) {
86 + callback(new Error('上传前请选择生效时间'))
87 + }
88 + },
89 + trigger: 'change'
90 + },
91 + fileList: [],
92 + tableLoading: false,
93 + };
94 + },
95 + created() {
96 + },
97 + mounted() {
98 + this.tableHeight = window.innerHeight - this.$refs.selectForm.$el.offsetHeight - 170
99 + this.selection(1)
100 + },
101 + activated() {
102 + },
103 + methods: {
104 + selection(val) {
105 + this.tableData = []
106 + this.tableLoading = true
107 + if (val === 1) {
108 + this.formData.page = 1
109 + }
110 + let obj = {
111 + area: this.formData.area,
112 + page: this.formData.page,
113 + size: 20
114 + }
115 + if (this.formData.ursa && this.formData.ursa != null && this.formData.ursa != '') {
116 + obj.ursa = this.formData.ursa.split(';')
117 + } else {
118 + obj.ursa = null
119 + }
120 + searchUrsaDestination(obj).then(res => {
121 + this.tableLoading = false
122 + if (res.code === 200) {
123 + this.tableData = res.data.list
124 + this.total = res.data.total
125 + } else {
126 + this.msgWarning(res.msg)
127 + }
128 + }).catch(err => {
129 + this.tableLoading = false
130 + console.log(err)
131 + })
132 + },
133 + downloadTempleate() {
134 + let downloadType = "ursaDestination";
135 + let fileName = "URSA目的地模板.xlsx";
136 + downLoadTemplate(downloadType).then((res) => {
137 + if (res) {
138 + const blob = new Blob([res]);
139 + const link = document.createElement("a"); //创建a标签
140 + link.download = fileName; //a标签添加属性
141 + link.style.display = "none";
142 + link.href = URL.createObjectURL(blob);
143 + document.body.appendChild(link);
144 + link.click(); //执行下载
145 + URL.revokeObjectURL(link.href); //释放url
146 + document.body.removeChild(link); //释放标签
147 + } else {
148 + this.$message.error("下载失败");
149 + }
150 + });
151 + },
152 + uploadExcel(option) {
153 + //上传excel
154 + const file = option.file;
155 + importUrsaDestination(file, this.formData.beginDate).then((res) => {
156 + if (res.data.code != 200) {
157 + if (res.data.code == 603) {
158 + this.$alert(res.data.msg, "提示", {
159 + confirmButtonText: "确定",
160 + type: "warning",
161 + });
162 + } else {
163 + this.msgWarning(res.data.msg);
164 + if (res.data.data && res.data.data.length > 0) {
165 + this.errorData = res.data.data;
166 + this.$router.push({ name: 'UpDateResult', params: { data: this.errorData, from: 'FlightInformationImport' } })
167 + }
168 + }
169 + } else {
170 + this.msgSuccess("导入成功");
171 + this.tableData = res.data.data;
172 + }
173 + });
174 + },
175 + handleRemove(file, fileList) {
176 + //清掉上传的文件
177 + this.fileList = [];
178 + this.selection()
179 + },
180 + handleExceed(files) {
181 + //重复上传文件
182 + let file = {};
183 + file.file = files[0];
184 + file.name = files[0].name;
185 + this.fileList = [];
186 + this.fileList.push(file);
187 + this.uploadExcel(file);
188 + },
189 + currentChange(val) {
190 + this.formData.page = val.page
191 + this.selection()
192 + },
193 + upload() {
194 + this.$refs.selectForm.validateField('beginDate')
195 + }
196 + },
197 +};
198 +</script>
199 +<style rel="stylesheet/scss" lang="scss">
200 +.upload-demo {
201 + display: flex;
202 + margin-left: 10px;
203 + float: none !important;
204 +}
205 +
206 +.el-upload-list {
207 + display: inline-block;
208 + margin-left: 10px;
209 + vertical-align: top;
210 +}
211 +</style>
...\ No newline at end of file ...\ No newline at end of file