1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00
Files
Pinnacle-OA/ui/src/components/ApproverApproved.vue
2023-05-23 15:16:00 +08:00

270 lines
8.4 KiB
Vue

<template>
<el-row :span="24">
<el-col :span="18">
<div class="mt-4">
<el-input placeholder="查询事务" class="input-with-select">
<template #prepend>
<el-select placeholder="查询方式">
<el-option label="事务编号" value="1" />
<el-option label="事务名称" value="2" />
<el-option label="日期" value="3" />
</el-select>
</template>
<template #append>
<el-button>查询</el-button>
</template>
</el-input>
</div>
</el-col>
<el-col :span="4">
<el-button type="warning" round>待审批</el-button>
<el-button type="success" round>已审批</el-button>
</el-col>
</el-row>
<el-table :data="tableData" style="width: 100%">
<el-table-column label="事务编号" prop="id" />
<el-table-column label="事务名称" prop="title" />
<el-table-column label="事务类型" prop="typeId">
<template #default="scope">
{{
scope.row.typeId === 1
? '事假'
: scope.row.typeId === 2
? '病假'
: scope.row.typeId === 3
? '财务报销'
: '调休'
}}
</template>
</el-table-column>
<el-table-column label="申请者" prop="applicantId">
<el-text v-for="(user, index) in users" :key="index" :content="user.username" />
</el-table-column>
<el-table-column label="提交日期" prop="createTime">
<template #default="scope">
{{ format(scope.row.createTime) }}
</template>
</el-table-column>
<el-table-column label="审批日期" prop="inspectTime">
<template #default="scope">
{{ format(scope.row.inspectTime) }}
</template>
</el-table-column>
<el-table-column label="操作" key="slot" width="180" prop="content">
<template #default="scope">
<el-button size="small" type="text" @click="dialogTure(scope.row)"
>具体内容
</el-button>
<el-button size="small" type="danger" @click="handleDelete(scope.row)">
删除
</el-button>
</template>
</el-table-column>
<el-table-column label="审批结果" width="90" prop="status">
<template #default="scope">
{{ scope.row.status === 1 ? '同意' : '驳回' }}
</template>
</el-table-column>
</el-table>
<el-dialog title="详细内容" v-model="dialogVisible" width="50%" :data="dialogData" center>
<el-row>
<el-col :span="3"></el-col>
<el-col :span="4">事务标题:</el-col>
<el-col :span="17">{{ dialogData.title }}</el-col>
</el-row>
<el-row>
<el-col :span="3"></el-col>
<el-col :span="4">具体内容:</el-col>
</el-row>
<el-row>
<el-col :span="7"></el-col>
<el-col :span="17">{{ dialogData.content }}</el-col>
</el-row>
<el-row>
<el-col :span="11"></el-col>
<el-col :span="2">
<span class="dialog-footer">
<el-button @click="dialogFalse"> </el-button>
</span>
</el-col>
</el-row>
</el-dialog>
<el-divider :data="labelData">
<div class="block">
<el-pagination
style="color: #888888"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-size="100"
layout="prev, pager, next, jumper"
:total="1000"
>
</el-pagination>
</div>
</el-divider>
</template>
<script>
import request from '@/services'
import 'element-plus/theme-chalk/index.css'
export default {
data() {
return {
tableData: [
{
id: '',
title: '',
content: '',
typeId: '',
status: '',
applicantId: '',
inspectorId: '',
createTime: new Date(),
inspectTime: new Date(),
priority: '',
modifyTime: '',
originId: '',
old: '',
deleted: '',
version: ''
}
],
// }],
labelData: [
{
currentPage1: 5,
currentPage2: 5,
currentPage3: 5,
currentPage4: 4
}
],
dialogVisible: false,
dialogData: [
{
id: '',
title: '',
content: '',
typeId: '',
status: '',
applicantId: '',
inspectorId: '',
createTime: new Date(),
inspectTime: new Date(),
priority: '',
modifyTime: '',
originId: '',
old: '',
deleted: '',
version: ''
}
],
users: [
{
id: '',
username: ''
}
],
currentUser: [
{
id: '',
username: ''
}
]
}
},
methods: {
handleYes(row) {
console.log(row)
request
.put('/affair/yes', row)
.then((response) => {
console.log(response.data)
this.getApproved()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleNo(row) {
console.log(row)
request
.put('/affair/no', row)
.then((response) => {
console.log(response.data)
this.getApproved()
})
.catch((reportError) => {
console.log(reportError)
})
},
handleDelete(row) {
console.log(row.id)
request
.delete('/affair/' + row.id)
.then((response) => {
console.log(response.data)
this.getApproved()
})
.catch((reportError) => {
console.log(reportError)
})
},
getUser() {
request
.get('/affair/add/get_user')
.then((response) => {
this.users = response.data.data
})
.catch((reportError) => {
console.log(reportError)
}) // 数据库中获取用户
},
handleSizeChange(val) {
console.log(`每页 ${val}`)
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
},
getApproved() {
request
.get('/affair/approved')
.then((response) => {
this.tableData = response.data.data
console.log(this.tableData)
})
.catch((reportError) => {
console.log(reportError)
})
},
format(time) {
return new Date(time).toLocaleString()
}, // 时间格式转换
dialogTure(data) {
this.dialogVisible = true
this.dialogData = data
},
dialogFalse() {
this.dialogVisible = false
}
},
created() {
this.getApproved()
this.dialogFalse()
this.getUser()
console.log(this.tableData)
}
}
</script>
<style></style>