添加功能

This commit is contained in:
yangjun 2024-05-13 16:29:57 +08:00
parent 70a24be075
commit 622ed8a4a1
12 changed files with 386 additions and 58 deletions

View File

@ -54,13 +54,17 @@
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { ref, onMounted, watch,unref } from 'vue';
import { TeamOutlined, FormOutlined } from '@ant-design/icons-vue';
import { Pagination } from 'ant-design-vue';
import { getUserId, getSysConfig } from '/@/views/site/utils/index';
import { useRouter } from 'vue-router';
import KcXsktjxmydcpDetailModal from '/@/views/kc/kcXsktjxmydcp/components/KcXsktjxmydcpDetailModal.vue';
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh,xqxn } = query;//
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/kcXsktjxmydcp/kcXsktjxmydcp/groupByList'
@ -101,10 +105,16 @@ watch(
);
function init() {
async function init() {
console.log('init');
loadingList.value = true
listApi({ jgh: getUserId(), searchByNowXqxn: true, ...props.queryParam }).then(res => {
loadingList.value = true;
console.log('props.queryParam-1-->',props.queryParam);
await defHttp.get({ url: '/ktgl/kcKechengbiao/getKcxxByRwbhXqxn', params: { rwbh:rwbh,xqxn:xqxn } }).then((res) => {
console.log(`🚀 ~ defHttp.get ~ res:`, res)
props.queryParam.kcbh = res.kcbh;
});
console.log('props.queryParam-2-->',props.queryParam);
await listApi({ jgh: getUserId(), searchByNowXqxn: true, ...props.queryParam }).then(res => {
list.value = res?.records ?? [];
total.value = res.total;

View File

@ -12,29 +12,29 @@
<a-card>
<div style="line-height: 30px; font-size: 18px; font-weight: bold;width:100%;">
<span style="float: left;">常见问题</span>
<span style="float: right;"><a-button type="primary">新增</a-button></span>
<span style="float: right;"><a-button type="primary" @click="addCjwtHanle">新增</a-button></span>
</div>
<a-row style="margin-top: 50px;width:100%;display: block;">
<a-col :span="24" v-for="i in 3">
<a-col :span="24" v-for="(item,index) in cjwtSource" :key="index">
<a-row>
<a-col :span="24">
<span style="float: left;">{{i}}.问题</span>
<span style="float: left;">{{index+1}}.{{item.question}}</span>
<span style="float: right;">
<a title="修改"><Icon icon="ant-design:form-outlined" /></a>
<a title="修改" @click="handleEdit(item)"><Icon icon="ant-design:form-outlined" /></a>
<a-divider type="vertical" style="height: 30px; background-color: #7cb305" />
<a title="删除"><Icon icon="ant-design:delete-outlined" /></a>
<a title="删除" @click="handleDelete(item)"><Icon icon="ant-design:delete-outlined" /></a>
</span>
</a-col>
<a-col :span="24"><span><Icon icon="ant-design:caret-right-outlined" />就是一个常见的问题及答案</span></a-col>
<a-col :span="24"><span><Icon icon="ant-design:caret-right-outlined" />{{item.answer}}</span></a-col>
<a-col :span="24">
<a-divider />
</a-col>
</a-row>
</a-col>
<a-col :span="24">
<a-col :span="24" v-show="cjwtSource.length>0">
<a-pagination v-model="current" :total="total" @change="handlePageChange" :pageSize="pageSize" style="text-align: right;"/>
</a-col>
<a-col :span="24" v-show="false">
<a-col :span="24" v-show="cjwtSource.length==0">
<a-empty/>
</a-col>
</a-row>
@ -43,8 +43,9 @@
<div style="line-height: 30px; font-size: 18px; font-weight: bold;width:100%;">
<span style="float: left;">往届学生评价</span>
</div>
<studentPjjgTeaList :queryParam="{ pageSize: 3, ...tkzjParam }" style="max-height: 106px;"/>
<studentPjjgTeaList :queryParam="{ pageSize: 3, ...tkzjParam,kcbh:'' }" style="max-height: 106px;"/>
</a-card>
<ZyCjwtModal ref="ZyCjwtModalPage" @success="handleCjwtOk" />
</div>
</template>
@ -56,32 +57,72 @@
import { Icon } from '/@/components/Icon';
import { Pagination, Empty } from 'ant-design-vue';
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
import { deleteOne } from '/@/views/zy/zyCjwt/ZyCjwt.api';
import headerPage from '/@/views/site/common/header.vue';
import footerPage from '/@/views/site/common/footer.vue';
import studentPjjgTeaList from '/@/views/site/pjjgPage/studentPjjgTeaList.vue';
import ZyCjwtModal from '/@/views/zy/zyCjwt/components/ZyCjwtModal.vue';
//
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh } = query;//
const { rwbh,xqxn } = query;//
const APagination = Pagination;
const current = ref<number>(0);
const total = ref<number>(0);
const pageNo = ref<number>(0);
const pageSize = ref<number>(3);
const tkzjParam = ref({});
const tkzjParam = ref({rwbh:rwbh});
const ZyCjwtModalPage = ref();
const cjwtSource = ref([]);
let router = useRouter();
const jxdgInfo = ref({
filePath:''
});
//
function addCjwtHanle(){
var params = { rwbh:rwbh,xqxn:xqxn };
ZyCjwtModalPage.value.disableSubmit = false;
ZyCjwtModalPage.value.add(params);
}
/**
* 常见问题编辑事件
*/
function handleEdit(record: Recordable) {
ZyCjwtModalPage.value.disableSubmit = false;
ZyCjwtModalPage.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleCjwtOk);
}
//
function handleCjwtOk() {
console.log('--------cjwt ok -----------')
cjwtData(1);
}
//
function handlePageChange(page: number) {
cjwtData(page);
}
function cjwtData(arg){
defHttp.get({ url: '/zyCjwt/zyCjwt/list', params: { pageSize: 3,pageNo:arg, rwbh:rwbh,xqxn:xqxn } }).then((res) => {
console.log(`🚀 ~ defHttp.get ~ res:`, res)
cjwtSource.value = res.records;
console.log(`🚀 ~ defHttp.get ~ cjwtSource:`, cjwtSource)
});
}
//
onMounted(() => {
cjwtData(1);
});
</script>

View File

@ -20,11 +20,11 @@
</a-menu-item>
<a-sub-menu key="sub4">
<template #title>测验/作业</template>
<a-menu-item key="4" @click="getGzt('dqzy')">当前作业</a-menu-item>
<a-menu-item key="5" @click="getGzt('lszy')">历史作业</a-menu-item>
<a-menu-item key="4" @click="getGzt('dqzy')">课程作业</a-menu-item>
<a-menu-item key="5" @click="getGzt('lszy')">课程测验</a-menu-item>
</a-sub-menu>
<a-menu-item key="sub5">
<span>课堂调查</span>
<span>问卷调查</span>
</a-menu-item>
<a-menu-item key="sub5">
<span>讨论区</span>
@ -59,12 +59,13 @@
function getGzt(zytype){
console.log(`🚀 ~ getGzt ~ type:`, zytype)
var href = "/stuzy/dqkcDqzy";
var href = "";
if(zytype=='dqzy'){
href = "/stuzy/studentDqzy";
}else if(zytype=='lszy'){
href = "/stuzy/studentLszy";
}
// else if(zytype=='lszy'){
// href = "/stuzy/studentLszy";
// }
router.push({path:href,query: {rwbh,xqxn,type}});
}

View File

@ -36,8 +36,17 @@ export const list = (params) => defHttp.get({ url: Api.list, params });
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}

View File

@ -4,7 +4,7 @@
<a-row>
<a-col :span="24">
<a-form-item label="问题" v-bind="validateInfos.question">
<a-textarea v-model:value="formData.question" rows="4" placeholder="请输入问题" :disabled="disabled"/>
<a-input v-model:value="formData.question" rows="4" placeholder="请输入问题" :disabled="disabled"/>
</a-form-item>
</a-col>
<a-col :span="24">
@ -65,8 +65,8 @@
/**
* 新增
*/
function add() {
edit({});
function add(record) {
edit(record);
}
/**

View File

@ -18,11 +18,11 @@
/**
* 新增
*/
function add() {
function add(record) {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
registerForm.value.add(record);
});
}

View File

@ -9,11 +9,11 @@
<a-input placeholder="请输入作业名称" v-model:value="queryParam.title"></a-input>
</a-form-item>
</a-col>
<a-col :lg="8">
<!-- <a-col :lg="8">
<a-form-item label="类型">
<j-dict-select-tag placeholder="请选择类型" v-model:value="queryParam.zyType" dictCode="zy_type"/>
</a-form-item>
</a-col>
</a-col> -->
<!-- <a-col :lg="8">
<a-form-item label="学年学期">
<a-input placeholder="请输入学年学期" v-model:value="queryParam.xnxq"></a-input>
@ -41,10 +41,10 @@
<div style="font-size: 18px;font-weight: bold;">{{item.zyType_dictText}}{{item.title}}</div>
</a-col>
<a-col :span="24" class="zyCon">时间{{item.startTime}} - {{item.endTime}}</a-col>
<a-col :span="24" class="zyCon"><div style="float:left">{{item.xnxq}}</div><div style="float:right;" @click="openXkrs(item)"><a>{{item.xkxs}}人选课</a></div></a-col>
<a-col :span="24" class="zyCon"><div style="float:left" v-if="item.score">{{item.score}}</div><div style="float:right;" @click="openXkrs(item)"><a>{{item.xkxs}}人选课</a></div></a-col>
<a-col :span="24" style="text-align:center;margin-top:20px;">
<a-button type="primary" @click="handleDetail(item)" style="margin-left:5px;background:rgb(28, 132, 198);">详情</a-button>
<a-button type="primary" @click="handleShangchuan(item)" style="margin-left:5px;background:rgb(28, 132, 198);" >上传</a-button>
<a-button type="primary" @click="handleShangchuan(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="!item.score" >上传</a-button>
</a-col>
</a-row>
</a-card>
@ -120,8 +120,9 @@
//
function handleShangchuan(record){
ZyInfoStudentModalPage.value.disableSubmit = false;
var param = {mainId:record.id,zyfj:record.filePath}
var param = {id:record.stuId,zyfj:record.filePath}
ZyInfoStudentModalPage.value.edit(param);
}
@ -162,11 +163,10 @@
queryParam.value.pageSize = pageSize;
queryParam.value.rwbh = rwbh;
queryParam.value.xqxn = xqxn;
queryParam.value.sflssj = '0';
queryParam.value.zyStatus = '1,2';
queryParam.value.column="startTime";
queryParam.value.order="asc";
defHttp.get({ url: '/zyInfo/zyInfo/list', params: queryParam.value }).then(res => {
queryParam.value.zyStatus = '1,2,3,4';
queryParam.value.column="createTime";
queryParam.value.order="desc";
defHttp.get({ url: '/zyInfo/zyInfo/stuList', params: queryParam.value }).then(res => {
console.log(`🚀 ~ defHttp.get ~ res:`, res)
total.value = res.total;
pageNo.value = res.pages;

View File

@ -52,7 +52,7 @@
<a-button type="primary" @click="handleFabu(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==0">发布</a-button>
<a-button type="primary" @click="handleDetail(item)" style="margin-left:5px;background:rgb(28, 132, 198);">详情</a-button>
<a-button type="primary" @click="handleZyxx(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==1||item.zyStatus==2||item.zyStatus==3">作业</a-button>
<a-button type="primary" @click="handleShangchuan(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==1||item.zyStatus==2||item.zyStatus==3">上传</a-button>
<!-- <a-button type="primary" @click="handleShangchuan(item)" style="margin-left:5px;background:rgb(28, 132, 198);" v-if="item.zyStatus==1||item.zyStatus==2||item.zyStatus==3">上传</a-button> -->
</a-col>
</a-row>
</a-card>
@ -189,7 +189,7 @@
var url = "/zyInfo/zyInfo/edit";
var params = {id:record.id,zyStatus:'1'};
defHttp.post({ url: url, params }).then((res) => {
handleSuccess();
handleZySuccess(record.id);
});
}
});
@ -202,6 +202,15 @@
function handleSuccess() {
reload()
}
function handleZySuccess(zyid){
setTimeout(()=>{handleSuccess()}, 1500);
var url = "/zyInfo/zyInfo/editStudent";
defHttp.get({ url: url, params:{id:zyid} }).then((res) => {
});
}
/**

View File

@ -19,18 +19,18 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'createTime'
},
{
title: '作业附件',
align: "center",
dataIndex: 'filePath',
slots: { customRender: 'fileSlot' },
},
{
title: '在线预览',
align: "center",
dataIndex: 'filePath',
slots: { customRender: 'fileZxSlot' },
},
// {
// title: '作业附件',
// align: "center",
// dataIndex: 'filePath',
// slots: { customRender: 'fileSlot' },
// },
// {
// title: '在线预览',
// align: "center",
// dataIndex: 'filePath',
// slots: { customRender: 'fileZxSlot' },
// },
{
title: '外网相似律',
align: "center",

View File

@ -48,6 +48,8 @@
</BasicTable>
<!-- 表单区域 -->
<ZyInfoStudentModal ref="registerModal" @success="handleSuccess"></ZyInfoStudentModal>
<ZyInfoStudentScoreModal ref="registerScoreModal" @success="handleSuccess"></ZyInfoStudentScoreModal>
</div>
</template>
@ -61,12 +63,15 @@
import ZyInfoStudentModal from './components/ZyInfoStudentModal.vue'
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import ZyInfoStudentScoreModal from '/@/views/zy/zyInfoStudent/components/ZyInfoStudentScoreModal.vue'
const queryParam = ref<any>({});
const mainId = ref<string>('');
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const registerScoreModal = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
@ -76,7 +81,7 @@ import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
canResize:false,
useSearchForm: false,
actionColumn: {
width: 120,
width: 220,
fixed: 'right',
},
beforeFetch: (params) => {
@ -124,6 +129,11 @@ import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
function handleScore(record: Recordable) {
registerScoreModal.value.disableSubmit = false;
registerScoreModal.value.edit(record);
}
/**
* 详情
@ -153,17 +163,61 @@ import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
function handleSuccess() {
reload();
}
function handleDown(record){
downloadFile(text);
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
if(record.filePath){
if(record.score){
var list = [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '下载',
onClick: handleDown.bind(null, record),
},
{
label: '预览',
onClick: yulanFile.bind(null, record),
}];
return list;
}else{
var list = [
{
label: '评分',
onClick: handleScore.bind(null, record),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '下载',
onClick: handleDown.bind(null, record),
},
{
label: '预览',
onClick: yulanFile.bind(null, record),
}];
return list;
}
}else{
var list = [
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
];
},];
return list;
}
}
/**

View File

@ -0,0 +1,129 @@
<template>
<a-spin :spinning="confirmLoading">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row>
<a-col :span="24">
<a-form-item label="评分" v-bind="validateInfos.score">
<a-input v-model:value="formData.score" :disabled="disabled" ></a-input>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../ZyInfoStudent.api';
import { Form } from 'ant-design-vue';
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: ()=>{} },
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
score: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//
const validatorRules = {
score: [{ required: true, message: '请输入评分!'},],
};
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true });
//
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
//
Object.assign(formData, record);
});
}
/**
* 提交数据
*/
async function submitForm() {
//
await validate();
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//
for (let data in model) {
//
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
min-height: 500px !important;
overflow-y: auto;
padding: 24px 24px 24px 24px;
}
</style>

View File

@ -0,0 +1,75 @@
<template>
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<ZyInfoStudentForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ZyInfoStudentForm>
</a-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import ZyInfoStudentForm from './ZyInfoStudentScoreForm.vue'
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = '评分';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style>
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>