fix:已审核项目页面和待审核项目页面列表渲染、搜索(整个审核管理的通过选择已审核状态搜索未完成)

This commit is contained in:
Ggysh-7
2022-11-28 12:47:51 +08:00
parent 3f9854f0f6
commit 54e8dfdc84
2 changed files with 92 additions and 106 deletions

View File

@@ -68,7 +68,7 @@
</div> </div>
</div> </div>
<div class="tmplh_btn"> <div class="tmplh_btn">
<div class="btn btn1" @click="search"> <div class="btn btn1" @click="getProjList">
<div class="search"></div> <div class="search"></div>
<div class="btnText btnText1">搜索</div> <div class="btnText btnText1">搜索</div>
</div> </div>
@@ -151,7 +151,6 @@
import { reactive, toRefs, onMounted } from "vue"; import { reactive, toRefs, onMounted } from "vue";
import { listView, auditList } from "../../api/indexAudit"; import { listView, auditList } from "../../api/indexAudit";
import { toDate } from "@/api/method"; import { toDate } from "@/api/method";
import dayjs from "dayjs";
export default { export default {
name: "ProjectViewed", name: "ProjectViewed",
@@ -168,10 +167,10 @@ export default {
label: "rose", label: "rose",
}, },
], ],
valueproj: null, valueproj: "",
valuecreater: null, valuecreater: "",
valuename: null, valuename: "",
valueDate: [], valueDate: undefined,
valuestate: null, valuestate: null,
currentPage: 1, currentPage: 1,
total: null, total: null,
@@ -265,7 +264,6 @@ export default {
dataIndex: "belong", dataIndex: "belong",
key: "belong", key: "belong",
align: "center", align: "center",
// width: "10%",
}, },
{ {
@@ -284,28 +282,17 @@ export default {
], ],
//审核记录的数据 //审核记录的数据
tableDataAudit: [], tableDataAudit: [],
tableData1: [ tableData1: [],
{
number: "1",
name: "课程1",
belong: "管理者进阶/管理者进阶腾飞班",
manager: "黄华,刘军",
status: "通过",
creater: "管理员",
time: "-",
msg: "-",
},
],
}); });
const getProjList = (obj) => { const getProjList = () => {
let objn = obj || { let objn = {
beginTime: 0, beginTime: state.valueDate == undefined ? "" : Date.parse(state.valueDate[0]) ,
createName: "", endTime: state.valueDate == undefined ? "" : Date.parse(state.valueDate[1]),
endTime: "", createName: state.valuecreater,
manager: "", manager: state.valuename,
name: "", name: state.valueproj,
pageNo: state.currentPage, pageNo: state.currentPage,
pageSize: 10, pageSize: state.pageSize,
status: 0, status: 0,
}; };
listView(objn) listView(objn)
@@ -313,9 +300,7 @@ export default {
console.log("获取已审核项目成功", res.data.data.rows); console.log("获取已审核项目成功", res.data.data.rows);
let result = res.data.data; let result = res.data.data;
state.total = res.data.data.total; state.total = res.data.data.total;
if (result.total > 0) {
setTableData(result.rows); setTableData(result.rows);
}
}) })
.catch((err) => { .catch((err) => {
console.log("获取已审核项目失败", err); console.log("获取已审核项目失败", err);
@@ -324,26 +309,21 @@ export default {
const setTableData = (tabledata) => { const setTableData = (tabledata) => {
let data = tabledata; let data = tabledata;
let array = []; let array = [];
data.map((item) => { data.map((item,index) => {
if(item.type == 3){
let obj = { let obj = {
key:index+1,
number: item.projectId, number: item.projectId,
// 需要加上 name: item.name,
// name: getName(item), belong: "",
// belong: getBelong(item),
manager: item.manager || "-", manager: item.manager || "-",
status: status:
item.status == 0 item.status == 0
? "草稿" ? "草稿"
: item.status == 1 : item.status == 1
? "待审核" ? "已发布"
: item.status == 2 : item.status == 2
? "通过"
: item.status == 3
? "发布"
: item.status == -1
? "已结束" ? "已结束"
: item.status == -2
? "拒绝"
: "-", : "-",
creater: item.createName, creater: item.createName,
time: toDate(item.beginTime, "Y-M-D h:m"), time: toDate(item.beginTime, "Y-M-D h:m"),
@@ -351,70 +331,81 @@ export default {
id: item.projectId, id: item.projectId,
}; };
array.push(obj); array.push(obj);
} else {
let obj = {
key:index+1,
number: item.projectId,
name: item.name,
belong: "",
manager: item.manager || "-",
status:
item.status == 0
? "草稿"
: item.status == 1
? "已发布"
: item.status == 2
? "已结束"
: "-",
creater: item.createName,
time: toDate(item.beginTime, "Y-M-D h:m"),
msg: item.description || "-",
id: item.projectId,
children: item.subList ? setTableData(item.subList) : [] ,
};
array.push(obj);
}
}); });
state.tableData1 = array; state.tableData1 = array;
return array
}; };
const getName = (item) => { // const getName = (item) => {
if ( // if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") && // Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
!Object.prototype.hasOwnProperty.call( // !Object.prototype.hasOwnProperty.call(
item.subList[0].subList[0], // item.subList[0].subList[0],
"name" // "name"
) // )
) { // ) {
// 两层 // // 两层
return item.subList[0].name; // return item.subList[0].name;
} else if ( // } else if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") && // Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
Object.prototype.hasOwnProperty.call(item.subList[0].subList[0], "name") // Object.prototype.hasOwnProperty.call(item.subList[0].subList[0], "name")
) { // ) {
//三层 // //三层
return item.subList[0].subList[0].name; // return item.subList[0].subList[0].name;
// return item.name // // return item.name
} else { // } else {
// 单层 // // 单层
return item.name; // return item.name;
} // }
}; // };
const getBelong = (item) => { // const getBelong = (item) => {
if ( // if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") && // Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
!Object.prototype.hasOwnProperty.call( // !Object.prototype.hasOwnProperty.call(
item.subList[0].subList[0], // item.subList[0].subList[0],
"name" // "name"
) // )
) { // ) {
// 两层 // // 两层
return item.name; // return item.name;
} else if ( // } else if (
Object.prototype.hasOwnProperty.call(item.subList[0], "name") && // Object.prototype.hasOwnProperty.call(item.subList[0], "name") &&
Object.prototype.hasOwnProperty.call(item.subList[0].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.subList[0].name + "/" + item.subList[0].subList[0].name;
// return item.name // // return item.name
} else { // } else {
// 单层 // // 单层
return item.name; // return item.name;
} // }
}; // };
const changePagination = (pagina) => { const changePagination = (pagina) => {
state.currentPage = pagina; state.currentPage = pagina;
getProjList(); 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 = () => { const reset = () => {
state.valueproj = null; state.valueproj = null;
state.valuecreater = null; state.valuecreater = null;
@@ -436,9 +427,7 @@ export default {
.then((res) => { .then((res) => {
console.log("获取到了审核日志列表", res); console.log("获取到了审核日志列表", res);
let result = res.data.data; let result = res.data.data;
// if (result.total > 0) {
setAudit(result.rows); setAudit(result.rows);
// }
}) })
.catch((err) => { .catch((err) => {
console.log("审核日志列表获取失败", err); console.log("审核日志列表获取失败", err);
@@ -474,10 +463,7 @@ export default {
...toRefs(state), ...toRefs(state),
getProjList, getProjList,
setTableData, setTableData,
getName,
getBelong,
changePagination, changePagination,
search,
reset, reset,
closeProjAuditModal, closeProjAuditModal,
showProjAuditModal, showProjAuditModal,

View File

@@ -309,10 +309,10 @@ export default {
getProjList(); getProjList();
}; };
const reset = () => { const reset = () => {
(state.valueproj = null), state.valueproj = "",
(state.valuecreater = null), state.valuecreater = "",
(state.valuename = null), state.valuename = "",
(state.valueDate = []); state.valueDate = undefined;
getProjList(); getProjList();
}; };
onMounted(() => { onMounted(() => {