|
|
@ -8,11 +8,53 @@ |
|
|
|
</a-button> |
|
|
|
</a-button> |
|
|
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 |
|
|
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出 |
|
|
|
</a-button> |
|
|
|
</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> |
|
|
|
<!--操作栏--> |
|
|
|
<!--操作栏--> |
|
|
|
<template #action="{ record }"> |
|
|
|
<template #action="{ record }"> |
|
|
|
<!-- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>--> |
|
|
|
<!-- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>--> |
|
|
|
<TableAction :actions="getTableAction(record)"/> |
|
|
|
<TableAction :actions="getTableAction(record)"/> |
|
|
|
|
|
|
|
<!--<TableAction |
|
|
|
|
|
|
|
:stopButtonPropagation="true" |
|
|
|
|
|
|
|
:actions="[ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: '1', |
|
|
|
|
|
|
|
// type: 'link', |
|
|
|
|
|
|
|
size: 'small', |
|
|
|
|
|
|
|
icon: 'ant-design:plus-circle-outlined', |
|
|
|
|
|
|
|
onClick: add.bind(null, record), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: '2', |
|
|
|
|
|
|
|
// type: 'link', |
|
|
|
|
|
|
|
size: 'small', |
|
|
|
|
|
|
|
icon: 'fa6-regular:pen-to-square', |
|
|
|
|
|
|
|
onClick: editor.bind(null, record), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
label: '3', |
|
|
|
|
|
|
|
// color: 'error', |
|
|
|
|
|
|
|
icon: 'ic:outline-delete-outline', |
|
|
|
|
|
|
|
popConfirm: { |
|
|
|
|
|
|
|
title: '确定删除该数据吗?', |
|
|
|
|
|
|
|
confirm: del.bind(null, record), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]" |
|
|
|
|
|
|
|
/>--> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<!--字段回显插槽--> |
|
|
|
<!--字段回显插槽--> |
|
|
|
<template #htmlSlot="{text}"> |
|
|
|
<template #htmlSlot="{text}"> |
|
|
@ -35,162 +77,166 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" name="cms-cmsArticle" setup> |
|
|
|
<script lang="ts" name="cms-cmsArticle" setup> |
|
|
|
import {ref} from 'vue'; |
|
|
|
import {ref} from 'vue'; |
|
|
|
import {useModal} from '/@/components/Modal'; |
|
|
|
import {BasicTable, TableAction} from '/@/components/Table'; |
|
|
|
import {useListPage} from '/@/hooks/system/useListPage' |
|
|
|
import {useModal} from '/@/components/Modal'; |
|
|
|
import {columns, searchFormSchema} from './CmsArticle.data'; |
|
|
|
import {useListPage} from '/@/hooks/system/useListPage' |
|
|
|
import { |
|
|
|
import CmsArticleModal from './components/CmsArticleModal.vue' |
|
|
|
batchDelete, |
|
|
|
import {columns, searchFormSchema} from './CmsArticle.data'; |
|
|
|
deleteOne, |
|
|
|
import { |
|
|
|
getExportUrl, |
|
|
|
batchDelete, |
|
|
|
getImportUrl, |
|
|
|
deleteOne, |
|
|
|
list, |
|
|
|
getExportUrl, |
|
|
|
updateStatus |
|
|
|
getImportUrl, |
|
|
|
} from './CmsArticle.api'; |
|
|
|
list, |
|
|
|
// import { downloadFile } from '/@/utils/common/renderUtils'; |
|
|
|
updateStatus |
|
|
|
const checkedKeys = ref<Array<string | number>>([]); |
|
|
|
} from './CmsArticle.api'; |
|
|
|
//注册model |
|
|
|
// import {updateStatus} from './CmsArticle.api'; |
|
|
|
const [registerModal, {openModal}] = useModal(); |
|
|
|
import {Update} from "/@/views/topic/Topic.api"; |
|
|
|
//注册table数据 |
|
|
|
// import { downloadFile } from '/@/utils/common/renderUtils'; |
|
|
|
const {prefixCls, tableContext, onExportXls, onImportXls} = useListPage({ |
|
|
|
const checkedKeys = ref<Array<string | number>>([]); |
|
|
|
tableProps: { |
|
|
|
//注册model |
|
|
|
title: '文章', |
|
|
|
const [registerModal, {openModal}] = useModal(); |
|
|
|
api: list, |
|
|
|
//注册table数据 |
|
|
|
columns, |
|
|
|
const {prefixCls, tableContext, onExportXls, onImportXls} = useListPage({ |
|
|
|
canResize: false, |
|
|
|
tableProps: { |
|
|
|
formConfig: { |
|
|
|
title: '文章', |
|
|
|
//labelWidth: 120, |
|
|
|
api: list, |
|
|
|
schemas: searchFormSchema, |
|
|
|
columns, |
|
|
|
autoSubmitOnEnter: true, |
|
|
|
canResize: false, |
|
|
|
showAdvancedButton: true, |
|
|
|
formConfig: { |
|
|
|
fieldMapToNumber: [], |
|
|
|
//labelWidth: 120, |
|
|
|
fieldMapToTime: [], |
|
|
|
schemas: searchFormSchema, |
|
|
|
}, |
|
|
|
autoSubmitOnEnter: true, |
|
|
|
actionColumn: { |
|
|
|
showAdvancedButton: true, |
|
|
|
width: 120, |
|
|
|
fieldMapToNumber: [], |
|
|
|
fixed: 'right' |
|
|
|
fieldMapToTime: [], |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
exportConfig: { |
|
|
|
actionColumn: { |
|
|
|
name: "文章", |
|
|
|
width: 180, |
|
|
|
url: getExportUrl, |
|
|
|
fixed: 'right' |
|
|
|
}, |
|
|
|
}, |
|
|
|
importConfig: { |
|
|
|
}, |
|
|
|
url: getImportUrl, |
|
|
|
exportConfig: { |
|
|
|
success: handleSuccess |
|
|
|
name: "文章", |
|
|
|
}, |
|
|
|
url: getExportUrl, |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
importConfig: { |
|
|
|
|
|
|
|
url: getImportUrl, |
|
|
|
|
|
|
|
success: handleSuccess |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
const [registerTable, {reload}, {rowSelection, selectedRowKeys}] = tableContext |
|
|
|
const [registerTable, {reload}, {rowSelection, selectedRowKeys}] = tableContext |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 新增事件 |
|
|
|
* 新增事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function handleAdd() { |
|
|
|
function handleAdd() { |
|
|
|
openModal(true, { |
|
|
|
openModal(true, { |
|
|
|
isUpdate: false, |
|
|
|
isUpdate: false, |
|
|
|
showFooter: true, |
|
|
|
showFooter: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 编辑事件 |
|
|
|
* 编辑事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function handleEdit(record: Recordable) { |
|
|
|
function handleEdit(record: Recordable) { |
|
|
|
openModal(true, { |
|
|
|
openModal(true, { |
|
|
|
record, |
|
|
|
record, |
|
|
|
isUpdate: true, |
|
|
|
isUpdate: true, |
|
|
|
showFooter: true, |
|
|
|
showFooter: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
function update2(record: Recordable, isopen) { |
|
|
|
* 详情 |
|
|
|
record.isopen = isopen; |
|
|
|
*/ |
|
|
|
updateStatus(record) |
|
|
|
function handleDetail(record: Recordable) { |
|
|
|
reload() |
|
|
|
openModal(true, { |
|
|
|
} |
|
|
|
record, |
|
|
|
|
|
|
|
isUpdate: true, |
|
|
|
|
|
|
|
showFooter: false, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function operationStatus(record: Recordable, isopen) { |
|
|
|
/** |
|
|
|
record.isopen = isopen; |
|
|
|
* 详情 |
|
|
|
updateStatus(record) |
|
|
|
*/ |
|
|
|
reload() |
|
|
|
function handleDetail(record: Recordable) { |
|
|
|
} |
|
|
|
openModal(true, { |
|
|
|
|
|
|
|
record, |
|
|
|
|
|
|
|
isUpdate: true, |
|
|
|
|
|
|
|
showFooter: false, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除事件 |
|
|
|
* 删除事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async function handleDelete(record) { |
|
|
|
async function handleDelete(record) { |
|
|
|
await deleteOne({id: record.id}, handleSuccess); |
|
|
|
await deleteOne({id: record.id}, handleSuccess); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 批量删除事件 |
|
|
|
* 批量删除事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async function batchHandleDelete() { |
|
|
|
async function batchHandleDelete() { |
|
|
|
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); |
|
|
|
await batchDelete({ids: selectedRowKeys.value}, handleSuccess); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 成功回调 |
|
|
|
* 成功回调 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function handleSuccess() { |
|
|
|
function handleSuccess() { |
|
|
|
(selectedRowKeys.value = []) && reload(); |
|
|
|
(selectedRowKeys.value = []) && reload(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 操作栏 |
|
|
|
* 操作栏 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function getTableAction(record) { |
|
|
|
function getTableAction(record) { |
|
|
|
const actions = [ |
|
|
|
const actions = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '编辑', |
|
|
|
label: '编辑', |
|
|
|
onClick: handleEdit.bind(null, record), |
|
|
|
onClick: handleEdit.bind(null, record), |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '删除', |
|
|
|
label: '删除', |
|
|
|
popConfirm: { |
|
|
|
popConfirm: { |
|
|
|
title: '是否确认删除', |
|
|
|
title: '是否确认删除', |
|
|
|
confirm: handleDelete.bind(null, record), |
|
|
|
confirm: handleDelete.bind(null, record), |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
]; |
|
|
|
|
|
|
|
if (record.status == "0") { |
|
|
|
|
|
|
|
actions.unshift({ |
|
|
|
|
|
|
|
label: '发布', |
|
|
|
|
|
|
|
onClick: operationStatus.bind(null, record, "1"), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (record.status == "1") { |
|
|
|
]; |
|
|
|
actions.unshift({ |
|
|
|
if (record.status == "1") { |
|
|
|
label: '取消发布', |
|
|
|
actions.unshift({ |
|
|
|
onClick: operationStatus.bind(null, record, "0"), |
|
|
|
label: '取消发布', |
|
|
|
}); |
|
|
|
onClick: update2.bind(null, record, "0"), |
|
|
|
} |
|
|
|
}); |
|
|
|
return actions; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (record.status == "0") { |
|
|
|
|
|
|
|
actions.unshift({ |
|
|
|
|
|
|
|
label: '发布', |
|
|
|
|
|
|
|
onClick: update2.bind("1", record, "1"), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return actions; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 下拉操作栏 |
|
|
|
* 下拉操作栏 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function getDropDownAction(record) { |
|
|
|
function getDropDownAction(record) { |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
label: '详情', |
|
|
|
label: '详情', |
|
|
|
onClick: handleDetail.bind(null, record), |
|
|
|
onClick: handleDetail.bind(null, record), |
|
|
|
}, { |
|
|
|
}, { |
|
|
|
label: '删除', |
|
|
|
label: '删除', |
|
|
|
popConfirm: { |
|
|
|
popConfirm: { |
|
|
|
title: '是否确认删除', |
|
|
|
title: '是否确认删除', |
|
|
|
confirm: handleDelete.bind(null, record), |
|
|
|
confirm: handleDelete.bind(null, record), |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|