Accept Merge Request #117: (hyc -> master)
Merge Request: 【修改】文件夹出题加上原始文件夹回显 Created By: @华允传 Accepted By: @华允传 URL: https://g-iswv8783.coding.net/p/education/d/pengchen-ui-exam-vue3/git/merge/117?initial=true
This commit is contained in:
@@ -149,7 +149,7 @@
|
|||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChangeQuestion">
|
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChangeQuestion">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="试题编号" align="center" key="id" prop="quId" :show-overflow-tooltip="true"/>
|
<el-table-column label="试题编号" align="center" key="id" prop="quNum" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="专业" align="center" prop="specialtyName" width="120" />
|
<el-table-column label="专业" align="center" prop="specialtyName" width="120" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="课程"
|
label="课程"
|
||||||
|
@@ -434,6 +434,7 @@
|
|||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
draggable
|
draggable
|
||||||
>
|
>
|
||||||
|
<div style="margin-bottom: 10px; font-weight: bold;">答案目录</div>
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="fileTreeData"
|
:data="fileTreeData"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
@@ -441,6 +442,15 @@
|
|||||||
@node-click="handleFileNodeClick"
|
@node-click="handleFileNodeClick"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
/>
|
/>
|
||||||
|
<div style="margin: 20px 0 10px; font-weight: bold;">原始目录</div>
|
||||||
|
<el-tree
|
||||||
|
:data="fileTreeStu"
|
||||||
|
node-key="id"
|
||||||
|
:props="{ label: 'name', children: 'children' }"
|
||||||
|
@node-click="handleFileNodeStuClick"
|
||||||
|
default-expand-all
|
||||||
|
/>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
@@ -456,6 +466,7 @@ import * as SpecialtyApi from '@/api/points'
|
|||||||
defineOptions({ name: 'ChoiceForm' })
|
defineOptions({ name: 'ChoiceForm' })
|
||||||
// 定义一个缓存对象
|
// 定义一个缓存对象
|
||||||
const nodeListCache: Record<number, any> = {};
|
const nodeListCache: Record<number, any> = {};
|
||||||
|
const stuListCache: Record<number, any> = {};
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
@@ -466,6 +477,7 @@ const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|||||||
|
|
||||||
const fileTreeDialogVisible = ref(false);
|
const fileTreeDialogVisible = ref(false);
|
||||||
const fileTreeData = ref<Tree[]>([]);
|
const fileTreeData = ref<Tree[]>([]);
|
||||||
|
const fileTreeStu = ref<Tree[]>([]);
|
||||||
const currentEditingRow = ref<any>(null); // 当前点击的行
|
const currentEditingRow = ref<any>(null); // 当前点击的行
|
||||||
|
|
||||||
|
|
||||||
@@ -516,12 +528,15 @@ const openFileTree = (row: any) => {
|
|||||||
console.log("111")
|
console.log("111")
|
||||||
const quId = kaodianData.value.quId;
|
const quId = kaodianData.value.quId;
|
||||||
const cached = nodeListCache[quId];
|
const cached = nodeListCache[quId];
|
||||||
|
const cachedstu = stuListCache[quId]
|
||||||
if (!cached) {
|
if (!cached) {
|
||||||
ElMessage.warning('暂无缓存的文件结构');
|
ElMessage.warning('暂无缓存的文件结构');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileTreeData.value.push(...handleTree(cached))
|
fileTreeData.value.push(...handleTree(cached))
|
||||||
|
fileTreeStu.value.push(...handleTree(cachedstu))
|
||||||
|
|
||||||
currentEditingRow.value = row;
|
currentEditingRow.value = row;
|
||||||
fileTreeDialogVisible.value = true;
|
fileTreeDialogVisible.value = true;
|
||||||
};
|
};
|
||||||
@@ -537,6 +552,19 @@ const handleFileNodeClick = (data) => {
|
|||||||
}
|
}
|
||||||
fileTreeDialogVisible.value = false
|
fileTreeDialogVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleFileNodeStuClick = (data) => {
|
||||||
|
const pathArray = findFilePathById(fileTreeStu.value, data.id)
|
||||||
|
if (!pathArray) return
|
||||||
|
|
||||||
|
const fullPath = pathArray.join('\\')
|
||||||
|
if (currentEditingRow.value) {
|
||||||
|
currentEditingRow.value.content = fullPath
|
||||||
|
currentEditingRow.value.attribute = data.attribute || ''
|
||||||
|
}
|
||||||
|
fileTreeDialogVisible.value = false
|
||||||
|
}
|
||||||
const findFilePathById = (
|
const findFilePathById = (
|
||||||
tree: any[],
|
tree: any[],
|
||||||
targetId: number,
|
targetId: number,
|
||||||
@@ -660,6 +688,7 @@ const setKaodianRow =async () => {
|
|||||||
const quId = kaodianData.value.quId;
|
const quId = kaodianData.value.quId;
|
||||||
if (quId) {
|
if (quId) {
|
||||||
nodeListCache[quId] = res.nodeList;
|
nodeListCache[quId] = res.nodeList;
|
||||||
|
stuListCache[quId]=res.stuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user