feat:创建测评对接 评估改版创建评估对接

This commit is contained in:
dongwug
2022-11-01 14:24:30 +08:00
parent 5dd02e6448
commit 5fad403edc
2 changed files with 136 additions and 130 deletions

View File

@@ -102,7 +102,7 @@
</a-drawer>
</template>
<script>
import { reactive, toRefs, ref, onMounted } from "vue";
import { reactive, toRefs, ref } from "vue";
import { useRouter } from "vue-router";
import * as api from "../../api/indexEval";
import { message } from "ant-design-vue";
@@ -186,35 +186,35 @@ export default {
return isJpgOrPng && isLt2M;
};
const getTableDate = (tableData) => {
let data = tableData;
let array = [];
data.map((value, index) => {
let obj = {
id: value.routerId,
number: (state.currentPage - 1) * state.pageSize + index + 1,
manager: value.name ? value.name : "-",
state:
value.status === 0
? "草稿"
: value.status === 1
? "已发布"
: value.status === -1
? "已停用"
: "-",
creater: value.createName ? value.createName : "-",
pubtime: value.publishTime
? toDate(value.publishTime, "Y-M-D h:m:s")
: "-",
cretime: value.createTime
? toDate(value.createTime, "Y-M-D h:m:s")
: "-",
remark: value.remark ? value.remark : "-",
};
array.push(obj);
});
state.tableData = array;
};
// const getTableDate = (tableData) => {
// let data = tableData;
// let array = [];
// data.map((value, index) => {
// let obj = {
// id: value.routerId,
// number: (state.currentPage - 1) * state.pageSize + index + 1,
// manager: value.name ? value.name : "-",
// state:
// value.status === 0
// ? "草稿"
// : value.status === 1
// ? "已发布"
// : value.status === -1
// ? "已停用"
// : "-",
// creater: value.createName ? value.createName : "-",
// pubtime: value.publishTime
// ? toDate(value.publishTime, "Y-M-D h:m:s")
// : "-",
// cretime: value.createTime
// ? toDate(value.createTime, "Y-M-D h:m:s")
// : "-",
// remark: value.remark ? value.remark : "-",
// };
// array.push(obj);
// });
// state.tableData = array;
// };
//创建测评信息
const createEvalText = () => {
@@ -256,92 +256,92 @@ export default {
});
};
//获取学习路径列表
const getEvalPath = () => {
let obj = {
pageNo: state.currentPage,
pageSize: state.pageSize,
};
api
.queryEvaluationDetailById(obj)
.then((res) => {
if (res.status === 200) {
console.log("获取任务列表数据", res.data.data);
let arr = res.data.data.rows;
if (
arr.length === 0 &&
res.data.data.total > 0 &&
state.currentPage > 1
) {
state.currentPage = state.currentPage - 1;
getEvalPath();
}
getTableDate(arr);
state.tableDataTotal = Number(res.data.data.total);
}
})
.catch((err) => {
console.log("获取学习路径失败", err);
});
};
//翻页 需要去pa里绑定 @change="changePagination"
const changePagination = (page) => {
state.currentPage = page;
getEvalPath();
// console.log("翻页", page, pageSize);
};
//删除评估
const deleteEvalPath = () => {
let obj = {
routerId: state.deletePathId,
type: -2,
};
api
.deleteEvaluationById(obj)
.then((res) => {
console.log("删除成功", res);
message.success("删除成功");
// state.deleteModal = false;
getEvalPath();
})
.catch((err) => {
console.log("删除失败", err);
});
};
//编辑评估
const editEvalPath = () => {
if (!state.pathName) return message.info("请输入路径图名称");
// if (!state.organizationSelectName) return message.info("请选择归属组织");
// state.createLoading = true;
let obj = {
routerId: state.editPathId,
name: state.pathName,
picUrl: "",
remark: state.pathIntro,
status: 0,
};
api
.updateEvaluation(obj)
.then((res) => {
setTimeout(() => {
console.log("修改成功", res);
message.success("修改成功");
// state.createLoading = false;
// state.currentPage = 1;
// state.out1 = false;
// router.push("/leveladd");
getEvalPath();
}, 1000);
})
.catch((err) => {
console.log("修改失败", err);
// state.createLoading = false;
});
};
onMounted(() => {
// console.log("执行");
getEvalPath();
});
// //获取学习路径列表
// const getEvalPath = () => {
// let obj = {
// pageNo: state.currentPage,
// pageSize: state.pageSize,
// };
// api
// .queryEvaluationDetailById(obj)
// .then((res) => {
// if (res.status === 200) {
// console.log("获取任务列表数据", res.data.data);
// let arr = res.data.data.rows;
// if (
// arr.length === 0 &&
// res.data.data.total > 0 &&
// state.currentPage > 1
// ) {
// state.currentPage = state.currentPage - 1;
// getEvalPath();
// }
// getTableDate(arr);
// state.tableDataTotal = Number(res.data.data.total);
// }
// })
// .catch((err) => {
// console.log("获取学习路径失败", err);
// });
// };
// //翻页 需要去pa里绑定 @change="changePagination"
// const changePagination = (page) => {
// state.currentPage = page;
// getEvalPath();
// // console.log("翻页", page, pageSize);
// };
// //删除评估
// const deleteEvalPath = () => {
// let obj = {
// routerId: state.deletePathId,
// type: -2,
// };
// api
// .deleteEvaluationById(obj)
// .then((res) => {
// console.log("删除成功", res);
// message.success("删除成功");
// // state.deleteModal = false;
// getEvalPath();
// })
// .catch((err) => {
// console.log("删除失败", err);
// });
// };
// //编辑评估
// const editEvalPath = () => {
// if (!state.pathName) return message.info("请输入路径图名称");
// // if (!state.organizationSelectName) return message.info("请选择归属组织");
// // state.createLoading = true;
// let obj = {
// routerId: state.editPathId,
// name: state.pathName,
// picUrl: "",
// remark: state.pathIntro,
// status: 0,
// };
// api
// .updateEvaluation(obj)
// .then((res) => {
// setTimeout(() => {
// console.log("修改成功", res);
// message.success("修改成功");
// // state.createLoading = false;
// // state.currentPage = 1;
// // state.out1 = false;
// // router.push("/leveladd");
// getEvalPath();
// }, 1000);
// })
// .catch((err) => {
// console.log("修改失败", err);
// // state.createLoading = false;
// });
// };
// onMounted(() => {
// // console.log("执行");
// getEvalPath();
// });
return {
...toRefs(state),
@@ -349,10 +349,10 @@ export default {
closeDrawer,
//增删改查
createEvalText,
getEvalPath,
changePagination,
deleteEvalPath,
editEvalPath,
// getEvalPath,
// changePagination,
// deleteEvalPath,
// editEvalPath,
//上传组件
fileList,
loading,