feat:过滤未发布的评估

This commit is contained in:
lixg
2023-02-19 17:54:04 +08:00
parent 9f1b56ca1d
commit be29458b74

View File

@@ -20,12 +20,10 @@
</div> </div>
<div class="main_item"> <div class="main_item">
<button class="xkbtn" @click="goResearchmanage"> <button class="xkbtn" @click="goResearchmanage">新建评估</button>
新建评估
</button>
</div> </div>
<div class="main_notice" style="display:none;"> <div class="main_notice" style="display: none">
<div class="mntc_left"> <div class="mntc_left">
<div class="notice_icon"></div> <div class="notice_icon"></div>
</div> </div>
@@ -45,16 +43,16 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import {computed, defineEmits, defineProps, ref, watch} from "vue"; import { computed, defineEmits, defineProps, ref, watch } from "vue";
import {useRouter} from "vue-router"; import { useRouter } from "vue-router";
import {useRowsPage} from "@/api/request"; import { useRowsPage } from "@/api/request";
import {ASSESSMENT_PAGE} from "@/api/apis"; import { ASSESSMENT_PAGE } from "@/api/apis";
const props = defineProps({ const props = defineProps({
id: String, id: String,
name: String name: String,
}) });
const emit = defineEmits([]) const emit = defineEmits([]);
const columns = ref([ const columns = ref([
{ {
title: "名称", title: "名称",
@@ -73,7 +71,13 @@ const columns = ref([
customRender: (text) => { customRender: (text) => {
return ( return (
<div class="racona"> <div class="racona">
<span> {text.record.essayQuestionVoList.length + text.record.multipleStemVoList.length + text.record.scoringQuestionVoList.length + text.record.singleStemVoList.length}</span> <span>
{" "}
{text.record.essayQuestionVoList.length +
text.record.multipleStemVoList.length +
text.record.scoringQuestionVoList.length +
text.record.singleStemVoList.length}
</span>
</div> </div>
); );
}, },
@@ -94,38 +98,45 @@ const columns = ref([
align: "center", align: "center",
ellipsis: true, ellipsis: true,
}, },
]) ]);
const initParams = { const initParams = {
assessmentName: '', assessmentName: "",
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
} releaseStatus: 2,
const router = useRouter() };
const params = ref(initParams) const router = useRouter();
const params = ref(initParams);
const rowSelectKeys = ref([]); const rowSelectKeys = ref([]);
const selectsData = ref([]); const selectsData = ref([]);
const {data, loading, total, fetch} = useRowsPage(ASSESSMENT_PAGE, params.value) const { data, loading, total, fetch } = useRowsPage(
console.log(data) ASSESSMENT_PAGE,
watch(()=>props.id, () => { params.value
);
console.log(data);
watch(
() => props.id,
() => {
if (props.id) { if (props.id) {
rowSelectKeys.value = [props.id] rowSelectKeys.value = [props.id];
selectsData.value = [{id: props.id, assessmentName: props.name}] selectsData.value = [{ id: props.id, assessmentName: props.name }];
} else { } else {
rowSelectKeys.value = [] rowSelectKeys.value = [];
selectsData.value = [] selectsData.value = [];
} }
}) }
);
const customRow = (record) => ({ const customRow = (record) => ({
onClick: () => { onClick: () => {
rowSelectKeys.value = [record.id] rowSelectKeys.value = [record.id];
selectsData.value = [record] selectsData.value = [record];
emit('update:id', selectsData.value[0].id) emit("update:id", selectsData.value[0].id);
emit('update:name', selectsData.value[0].assessmentName) emit("update:name", selectsData.value[0].assessmentName);
} },
}) });
const pagination = computed(() => ({ const pagination = computed(() => ({
total: total.value, total: total.value,
@@ -137,10 +148,10 @@ const pagination = computed(() => ({
const changePagination = (e) => { const changePagination = (e) => {
params.value.pageIndex = e; params.value.pageIndex = e;
fetch() fetch();
}; };
const rowSelection = computed(() => ({ const rowSelection = computed(() => ({
type: 'radio', type: "radio",
columnWidth: 20, columnWidth: 20,
selectedRowKeys: rowSelectKeys.value, selectedRowKeys: rowSelectKeys.value,
onChange: onSelectChange, onChange: onSelectChange,
@@ -150,27 +161,26 @@ const rowSelection = computed(() => ({
function onSelectChange(e, l) { function onSelectChange(e, l) {
rowSelectKeys.value = e; rowSelectKeys.value = e;
selectsData.value = l; selectsData.value = l;
emit('update:id', selectsData.value[0].id) emit("update:id", selectsData.value[0].id);
emit('update:name', selectsData.value[0].assessmentName) emit("update:name", selectsData.value[0].assessmentName);
} }
function search() { function search() {
params.value.pageIndex = 1 params.value.pageIndex = 1;
fetch() fetch();
} }
function reset() { function reset() {
rowSelectKeys.value = []; rowSelectKeys.value = [];
selectsData.value = []; selectsData.value = [];
params.value.pageIndex = 1 params.value.pageIndex = 1;
params.value.keyWord = '' params.value.keyWord = "";
fetch() fetch();
} }
const goResearchmanage = () => { const goResearchmanage = () => {
router.push({path: "/researchmanage"}); router.push({ path: "/researchmanage" });
} };
</script> </script>
<style lang="scss"> <style lang="scss">
.xkbtn { .xkbtn {