Showing
4 changed files
with
50 additions
and
38 deletions
| ... | @@ -281,7 +281,7 @@ export default { | ... | @@ -281,7 +281,7 @@ export default { |
| 281 | // 保存 | 281 | // 保存 |
| 282 | saveSubmit(item, index) { | 282 | saveSubmit(item, index) { |
| 283 | item.flightRoute = item.route || item.flightRoute; | 283 | item.flightRoute = item.route || item.flightRoute; |
| 284 | - item.ruleDate = item.ruleDate || this.queryForm.flightDate | 284 | + item.ruleDate = item.ruleDate || this.queryForm.flightDate; |
| 285 | let parmas = JSON.parse(JSON.stringify(item)); | 285 | let parmas = JSON.parse(JSON.stringify(item)); |
| 286 | this.returnString(parmas, "cargoType"); | 286 | this.returnString(parmas, "cargoType"); |
| 287 | this.returnString(parmas, "typeOfGoods"); | 287 | this.returnString(parmas, "typeOfGoods"); | ... | ... |
| ... | @@ -158,6 +158,7 @@ export default { | ... | @@ -158,6 +158,7 @@ export default { |
| 158 | sortType: "Number", // 排序类型 | 158 | sortType: "Number", // 排序类型 |
| 159 | sortAttr: "routePriority", // 排序字段 | 159 | sortAttr: "routePriority", // 排序字段 |
| 160 | }); | 160 | }); |
| 161 | + // 将flightRoute航线赋值给route属性,并且追加到当前对象 | ||
| 161 | routeList.map((item) => { | 162 | routeList.map((item) => { |
| 162 | if (item.flightRoute) { | 163 | if (item.flightRoute) { |
| 163 | item.route = item.flightRoute; | 164 | item.route = item.flightRoute; |
| ... | @@ -180,6 +181,12 @@ export default { | ... | @@ -180,6 +181,12 @@ export default { |
| 180 | } | 181 | } |
| 181 | }); | 182 | }); |
| 182 | this.routeList = routeList; // 航班航线列表 | 183 | this.routeList = routeList; // 航班航线列表 |
| 184 | + mergeRouteInfo.sort((a, b) => { | ||
| 185 | + return ( | ||
| 186 | + routeList.findIndex((item) => item.route == a.route) - | ||
| 187 | + routeList.findIndex((item) => item.route == b.route) | ||
| 188 | + ); | ||
| 189 | + }); | ||
| 183 | this.routesInfo = mergeRouteInfo; // 航班航线配置信息列表 | 190 | this.routesInfo = mergeRouteInfo; // 航班航线配置信息列表 |
| 184 | }) | 191 | }) |
| 185 | .catch(() => {}); | 192 | .catch(() => {}); |
| ... | @@ -201,6 +208,12 @@ export default { | ... | @@ -201,6 +208,12 @@ export default { |
| 201 | } | 208 | } |
| 202 | }); | 209 | }); |
| 203 | this.routeList = noDateRouteList; // 航班航线列表 | 210 | this.routeList = noDateRouteList; // 航班航线列表 |
| 211 | + mergeNoDateRouteInfo.sort((a, b) => { | ||
| 212 | + return ( | ||
| 213 | + noDateRouteList.findIndex((item) => item.route == a.route) - | ||
| 214 | + noDateRouteList.findIndex((item) => item.route == b.route) | ||
| 215 | + ); | ||
| 216 | + }); | ||
| 204 | this.routesInfo = mergeNoDateRouteInfo; // 航班航线配置信息列表 | 217 | this.routesInfo = mergeNoDateRouteInfo; // 航班航线配置信息列表 |
| 205 | } | 218 | } |
| 206 | ); | 219 | ); |
| ... | @@ -228,6 +241,12 @@ export default { | ... | @@ -228,6 +241,12 @@ export default { |
| 228 | } | 241 | } |
| 229 | }); | 242 | }); |
| 230 | this.routeList = dateRouteList; // 航班航线列表 | 243 | this.routeList = dateRouteList; // 航班航线列表 |
| 244 | + mergeDateRouteInfo.sort((a, b) => { | ||
| 245 | + return ( | ||
| 246 | + dateRouteList.findIndex((item) => item.route == a.route) - | ||
| 247 | + dateRouteList.findIndex((item) => item.route == b.route) | ||
| 248 | + ); | ||
| 249 | + }); | ||
| 231 | this.routesInfo = mergeDateRouteInfo; // 航班航线配置信息列表 | 250 | this.routesInfo = mergeDateRouteInfo; // 航班航线配置信息列表 |
| 232 | } | 251 | } |
| 233 | if (dateConfigFlag == false) { | 252 | if (dateConfigFlag == false) { |
| ... | @@ -303,6 +322,12 @@ export default { | ... | @@ -303,6 +322,12 @@ export default { |
| 303 | this.setattrVal(item); // 设置属性值 | 322 | this.setattrVal(item); // 设置属性值 |
| 304 | } | 323 | } |
| 305 | }); | 324 | }); |
| 325 | + result.sort((a, b) => { | ||
| 326 | + return ( | ||
| 327 | + dateRouteList.findIndex((item) => item.route == a.route) - | ||
| 328 | + dateRouteList.findIndex((item) => item.route == b.route) | ||
| 329 | + ); | ||
| 330 | + }); | ||
| 306 | this.routesInfo = result; | 331 | this.routesInfo = result; |
| 307 | } else { | 332 | } else { |
| 308 | // 日期级别和非日期级别都没有配置信息的时候, | 333 | // 日期级别和非日期级别都没有配置信息的时候, |
| ... | @@ -310,6 +335,12 @@ export default { | ... | @@ -310,6 +335,12 @@ export default { |
| 310 | noDateRouteInfo = mergeNoDateRouteInfo.filter( | 335 | noDateRouteInfo = mergeNoDateRouteInfo.filter( |
| 311 | (item) => item.route == route | 336 | (item) => item.route == route |
| 312 | ); | 337 | ); |
| 338 | + noDateRouteInfo.sort((a, b) => { | ||
| 339 | + return ( | ||
| 340 | + dateRouteList.findIndex((item) => item.route == a.route) - | ||
| 341 | + dateRouteList.findIndex((item) => item.route == b.route) | ||
| 342 | + ); | ||
| 343 | + }); | ||
| 313 | this.routesInfo = noDateRouteInfo; | 344 | this.routesInfo = noDateRouteInfo; |
| 314 | } | 345 | } |
| 315 | } else { | 346 | } else { |
| ... | @@ -334,6 +365,12 @@ export default { | ... | @@ -334,6 +365,12 @@ export default { |
| 334 | } | 365 | } |
| 335 | }); | 366 | }); |
| 336 | this.routeList = dateRouteList; | 367 | this.routeList = dateRouteList; |
| 368 | + dateList.sort((a, b) => { | ||
| 369 | + return ( | ||
| 370 | + dateRouteList.findIndex((item) => item.route == a.route) - | ||
| 371 | + dateRouteList.findIndex((item) => item.route == b.route) | ||
| 372 | + ); | ||
| 373 | + }); | ||
| 337 | this.routesInfo = dateList; | 374 | this.routesInfo = dateList; |
| 338 | if (this.$route.query.flightKindName == "Purple Tail") { | 375 | if (this.$route.query.flightKindName == "Purple Tail") { |
| 339 | let flightRouteListStr = []; | 376 | let flightRouteListStr = []; | ... | ... |
| ... | @@ -1405,6 +1405,7 @@ export default { | ... | @@ -1405,6 +1405,7 @@ export default { |
| 1405 | }) | 1405 | }) |
| 1406 | .catch(() => {}); | 1406 | .catch(() => {}); |
| 1407 | }, | 1407 | }, |
| 1408 | + | ||
| 1408 | /** 提交按钮 */ | 1409 | /** 提交按钮 */ |
| 1409 | submitForm: function () { | 1410 | submitForm: function () { |
| 1410 | this.$refs["form"].validate((valid) => { | 1411 | this.$refs["form"].validate((valid) => { |
| ... | @@ -1415,38 +1416,12 @@ export default { | ... | @@ -1415,38 +1416,12 @@ export default { |
| 1415 | if (this.form.route.length || this.form.route !== undefined) { | 1416 | if (this.form.route.length || this.form.route !== undefined) { |
| 1416 | this.routeError = false; | 1417 | this.routeError = false; |
| 1417 | } | 1418 | } |
| 1418 | - | ||
| 1419 | if (this.form.route.length == 0) { | 1419 | if (this.form.route.length == 0) { |
| 1420 | this.routeError = true; | 1420 | this.routeError = true; |
| 1421 | return; | 1421 | return; |
| 1422 | } | 1422 | } |
| 1423 | if (valid) { | 1423 | if (valid) { |
| 1424 | let formdata = JSON.parse(JSON.stringify(this.form)); | 1424 | let formdata = JSON.parse(JSON.stringify(this.form)); |
| 1425 | - let params = { | ||
| 1426 | - fltNo: formdata.fltNo, | ||
| 1427 | - }; | ||
| 1428 | - queryRoute(params) | ||
| 1429 | - .then((res) => { | ||
| 1430 | - const { code, data, msg } = res; | ||
| 1431 | - if (code == 200) { | ||
| 1432 | - // 按照route数组的顺序排序 | ||
| 1433 | - let sortRoute = data.list.sort((a, b) => { | ||
| 1434 | - return ( | ||
| 1435 | - formdata.route.indexOf(a.route) - | ||
| 1436 | - formdata.route.indexOf(b.route) | ||
| 1437 | - ); | ||
| 1438 | - }); | ||
| 1439 | - // 过滤掉不在route数组中的字符串 | ||
| 1440 | - let reuslt = sortRoute.filter((item) => { | ||
| 1441 | - return formdata.route.indexOf(item.route) !== -1; | ||
| 1442 | - }); | ||
| 1443 | - let sortRoutes = []; | ||
| 1444 | - reuslt.map((item) => { | ||
| 1445 | - sortRoutes.push(item.route); | ||
| 1446 | - }); | ||
| 1447 | - formdata.route = sortRoutes; | ||
| 1448 | - // console.log(sortRoutes) | ||
| 1449 | - // console.log(reuslt) | ||
| 1450 | //高价百分比和低价百分比和不可以大于100 | 1425 | //高价百分比和低价百分比和不可以大于100 |
| 1451 | if ( | 1426 | if ( |
| 1452 | this.form.highLowPriceFlg && | 1427 | this.form.highLowPriceFlg && |
| ... | @@ -1483,17 +1458,16 @@ export default { | ... | @@ -1483,17 +1458,16 @@ export default { |
| 1483 | ) { | 1458 | ) { |
| 1484 | formdata.extraWeightPercent = 0; | 1459 | formdata.extraWeightPercent = 0; |
| 1485 | } | 1460 | } |
| 1486 | - // //处理数据 | 1461 | + //处理数据 |
| 1487 | - // saveOrUpdate(formdata).then((response) => { | 1462 | + saveOrUpdate(formdata) |
| 1488 | - // if (response.code === 200) { | 1463 | + .then((response) => { |
| 1489 | - // this.msgSuccess("保存成功"); | 1464 | + if (response.code === 200) { |
| 1490 | - // this.routeList = []; | 1465 | + this.msgSuccess("保存成功"); |
| 1491 | - // this.open = false; | 1466 | + this.routeList = []; |
| 1492 | - // this.findAllFltData(); | 1467 | + this.open = false; |
| 1493 | - // } else { | 1468 | + this.findAllFltData(); |
| 1494 | - // this.msgError(response.msg); | 1469 | + } else { |
| 1495 | - // } | 1470 | + this.msgError(response.msg); |
| 1496 | - // }).catch(()=>{}); | ||
| 1497 | } | 1471 | } |
| 1498 | }) | 1472 | }) |
| 1499 | .catch(() => {}); | 1473 | .catch(() => {}); | ... | ... |
-
Please register or login to post a comment