添加常见问题等功能

This commit is contained in:
yangjun 2024-05-13 09:03:02 +08:00
parent f4b315f3b1
commit 70a24be075
18 changed files with 1395 additions and 16 deletions

View File

@ -19,7 +19,8 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
VITE_GLOB_API_URL=/jeecg-boot
#后台接口全路径地址(必填)
VITE_GLOB_DOMAIN_URL=https://zxkccx.webvpn.nenu.edu.cn/jeecg-boot
#VITE_GLOB_DOMAIN_URL=https://zxkccx.webvpn.nenu.edu.cn/jeecg-boot
VITE_GLOB_DOMAIN_URL=https://kczxcs.nenu.edu.cn/jeecg-boot
#RTC服务器地址
VITE_GLOB_RTC_SERVER = https://zxkccx.webvpn.nenu.edu.cn:8081
@ -37,5 +38,5 @@ VITE_USE_PWA = false
VITE_LEGACY = false
# 是否开启单点登录
VITE_GLOB_APP_OPEN_SSO = true
VITE_GLOB_APP_OPEN_SSO = false

View File

@ -19,7 +19,7 @@
<!-- 任教教程 -->
<renKeJiaoChengPage v-if="getUserSf()=='T'&&getSysConfig().flag2=='1'&&getSysConfig().sfbmd=='n'" />
<!-- 评价结果 -->
<pjjgPage v-if="getSysConfig().sfbmd=='n'"/>
<pjjgPage v-if="getSysConfig().sfbmd=='n'&&getUserSf()=='T'"/>
<!-- 预约课程 -->
<yuYueKeChengPage ref="yykcModeal" @orther-load="yykcLoad" v-if="getUserSf()=='T'&&getSysConfig().flag3=='1'"/>
<!-- 精彩公开课 -->

View File

@ -0,0 +1,184 @@
<template>
<div style="width:100%;text-align: right;line-height:40px;">
<a style="padding-right: 0.5rem;" @click="init()">刷新</a>
<RouterLink to="/site/xspjjgore">查看更多</RouterLink>
</div>
<a-list item-layout="horizontal" :data-source="list" :grid="{ gutter: 12, xs: 2, sm: 3, md: 3, lg: 3, xl: 3, xxl: 3, xxxl: 3 }">
<template #renderItem="{ item }">
<a-list-item>
<div style="border: 2px #eef1f2 solid;">
<div>
<div style="width: 100%;height: 20px;background-color: #1c84c6;"></div>
<div style="width:100%;white-space:normal; word-break:break-all;overflow:hidden;padding: 10px;height: 70px;font-weight: 600;font-size: 16px;">
{{ item.kcmc }}
</div>
</div>
<a-divider style="margin: 0px;color: #eef1f2;" />
<div style="padding: 20px;font-weight: 600;">
<a-row>
<a-col :span="16">
<div style="height: 38px;font-size: 16px;font-weight: 700;">{{ item.skjs }}</div>
<div style="font-size: 14px;font-weight: 700;height: 50px;">{{ item.kkdw }}</div>
</a-col>
<a-col :span="8" style="text-align: center;height: 70px;">
<div style="color: #1c84c6;font-size: 24px;font-weight: 600;">{{ item.xsrs }}</div>
<div style="font-size: 14px;font-weight: 700;">学生人数</div>
</a-col>
<a-col :span="24" style="margin-top:0px;font-weight: 700;">
<div>样本总数{{ item.ybzs }}</div>
<div> {{ item.cpl }}(%)</div>
<div> {{ item.yxs }}</div>
<div>综合评价{{ item.zhpj }}</div>
</a-col>
<a-col :span="24">
<a-row style="text-align: center;">
<a-col :span="24">
<a-button type="primary" class="bcClass" @click="openJspjPage(item)" >详情</a-button>
</a-col>
</a-row>
</a-col>
</a-row>
</div>
</div>
</a-list-item>
</template>
</a-list>
<a-pagination v-model="current" :total="total" show-less-items @change="handlePageChange" v-if="props.flagPage" style="text-align: right;" :hideOnSinglePage="true"/>
<KcXsktjxmydcpDetailModal ref="KcXsktjxmydcpDetailModalPage"/>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } 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 KcXsktjxmydcpDetailModal from '/@/views/kc/kcXsktjxmydcp/components/KcXsktjxmydcpDetailModal.vue';
import { defHttp } from '/@/utils/http/axios';
enum Api {
list = '/kcXsktjxmydcp/kcXsktjxmydcp/groupByList'
}
const KcXsktjxmydcpDetailModalPage = ref();
const current = ref<number>(0);
const total = ref<number>(2);
const loadingList = ref<boolean>(false);
const APagination = Pagination;
const emit = defineEmits(['changeParam']);
const props = defineProps({
queryParam: { type: Object, default: () => ({}) },
flagPage: { type:Boolean,default:false}
});
/**
* 列表接口
* @param params
*/
const listApi = (params) => defHttp.get({ url: Api.list, params });
const list = ref<any>([]);
onMounted(() => {
init();
});
watch(
() => props.queryParam,
(v) => init(),
{
deep:true,
immediate:true,
}
);
function init() {
console.log('init');
loadingList.value = true
listApi({ jgh: getUserId(), searchByNowXqxn: true, ...props.queryParam }).then(res => {
list.value = res?.records ?? [];
total.value = res.total;
current.value = res.current;
list.value = res.records
loadingList.value = false
});
}
function handlePageChange(record){
emit('changeParam',record);
// loadData();
}
/**
* 转换时间由0012转成00:12
* @param time 四个字符时分无分隔
*/
function formatTime(time: string) {
if(!time) return '';
let t_i_m_e = time.split('');
return [t_i_m_e[0],t_i_m_e[1],':',t_i_m_e[2],t_i_m_e[3]].join('');
}
function onSearch() {
init();
}
//
function openJspjPage(item) {
KcXsktjxmydcpDetailModalPage.value.disableSubmit = true;
KcXsktjxmydcpDetailModalPage.value.edit(item)
}
defineExpose({
onSearch
});
</script>
<style lang="less" scoped>
.wenZiJuZhong {
text-align: center;
}
.wenZiJiaCu {
font-weight: 700;
}
.fs1d1r {
font-size: 16px;
min-height: 55.281px;
}
.hand {
cursor:pointer;
}
.dateAndTime {
padding-top: 10px;
}
.yyyClass{
background: #6cafda;font-weight: 600;color:#fff;border-radius: 5px;line-height: 23px;
}
.yyClass{
background-color: #1c84c6;font-weight: 600;color:#fff;border-radius: 5px;line-height: 23px;
}
.bcClass{
background-color: #1c84c6;font-weight: 600;border-radius: 5px;line-height: 23px;
}
.itemDate {
border-radius: 25px;
background: #cccccc8c;
width: 90%;
margin-bottom: 0.5rem;
text-align: center;
margin: 0 auto .5rem;
padding: 0.5rem;
font-weight: 700;
font-size: 16px;
}
</style>

View File

@ -1,33 +1,87 @@
<template>
<div>
<div style="margin-top:10px;background:#fff;height:630px;overflow:auto;">
<a-card>
<div>
<span style="float: left;line-height: 30px; font-size: 18px; font-weight: bold;">教学大纲</span>
<span style="width:300px;float: left;">
<span style="float:left;"><j-upload v-model:value="jxdgInfo.filePath"></j-upload></span>
</span>
<span style="float: right;"><a-button type="primary">提交</a-button><a-button type="primary" style="margin-left:10px;"></a-button></span>
</div>
</a-card>
<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>
</div>
<a-row style="margin-top: 50px;width:100%;display: block;">
<a-col :span="24" v-for="i in 3">
<a-row>
<a-col :span="24">
<span style="float: left;">{{i}}.问题</span>
<span style="float: right;">
<a title="修改"><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>
</span>
</a-col>
<a-col :span="24"><span><Icon icon="ant-design:caret-right-outlined" />就是一个常见的问题及答案</span></a-col>
<a-col :span="24">
<a-divider />
</a-col>
</a-row>
</a-col>
<a-col :span="24">
<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-empty/>
</a-col>
</a-row>
</a-card>
<a-card>
<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;"/>
</a-card>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted, unref } from 'vue';
import { getUserSf,getSysConfig } from '/@/views/site/utils/index';
import { defHttp } from '/@/utils/http/axios';
import { useRouter } from 'vue-router';
import { Icon } from '/@/components/Icon';
import { Pagination, Empty } from 'ant-design-vue';
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
import headerPage from '/@/views/site/common/header.vue';
import footerPage from '/@/views/site/common/footer.vue';
import dqxqkc from '/@/views/site/renKeJiaoCheng/checkKecheng/dqxqkc.vue';
import studentPjjgTeaList from '/@/views/site/pjjgPage/studentPjjgTeaList.vue';
const maxClassName = ref<any>({});
const selectedKeys = ref<string[]>([]);
//
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh } = 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({});
let router = useRouter();
console.log(`🚀 ~ router:`, router)
const jxdgInfo = ref({
filePath:''
});
function handlePageChange(page: number) {
}
//
onMounted(() => {
console.log('rwbh:',rwbh);
});
</script>

View File

@ -9,14 +9,14 @@
>
<a-sub-menu key="sub1">
<template #title>教学内容</template>
<a-menu-item key="1">课程介绍</a-menu-item>
<a-menu-item key="1" @click="getGzt('kcjs')">课程介绍</a-menu-item>
<a-menu-item key="2" @click="getGzt('gonggao')">公告</a-menu-item>
<a-menu-item key="3">教学单元内容</a-menu-item>
</a-sub-menu>
<a-sub-menu key="sub2">
<template #title>测验/作业</template>
<a-menu-item key="4" @click="getGzt('dqzy')">课程作业</a-menu-item>
<a-menu-item key="5">课程测验</a-menu-item>
<a-menu-item key="5" @click="getGzt('kcjc')">课程测验</a-menu-item>
</a-sub-menu>
<a-menu-item key="sub3">
<span @click="getGzt('dqwj')">问卷调查</span>
@ -70,6 +70,10 @@
href = "/zy/dqkcLszy";
}else if(zytype=='gonggao'){
href = "/zy/tuGonggao";
}else if(zytype=='kcjs'){
href = "/zy/dqkcDetail";
}else if(zytype=='kcjc'){
href = "/zy/dqkcWenjuan";
}
router.push({path:href,query: {rwbh,xqxn,type}});

View File

@ -161,8 +161,8 @@
//
const formData = reactive<any>({
inputCode: '',
username: 'admin',
password: '123456',
username: '',
password: '',
});
//
const phoneFormData = reactive<any>({

View File

@ -0,0 +1,72 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/zyCjwt/zyCjwt/list',
save='/zyCjwt/zyCjwt/add',
edit='/zyCjwt/zyCjwt/edit',
deleteOne = '/zyCjwt/zyCjwt/delete',
deleteBatch = '/zyCjwt/zyCjwt/deleteBatch',
importExcel = '/zyCjwt/zyCjwt/importExcel',
exportXls = '/zyCjwt/zyCjwt/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -0,0 +1,71 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: 'createTime',
align: "center",
dataIndex: 'createTime',
customRender:({text}) =>{
return !text?"":(text.length>10?text.substr(0,10):text);
},
},
{
title: '学期学年',
align: "center",
dataIndex: 'xqxn'
},
{
title: '问题',
align: "center",
dataIndex: 'question'
},
{
title: '答案',
align: "center",
dataIndex: 'answer'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
{
label: "问题",
field: 'question',
component: 'Input',
colProps: {span: 6},
},
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '问题',
field: 'question',
component: 'InputTextArea',
dynamicRules: ({model,schema}) => {
return [
{ required: true, message: '请输入问题!'},
];
},
},
{
label: '答案',
field: 'answer',
component: 'InputTextArea',
dynamicRules: ({model,schema}) => {
return [
{ required: true, message: '请输入答案!'},
];
},
},
// TODO 主键隐藏字段目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];

View File

@ -0,0 +1,232 @@
<template>
<div>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="8">
<a-form-item label="问题">
<a-input placeholder="请输入问题" v-model:value="queryParam.question"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<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 @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
</a>-->
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<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>
</BasicTable>
<!-- 表单区域 -->
<ZyCjwtModal ref="registerModal" @success="handleSuccess"></ZyCjwtModal>
</div>
</template>
<script lang="ts" name="zyCjwt-zyCjwt" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './ZyCjwt.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './ZyCjwt.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import ZyCjwtModal from './components/ZyCjwtModal.vue'
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '常见问题',
api: list,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
params.column = '',params.order = '';//
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name: "常见问题",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//
reload();
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
}
</style>

View File

@ -0,0 +1,135 @@
<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.question">
<a-textarea v-model:value="formData.question" rows="4" placeholder="请输入问题" :disabled="disabled"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="答案" v-bind="validateInfos.answer">
<a-textarea v-model:value="formData.answer" rows="4" placeholder="请输入答案" :disabled="disabled"/>
</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 { getValueType } from '/@/utils';
import { saveOrUpdate } from '../ZyCjwt.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: '',
question: '',
answer: '',
});
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 = {
question: [{ required: true, message: '请输入问题!'},],
answer: [{ 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="关闭">
<ZyCjwtForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ZyCjwtForm>
</a-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import ZyCjwtForm from './ZyCjwtForm.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 = disableSubmit.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>

View File

@ -26,7 +26,7 @@
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" style="top: -46px;position: relative;">
<BasicTable @register="registerTable" style="top: -16px;position: relative;">
<!--插槽:table标题-->
<template #tableTitle>
</template>

View File

@ -0,0 +1,72 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/zyJxdg/zyJxdg/list',
save='/zyJxdg/zyJxdg/add',
edit='/zyJxdg/zyJxdg/edit',
deleteOne = '/zyJxdg/zyJxdg/delete',
deleteBatch = '/zyJxdg/zyJxdg/deleteBatch',
importExcel = '/zyJxdg/zyJxdg/importExcel',
exportXls = '/zyJxdg/zyJxdg/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
*
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}

View File

@ -0,0 +1,35 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '附件',
align: "center",
dataIndex: 'filePath',
slots: { customRender: 'fileSlot' },
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '附件',
field: 'filePath',
component: 'JUpload',
componentProps:{
},
},
// TODO 主键隐藏字段目前写死为ID
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
];

View File

@ -0,0 +1,215 @@
<template>
<div>
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<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>
</BasicTable>
<!-- 表单区域 -->
<ZyJxdgModal ref="registerModal" @success="handleSuccess"></ZyJxdgModal>
</div>
</template>
<script lang="ts" name="zyJxdg-zyJxdg" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns } from './ZyJxdg.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './ZyJxdg.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import ZyJxdgModal from './components/ZyJxdgModal.vue'
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '教学大纲',
api: list,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: (params) => {
params.column = '',params.order = '';//
return Object.assign(params, queryParam.value);
},
},
exportConfig: {
name: "教学大纲",
url: getExportUrl,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//
reload();
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
width: calc(50% - 15px);
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
}
</style>

View File

@ -0,0 +1,26 @@
-- 注意该页面对应的前台目录为views/zyJxdg文件夹下
-- 如果你想更改到其他目录请修改sql中component字段对应的值
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
VALUES ('202405110931940070', NULL, '教学大纲', '/zyJxdg/zyJxdgList', 'zyJxdg/ZyJxdgList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0);
-- 权限控制sql
-- 新增
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('202405110931940071', '202405110931940070', '添加教学大纲', NULL, NULL, 0, NULL, NULL, 2, 'zyJxdg:zy_jxdg:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0, 0, '1', 0);
-- 编辑
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('202405110931940072', '202405110931940070', '编辑教学大纲', NULL, NULL, 0, NULL, NULL, 2, 'zyJxdg:zy_jxdg:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0, 0, '1', 0);
-- 删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('202405110931940073', '202405110931940070', '删除教学大纲', NULL, NULL, 0, NULL, NULL, 2, 'zyJxdg:zy_jxdg:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0, 0, '1', 0);
-- 批量删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('202405110931940074', '202405110931940070', '批量删除教学大纲', NULL, NULL, 0, NULL, NULL, 2, 'zyJxdg:zy_jxdg:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0, 0, '1', 0);
-- 导出excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('202405110931940075', '202405110931940070', '导出excel_教学大纲', NULL, NULL, 0, NULL, NULL, 2, 'zyJxdg:zy_jxdg:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0, 0, '1', 0);
-- 导入excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('202405110931940076', '202405110931940070', '导入excel_教学大纲', NULL, NULL, 0, NULL, NULL, 2, 'zyJxdg:zy_jxdg:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2024-05-11 09:31:07', NULL, NULL, 0, 0, '1', 0);

View File

@ -0,0 +1,128 @@
<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.filePath">
<j-upload v-model:value="formData.filePath" :disabled="disabled" ></j-upload>
</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 '../ZyJxdg.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: '',
filePath: '',
});
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 = {
};
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="关闭">
<ZyJxdgForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ZyJxdgForm>
</a-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import ZyJxdgForm from './ZyJxdgForm.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 = disableSubmit.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>