添加新功能

This commit is contained in:
yangjun 2024-09-26 17:18:30 +08:00
parent b4d466a87e
commit f079900812
9 changed files with 1301 additions and 315 deletions

View File

@ -304,6 +304,87 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'col55'
},
{
title: '1.仪表整洁、举止得体、精神饱满',
align: "center",
dataIndex: 'col6176'
},
{
title: '2.遵守教学纪律,严格课堂管理',
align: "center",
dataIndex: 'col62'
},
{
title: '3.备课充分,精心设计教学(有课件、教案等教学素材),教学投入',
align: "center",
dataIndex: 'col63'
},
{
title: '4.坚持马克思主义立场观点方法,具有较为扎实的马克思主义理论功底,教学目标明确',
align: "center",
dataIndex: 'col64'
},
{
title: '5.有效使用统编教材配套课件、参考讲义、辅导用书,教学内容科学完整,基本理论阐释清楚,基本事实讲述准确,重点、难点比较突出',
align: "center",
dataIndex: 'col65'
},
{
title: '6.理论联系实际,熟悉党史、新中国史、改革开放史、社会主义发展史、中华民族发展史,注重史论结合,教学素材多样,案例鲜活生动,及时将新时代中国特色社会主义的生动实践转化为课堂教学资源',
align: "center",
dataIndex: 'col66'
},
{
title: '7.贴近学生实际,善于发掘身边人身边事蕴含的育人元素,有效回应学生关心问题和思想困惑',
align: "center",
dataIndex: 'col67'
},
{
title: '8.熟悉教学法基本原理,注重教学逻辑与学术逻辑的辩证统一,教学设计符合学生认知规律、关注学生差异性',
align: "center",
dataIndex: 'col68'
},
{
title: '9.熟练运用启发式、案例式等教学法,注重课堂互动,不照本宣科,善于调动学生积极性,启发学生思考',
align: "center",
dataIndex: 'col69'
},
{
title: '10.综合运用现代信息技术手段,增强课堂教学的生动性、吸引力,帮助学生理解领会教学内容',
align: "center",
dataIndex: 'col70'
},
{
title: '11.注重思想性和理论性,具有亲和力和感染力,能够把道理讲深、讲透、讲活,学生学习积极性高,愿意与教师交流反馈',
align: "center",
dataIndex: 'col71'
},
{
title: '12.注重价值引领,增进对党的创新理论的政治认同、思想认同、理论认同、情感认同,坚定“四个自信”',
align: "center",
dataIndex: 'col72'
},
{
title: '13.完成教学计划,课堂秩序良好',
align: "center",
dataIndex: 'col73'
},
{
title: '14.课堂诊断',
align: "center",
dataIndex: 'col74'
},
{
title: '15.总体评价',
align: "center",
dataIndex: 'col75'
},
{
title: '16.指导建议',
align: "center",
dataIndex: 'col76'
},
];
//查询数据

View File

@ -116,12 +116,12 @@ export const columns: BasicColumn[] = [
dataIndex: 'ans13_dictText'
},
{
title: '课堂诊断',
title: '总体评价',
align: "center",
dataIndex: 'ans14'
},
{
title: '总体评价',
title: '课堂诊断',
align: "center",
dataIndex: 'ans15'
},

View File

@ -119,18 +119,18 @@
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="完成教学计划,课堂秩序良好" v-bind="validateInfos.ans413" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<j-dict-select-tag type='radio' v-model:value="formData.ans413" :dictCode="`kc_evaluationans,content,ordernum,queid = '73' order by ordernum asc`" placeholder="请选择完成教学计划,课堂秩序良好" :disabled="disabled"/>
<a-form-item label="完成教学计划,课堂秩序良好" v-bind="validateInfos.ans13" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<j-dict-select-tag type='radio' v-model:value="formData.ans13" :dictCode="`kc_evaluationans,content,ordernum,queid = '73' order by ordernum asc`" placeholder="请选择完成教学计划,课堂秩序良好" :disabled="disabled"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="课堂诊断" v-bind="validateInfos.ans14" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<a-textarea v-model:value="formData.ans14" rows="4" placeholder="请输入课堂诊断" :disabled="disabled"/>
<a-form-item label="总体评价" v-bind="validateInfos.ans14" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<j-dict-select-tag type='radio' v-model:value="formData.ans14" :dictCode="`kc_evaluationans,content,ordernum,queid = '75' order by ordernum asc`" placeholder="请选择总体评价" :disabled="disabled"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="总体评价" v-bind="validateInfos.ans15" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<j-dict-select-tag type='radio' v-model:value="formData.ans15" :dictCode="`kc_evaluationans,content,ordernum,queid = '75' order by ordernum asc`" placeholder="请选择总体评价" :disabled="disabled"/>
<a-form-item label="课堂诊断" v-bind="validateInfos.ans15" :labelCol="labelCol2" :wrapperCol="wrapperCol2">
<a-textarea v-model:value="formData.ans15" rows="4" placeholder="请输入课堂诊断" :disabled="disabled"/>
</a-form-item>
</a-col>
<a-col :span="24">

View File

@ -476,7 +476,7 @@
<div v-else> 无对应类型 -{{item.wjType}}- </div>
<div v-else></div>
</div>
</template>
</draggable>
@ -629,12 +629,8 @@
<a-button type="primary" @click="handleSzzycs(1)"><Icon icon="ant-design:edit-outlined" />修改课程测验次数</a-button>
<a-divider type="vertical" />
<a-button type="primary" @click="handleAddOne"><Icon icon="ant-design:file-add-outlined" />新增测验</a-button>
<!-- <a-divider type="vertical" />
<a-button type="primary" @click="handleTiku('6')" style="margin-left: 8px">题库</a-button>
<a-divider type="vertical" />
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="importXls">导入试题</j-upload-button>
<a-divider type="vertical" />
<a-button type="primary" @click="downloadByUrl({url:'/downPath/stdrmb.xls',target: '_self',fileName:'试题导入模板.xls'})" class="mar-right20"><Icon icon="ant-design:file-add-outlined" />下载试题模板</a-button> -->
<a-button type="primary" @click="handleTiku('6')" style="margin-left: 8px;margin-right: 18px;">题库</a-button>
</a-col>
<a-col :span="24">
<a-row style="padding: 10px">

View File

@ -62,7 +62,7 @@
</template>
<script lang="ts" name="wjxWjxxTmlb-gongyou" setup>
import {ref, reactive,watch, computed, unref,onMounted} from 'vue';
import {ref, reactive,watch, computed, unref,onMounted,defineExpose} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
@ -179,6 +179,9 @@
reload();
});
defineExpose({
searchQuery
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {

View File

@ -1,6 +1,22 @@
<template>
<div>
<!-- <a-divider type="vertical" />
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="importXls">导入试题</j-upload-button>
<a-divider type="vertical" />
<a-button type="primary" @click="downloadByUrl({url:'/downPath/stdrmb.xls',target: '_self',fileName:'试题导入模板.xls'})" class="mar-right20"><Icon icon="ant-design:file-add-outlined" />下载试题模板</a-button> -->
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="24">
<!-- <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="importXls">导入试题</j-upload-button> -->
<a-button type="primary" @click="importOpen = true">导入试题</a-button>
<a-button type="primary" @click="addOpen = true" style="margin-left: 20px">手动添加</a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="jeecg-basic-table-form-container">
<a-form @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
@ -35,198 +51,740 @@
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<!-- <template #tableTitle>
</template> -->
<!--操作栏-->
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)"/>
<TableAction :actions="getTableAction(record)" />
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
<template #htmlSlot="{ text }">
<div v-html="text"></div>
</template>
<!--省市区字段回显插槽-->
<template #pcaSlot="{text}">
{{ getAreaTextByCode(text) }}
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
<template #fileSlot="{ text }">
<span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<a-modal
title="Excel导入指导"
:width="800"
:visible="importOpen"
:maskClosable="false"
:okButtonProps="{ class: { 'jee-hidden': true } }"
@cancel="importOpen = false"
cancelText="关闭"
>
<div style="padding: 20px; background-color: rgb(225, 243, 237); border-radius: 5px; margin: 20px">
<p>Excel导入指导</p>
<p>1.下载题目导入模板文件</p>
<p>2.按要求格式填写题目信息</p>
<p>3.在模板内录入信息后上传文件导入题目</p>
<p>4.点击导入题目选择已完成录入的文件平台将会验证数据的正确性</p>
<p>5.若发现错误会给予提示重新修正后再次上传:若无错误即将数据导入到平台中</p>
<p
><a @click="downloadByUrl({ url: '/downPath/stdrmb.xls', target: '_self', fileName: '试题导入模板.xls' })"
><Icon icon="ant-design:download-outlined" :size="20" />导入模板下载</a
></p
>
</div>
<div style="text-align: center; margin-top: 20px; margin-bottom: 20px">
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="importXls">导入试题</j-upload-button>
</div>
</a-modal>
<a-modal title="手动添加" :width="`80%`" :visible="addOpen" :maskClosable="false" @cancel="addOpen = false" cancelText="关闭" @ok="handleOk">
<div style="padding: 20px; margin: 20px">
<a-row style="min-height: 100px">
<a-col :span="4" style="padding: 10px">
<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-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>
</a-card>
</a-col>
<a-col :span="20" style="overflow-y: scroll; min-height: 100px">
<draggable @end="end" v-model="tiganData" item-key="id">
<template #item="{ index, element: item }">
<div>
<!-- 单选题 -->
<div style="width: 100%" v-if="item.wjType == 3 || item.wjType == '3'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span>
<a-textarea
placeholder="请填写单选题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
/>
<span style="color: #c2bfbf">[单选]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select style="width: 120px" v-model:value="item.wjScore" placeholder="请选择分数" v-if="item.wjSfqh == '0'">
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e">自定义分数</span>
<a-input-number v-model:value="item.wjScore" style="width: 120px" v-if="item.wjSfqh == '1'"></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e">返回</span>
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24" style="color: darkgrey; font-size: 13px"> 选中即为正确答案 </a-col>
</a-row>
<a-radio-group v-model:value="item.itemSelected" style="width: 100%" size="default" :disabled="!isShow">
<div style="width: 100%" v-for="(tmxx, index) in item.wjxWjxxTmxxList" :key="index">
<a-radio :value="tmxx.itemIndex + ``" style="width: 100%">
<a-input
placeholder="请填写选项"
v-model:value="tmxx.itemTitle"
:style="{ width: handinpwei(tmxx.itemTitle) }"
:bordered="false"
/>
<span style="color: #ecb646" v-if="item.itemSelected == tmxx.itemIndex">(正确答案)</span>
<a-tooltip placement="topLeft" title="在下方添加新的选项"
><Icon
icon="ant-design:plus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleAddTmxx(tmxx, index, item.wjxWjxxTmxxList)"
/></a-tooltip>
<a-tooltip placement="topLeft" title="删除选项"
><Icon
icon="ant-design:minus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleRemTmxx(tmxx, index, item.wjxWjxxTmxxList)"
/></a-tooltip>
</a-radio>
</div>
</a-radio-group>
</a-card>
</div>
<!-- 多选题 -->
<div style="width: 100%" v-else-if="item.wjType == 4 || item.wjType == '4'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span
><a-textarea
placeholder="请填写多选题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
/>
<span style="color: #c2bfbf">[多选]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select style="width: 120px" v-model:value="item.wjScore" placeholder="请选择分数" v-if="item.wjSfqh == '0'">
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e">自定义分数</span>
<a-input-number v-model:value="item.wjScore" style="width: 120px" v-if="item.wjSfqh == '1'"></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e">返回</span>
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24" style="color: darkgrey; font-size: 13px"> 选中即为正确答案 </a-col>
</a-row>
<a-checkbox-group v-model:value="item.itemSelected" style="width: 100%" :disabled="!isShow" @change="handleChecked">
<a-row>
<a-col :span="24" v-for="(tmxx, index) in item.wjxWjxxTmxxList" :key="index">
<!-- -{{item.itemSelected}}-{{tmxx.itemIndex}} -->
<a-checkbox :value="tmxx.itemIndex"
><a-input
placeholder="请填写选项"
v-model:value="tmxx.itemTitle"
:bordered="false"
:style="{ width: handinpwei(tmxx.itemTitle) }"
/></a-checkbox>
<span style="color: #ecb646" v-if="cheGrp(item.itemSelected, tmxx.itemIndex)">(正确答案)</span>
<a-tooltip placement="topLeft" title="在下方添加新的选项"
><Icon
icon="ant-design:plus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleAddTmxx(tmxx, index, item.wjxWjxxTmxxList)"
/></a-tooltip>
<a-tooltip placement="topLeft" title="删除选项"
><Icon
icon="ant-design:minus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleRemTmxx(tmxx, index, item.wjxWjxxTmxxList)"
/></a-tooltip>
</a-col>
</a-row>
</a-checkbox-group>
</a-card>
</div>
<!-- 填空题 -->
<div style="width: 100%" v-else-if="item.wjType == 5 || item.wjType == '5'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span
><a-textarea
placeholder="请填写填空题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
/>
<span style="color: #c2bfbf">[填空]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select style="width: 120px" v-model:value="item.wjScore" placeholder="请选择分数" v-if="item.wjSfqh == '0'">
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e">自定义分数</span>
<a-input-number v-model:value="item.wjScore" style="width: 120px" v-if="item.wjSfqh == '1'"></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e">返回</span>
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24">
<a-textarea
placeholder="请填写答案"
v-model:value="item.wjAnswer"
:bordered="false"
style="width: 100%"
:auto-size="{ minRows: 1, maxRows: 5 }"
/>
</a-col>
</a-row>
</a-card>
</div>
<!-- 文件上传 -->
<div style="width: 100%" v-else-if="item.wjType == 8 || item.wjType == '8'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span>
<a-textarea
placeholder="请填写文件上传题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
/>
<span style="color: #c2bfbf">[文件上传]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select style="width: 120px" v-model:value="item.wjScore" placeholder="请选择分数" v-if="item.wjSfqh == '0'">
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e">自定义分数</span>
<a-input-number v-model:value="item.wjScore" style="width: 120px" v-if="item.wjSfqh == '1'"></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e">返回</span>
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
/></a-tooltip>
</template>
</a-card>
</div>
<div v-else> 无对应类型 -{{ item.wjType }}- </div>
</div>
</template>
</draggable>
<!-- 题干信息 -->
<div style="width: 100%" v-for="(item, index) in tiganData" :key="index"> </div>
</a-col>
</a-row>
</div>
</a-modal>
<!-- 表单区域 -->
<WjxWjxxTmlbModal @register="registerModal" @success="handleSuccess"></WjxWjxxTmlbModal>
</div>
</template>
<script lang="ts" name="wjxWjxxTmlb-siyou" setup>
import {ref, reactive,watch, computed, unref,onMounted} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
import { defHttp } from '/@/utils/http/axios';
import WjxWjxxTmlbModal from './components/WjxWjxxTmlbModal.vue'
import {columns, searchFormSchema} from './WjxWjxxTmlb.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,distinctList} from './WjxWjxxTmlb.api';
import {downloadFile} from '/@/utils/common/renderUtils';
import { JInput,JDictSelectTag } from '/@/components/Form';
import { useUserStore } from '/@/store/modules/user';
import { ref, reactive, watch, computed, unref, onMounted } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { useModal } from '/@/components/Modal';
import { defHttp } from '/@/utils/http/axios';
import WjxWjxxTmlbModal from './components/WjxWjxxTmlbModal.vue';
import { columns, searchFormSchema } from './WjxWjxxTmlb.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, distinctList } from './WjxWjxxTmlb.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import { JInput, JDictSelectTag } from '/@/components/Form';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
import { useGlobSetting } from '/@/hooks/setting';
import { downloadByUrl } from '/@/utils/file/download';
import draggable from 'vuedraggable';
//
const userStore = useUserStore();
const checkedKeys = ref<Array<string | number>>([]);
// const wjLeixing = ref<string>('');
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
// title: '',
api: distinctList,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed:'right'
},
beforeFetch: (params) => {
params.column = 'id',params.order = 'desc';//
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name:"题目信息",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
})
//
const userStore = useUserStore();
const checkedKeys = ref<Array<string | number>>([]);
const importOpen = ref<boolean>(false);
const addOpen = ref<boolean>(false);
const glob = useGlobSetting();
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
const tiganData = ref<any>([]);
const isShow = ref<boolean>(true);
const mainId = ref<string>('');
const wjLeixing = ref<string>('6');
// const wjLeixing = ref<string>('');
//model
const [registerModal, { openModal }] = useModal();
const { createConfirm, createMessage, createWarningModal } = useMessage();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
// title: '',
api: distinctList,
columns,
canResize: false,
useSearchForm: false,
actionColumn: {
width: 240,
fixed: 'right',
},
beforeFetch: (params) => {
(params.column = 'id'), (params.order = 'desc'); //
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name: '题目信息',
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess,
},
});
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
const props = defineProps({
wjLeixing: { type: String },
});
//
watch(() => props.wjLeixing, async (newRow, oldRow) => {
console.log(`🚀 ~ watch ~ newRow, oldRow:`, newRow, oldRow)
const props = defineProps({
wjLeixing: { type: String },
});
//
watch(
() => props.wjLeixing,
async (newRow, oldRow) => {
console.log(`🚀 ~ watch ~ newRow, oldRow:`, newRow, oldRow);
queryParam.value.wjLeixing = newRow;
},{ deep: true });
/**
* 编辑事件
*/
function handleEdit(record: Recordable,wjSytype) {
defHttp.post({url:'/wjxWjxxTmlb/wjxWjxxTmlb/editSwgysy',params:{id:record.id,wjSytype}}).then(res=>{
reload();
})
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record){
if(record.wjSytype == '0'){
return [
{
label: '设为公有',
onClick: handleEdit.bind(null, record,'1'),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
}
]
}else{
return [
{
label: '设为私有',
onClick: handleEdit.bind(null, record,'0'),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
}
]
},
{ deep: true }
);
function handleOk() {
const data = tiganData.value;
console.log('🧝‍♀️', data);
defHttp.post({ url: '/wjxWjxxTmlb/wjxWjxxTmlb/add', params: data }).then((res) => {
console.log('👞', res);
addOpen.value = false;
searchQuery();
});
}
function handleChecked(record) {
record = record + '';
}
/**
* 拖动结束事件
* @param evt
*/
function end(evt) {
for (var i = 0; i < tiganData.value.length; i++) {
tiganData.value[i].wjIndex = i + 1;
}
}
function cheGrp(a, b) {
var retChe = false;
if (a) {
for (var i = 0; i < a.length; i++) {
if (a[i] == b) {
retChe = true;
break;
}
}
}
/* ----------------------以下为原生查询需要添加的-------------------------- */
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//
reload();
}
return retChe;
}
//
function handleAddTmxx(record, index, list) {
var itemIndex = 0;
for (var i = 0; i < list.length; i++) {
var lssx = list[i].itemIndex;
if (itemIndex < parseInt(lssx)) {
itemIndex = lssx;
}
}
onMounted(() => {
// wjLeixing.value = "1";
// console.log(`🚀 ~ onMounted ~ wjLeixing:`, wjLeixing)
// queryParam.value.wjLeixing = wjLeixing;
queryParam.value.createBy = userStore.getUserInfo.username;
list.push({ itemTitle: null, itemIndex: parseInt(itemIndex) + 1 });
}
//
function handleRemTmxx(record, index, list) {
if (list.length <= 2) {
createMessage.error('至少保留两个选项');
} else {
list.splice(index, 1);
}
}
//
function handinpwei(value) {
if (!value) {
return '20rem';
} else {
if (String(value).length * 1.1 < 20) {
return '20rem';
} else if (String(value).length * 1.1 > 60) {
return '60rem';
} else {
return String(value).length * 1.1 + 'rem';
}
}
}
//
function handleQiehuan(record, type) {
console.log(`🚀 ~ handleQiehuan ~ type:`, type);
console.log(`🚀 ~ handleQiehuan ~ record:`, record);
record.wjSfqh = type;
}
//
function handleDelTigan(record, index) {
tiganData.value.splice(index, 1);
for (var i = 0; i < tiganData.value.length; i++) {
tiganData.value[i].wjIndex = i + 1;
}
}
//
function addTigan(type) {
console.log('😸', type);
var list = tiganData.value;
console.log('👩‍🦱', list);
if (type == 3) {
console.log('11111111111111111111');
var chk = '';
if (isShow.value) {
chk = '1';
}
console.log('2222222222222222222');
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
itemSelected: chk,
wjSfqh: '0',
wjxWjxxTmxxList: [
{ itemTitle: null, itemIndex: '1' },
{ itemTitle: null, itemIndex: '2' },
],
};
console.log('💇‍♀️', params);
list.push(params);
console.log('👩‍🔬', list);
tiganData.value = [...list];
} else if (type == 4) {
let chk = '';
if (isShow.value) {
chk = '1,2';
}
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
itemSelected: chk,
wjSfqh: '0',
wjxWjxxTmxxList: [
{ itemTitle: null, itemIndex: '1' },
{ itemTitle: null, itemIndex: '2' },
],
};
list.push(params);
tiganData.value = [...list];
} else if (type == 5) {
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
wjAnswer: null,
wjSfqh: '0',
};
list.push(params);
tiganData.value = [...list];
} else if (type == 8) {
var chk = '';
if (isShow.value) {
chk = '1';
}
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
wjSfqh: '0',
};
list.push(params);
tiganData.value = [...list];
}
}
/**
* 导入xls
* @param data 导入的数据
* @param url
*/
async function importXls(data, url) {
url = '/wjxWjxxTmlb/wjxWjxxTmlb/importExcel';
const isReturn = (fileInfo) => {
try {
if (fileInfo.code === 201) {
let {
message,
result: { msg, fileUrl, fileName },
} = fileInfo;
let href = glob.uploadUrl + fileUrl;
createWarningModal({
title: message,
centered: false,
content: `<div>
<span>${msg}</span><br/>
<span>具体详情请<a href = ${href} download = ${fileName}> 点击下载 </a> </span>
</div>`,
});
//update-begin---author:wangshuai ---date:20221121 for[VUEN-2827]------------
} else if (fileInfo.code === 500 || fileInfo.code === 510) {
createMessage.error(fileInfo.message || `${data.file.name} 导入失败`);
//update-end---author:wangshuai ---date:20221121 for[VUEN-2827]------------
} else {
createWarningModal({
centered: false,
content: `<div>
<span>${fileInfo.message}</span><br/>
</div>`,
});
}
} catch (error) {
console.log('导入的数据异常', error);
} finally {
}
};
await defHttp.uploadFile({ url }, { file: data.file }, { success: isReturn });
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable, wjSytype) {
defHttp.post({ url: '/wjxWjxxTmlb/wjxWjxxTmlb/editSwgysy', params: { id: record.id, wjSytype } }).then((res) => {
reload();
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 详情
*/
function handleEdit2(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '设为私有',
onClick: handleEdit.bind(null, record, '0'),
ifShow:record.wjSytype == '1'
},
{
label: '设为公有',
onClick: handleEdit.bind(null, record, '1'),
ifShow:record.wjSytype == '0'
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '删除',
onClick: handleDelete.bind(null, record),
ifShow: (record.mainId == '' || record.mainId == null),
},
{
label: '修改',
onClick: handleEdit2.bind(null, record),
ifShow: (record.mainId == '' || record.mainId == null),
},
{
label: '已使用不能修改',
ifShow: (record.mainId != '' && record.mainId != null),
disabled: true,
},
];
// if (record.wjSytype == '0') {
// return [
// {
// label: '',
// onClick: handleEdit.bind(null, record, '1'),
// },
// {
// label: '',
// onClick: handleDetail.bind(null, record),
// ifShow: (record.mainId == '' || record.mainId == null),
// },
// {
// label: '',
// onClick: handleDetail.bind(null, record),
// ifShow: (record.mainId == '' || record.mainId == null),
// },
// ];
// } else {
// return [
// {
// label: '',
// onClick: handleEdit.bind(null, record, '0'),
// },
// {
// label: '',
// onClick: handleDetail.bind(null, record),
// },
// ];
// }
}
/* ----------------------以下为原生查询需要添加的-------------------------- */
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//
reload();
}
onMounted(() => {
// wjLeixing.value = "1";
// console.log(`🚀 ~ onMounted ~ wjLeixing:`, wjLeixing)
// queryParam.value.wjLeixing = wjLeixing;
queryParam.value.createBy = userStore.getUserInfo.username;
reload();
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
.jeecg-basic-table-form-container {
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
.query-group-cust {
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
text-align: center;
}
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<div style="padding: 20px;">
<a-tabs v-model:activeKey="activeKey">
<a-tabs v-model:activeKey="activeKey" @change="onChangeTab">
<a-tab-pane key="1" tab="我的题库"><TikuList :wjLeixing="wjLeixing"/></a-tab-pane>
<a-tab-pane key="2" tab="公有题库" force-render><TikuGongyouList :wjLeixing="wjLeixing" /></a-tab-pane>
<a-tab-pane key="2" tab="公有题库" force-render><TikuGongyouList ref="gytkRef" :wjLeixing="wjLeixing" /></a-tab-pane>
</a-tabs>
</div>
</template>
@ -13,6 +13,7 @@
import TikuGongyouList from '/@/views/kc/wjxWjxxTmlb/TikuGongyouList.vue'
const activeKey = ref('1');
const gytkRef = ref();
const wjLeixing = ref<string>('');
function init(record){
@ -20,6 +21,12 @@
wjLeixing.value = record.wjLeixing;
}
function onChangeTab(tab){
if(tab==2){
gytkRef.value.searchQuery();
}
}
defineExpose({
init,
});

View File

@ -1,28 +1,278 @@
<template>
<a-spin :spinning="loading">
<a-form v-bind="formItemLayout">
<a-row>
<a-col :span="12">
<a-form-item label="题干" v-bind="validateInfos.wjTitle">
<a-input v-model:value="formData.wjTitle" placeholder="请输入题干" :disabled="disabled"></a-input>
</a-form-item>
</a-col>
<a-col :span="12" v-if="formData.wjLeixing == '6'">
<a-form-item label="问题分值" v-bind="validateInfos.wjScore">
<a-input-number v-model:value="formData.wjScore" placeholder="请输入问题分值" style="width: 100%" :disabled="disabled"/>
</a-form-item>
</a-col>
<a-col :span="12" v-if="formData.wjAnswer">
<a-form-item label="正确答案" >
<a-input-number v-model:value="formData.wjAnswer" placeholder="请输入正确答案" style="width: 100%" :disabled="disabled"/>
</a-form-item>
</a-col>
</a-row>
<draggable @end="end" v-model="tiganData" item-key="id">
<template #item="{ index, element: item }">
<div>
<!-- 单选题 -->
<div style="width: 100%" v-if="item.wjType == 3 || item.wjType == '3'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span>
<a-textarea
placeholder="请填写单选题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
:disabled="editDisabled"
/>
<span style="color: #c2bfbf">[单选]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled">返回</span>
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
v-if="!editDisabled"
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24" style="color: darkgrey; font-size: 13px"> 选中即为正确答案 </a-col>
</a-row>
<a-radio-group v-model:value="item.itemSelected" style="width: 100%" size="default" :disabled="!isShow">
<div style="width: 100%" v-for="(tmxx, index) in item.wjxWjxxTmxxList" :key="index">
<a-radio :value="tmxx.itemIndex + ``" style="width: 100%">
<a-input
placeholder="请填写选项"
v-model:value="tmxx.itemTitle"
:style="{ width: handinpwei(tmxx.itemTitle) }"
:bordered="false"
:disabled="editDisabled"
/>
<span style="color: #ecb646" v-if="item.itemSelected == tmxx.itemIndex">(正确答案)</span>
<a-tooltip placement="topLeft" title="在下方添加新的选项"
><Icon
icon="ant-design:plus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleAddTmxx(tmxx, index, item.wjxWjxxTmxxList)"
v-if="!editDisabled"
/></a-tooltip>
<a-tooltip placement="topLeft" title="删除选项"
><Icon
icon="ant-design:minus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleRemTmxx(tmxx, index, item.wjxWjxxTmxxList)"
v-if="!editDisabled"
/></a-tooltip>
</a-radio>
</div>
</a-radio-group>
</a-card>
</div>
<!-- 多选题 -->
<div style="width: 100%" v-else-if="item.wjType == 4 || item.wjType == '4'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span
><a-textarea
placeholder="请填写多选题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
:disabled="editDisabled"
/>
<span style="color: #c2bfbf">[多选]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled">返回</span>
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
v-if="!editDisabled"
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24" style="color: darkgrey; font-size: 13px"> 选中即为正确答案 </a-col>
</a-row>
<a-checkbox-group v-model:value="item.itemSelected" style="width: 100%" :disabled="!isShow" @change="handleChecked">
<a-row>
<a-col :span="24" v-for="(tmxx, index) in item.wjxWjxxTmxxList" :key="index">
<!-- -{{item.itemSelected}}-{{tmxx.itemIndex}} -->
<a-checkbox :value="tmxx.itemIndex"
><a-input
placeholder="请填写选项"
v-model:value="tmxx.itemTitle"
:bordered="false"
:style="{ width: handinpwei(tmxx.itemTitle) }"
:disabled="editDisabled"
/></a-checkbox>
<span style="color: #ecb646" v-if="cheGrp(item.itemSelected, tmxx.itemIndex)">(正确答案)</span>
<a-tooltip placement="topLeft" title="在下方添加新的选项"
><Icon
icon="ant-design:plus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleAddTmxx(tmxx, index, item.wjxWjxxTmxxList)"
v-if="!editDisabled"
/></a-tooltip>
</a-col>
</a-row>
</a-checkbox-group>
</a-card>
</div>
<!-- 填空题 -->
<div style="width: 100%" v-else-if="item.wjType == 5 || item.wjType == '5'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span
><a-textarea
placeholder="请填写填空题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
:disabled="editDisabled"
/>
<span style="color: #c2bfbf">[填空]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled">返回</span>
</a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24">
<a-textarea
placeholder="请填写答案"
v-model:value="item.wjAnswer"
:bordered="false"
style="width: 100%"
:auto-size="{ minRows: 1, maxRows: 5 }"
:disabled="editDisabled"
/>
</a-col>
</a-row>
</a-card>
</div>
<!-- 文件上传 -->
<div style="width: 100%" v-else-if="item.wjType == 8 || item.wjType == '8'">
<a-card>
<template #title>
<span>{{ index + 1 }}</span>
<a-textarea
placeholder="请填写文件上传题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
:disabled="editDisabled"
/>
<span style="color: #c2bfbf">[文件上传]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled">返回</span>
</a-tooltip>
</template>
</a-card>
</div>
<div v-else></div>
</div>
</template>
</draggable>
</a-form>
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" animated v-if="!formData.wjAnswer">
<a-tab-pane tab="选项信息" key="wjxWjxxTmxx" :forceRender="true">
<!-- 子表单区域 -->
<!-- <a-tabs v-model:activeKey="activeKey" animated v-if="!formData.wjAnswer">
<a-tab-pane tab="选项信息2" key="wjxWjxxTmxx" :forceRender="true">
<j-vxe-table
:keep-source="true"
resizable
@ -34,149 +284,240 @@
:disabled="disabled"
:rowNumber="true"
:rowSelection="false"
:toolbar="false"/>
:toolbar="false">
</j-vxe-table>
</a-tab-pane>
</a-tabs>
</a-tabs> -->
</a-spin>
</template>
<script lang="ts">
import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
import { queryWjxWjxxTmxxListByMainId, queryDataById, saveOrUpdate } from '../WjxWjxxTmlb.api';
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
import {wjxWjxxTmxxColumns,wjxWjdcColumns} from '../WjxWjxxTmlb.data';
import { Form } from 'ant-design-vue';
const useForm = Form.useForm;
import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
import { queryWjxWjxxTmxxListByMainId, queryDataById, saveOrUpdate } from '../WjxWjxxTmlb.api';
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
import { wjxWjxxTmxxColumns, wjxWjdcColumns } from '../WjxWjxxTmlb.data';
import { useMessage } from '/@/hooks/web/useMessage';
import { Form } from 'ant-design-vue';
import draggable from 'vuedraggable';
const useForm = Form.useForm;
export default defineComponent({
name: "WjxWjxxTmlbForm",
components:{
JVxeTable,
export default defineComponent({
name: 'WjxWjxxTmlbForm',
components: {
JVxeTable,
draggable,
},
props: {
formDisabled: {
type: Boolean,
default: false,
},
props:{
formDisabled:{
type: Boolean,
default: false
},
formData: { type: Object, default: ()=>{} },
formBpm: { type: Boolean, default: true }
},
emits:['success'],
setup(props, {emit}) {
const loading = ref(false);
const wjxWjxxTmxxTableRef = ref();
const activeKey = ref('wjxWjxxTmxx');
const formData = reactive<Record<string, any>>({
id: '',
wjTitle: '',
wjScore: '',
});
const wjxWjxxTmxxTable = reactive<Record<string, any>>({
loading: false,
columns: wjxWjxxTmxxColumns,
dataSource: []
});
//
const validatorRules = reactive({
});
const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: true});
const dbData = {};
const formItemLayout = {
labelCol: {xs: {span: 24}, sm: {span: 5}},
wrapperCol: {xs: {span: 24}, sm: {span: 16}},
};
formData: { type: Object, default: () => {} },
formBpm: { type: Boolean, default: true },
},
emits: ['success'],
setup(props, { emit }) {
const loading = ref(false);
const wjxWjxxTmxxTableRef = ref();
const activeKey = ref('wjxWjxxTmxx');
const isShow = ref<boolean>(true);
const editDisabled = ref<boolean>(true);
const tiganData = ref<any>([]);
const { createConfirm, createMessage, createWarningModal } = useMessage();
const formData = reactive<Record<string, any>>({
id: '',
wjTitle: '',
wjScore: '',
});
const wjxWjxxTmxxTable = reactive<Record<string, any>>({
loading: false,
columns: wjxWjxxTmxxColumns,
dataSource: [],
});
//
const validatorRules = reactive({});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
const dbData = {};
const formItemLayout = {
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
};
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
//
const disabled = computed(() => {
if (props.formBpm === true) {
if (props.formData.disabled === false) {
return false;
} else {
return true;
}
return props.formDisabled;
}
return props.formDisabled;
});
function add() {
resetFields();
wjxWjxxTmxxTable.dataSource = [];
}
async function edit(row, formDisabled) {
console.log('😺', formDisabled.value);
console.log('😰', row);
editDisabled.value = formDisabled.value;
defHttp.get({ url: '/wjxWjxxTmlb/wjxWjxxTmlb/getTmxxByTmlbid', params: { id: row.id } }).then((res) => {
console.log('👦', res);
tiganData.value = res;
});
// //
// await queryMainData(row.id);
// //
// const wjxWjxxTmxxDataList = await queryWjxWjxxTmxxListByMainId(row['id']);
// wjxWjxxTmxxTable.dataSource = [...wjxWjxxTmxxDataList];
}
async function queryMainData(id) {
const row = await queryDataById(id);
Object.keys(row).map((k) => {
formData[k] = row[k];
});
}
function add() {
resetFields();
wjxWjxxTmxxTable.dataSource = [];
}
const { getSubFormAndTableData, transformData } = useValidateAntFormAndTable(activeKey, {
wjxWjxxTmxx: wjxWjxxTmxxTableRef,
});
async function edit(row) {
//
await queryMainData(row.id);
//
const wjxWjxxTmxxDataList = await queryWjxWjxxTmxxListByMainId(row['id']);
wjxWjxxTmxxTable.dataSource = [...wjxWjxxTmxxDataList];
}
async function getFormData() {
await validate();
return transformData(toRaw(formData));
}
async function queryMainData(id) {
const row = await queryDataById(id);
Object.keys(row).map(k => {
formData[k] = row[k];
async function submitForm() {
const mainData = await getFormData();
const subData = await getSubFormAndTableData();
const values = Object.assign({}, dbData, mainData, subData);
console.log('表单提交数据', values);
const isUpdate = values.id ? true : false;
await saveOrUpdate(values, isUpdate);
//
emit('success');
}
function setFieldsValue(values) {
if (values) {
Object.keys(values).map((k) => {
formData[k] = values[k];
});
}
}
const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, {
'wjxWjxxTmxx': wjxWjxxTmxxTableRef,
});
/**
* 值改变事件触发-树控件回调
* @param key
* @param value
*/
function handleFormChange(key, value) {
formData[key] = value;
}
async function getFormData() {
await validate();
return transformData(toRaw(formData))
}
function handleChecked(record) {
record = record + '';
}
/**
* 拖动结束事件
* @param evt
*/
function end(evt) {
// for (var i = 0; i < tiganData.value.length; i++) {
// tiganData.value[i].wjIndex = i + 1;
// }
}
async function submitForm() {
const mainData = await getFormData();
const subData = await getSubFormAndTableData();
const values = Object.assign({}, dbData, mainData, subData);
console.log('表单提交数据', values)
const isUpdate = values.id ? true : false
await saveOrUpdate(values, isUpdate);
//
emit('success');
}
function setFieldsValue(values) {
if(values){
Object.keys(values).map(k=>{
formData[k] = values[k];
});
function cheGrp(a, b) {
var retChe = false;
if (a) {
for (var i = 0; i < a.length; i++) {
if (a[i] == b) {
retChe = true;
break;
}
}
}
/**
* 值改变事件触发-树控件回调
* @param key
* @param value
*/
function handleFormChange(key, value) {
formData[key] = value;
return retChe;
}
//
function handleAddTmxx(record, index, list) {
var itemIndex = 0;
for (var i = 0; i < list.length; i++) {
var lssx = list[i].itemIndex;
if (itemIndex < parseInt(lssx)) {
itemIndex = lssx;
}
}
list.push({ itemTitle: null, itemIndex: parseInt(itemIndex) + 1 });
}
return {
wjxWjxxTmxxTableRef,
wjxWjxxTmxxTable,
validatorRules,
validateInfos,
activeKey,
loading,
formData,
setFieldsValue,
handleFormChange,
formItemLayout,
disabled,
getFormData,
submitForm,
add,
edit
//
function handleRemTmxx(record, index, list) {
if (list.length <= 2) {
createMessage.error('至少保留两个选项');
} else {
list.splice(index, 1);
}
}
});
//
function handinpwei(value) {
if (!value) {
return '20rem';
} else {
if (String(value).length * 1.1 < 20) {
return '20rem';
} else if (String(value).length * 1.1 > 60) {
return '60rem';
} else {
return String(value).length * 1.1 + 'rem';
}
}
}
//
function handleQiehuan(record, type) {
console.log(`🚀 ~ handleQiehuan ~ type:`, type);
console.log(`🚀 ~ handleQiehuan ~ record:`, record);
record.wjSfqh = type;
}
return {
wjxWjxxTmxxTableRef,
wjxWjxxTmxxTable,
validatorRules,
validateInfos,
activeKey,
loading,
formData,
setFieldsValue,
handleFormChange,
formItemLayout,
disabled,
getFormData,
submitForm,
add,
edit,
handinpwei,
handleQiehuan,
handleAddTmxx,
handleRemTmxx,
cheGrp,
end,
handleChecked,
isShow,
tiganData,
editDisabled,
};
},
});
</script>

View File

@ -26,11 +26,11 @@
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
isUpdate.value = !!data?.isUpdate;
title.value ='详情'
formDisabled.value = !data?.showFooter;
title.value =formDisabled.value?'详情':'修改'
if (unref(isUpdate)) {
console.log('data', data)
formComponent.value.edit(data.record)
formComponent.value.edit(data.record,formDisabled)
}else{
formComponent.value.add()
}