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

View File

@@ -18,23 +18,20 @@
</div>
<div class="contentMain">
<div class="main_item">
<div class="signbox">
<div class="sign">
<img
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 class="signbox">
<div class="sign">
<img 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 class="box" @click="showDrawerCreVote">
<button class="cjtpbtn" @click="addQue()">创建题干</button>
</div>
@@ -112,7 +109,7 @@ export default {
setup(props, ctx) {
const state = reactive({
inputV1: "",
creVote:true,
creVote: true,
questions: [
{
inputV: "",
@@ -170,35 +167,32 @@ export default {
// return message.info("请输入选项");
// }
console.log(state.questions[0].inputV);
let obj = {
createTime: "",
createUser: 0,
optionDto: [
{
optionId: 0,
optionName: "",
optionPictureAddress: "",
},
],
optionId: 0,
optionName: "",
optionPictureAddress: "",
stem: state.questions[0].inputV,
stemId: 0,
updateTime: "",
updateUser: 0,
};
api
.createOptionMessage(obj)
.then((res) => {
console.log("创建成功", res);
message.success("创建成功");
ctx.emit("getData",state.creVote);
closeDrawer();
})
.catch((err) => {
console.log(err);
});
let obj = {
createTime: "",
createUser: 0,
optionDto: [
{
optionId: 0,
optionName: "",
optionPictureAddress: "",
},
],
stemName: "",
updateTime: "",
updateUser: 0,
voteStemId: 0,
};
api
.createOptionMessage(obj)
.then((res) => {
console.log("创建成功", res);
message.success("创建成功");
ctx.emit("getData", state.creVote);
closeDrawer();
})
.catch((err) => {
console.log(err);
});
};
return {
...toRefs(state),