shanyunduo.cheng

删除规则

...@@ -35,8 +35,18 @@ export function updateOrAddFlight(form){ ...@@ -35,8 +35,18 @@ export function updateOrAddFlight(form){
35 method: 'post', 35 method: 'post',
36 data:form 36 data:form
37 }) 37 })
38 +}
38 39
39 - 40 +//删除规则
41 +export function delFlightId(id){
42 + const data = {
43 + id
44 + }
45 + return request({
46 + url: '/destinationFlight/delFlightId',
47 + method: 'post',
48 + data: data
49 + })
40 } 50 }
41 51
42 //申报类别 52 //申报类别
......
1 <template> 1 <template>
2 -<div style="margin:40px" class="app-container"> 2 + <div style="margin: 40px" class="app-container">
3 - <el-form :inline="true" :model="queryParams" class="demo-form-inline" size="small"> 3 + <el-form
4 + :inline="true"
5 + :model="queryParams"
6 + class="demo-form-inline"
7 + size="small"
8 + >
4 <el-form-item label="航班号"> 9 <el-form-item label="航班号">
5 - <el-input v-model="queryParams.purposeOfFlightNo" placeholder="航班号"></el-input> 10 + <el-input
11 + v-model="queryParams.purposeOfFlightNo"
12 + placeholder="航班号"
13 + ></el-input>
6 </el-form-item> 14 </el-form-item>
7 <el-form-item> 15 <el-form-item>
8 - <el-button type="primary" icon="el-icon-search" @click="getList" size="mini">查询</el-button> 16 + <el-button
17 + type="primary"
18 + icon="el-icon-search"
19 + @click="getList"
20 + size="mini"
21 + >查询</el-button
22 + >
9 </el-form-item> 23 </el-form-item>
10 </el-form> 24 </el-form>
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> 25 + <el-button
26 + style="margin-bottom: 20px"
27 + type="primary"
28 + icon="el-icon-plus"
29 + size="mini"
30 + @click="$router.push({ name: 'Add', params: { handle: 'add' } })"
31 + >添加</el-button
32 + >
12 <el-table 33 <el-table
13 :data="flyList" 34 :data="flyList"
14 style="width: 800px" 35 style="width: 800px"
15 - v-loading="loading" size="small" 36 + v-loading="loading"
37 + size="small"
16 > 38 >
17 - <el-table-column prop="purposeOfFlightNo" label="航班号" align="center"></el-table-column> 39 + <el-table-column
40 + prop="purposeOfFlightNo"
41 + label="航班号"
42 + align="center"
43 + ></el-table-column>
18 44
19 <el-table-column prop="status" label="状态" align="center"> 45 <el-table-column prop="status" label="状态" align="center">
20 <template slot-scope="scope"> 46 <template slot-scope="scope">
21 - <span v-if="scope.row.status==='0'">无效</span> 47 + <span v-if="scope.row.status === '0'">无效</span>
22 - <span v-if="scope.row.status==='1'">有效</span> 48 + <span v-if="scope.row.status === '1'">有效</span>
23 - <span v-if="scope.row.status==='2'">配置中</span> 49 + <span v-if="scope.row.status === '2'">配置中</span>
24 - <span v-if="scope.row.status==='3'">停用</span> 50 + <span v-if="scope.row.status === '3'">停用</span>
25 </template> 51 </template>
26 </el-table-column> 52 </el-table-column>
27 53
28 <el-table-column label="操作" prop="id" align="center"> 54 <el-table-column label="操作" prop="id" align="center">
29 - <template slot-scope="scope" > 55 + <template slot-scope="scope">
30 - <el-button type="text" size="mini" icon="el-icon-view" @click="handleClick(scope.row.id, 'detail')">查看</el-button> 56 + <el-button
31 - <el-button type="text" size="mini" icon="el-icon-edit" @click="handleClick(scope.row.id, 'update')">修改</el-button> 57 + type="text"
32 - <el-button type="text" size="mini" icon="el-icon-delete">删除</el-button> 58 + size="mini"
33 - <el-button type="text" size="mini" icon="el-icon-video-play">启用</el-button> 59 + icon="el-icon-view"
34 - <el-button type="text" size="mini" icon="el-icon-video-pause">停用</el-button> 60 + @click="handleClick(scope.row.id, 'detail')"
61 + >查看</el-button
62 + >
63 + <el-button
64 + type="text"
65 + size="mini"
66 + icon="el-icon-edit"
67 + @click="handleClick(scope.row.id, 'update')"
68 + >修改</el-button
69 + >
70 + <el-button
71 + type="text"
72 + size="mini"
73 + icon="el-icon-delete"
74 + @click="del(scope.row.id)"
75 + >删除</el-button
76 + >
77 + <el-button type="text" size="mini" icon="el-icon-video-play"
78 + >启用</el-button
79 + >
80 + <el-button type="text" size="mini" icon="el-icon-video-pause"
81 + >停用</el-button
82 + >
35 </template> 83 </template>
36 </el-table-column> 84 </el-table-column>
37 </el-table> 85 </el-table>
...@@ -45,59 +93,74 @@ ...@@ -45,59 +93,74 @@
45 :total="total" 93 :total="total"
46 background 94 background
47 :hide-on-single-page="true" 95 :hide-on-single-page="true"
48 - style="margin-top:40px; text-align:right"> 96 + style="margin-top: 40px; text-align: right"
97 + >
49 </el-pagination> 98 </el-pagination>
50 -</div> 99 + </div>
51 </template> 100 </template>
52 101
53 <script> 102 <script>
54 - import { 103 +import { findFlightNo, delFlightId } from "@/api/destinationFlight";
55 - findFlightNo
56 - } from "@/api/destinationFlight";
57 104
58 - export default { 105 +export default {
59 data() { 106 data() {
60 return { 107 return {
61 queryParams: { 108 queryParams: {
62 - purposeOfFlightNo: '', 109 + purposeOfFlightNo: "",
63 - start:0, 110 + start: 0,
64 - limit:10 111 + limit: 10,
65 }, 112 },
66 - flyList:[], 113 + flyList: [],
67 - curPage:1, 114 + curPage: 1,
68 - limit:10, 115 + limit: 10,
69 - total:0, 116 + total: 0,
70 - loading:false, 117 + loading: false,
71 - } 118 + };
72 }, 119 },
73 methods: { 120 methods: {
74 - getList(){ 121 + getList() {
75 this.queryParams.limit = this.limit; 122 this.queryParams.limit = this.limit;
76 if (this.curPage > 1) { 123 if (this.curPage > 1) {
77 - this.queryParams.start = (this.curPage - 1) * this.queryParams.limit 124 + this.queryParams.start = (this.curPage - 1) * this.queryParams.limit;
78 - }else { 125 + } else {
79 this.queryParams.start = 0; 126 this.queryParams.start = 0;
80 } 127 }
81 this.loading = true; 128 this.loading = true;
82 - findFlightNo(this.queryParams).then(response => { 129 + findFlightNo(this.queryParams).then((response) => {
83 this.flyList = response.data.list; 130 this.flyList = response.data.list;
84 this.total = response.data.totalCount; 131 this.total = response.data.totalCount;
85 this.loading = false; 132 this.loading = false;
86 }); 133 });
87 }, 134 },
88 //跳转到查看,修改页面 135 //跳转到查看,修改页面
89 - handleClick(flightiId, handle){ 136 + handleClick(flightiId, handle) {
90 - this.$router.push({ name: 'Info', params: { handle: handle, id:flightiId }}); 137 + this.$router.push({
138 + name: "Info",
139 + params: { handle: handle, id: flightiId },
140 + });
141 + },
142 + //删除规则
143 + del(id) {
144 + this.$confirm("是否确认删除此航班规则?", "警告", {
145 + confirmButtonText: "确定",
146 + cancelButtonText: "取消",
147 + type: "warning",
148 + }).then(function () {
149 + return delFlightId(id);
150 + })
151 + .then(() => {
152 + this.getList();
153 + this.msgSuccess("删除成功");
154 + })
155 + .catch(function () {});
91 }, 156 },
92 //删除,启用,停用 157 //删除,启用,停用
93 - changeStatus(id, handle){ 158 + changeStatus(id, handle) {},
94 -
95 - }
96 }, 159 },
97 created() { 160 created() {
98 this.getList(); 161 this.getList();
99 - } 162 + },
100 - } 163 +};
101 </script> 164 </script>
102 165
103 166
......