index.vue
7.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<template>
<div style="margin:30px 20px 20px">
<el-form class="form-header" :model="pageOption" ref="queryForm" label-position="right" label-width="auto"
size="small">
<el-row>
<el-col :span="6">
<el-form-item label="航班号" prop="fltNo">
<el-input class="wid80" v-model="queryfltNo" placeholder="请输入航班号" maxlength="20" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="预审状态" prop="status">
<el-select class="wid80" v-model="pageOption.status" clearable placeholder="不限">
<el-option label="关闭" :value="0">
</el-option>
<el-option label="开启" :value="1">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="mb20" ref="preReviewOptions" style="font-size: 12px; font-weight: 700">
<el-button type="primary" icon="el-icon-search" size="small" :loading="tableLoading" @click="preQuery(1)">搜 索
</el-button>
<el-button type="primary" icon="el-icon-plus" size="small" @click="dialogVisible = true"
v-hasPermi="['allocation:preReview:add']">新增预审航班</el-button>
<el-button type="primary" size="small" icon="el-icon-check" :disabled="selectData.length == 0"
@click="preOption(1)" v-hasPermi="['allocation:preReview:open']">
预审开启</el-button>
<el-button type="primary" size="small" icon="el-icon-close" :disabled="selectData.length == 0"
@click="preOption(0)" v-hasPermi="['allocation:preReview:close']">
预审关闭</el-button>
<el-button type="danger" icon="el-icon-delete" size="small" :disabled="selectData.length == 0"
@click="preOption(2)" v-hasPermi="['allocation:preReview:delete']">删 除
</el-button>
</div>
<Tables ref="preFlight" ductName="preFlight" :selection="true" :selectFixed="false" :order='true'
:height="tableHeight" :data="flightData" :headerData="tableHeaders" :page="pageOption.page" :pageSizes="[20]"
:totalCount="total" :loading="tableLoading" @currentChange="currentChange"
layout="total,prev, pager, next, jumper, ->" @tableSelect="tableSelection" @tableSelectAll="tableSelectAll">
</Tables>
<el-dialog title="新增预审航班" width="20%" :visible.sync="dialogVisible" :close-on-click-modal="false"
:show-close="false" :append-to-body="true" @close="close">
<el-form ref="addForm" :model="newPre" label-width="auto" label-position="left" size="small" :rules="rules"
@submit.native.prevent>
<el-form-item label="航班号" prop="addFlitNo">
<el-input type="textarea" v-model="fltNo" :rows="7" maxlength="255" show-word-limit placeholder="请输入航班号,用;分隔">
</el-input>
</el-form-item>
</el-form>
<div slot="footer">
<el-button type="primary" :loading="loading" @click="submit">确 定</el-button>
<el-button @click="close">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getpreAudit, addPreFlight, updatePreStatus } from '@/api/system/preReview.js'
export default {
name: "PreReviewFlight",
data() {
return {
pageOption: {
fltNo: undefined,
page: 1,
size: 20
},//查询条件
tableHeaders: [
{
columnChineseName: "航班号",
columnName: "fltNo",
columnWidth: "",
status: 1
},
{
columnChineseName: "预审状态",
columnName: "status",
columnWidth: "",
status: 1
},
],//表头
flightData: [],//表格数据
selectData: [],//选中数据
newPre: {
addFlitNo: '',
},//新增航班
rules: {
fltNo: [
{
required: true,
message: "航班号不能为空",
trigger: "blur",
}
]
},//表单规则
dialogVisible: false,
total: 0,
tableHeight: 300,
loading: false,
tableLoading: false,
};
},
created() {
this.preQuery(1)
},
activated() {
if (this.flightData.length > 0) {
this.preQuery()
}
},
mounted() {
// this.tableHeight = window.innerHeight - this.$refs.preReviewOptions.offsetHeight - 300;
},
methods: {
//搜索
preQuery(val) {
this.tableLoading = true
this.selectData = []
if (val === 1) {
this.pageOption.page = 1
}
getpreAudit(this.pageOption).then(res => {
this.tableLoading = false
if (res.code === 200) {
this.flightData = res.data.list
this.total = res.data.total
} else {
this.msgWarning(res.msg)
}
}).catch(err => {
this.tableLoading = false
console.log(err)
})
},
//保存
submit() {
this.$refs["addForm"].validate(val => {
if (val) {
this.loading = true
let fltList = []
this.newPre.addFlitNo.split(';').forEach(item => {
if (item != '') {
fltList.push(item)
}
})
addPreFlight(fltList).then(res => {
this.loading = false
if (res.code === 200) {
this.msgSuccess(res.msg)
this.close()
this.preQuery(1)
} else {
this.msgWarning(res.msg)
}
}).catch(err => {
this.loading = false
console.log(err)
})
}
})
},
//预审状态修改
preOption(val) {
this.$confirm(val === 2 ? '是否要删除?' : val === 0 ? '是否要关闭预审' : '是否要开启预审', '系统提示', {
closeOnClickModal: false,
confirmButtonText: '确定',
cancelButtonText: "取消",
type: 'warning'
}).then(() => {
let idList = []
this.selectData.forEach(item => {
idList.push(item.id)
})
updatePreStatus({ ids: idList, status: val }).then(res => {
if (res.code === 200) {
this.msgSuccess(val === 2 ? '删除成功' : val === 0 ? '关闭成功' : '开启成功')
this.preQuery(1)
} else {
this.msgWarning(res.msg)
}
}).catch(err => {
console.log(err)
})
}).catch()
},
//关闭弹窗
close() {
this.dialogVisible = false
this.newPre.addFlitNo = ''
},
//翻页
currentChange(val) {
this.pageOption.page = val.page
this.preQuery()
},
//多选
tableSelection(val) {
this.selectData = val.selection
},
//全选
tableSelectAll(val) {
this.selectData = val
},
},
computed: {
queryfltNo: {
get: function () {
return this.pageOption.fltNo;
},
set: function (val) {
this.pageOption.fltNo = this.upCase(val);
},
},
fltNo: {
get: function () {
return this.newPre.addFlitNo;
},
set: function (val) {
let reg = /^([0-9A-Za-z]{0,20}(\;[0-9a-zA-Z]{0,20})*)$/
if (reg.test(val)) {
this.newPre.addFlitNo = this.upCase(val);
}
},
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
</style>