|
|
<template>
|
|
|
<el-row>
|
|
|
<el-card style="background-color: #F5F7FA">
|
|
|
<!-- 搜索区域-->
|
|
|
<el-row :gutter="10" class="toolbar">
|
|
|
<el-col :span="7">
|
|
|
<el-input v-model="queryInfo.stationno" prefix-icon="el-icon-search" size="small" style="width: 280px"
|
|
|
placeholder="场站编号" clearable>
|
|
|
<template slot="prepend">场站编号</template>
|
|
|
|
|
|
</el-input>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-button type="primary" icon="el-icon-search" size="small" @click="getList()">
|
|
|
查询
|
|
|
</el-button>
|
|
|
<el-button type="success" icon="el-icon-edit" size="small" @click="applyAdd()">新增</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<!-- 列表区域-->
|
|
|
<el-row>
|
|
|
<template>
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
border
|
|
|
:cell-style="{textAlign:'center'}"
|
|
|
style="border-radius: 10px 10px 0px 0px;line-height: 25px"
|
|
|
:header-cell-style="{background:'#6F8294',color:'#FFFFFF'}" size="small"
|
|
|
>
|
|
|
<el-table-column
|
|
|
fixed
|
|
|
prop="stationno"
|
|
|
label="场站编号"
|
|
|
width="160">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="stationname"
|
|
|
label="场站名称"
|
|
|
width="160">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="stationadr"
|
|
|
label="场站地址"
|
|
|
width="240">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="stationuser"
|
|
|
label="场站负责人名称"
|
|
|
width="120">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="area"
|
|
|
label="区域代码"
|
|
|
width="160">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="customs"
|
|
|
label="关区"
|
|
|
width="80">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
fixed="right"
|
|
|
label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button type="success" size="mini" @click="applyEdit(scope.row)">编辑</el-button>
|
|
|
<el-button type="danger" size="mini" @click="applyDel(scope.$index,scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</template>
|
|
|
</el-row>
|
|
|
<el-row style="margin-top: 10px" class="toolbar">
|
|
|
<el-pagination
|
|
|
@size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange"
|
|
|
:current-page="queryInfo.pageNum"
|
|
|
:page-size="queryInfo.pageSize"
|
|
|
:page-sizes="[10, 50, 100, 500]"
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
:total="total">
|
|
|
</el-pagination>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-dialog :title="dialogMap[dialogApply]" :visible.sync="apply_dialog.addDialog" width="80%" >
|
|
|
<el-form :model="addForm" :rules="rules" ref="addForm" style="margin-top: 40px">
|
|
|
<el-row>
|
|
|
<el-col :span="9">
|
|
|
<el-form-item label="场站编号" :label-width="formLabelWidth" prop="stationno">
|
|
|
<el-input v-model="addForm.stationno" autocomplete="off" size="small" style="width: 190px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="9">
|
|
|
<el-form-item label="场站名称" :label-width="formLabelWidth" prop="stationname">
|
|
|
<el-input v-model="addForm.stationname" autocomplete="off" size="small" style="width: 190px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="9">
|
|
|
<el-form-item label="场站地址" :label-width="formLabelWidth" prop="stationadr">
|
|
|
<el-input v-model="addForm.stationadr" autocomplete="off" size="small" style="width: 190px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="场站负责人名称" :label-width="formLabelWidth" prop="stationuser">
|
|
|
<el-input v-model="addForm.stationuser" autocomplete="off" size="small" style="width: 190px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="9">
|
|
|
<el-form-item label="区域代码" :label-width="formLabelWidth" prop="area">
|
|
|
<el-input v-model="addForm.area" autocomplete="off" size="small" style="width: 190px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="关区" :label-width="formLabelWidth" prop="customs">
|
|
|
<el-input v-model="addForm.customs" autocomplete="off" size="small" style="width: 190px"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="apply_dialog.addDialog = false" size="small">取 消</el-button>
|
|
|
<el-button type="primary" @click="dialogApply==='create'?add():edit()" size="small">提 交</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</el-row>
|
|
|
</el-card>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {selectStations,delStation,addStation,ediStation} from '../../api/consigner/station';
|
|
|
|
|
|
export default {
|
|
|
name: "warehouse",
|
|
|
data() {
|
|
|
return {
|
|
|
queryInfo: {
|
|
|
stationno:'',
|
|
|
// 当前页数
|
|
|
pageNum: 1,
|
|
|
// 每页大小
|
|
|
pageSize: 10,
|
|
|
},
|
|
|
total: 0,
|
|
|
tableData:[],
|
|
|
dialogMap: {
|
|
|
update: '编辑',
|
|
|
create: '新增'
|
|
|
},
|
|
|
dialogApply: 'create',
|
|
|
apply_dialog: {
|
|
|
// 添加对话框
|
|
|
addDialog: false,
|
|
|
// 编辑对话框
|
|
|
editDialog: false
|
|
|
},
|
|
|
addForm: {
|
|
|
stationno: '',
|
|
|
stationname: '',
|
|
|
stationadr: '',
|
|
|
stationuser: '',
|
|
|
area: '',
|
|
|
customs: '',
|
|
|
remark:'',
|
|
|
remark1:'',
|
|
|
remark2:'',
|
|
|
remark3:''
|
|
|
},
|
|
|
formLabelWidth: '220px',
|
|
|
rules: {
|
|
|
userName: [
|
|
|
// { required: true, message: '请输入申请人', trigger: 'blur' },
|
|
|
// // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
|
|
|
// ],
|
|
|
// applyTime: [
|
|
|
// { required: true, message: '请选择时间', trigger: 'change' }
|
|
|
// ],
|
|
|
// needCount: [
|
|
|
// { required: true, message: '请输入需要车辆数量', trigger: 'blur' },
|
|
|
// ],
|
|
|
// orginStation: [
|
|
|
// { required: true, message: '请输入起始场站', trigger: 'blur' },
|
|
|
// ],
|
|
|
// endStation: [
|
|
|
// { required: true, message: '请输入目的场站', trigger: 'blur' },
|
|
|
// ],
|
|
|
// status: [
|
|
|
// { required: true, message: '请选择申请状态', trigger: 'change' }
|
|
|
],
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
handleSizeChange(val) {
|
|
|
this.queryInfo.pageSize = val
|
|
|
this.getList()
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
this.queryInfo.pageNum = val
|
|
|
this.getList()
|
|
|
},
|
|
|
getList() {
|
|
|
const _this = this
|
|
|
selectStations(this.queryInfo).then((response) => {
|
|
|
const res = response.data
|
|
|
console.log(response.data)
|
|
|
if (res.code !== '200') {
|
|
|
return _this.$message.error('获取消息收发记录,失败!')
|
|
|
}
|
|
|
// 获取列表数据
|
|
|
_this.tableData = res.data.list
|
|
|
// 获取列表的总记录数
|
|
|
_this.total = res.data.total
|
|
|
_this.$message.success('获取消息收发记录,成功!')
|
|
|
}).catch(error => {
|
|
|
// 关闭加载
|
|
|
_this.$message.error(error.toString())
|
|
|
})
|
|
|
},
|
|
|
// 添加对话框,打开事件
|
|
|
applyAdd() {
|
|
|
this.addForm = {
|
|
|
stationno: '',
|
|
|
stationname: '',
|
|
|
stationadr: '',
|
|
|
stationuser: '',
|
|
|
area: '',
|
|
|
customs: '',
|
|
|
remark:'',
|
|
|
remark1:'',
|
|
|
remark2:'',
|
|
|
remark3:''
|
|
|
};
|
|
|
this.dialogApply= 'create';
|
|
|
this.apply_dialog.addDialog = true;
|
|
|
},
|
|
|
// 添加功能
|
|
|
add() {
|
|
|
this.$refs.addForm.validate(valid => {
|
|
|
// 未通过,表单预校验
|
|
|
if (!valid) return;
|
|
|
addStation(this.addForm).then((response) => {
|
|
|
let res = response.data;
|
|
|
// 添加失败
|
|
|
if (res.code !== '200') {
|
|
|
return this.$message.error(res.msg);
|
|
|
}
|
|
|
// 添加,成功
|
|
|
this.$message.success(res.msg);
|
|
|
// 隐藏对话框
|
|
|
this.apply_dialog.addDialog = false;
|
|
|
// 刷新列表
|
|
|
this.getList();
|
|
|
}).catch(error => {
|
|
|
this.$message.error(error.toString());
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
// 打开编辑
|
|
|
applyEdit(row) {
|
|
|
this.apply_dialog.addDialog = true;
|
|
|
this.dialogApply = 'update';
|
|
|
this.addForm=row;
|
|
|
},
|
|
|
// 编辑功能
|
|
|
edit() {
|
|
|
// 进行表单的预验证
|
|
|
this.$refs.addForm.validate(valid => {
|
|
|
// 未通过,表单预校验
|
|
|
if (!valid) return
|
|
|
ediStation(this.addForm).then((response) => {
|
|
|
// console.log(row)
|
|
|
const res = response.data
|
|
|
if (res.code != '200') {
|
|
|
return this.$message.error(res.msg)
|
|
|
}
|
|
|
this.$message.success(res.msg)
|
|
|
// 隐藏对话框
|
|
|
this.apply_dialog.addDialog = false
|
|
|
// 刷新列表
|
|
|
this.getList()
|
|
|
}).catch(error => {
|
|
|
this.$message.error(error.toString())
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
// 删除
|
|
|
applyDel(index, row) {
|
|
|
// 弹框询问是否删除?
|
|
|
this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
|
|
|
confirmButtonText: '确定删除',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
}
|
|
|
).then(() => {
|
|
|
// console.log(row);
|
|
|
delStation({stationno:row.stationno}).then((response) => {
|
|
|
// console.log(row)
|
|
|
const res = response.data
|
|
|
this.$message.success(res.msg)
|
|
|
this.getList()
|
|
|
}).catch(error => {
|
|
|
this.$message.error(res.msg)
|
|
|
})
|
|
|
}).catch(() => {
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getList();
|
|
|
// this.getYardList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.toolbar{
|
|
|
height: 60px;
|
|
|
background-color: white;
|
|
|
/*line-height: 60px;*/
|
|
|
vertical-align: middle;
|
|
|
border-radius: 5px 5px 5px 5px;
|
|
|
padding: 15px 0 0 20px;
|
|
|
box-shadow: 0px 5px 5px #e5e8eb;
|
|
|
}
|
|
|
</style> |
...
|
...
|
|