Elements-SY

modify

1 <template> 1 <template>
2 - <div> 2 + <div>
3 - <el-dialog title="航线优先级排序" :visible.sync="open" width="25%" :close-on-click-modal="false" :show-close="false" 3 + <el-dialog
4 - @close="close" append-to-body center> 4 + title="航线优先级排序"
5 - <el-form ref="routeOrder" label-width="auto" label-position="left" size="small" @submit.native.prevent> 5 + :visible.sync="open"
6 - <el-form-item label="航班号:" prop="fltNo"> 6 + width="25%"
7 - <span>{{ fltNo }}</span> 7 + :close-on-click-modal="false"
8 - </el-form-item> 8 + :show-close="false"
9 - <el-form-item label="航班日期:" prop="fltDate"> 9 + @close="close"
10 - <span>{{ fltDate }}</span> 10 + append-to-body
11 - </el-form-item> 11 + center
12 - <el-form-item label="航线优先级" prop="route"> 12 + >
13 - <Drag :routes="routeList" @drag="drag"></Drag> 13 + <el-form
14 - </el-form-item> 14 + ref="routeOrder"
15 - </el-form> 15 + label-width="auto"
16 - <div slot="footer" class="dialog-footer"> 16 + label-position="left"
17 - <el-button type="primary" :loading="loading" @click="submit">确 定</el-button> 17 + size="small"
18 - <el-button @click="close">取 消</el-button> 18 + @submit.native.prevent
19 - </div> 19 + >
20 - </el-dialog> 20 + <el-form-item label="航班号:" prop="fltNo">
21 - </div> 21 + <span>{{ fltNo }}</span>
22 + </el-form-item>
23 + <el-form-item label="航班日期:" prop="fltDate">
24 + <span>{{ fltDate }}</span>
25 + </el-form-item>
26 + <el-form-item label="航线优先级" prop="route">
27 + <Drag :routes="routeList" @drag="drag"></Drag>
28 + </el-form-item>
29 + </el-form>
30 + <div slot="footer" class="dialog-footer">
31 + <el-button type="primary" :loading="loading" @click="submit"
32 + >确 定</el-button
33 + >
34 + <el-button @click="close">取 消</el-button>
35 + </div>
36 + </el-dialog>
37 + </div>
22 </template> 38 </template>
23 39
24 <script> 40 <script>
25 -import { allRouteQuery, saveOrUpdateSpecifyDateRoute } from "@/api/destinationFlight"; 41 +import {
42 + allRouteQuery,
43 + saveOrUpdateSpecifyDateRoute,
44 +} from "@/api/destinationFlight";
26 45
27 export default { 46 export default {
28 - name: "", 47 + name: "",
29 - props: { 48 + props: {
30 - open: { 49 + open: {
31 - type: Boolean, 50 + type: Boolean,
32 - default: false 51 + default: false,
33 - },
34 - fltData: {
35 - type: Object,
36 - default: null
37 - }
38 }, 52 },
39 - data() { 53 + fltData: {
40 - return { 54 + type: Object,
41 - fltNo: '', 55 + default: null,
42 - fltDate: '',
43 - routeList: [],
44 - submitData: [],
45 - loading: false
46 - }
47 }, 56 },
48 - watch: { 57 + },
49 - open(val) { 58 + data() {
50 - this.routeList = [] 59 + return {
51 - this.submitData = [] 60 + fltNo: "",
52 - if (val) { 61 + fltDate: "",
53 - this.fltNo = this.fltData.fltNo 62 + routeList: [],
54 - this.fltDate = this.fltData.fltDate 63 + submitData: [],
55 - allRouteQuery({ 64 + loading: false,
56 - fltNo: this.fltNo, 65 + };
57 - routeDate: this.fltDate 66 + },
58 - }).then(res => { 67 + watch: {
59 - if (res.code === 200) { 68 + open(val) {
60 - this.routeList = res.data.list 69 + this.routeList = [];
61 - this.submitData = res.data.list 70 + this.submitData = [];
62 - } else { 71 + if (val) {
63 - this.msgWarning(res.msg) 72 + this.fltNo = this.fltData.fltNo;
64 - } 73 + this.fltDate = this.fltData.fltDate;
65 - }).catch(err => { 74 + allRouteQuery({
66 - console.log(err) 75 + fltNo: this.fltNo,
67 - }) 76 + routeDate: this.fltDate,
77 + })
78 + .then((res) => {
79 + if (res.code === 200) {
80 + this.routeList = res.data.list;
81 + this.submitData = res.data.list;
82 + } else {
83 + this.msgWarning(res.msg);
68 } 84 }
69 - } 85 + })
86 + .catch((err) => {
87 + console.log(err);
88 + });
89 + }
70 }, 90 },
71 - methods: { 91 + },
72 - submit() { 92 + methods: {
73 - saveOrUpdateSpecifyDateRoute(this.submitData).then(res => { 93 + submit() {
74 - if (res.code === 200) { 94 + saveOrUpdateSpecifyDateRoute(this.submitData)
75 - this.msgSuccess('保存成功') 95 + .then((res) => {
76 - this.close() 96 + if (res.code === 200) {
77 - } else { 97 + this.msgSuccess("保存成功");
78 - this.msgWarning(res.msg) 98 + this.close(res.code);
79 - } 99 + } else {
80 - }).catch(err => { 100 + this.msgWarning(res.msg);
81 - console.log(err) 101 + }
82 - }) 102 + })
83 - }, 103 + .catch((err) => {
84 - close() { 104 + console.log(err);
85 - this.routeList = [] 105 + });
86 - this.submitData = [] 106 + },
87 - this.$emit('close') 107 + close(code) {
88 - }, 108 + this.routeList = [];
89 - drag(val) { 109 + this.submitData = [];
90 - val.forEach((item, index) => { 110 + this.$emit("close", code);
91 - item.ordinal = index + 1 111 + },
92 - }) 112 + drag(val) {
93 - this.submitData = val 113 + val.forEach((item, index) => {
94 - } 114 + item.ordinal = index + 1;
95 - } 115 + });
96 -} 116 + this.submitData = val;
97 - 117 + },
118 + },
119 +};
98 </script> 120 </script>
99 121
100 -<style lang="scss" scoped>
101 -
102 -</style>
...\ No newline at end of file ...\ No newline at end of file
122 +<style lang="scss" scoped></style>
......
...@@ -213,13 +213,13 @@ export default { ...@@ -213,13 +213,13 @@ export default {
213 this.$router.push({ 213 this.$router.push({
214 path: "/routeInfo", 214 path: "/routeInfo",
215 query: { 215 query: {
216 - flightDate: '', // 跳转的时候默认当天日期 216 + flightDate: "", // 跳转的时候默认当天日期
217 - purposeOfFlightNo: '', 217 + purposeOfFlightNo: "",
218 - flightRouteListStr: '', 218 + flightRouteListStr: "",
219 - status: '', 219 + status: "",
220 pageName: "flightAllocConfig", 220 pageName: "flightAllocConfig",
221 dataStatus: "add", 221 dataStatus: "add",
222 - disable: '', 222 + disable: "",
223 }, 223 },
224 }); 224 });
225 }, 225 },
...@@ -253,7 +253,10 @@ export default { ...@@ -253,7 +253,10 @@ export default {
253 this.queryParams.flightDate = undefined; 253 this.queryParams.flightDate = undefined;
254 } 254 }
255 }, 255 },
256 - close() { 256 + close(code) {
257 + if (code == 200) {
258 + this.getList();
259 + }
257 this.open = false; 260 this.open = false;
258 }, 261 },
259 //翻页 262 //翻页
......
...@@ -81,6 +81,7 @@ export default { ...@@ -81,6 +81,7 @@ export default {
81 noDateRouteList, 81 noDateRouteList,
82 noDateDataList 82 noDateDataList
83 ); 83 );
84 + // 当前所有航线都有航线配置信息返回true,否则返回false
84 let noDateConfigFlag = mergeNoDateRouteInfo.every( 85 let noDateConfigFlag = mergeNoDateRouteInfo.every(
85 (item) => item.config == true 86 (item) => item.config == true
86 ); 87 );
......