勘察审核完成

维修审核完成
This commit is contained in:
2024-10-15 10:47:31 +08:00
parent 96e5df3a45
commit d09e144aaf
2 changed files with 117 additions and 25 deletions
+115 -24
View File
@@ -54,12 +54,15 @@
>
<el-table-column
label="序号"
prop="userId"
width="120"
width="80"
align="center"
show-overflow-tooltip
sortable
/>
>
<template #default="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="头像" width="200" align="center">
<template #default="scope">
@@ -69,27 +72,41 @@
<el-table-column
label="微信昵称"
prop="nickname"
width="300"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="名字"
prop="name"
width="300"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="手机号"
prop="mobile"
width="300"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="注册时间"
prop="date"
label="申请岗位"
prop="roleId"
:formatter="postFormater"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="申请时间"
prop="createTime"
:formatter="formatDate"
width="auto"
align="center"
show-overflow-tooltip
sortable
/>
<el-table-column
label="状态"
prop="status"
:formatter="statusFormater"
width="auto"
align="center"
show-overflow-tooltip
@@ -103,8 +120,9 @@
show-overflow-tooltip
>
<template v-slot:default="scope">
<el-button type="success">通过</el-button>
<el-button type="danger" @click="openModel(scope.$index)">驳回</el-button>
<el-button type="success" v-if="scope.row.status === 0" @click="handleApprove(scope.row)">通过</el-button>
<el-button type="danger" v-if="scope.row.status === 0" @click="handleReject(scope.row)">驳回</el-button>
<!-- <el-button type="danger" @click="openModel(scope.$index)">驳回</el-button>-->
</template>
</el-table-column>
</el-table>
@@ -122,10 +140,13 @@
<script setup>
import { ref, onMounted } from 'vue';
import { getUserList } from '../../api/modules/user';
import {getApplyList, reject, approve} from "../../api/modules/postApply";
// 示例数据
// import {options} from './options.js'
// const exampleData = ref(JSON.parse(JSON.stringify(options)))
import { ElMessage, ElMessageBox } from 'element-plus'
import {options} from './options.js'
const columnData = ref(JSON.parse(JSON.stringify(options)))
const tableData = ref([]);
const searchWechatNickname = ref('');
@@ -138,19 +159,82 @@ const queryData = ref({
});
const initData = () => {
tableData.value = columnData.value;
// getUserList(queryData.value).then((res) => {
// tableData.value = res.data.data;
// });
// 加载示例数据
// tableData.value = exampleData.value;
getApplyList(queryData.value).then((res) => {
console.log("调试:总数=", res.data.total, "data.record.length=", res.data.records.length);
const filteredData = res.data.records.filter(record => record.roleId === 3);
// total.value = res.data.total
tableData.value = filteredData;
});
};
const formatDate = (row, column, cellValue) => {
const date = new Date(cellValue);
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
}
const statusFormater = (row, column, cellValue) => {
// 0待审核(审核中) 1驳回 2通过
if (cellValue === 1) {
return '已驳回';
} else if (cellValue === 2) {
return '已通过';
} else {
return '待审核';
}
}
const postFormater = (row, column, cellValue) => {
if (cellValue === 2) {
return '勘察工程师';
} else if (cellValue === 3) {
return '维修工程师';
} else {
return '工程师';
}
}
const searchEvnt = () => {
console.log('点击搜索');
queryData.value.keyWord = searchWechatNickname.value || searchName.value || searchMobile.value;
initData();
};
const handleApprove = (item) => {
ElMessageBox.confirm('确定要通过该申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
approve(item.id).then((res) => {
item.status = 2;
ElMessage({
type: 'success',
message: '申请已被通过!'
})
})
}).catch(() => {
});
}
const handleReject = (item) => {
ElMessageBox.confirm('确定要拒绝该申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
reject(item.id).then((res) => {
item.status = 1;
ElMessage({
type: 'success',
message: '申请已被拒绝!'
})
})
}).catch(() => {
});
}
// 驳回原因
const openModel = (index) => {
ElMessageBox.prompt('请输入驳回原因', '', {
@@ -158,12 +242,19 @@ const openModel = (index) => {
cancelButtonText: '取消',
inputType: 'textarea',
})
.then(({value}) => {
ElMessage({
type: 'success',
message: `驳回成功`,
})
.then(({ value }) => {
// 用户确认后,调用 rejectApplication 函数
if (value) { // 确保用户输入了驳回原因
reject(applicationId, value);
} else {
ElMessage({
type: 'warning',
message: '请输入驳回原因',
});
}
})
.catch(() => {
// 用户取消操作,无需处理
});
};
+2 -1
View File
@@ -163,8 +163,9 @@ const initData = () => {
// tableData.value = exampleData.value;
getApplyList(queryData.value).then((res) => {
console.log("调试:总数=", res.data.total, "data.record.length=", res.data.records.length);
const filteredData = res.data.records.filter(record => record.roleId === 2);
// total.value = res.data.total
tableData.value = res.data.records;
tableData.value = filteredData;
});
};