main
parent
f7bc528572
commit
ecc813dc89
@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function index(params) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/oa/vehicle/index',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function show(params) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/oa/vehicle/show',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function save(data, isLoading = true) {
|
||||||
|
return request({
|
||||||
|
method: 'post',
|
||||||
|
url: '/api/oa/vehicle/save',
|
||||||
|
data,
|
||||||
|
isLoading
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function destroy(params, isLoading = true) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/oa/vehicle/destroy',
|
||||||
|
params,
|
||||||
|
isLoading
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function index(params) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/oa/vehicle-certificate/index',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function show(params) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/oa/vehicle-certificate/show',
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function save(data, isLoading = true) {
|
||||||
|
return request({
|
||||||
|
method: 'post',
|
||||||
|
url: '/api/oa/vehicle-certificate/save',
|
||||||
|
data,
|
||||||
|
isLoading
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function destroy(params, isLoading = true) {
|
||||||
|
return request({
|
||||||
|
method: 'get',
|
||||||
|
url: '/api/oa/vehicle-certificate/destroy',
|
||||||
|
params,
|
||||||
|
isLoading
|
||||||
|
})
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,35 +1,64 @@
|
|||||||
|
@import "variables";
|
||||||
#navbar-menu {
|
#navbar-menu {
|
||||||
.sidebar-item {
|
.sidebar-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|
||||||
|
.el-menu-item:hover ,.el-submenu__title:hover {
|
||||||
|
color: $menuActiveText !important;
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.el-menu-item, .el-submenu__title {
|
.el-menu-item, .el-submenu__title {
|
||||||
height: 50px;
|
height: 54px;
|
||||||
line-height: 50px;
|
line-height: 54px;
|
||||||
}
|
}
|
||||||
.el-submenu__icon-arrow {
|
.el-submenu__icon-arrow {
|
||||||
position: initial;
|
display: none;
|
||||||
margin-top: 0;
|
}
|
||||||
|
}
|
||||||
|
.navbar {
|
||||||
|
.el-menu--horizontal {
|
||||||
|
border-bottom: none !important;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-menu--collapse .el-menu .el-submenu, .el-menu--popup {
|
.el-menu--collapse .el-menu .el-submenu, .el-menu--popup {
|
||||||
text-align: center;
|
min-width: 124px !important;
|
||||||
min-width: 120px !important;
|
background-color: $subMenuBg !important;
|
||||||
|
}
|
||||||
|
.el-menu--horizontal .el-menu .el-menu-item, .el-menu--horizontal .el-menu .el-submenu__title {
|
||||||
|
color: $subMenuText !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#navbar-menu-mobile {
|
#navbar-menu-mobile {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
box-shadow: 0 1px 6px rgba(0,0,0,.2);
|
||||||
|
|
||||||
.el-menu {
|
.el-menu {
|
||||||
border-right: none;
|
border-right: none;
|
||||||
|
|
||||||
.el-menu-item, .el-submenu__title{
|
.el-menu-item, .el-submenu__title{
|
||||||
font-size: var(--tblr-nav-link-font-size);
|
|
||||||
height: auto;
|
height: auto;
|
||||||
line-height: inherit;
|
line-height: inherit;
|
||||||
min-height: 2rem;
|
min-height: 2rem;
|
||||||
padding: .5rem calc(calc(var(--tblr-page-padding)* 2) / 2);
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.el-submenu.is-active .el-submenu__title {
|
.el-submenu.is-active .el-submenu__title {
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
color: var(--theme-color);
|
color: var(--theme-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.el-menu {
|
||||||
|
background-color: #fff !important;
|
||||||
|
}
|
||||||
|
.sidebar-item {
|
||||||
|
|
||||||
|
.el-menu-item ,.el-submenu__title {
|
||||||
|
color: #333 !important;
|
||||||
|
background-color: #fff !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,229 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<card-container>
|
||||||
|
<vxe-toolbar>
|
||||||
|
<template #buttons>
|
||||||
|
<el-button icon="el-icon-plus" type="primary" size="small" @click="$refs['AddVehicle'].setType('vehicle'),isShowAdd = true">新增车辆</el-button>
|
||||||
|
<el-button icon="el-icon-plus" type="primary" size="small" @click="$refs['AddVehicle'].setType('boat'),isShowAdd = true">新增艇</el-button>
|
||||||
|
|
||||||
|
<el-button icon="el-icon-search" type="primary" plain size="small" @click="getList">搜索</el-button>
|
||||||
|
</template>
|
||||||
|
</vxe-toolbar>
|
||||||
|
<vxe-table
|
||||||
|
ref="table"
|
||||||
|
stripe
|
||||||
|
style="margin-top: 10px;"
|
||||||
|
:loading="loading"
|
||||||
|
keep-source
|
||||||
|
show-overflow
|
||||||
|
:column-config="{ resizable: true }"
|
||||||
|
:edit-rules="validRules"
|
||||||
|
:edit-config="{ trigger: 'manual', mode: 'row', showStatus: true, isHover: true, autoClear: false }"
|
||||||
|
:align="allAlign"
|
||||||
|
:data="tableData"
|
||||||
|
>
|
||||||
|
<vxe-column type="seq" width="58" align="center" />
|
||||||
|
<vxe-column field="date" width="170" title="日期" :edit-render="{}">
|
||||||
|
<template #edit="{ row }">
|
||||||
|
<el-date-picker style="width: 100%;" v-model="row.date" value-format="yyyy-MM-dd" />
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<vxe-column field="type" title="类型" width="120" :edit-render="{}">
|
||||||
|
<template #edit="{ row }">
|
||||||
|
<el-select v-model="row.type">
|
||||||
|
<el-option value="workday" label="工作日" />
|
||||||
|
<el-option value="holiday" label="节假日" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<vxe-column field="reason" min-width="180" title="说明" align="center" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||||
|
<vxe-column field="operate" title="操作" min-width="220">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<template v-if="isActiveStatus(row)">
|
||||||
|
<el-button size="small" type="primary" @click="saveRowEvent(row)">保存</el-button>
|
||||||
|
<el-button size="small" type="primary" plain @click="cancelRowEvent(row)">取消</el-button>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-button size="small" type="warning" @click="editRowEvent(row)">编辑</el-button>
|
||||||
|
<el-button size="small" type="danger" @click="destroyRowEvent(row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
style="margin-top: 10px;"
|
||||||
|
:current-page="select.page"
|
||||||
|
:page-sizes="[20, 30, 40, 50]"
|
||||||
|
:page-size="select.page_size"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
:total="total"
|
||||||
|
@size-change="e => {
|
||||||
|
select.page_size = e;
|
||||||
|
select.page = 1;
|
||||||
|
getList();
|
||||||
|
}"
|
||||||
|
@current-change="e => {
|
||||||
|
select.page = e;
|
||||||
|
getList();
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</card-container>
|
||||||
|
<add-vehicle ref="AddVehicle" :departments="departments" :is-show.sync="isShowAdd" @refresh="getList" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { index as departmentIndex } from '@/api/department'
|
||||||
|
import { deepCopy } from '@/utils'
|
||||||
|
import { index, save, destroy } from '@/api/vehicle'
|
||||||
|
import AddVehicle from './components/AddVehicle.vue'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
AddVehicle
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
departments: [],
|
||||||
|
isShowAdd: false,
|
||||||
|
|
||||||
|
loading: false,
|
||||||
|
select: {
|
||||||
|
page: 1,
|
||||||
|
page_size: 20
|
||||||
|
},
|
||||||
|
total: 0,
|
||||||
|
allAlign: null,
|
||||||
|
tableData: [],
|
||||||
|
validRules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入角色' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
license: '',
|
||||||
|
driver: '',
|
||||||
|
photo_file_id: '',
|
||||||
|
start_date: '',
|
||||||
|
insurance_expire: '',
|
||||||
|
maintain_expire: '',
|
||||||
|
status: 1,
|
||||||
|
department_id: '',
|
||||||
|
discard_date: '',
|
||||||
|
inspect_date: '',
|
||||||
|
is_open_detail: '',
|
||||||
|
type: '',
|
||||||
|
end_date: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isActiveStatus() {
|
||||||
|
return function(row) {
|
||||||
|
if (this.$refs['table']) {
|
||||||
|
return this.$refs['table'].isEditByRow(row)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDepartments()
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
editRowEvent(row) {
|
||||||
|
if (this.$refs['table']) {
|
||||||
|
this.$refs['table'].setEditRow(row)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelRowEvent(row) {
|
||||||
|
if (this.$refs['table']) {
|
||||||
|
this.$refs['table'].clearEdit().then(() => {
|
||||||
|
// 还原行数据
|
||||||
|
this.$refs['table'].revertData(row)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async getDepartments() {
|
||||||
|
try {
|
||||||
|
this.departments = await departmentIndex({
|
||||||
|
page: 1,
|
||||||
|
page_size: 9999
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getList() {
|
||||||
|
this.loading = true
|
||||||
|
try {
|
||||||
|
const res = await index(this.select)
|
||||||
|
this.tableData = res.data
|
||||||
|
this.total = res.total
|
||||||
|
this.loading = false
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async saveRowEvent(row) {
|
||||||
|
try {
|
||||||
|
await this.$confirm('确认保存?', '提示', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
})
|
||||||
|
await this.$refs['table'].clearEdit()
|
||||||
|
const form = deepCopy(this.form)
|
||||||
|
for (const key in form) {
|
||||||
|
form[key] = row[key]
|
||||||
|
}
|
||||||
|
if (!form.password) {
|
||||||
|
delete form.password
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
await save(form)
|
||||||
|
await this.getList()
|
||||||
|
this.loading = false
|
||||||
|
} catch (err) {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async destroyRowEvent(row) {
|
||||||
|
try {
|
||||||
|
await this.$confirm('确认删除?', '提示', {
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
})
|
||||||
|
this.loading = true
|
||||||
|
if (row.id) {
|
||||||
|
await destroy({
|
||||||
|
id: row.id
|
||||||
|
})
|
||||||
|
await this.getList()
|
||||||
|
} else {
|
||||||
|
console.log(row)
|
||||||
|
this.tableData.splice(this.tableData.findIndex(i => i._X_ROW_KEY === row._X_ROW_KEY), 1)
|
||||||
|
}
|
||||||
|
this.loading = false
|
||||||
|
} catch (err) {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.total {
|
||||||
|
color: #666;
|
||||||
|
text-align: right;
|
||||||
|
line-height: 3;
|
||||||
|
}
|
||||||
|
::v-deep .el-tag + .el-tag {
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in new issue