修改bug

This commit is contained in:
yangjun 2024-05-23 21:56:08 +08:00
parent b340db4e4a
commit 2ef5293aba
7 changed files with 179 additions and 68 deletions

View File

@ -23,8 +23,9 @@
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons"> <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6"> <a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button> <a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button> <!-- <a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button> -->
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd" style="margin-left: 8px"> 新增</a-button> <a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd" style="margin-left: 8px"> 新增</a-button>
<a-button type="primary" @click="handleTiku('1')" style="margin-left: 8px">题库</a-button>
</a-col> </a-col>
</span> </span>
</a-col> </a-col>
@ -94,6 +95,7 @@
<WjxWjxxTmlbDjjgModal ref="WjxWjxxTmlbDjjgModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgModal> <WjxWjxxTmlbDjjgModal ref="WjxWjxxTmlbDjjgModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgModal>
<WjxWjxxTmlbDjjgsDcModal ref="WjxWjxxTmlbDjjgsDcModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgsDcModal> <WjxWjxxTmlbDjjgsDcModal ref="WjxWjxxTmlbDjjgsDcModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgsDcModal>
<XxhbbksListModal ref="XxhbbksListModalPage"></XxhbbksListModal> <XxhbbksListModal ref="XxhbbksListModalPage"></XxhbbksListModal>
<TikuListModal ref="TikuListModalPage"></TikuListModal>
</div> </div>
</template> </template>
@ -111,6 +113,7 @@
import {useRouter} from "vue-router"; import {useRouter} from "vue-router";
import { JInput } from '/@/components/Form'; import { JInput } from '/@/components/Form';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import TikuListModal from '/@/views/kc/wjxWjxxTmlb/TikuListModal.vue';
// //
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
@ -130,6 +133,7 @@
const WjxWjxxTmlbDjModalPage = ref(); const WjxWjxxTmlbDjModalPage = ref();
const WjxWjxxTmlbDjjgsDcModalPage = ref(); const WjxWjxxTmlbDjjgsDcModalPage = ref();
const XxhbbksListModalPage = ref(); const XxhbbksListModalPage = ref();
const TikuListModalPage = ref();
const labelCol = reactive({ const labelCol = reactive({
xs: { span: 24 }, xs: { span: 24 },
@ -140,6 +144,13 @@
sm: { span: 16 }, sm: { span: 16 },
}); });
//61
function handleTiku(wjLeixing){
var record = {wjLeixing}
TikuListModalPage.value.disableSubmit = true;
TikuListModalPage.value.init(record);
}
/** /**
* 新增事件 * 新增事件
*/ */

View File

@ -3,11 +3,15 @@
<a-row style="height: calc(80vh);"> <a-row style="height: calc(80vh);">
<a-col :span="4" style="padding: 10px"> <a-col :span="4" style="padding: 10px">
<a-card title="可选题型" style="height: 450px;border: 1px solid #e8e8e8;"> <a-card title="可选题型" style="height: 300px;border: 1px solid #e8e8e8;">
<p><a-button type="primary" preIcon="ant-design:check-circle-outlined" @click="addTigan(3)">单选</a-button></p> <p><a-button type="primary" preIcon="ant-design:check-circle-outlined" @click="addTigan(3)">单选</a-button></p>
<p><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="addTigan(4)">多选</a-button></p> <p><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="addTigan(4)">多选</a-button></p>
<p><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="addTigan(5)">填空</a-button></p> <p><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="addTigan(5)">填空</a-button></p>
</a-card> </a-card>
<a-card title="引用题库">
<p><a-button type="primary" preIcon="ant-design:check-circle-outlined" @click="handleYylx('0')">我的题库</a-button></p>
<p><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="handleYylx('1')">公有题库</a-button></p>
</a-card>
</a-col> </a-col>
<a-col :span="20" style="overflow-y: scroll;height: calc(80vh);"> <a-col :span="20" style="overflow-y: scroll;height: calc(80vh);">
<div style="text-align: center;width: 100%;font-weight: bold;font-size: 20px;padding: 20px;"> <div style="text-align: center;width: 100%;font-weight: bold;font-size: 20px;padding: 20px;">
@ -112,6 +116,7 @@
</div> </div>
</a-col> </a-col>
</a-row> </a-row>
<YinyongTikuListModal ref="YinyongTikuListModalpage" @success="handleYytkSuccess" />
</a-spin> </a-spin>
</template> </template>
@ -121,8 +126,16 @@ import { Icon } from '/@/components/Icon';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { queryWjxWjxxTmxxListByMainId, queryDataById, saveOrUpdate } from '/@/views/kc/wjxWjxxTmlb/WjxWjxxTmlb.api'; import { queryWjxWjxxTmxxListByMainId, queryDataById, saveOrUpdate } from '/@/views/kc/wjxWjxxTmlb/WjxWjxxTmlb.api';
import YinyongTikuListModal from '/@/views/kc/wjxWjxxTmlb/YinyongTikuListModal.vue'
import { useUserStore } from '/@/store/modules/user';
//
const userStore = useUserStore();
const title = ref<string>(''); const title = ref<string>('');
const mainId = ref<string>(''); const mainId = ref<string>('');
const YinyongTikuListModalpage = ref();
const isShow = ref<boolean>(false); const isShow = ref<boolean>(false);
const confirmLoading = ref<boolean>(false); const confirmLoading = ref<boolean>(false);
const tiganData = ref<any>([]); const tiganData = ref<any>([]);
@ -174,6 +187,102 @@ function addTigan(type){
tiganData.value = [...list]; tiganData.value = [...list];
} }
} }
//
function handleYylx(sylx){
var createBy = "";
var wjSytype = "";
if(sylx=='0'){//
createBy = userStore.getUserInfo.username;
}else{//
wjSytype = "1";
}
var record = {wjLeixing,createBy,wjSytype};
YinyongTikuListModalpage.value.disableSubmit = false;
YinyongTikuListModalpage.value.init(record);
}
//
function handleYytkSuccess(record){
console.log(`🚀 ~ handleYytkSuccess ~ record:`, record)
for(var i=0;i<record.length;i++){
var type = record[i].wjType;
var list = tiganData.value;
var wjxWjxxTmxxList = record[i].wjxWjxxTmxxList;
console.log(`🚀 ~ handleYytkSuccess ~ addwjxWjxxTmxxList:`, addwjxWjxxTmxxList)
if(type==3){
var addwjxWjxxTmxxList = []
var sfxz = "";
for(var j=0;j<wjxWjxxTmxxList.length;j++){
if(wjxWjxxTmxxList[j].itemSelected=="true"){
sfxz = wjxWjxxTmxxList[j].itemIndex;
}
addwjxWjxxTmxxList.push({itemTitle:wjxWjxxTmxxList[j].itemTitle,itemIndex:wjxWjxxTmxxList[j].itemIndex})
}
if(wjLeixing=='1'){
sfxz = "";
}
console.log(`🚀 ~ handleYytkSuccess ~ sfxz:`, sfxz)
let params = {
wjType:parseInt(type),
wjIndex:list.length+1,
mainId:mainId,
wjTitle:record[i].wjTitle,
wjScore:record[i].wjScore,
wjLeixing,
itemSelected:sfxz+"",
wjxWjxxTmxxList:addwjxWjxxTmxxList,
}
list.push(params);
tiganData.value = [...list];
}else if(type==4){
var addwjxWjxxTmxxList = []
var sfxz = [];
for(var j=0;j<wjxWjxxTmxxList.length;j++){
if(wjxWjxxTmxxList[j].itemSelected=="true"){
sfxz.push(wjxWjxxTmxxList[j].itemIndex);
}
addwjxWjxxTmxxList.push({itemTitle:wjxWjxxTmxxList[j].itemTitle,itemIndex:wjxWjxxTmxxList[j].itemIndex})
}
if(wjLeixing=='1'){
sfxz = "";
}
let params = {
wjType:parseInt(type),
wjIndex:list.length+1,
mainId:mainId,
wjTitle:record[i].wjTitle,
wjScore:record[i].wjScore,
wjLeixing,
itemSelected:sfxz,
wjxWjxxTmxxList:addwjxWjxxTmxxList,
}
list.push(params);
tiganData.value = [...list];
}else if(type==5){
var huida = record[i].wjAnswer
if(wjLeixing=='1'){
huida = "";
}
let params = {
wjType:parseInt(type),
wjIndex:list.length+1,
mainId:mainId,
wjTitle:record[i].wjTitle,
wjScore:record[i].wjScore,
wjLeixing,
wjAnswer:huida,
}
list.push(params);
tiganData.value = [...list];
}
}
}
// //
function handleAddTmxx(record,index,list){ function handleAddTmxx(record,index,list){
list.push({itemTitle:null,itemIndex:list.length+1}); list.push({itemTitle:null,itemIndex:list.length+1});

View File

@ -52,7 +52,7 @@
</template> </template>
<script lang="ts" name="wjxWjxxTmlb-gongyou" setup> <script lang="ts" name="wjxWjxxTmlb-gongyou" setup>
import {ref, reactive, computed, unref,onMounted} from 'vue'; import {ref, reactive,watch, computed, unref,onMounted} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table'; import {BasicTable, useTable, TableAction} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage' import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal'; import {useModal} from '/@/components/Modal';
@ -94,7 +94,14 @@
}) })
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
const props = defineProps({
wjLeixing: { type: String },
});
//
watch(() => props.wjLeixing, async (newRow, oldRow) => {
console.log(`🚀 ~ watch2222 ~ newRow, oldRow:`, newRow, oldRow)
queryParam.value.wjLeixing = newRow;
},{ deep: true });
/** /**
* 详情 * 详情
*/ */
@ -153,20 +160,10 @@
reload(); reload();
} }
function init(record){
console.log(`🚀 ~ init ~ record:`, record)
wjLeixing.value = record.wjLeixing;
queryParam.value.wjLeixing = record.wjLeixing;
reload();
}
// defineExpose({
// init,
// });
onMounted(() => { onMounted(() => {
wjLeixing.value = "1"; // wjLeixing.value = "1";
queryParam.value.wjLeixing = "1"; // queryParam.value.wjLeixing = "1";
queryParam.value.wjSytype = "1"; queryParam.value.wjSytype = "1";
reload(); reload();
}); });

View File

@ -52,7 +52,7 @@
</template> </template>
<script lang="ts" name="wjxWjxxTmlb-siyou" setup> <script lang="ts" name="wjxWjxxTmlb-siyou" setup>
import {ref, reactive, computed, unref,onMounted} from 'vue'; import {ref, reactive,watch, computed, unref,onMounted} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table'; import {BasicTable, useTable, TableAction} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage' import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal'; import {useModal} from '/@/components/Modal';
@ -67,7 +67,7 @@
// //
const userStore = useUserStore(); const userStore = useUserStore();
const checkedKeys = ref<Array<string | number>>([]); const checkedKeys = ref<Array<string | number>>([]);
const wjLeixing = ref<string>(''); // const wjLeixing = ref<string>('');
//model //model
const [registerModal, {openModal}] = useModal(); const [registerModal, {openModal}] = useModal();
//table //table
@ -98,15 +98,15 @@
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件 const props = defineProps({
*/ wjLeixing: { type: String },
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
}); });
} //
watch(() => props.wjLeixing, async (newRow, oldRow) => {
console.log(`🚀 ~ watch ~ newRow, oldRow:`, newRow, oldRow)
queryParam.value.wjLeixing = newRow;
},{ deep: true });
/** /**
* 编辑事件 * 编辑事件
*/ */
@ -125,18 +125,6 @@
showFooter: false, showFooter: false,
}); });
} }
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: selectedRowKeys.value},handleSuccess);
}
/** /**
* 成功回调 * 成功回调
*/ */
@ -172,23 +160,6 @@
} }
} }
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
@ -220,17 +191,11 @@
reload(); reload();
} }
function init(record){
console.log(`🚀 ~ init ~ record:`, record)
wjLeixing.value = record.wjLeixing;
queryParam.value.wjLeixing = record.wjLeixing;
reload();
}
onMounted(() => { onMounted(() => {
wjLeixing.value = "1"; // wjLeixing.value = "1";
queryParam.value.wjLeixing = "1"; // console.log(`🚀 ~ onMounted ~ wjLeixing:`, wjLeixing)
// queryParam.value.wjLeixing = wjLeixing;
queryParam.value.createBy = userStore.getUserInfo.username; queryParam.value.createBy = userStore.getUserInfo.username;
reload(); reload();
}); });

View File

@ -1,8 +1,8 @@
<template> <template>
<div style="padding: 20px;"> <div style="padding: 20px;">
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="我的题库"><TikuList /></a-tab-pane> <a-tab-pane key="1" tab="我的题库"><TikuList :wjLeixing="wjLeixing"/></a-tab-pane>
<a-tab-pane key="2" tab="公有题库"><TikuGongyouList /></a-tab-pane> <a-tab-pane key="2" tab="公有题库" force-render><TikuGongyouList :wjLeixing="wjLeixing" /></a-tab-pane>
</a-tabs> </a-tabs>
</div> </div>
</template> </template>

View File

@ -21,6 +21,35 @@ export const columns: BasicColumn[] = [
dataIndex: 'wjSytype_dictText' dataIndex: 'wjSytype_dictText'
}, },
]; ];
export const columnsYytk: BasicColumn[] = [
{
title: '题目类型',
align:"center",
dataIndex: 'wjType',
customRender:({text}) =>{
var rt = "";
if(text == '3'){
rt = "单选";
}else if(text == '4'){
rt = "多选";
}else if(text == '5'){
rt = "填空";
}
return rt;
},
},
{
title: '题干名称',
align:"center",
dataIndex: 'wjTitle'
},
{
title: '题目分值',
align:"center",
dataIndex: 'wjScore'
},
];
//查询数据 //查询数据
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
]; ];

View File

@ -26,7 +26,7 @@
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter}); setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
isUpdate.value = !!data?.isUpdate; isUpdate.value = !!data?.isUpdate;
title.value = data?.isUpdate?'编辑':'新增' title.value ='详情'
formDisabled.value = !data?.showFooter; formDisabled.value = !data?.showFooter;
if (unref(isUpdate)) { if (unref(isUpdate)) {
console.log('data', data) console.log('data', data)