| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <a-card :bordered="false">
- <!-- 搜索和操作区域 -->
- <a-row :gutter="60" style="margin-bottom: 16px">
- <a-col>
- <span>试卷名称:</span>
- <a-input v-model:value="formState.name" placeholder="请输入试卷名称" style="width: 150px;" />
- </a-col>
- <a-col>
- <span>学科名称:</span>
- <a-input v-model:value="formState.fileName" placeholder="请输入学科名称" style="width: 150px" />
- </a-col>
- <a-col>
- <a-button type="primary" style="margin-left: 8px" @click="handleSearch">查询</a-button>
- <a-button style="margin-left: 8px" @click="handleReset">重置</a-button>
- </a-col>
- </a-row>
- <s-table
- ref="table"
- :columns="columns"
- :data="loadData"
- :alert="options.alert.show"
- bordered
- :row-key="(record) => record.id"
- :tool-config="toolConfig"
- :row-selection="options.rowSelection"
- >
- <template #operator class="table-operator">
- <a-space>
- <a-button type="primary" @click="formRef.onOpen()" v-if="hasPerm('tExamPaperAdd')">
- <template #icon><plus-outlined /></template>
- 新增
- </a-button>
- <xn-batch-delete
- v-if="hasPerm('tExamPaperBatchDelete')"
- :selectedRowKeys="selectedRowKeys"
- @batchDelete="deleteBatchTExamPaper"
- />
- </a-space>
- </template>
- <template #bodyCell="{ column, record }">
- <template v-if="column.dataIndex === 'action'">
- <a-space>
- <a @click="formRef.onOpen(record)" v-if="hasPerm('tExamPaperEdit')">编辑</a>
- <a-divider type="vertical" v-if="hasPerm(['tExamPaperEdit', 'tExamPaperDelete'], 'and')" />
- <a-popconfirm title="确定要删除吗?" @confirm="deleteTExamPaper(record)">
- <a-button type="link" danger size="small" v-if="hasPerm('tExamPaperDelete')">删除</a-button>
- </a-popconfirm>
- </a-space>
- </template>
- </template>
- </s-table>
- </a-card>
- <Form ref="formRef" @successful="table.refresh(true)" />
- </template>
- <script setup name="exampaper">
- import Form from './form.vue'
- import tExamPaperApi from '@/api/paper/examPaperApi'
- const formState = reactive({
- id: null,
- verifyStatus: '0',
- resourcesId: null,
- })
- const table = ref()
- const formRef = ref()
- const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
- const columns = [
- {
- title: 'ID',
- dataIndex: 'ID'
- },
- {
- title: '学科',
- dataIndex: 'subjectId'
- },
- {
- title: '名称',
- dataIndex: 'name'
- },
- {
- title: '创建时间',
- dataIndex: 'createTime'
- }
- ]
- // 操作栏通过权限判断是否显示
- if (hasPerm(['tExamPaperEdit', 'tExamPaperDelete'])) {
- columns.push({
- title: '操作',
- dataIndex: 'action',
- align: 'center',
- width: '150px'
- })
- }
- const selectedRowKeys = ref([])
- // 列表选择配置
- const options = {
- // columns数字类型字段加入 needTotal: true 可以勾选自动算账
- alert: {
- show: true,
- clear: () => {
- selectedRowKeys.value = ref([])
- }
- },
- rowSelection: {
- onChange: (selectedRowKey, selectedRows) => {
- selectedRowKeys.value = selectedRowKey
- }
- }
- }
- const loadData = (parameter) => {
- return tExamPaperApi.tExamPaperPage(parameter).then((data) => {
- return data
- })
- }
- // 重置
- const reset = () => {
- searchFormRef.value.resetFields()
- table.value.refresh(true)
- }
- // 删除
- const deleteTExamPaper = (record) => {
- let params = [
- {
- id: record.id
- }
- ]
- tExamPaperApi.tExamPaperDelete(params).then(() => {
- table.value.refresh(true)
- })
- }
- // 批量删除
- const deleteBatchTExamPaper = (params) => {
- tExamPaperApi.tExamPaperDelete(params).then(() => {
- table.value.clearRefreshSelected()
- })
- }
- </script>
|