Elements-SY

modify

......@@ -281,7 +281,7 @@ export default {
// 保存
saveSubmit(item, index) {
item.flightRoute = item.route || item.flightRoute;
item.ruleDate = item.ruleDate || this.queryForm.flightDate
item.ruleDate = item.ruleDate || this.queryForm.flightDate;
let parmas = JSON.parse(JSON.stringify(item));
this.returnString(parmas, "cargoType");
this.returnString(parmas, "typeOfGoods");
......
......@@ -158,6 +158,7 @@ export default {
sortType: "Number", // 排序类型
sortAttr: "routePriority", // 排序字段
});
// 将flightRoute航线赋值给route属性,并且追加到当前对象
routeList.map((item) => {
if (item.flightRoute) {
item.route = item.flightRoute;
......@@ -180,6 +181,12 @@ export default {
}
});
this.routeList = routeList; // 航班航线列表
mergeRouteInfo.sort((a, b) => {
return (
routeList.findIndex((item) => item.route == a.route) -
routeList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = mergeRouteInfo; // 航班航线配置信息列表
})
.catch(() => {});
......@@ -201,6 +208,12 @@ export default {
}
});
this.routeList = noDateRouteList; // 航班航线列表
mergeNoDateRouteInfo.sort((a, b) => {
return (
noDateRouteList.findIndex((item) => item.route == a.route) -
noDateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = mergeNoDateRouteInfo; // 航班航线配置信息列表
}
);
......@@ -228,6 +241,12 @@ export default {
}
});
this.routeList = dateRouteList; // 航班航线列表
mergeDateRouteInfo.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = mergeDateRouteInfo; // 航班航线配置信息列表
}
if (dateConfigFlag == false) {
......@@ -303,6 +322,12 @@ export default {
this.setattrVal(item); // 设置属性值
}
});
result.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = result;
} else {
// 日期级别和非日期级别都没有配置信息的时候,
......@@ -310,6 +335,12 @@ export default {
noDateRouteInfo = mergeNoDateRouteInfo.filter(
(item) => item.route == route
);
noDateRouteInfo.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = noDateRouteInfo;
}
} else {
......@@ -334,6 +365,12 @@ export default {
}
});
this.routeList = dateRouteList;
dateList.sort((a, b) => {
return (
dateRouteList.findIndex((item) => item.route == a.route) -
dateRouteList.findIndex((item) => item.route == b.route)
);
});
this.routesInfo = dateList;
if (this.$route.query.flightKindName == "Purple Tail") {
let flightRouteListStr = [];
......
......@@ -1405,6 +1405,7 @@ export default {
})
.catch(() => {});
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
......@@ -1415,85 +1416,58 @@ export default {
if (this.form.route.length || this.form.route !== undefined) {
this.routeError = false;
}
if (this.form.route.length == 0) {
this.routeError = true;
return;
}
if (valid) {
let formdata = JSON.parse(JSON.stringify(this.form));
let params = {
fltNo: formdata.fltNo,
};
queryRoute(params)
.then((res) => {
const { code, data, msg } = res;
if (code == 200) {
// 按照route数组的顺序排序
let sortRoute = data.list.sort((a, b) => {
return (
formdata.route.indexOf(a.route) -
formdata.route.indexOf(b.route)
);
});
// 过滤掉不在route数组中的字符串
let reuslt = sortRoute.filter((item) => {
return formdata.route.indexOf(item.route) !== -1;
});
let sortRoutes = [];
reuslt.map((item) => {
sortRoutes.push(item.route);
});
formdata.route = sortRoutes;
// console.log(sortRoutes)
// console.log(reuslt)
//高价百分比和低价百分比和不可以大于100
if (
this.form.highLowPriceFlg &&
(formdata.highPriceWeightPercent > 100 ||
formdata.highPriceWeightPercent < 0)
) {
this.$message.warning("请正确填写高低价百分比");
return;
}
//已删除的无法修改
//拿到已删除的id
let statusId = 0;
this.selectOption.flightStatuslist.map((item) => {
// this.unitList 是你 select option遍历的集合 e 是选中的id
if (item.chineseName === "已删除") {
statusId = item.id;
return;
}
});
if (statusId === formdata.statusId) {
this.$message.warning("已删除的航班无法修改");
return;
}
//是否开启高低价
// formdata.highLowPriceFlg = formdata.highLowPriceFlg ? 1 : 0;
//是否预审
// formdata.isNeedRequired = formdata.isNeedRequired ? 1 : 0;
//总重量更新
// formdata.totalWeight = this.Weightall()
formdata.route = this.form.route.toString().replace(/,/g, ";");
if (
this.form.extraWeightPercent == undefined ||
this.form.extraWeightPercent == null
) {
formdata.extraWeightPercent = 0;
}
// //处理数据
// saveOrUpdate(formdata).then((response) => {
// if (response.code === 200) {
// this.msgSuccess("保存成功");
// this.routeList = [];
// this.open = false;
// this.findAllFltData();
// } else {
// this.msgError(response.msg);
// }
// }).catch(()=>{});
//高价百分比和低价百分比和不可以大于100
if (
this.form.highLowPriceFlg &&
(formdata.highPriceWeightPercent > 100 ||
formdata.highPriceWeightPercent < 0)
) {
this.$message.warning("请正确填写高低价百分比");
return;
}
//已删除的无法修改
//拿到已删除的id
let statusId = 0;
this.selectOption.flightStatuslist.map((item) => {
// this.unitList 是你 select option遍历的集合 e 是选中的id
if (item.chineseName === "已删除") {
statusId = item.id;
return;
}
});
if (statusId === formdata.statusId) {
this.$message.warning("已删除的航班无法修改");
return;
}
//是否开启高低价
// formdata.highLowPriceFlg = formdata.highLowPriceFlg ? 1 : 0;
//是否预审
// formdata.isNeedRequired = formdata.isNeedRequired ? 1 : 0;
//总重量更新
// formdata.totalWeight = this.Weightall()
formdata.route = this.form.route.toString().replace(/,/g, ";");
if (
this.form.extraWeightPercent == undefined ||
this.form.extraWeightPercent == null
) {
formdata.extraWeightPercent = 0;
}
//处理数据
saveOrUpdate(formdata)
.then((response) => {
if (response.code === 200) {
this.msgSuccess("保存成功");
this.routeList = [];
this.open = false;
this.findAllFltData();
} else {
this.msgError(response.msg);
}
})
.catch(() => {});
......
......@@ -17,6 +17,7 @@
@click="addBtn"
>添加</el-button
>
<span class="ml20" style="color: #ffba00">拖动航班号可调整优先级</span>
</el-col>
</el-row>
<yl-table
......