rollback
parent
78df620162
commit
4fdd9fbaae
@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<div>
|
||||
<vxe-modal
|
||||
:width="840"
|
||||
:height="600"
|
||||
show-zoom
|
||||
:fullscreen="$store.getters.device === 'mobile'"
|
||||
:z-index="zIndex"
|
||||
v-model="showModal"
|
||||
:footer-hide="true"
|
||||
title="预览"
|
||||
>
|
||||
<template>
|
||||
<iframe
|
||||
style="width: 100%; height: 100%;"
|
||||
:src="codeUri"
|
||||
frameborder="0"
|
||||
></iframe>
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { PopupManager } from "element-ui/lib/utils/popup";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
zIndex: PopupManager.nextZIndex(),
|
||||
showModal:false,
|
||||
codeUri: "",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(url) {
|
||||
this.codeUri = `${process.env.VUE_APP_PREVIEW}?url=${encodeURIComponent(
|
||||
new Buffer(url).toString("base64")
|
||||
)}`;
|
||||
this.showModal = true;
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
this.$bus.$on('online-file',(url) => this.open(url))
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$bus.$off('online-file')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {},
|
||||
computed: {},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<div>
|
||||
<card-container>
|
||||
<vxe-toolbar>
|
||||
<template #buttons>
|
||||
<el-button icon="el-icon-plus" type="primary" size="small" @click="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="name" width="170" title="名字" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="key" width="150" title="标识" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="value" width="150" title="值" :edit-render="{ name: 'input', attrs: { type: 'text' } }" />
|
||||
<vxe-column field="mysort" width="80" title="排序" align="center" :edit-render="{ name: 'input', attrs: { type: 'number' } }" />
|
||||
<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-certificate ref="AddVehicleCertificate" :is-show.sync="isShowAdd" @refresh="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { deepCopy } from '@/utils'
|
||||
import { index, save, destroy } from '@/api/vehicleCertificate'
|
||||
import AddVehicleCertificate from './components/AddVehicleCertificate.vue'
|
||||
export default {
|
||||
components: {
|
||||
AddVehicleCertificate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowAdd: false,
|
||||
|
||||
loading: false,
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
total: 0,
|
||||
allAlign: null,
|
||||
tableData: [],
|
||||
validRules: {},
|
||||
form: {
|
||||
id: '',
|
||||
vehicle_id: '',
|
||||
name: '',
|
||||
grant_at: '',
|
||||
expire_at: '',
|
||||
renewed_at: '',
|
||||
renewed_id: '',
|
||||
grant_by: '',
|
||||
serial: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isActiveStatus() {
|
||||
return function(row) {
|
||||
if (this.$refs['table']) {
|
||||
return this.$refs['table'].isEditByRow(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
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 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 {
|
||||
const errMap = await this.$refs['table'].validate()
|
||||
if (errMap) {
|
||||
throw new Error(errMap)
|
||||
}
|
||||
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>
|
||||
@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div>
|
||||
<card-container>
|
||||
<vxe-toolbar>
|
||||
<template #buttons>
|
||||
<el-date-picker v-model="select.month" type="month" size="small" value-format="yyyy-MM"></el-date-picker>
|
||||
<el-button icon="el-icon-search" type="primary" plain size="small" style="margin-left: 6px;" @click="getStatistics">搜索</el-button>
|
||||
</template>
|
||||
</vxe-toolbar>
|
||||
<vxe-table
|
||||
ref="table"
|
||||
stripe
|
||||
style="margin-top: 10px;"
|
||||
round
|
||||
:max-height="600"
|
||||
keep-source
|
||||
show-header-overflow
|
||||
show-footer-overflow
|
||||
show-overflow
|
||||
:row-config="{ isHover: true }"
|
||||
:header-cell-style="{ 'white-space': 'wrap' }"
|
||||
:scroll-x="{ enabled: true, gt: 0 }"
|
||||
:column-config="{ resizable: true }"
|
||||
:data="tableData.admins">
|
||||
<vxe-column type="seq" width="50" align="center" fixed="left"></vxe-column>
|
||||
<vxe-column field="name" title="姓名" fixed="left" align="center" width="120"></vxe-column>
|
||||
<vxe-column field="department.name" title="所在部门" align="center" width="150"></vxe-column>
|
||||
<vxe-colgroup v-for="item in dateTableColumns" align="center" :title="item.title">
|
||||
<vxe-column title="上午" width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.attendance[item.date] instanceof Array ? '' : row.attendance[item.date][0].sign_in_at }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column title="下午" width="160" align="center">
|
||||
<template #default="{ row }">
|
||||
<span>{{ row.attendance[item.date] instanceof Array ? '' : row.attendance[item.date][0].sign_out_at }}</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-colgroup>
|
||||
</vxe-table>
|
||||
</card-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { statistics } from '@/api/attendance'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
month: this.$moment().format('YYYY-MM')
|
||||
},
|
||||
tableData: {
|
||||
admins: [],
|
||||
dates: []
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getStatistics() {
|
||||
try {
|
||||
const res = await statistics(this.select)
|
||||
this.tableData = res
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dateTableColumns() {
|
||||
return this.tableData.dates.map(i => ({
|
||||
title: `${this.$moment(i.day).format('YYYY年MM月DD日')} ${i.is_workday ? '工作日' : '公休'}`,
|
||||
field: i.day,
|
||||
date: i.date
|
||||
}))
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getStatistics()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<vxe-modal
|
||||
:z-index="zIndex"
|
||||
:value="isShow"
|
||||
show-footer
|
||||
title="公共文件柜"
|
||||
show-confirm-button
|
||||
:width="600"
|
||||
:height="400"
|
||||
:fullscreen="$store.getters.device === 'mobile'"
|
||||
esc-closable
|
||||
@input="e => $emit('update:isShow',e)"
|
||||
>
|
||||
<el-form ref="elForm" :model="form" :rules="rules" label-position="top" label-width="100">
|
||||
<el-form-item label="所属栏目" prop="document_menu_id" required>
|
||||
<Treeselect
|
||||
v-model="form.document_menu_id"
|
||||
:options="list"
|
||||
:multiple="false"
|
||||
no-children-text="无子菜单"
|
||||
:normalizer="node => ({
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.children,
|
||||
isDefaultExpanded: true
|
||||
})"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name" required>
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="文件" prop="file_id">
|
||||
<el-upload
|
||||
:action="action"
|
||||
:headers="{
|
||||
Authorization: `Bearer ${getToken()}`
|
||||
}"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="uploadSuccess"
|
||||
multiple
|
||||
:file-list="fileList">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">上传文件不超过10Mb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="myindex">
|
||||
<el-input-number v-model="form.myindex" :controls="false" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="loading" @click="submit">确认</el-button>
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { save } from '@/api/document'
|
||||
import { PopupManager } from "element-ui/lib/utils/popup";
|
||||
export default {
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true
|
||||
},
|
||||
users: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
action: process.env.VUE_APP_UPLOAD_API,
|
||||
fileList: [],
|
||||
|
||||
zIndex: PopupManager.nextZIndex(),
|
||||
loading: false,
|
||||
form: {
|
||||
document_menu_id: '',
|
||||
name: '',
|
||||
file_id: '',
|
||||
update_children_ids: '',
|
||||
myindex: ''
|
||||
},
|
||||
rules: {
|
||||
document_menu_id: [
|
||||
{ required: true, message: '请选择栏目' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '请输入名称' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if(newVal) {
|
||||
this.zIndex = PopupManager.nextZIndex()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getToken,
|
||||
beforeUpload(file) {
|
||||
const isLt10M = file.size / 1024 / 1024 < 10
|
||||
if (!isLt10M) {
|
||||
this.$message.error('上传头像图片大小不能超过 10MB!')
|
||||
}
|
||||
return isLt10M
|
||||
},
|
||||
uploadSuccess(response, file, fileList) {
|
||||
this.fileList = fileList
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs['elForm'].validate(async valid => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
try {
|
||||
await Promise.all(this.fileList.map(i => save({
|
||||
...this.form,
|
||||
file_id: i.response?.data?.id
|
||||
})))
|
||||
// await save(this.form)
|
||||
this.$message.success('新增成功')
|
||||
this.$emit('refresh')
|
||||
this.$emit('update:isShow', false)
|
||||
this.loading = false
|
||||
this.$refs['elForm'].resetFields()
|
||||
} catch (err) {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
Loading…
Reference in new issue