feat:评估获取全部信息接口调用,并渲染到评估抽屉列表

This commit is contained in:
dongwug
2022-11-07 10:07:06 +08:00
parent 58652aa012
commit aecde0b1ac
2 changed files with 125 additions and 92 deletions

View File

@@ -70,10 +70,11 @@
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs } from "vue"; import { reactive, toRefs, onMounted } from "vue";
import * as api from "../../api/indexInvist"; import * as api from "../../api/indexInvist";
import * as apitaskadd from "../../api/indexTaskadd"; import * as apitaskadd from "../../api/indexTaskadd";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { toDate } from "../../api/method";
import { RouterEditTask } from "@/api/indexTask"; import { RouterEditTask } from "@/api/indexTask";
export default { export default {
name: "AddInvist", name: "AddInvist",
@@ -97,6 +98,9 @@ export default {
const state = reactive({ const state = reactive({
inputV1: "", inputV1: "",
time: undefined, time: undefined,
currentPage: 1,
pageSize: 10,
tableDataTotal: -1,
tableData: [ tableData: [
// { // {
// key: 1, // key: 1,
@@ -105,13 +109,6 @@ export default {
// creator: "管理员", // creator: "管理员",
// time: "2022-07-21 14:30:25", // time: "2022-07-21 14:30:25",
// }, // },
// {
// key: 2,
// name: "评估",
// num: "8",
// creator: "管理员",
// time: "2022-07-21 14:30:25",
// },
], ],
}); });
const closeDrawer = () => { const closeDrawer = () => {
@@ -175,14 +172,74 @@ export default {
}; };
const rowSelection = { const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); console.log(
`selectedRowKeys: ${selectedRowKeys}`,
"selectedRows: ",
selectedRows
);
}, },
getCheckboxProps: record => ({ getCheckboxProps: (record) => ({
// disabled: record.name === 'Disabled User', // disabled: record.name === 'Disabled User',
// // Column configuration not to be checked // // Column configuration not to be checked
name: record.name, name: record.name,
}), }),
}; };
const getTableDate = (tableData) => {
let data = tableData;
let array = [];
data.map((value, index) => {
console.log("123", value);
let obj = {
id: value.routerId,
key: index,
num: value.essayQuestionVoList.length,
name: value.assessmentName ? value.assessmentName : "-",
creator: value.createUser ? value.createUser : "-",
time: value.createTime
? toDate(new Date(value.createTime).getTime() / 1000, "Y-M-D h:m:s")
: "-",
};
array.push(obj);
});
state.tableData = array;
};
//获取全部评估信息接口
const getAllInvistText = () => {
let obj = {
assessmentName: "",
pageNo: state.currentPage,
pageSize: state.pageSize,
releaseStatus: "",
searchEndTime: "",
searchStartTime: "",
};
api
.queryAssessmentDetailList(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;
getAllInvistText();
}
getTableDate(arr);
state.tableDataTotal = Number(res.data.data.total);
}
console.log("获取全部评估信息接口成功", res);
message.success("获取全部评估信息接口成功");
console.log(obj);
})
.catch((err) => {
console.log("获取全部评估信息接口失败", err);
// state.createLoading = false;
});
};
//创建评估信息 //创建评估信息
const createInvist = () => { const createInvist = () => {
let obj = { let obj = {
@@ -208,18 +265,18 @@ export default {
closeDrawer(); closeDrawer();
getAllInvistText(); getAllInvistText();
if (props.learn == 0) if (props.learn == 0)
apitaskadd apitaskadd
.addTask({ .addTask({
courseId: 0, courseId: 0,
duration: 0, duration: 0,
flag: true, flag: true,
name: obj.appraiseName, name: obj.appraiseName,
projectId: 28, projectId: 28,
projectTaskId: 0, projectTaskId: 0,
stageId: 3, stageId: 3,
type: 11, type: 11,
}) })
.then((res) => { .then((res) => {
console.log("调用项目添加接口后", res.data); console.log("调用项目添加接口后", res.data);
//自定义事件给父组件传值 //自定义事件给父组件传值
ctx.emit("changeData", false); ctx.emit("changeData", false);
@@ -230,7 +287,7 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
}); });
else { else {
let editObj1 = { let editObj1 = {
chapterId: 36, chapterId: 36,
courseId: 0, courseId: 0,
@@ -241,7 +298,7 @@ export default {
routerTaskId: 0, routerTaskId: 0,
type: 11, type: 11,
}; };
RouterEditTask(editObj1) RouterEditTask(editObj1);
} }
}) })
.catch((err) => { .catch((err) => {
@@ -250,28 +307,10 @@ export default {
}); });
}; };
//获取全部评估信息接口 onMounted(() => {
const getAllInvistText = () => { // createInvist();
let obj = { getAllInvistText();
assessmentName: "", });
pageNo: 0,
pageSize: 0,
releaseStatus: "",
searchEndTime: "",
searchStartTime: "",
};
api
.queryAssessmentDetailList(obj)
.then((res) => {
console.log("获取全部评估信息接口成功", res);
message.success("获取全部评估信息接口成功");
console.log(obj);
})
.catch((err) => {
console.log("获取全部评估信息接口失败", err);
// state.createLoading = false;
});
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,

View File

@@ -18,23 +18,20 @@
</div> </div>
<div class="contentMain"> <div class="contentMain">
<div class="main_item"> <div class="main_item">
<div class="signbox"> <div class="signbox">
<div class="sign"> <div class="sign">
<img <img src="@/assets/images/coursewareManage/asterisk.png" alt="" />
src="@/assets/images/coursewareManage/asterisk.png"
alt=""
/>
</div>
<span style="margin-right: 3px">投票名称</span>
</div>
<div class="btnbox">
<a-input
v-model:value="inputV1"
style="width: 424px; height: 32px"
placeholder="请输入投票名称"
/>
</div>
</div> </div>
<span style="margin-right: 3px">投票名称</span>
</div>
<div class="btnbox">
<a-input
v-model:value="inputV1"
style="width: 424px; height: 32px"
placeholder="请输入投票名称"
/>
</div>
</div>
<div class="box" @click="showDrawerCreVote"> <div class="box" @click="showDrawerCreVote">
<button class="cjtpbtn" @click="addQue()">创建题干</button> <button class="cjtpbtn" @click="addQue()">创建题干</button>
</div> </div>
@@ -112,7 +109,7 @@ export default {
setup(props, ctx) { setup(props, ctx) {
const state = reactive({ const state = reactive({
inputV1: "", inputV1: "",
creVote:true, creVote: true,
questions: [ questions: [
{ {
inputV: "", inputV: "",
@@ -170,35 +167,32 @@ export default {
// return message.info("请输入选项"); // return message.info("请输入选项");
// } // }
console.log(state.questions[0].inputV); console.log(state.questions[0].inputV);
let obj = { let obj = {
createTime: "", createTime: "",
createUser: 0, createUser: 0,
optionDto: [ optionDto: [
{ {
optionId: 0, optionId: 0,
optionName: "", optionName: "",
optionPictureAddress: "", optionPictureAddress: "",
}, },
], ],
optionId: 0, stemName: "",
optionName: "", updateTime: "",
optionPictureAddress: "", updateUser: 0,
stem: state.questions[0].inputV, voteStemId: 0,
stemId: 0, };
updateTime: "", api
updateUser: 0, .createOptionMessage(obj)
}; .then((res) => {
api console.log("创建成功", res);
.createOptionMessage(obj) message.success("创建成功");
.then((res) => { ctx.emit("getData", state.creVote);
console.log("创建成功", res); closeDrawer();
message.success("创建成功"); })
ctx.emit("getData",state.creVote); .catch((err) => {
closeDrawer(); console.log(err);
}) });
.catch((err) => {
console.log(err);
});
}; };
return { return {
...toRefs(state), ...toRefs(state),