pms-front/src/views/workAppraisal/managerUser.vue

321 lines
7.3 KiB
Vue

<template>
<div class="project-list">
<div class="search-bar">
<el-form
:inline="true"
:model="searchForm"
class="demo-form-inline"
size="small"
>
<el-form-item label="考核人员" class="form-item">
<el-input
v-model="searchForm.userName"
placeholder="考核人员"
readonly
@click.native="openUserSelectDialog"
style="width: 300px"
><el-button slot="append" icon="el-icon-s-custom"></el-button
></el-input>
</el-form-item>
<el-form-item label="状态" class="form-item">
<el-select
v-model="searchForm.examineStatus"
placeholder="状态"
clearable
style="width: 300px"
>
<el-option
v-for="item in statusList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item class="search-buttons">
<el-button type="primary" @click="onSearch">查询</el-button>
<el-button @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="f1 df">
<CustomTable
:columns="columns"
:tableData="tableData"
:total="total"
:show-selection="false"
:show-index="true"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
@sortChange="sortChange"
tableHeight="495px"
>
<template slot="operation" slot-scope="{ row }">
<div class="operation-buttons">
<el-button
v-if="isEdit == 1 && row.examineStatus == '0'"
@click="handleEdit(row, 1)"
type="text"
size="mini"
>去评分</el-button
>
<el-button
v-if="row.examineStatus == '1' || isEdit == 0"
type="text"
size="mini"
@click="handleEdit(row, 0)"
>查看详情</el-button
>
</div>
</template>
</CustomTable>
</div>
<SelectUser
:dialogVisible="userSelectDialogVisible"
:currentSelectedUser="currentSelectedUser"
:showSelection="true"
:highligt="false"
@confirm="handleUserConfirm"
@close="handleUserClose"
/>
</div>
</template>
<script>
import CustomTable from "@/components/CustomTable.vue";
import SelectUser from "@/components/SelectUser.vue";
import { taskApi } from "@/utils/api";
export default {
components: {
CustomTable,
SelectUser,
},
data() {
return {
searchForm: {
userIdList: [],
userName: "",
examineStatus: "",
},
taskId: "",
isEdit: "",
columns: [
{ prop: "userName", label: "考核人员" },
{ prop: "manageScore", label: "考核评分", sortable: "custom" },
{
prop: "examineStatus",
label: "状态",
type: "status",
callback: (value) => {
if (value == 0) var color = "#EA741D";
else var color = "#999";
return `<span style="color: ${color}">${
value == 0 ? "" : ""
}</span>`;
},
},
{
prop: "operation",
label: "",
width: "250",
className: "operation-column",
},
],
tableData: [],
total: 0,
userSelectDialogVisible: false,
currentSelectedUser: [],
pageNum: 1, //
pageSize: 10, //
statusList: [
{ label: "", value: "" },
{ label: "", value: "0" },
{ label: "", value: "1" },
],
isAsc: "",
};
},
methods: {
onSearch() {
this.taskUserList();
},
onReset() {
Object.keys(this.searchForm).forEach((key) => {
this.searchForm[key] = "";
});
this.currentSelectedUser = [];
this.taskUserList();
},
handleEdit(row, edit) {
this.$router.push({
path: "/workAppraisal/detail",
query: {
edit,
examineTaskId: this.taskId,
examineId: row.id,
reviewType: 0,
},
});
},
taskUserList() {
taskApi
.getTaskUserList({
...this.searchForm,
taskId: this.taskId,
pageNum: this.pageNum,
pageSize: this.pageSize,
isAsc: this.isAsc,
sortFiled: "manageScore",
})
.then((res) => {
this.tableData = res.rows;
this.total = res.total;
});
},
handleSizeChange(size) {
this.pageSize = size;
this.pageNum = 1; // 重置为第一页
this.taskUserList();
},
handleCurrentChange(page) {
this.pageNum = page;
this.taskUserList();
},
openUserSelectDialog() {
this.userSelectDialogVisible = true;
},
handleUserConfirm(data) {
this.searchForm.userName = data.map((ele) => ele.nickName).join(",");
this.searchForm.userIdList = data.map((ele) => ele.userId);
},
handleUserClose() {
this.userSelectDialogVisible = false;
},
sortChange({ order }) {
this.isAsc =
order == "descending" ? "desc" : order == "ascending" ? "asc" : "";
this.taskUserList();
},
},
created() {
this.taskId = this.$route.query.taskId;
this.isEdit = this.$route.query.isEdit;
},
mounted() {
this.taskUserList();
},
};
</script>
<style lang="scss" scoped>
.project-list {
padding: 20px;
background-color: white;
height: 88vh;
box-sizing: border-box;
overflow: hidden;
display: flex;
flex-direction: column;
}
.search-bar {
margin-bottom: 20px;
}
.demo-form-inline {
// display: flex;
// flex-wrap: nowrap;
// align-items: flex-start;
}
.demo-form-inline .el-form-item {
// margin-right: 50px; /* 将间距设置为 30px */
// margin-bottom: 0;
}
.demo-form-inline .el-form-item:last-child {
margin-right: 0; /* 移除最后一个元素的右边距 */
}
.form-item {
flex: 1;
}
.form-item ::v-deep .el-form-item__content {
// width: 100%;
}
.form-item ::v-deep .el-input,
.form-item ::v-deep .el-select {
// width: 100%;
}
.search-buttons {
white-space: nowrap;
}
::v-deep .operation-column {
background-color: #ffffff;
box-shadow: -2px 0 5px rgba(241, 112, 6, 0.1);
}
.el-button.is-text {
min-width: 32px !important;
}
.dialog-footer {
display: flex;
justify-content: center;
align-items: center;
}
.dialog-footer .el-button {
margin: 0 10px;
}
.delete-content {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.warning-icon {
font-size: 24px;
color: #e6a23c;
margin-right: 10px;
}
/* 添加以下样式来使对话框垂直居中 */
::v-deep .delete-dialog.el-dialog {
margin-top: 0 !important;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
::v-deep .el-table th {
text-align: center;
}
::v-deep .el-table .cell {
text-align: center;
}
::v-deep .operation-buttons .el-button {
padding: 4px 8px;
margin: 0 2px;
font-weight: 600;
font-size: 14px;
}
.search-buttons ::v-deep .el-button {
width: 90px !important;
height: 36px;
}
.waitBtn {
color: #999;
}
</style>