diff --git a/src/views/kc/wjxCswj/WjxCywjV2List.vue b/src/views/kc/wjxCswj/WjxCywjV2List.vue index c1d396a..1c783c5 100644 --- a/src/views/kc/wjxCswj/WjxCywjV2List.vue +++ b/src/views/kc/wjxCswj/WjxCywjV2List.vue @@ -172,13 +172,15 @@ - +

单选题

多选题

填空题

文件题

简答题

判断题

+ +
@@ -609,7 +611,107 @@ + +
+ + + +
@@ -1304,7 +1406,16 @@ import { create } from 'sortablejs'; import { downloadByUrl } from '/@/utils/file/download'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import ZyCyFenxiangListModal from '/@/views/zy/zyCyFenxiang/ZyCyFenxiangListModal.vue'; +import MatrixQuestion from './components/MatrixQuestion.vue'; +// 处理来自子组件的更新 +function handleMatrixItemsUpdate(newItems) { + matrixItems.value = newItems; +} + +function handleMatrixItemRowsUpdate(newItemRows) { + matrixItemRows.value = newItemRows; +} const glob = useGlobSetting(); const globSetting = useGlobSetting(); @@ -2007,9 +2118,71 @@ function addTigan(type) { list.push(params); tiganData.value = [...list]; //文件题 - } + } else if (type == 7){//量表题(矩阵题) + let params = { + wjType: 7, + wjSubtype: 701, + wjIndex: list.length + 1, + mainId: mainId, + wjTitle: null, + wjScore: null, + wjLeixing, + wjAnswer: null, + wjSfqh: '0', + sftjtk: '1', + itemRows: [ + { qIndex: 1, itemIndex: 1, itemTitle: '外观' }, + { qIndex: 2, itemIndex: 2, itemTitle: '功能' } + // 可以根据需要添加更多行项 + ], + items: [ + { itemScore: '1', itemTitle: '很不满意' }, + { itemScore: '2', itemTitle: '不满意' }, + { itemScore: '3', itemTitle: '一般' }, + { itemScore: '4', itemTitle: '满意' }, + { itemScore: '5', itemTitle: '很满意' } + // 可以根据需要添加更多列项 + ] + }; + list.push(params); + tiganData.value = [...list]; + } } +const handleColumnAction = (action, item, index) => { + if (action === 'add' && item.items.length < 10) { + const newItem = { itemScore: '5', itemTitle: '' }; + item.items.push(newItem); + } else if (action === 'delete' && item.items.length > 3) { + item.items.splice(index, 1); + }else if(action === 'moveLeft' ){ + let temp = item.items[index]; + item.items[index] = item.items[index - 1]; + item.items[index - 1] = temp; + }else if(action === 'moveRight' ){ + let temp = item.items[index]; + item.items[index] = item.items[index + 1]; + item.items[index + 1] = temp; + } +}; + +const handleRowAction = (action, item, rowIndex) => { + if (action === 'add') { + const newRow = { qIndex: item.itemRows.length + 1,itemIndex: item.itemRows.length + 1,itemTitle: '' }; + item.itemRows.push(newRow); + } else if (action === 'delete' && item.itemRows.length > 2) { + item.itemRows.splice(rowIndex, 1); + } else if (action === 'moveTop' ) { + let temp = item.itemRows[rowIndex]; + item.itemRows[rowIndex] = item.itemRows[rowIndex - 1]; + item.itemRows[rowIndex - 1] = temp; + } else if (action === 'moveDown' ) { + let temp = item.itemRows[rowIndex]; + item.itemRows[rowIndex] = item.itemRows[rowIndex + 1]; + item.itemRows[rowIndex + 1] = temp; + } +}; + /** * 拖动结束事件 * @param evt @@ -2287,7 +2460,7 @@ async function submitForm() { return; } if (isShow.value) { - if (!param.wjScore) { + if (!param.wjScore && param.wjType != 7) { createMessage.error('请填写题目分数'); sfjx = '0'; confirmLoading.value = false; @@ -2843,4 +3016,92 @@ onMounted(() => { word-break: break-all; /* 长单词和 URL 地址换行 */ overflow-wrap: break-word; /* 在长单词内部换行 */ } + +.scrollable-table-container { + overflow-x: auto; /* 允许水平滚动 */ + width: 100%; + -webkit-overflow-scrolling: touch; /* 确保移动端可以流畅滚动 */ +} + +.custom-table { + width: 100%; + margin-top: 10px; +} + +.custom-table table { + width: max-content; /* 表格宽度根据内容自适应 */ + border-collapse: collapse; + min-width: 100%; /* 确保表格至少占据父容器的全部宽度 */ +} + +.custom-table th, +.custom-table td { + border: 1px solid #ccc; + padding: 8px; + text-align: center; + white-space: nowrap; /* 单元格内容不换行,以保证内容完整显示 */ + min-width: 130px; /* 设置最小宽度 */ + width: 80px; /* 设置固定宽度 */ +} + +/* 输入框与下拉菜单的组合样式 */ +.input-with-dropdown { + display: flex; + align-items: center; + justify-content: space-between; +} + +.input-field { + width: calc(100% - 30px); /* 为图标留出空间 */ +} + +.dropdown-menu .anticon { + font-size: 16px; + color: #1890ff; + cursor: pointer; +} + +.d-flex { + display: flex; +} + +.align-items-center { + align-items: center; +} + +.flex-grow-1 { + flex-grow: 1; +} + +.mr-1 { + margin-right: 5px; +} + +.mr-2 { + margin-right: 20px; /* 为图标留出一些空间 */ +} + +.row-cell { + position: relative; +} + +.row-cell .dropdown-menu { + position: absolute; + right: 8px; /* 根据需要调整 */ + top: 50%; + transform: translateY(-50%); +} + +/* 自定义空白圈样式 */ +.circle { + width: 20px; + height: 20px; + background-color: #F8F9FA; /* 乳白色 */ + border-radius: 50%; + border: 1px solid #ccc; /* 灰色边框 */ + display: flex; + align-items: center; + justify-content: center; + margin: auto; +} diff --git a/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjV2Form.vue b/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjV2Form.vue index b1dd239..bdf135f 100644 --- a/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjV2Form.vue +++ b/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjV2Form.vue @@ -205,10 +205,64 @@
+ +
+
+ 量表题
+ + + + +
+ +
+
+ + + + + + + + + + + +
+
+
{{ item_.itemTitle }}
+
+
+
+
{{ row.itemTitle }}
+
+
+ + + + +
+
+
+
+
+
+
+
无对应类型-{{ item.wjType }}-{{ item.wjSubtype }}=
- + 提交 @@ -346,6 +400,16 @@ async function submitForm() { createMessage.warning('第' + (i + 1) + '题没有作答,请检查试卷,完成所有作答!'); return; } + } else if (param.wjType == 7) { + let v = true + param.itemRows.forEach(element => { + if(!element.itemSelected)v = false + }); + if(!v){ + emit('closeLoading'); + createMessage.warning('第' + (i + 1) + '题没有作答,请检查试卷,完成所有作答!'); + return; + } } // values[i].openTime = openTime.value; } @@ -363,7 +427,7 @@ async function submitForm() { } } - //保存成功 + // 保存成功 await djtj(values, isUpdate); if (it.value == 'fs') { @@ -495,6 +559,14 @@ async function refreshFT() { finishTime.value = finishTimeData.result } +function changeScaleSelected(item){ + item.itemSelected = '' + item.itemRows.forEach((element,index) => { + item.itemSelected += ','+(index+1) + '!' + element.itemSelected + }); + item.itemSelected = item.itemSelected.replace(',','') +} + // 自动请求并暴露内部方法 onMounted(async () => { //获取是否答过题 @@ -693,4 +765,92 @@ defineExpose({ margin-left: auto; margin-right: auto; } + +.scrollable-table-container { + overflow-x: auto; /* 允许水平滚动 */ + width: 100%; + -webkit-overflow-scrolling: touch; /* 确保移动端可以流畅滚动 */ +} + +.custom-table { + width: 100%; + margin-top: 10px; +} + +.custom-table table { + width: max-content; /* 表格宽度根据内容自适应 */ + border-collapse: collapse; + min-width: 100%; /* 确保表格至少占据父容器的全部宽度 */ +} + +.custom-table th, +.custom-table td { + // border: 1px solid #ccc; + padding: 8px; + text-align: center; + white-space: nowrap; /* 单元格内容不换行,以保证内容完整显示 */ + min-width: 130px; /* 设置最小宽度 */ + width: 80px; /* 设置固定宽度 */ +} + +/* 输入框与下拉菜单的组合样式 */ +.input-with-dropdown { + display: flex; + align-items: center; + justify-content: space-between; +} + +.input-field { + width: calc(100% - 30px); /* 为图标留出空间 */ +} + +.dropdown-menu .anticon { + font-size: 16px; + color: #1890ff; + cursor: pointer; +} + +.d-flex { + display: flex; +} + +.align-items-center { + align-items: center; +} + +.flex-grow-1 { + flex-grow: 1; +} + +.mr-1 { + margin-right: 5px; +} + +.mr-2 { + margin-right: 20px; /* 为图标留出一些空间 */ +} + +.row-cell { + position: relative; +} + +.row-cell .dropdown-menu { + position: absolute; + right: 8px; /* 根据需要调整 */ + top: 50%; + transform: translateY(-50%); +} + +/* 自定义空白圈样式 */ +.circle { + width: 20px; + height: 20px; + background-color: #F8F9FA; /* 乳白色 */ + border-radius: 50%; + border: 1px solid #ccc; /* 灰色边框 */ + display: flex; + align-items: center; + justify-content: center; + margin: auto; +} diff --git a/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgForm.vue b/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgForm.vue index fd4e4f7..c24f3a5 100644 --- a/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgForm.vue +++ b/src/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgForm.vue @@ -229,6 +229,69 @@ + +
+
量表题
+ + + + +
+ +
+
+ + + + + + + + + + + +
+
+
{{ item_.itemTitle }}
+
+
+
+
{{ row.itemTitle }}
+
+
+ + + + +
+
+
+
+
+
+
+
无对应类型
@@ -328,4 +391,92 @@ defineExpose({ .answer-word { color: #ff8710; } + +.scrollable-table-container { + overflow-x: auto; /* 允许水平滚动 */ + width: 100%; + -webkit-overflow-scrolling: touch; /* 确保移动端可以流畅滚动 */ +} + +.custom-table { + width: 100%; + margin-top: 10px; +} + +.custom-table table { + width: max-content; /* 表格宽度根据内容自适应 */ + border-collapse: collapse; + min-width: 100%; /* 确保表格至少占据父容器的全部宽度 */ +} + +.custom-table th, +.custom-table td { + // border: 1px solid #ccc; + padding: 8px; + text-align: center; + white-space: nowrap; /* 单元格内容不换行,以保证内容完整显示 */ + min-width: 130px; /* 设置最小宽度 */ + width: 80px; /* 设置固定宽度 */ +} + +/* 输入框与下拉菜单的组合样式 */ +.input-with-dropdown { + display: flex; + align-items: center; + justify-content: space-between; +} + +.input-field { + width: calc(100% - 30px); /* 为图标留出空间 */ +} + +.dropdown-menu .anticon { + font-size: 16px; + color: #1890ff; + cursor: pointer; +} + +.d-flex { + display: flex; +} + +.align-items-center { + align-items: center; +} + +.flex-grow-1 { + flex-grow: 1; +} + +.mr-1 { + margin-right: 5px; +} + +.mr-2 { + margin-right: 20px; /* 为图标留出一些空间 */ +} + +.row-cell { + position: relative; +} + +.row-cell .dropdown-menu { + position: absolute; + right: 8px; /* 根据需要调整 */ + top: 50%; + transform: translateY(-50%); +} + +/* 自定义空白圈样式 */ +.circle { + width: 20px; + height: 20px; + background-color: #F8F9FA; /* 乳白色 */ + border-radius: 50%; + border: 1px solid #ccc; /* 灰色边框 */ + display: flex; + align-items: center; + justify-content: center; + margin: auto; +}