课程简介引用,列表展现调整

This commit is contained in:
曹磊 2024-05-24 15:25:45 +08:00
parent e7be1efbb7
commit fdeaa26782
2 changed files with 63 additions and 140 deletions

View File

@ -1,76 +1,52 @@
<template>
<div>
<!--查询区域-->
<!--引用表格-->
<BasicTable @register="registerTable">
<!--插槽:table标题-->
<template #tableTitle>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(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>
<a-row>
<a-col :span="24" v-for="(item, index) in tableData" :key="index" style="padding:10px;overflow:hidden;border-bottom: 1px solid #f0f0f0;">
<div>
<a-row style="padding:10px;line-height: 30px;">
<a-col :span="22">
<span style="font-size: 16px;color: #515151 ;font-weight: bold;">{{item.xqxn}}</span>
</a-col>
<a-col :span="2">
<a-button type="primary" @click="handleEdit(item)" style="margin-left:5px;padding: 0px 8px;background:rgb(28, 132, 198);">引用</a-button>
</a-col>
</a-row>
<a-row style="padding:10px;">
<a-col :span="24">
<div style="color: #515151" v-html="item.kcjs"></div>
</a-col>
</a-row>
</div>
</a-col>
<a-col :span="24" style="padding:10px;">
<div v-show="tableData.length>0">
<a-pagination v-model="current" :total="total" @change="handlePageChange" :pageSize="pageSize" style="text-align: right;"/>
</div>
<div v-show="tableData.length==0">
<a-empty/>
</div>
</a-col>
</a-row>
</div>
</template>
<script lang="ts" name="zyJxdg-zyJxdg" setup>
import { ref, reactive,unref } 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'
import { Input, Popover, Pagination, Empty } from 'ant-design-vue';
import { defHttp } from '/@/utils/http/axios';
import { useRouter } from 'vue-router';
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const APagination = Pagination;
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh,xqxn } = query;//
const queryParam = ref<any>({ rwbh,xqxn });
//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 current = ref<number>(1);
const total = ref<number>(0);
const pageNo = ref<number>(0);
const pageSize = ref<number>(5);
const tableData = ref<any>([]);
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 7 },
@ -80,90 +56,32 @@
sm: { span: 16 },
});
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
// registerModal.value.disableSubmit = false;
// registerModal.value.edit(record);
defHttp.post({url: '/zyJxdg/zyJxdg/editJxdgyy', params: {kcjs:record.kcjs,rwbh,xqxn }}).then(res => {
console.log(`🚀 ~ defHttp.post ~ res:`, res)
defHttp.post({url: '/zyJxdg/zyJxdg/editJxdgyy', params: {kcjs:record.kcjs,rwbh,xqxn }}).then(res => { });
}
function reload(){
queryParam.value.pageNo = current.value;
queryParam.value.pageSize = pageSize.value;
queryParam.value.rwbh = rwbh;
queryParam.value.xqxn = xqxn;
defHttp.get({ url: '/zyJxdg/zyJxdg/list', params: queryParam.value }).then(res => {
total.value = res.total;
pageNo.value = res.pages;
current.value = res.current;
tableData.value = res.records;
});
}
/**
* 详情
*/
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();
total.value = 1;
handlePageChange(1);
}
/**
@ -171,15 +89,20 @@
*/
function searchReset() {
queryParam.value = {};
selectedRowKeys.value = [];
//
reload();
queryParam.value.rwbh = rwbh;
queryParam.value.xqxn = xqxn;
total.value = 1;
handlePageChange(1);
}
function init(record){
console.log(`🚀 ~ init ~ record:`, record)
function handlePageChange(record){
current.value = record;
reload();
}
function init(record){
reload();
}
defineExpose({
init,
@ -190,6 +113,7 @@
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;

View File

@ -9,19 +9,18 @@ ZyJxdgList<template>
import ZyJxdgList from './ZyJxdgList.vue'
const title = ref<string>('');
const width = ref<string>('80%');
const width = ref<string>('50%');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 编辑
* @param record
*/
function init(record) {
title.value = '引用';
title.value = '课程简介引用';
visible.value = true;
nextTick(() => {
registerForm.value.init(record);