jinhui.wang

version:1.0.0

This diff is collapsed. Click to expand it.
1 +<template>
2 + <div>
3 + <el-dialog
4 + title="货物配舱"
5 + width="80%"
6 + :visible.sync="dialogVisible"
7 + :close-on-click-modal="false"
8 + :append-to-body="true"
9 + >
10 + <el-divider content-position="left">已选货物信息</el-divider>
11 + <el-table
12 + :data="tableData"
13 + size="mini"
14 + height="200"
15 + max-height="200"
16 + border
17 + stripe
18 + highlight-current-row
19 + style="width: 100%"
20 + >
21 + <el-table-column type="index" label="序号" align="center">
22 + </el-table-column>
23 + <el-table-column
24 + v-for="(item, index) in cargoHeader"
25 + header-align="center"
26 + align="center"
27 + :prop="item.value"
28 + :label="item.name"
29 + :key="index"
30 + :show-overflow-tooltip="true"
31 + >
32 + </el-table-column>
33 + </el-table>
34 + <el-form
35 + ref="form"
36 + label-position="right"
37 + label-width="auto"
38 + style="width: 400px; margin: 30px auto"
39 + >
40 + <el-form-item label="航班号" prop="fltNo">
41 + <el-input
42 + v-model="fltNo"
43 + size="medium"
44 + placeholder="请输入航班号"
45 + style="width: 350px"
46 + ></el-input>
47 + </el-form-item>
48 + <el-form-item label="航班日期:" prop="fltDate">
49 + <el-date-picker
50 + v-model="formData.fltDate"
51 + type="date"
52 + placeholder="选择日期"
53 + value-format="yyyy-MM-dd"
54 + size="medium"
55 + style="width: 350px"
56 + >
57 + </el-date-picker>
58 + </el-form-item>
59 + </el-form>
60 + <div slot="footer">
61 + <el-button @click="dialogBeforeClose">取 消</el-button>
62 + <el-button type="primary" @click="submit" :loading="loading">确 定</el-button>
63 + </div>
64 + </el-dialog>
65 + </div>
66 +</template>
67 +
68 +<script>
69 +import { allocationFlight } from "@/api/cargoSelect";
70 +import { MessageBox } from "element-ui";
71 +export default {
72 + props: {
73 + dialogVisible: {
74 + type: Boolean,
75 + default: false,
76 + },
77 + tableData: {
78 + type: Array,
79 + default: null,
80 + },
81 + },
82 + data() {
83 + return {
84 + formData: {
85 + ids: [],
86 + fltNo: undefined,
87 + fltDate: undefined,
88 + overweight: false,
89 + },
90 + cargoHeader: [
91 + { name: "口岸代码", value: "portName" },
92 + { name: "运单号", value: "waybillNo" },
93 + { name: "货物状态", value: "statusName" },
94 + { name: "站点", value: "siteName" },
95 + { name: "申报类型", value: "typeName" },
96 + { name: "URSA", value: "ursa" },
97 + { name: "实际重量", value: "actualWeight" },
98 + { name: "件数", value: "qty" },
99 + { name: "ACCS原航班号", value: "fltNoAccs" },
100 + { name: "ACCS原航班日期", value: "fltDateAccs" },
101 + { name: "品名描述", value: "nameDescription" },
102 + { name: "是否自动", value: "cargoRulesStatus" },
103 + { name: "创建人", value: "createUserName" },
104 + { name: "创建时间", value: "createTime" },
105 + ],
106 + rules: {
107 + fltNo: [
108 + {
109 + required: true,
110 + message: "航班号不能为空",
111 + trigger: "blur",
112 + },
113 + ],
114 + fltDate: [
115 + {
116 + required: true,
117 + message: "航班日期不能为空",
118 + trigger: "change",
119 + },
120 + ],
121 + },
122 + loading:false
123 + };
124 + },
125 + methods: {
126 + cleaerForm() {
127 + this.formData = {
128 + ids: [],
129 + fltNo: undefined,
130 + fltDate: undefined,
131 + overweight: false,
132 + };
133 + },
134 + //确定配舱
135 + submit() {
136 + this.loading = true;
137 + let arr = [];
138 + this.tableData.forEach((item) => {
139 + arr.push(item.id);
140 + });
141 + this.formData.ids = arr;
142 + if (this.formData.fltNo && this.formData.fltDate) {
143 + allocationFlight(this.formData).then((res) => {
144 + //code 200 配舱成功 202 重量已满需要确认 其余code直接输出msg
145 + if (res.code === 200) {
146 + this.$message({
147 + message: "货物配舱成功",
148 + type: "success",
149 + });
150 + this.cleaerForm();
151 + this.loading = false;
152 + this.$emit("dialogBeforeClose", { close: false, reload: true });
153 + } else if (res.code === 202) {
154 + MessageBox.confirm(res.msg, "提示", {
155 + confirmButtonText: "确定",
156 + cancelButtonText: "取消",
157 + type: "warning",
158 + })
159 + .then(() => {
160 + this.formData.overweight = true; //确定继续overweight变为true再次请求接口
161 + allocationFlight(this.formData).then((res) => {
162 + if (res.code === 200) {
163 + this.$message({
164 + message: "货物配舱成功",
165 + type: "success",
166 + });
167 + } else {
168 + this.$message({
169 + message: res.msg,
170 + type: "warning",
171 + });
172 + }
173 + });
174 + this.cleaerForm();
175 + this.loading = false;
176 + this.$emit("dialogBeforeClose", { close: false, reload: true });
177 + })
178 + .catch(() => {
179 + //取消 取消当前配舱
180 + this.$message({
181 + message: "配舱已取消",
182 + type: "success",
183 + });
184 + this.cleaerForm();
185 + this.loading = false;
186 + this.$emit("dialogBeforeClose", {
187 + close: false,
188 + reload: true,
189 + });
190 + });
191 + } else {
192 + this.loading = false;
193 + this.$message({
194 + message: res.msg,
195 + type: "warning",
196 + });
197 + }
198 + }).catch(()=>{
199 + this.loading = false;
200 + });
201 + } else {
202 + this.loading = false;
203 + this.$message({
204 + message: "航班号或航班日期不能为空",
205 + type: "warning",
206 + });
207 + }
208 + },
209 + dialogBeforeClose() {
210 + this.cleaerForm();
211 + this.$emit("dialogBeforeClose", { close: false, reload: true });
212 + },
213 + },
214 + computed: {
215 + fltNo: {
216 + get: function () {
217 + return this.formData.fltNo;
218 + },
219 + set: function (val) {
220 + this.formData.fltNo = val.toUpperCase();
221 + },
222 + },
223 + },
224 +};
225 +</script>
226 +
227 +<style>
228 +</style>
...\ No newline at end of file ...\ No newline at end of file
1 +<template>
2 + <div style="margin: 40px" class="app-container">
3 + <el-form
4 + :inline="true"
5 + :model="queryParams"
6 + class="demo-form-inline"
7 + size="small"
8 + >
9 + <el-form-item label="航班号">
10 + <el-input
11 + v-model.trim="purposeOfFlightNo"
12 + placeholder="航班号"
13 + @keyup.enter.native="getList"
14 + ></el-input>
15 + </el-form-item>
16 + <el-form-item label="状态">
17 + <el-select v-model="queryParams.status" placeholder="状态">
18 + <el-option label="有效" value="1"></el-option>
19 + <el-option label="停用" value="3"></el-option>
20 + </el-select>
21 + </el-form-item>
22 + <el-form-item>
23 + <el-button
24 + type="primary"
25 + icon="el-icon-search"
26 + @click="getList"
27 + size="mini"
28 + >查询</el-button
29 + >
30 + </el-form-item>
31 + </el-form>
32 + <el-button
33 + style="margin-bottom: 20px"
34 + type="primary"
35 + icon="el-icon-plus"
36 + size="mini"
37 + @click="
38 + $router.push({
39 + name: 'FlightAllocConfigAdd',
40 + params: { handle: 'add' },
41 + })
42 + "
43 + >添加</el-button
44 + >
45 + <el-table :data="flyList" v-loading="loading" size="small">
46 + <el-table-column
47 + prop="purposeOfFlightNo"
48 + label="航班号"
49 + align="center"
50 + ></el-table-column>
51 +
52 + <el-table-column prop="status" label="状态" align="center">
53 + <template slot-scope="scope">
54 + <span v-if="scope.row.status === '0'">无效</span>
55 + <span v-if="scope.row.status === '1'">有效</span>
56 + <span v-if="scope.row.status === '2'">配置中</span>
57 + <span v-if="scope.row.status === '3'">停用</span>
58 + </template>
59 + </el-table-column>
60 +
61 + <el-table-column prop="createUserName" label="操作人" align="center">
62 + </el-table-column>
63 +
64 + <el-table-column prop="createTime" label="更新时间" align="center">
65 + </el-table-column>
66 +
67 + <el-table-column label="操作" prop="id" align="center">
68 + <template slot-scope="scope">
69 + <el-button
70 + type="text"
71 + size="mini"
72 + icon="el-icon-view"
73 + @click="handleClick(scope.row.id, 'detail')"
74 + >查看</el-button
75 + >
76 + <el-button
77 + type="text"
78 + size="mini"
79 + icon="el-icon-edit"
80 + @click="handleClick(scope.row.id, 'update')"
81 + >修改</el-button
82 + >
83 + <el-button
84 + type="text"
85 + size="mini"
86 + icon="el-icon-delete"
87 + @click="del(scope.row.id, scope.row.status)"
88 + >删除</el-button
89 + >
90 + <el-button
91 + type="text"
92 + size="mini"
93 + icon="el-icon-video-pause"
94 + @click="changeStatus(scope.row.id, 3)"
95 + v-if="scope.row.status == '1'"
96 + >停用</el-button
97 + >
98 + <el-button
99 + type="text"
100 + size="mini"
101 + icon="el-icon-video-play"
102 + @click="changeStatus(scope.row.id, 1)"
103 + v-else
104 + >启用</el-button
105 + >
106 + </template>
107 + </el-table-column>
108 + </el-table>
109 + <el-pagination
110 + @size-change="getList"
111 + @current-change="getList"
112 + :current-page.sync="curPage"
113 + :page-sizes="[10, 20, 30, 40]"
114 + :page-size.sync="limit"
115 + layout="prev, pager, next, jumper, sizes, total"
116 + :total="total"
117 + background
118 + :hide-on-single-page="true"
119 + style="margin-top: 40px; text-align: right"
120 + >
121 + </el-pagination>
122 + </div>
123 +</template>
124 +
125 +<script>
126 +import {
127 + findFlightNo,
128 + delFlightId,
129 + enableOrDisable,
130 +} from "@/api/destinationFlight";
131 +
132 +export default {
133 + name: "FlightAllocConfig",
134 + data() {
135 + return {
136 + queryParams: {
137 + purposeOfFlightNo: "",
138 + status: "1",
139 + start: 0,
140 + limit: 10,
141 + },
142 + flyList: [],
143 + curPage: 1,
144 + limit: 10,
145 + total: 0,
146 + loading: false,
147 + };
148 + },
149 + activated(){
150 + this.getList()
151 + },
152 + methods: {
153 + getList() {
154 + this.queryParams.limit = this.limit;
155 + if (this.curPage > 1) {
156 + this.queryParams.start = (this.curPage - 1) * this.queryParams.limit;
157 + } else {
158 + this.queryParams.start = 0;
159 + }
160 + this.loading = true;
161 + findFlightNo(this.queryParams).then((response) => {
162 + if (response.code != 200) {
163 + this.$message({
164 + showClose: true,
165 + message: response.msg,
166 + type: "error",
167 + });
168 + return;
169 + }
170 + this.flyList = response.data.list;
171 + this.total = response.data.totalCount;
172 + this.loading = false;
173 + });
174 + },
175 + //跳转到查看,修改页面
176 + handleClick(flightiId, handle) {
177 + this.$router.push({
178 + name: "FlightAllocConfigInfo",
179 + params: { handle: handle, id: flightiId },
180 + });
181 + },
182 + //删除规则
183 + del(id, status) {
184 + if (status == "1") {
185 + this.$confirm("航班规则生效中,无法删除,请停用后再操作", "警告", {
186 + confirmButtonText: "确定",
187 + showCancelButton: false,
188 + type: "warning",
189 + });
190 + } else {
191 + this.$confirm("是否确认删除此航班规则?", "警告", {
192 + confirmButtonText: "确定",
193 + cancelButtonText: "取消",
194 + showCancelButton: true,
195 + type: "warning",
196 + }).then(() => {
197 + delFlightId(id)
198 + .then((res) => {
199 + this.$message({
200 + message: res.msg,
201 + type: res.code === 200 ? "success" : "warning",
202 + });
203 + this.getList();
204 + })
205 + .catch(() => {});
206 + });
207 + }
208 + },
209 + //启用,停用
210 + changeStatus(id, status) {
211 + let tip = status === 1 ? "启用" : "停用";
212 + this.$confirm("是否确认" + tip + "此航班规则?", "警告", {
213 + confirmButtonText: "确定",
214 + cancelButtonText: "取消",
215 + type: "warning",
216 + }).then(() => {
217 + enableOrDisable(id, status)
218 + .then((res) => {
219 + if (res.code != 200) {
220 + this.msgError(res.msg);
221 + } else {
222 + this.getList();
223 + this.msgSuccess(tip + "成功");
224 + }
225 + })
226 + .catch(() => {});
227 + });
228 + },
229 + },
230 + created() {
231 + this.getList();
232 + },
233 + computed: {
234 + purposeOfFlightNo: {
235 + get: function () {
236 + return this.queryParams.purposeOfFlightNo;
237 + },
238 + set: function (val) {
239 + this.queryParams.purposeOfFlightNo = val.toUpperCase();
240 + },
241 + },
242 + },
243 +};
244 +</script>
245 +
246 +
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +<template>
2 + <div class="app-container">
3 + <el-form
4 + class="form-header"
5 + :model="queryParams"
6 + label-position="right"
7 + label-width="auto"
8 + size="medium"
9 + >
10 + <el-row>
11 + <el-col :span="6">
12 + <el-form-item label="航班日期从" prop="fltDateStart">
13 + <el-date-picker
14 + value-format="yyyy-MM-dd"
15 + class="formItem"
16 + v-model="queryParams.fltDateStart"
17 + type="date"
18 + placeholder="选择日期"
19 + >
20 + </el-date-picker>
21 + </el-form-item>
22 + </el-col>
23 + <el-col :span="6">
24 + <el-form-item label="到" prop="fltDateEnd">
25 + <el-date-picker
26 + value-format="yyyy-MM-dd"
27 + class="formItem"
28 + v-model="queryParams.fltDateEnd"
29 + type="date"
30 + placeholder="选择日期"
31 + >
32 + </el-date-picker>
33 + </el-form-item>
34 + </el-col>
35 + <el-col :span="6">
36 + <el-form-item label="航班号">
37 + <el-input
38 + type="textarea"
39 + v-model="fltNo"
40 + clearable
41 + class="formItem"
42 + placeholder="AC001;AC002"
43 + rows="1"
44 + >
45 + </el-input>
46 + </el-form-item>
47 + </el-col>
48 + <el-col :span="6">
49 + <el-form-item label="运单号">
50 + <el-input
51 + clearable
52 + type="textarea"
53 + v-model="queryParams.waybillNo"
54 + class="formItem"
55 + placeholder="请输入运单号(回车间隔)"
56 + rows="1"
57 + ></el-input>
58 + </el-form-item>
59 + </el-col>
60 + <el-col :span="6">
61 + <el-form-item label="站点">
62 + <el-input
63 + type="textarea"
64 + v-model="siteName"
65 + class="formItem"
66 + placeholder="PVG;PEK"
67 + clearable
68 + rows="1"
69 + >
70 + </el-input>
71 + </el-form-item>
72 + </el-col>
73 + <el-col :span="6">
74 + <el-form-item label="URSA">
75 + <el-input
76 + clearable
77 + type="textarea"
78 + v-model="ursa"
79 + class="formItem"
80 + placeholder="S_;P_;E2"
81 + rows="1"
82 + >
83 + </el-input>
84 + </el-form-item>
85 + </el-col>
86 + <el-col :span="24">
87 + <el-switch
88 + v-model="queryParams.reExport"
89 + active-color="#13ce66"
90 + active-text="重新导出"
91 + style="padding-left: 35px"
92 + >
93 + </el-switch>
94 + </el-col>
95 + </el-row>
96 + <div style="margin-top: 25px">
97 + <el-button
98 + type="primary"
99 + icon="el-icon-search"
100 + size="mini"
101 + @click="handleQuery"
102 + >搜索</el-button
103 + >
104 + <el-button
105 + type="warning"
106 + :disabled="tableData.length == 0"
107 + @click="xlse()"
108 + :loading="downLoadingTip.downloading"
109 + icon="el-icon-download"
110 + size="mini"
111 + >{{
112 + downLoadingTip.downloading ? downLoadingTip.tip : "导出"
113 + }}</el-button
114 + >
115 + </div>
116 + </el-form>
117 +
118 + <el-table
119 + max-height="500"
120 + highlight-current-row
121 + border
122 + stripe
123 + v-loading="loading"
124 + :data="tableData"
125 + >
126 + <el-table-column
127 + label="运单号"
128 + align="center"
129 + prop="waybillNo"
130 + width="150"
131 + />
132 + <el-table-column
133 + :show-overflow-tooltip="true"
134 + label="品牌描述"
135 + align="center"
136 + prop="nameDescription"
137 + width="150"
138 + />
139 + <el-table-column
140 + label="航班日期"
141 + align="center"
142 + prop="fltDate"
143 + width="150"
144 + />
145 + <el-table-column label="航班号" align="center" prop="fltNo" />
146 + <el-table-column
147 + label="航班路线"
148 + align="center"
149 + prop="route"
150 + width="150"
151 + />
152 + <el-table-column
153 + label="配置航班类型"
154 + align="center"
155 + prop="kindName"
156 + width="130"
157 + />
158 + <el-table-column label="尺寸" align="center" prop="sizeStr" />
159 + <el-table-column label="件数" align="center" prop="qty" />
160 + <el-table-column label="实际重量" align="center" prop="actualWeight" />
161 + <el-table-column
162 + label="创建时间"
163 + align="center"
164 + prop="createTime"
165 + width="180"
166 + />
167 + </el-table>
168 + <pagination
169 + v-show="total > 0"
170 + :total="total"
171 + layout=" prev, pager, next, jumper, sizes,total"
172 + :page.sync="queryParams.pageNum"
173 + :limit.sync="queryParams.limitSize"
174 + @pagination="findAllFltData"
175 + />
176 + </div>
177 +</template>
178 +
179 +<script>
180 +import { findCagroPreData } from "@/api/cargoSelect";
181 +import { cargoXlsxPre } from "@/utils/zipdownload";
182 +export default {
183 + name: "CAPreQualificationExport",
184 + data() {
185 + return {
186 + //导出
187 + downLoadingTip: {
188 + tip: "",
189 + downloading: false,
190 + },
191 + tableData: [], //表格数据
192 + // 遮罩层
193 + loading: false,
194 + // 弹出层标题
195 + title: "",
196 + // 总条数
197 + total: 0,
198 + // 原航班规则数据
199 + findAllFltDatList: [],
200 + // 新增修改查看规则弹出层
201 + open: false,
202 + // 查询参数
203 + queryParams: {
204 + limitStart: 0, //当前条数【代表第几条数据 +1开始】
205 + pageNum: 1,
206 + limitSize: 20, //一页显示多少条数据
207 + fltDateStart: undefined, //航班日期开始
208 + fltDateEnd: undefined, //航班日期结束
209 + reExport: false,
210 + //航班号
211 + fltNo: null,
212 + //运单号
213 + waybillNo: "",
214 + //站点
215 + siteName: "",
216 + //ursa
217 + ursa: "",
218 + },
219 + // 表单校验
220 + rules: {},
221 + };
222 + },
223 + created() {},
224 + methods: {
225 + // 导出表格
226 + xlse() {
227 + this.downLoadingTip.downloading = true;
228 + this.downLoadingTip.tip = "正在导出结果集请耐心等待";
229 + let cargoXlse = { title: "航班预审表", cargoExportPreQueryDto: {} };
230 + cargoXlse.cargoExportPreQueryDto = JSON.parse(
231 + JSON.stringify(this.queryParams)
232 + );
233 + cargoXlse.cargoExportPreQueryDto.limitStart = 0;
234 + cargoXlse.cargoExportPreQueryDto.limitSize = -1;
235 + cargoXlsxPre("/cargo/excelPre", cargoXlse)
236 + .then(() => {
237 + this.downLoadingTip.downloading = false;
238 + this.downLoadingTip.tip = "";
239 + this.progress = 100;
240 + })
241 + .catch(() => {
242 + this.downLoadingTip.downloading = false;
243 + this.downLoadingTip.tip = "";
244 + });
245 + },
246 +
247 + /** 搜索按钮操作 */
248 + handleQuery() {
249 + this.queryParams.pageNum = 1;
250 + this.queryParams.start = 0;
251 + this.findAllFltData();
252 + },
253 + /** 预审信息查寻*/
254 + findAllFltData() {
255 + this.loading = true;
256 + if (this.queryParams.pageNum > 1) {
257 + this.queryParams.limitStart =
258 + (this.queryParams.pageNum - 1) * this.queryParams.limitSize;
259 + } else {
260 + this.queryParams.limitStart = 0;
261 + }
262 + findCagroPreData(this.queryParams).then((response) => {
263 + if (response.code == 200) {
264 + this.tableData = response.data.list;
265 + this.total = response.data.totalCount;
266 + this.loading = false;
267 + } else {
268 + this.msgError(response.msg);
269 + }
270 + });
271 + },
272 + },
273 + computed: {
274 + fltNo: {
275 + get: function () {
276 + return this.queryParams.fltNo;
277 + },
278 + set: function (val) {
279 + this.queryParams.fltNo = val.toUpperCase();
280 + },
281 + },
282 + siteName: {
283 + get: function () {
284 + return this.queryParams.siteName;
285 + },
286 + set: function (val) {
287 + this.queryParams.siteName = val.toUpperCase();
288 + },
289 + },
290 + ursa: {
291 + get: function () {
292 + return this.queryParams.ursa;
293 + },
294 + set: function (val) {
295 + this.queryParams.ursa = val.toUpperCase();
296 + },
297 + },
298 + },
299 +};
300 +</script>
301 +
302 +<style scoped>
303 +.tips {
304 + float: right;
305 + color: #606266;
306 + font-size: 14px;
307 + margin-right: 40px;
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: #1890ff">以下为所提交的数据或出错信息</span>
17 + </div>
18 + <el-table ref="filterTable" :data="tableData" v-loading="loading" 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 +
40 +<script>
41 + import {
42 + downLoadTemplate,
43 + importcaPreReview,
44 + } from "@/api/caPreReviewImport";
45 + export default {
46 + name:"CAPreReviewImport",
47 + data() {
48 + return {
49 + // 遮罩层
50 + loading: false,
51 + flightType: [],
52 + form: {
53 + type: "",
54 + region: "",
55 + },
56 + fileList: [],
57 + tableData: [],
58 + };
59 + },
60 + methods: {
61 + downloadTempleate() {
62 +
63 + let fileName = "航班预审导入模板.xlsx";
64 + downLoadTemplate().then((res) => {
65 + if (res) {
66 + const blob = new Blob([res]);
67 + const link = document.createElement("a"); //创建a标签
68 + link.download = fileName; //a标签添加属性
69 + link.style.display = "none";
70 + link.href = URL.createObjectURL(blob);
71 + document.body.appendChild(link);
72 + link.click(); //执行下载
73 + URL.revokeObjectURL(link.href); //释放url
74 + document.body.removeChild(link); //释放标签
75 + } else {
76 + this.$message.error("下载失败");
77 + }
78 + });
79 +
80 + },
81 + uploadExcel(option) {
82 + //上传excel
83 + const file = option.file;
84 + this.loading=true;
85 + importcaPreReview(file, this.form.type).then((res) => {
86 + this.loading=false;
87 + if (res.code != 200) {
88 + if (res.code == 603) {
89 + this.$alert(res.msg, "提示", {
90 + confirmButtonText: "确定",
91 + type: "warning",
92 + });
93 + } else {
94 + this.$message.error(res.msg);
95 + this.tableData = res.data;
96 + }
97 + } else {
98 + this.$message.success(res.msg);
99 + this.tableData = res.data;
100 + }
101 + });
102 + },
103 + handleRemove(file, fileList) {
104 + //清掉上传的文件
105 + this.tableData = [];
106 + this.fileList = [];
107 + },
108 + handleExceed(files) {
109 + //重复上传文件
110 + let file = {};
111 + file.file = files[0];
112 + file.name = files[0].name;
113 + this.fileList = [];
114 + this.fileList.push(file);
115 + this.uploadExcel(file);
116 + },
117 + },
118 + created() {
119 +
120 + },
121 + };
122 +</script>
123 +<style rel="stylesheet/scss" lang="scss">
124 + .upload-demo {
125 + float: right;
126 + }
127 +
128 + .el-upload-list {
129 + display: inline-block;
130 + margin-left: 10px;
131 + vertical-align: top;
132 + }
133 +</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 label="航班种类">
5 + <el-select v-model="form.type" placeholder="航班种类">
6 + <el-option
7 + v-for="item in flightType"
8 + :key="item.id"
9 + :label="item.englishName"
10 + :value="item.code"
11 + >{{ item.englishName }}</el-option
12 + >
13 + </el-select>
14 + </el-form-item>
15 + <el-form-item>
16 + <el-upload
17 + action="/flightInfoImport/importFlight"
18 + name="file"
19 + :http-request="uploadExcel"
20 + :on-remove="handleRemove"
21 + :limit="1"
22 + :on-exceed="handleExceed"
23 + :file-list="fileList"
24 + accept=".xlsx"
25 + class="upload-demo"
26 + >
27 + <el-button type="primary">点击上传</el-button>
28 + </el-upload>
29 + </el-form-item>
30 + <el-form-item>
31 + <el-button type="primary" @click="downloadTempleate"
32 + >下载模板</el-button
33 + >
34 + </el-form-item>
35 + </el-form>
36 + <div style="font-size: 12px; font-weight: 700">
37 + 提示:<span style="color: #1890ff">以下为所提交的数据或出错信息</span>
38 + </div>
39 + <el-table
40 + ref="filterTable"
41 + :data="tableData"
42 + style="width: 100%; margin-top: 20px"
43 + size="small"
44 + border
45 + >
46 + <el-table-column label="行号" prop="line" fixed width="50" align="center">
47 + </el-table-column>
48 + <el-table-column label="错误信息" prop="errorMessage" fixed width="200">
49 + <template slot-scope="scope">
50 + <div v-for="(m, key) in scope.row.errorMessage" :key="key">
51 + {{ m }}
52 + </div>
53 + </template>
54 + </el-table-column>
55 + <el-table-column v-if="tableData.length == 0"></el-table-column>
56 + <el-table-column
57 + v-for="(value, key) in this.tableData[0]"
58 + :key="key"
59 + v-if="key != 'errorMessage' && key != 'line'"
60 + :label="key"
61 + :prop="key"
62 + width="120"
63 + ></el-table-column>
64 + </el-table>
65 + </div>
66 +</template>
67 +
68 +<script>
69 +import {
70 + filghtKindData,
71 + downLoadTemplate,
72 + importFlight,
73 +} from "@/api/flightInfoImport";
74 +export default {
75 + name: "FlightInformationImport",
76 + data() {
77 + return {
78 + flightType: [],
79 + form: {
80 + type: "",
81 + region: "",
82 + },
83 + fileList: [],
84 + tableData: [],
85 + };
86 + },
87 + methods: {
88 + downloadTempleate() {
89 + let downloadType = "";
90 + let fileName = "";
91 + switch (this.form.type) {
92 + case "flightKind20":
93 + downloadType = "whiteTail";
94 + fileName = "航班信息导入模板WhiteTail.xlsx";
95 + break;
96 + case "flightKind30":
97 + downloadType = "purpleTail";
98 + fileName = "航班信息导入模板PurpleTail.xlsx";
99 + break;
100 + default:
101 + this.$confirm("此类航班暂无模板,请选择其他类型航班", "提示", {
102 + confirmButtonText: "确定",
103 + showCancelButton: false,
104 + type: "warning",
105 + });
106 + }
107 + if (downloadType != "") {
108 + downLoadTemplate(downloadType).then((res) => {
109 + if (res) {
110 + const blob = new Blob([res]);
111 + const link = document.createElement("a"); //创建a标签
112 + link.download = fileName; //a标签添加属性
113 + link.style.display = "none";
114 + link.href = URL.createObjectURL(blob);
115 + document.body.appendChild(link);
116 + link.click(); //执行下载
117 + URL.revokeObjectURL(link.href); //释放url
118 + document.body.removeChild(link); //释放标签
119 + } else {
120 + this.$message.error("下载失败");
121 + }
122 + });
123 + }
124 + },
125 + uploadExcel(option) {
126 + //上传excel
127 + const file = option.file;
128 + importFlight(file, this.form.type).then((res) => {
129 + if (res.code != 200) {
130 + if (res.code == 603) {
131 + this.$alert(res.msg, "提示", {
132 + confirmButtonText: "确定",
133 + type: "warning",
134 + });
135 + } else {
136 + this.$message.error(res.msg);
137 + this.tableData = res.data;
138 + }
139 + } else {
140 + this.$message.success("导入成功");
141 + this.tableData = res.data;
142 + }
143 + });
144 + },
145 + handleRemove(file, fileList) {
146 + //清掉上传的文件
147 + this.tableData = [];
148 + this.fileList = [];
149 + },
150 + handleExceed(files) {
151 + //重复上传文件
152 + let file = {};
153 + file.file = files[0];
154 + file.name = files[0].name;
155 + this.fileList = [];
156 + this.fileList.push(file);
157 + this.uploadExcel(file);
158 + },
159 + },
160 + created() {
161 + filghtKindData().then((response) => {
162 + if (response.code != 200) {
163 + this.$message({
164 + message: response.msg,
165 + type: "error",
166 + });
167 + }
168 + this.flightType = response.data;
169 + this.form.type = response.data[0].code;
170 + });
171 + },
172 +};
173 +</script>
174 +
175 +<style rel="stylesheet/scss" lang="scss">
176 +.upload-demo {
177 + float: right;
178 +}
179 +.el-upload-list {
180 + display: inline-block;
181 + margin-left: 10px;
182 + vertical-align: top;
183 +}
184 +</style>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.