Showing
4 changed files
with
144 additions
and
32 deletions
| ... | @@ -23,6 +23,22 @@ export function findByFlightId(id) { | ... | @@ -23,6 +23,22 @@ export function findByFlightId(id) { |
| 23 | }) | 23 | }) |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | +export function updateOrAddFlight(form){ | ||
| 27 | + //处理数据 | ||
| 28 | + form.typeOfGoods = form.typeOfGoods.join(';'); | ||
| 29 | + form.declarationCategory = form.declarationCategory.join(';'); | ||
| 30 | + form.serviceCode = form.serviceCode.join(';'); | ||
| 31 | + form.subCategory = form.subCategory.join(';'); | ||
| 32 | + | ||
| 33 | + return request({ | ||
| 34 | + url:'/destinationFlight/updateOrAddFlight', | ||
| 35 | + method: 'post', | ||
| 36 | + data:form | ||
| 37 | + }) | ||
| 38 | + | ||
| 39 | + | ||
| 40 | +} | ||
| 41 | + | ||
| 26 | //申报类别 | 42 | //申报类别 |
| 27 | export function cargoTypeData(){ | 43 | export function cargoTypeData(){ |
| 28 | return request({ | 44 | return request({ | ... | ... |
| ... | @@ -89,8 +89,14 @@ export const constantRoutes = [ | ... | @@ -89,8 +89,14 @@ export const constantRoutes = [ |
| 89 | { | 89 | { |
| 90 | path: '/flightAllocConfig/:handle/:id', | 90 | path: '/flightAllocConfig/:handle/:id', |
| 91 | component: (resolve) => require(['@/views/allocationConfig/flightAllocConfig/info'], resolve), | 91 | component: (resolve) => require(['@/views/allocationConfig/flightAllocConfig/info'], resolve), |
| 92 | - name: 'info', | 92 | + name: 'Info', |
| 93 | - meta: { title: '目的航班信息', icon: 'user' } | 93 | + meta: { title: '航班配舱', icon: 'user' } |
| 94 | + }, | ||
| 95 | + { | ||
| 96 | + path: '/flightAllocConfig/:handle', | ||
| 97 | + component: (resolve) => require(['@/views/allocationConfig/flightAllocConfig/info'], resolve), | ||
| 98 | + name: 'Add', | ||
| 99 | + meta: { title: '添加航班配舱', icon: 'user' } | ||
| 94 | } | 100 | } |
| 95 | ] | 101 | ] |
| 96 | } | 102 | } | ... | ... |
| ... | @@ -8,13 +8,23 @@ | ... | @@ -8,13 +8,23 @@ |
| 8 | <el-button type="primary" icon="el-icon-search" @click="getList" size="mini">查询</el-button> | 8 | <el-button type="primary" icon="el-icon-search" @click="getList" size="mini">查询</el-button> |
| 9 | </el-form-item> | 9 | </el-form-item> |
| 10 | </el-form> | 10 | </el-form> |
| 11 | - <el-button style="margin-bottom:20px" type="primary" icon="el-icon-plus" size="mini">添加</el-button> | 11 | + <el-button style="margin-bottom:20px" type="primary" icon="el-icon-plus" size="mini" @click="$router.push({ name: 'Add', params: {handle: 'add'}});">添加</el-button> |
| 12 | <el-table | 12 | <el-table |
| 13 | :data="flyList" | 13 | :data="flyList" |
| 14 | style="width: 800px" | 14 | style="width: 800px" |
| 15 | v-loading="loading" size="small" | 15 | v-loading="loading" size="small" |
| 16 | > | 16 | > |
| 17 | <el-table-column prop="purposeOfFlightNo" label="航班号" align="center"></el-table-column> | 17 | <el-table-column prop="purposeOfFlightNo" label="航班号" align="center"></el-table-column> |
| 18 | + | ||
| 19 | + <el-table-column prop="status" label="状态" align="center"> | ||
| 20 | + <template slot-scope="scope"> | ||
| 21 | + <span v-if="scope.row.status==='0'">无效</span> | ||
| 22 | + <span v-if="scope.row.status==='1'">有效</span> | ||
| 23 | + <span v-if="scope.row.status==='2'">配置中</span> | ||
| 24 | + <span v-if="scope.row.status==='3'">停用</span> | ||
| 25 | + </template> | ||
| 26 | + </el-table-column> | ||
| 27 | + | ||
| 18 | <el-table-column label="操作" prop="id" align="center"> | 28 | <el-table-column label="操作" prop="id" align="center"> |
| 19 | <template slot-scope="scope" > | 29 | <template slot-scope="scope" > |
| 20 | <el-button type="text" size="mini" icon="el-icon-view" @click="handleClick(scope.row.id, 'detail')">查看</el-button> | 30 | <el-button type="text" size="mini" icon="el-icon-view" @click="handleClick(scope.row.id, 'detail')">查看</el-button> |
| ... | @@ -77,7 +87,7 @@ | ... | @@ -77,7 +87,7 @@ |
| 77 | }, | 87 | }, |
| 78 | //跳转到查看,修改页面 | 88 | //跳转到查看,修改页面 |
| 79 | handleClick(flightiId, handle){ | 89 | handleClick(flightiId, handle){ |
| 80 | - this.$router.push({ name: 'info', params: { handle: handle, id:flightiId }}); | 90 | + this.$router.push({ name: 'Info', params: { handle: handle, id:flightiId }}); |
| 81 | }, | 91 | }, |
| 82 | //删除,启用,停用 | 92 | //删除,启用,停用 |
| 83 | changeStatus(id, handle){ | 93 | changeStatus(id, handle){ | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <div style="margin: 40px"> | 2 | <div style="margin: 40px"> |
| 3 | - <el-form ref="form" :model="form" label-width="200px" size="small" :disabled="disable"> | 3 | + <el-form |
| 4 | + ref="form" | ||
| 5 | + :model="form" | ||
| 6 | + label-width="200px" | ||
| 7 | + size="small" | ||
| 8 | + :disabled="disable" | ||
| 9 | + > | ||
| 4 | <el-form-item label="航班号"> | 10 | <el-form-item label="航班号"> |
| 5 | <el-input | 11 | <el-input |
| 6 | v-model="form.purposeOfFlightNo" | 12 | v-model="form.purposeOfFlightNo" |
| ... | @@ -76,39 +82,70 @@ | ... | @@ -76,39 +82,70 @@ |
| 76 | 82 | ||
| 77 | <el-form-item label="申报类别"> | 83 | <el-form-item label="申报类别"> |
| 78 | <el-checkbox-group v-model="form.typeOfGoods"> | 84 | <el-checkbox-group v-model="form.typeOfGoods"> |
| 79 | - <el-checkbox v-for="item in cargoType" :key="item.id" :label="item.chineseName" :name="item.chineseName"></el-checkbox> | 85 | + <el-checkbox |
| 86 | + v-for="item in cargoType" | ||
| 87 | + :key="item.id" | ||
| 88 | + :label="item.chineseName" | ||
| 89 | + :name="item.chineseName" | ||
| 90 | + ></el-checkbox> | ||
| 80 | </el-checkbox-group> | 91 | </el-checkbox-group> |
| 81 | </el-form-item> | 92 | </el-form-item> |
| 82 | 93 | ||
| 83 | <el-form-item label="货物类型"> | 94 | <el-form-item label="货物类型"> |
| 84 | <el-checkbox-group v-model="form.declarationCategory"> | 95 | <el-checkbox-group v-model="form.declarationCategory"> |
| 85 | - <el-checkbox v-for="item in cargoStatus" :key="item.id" :label="item.chineseName" :name="item.chineseName"></el-checkbox> | 96 | + <el-checkbox |
| 97 | + v-for="item in cargoStatus" | ||
| 98 | + :key="item.id" | ||
| 99 | + :label="item.chineseName" | ||
| 100 | + :name="item.chineseName" | ||
| 101 | + ></el-checkbox> | ||
| 86 | </el-checkbox-group> | 102 | </el-checkbox-group> |
| 87 | </el-form-item> | 103 | </el-form-item> |
| 88 | 104 | ||
| 89 | <el-form-item label="Service Code"> | 105 | <el-form-item label="Service Code"> |
| 90 | <el-checkbox-group v-model="form.serviceCode"> | 106 | <el-checkbox-group v-model="form.serviceCode"> |
| 91 | - <el-checkbox v-for="item in serviceCode" :key="item.id" :label="item.englishName" :name="item.englishName"></el-checkbox> | 107 | + <el-checkbox |
| 108 | + v-for="item in serviceCode" | ||
| 109 | + :key="item.id" | ||
| 110 | + :label="item.englishName" | ||
| 111 | + :name="item.englishName" | ||
| 112 | + ></el-checkbox> | ||
| 92 | </el-checkbox-group> | 113 | </el-checkbox-group> |
| 93 | </el-form-item> | 114 | </el-form-item> |
| 94 | 115 | ||
| 95 | <el-form-item label="Sub Category"> | 116 | <el-form-item label="Sub Category"> |
| 96 | <el-checkbox-group v-model="form.subCategory"> | 117 | <el-checkbox-group v-model="form.subCategory"> |
| 97 | - <el-checkbox v-for="item in subCategory" :key="item.id" :label="item.englishName" :name="item.englishName"></el-checkbox> | 118 | + <el-checkbox |
| 119 | + v-for="item in subCategory" | ||
| 120 | + :key="item.id" | ||
| 121 | + :label="item.englishName" | ||
| 122 | + :name="item.englishName" | ||
| 123 | + ></el-checkbox> | ||
| 98 | </el-checkbox-group> | 124 | </el-checkbox-group> |
| 99 | </el-form-item> | 125 | </el-form-item> |
| 100 | - | ||
| 101 | - <el-form-item> | ||
| 102 | - <el-button type="primary" v-if="$route.params.handle === 'add'" @click="onSubmit">添加</el-button> | ||
| 103 | - <el-button type="primary" v-if="$route.params.handle === 'update'" @click="onSubmit">保存</el-button> | ||
| 104 | - <el-button @click="close">取消</el-button> | ||
| 105 | - </el-form-item> | ||
| 106 | </el-form> | 126 | </el-form> |
| 127 | + <el-row style="margin-left: 200px"> | ||
| 128 | + <el-button | ||
| 129 | + type="primary" | ||
| 130 | + size="small" | ||
| 131 | + v-if="$route.params.handle != 'detail'" | ||
| 132 | + @click="submit" | ||
| 133 | + :loading="btnLoading" | ||
| 134 | + > | ||
| 135 | + <span v-if="$route.params.handle === 'add'">添加</span> | ||
| 136 | + <span v-else>保存</span> | ||
| 137 | + </el-button> | ||
| 138 | + <el-button size="small" @click="close">取消</el-button> | ||
| 139 | + </el-row> | ||
| 107 | </div> | 140 | </div> |
| 108 | </template> | 141 | </template> |
| 109 | 142 | ||
| 110 | <script> | 143 | <script> |
| 111 | -import { findByFlightId, cargoTypeData, cargoStatusData, serviceCodeData, subCategoryData, allDictData } from "@/api/destinationFlight"; | 144 | +import { |
| 145 | + findByFlightId, | ||
| 146 | + updateOrAddFlight, | ||
| 147 | + allDictData, | ||
| 148 | +} from "@/api/destinationFlight"; | ||
| 112 | 149 | ||
| 113 | export default { | 150 | export default { |
| 114 | data() { | 151 | data() { |
| ... | @@ -119,28 +156,63 @@ export default { | ... | @@ -119,28 +156,63 @@ export default { |
| 119 | serviceCode: [], | 156 | serviceCode: [], |
| 120 | subCategory: [], | 157 | subCategory: [], |
| 121 | }, | 158 | }, |
| 122 | - cargoType:[], | 159 | + typeOfGoods: [], |
| 123 | - cargoStatus:[], | 160 | + declarationCategory: [], |
| 124 | - serviceCode:[], | 161 | + formServiceCode: [], |
| 125 | - subCategory:[], | 162 | + formSubCategory: [], |
| 126 | - disable:false, | 163 | + cargoType: [], |
| 164 | + cargoStatus: [], | ||
| 165 | + serviceCode: [], | ||
| 166 | + subCategory: [], | ||
| 167 | + disable: false, | ||
| 168 | + btnLoading: false, | ||
| 127 | }; | 169 | }; |
| 128 | }, | 170 | }, |
| 129 | methods: { | 171 | methods: { |
| 130 | - onSubmit() { | 172 | + submit() { |
| 131 | - console.log("submit!"); | 173 | + this.btnLoading = true; |
| 132 | - }, | 174 | + let handle = this.$route.params.handle; |
| 133 | - close(){ | 175 | + if (handle === "update") { |
| 176 | + //修改,获取id | ||
| 177 | + this.form.id = this.$route.params.id; | ||
| 178 | + } | ||
| 134 | 179 | ||
| 180 | + //调用接口 | ||
| 181 | + this.typeOfGoods = this.form.typeOfGoods; | ||
| 182 | + this.declarationCategory = this.form.declarationCategory; | ||
| 183 | + this.formServiceCode = this.form.serviceCode; | ||
| 184 | + this.formSubCategory = this.form.subCategory; | ||
| 185 | + updateOrAddFlight(this.form).then((response) => { | ||
| 186 | + if (response.code === 200){ | ||
| 187 | + this.$message({ | ||
| 188 | + message: '成功', | ||
| 189 | + type: 'success' | ||
| 190 | + }); | ||
| 135 | } | 191 | } |
| 192 | + this.btnLoading = false; | ||
| 193 | + }); | ||
| 194 | + this.form.typeOfGoods = this.typeOfGoods; | ||
| 195 | + this.form.declarationCategory = this.declarationCategory; | ||
| 196 | + this.form.serviceCode = this.formServiceCode; | ||
| 197 | + this.form.subCategory = this.formSubCategory; | ||
| 198 | + | ||
| 199 | + }, | ||
| 200 | + close() { | ||
| 201 | + this.$store.state.tagsView.visitedViews.splice( | ||
| 202 | + this.$store.state.tagsView.visitedViews.findIndex( | ||
| 203 | + (item) => item.path === this.$route.path | ||
| 204 | + ), | ||
| 205 | + 1 | ||
| 206 | + ); | ||
| 207 | + this.$router.push( | ||
| 208 | + this.$store.state.tagsView.visitedViews[ | ||
| 209 | + this.$store.state.tagsView.visitedViews.length - 1 | ||
| 210 | + ].path | ||
| 211 | + ); | ||
| 212 | + }, | ||
| 136 | }, | 213 | }, |
| 137 | created() { | 214 | created() { |
| 138 | - let id = this.$route.params.id; | ||
| 139 | let handle = this.$route.params.handle; | 215 | let handle = this.$route.params.handle; |
| 140 | - console.log(handle); | ||
| 141 | - if (handle === "detail"){ | ||
| 142 | - this.disable = true; | ||
| 143 | - } | ||
| 144 | 216 | ||
| 145 | allDictData().then((response) => { | 217 | allDictData().then((response) => { |
| 146 | let dict = response.data; | 218 | let dict = response.data; |
| ... | @@ -148,18 +220,26 @@ export default { | ... | @@ -148,18 +220,26 @@ export default { |
| 148 | this.cargoStatus = dict.cargoStatus; | 220 | this.cargoStatus = dict.cargoStatus; |
| 149 | this.serviceCode = dict.serviceCode; | 221 | this.serviceCode = dict.serviceCode; |
| 150 | this.subCategory = dict.subCategory; | 222 | this.subCategory = dict.subCategory; |
| 151 | - }) | 223 | + }); |
| 224 | + if (handle === "detail") { | ||
| 225 | + this.disable = true; | ||
| 226 | + } | ||
| 152 | 227 | ||
| 228 | + if (handle != "add") { | ||
| 229 | + let id = this.$route.params.id; | ||
| 153 | 230 | ||
| 154 | //货物信息 | 231 | //货物信息 |
| 155 | findByFlightId(id).then((response) => { | 232 | findByFlightId(id).then((response) => { |
| 156 | let info = response.data.list; | 233 | let info = response.data.list; |
| 157 | info.typeOfGoods = info.typeOfGoods ? info.typeOfGoods.split(";") : []; | 234 | info.typeOfGoods = info.typeOfGoods ? info.typeOfGoods.split(";") : []; |
| 158 | - info.declarationCategory = info.declarationCategory ? info.declarationCategory.split(";") : []; | 235 | + info.declarationCategory = info.declarationCategory |
| 236 | + ? info.declarationCategory.split(";") | ||
| 237 | + : []; | ||
| 159 | info.serviceCode = info.serviceCode ? info.serviceCode.split(";") : []; | 238 | info.serviceCode = info.serviceCode ? info.serviceCode.split(";") : []; |
| 160 | info.subCategory = info.subCategory ? info.subCategory.split(";") : []; | 239 | info.subCategory = info.subCategory ? info.subCategory.split(";") : []; |
| 161 | this.form = info; | 240 | this.form = info; |
| 162 | }); | 241 | }); |
| 242 | + } | ||
| 163 | }, | 243 | }, |
| 164 | }; | 244 | }; |
| 165 | </script> | 245 | </script> | ... | ... |
-
Please register or login to post a comment