Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
imac-vue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
shanyunduo.cheng
2021-12-02 14:11:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3c7b830b051d0560b9fab432b1fa2d3e27557ecc
3c7b830b
1 parent
a71ab7ba
添加和修改
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
32 deletions
src/api/destinationFlight.js
src/router/index.js
src/views/allocationConfig/flightAllocConfig/index.vue
src/views/allocationConfig/flightAllocConfig/info.vue
src/api/destinationFlight.js
View file @
3c7b830
...
...
@@ -23,6 +23,22 @@ export function findByFlightId(id) {
})
}
export
function
updateOrAddFlight
(
form
){
//处理数据
form
.
typeOfGoods
=
form
.
typeOfGoods
.
join
(
';'
);
form
.
declarationCategory
=
form
.
declarationCategory
.
join
(
';'
);
form
.
serviceCode
=
form
.
serviceCode
.
join
(
';'
);
form
.
subCategory
=
form
.
subCategory
.
join
(
';'
);
return
request
({
url
:
'/destinationFlight/updateOrAddFlight'
,
method
:
'post'
,
data
:
form
})
}
//申报类别
export
function
cargoTypeData
(){
return
request
({
...
...
src/router/index.js
View file @
3c7b830
...
...
@@ -89,8 +89,14 @@ export const constantRoutes = [
{
path
:
'/flightAllocConfig/:handle/:id'
,
component
:
(
resolve
)
=>
require
([
'@/views/allocationConfig/flightAllocConfig/info'
],
resolve
),
name
:
'info'
,
meta
:
{
title
:
'目的航班信息'
,
icon
:
'user'
}
name
:
'Info'
,
meta
:
{
title
:
'航班配舱'
,
icon
:
'user'
}
},
{
path
:
'/flightAllocConfig/:handle'
,
component
:
(
resolve
)
=>
require
([
'@/views/allocationConfig/flightAllocConfig/info'
],
resolve
),
name
:
'Add'
,
meta
:
{
title
:
'添加航班配舱'
,
icon
:
'user'
}
}
]
}
...
...
src/views/allocationConfig/flightAllocConfig/index.vue
View file @
3c7b830
...
...
@@ -8,13 +8,23 @@
<el-button type="primary" icon="el-icon-search" @click="getList" size="mini">查询</el-button>
</el-form-item>
</el-form>
<el-button style="margin-bottom:20px" type="primary" icon="el-icon-plus" size="mini">添加</el-button>
<el-button style="margin-bottom:20px" type="primary" icon="el-icon-plus" size="mini"
@click="$router.push({ name: 'Add', params: {handle: 'add'}});"
>添加</el-button>
<el-table
:data="flyList"
style="width: 800px"
v-loading="loading" size="small"
>
<el-table-column prop="purposeOfFlightNo" label="航班号" align="center"></el-table-column>
<el-table-column prop="status" label="状态" align="center">
<template slot-scope="scope">
<span v-if="scope.row.status==='0'">无效</span>
<span v-if="scope.row.status==='1'">有效</span>
<span v-if="scope.row.status==='2'">配置中</span>
<span v-if="scope.row.status==='3'">停用</span>
</template>
</el-table-column>
<el-table-column label="操作" prop="id" align="center">
<template slot-scope="scope" >
<el-button type="text" size="mini" icon="el-icon-view" @click="handleClick(scope.row.id, 'detail')">查看</el-button>
...
...
@@ -77,7 +87,7 @@
},
//跳转到查看,修改页面
handleClick(flightiId, handle){
this.$router.push({ name: '
i
nfo', params: { handle: handle, id:flightiId }});
this.$router.push({ name: '
I
nfo', params: { handle: handle, id:flightiId }});
},
//删除,启用,停用
changeStatus(id, handle){
...
...
src/views/allocationConfig/flightAllocConfig/info.vue
View file @
3c7b830
<template>
<div style="margin: 40px">
<el-form ref="form" :model="form" label-width="200px" size="small" :disabled="disable">
<el-form
ref="form"
:model="form"
label-width="200px"
size="small"
:disabled="disable"
>
<el-form-item label="航班号">
<el-input
v-model="form.purposeOfFlightNo"
...
...
@@ -76,39 +82,70 @@
<el-form-item label="申报类别">
<el-checkbox-group v-model="form.typeOfGoods">
<el-checkbox v-for="item in cargoType" :key="item.id" :label="item.chineseName" :name="item.chineseName"></el-checkbox>
<el-checkbox
v-for="item in cargoType"
:key="item.id"
:label="item.chineseName"
:name="item.chineseName"
></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="货物类型">
<el-checkbox-group v-model="form.declarationCategory">
<el-checkbox v-for="item in cargoStatus" :key="item.id" :label="item.chineseName" :name="item.chineseName"></el-checkbox>
<el-checkbox
v-for="item in cargoStatus"
:key="item.id"
:label="item.chineseName"
:name="item.chineseName"
></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="Service Code">
<el-checkbox-group v-model="form.serviceCode">
<el-checkbox v-for="item in serviceCode" :key="item.id" :label="item.englishName" :name="item.englishName"></el-checkbox>
<el-checkbox
v-for="item in serviceCode"
:key="item.id"
:label="item.englishName"
:name="item.englishName"
></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="Sub Category">
<el-checkbox-group v-model="form.subCategory">
<el-checkbox v-for="item in subCategory" :key="item.id" :label="item.englishName" :name="item.englishName"></el-checkbox>
<el-checkbox
v-for="item in subCategory"
:key="item.id"
:label="item.englishName"
:name="item.englishName"
></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item>
<el-button type="primary" v-if="$route.params.handle === 'add'" @click="onSubmit">添加</el-button>
<el-button type="primary" v-if="$route.params.handle === 'update'" @click="onSubmit">保存</el-button>
<el-button @click="close">取消</el-button>
</el-form-item>
</el-form>
<el-row style="margin-left: 200px">
<el-button
type="primary"
size="small"
v-if="$route.params.handle != 'detail'"
@click="submit"
:loading="btnLoading"
>
<span v-if="$route.params.handle === 'add'">添加</span>
<span v-else>保存</span>
</el-button>
<el-button size="small" @click="close">取消</el-button>
</el-row>
</div>
</template>
<script>
import { findByFlightId, cargoTypeData, cargoStatusData, serviceCodeData, subCategoryData, allDictData } from "@/api/destinationFlight";
import {
findByFlightId,
updateOrAddFlight,
allDictData,
} from "@/api/destinationFlight";
export default {
data() {
...
...
@@ -119,28 +156,63 @@ export default {
serviceCode: [],
subCategory: [],
},
cargoType:[],
cargoStatus:[],
serviceCode:[],
subCategory:[],
disable:false,
typeOfGoods: [],
declarationCategory: [],
formServiceCode: [],
formSubCategory: [],
cargoType: [],
cargoStatus: [],
serviceCode: [],
subCategory: [],
disable: false,
btnLoading: false,
};
},
methods: {
onSubmit() {
console.log("submit!");
},
close(){
submit() {
this.btnLoading = true;
let handle = this.$route.params.handle;
if (handle === "update") {
//修改,获取id
this.form.id = this.$route.params.id;
}
//调用接口
this.typeOfGoods = this.form.typeOfGoods;
this.declarationCategory = this.form.declarationCategory;
this.formServiceCode = this.form.serviceCode;
this.formSubCategory = this.form.subCategory;
updateOrAddFlight(this.form).then((response) => {
if (response.code === 200){
this.$message({
message: '成功',
type: 'success'
});
}
this.btnLoading = false;
});
this.form.typeOfGoods = this.typeOfGoods;
this.form.declarationCategory = this.declarationCategory;
this.form.serviceCode = this.formServiceCode;
this.form.subCategory = this.formSubCategory;
},
close() {
this.$store.state.tagsView.visitedViews.splice(
this.$store.state.tagsView.visitedViews.findIndex(
(item) => item.path === this.$route.path
),
1
);
this.$router.push(
this.$store.state.tagsView.visitedViews[
this.$store.state.tagsView.visitedViews.length - 1
].path
);
},
},
created() {
let id = this.$route.params.id;
let handle = this.$route.params.handle;
console.log(handle);
if (handle === "detail"){
this.disable = true;
}
allDictData().then((response) => {
let dict = response.data;
...
...
@@ -148,18 +220,26 @@ export default {
this.cargoStatus = dict.cargoStatus;
this.serviceCode = dict.serviceCode;
this.subCategory = dict.subCategory;
})
});
if (handle === "detail") {
this.disable = true;
}
if (handle != "add") {
let id = this.$route.params.id;
//货物信息
findByFlightId(id).then((response) => {
let info = response.data.list;
info.typeOfGoods = info.typeOfGoods ? info.typeOfGoods.split(";") : [];
info.declarationCategory = info.declarationCategory ? info.declarationCategory.split(";") : [];
info.declarationCategory = info.declarationCategory
? info.declarationCategory.split(";")
: [];
info.serviceCode = info.serviceCode ? info.serviceCode.split(";") : [];
info.subCategory = info.subCategory ? info.subCategory.split(";") : [];
this.form = info;
});
}
},
};
</script>
...
...
Please
register
or
login
to post a comment