1、调用企业端的车辆信息管理

dev_pc_fufeifei_2024-12-3_vehicle
fufeifei 2024-12-06 10:10:41 +08:00
parent 96c97d9c29
commit 6ad915f69e
3 changed files with 1171 additions and 0 deletions

View File

@ -0,0 +1,935 @@
<template>
<div class="app-container">
<el-form label-width="100px">
<el-row>
<el-col :span="4">
<el-form-item label="车牌号">
<el-input v-model="searchFrom.LICENCE_NO" placeholder="请输入车牌号..." />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="车辆类型" prop="VEHICLE_TYPE">
<SelectTree
ref="selectTree_Search1"
:clearable="false"
:options="vehicleTypeList"
:props="vehicleDefaultProps"
v-model="searchFrom.VEHICLE_TYPE"
placeholder="请选择车辆类型"/>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="车辆所属部门" prop="VEHICLE_DEPARTMENT_ID">
<SelectTree
ref="selectTree_Search2"
:clearable="false"
:options="departmentTreeData"
:props="defaultProps"
v-model="searchFrom.VEHICLE_DEPARTMENT_ID"
placeholder="请选择车辆所属部门"
@change="searchUserList"/>
</el-form-item>
</el-col>
<el-col :span="3">
<!-- <el-form-item label="车辆责任人">-->
<!-- <el-input v-model="searchFrom.USER_NAME" placeholder="请输入车辆责任人..." />-->
<!-- </el-form-item>-->
<el-form-item label="车辆责任人">
<el-select :value="searchFrom.USER_ID" clearable placeholder="请选择" @visible-change="$forceUpdate()" @change="userIdSearchChange">
<el-option v-for="item in userList" :key="item.USER_ID" :label="item.NAME" :value="item.USER_ID"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="10px">
<el-button v-waves type="primary" icon="el-icon-search" @click="getQuery">
搜索
</el-button>
<el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
v-loading="listLoading"
ref="vehicleMessageTable"
:data="varList"
:row-key="getRowKey"
:header-cell-style="{
'font-weight': 'bold',
'color': '#000'
}"
tooltip-effect="dark"
border
fit
highlight-current-row
>
<el-table-column
:reserve-selection="true"
type="selection"
width="55"
align="center"/>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="LICENCE_NO" label="车牌号" align="center" />
<el-table-column label="车牌类型" align="center">
<template slot-scope="{row}">
{{ translateLicenceType(row.LICENCE_TYPE) }}
</template>
</el-table-column>
<el-table-column label="车辆类型" align="center">
<template slot-scope="{row}">
{{ translateVehicleType(row.VEHICLE_TYPE) }}
</template>
</el-table-column>
<el-table-column prop="DEPARTMENT_NAME" label="车辆所属部门" align="center" />
<el-table-column prop="USER_NAME" label="车辆责任人" align="center"/>
<el-table-column label="操作" align="center" width="480">
<template slot-scope="{row}">
<el-button type="warning" icon="el-icon-more" size="mini" @click="vehicleInOutRecordBtn(row.LICENCE_NO)"></el-button>
<el-button icon="el-icon-view" size="mini" @click="showDetail(row.VEHICLE_ID)"></el-button>
<el-button type="primary" icon="el-icon-edit" size="mini" @click="openEditDialogEditBtn(row.VEHICLE_ID)"></el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteSingleDataDeleteBtn(row.VEHICLE_ID, row.USER_ID, row.EMPLOYEE_VEHICLE_USER_ID)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="page-btn-group">
<div>
<el-button type="primary" icon="el-icon-plus" @click="openAddDialogAddBtn"></el-button>
</div>
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getPageList" />
</div>
<!-- 添加车辆信息 -->
<el-dialog :visible.sync="addDialogVisible" title="添加车辆信息" width="600px">
<el-form v-if="addDialogVisible" ref="addForm" :model="addForm" label-width="170px" style="padding:0 20px; width: 500px;">
<el-form-item :rules="[{required: true}]" label="车牌号">
<el-input v-model="addForm.LICENCE_NO" :autosize="{ minRows: 1}" type="text" maxlength="300" placeholder="这里输入车牌号..." @blur="goCheckLicenceNoAdd()"/>
</el-form-item>
<!-- 白牌蓝牌黄牌绿牌黑牌 下拉框-->
<el-form-item :rules="[{required: true}]" label="车牌类型" prop="LICENCE_TYPE">
<SelectTree
ref="selectTree_add2"
:clearable="false"
:options="licenceTypeList"
:props="vehicleDefaultProps"
v-model="addForm.LICENCE_TYPE"
placeholder="请选择车牌类型"
style="width: 300px"/>
</el-form-item>
<!-- 货车轿车大巴客车 下拉框-->
<el-form-item :rules="[{required: true}]" label="车辆类型" prop="VEHICLE_TYPE">
<SelectTree
ref="selectTree_add3"
:clearable="false"
:options="vehicleTypeList"
:props="vehicleDefaultProps"
v-model="addForm.VEHICLE_TYPE"
placeholder="请选择车辆类型"
style="width: 300px"/>
</el-form-item>
<!-- 员工车辆单位车辆外部车辆 下拉框 -->
<el-form-item :rules="[{required: true}]" label="车辆所属类型" prop="VEHICLE_BELONG_TYPE">
<SelectTree
ref="selectTree_add4"
:clearable="false"
:options="vehicleBelongTypeList"
:props="vehicleDefaultProps"
v-model="addForm.VEHICLE_BELONG_TYPE"
placeholder="请选择车辆所属类型"
style="width: 300px"/>
</el-form-item>
<!-- 车辆所属部门下拉框 -->
<el-form-item :rules="[{required: true}]" label="车辆所属部门" prop="VEHICLE_DEPARTMENT_ID">
<SelectTree
ref="selectTree_add1"
:clearable="false"
:options="departmentTreeData"
:props="defaultProps"
v-model="addForm.VEHICLE_DEPARTMENT_ID"
placeholder="请选择车辆所属部门"
style="width: 300px"
@change="addUserList"/>
</el-form-item>
<!-- 车辆责任人下拉框 -->
<el-form-item :rules="[{required: true}]" label="车辆责任人" prop="USER_ID">
<el-select :value="addForm.USER_ID" clearable placeholder="请选择" @visible-change="$forceUpdate()" @change="userIdAddChange">
<el-option v-for="item in userList" :key="item.USER_ID" :label="item.NAME" :value="item.USER_ID"/>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="addDialogCancelBtn"> </el-button>
<el-button type="primary" @click="addDialogConfirmBtn"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="editDialogVisible" title="修改" width="600px">
<el-form ref="editForm" :model="editForm" label-width="170px" style="width: 500px;">
<el-form-item :rules="[{required: true}]" label="车牌号">
<el-input v-model="editForm.LICENCE_NO" :autosize="{ minRows: 1}" type="text" maxlength="300" placeholder="这里输入车牌号..." @blur="goCheckLicenceNoUpdate()"/>
</el-form-item>
<el-form-item label="车牌类型" prop="LICENCE_TYPE">
<el-select v-model="editForm.LICENCE_TYPE" clearable placeholder="请选择" @visible-change="$forceUpdate()">
<el-option v-for="item in licenceTypeList" :key="item.ID" :label="item.NAME" :value="item.ID" />
</el-select>
</el-form-item>
<el-form-item label="车辆类型" prop="VEHICLE_TYPE">
<el-select v-model="editForm.VEHICLE_TYPE" clearable placeholder="请选择" @visible-change="$forceUpdate()">
<el-option v-for="item in vehicleTypeList" :key="item.ID" :label="item.NAME" :value="item.ID" />
</el-select>
</el-form-item>
<el-form-item label="车辆所属类型" prop="VEHICLE_BELONG_TYPE">
<el-select v-model="editForm.VEHICLE_BELONG_TYPE" clearable placeholder="请选择" @visible-change="$forceUpdate()">
<el-option v-for="item in vehicleBelongTypeList" :key="item.ID" :label="item.NAME" :value="item.ID" />
</el-select>
</el-form-item>
<!-- 车辆所属部门下拉框 -->
<el-form-item label="车辆所属部门" prop="VEHICLE_DEPARTMENT_ID">
<SelectTree
ref="selectTree_edit"
:clearable="true"
:options="departmentTreeData"
:props="defaultProps"
v-model="editForm.VEHICLE_DEPARTMENT_ID"
placeholder="请选择车辆所属部门"
style="width: 300px"
@change="updateUserList"/>
</el-form-item>
<!-- 车辆责任人下拉框 -->
<el-form-item label="车辆责任人" prop="USER_ID">
<el-select :value="editForm.USER_ID" clearable placeholder="请选择" @visible-change="$forceUpdate()" @change="userIdUpdateChange">
<el-option v-for="item in userList" :key="item.USER_ID" :label="item.NAME" :value="item.USER_ID" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editDialogCancelBtn"> </el-button>
<el-button type="primary" @click="editDialogConfirmBtn"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="detailDialogVisible" title="详情" width="600px">
<el-form ref="form" :model="detailForm" label-width="170px" style="width: 500px;">
<el-form-item label="车牌号">
<el-input v-model="detailForm.LICENCE_NO" :disabled="true" :autosize="{ minRows: 1}" type="text" maxlength="300"/>
</el-form-item>
<el-form-item label="车牌类型">
<el-input v-model="detailForm.LICENCE_TYPE" :disabled="true" :autosize="{ minRows: 1}" type="text" maxlength="300"/>
</el-form-item>
<el-form-item label="车辆类型">
<el-input v-model="detailForm.VEHICLE_TYPE" :disabled="true" :autosize="{ minRows: 1}" type="text" maxlength="300"/>
</el-form-item>
<el-form-item label="车辆所属类型">
<el-input v-model="detailForm.VEHICLE_BELONG_TYPE" :disabled="true" :autosize="{ minRows: 1}" type="text" maxlength="300"/>
</el-form-item>
<el-form-item label="车辆所属部门">
<el-input v-model="detailForm.VEHICLE_DEPARTMENT_ID" :disabled="true" :autosize="{ minRows: 1}" type="text" maxlength="300"/>
</el-form-item>
<el-form-item label="车辆责任人">
<el-input v-model="detailForm.USER_ID" :disabled="true" :autosize="{ minRows: 1}" type="text" maxlength="300"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="detailDialogReturnBtn"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import Pagination from '@/components/Pagination' // el-pagination
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
import SelectTree from '@/components/SelectTree'
export default {
components: { Pagination, SelectTree },
directives: { waves },
data() {
return {
ISCHECK: false,
userInfo: JSON.parse(sessionStorage.getItem('user')),
listLoading: true,
add: false,
del: false,
edit: false,
loginUserInfo: {}, //
roleName: '', //
loginUserId: '',
loginUserName: '',
loginDepartmentId: '',
loginDepartmentName: '',
listQuery: {
page: 1,
limit: 20
},
defaultProps: {
value: 'id',
children: 'nodes',
label: 'name'
},
total: 0,
KEYWORDS: '',
//
licenceTypeList: [
// { ID: '', NAME: '' },
{ ID: '0', NAME: '白牌' },
{ ID: '1', NAME: '蓝牌' },
{ ID: '2', NAME: '黄牌' },
{ ID: '3', NAME: '绿牌' },
{ ID: '4', NAME: '黑牌' }
],
//
vehicleTypeList: [
// { ID: '', NAME: '' },
{ ID: '0', NAME: '货车' },
{ ID: '1', NAME: '轿车' },
{ ID: '2', NAME: '大巴客车' }
],
//
vehicleBelongTypeList: [
// { ID: '', NAME: '' },
{ ID: '0', NAME: '员工车辆' },
{ ID: '1', NAME: '单位车辆' }
// { ID: '2', NAME: '' }
],
//
vehicleDefaultProps: {
value: 'ID',
label: 'NAME',
children: 'nodes'
},
departmentTreeData: [],
// inspectionTypeList: [], //
//
varList: [],
//
searchFrom: {
USER_ID: '', // id
USER_NAME: '',
VEHICLE_ID: '', // ID()
LICENCE_NO: '', //
VEHICLE_TYPE: '', //
VEHICLE_DEPARTMENT_ID: '' // ID
},
//
addForm: {
LICENCE_NO: '', //
VEHICLE_DEPARTMENT_ID: '', // id
VEHICLE_DEPARTMENT_NAME: '', //
USER_ID: '', //
LICENCE_TYPE: '', //
VEHICLE_TYPE: '', //
VEHICLE_BELONG_TYPE: '', //
EMPLOYEE_VEHICLE_USER_ID: '', // id
EMPLOYEE_VEHICLE_USER_NAME: '', //
DEPARTMENT_NAME: '', //
DEPARTMENT_ID: '',
USER_NAME: '' //
},
//
editForm: {
VEHICLE_ID: '', // id()
LICENCE_NO: '', //
OLD_LICENCE_NO: '', //
USER_ID: '', //
USER_NAME: '', //
LICENCE_TYPE: '', //
VEHICLE_TYPE: '', //
VEHICLE_BELONG_TYPE: '', //
DEPARTMENT_NAME: '', //
EMPLOYEE_VEHICLE_USER_ID: '', //
EMPLOYEE_VEHICLE_USER_NAME: '', //
VEHICLE_DEPARTMENT_ID: '', //
VEHICLE_DEPARTMENT_NAME: '' //
},
//
detailForm: {
LICENCE_NO: '', //
VEHICLE_DEPARTMENT_ID: '', //
VEHICLE_BELONG_TYPE: '', //
USER_ID: '', //
EMPLOYEE_VEHICLE_USER_ID: '', //
LICENCE_TYPE: null, //
VEHICLE_TYPE: null //
},
addDialogVisible: false, //
editDialogVisible: false, //
detailDialogVisible: false, //
userList: [], //
selectTree_edit: []
}
},
created() {
// this.getDict() //
this.loginUserInfo = JSON.parse(sessionStorage.getItem('user'))
this.getPageList() //
this.getDepartmentTreeData() //
this.getLoginUserInfo() //
},
methods: {
getRowKey(row) {
return row.VEHICLE_ID
},
translateLicenceType(id) {
for (var i = 0; i < this.licenceTypeList.length; i++) {
if (this.licenceTypeList[i].ID == id) return this.licenceTypeList[i].NAME
}
},
translateVehicleType(id) {
for (var i = 0; i < this.vehicleTypeList.length; i++) {
if (this.vehicleTypeList[i].ID == id) return this.vehicleTypeList[i].NAME
}
},
vehicleBelongType(id) {
for (var i = 0; i < this.vehicleBelongTypeList.length; i++) {
if (this.vehicleBelongTypeList[i].ID == id) return this.vehicleBelongTypeList[i].NAME
}
},
getLoginUserInfo() { //
return new Promise((resolve) => {
requestFN(
'/user/goEditMyInfo',
{}
).then((data) => {
this.loginUserId = data.pd.USER_ID
this.loginUserName = data.pd.NAME
this.loginDepartmentId = data.pd.DEPARTMENT_ID
this.loginDepartmentName = data.pd.deptName
resolve('ok')
}).catch((e) => {
})
})
},
//
getQuery() {
this.$refs.vehicleMessageTable.clearSelection() //
this.getPageList()
},
goKeyReset() {
this.resetSearch()
this.getQuery()
},
//
getPageList() {
this.roleName = ''
this.listLoading = true
requestFN(
'vehiclemessage/getPageList?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
{
...this.searchFrom,
'CORPINFO_ID': this.loginUserInfo.CORPINFO_ID,
'loginUserId': this.loginUserInfo.USER_ID,
'roleName': this.loginUserInfo.ROLENAME
}
).then((data) => {
this.listLoading = false
if (data.code === 200){
this.varList = data.varList
this.total = data.page.totalResult
this.roleName = data.roleName
// this.hasButton()
this.pd = data.pd
}
}).catch((e) => {
this.listLoading = false
})
},
//
openAddDialogAddBtn() {
this.addDialogVisible = true
this.reSetAddDialog()
this.ISCHECK = false
},
//
addDialogCancelBtn() {
this.addDialogVisible = false
},
//
detailDialogReturnBtn() {
this.detailDialogVisible = false
},
//
reSetAddDialog() {
this.addForm.LICENCE_NO = ''
this.addForm.USER_ID = ''
this.addForm.VEHICLE_DEPARTMENT_ID = ''
this.addForm.LICENCE_TYPE = ''
this.addForm.VEHICLE_TYPE = ''
this.addForm.VEHICLE_BELONG_TYPE = ''
this.addForm.EMPLOYEE_VEHICLE_USER_ID = ''
this.userList = []
this.addForm.DEPARTMENT_NAME = ''
this.addForm.DEPARTMENT_ID = ''
},
//
addDialogConfirmBtn() {
if (this.addForm.LICENCE_NO !== null && this.addForm.LICENCE_NO === '') {
this.$message({
message: '车牌号不能为空',
type: 'error'
})
return false
}
if (this.addForm.LICENCE_TYPE !== null && this.addForm.LICENCE_TYPE === '') {
this.$message({
message: '请选择车牌类型',
type: 'error'
})
return false
}
if (this.addForm.VEHICLE_TYPE !== null && this.addForm.VEHICLE_TYPE === '') {
this.$message({
message: '请选择车辆类型',
type: 'error'
})
return false
}
if (this.addForm.VEHICLE_BELONG_TYPE !== null && this.addForm.VEHICLE_BELONG_TYPE === '') {
this.$message({
message: '请选择车辆所属类型',
type: 'error'
})
return false
}
if (this.roleName !== '普通用户角色') {
if (this.addForm.VEHICLE_DEPARTMENT_ID !== null && this.addForm.VEHICLE_DEPARTMENT_ID === '') {
this.$message({
message: '请选择车辆所属部门',
type: 'error'
})
return false
}
if (this.addForm.USER_ID !== null && this.addForm.USER_ID === '') {
this.$message({
message: '请选择车辆责任人',
type: 'error'
})
return false
}
} else {
this.addForm.VEHICLE_DEPARTMENT_ID = this.loginDepartmentId // id
this.addForm.VEHICLE_DEPARTMENT_NAME = this.loginDepartmentName //
this.addForm.USER_ID = this.loginUserId // id
this.addForm.USER_NAME = this.loginUserName //
}
if (this.addForm.VEHICLE_BELONG_TYPE === '0') { // ()
this.addForm.EMPLOYEE_VEHICLE_USER_ID = this.addForm.USER_ID // id
this.addForm.EMPLOYEE_VEHICLE_USER_NAME = this.addForm.USER_NAME //
} else { //
this.addForm.EMPLOYEE_VEHICLE_USER_ID = '' // id
this.addForm.EMPLOYEE_VEHICLE_USER_NAME = '' //
}
this.addRequest()
},
addRequest() {
requestFN(
'vehiclemessage/addVehicleMessage',
{
...this.addForm,
'CORPINFO_ID': this.loginUserInfo.CORPINFO_ID,
'loginUserId': this.loginUserInfo.USER_ID,
'roleName': this.loginUserInfo.ROLENAME
}
).then((data) => {
if (data.result === 'fail') {
this.$message({
message: data.msg,
type: 'error'
})
} else {
this.$message.success('车辆信息添加成功')
this.getPageList() //
this.addDialogVisible = false
}
}).catch((e) => {
})
},
//
openEditDialogEditBtn(VEHICLE_ID) {
this.editForm = {
VEHICLE_ID: VEHICLE_ID, // id()
LICENCE_NO: '', //
OLD_LICENCE_NO: '', //
USER_ID: '', //
USER_NAME: '', //
EMPLOYEE_VEHICLE_USER_ID: '', // id
EMPLOYEE_VEHICLE_USER_NAME: '', //
VEHICLE_BELONG_TYPE: '',
VEHICLE_DEPARTMENT_ID: '', //
VEHICLE_DEPARTMENT_NAME: '', //
}
this.userList = []
this.editDialogVisible = true
//
requestFN(
'vehiclemessage/updateShowVehicleMessage',
{
VEHICLE_ID: VEHICLE_ID
}
).then((data) => {
if (data.result === 'success') {
this.editForm.LICENCE_NO = data.pd.LICENCE_NO //
this.editForm.OLD_LICENCE_NO = data.pd.LICENCE_NO //
this.editForm.USER_ID = data.pd.USER_ID //
this.editForm.LICENCE_TYPE = String(data.pd.LICENCE_TYPE) //
this.editForm.VEHICLE_TYPE = String(data.pd.VEHICLE_TYPE) //
this.editForm.VEHICLE_BELONG_TYPE = data.pd.VEHICLE_BELONG_TYPE === undefined ? '' : data.pd.VEHICLE_BELONG_TYPE //
if ('VEHICLE_DEPARTMENT_ID' in data.pd) { // id
const nodes = {}
nodes.id = data.pd.VEHICLE_DEPARTMENT_ID
// this.$refs.selectTree_edit.clearHandle()
this.editForm.VEHICLE_DEPARTMENT_ID = data.pd.VEHICLE_DEPARTMENT_ID
this.$nextTick(() => { // 使
this.$refs.selectTree_edit.handleNodeClick(nodes)
})
}
} else {
this.$message({
message: '数据回显失败',
type: 'error'
})
}
}).catch((e) => {
})
},
editDialogCancelBtn() {
this.editDialogVisible = false
},
// ()
showDetail(VEHICLE_ID) {
// this.$parent.activeName = 'Info'
// this.$parent.INSPECTION_ID = row.INSPECTION_ID
this.detailForm = {
LICENCE_NO: '', //
VEHICLE_DEPARTMENT_ID: '', //
VEHICLE_BELONG_TYPE: '', //
USER_ID: '', //
USER_NAME: '', //
EMPLOYEE_VEHICLE_USER_ID: '', //
LICENCE_TYPE: null, //
VEHICLE_TYPE: null //
}
this.detailDialogVisible = true
//
requestFN(
'vehiclemessage/detailVehicleMessage',
{
VEHICLE_ID: VEHICLE_ID
}
).then((data) => {
if (data.result === 'success') {
this.detailForm.LICENCE_NO = data.pd.LICENCE_NO //
this.detailForm.VEHICLE_DEPARTMENT_ID = data.pd.DEPARTMENT_NAME //
this.detailForm.USER_ID = data.pd.USER_NAME //
this.detailForm.LICENCE_TYPE = this.translateLicenceType(data.pd.LICENCE_TYPE) //
this.detailForm.VEHICLE_TYPE = this.translateVehicleType(data.pd.VEHICLE_TYPE) //
this.detailForm.VEHICLE_BELONG_TYPE = data.pd.VEHICLE_BELONG_TYPE === undefined ? '' : this.vehicleBelongType(data.pd.VEHICLE_BELONG_TYPE)
} else {
this.$message({
message: '数据回显失败',
type: 'error'
})
}
}).catch((e) => {
})
},
judgeEdit() {
if (this.editForm.VEHICLE_BELONG_TYPE === '0') { // ()
this.editForm.EMPLOYEE_VEHICLE_USER_ID = this.editForm.USER_ID // id
this.editForm.EMPLOYEE_VEHICLE_USER_NAME = this.editForm.USER_NAME //
} else { //
this.editForm.EMPLOYEE_VEHICLE_USER_ID = '' // id
this.editForm.EMPLOYEE_VEHICLE_USER_NAME = '' //
}
},
//
editDialogConfirmBtn() {
this.judgeEdit()
this.$refs.editForm.validate(valid => {
if (valid) {
const loading = this.$loading({
lock: true,
text: '数据保存中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.listLoading = true
requestFN(
'vehiclemessage/updateVehicleMessage',
{
...this.editForm,
'CORPINFO_ID': this.loginUserInfo.CORPINFO_ID,
'loginUserId': this.loginUserInfo.USER_ID,
'roleName': this.loginUserInfo.ROLENAME
}
).then((data) => {
if (data.result === 'success') {
this.$message({
message: '修改成功',
type: 'success'
})
} else {
this.$message({
message: data.msg,
type: 'success'
})
}
this.listLoading = false
loading.close()
this.editDialogVisible = false
this.getQuery()
}).catch((e) => {
this.listLoading = false
loading.close()
})
} else {
return false
}
})
},
//
deleteSingleDataDeleteBtn(id, USER_ID, EMPLOYEE_VEHICLE_USER_ID) {
this.$confirm('确定要删除吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
requestFN(
'vehiclemessage/deleteVehicleMessage',
{
VEHICLE_ID: id,
USER_ID: USER_ID,
EMPLOYEE_VEHICLE_USER_ID: EMPLOYEE_VEHICLE_USER_ID,
'CORPINFO_ID': this.loginUserInfo.CORPINFO_ID,
'loginUserId': this.loginUserInfo.USER_ID,
'roleName': this.loginUserInfo.ROLENAME
}
).then((data) => {
if (data.result === 'success') {
this.$message({
message: '删除成功',
type: 'success'
})
} else {
this.$message({
message: data.msg,
type: 'success'
})
}
this.listLoading = false
this.varList = []
this.listQuery.page = 1
this.getPageList()
}).catch((e) => {
this.listLoading = false
})
}).catch(() => {
})
},
//
// getDict: function() {
// requestFN(
// '/dictionaries/listSelectTree',
// {
// DICTIONARIES_ID: '60e6481d96e44a5390ff5c347c4d1ffe' //
// }
// ).then((data) => {
// this.inspectionTypeList = JSON.parse(data.zTreeNodes)
// }).catch((e) => {
//
// })
// },
//
getDepartmentTreeData() {
requestFN(
'/department/listTree',
{}
).then((data) => {
this.departmentTreeData = JSON.parse(data.zTreeNodes)
}).catch((e) => {
})
},
resetSearch() {
this.searchFrom.LICENCE_NO = ''
this.searchFrom.USER_ID = ''
this.searchFrom.USER_NAME = ''
this.$refs.selectTree_Search1.clearHandle() //
this.$refs.selectTree_Search2.clearHandle()
},
searchUserList(DEPARTMENT_ID) { //
this.getUserList(DEPARTMENT_ID)
this.handleDepartmentSearchChange(DEPARTMENT_ID)
},
addUserList(DEPARTMENT_ID) {
this.getUserList(DEPARTMENT_ID)
this.handleDepartmentAddChange(DEPARTMENT_ID)
},
updateUserList(DEPARTMENT_ID) {
this.getUserList(DEPARTMENT_ID)
this.handleDepartmentUpdateChange(DEPARTMENT_ID)
},
getUserList(DEPARTMENT_ID) { //
requestFN(
'/user/listAllByDepartmentId',
{
DEPARTMENT_ID: DEPARTMENT_ID,
tm: new Date().getTime()
}
).then((data) => {
this.userList = data.userList
}).catch((e) => {
// this.listLoading = false
})
},
//
userIdAddChange(event) {
this.addForm.USER_ID = event
this.handleUserAddChange(event)
},
userIdSearchChange(event) {
this.searchFrom.USER_ID = event
this.handleUserSearchChange(event)
},
//
employeeUserIdAddChange(event) {
this.addForm.EMPLOYEE_VEHICLE_USER_ID = event
this.handleEmployeeUserAddChange(event)
},
//
userIdUpdateChange(event) {
this.editForm.USER_ID = event
this.handleUserUpdateChange(event)
},
handleDepartmentSearchChange(value) {
this.searchFrom.VEHICLE_DEPARTMENT_NAME = this.findLabelByValue(this.departmentTreeData, value)
},
handleDepartmentAddChange(value) {
this.addForm.VEHICLE_DEPARTMENT_NAME = this.findLabelByValue(this.departmentTreeData, value)
},
handleDepartmentUpdateChange(value) {
this.editForm.VEHICLE_DEPARTMENT_NAME = this.findLabelByValue(this.departmentTreeData, value)
},
findLabelByValue(tree, value) {
for (const node of tree) {
if (node.id === value) {
return node.name
}
if (node.nodes && node.nodes.length > 0) {
const result = this.findLabelByValue(node.nodes, value)
if (result) {
return result
}
}
}
return ''
},
handleUserAddChange(value) {
const selectedUser = this.userList.find(user => user.USER_ID === value)
if (selectedUser) {
this.addForm.USER_NAME = selectedUser.NAME
} else {
this.addForm.USER_NAME = ''
}
},
handleUserSearchChange(value) {
const selectedUser = this.userList.find(user => user.USER_ID === value)
if (selectedUser) {
this.searchFrom.USER_NAME = selectedUser.NAME
} else {
this.searchFrom.USER_NAME = ''
}
},
handleEmployeeUserAddChange(value) {
const selectedUser = this.userList.find(user => user.USER_ID === value)
if (selectedUser) {
this.addForm.EMPLOYEE_VEHICLE_USER_NAME = selectedUser.NAME
} else {
this.addForm.EMPLOYEE_VEHICLE_USER_NAME = ''
}
},
handleUserUpdateChange(value) {
const selectedUser = this.userList.find(user => user.USER_ID === value)
if (selectedUser) {
this.editForm.USER_NAME = selectedUser.NAME
} else {
this.editForm.USER_NAME = ''
}
},
resetForm(row) {
this.searchFrom = {
LICENCE_NO: '', //
VEHICLE_TYPE: '', //
VEHICLE_DEPARTMENT_ID: '' //
}
},
goCheckLicenceNoAdd() {
if (this.addForm.LICENCE_NO) {
const regex = /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})$/
const result = regex.test(this.addForm.LICENCE_NO)
if (result) {
console.log('格式校验通过')
requestFN(
'vehiclemessage/goCheckLicenceNo',
{
'LICENCE_NO': this.addForm.LICENCE_NO
}
).then((data) => {
if (data.code === 200) {
this.$message.success('验证通过')
this.ISCHECK = true
} else {
this.$message.error('车牌号已存在,请重新输入')
this.ISCHECK = false
}
}).catch((e) => {
console.info(e)
this.listLoading = false
this.ISCHECK = false
})
} else {
this.$message.success('车牌号不规范')
this.ISCHECK = false
}
}
},
goCheckLicenceNoUpdate() {
if (this.editForm.LICENCE_NO) {
if (this.editForm.LICENCE_NO !== this.editForm.OLD_LICENCE_NO) {
const regex = /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1})$/
const result = regex.test(this.editForm.LICENCE_NO)
if (result) {
console.log('格式校验通过')
requestFN(
'vehiclemessage/goCheckLicenceNo',
{
'LICENCE_NO': this.editForm.LICENCE_NO
}
).then((data) => {
if (data.code === 200) {
this.$message.success('验证通过')
this.ISCHECK = true
} else {
this.$message.error('车牌号已存在,请重新输入')
this.ISCHECK = false
}
}).catch((e) => {
console.info(e)
this.listLoading = false
this.ISCHECK = false
})
} else {
this.$message.success('车牌号不规范')
this.ISCHECK = false
}
}
}
},
//
vehicleInOutRecordBtn(LICENCE_NO) {
this.$parent.activeName = 'Record'
this.$parent.LICENCE_NO = LICENCE_NO
}
}
}
</script>

View File

@ -0,0 +1,201 @@
<template>
<div class="app-container">
<el-form label-width="100px">
<el-row>
<el-col :span="4">
<el-form-item label="口门名称:" label-width="110px">
<el-input v-model="searchForm.KEYWORDS" style="width:206px" placeholder="请输入内容"/>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="口门状态" label-width="110px">
<el-select v-model="searchForm.GATE_STATUS" placeholder="请选择">
<el-option v-for="(item,index) in StatusList" :key="index" :label="item.label" :value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="所属区域" label-width="110px">
<el-select v-model="searchForm.REGION_BIANMA" placeholder="请选择">
<el-option v-for="(item,index) in RegionList" :key="index" :label="item.NAME" :value="item.BIANMA"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="10px">
<el-button v-waves type="primary" icon="el-icon-search" @click="getQuery">
搜索
</el-button>
<el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
v-loading="listLoading"
ref="queryTable"
:data="varList"
:cell-style="getPlateColor"
:row-key="getRowKey"
:header-cell-style="{
'font-weight': 'bold',
'color': '#000'
}"
tooltip-effect="dark"
border
fit
highlight-current-row
>
<el-table-column
:reserve-selection="true"
type="selection"
width="55"
align="center"/>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="REGION_NAME" label="区域" width="100px" align="center"/>
<el-table-column prop="AREA_NAME" label="口门名称" width="100px" align="center"/>
<el-table-column prop="AREA_LEVEL_NAME" label="口门级别" width="100px" align="center"/>
<el-table-column prop="vehicle_plate_number" label="车牌号" width="100px" align="center"/>
<!-- <el-table-column prop="vehicle_category_name" label="车辆类型" width="150px" align="center"/>-->
<el-table-column prop="VEHICLE_TYPE_NAME" label="车辆类型" width="150px" align="center"/>
<!-- <el-table-column prop="vehicle_filing_method" label="车辆所属类型" width="100px" align="center"/>-->
<el-table-column prop="VEHICLE_BELONG_TYPE_NAME" label="车辆所属类型" width="100px" align="center"/>
<el-table-column prop="vehicle_arrival_status" label="车辆在港状态" width="100px" align="center"/>
<el-table-column prop="VEHICLE_DEPARTMENT_NAME" label="车辆所属部门" align="center"/>
<!-- <el-table-column prop="vehicle_filing_info_recording_org" label="车辆所属部门" align="center"/>-->
<el-table-column prop="USER_NAME" label="车辆责任人" width="150ox" align="center"/>
<!-- <el-table-column prop="vehicle_contact_name" label="车辆联系人" width="150ox" align="center"/>-->
<!-- <el-table-column prop="vehicle_contact_phone_number" label="联系人手机号" width="120px" align="center"/>-->
<el-table-column prop="vehicle_arrival_barrier" label="入港闸口" align="center"/>
<el-table-column prop="vehicle_arrival_time" label="入港时间" align="center"/>
<el-table-column prop="vehicle_departure_barrier" label="离港闸口" align="center"/>
<el-table-column prop="vehicle_departure_time" label="离港时间" align="center"/>
</el-table>
<div class="page-btn-group">
<div>
<el-button plain type="info" @click="returnBtn"></el-button>
</div>
<pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getPageList" />
</div>
</div>
</template>
<script>
import Pagination from '@/components/Pagination' // el-pagination
import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive
export default {
components: { Pagination },
directives: { waves },
data() {
return {
listLoading: true,
add: false,
del: false,
edit: false,
listQuery: {
page: 1,
limit: 20
},
total: 0,
KEYWORDS: '',
loginUserInfo: {}, //
//
varList: [],
//
searchForm: {
LICENCE_NO: '', //
KEYWORDS: '',
GATE_STATUS: '',
REGION_BIANMA: ''
},
RegionList: [],
StatusList: [
{ value: '0', label: '停用' },
{ value: '1', label: '正常' },
{ value: '2', label: '暂时关闭' }
]
}
},
created() {
this.loginUserInfo = JSON.parse(sessionStorage.getItem('user'))
this.getDict()
this.searchForm.LICENCE_NO = this.$parent.LICENCE_NO
this.getPageList() //
},
methods: {
getRowKey(row) {
return row.id_sequence
},
//
getQuery() {
this.$refs.queryTable.clearSelection() //
this.getPageList()
},
resetSearch() {
this.searchForm.KEYWORDS = ''
this.searchForm.GATE_STATUS = ''
this.searchForm.REGION_BIANMA = ''
},
goKeyReset() {
this.resetSearch()
this.getQuery()
},
//
getPageList() {
this.listLoading = true
requestFN(
'/vehiclemessage/getInOutPageList?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
{
...this.searchForm,
'CORPINFO_ID': this.loginUserInfo.CORPINFO_ID,
'loginUserId': this.loginUserInfo.USER_ID,
'roleName': this.loginUserInfo.ROLENAME
}
).then((data) => {
this.listLoading = false
this.varList = data.varList
this.total = data.page.totalResult
// this.hasButton()
}).catch((e) => {
this.listLoading = false
})
},
//
returnBtn() {
this.$parent.activeName = 'List'
},
getPlateColor(row, column, rowIndex, columnIndex) {
if (row.column.label === '车牌号') {
const colorMap = {
蓝牌: 'background-color: blue;color: white',
黄牌: 'background-color: yellow;color: black',
新能源: 'background-color: green;color: white',
白牌: 'background-color: gray;color: black',
黑牌: 'background-color: black;color: white',
其他: 'background-color: white;color: black',
default: 'background-color: white;color: black'
}
// const plateColor = row.row.vehicle_plate_color || 'default'
const plateColor = row.row.LICENCE_TYPE_NAME || 'default'
const backgroundColorAndColor = colorMap[plateColor] || colorMap.default
return backgroundColorAndColor
}
},
getDict() {
requestFN(
'dictionaries/getLevels',
{
DICTIONARIES_ID: '1c73fa2717f2835165104aee234caefe'
}
).then((data) => {
this.RegionList = data.list
})
.catch((e) => {
this.listLoading = false
})
}
}
}
</script>

View File

@ -0,0 +1,35 @@
<template>
<div>
<List v-show="activeName==='List'" ref="list" />
<Record v-if="activeName==='Record'" />
</div>
</template>
<script>
import List from './components/list'
import Record from './components/record'
export default {
components: {
List,
Record
},
data() {
return {
activeName: 'List',
INSPECTION_ID: '',
LICENCE_NO: ''
}
},
watch: {
activeName(newValue, oldValue) {
if (newValue == 'List') {
this.$refs.list.getQuery()
}
}
}
}
</script>
<style scoped>
</style>