Files
fe-manage/src/views/examine/ProjectReviewed.vue

736 lines
19 KiB
Vue

<!--
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-16 21:00:40
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-11-16 21:09:49
* @FilePath: /fe-manage/src/views/examine/ProjectReviewed.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!-- 已审核项目页面 projectviewed-->
<template>
<div class="projectviewed">
<div class="tmpl">
<div class="tmpl_header">
<div class="tmplh_inp">
<div class="inpbox">
<div class="inpbox1">
<a-input
v-model:value="valueproj"
style="
width: 270px;
height: 40px;
border-radius: 8px;
margin-right: 14px;
"
placeholder="请输入项目名称/所属项目"
/>
</div>
<div class="inpbox1">
<a-input
v-model:value="valuename"
style="
width: 270px;
height: 40px;
border-radius: 8px;
margin-right: 14px;
"
placeholder="请输入项目经理"
/>
</div>
<div class="inpbox1">
<a-input
v-model:value="valuecreater"
style="
width: 270px;
height: 40px;
border-radius: 8px;
margin-right: 14px;
"
placeholder="请输入创建人"
/>
</div>
<div class="inpbox1">
<a-range-picker
v-model:value="valueDate"
style="border-radius: 8px; height: 40px; margin-left: 5px"
:placeholder="[' 开始时间', ' 结束时间']"
@change="rankTimeChange"
/>
</div>
<div class="inpbox1">
<a-select
v-model:value="valuestate"
placeholder="请选择审核状态"
@change="handleChangeproj"
:options="optionsproj"
/>
</div>
</div>
</div>
<div class="tmplh_btn">
<div class="btn btn1" @click="search">
<div class="search"></div>
<div class="btnText btnText1">搜索</div>
</div>
<div class="btn btn2" @click="reset">
<div class="search"></div>
<div class="btnText btnText2">重置</div>
</div>
</div>
</div>
<div class="tmpl_body">
<div class="tmpl_tabbox">
<a-table
:columns="columns1"
:data-source="tableData1"
:loading="tableDataTotal === -1 ? true : false"
expandRowByClick="true"
@expand="expandTable"
:scroll="{ x: 1300 }"
:pagination="false"
/>
</div>
<div class="tableBox">
<div class="pa">
<a-pagination
v-if="total > 10"
showSizeChanger="true"
show-quick-jumper
:pageSize="pageSize"
v-model:current="currentPage"
:total="total"
class="pagination"
@change="changePagination"
/>
</div>
</div>
</div>
</div>
<!-- 审核日志弹窗 -->
<a-modal
v-model:visible="projAuditModal"
:footer="null"
:closable="closeBack"
wrapClassName="projAuditModal"
centered="true"
>
<div class="delete">
<div class="del_header"></div>
<div class="del_main">
<div class="header">
<div class="icon"></div>
<span>审核记录</span>
<div class="close_exit" @click="closeProjAuditModal"></div>
</div>
<div class="body">
<a-table
style="width: 90%"
:columns="columnsAudit"
:data-source="tableDataAudit"
:loading="tableDataTotalAudit === -1 ? true : false"
expandRowByClick="true"
:scroll="{ y: 150 }"
@expand="expandTable"
:pagination="false"
/>
</div>
<div class="del_btnbox">
<div class="del_btn btn1" @click="closeProjAuditModal">
<div class="btnText">取消</div>
</div>
<div class="del_btn btn2" @click="closeProjAuditModal">
<div class="btnText">确定</div>
</div>
</div>
</div>
</div>
</a-modal>
</div>
</template>
<script>
import { reactive, toRefs, onMounted } from "vue";
import { listView, auditList } from "../../api/indexAudit";
import { toDate } from "@/api/method";
import dayjs from "dayjs";
export default {
name: "ProjectViewed",
setup() {
const state = reactive({
optionsproj: [
{
value: "jack",
label: "Jack",
},
{
value: "rose",
label: "rose",
},
],
valueproj: null,
valuecreater: null,
valuename: null,
valueDate: [],
valuestate: null,
currentPage: 1,
total: null,
pageSize: 10,
projAuditModal: false,
closeBack: false,
columns1: [
{
title: "序号",
dataIndex: "number",
key: "number",
align: "center",
},
{
title: "项目名称",
dataIndex: "name",
key: "name",
align: "center",
},
{
title: "所属项目",
dataIndex: "belong",
key: "belong",
align: "center",
width: "10%",
},
{
title: "项目经理",
dataIndex: "manager",
key: "manager",
align: "center",
},
{
title: "审核状态",
dataIndex: "status",
key: "status",
align: "center",
},
{
title: "创建人",
dataIndex: "creater",
key: "creater",
align: "center",
},
{
title: "审核时间",
dataIndex: "time",
key: "time",
align: "center",
},
{
title: "审核说明",
dataIndex: "msg",
key: "msg",
align: "center",
},
{
title: "操作",
dataIndex: "opt",
key: "opt",
align: "center",
customRender: (value) => {
return (
<div>
<span
onClick={() => {
showProjAuditModal(value.record.id);
}}
style="cursor:pointer;color:#387DF7"
>
审核日志
</span>
</div>
);
},
},
],
//审核记录的表
columnsAudit: [
{
title: "审核人",
dataIndex: "name",
key: "name",
align: "center",
},
{
title: "审核状态",
dataIndex: "belong",
key: "belong",
align: "center",
// width: "10%",
},
{
title: "审核时间",
dataIndex: "time",
key: "time",
align: "center",
},
{
title: "备注",
dataIndex: "description",
key: "description",
align: "center",
},
],
//审核记录的数据
tableDataAudit: [],
tableData1: [
{
number: "1",
name: "课程1",
belong: "管理者进阶/管理者进阶腾飞班",
manager: "黄华,刘军",
status: "通过",
creater: "管理员",
time: "-",
msg: "-",
},
],
});
const getProjList = (obj) => {
let objn = obj || {
beginTime: 0,
createName: "",
endTime: "",
manager: "",
name: "",
pageNo: state.currentPage,
pageSize: 10,
status: 0,
};
listView(objn)
.then((res) => {
console.log("获取已审核项目成功", res.data.data.rows);
let result = res.data.data;
state.total = res.data.data.total;
if (result.total > 0) {
setTableData(result.rows);
}
})
.catch((err) => {
console.log("获取已审核项目失败", err);
});
};
const setTableData = (tabledata) => {
let data = tabledata;
let array = [];
data.map((item) => {
let obj = {
number: item.projectId,
// 需要加上
// name: getName(item),
// belong: getBelong(item),
manager: item.manager || "-",
status:
item.status == 0
? "草稿"
: item.status == 1
? "待审核"
: item.status == 2
? "通过"
: item.status == 3
? "发布"
: item.status == -1
? "已结束"
: item.status == -2
? "拒绝"
: "-",
creater: item.createName,
time: toDate(item.beginTime, "Y-M-D h:m"),
msg: item.description || "-",
id: item.projectId,
};
array.push(obj);
});
state.tableData1 = array;
};
const getName = (item) => {
if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
!Object.prototype.hasOwnProperty.call(
item.subList[0].subList[0],
"name"
)
) {
// 两层
return item.subList[0].name;
} else if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
Object.prototype.hasOwnProperty.call(item.subList[0].subList[0], "name")
) {
//三层
return item.subList[0].subList[0].name;
// return item.name
} else {
// 单层
return item.name;
}
};
const getBelong = (item) => {
if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
!Object.prototype.hasOwnProperty.call(
item.subList[0].subList[0],
"name"
)
) {
// 两层
return item.name;
} else if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
Object.prototype.hasOwnProperty.call(item.subList[0].subList[0], "name")
) {
//三层
return item.subList[0].name + "/" + item.subList[0].subList[0].name;
// return item.name
} else {
// 单层
return item.name;
}
};
const changePagination = (pagina) => {
state.currentPage = pagina;
getProjList();
};
const search = () => {
let obj = {
beginTime: dayjs(state.valueDate[0]).format("YYYY-MM-DD"),
createName: state.valuecreater,
endTime: dayjs(state.valueDate[1]).format("YYYY-MM-DD"),
manager: state.valuename,
name: state.valueproj,
pageNo: state.currentPage,
pageSize: 10,
status: 0,
};
getProjList(obj);
};
const reset = () => {
state.valueproj = null;
state.valuecreater = null;
state.valuename = null;
state.valueDate = null;
state.valuestate = null;
getProjList();
};
const closeProjAuditModal = () => {
state.projAuditModal = false;
};
const showProjAuditModal = (id) => {
state.projAuditModal = true;
auditList({
pageNo: 1,
pageSize: 10,
project_id: id,
})
.then((res) => {
console.log("获取到了审核日志列表", res);
let result = res.data.data;
// if (result.total > 0) {
setAudit(result.rows);
// }
})
.catch((err) => {
console.log("审核日志列表获取失败", err);
});
};
const setAudit = (table) => {
let data = table;
let array = [];
data.map((item) => {
let obj = {
name: item.create_name,
belong:
item.status == 1
? "提交待审核"
: item.status == 2
? "通过"
: item.status == 3
? "拒绝"
: "-",
time: item.createTime,
description: item.description,
};
array.push(obj);
});
state.tableDataAudit = array;
};
onMounted(() => {
getProjList();
});
return {
...toRefs(state),
getProjList,
setTableData,
getName,
getBelong,
changePagination,
search,
reset,
closeProjAuditModal,
showProjAuditModal,
setAudit,
};
},
};
</script>
<style lang="scss">
.projAuditModal {
.ant-modal {
width: 816px !important;
min-height: 420px !important;
.ant-modal-content {
width: 816px !important;
min-height: 420px !important;
.ant-modal-body {
width: 816px !important;
min-height: 420px !important;
padding: 0 !important;
.delete {
z-index: 999;
width: 816px;
min-height: 420px;
background: #ffffff;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.21);
border-radius: 4px;
// position: absolute;
// left: 50%;
// top: 10%;
// transform: translate(-50%, -50%);
.del_header {
position: absolute;
width: calc(100%);
height: 68px;
background: linear-gradient(
rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100%
);
}
.del_main {
width: 100%;
position: relative;
.header {
display: flex;
align-items: center;
padding-top: 20px;
padding-left: 26px;
font-size: 16px;
.icon {
width: 16px;
height: 16px;
margin-right: 10px;
background-image: url(@/assets/images/taskpage/gan.png);
background-size: 100% 100%;
}
.close_exit {
position: absolute;
right: 42px;
cursor: pointer;
width: 20px;
height: 20px;
background-image: url(@/assets/images/coursewareManage/close.png);
background-size: 100% 100%;
}
}
.body {
width: 100%;
margin: 34px auto 56px auto;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
// background-color: red;
position: relative;
.ant-table-empty {
width: 100% !important;
}
.back {
position: absolute;
top: 30px;
font-size: 12px;
font-weight: 400;
color: #666666;
}
}
.del_btnbox {
display: flex;
margin: 30px auto;
justify-content: center;
.del_btn {
width: 100px;
height: 40px;
background: rgba(64, 158, 255, 0);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
cursor: pointer;
.btnText {
font-size: 14px;
font-weight: 400;
line-height: 40px;
}
}
.btn1 {
border: 1px solid rgba(64, 158, 255, 1);
color: #4ea6ff;
margin-right: 14px;
}
.btn2 {
background-color: #4ea6ff;
color: #ffffff;
}
}
}
}
}
}
}
}
.projectviewed {
width: 100%;
.tmpl {
width: 100%;
.tmpl_header {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-bottom: 32px;
margin-left: 32px;
margin-right: 32px;
.tmplh_inp {
.inpbox {
display: flex;
flex-wrap: wrap;
margin-top: 42px;
.inpbox1 {
display: flex;
justify-content: center;
align-items: center;
margin-right: 24px;
margin-top: 10px;
.ant-select-selector {
border-radius: 8px;
width: 270px;
height: 40px;
padding-top: 5px;
}
span {
white-space: nowrap;
}
}
}
}
.tmplh_btn {
display: flex;
// margin-left: 38px;
margin-top: 32px;
.btn {
padding: 0px 26px 0px 26px;
height: 38px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 14px;
cursor: pointer;
flex-shrink: 0;
.search {
background-size: 100%;
}
.btnText {
font-size: 14px;
font-weight: 400;
line-height: 36px;
margin-left: 5px;
}
.btnText1 {
color: rgb(255, 255, 255);
}
.btnText2 {
color: rgba(64, 158, 255, 1);
}
}
.btn1 {
background: #409eff;
.search {
width: 15px;
height: 17px;
background-image: url("../../assets/images/courseManage/search0.png");
}
}
.btn2 {
background: #ffffff;
border: 1px solid #388be1;
.search {
width: 16px;
height: 18px;
background-image: url("../../assets/images/courseManage/reset1.png");
}
}
.btn1:hover {
background: rgb(255, 255, 255);
border: 1px solid #388be1;
.search {
background-image: url("../../assets/images/courseManage/search1.png");
}
.btnText {
color: rgba(64, 158, 255, 1);
}
}
.btn2:hover {
background: rgba(64, 158, 255, 1);
.search {
background-image: url("../../assets/images/courseManage/reset0.png");
}
.btnText {
color: #ffffff;
}
}
}
}
.tmpl_body {
padding: 0px 30px;
.tmpl_tabbox {
.operation {
display: flex;
justify-content: center;
align-items: center;
color: #4ea6ff;
.nselect {
justify-content: center;
align-items: center;
display: flex;
.jc {
margin-left: 20px;
white-space: nowrap;
cursor: pointer;
}
}
}
}
.pa {
width: 100%;
margin-top: 20px;
display: flex;
justify-content: center;
}
}
}
}
</style>