<template>
|
<div class="app-container">
|
<div style="margin-bottom: 10px">
|
<el-form style="display: flex;flex-wrap: wrap;">
|
<el-form-item>
|
<el-button
|
type="primary"
|
plain
|
icon="Plus"
|
@click="openDialog('add',{})"
|
v-hasPermi="['sealApply:list:add']"
|
>新增</el-button>
|
</el-form-item>
|
<el-form-item label="单位名称:" v-if="data.isAdmin" style="margin-left: 20px">
|
<el-select v-model="data.queryParams.companyId" placeholder="请选择" filterable clearable>
|
<el-option
|
v-for="item in data.companyList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item v-if="data.isAdmin">
|
<el-button type="primary" style="margin-left: 30px" @click="searchClick">查询</el-button>
|
<el-button plain @click="reset">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<el-radio-group v-model="data.tabName" style="margin-bottom: 30px" @change="changBtn">
|
<el-radio-button label="all" v-if="data.userType == 0 || data.userType == 6">全部</el-radio-button>
|
<el-radio-button label="apply" >我申请的</el-radio-button>
|
<el-radio-button label="approval">待审批的</el-radio-button>
|
</el-radio-group>
|
<!-- 表格数据 -->
|
<el-table v-loading="loading" :data="dataList" :border="true" @selection-change="handleSelectionChange">
|
<!-- <el-table-column type="selection" width="55" />-->
|
<el-table-column type="index" label="序号" width="80" align="center"></el-table-column>
|
<el-table-column label="印章类型" prop="sealName" align="center" />
|
<el-table-column label="用章事由" prop="useSealCause" align="center" />
|
<el-table-column label="申请人" prop="applyUserName" align="center" />
|
<el-table-column label="用章时间" prop="useSealTime" align="center" />
|
<el-table-column label="状态" prop="status" align="center" >
|
<template #default="scope">
|
<span>{{scope.row.status == 1 ? '审批中' :scope.row.status == 2 ?'已审批' : ''}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" >
|
<template #default="scope">
|
<div v-if="data.tabName === 'apply' || data.tabName === 'all'">
|
<el-button link type="primary" @click="openDialog('review',scope.row)">查看</el-button>
|
<el-button link type="primary" v-if="scope.row.status == 1" @click="openDialog('edit',scope.row)" v-hasPermi="['sealApply:list:edit']">编辑</el-button>
|
<el-button link type="danger" @click="handleDelete(scope.row)" v-hasPermi="['sealApply:list:del']">删除</el-button>
|
</div>
|
<div v-if="data.tabName === 'approval'">
|
<el-button link type="primary" @click="openDialog('review',scope.row)">查看</el-button>
|
<el-button link type="primary" @click="openApplyDialog(scope.row)" v-hasPermi="['sealApply:list:apply']">审批</el-button>
|
</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<div class="pag-container">
|
<el-pagination
|
v-model:current-page="data.queryParams.pageNum"
|
v-model:page-size="data.queryParams.pageSize"
|
:page-sizes="[10,15,20,25]"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
<editDialog ref="noticeRef" @getList = "getList"></editDialog>
|
<el-dialog
|
v-model="data.showDialog"
|
width="500px"
|
:before-close="handleClose"
|
>
|
<el-form :model="data.applyForm" :rules="data.rules" size="default" ref="busRef" label-width="110px" >
|
<el-form-item label="审批意见:" prop="approveStatus" >
|
<el-radio-group v-model="data.applyForm.approveStatus" >
|
<el-radio :label="1">同意</el-radio>
|
<el-radio :label="2">不同意</el-radio>
|
</el-radio-group>
|
|
</el-form-item>
|
<el-form-item prop="approveMess" >
|
<el-input type="textarea" :rows="3" v-model="data.applyForm.approveMess"></el-input>
|
</el-form-item>
|
</el-form>
|
<template #footer >
|
<span class="dialog-footer">
|
<el-button @click="handleClose" size="default">取 消</el-button>
|
<el-button type="primary" @click="onSubmit" size="default" v-preReClick>确认</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script setup>
|
import {getCurrentInstance, onMounted, reactive, ref, toRefs} from "vue";
|
import editDialog from "./components/editDialog.vue"
|
import {ElMessage, ElMessageBox} from "element-plus";
|
import {getCompany} from "@/api/onlineEducation/company";
|
import Cookies from "js-cookie";
|
import {generateWordDocument} from "@/utils/exportWord";
|
import {delObject, getObjectPage} from "@/api/qualityObjectives/object";
|
import {delSealApply, getSealApply, reviewApply} from "@/api/sealManage/apply";
|
const { proxy } = getCurrentInstance();
|
const loading = ref(false);
|
const noticeRef = ref();
|
const busRef = ref();
|
const loadingCompany = ref(false)
|
const choosedData = ref([])
|
const data = reactive({
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
companyId: null,
|
nextCheck:null,
|
applyUserId: null
|
},
|
tabName:'',
|
companyList: [],
|
isAdmin: false,
|
userId: null,
|
showDialog: false,
|
userType: null,
|
applyForm: {
|
useSealId: null,
|
approveUserId: null,
|
approveStatus: null,
|
approveMess:''
|
},
|
rules: {
|
approveStatus:[{ required: true, message: '请选择审批意见', trigger: 'blur' }],
|
approveMess:[{ required: true, message: '请输入意见内容', trigger: 'blur' }],
|
},
|
});
|
const dataList = ref([]);
|
const total = ref(0);
|
|
const { queryParams } = toRefs(data);
|
|
onMounted(() => {
|
const userInfo = JSON.parse(Cookies.get('userInfo'))
|
console.log("userInfo",userInfo)
|
data.isAdmin = userInfo.userType === 0;
|
data.userType = userInfo.userType
|
data.tabName = userInfo.userType == 0 || userInfo.userType == 6 ?'all':'apply'
|
data.userId = userInfo.id
|
data.queryParams.applyUserId = userInfo.id
|
if(data.isAdmin){
|
data.queryParams.companyId = null
|
}else {
|
data.queryParams.companyId = userInfo.companyId
|
}
|
getList();
|
if(data.isAdmin){
|
getCompanyList()
|
}
|
});
|
const getList = async () => {
|
loading.value = true;
|
const param = {
|
pageNum: data.queryParams.pageNum,
|
pageSize: data.queryParams.pageSize,
|
companyId: data.queryParams.companyId,
|
nextCheck: data.tabName === 'approval' ?data.userId : null,
|
applyUserId:data.tabName === 'apply' ?data.queryParams.applyUserId : null,
|
}
|
const res = await getSealApply(param);
|
if(res.code === 200){
|
dataList.value = res.data.list
|
total.value = res.data.total
|
}else{
|
ElMessage.warning(res.message)
|
}
|
loading.value = false;
|
|
}
|
|
const searchClick = () => {
|
getList();
|
}
|
const openDialog = (type, value) => {
|
noticeRef.value.openDialog(type, value,data.companyList);
|
}
|
const selectValue = (val) => {
|
data.companyList.forEach(item => {
|
if(item.name === val){
|
data.queryParams.companyId = item.id
|
}
|
})
|
}
|
|
const getCompanyList = async ()=>{
|
const queryParams = {
|
pageNum: 1,
|
pageSize: 999
|
}
|
const res = await getCompany(queryParams)
|
if (res.code == 200) {
|
data.companyList = res.data.list?res.data.list:[]
|
// data.queryParams.companyId = data.companyList[0].id
|
} else {
|
ElMessage.warning(res.message)
|
}
|
}
|
|
const handleSizeChange = (val) => {
|
data.queryParams.pageSize = val
|
getList()
|
}
|
const handleCurrentChange = (val) => {
|
data.queryParams.pageNum = val
|
getList()
|
}
|
|
/** 重置新增的表单以及其他数据 */
|
function reset() {
|
if(data.isAdmin){
|
data.queryParams = {
|
companyId: '',
|
pageNum: 1,
|
pageSize: 10,
|
nextCheck:null,
|
applyUserId: null
|
}
|
choosedData.value = []
|
data.companyList = [];
|
getCompanyList()
|
}else {
|
data.queryParams = {
|
companyId: data.queryParams.companyId,
|
pageNum: 1,
|
pageSize: 10,
|
nextCheck:null,
|
applyUserId: null
|
}
|
}
|
getList();
|
|
}
|
|
const changBtn = () => {
|
getList()
|
}
|
const handleSelectionChange = (val) => {
|
choosedData.value = val
|
}
|
const handleDelete = (val) => {
|
ElMessageBox.confirm(
|
'确定删除此条数据?',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then( async() => {
|
const res = await delSealApply(val.id);
|
if(res.code === 200){
|
ElMessage({
|
type: 'success',
|
message: '删除成功'
|
});
|
getList();
|
}else{
|
ElMessage.warning(res.message)
|
}
|
})
|
}
|
const openApplyDialog = (val)=>{
|
data.applyForm = {
|
useSealId: val.id,
|
approveUserId: data.userId,
|
approveStatus: null,
|
approveMess:''
|
}
|
data.showDialog = true
|
}
|
const handleClose = () => {
|
data.applyForm = {
|
useSealId: null,
|
approveUserId: null,
|
approveStatus: null,
|
approveMess:''
|
}
|
data.showDialog = false
|
}
|
const onSubmit = async () => {
|
const valid = await busRef.value.validate();
|
if(valid){
|
const res = await reviewApply(data.applyForm)
|
if(res.code === 200){
|
ElMessage({
|
type: 'success',
|
message: '审批成功'
|
});
|
await getList();
|
data.showDialog = false
|
}else{
|
ElMessage.warning(res.message)
|
}
|
}
|
|
}
|
</script>
|
<style lang="scss">
|
.pag-container{
|
float: right;
|
margin-top: 10px;
|
}
|
</style>
|