|
@@ -4,7 +4,7 @@
|
|
<div class="flex-1 page-wrap">
|
|
<div class="flex-1 page-wrap">
|
|
<div class="btn-group">
|
|
<div class="btn-group">
|
|
<t-button theme="success" @click="handleAdd">新增</t-button>
|
|
<t-button theme="success" @click="handleAdd">新增</t-button>
|
|
- <t-button theme="danger" @click="handleDelete">作废</t-button>
|
|
|
|
|
|
+ <t-button theme="danger" @click="handleDestroy">作废</t-button>
|
|
</div>
|
|
</div>
|
|
<t-table
|
|
<t-table
|
|
size="small"
|
|
size="small"
|
|
@@ -12,12 +12,14 @@
|
|
:columns="columns"
|
|
:columns="columns"
|
|
:data="tableData"
|
|
:data="tableData"
|
|
bordered
|
|
bordered
|
|
|
|
+ :selected-row-keys="selectedRowKeys"
|
|
:pagination="{
|
|
:pagination="{
|
|
defaultCurrent: 1,
|
|
defaultCurrent: 1,
|
|
defaultPageSize: 10,
|
|
defaultPageSize: 10,
|
|
onChange,
|
|
onChange,
|
|
total: pagination.total,
|
|
total: pagination.total,
|
|
}"
|
|
}"
|
|
|
|
+ @select-change="selectChange"
|
|
>
|
|
>
|
|
</t-table>
|
|
</t-table>
|
|
</div>
|
|
</div>
|
|
@@ -32,11 +34,18 @@
|
|
|
|
|
|
<script setup lang="jsx" name="NoticeManage">
|
|
<script setup lang="jsx" name="NoticeManage">
|
|
import { ref, reactive } from 'vue';
|
|
import { ref, reactive } from 'vue';
|
|
-import { getTableData } from '@/api/test';
|
|
|
|
|
|
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
|
|
import useFetchTable from '@/hooks/useFetchTable';
|
|
import useFetchTable from '@/hooks/useFetchTable';
|
|
import EditNoticeDialog from './edit-notice-dialog.vue';
|
|
import EditNoticeDialog from './edit-notice-dialog.vue';
|
|
|
|
+import {
|
|
|
|
+ noticeListApi,
|
|
|
|
+ noticeDestroyApi,
|
|
|
|
+ noticePublishApi,
|
|
|
|
+ noticeCancelPublishApi,
|
|
|
|
+} from '@/api/system';
|
|
const showEditNoticeDialog = ref(false);
|
|
const showEditNoticeDialog = ref(false);
|
|
const curRow = ref(null);
|
|
const curRow = ref(null);
|
|
|
|
+const selectedRowKeys = ref([]);
|
|
|
|
|
|
const columns = [
|
|
const columns = [
|
|
{ colKey: 'row-select', type: 'multiple', width: 50 },
|
|
{ colKey: 'row-select', type: 'multiple', width: 50 },
|
|
@@ -67,45 +76,38 @@ const columns = [
|
|
hover="color"
|
|
hover="color"
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
- handleFeedbackView(row);
|
|
|
|
|
|
+ handlePublish(row);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- 回执查询
|
|
|
|
|
|
+ 发布
|
|
</t-link>
|
|
</t-link>
|
|
<t-link
|
|
<t-link
|
|
theme="primary"
|
|
theme="primary"
|
|
hover="color"
|
|
hover="color"
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
- handleEdit(row);
|
|
|
|
|
|
+ handleFeedbackView(row);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- 修改
|
|
|
|
|
|
+ 回执查询
|
|
</t-link>
|
|
</t-link>
|
|
<t-link
|
|
<t-link
|
|
theme="primary"
|
|
theme="primary"
|
|
hover="color"
|
|
hover="color"
|
|
onClick={(e) => {
|
|
onClick={(e) => {
|
|
e.stopPropagation();
|
|
e.stopPropagation();
|
|
- handlePublish(row);
|
|
|
|
|
|
+ handleEdit(row);
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- 发布
|
|
|
|
|
|
+ 修改
|
|
</t-link>
|
|
</t-link>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
];
|
|
];
|
|
-const {
|
|
|
|
- loading: tableLoading,
|
|
|
|
- pagination,
|
|
|
|
- tableData,
|
|
|
|
- fetchData,
|
|
|
|
- onChange,
|
|
|
|
-} = useFetchTable(getTableData);
|
|
|
|
-
|
|
|
|
-const refresh = async () => {};
|
|
|
|
|
|
+const { pagination, tableData, fetchData, onChange } =
|
|
|
|
+ useFetchTable(noticeListApi);
|
|
|
|
|
|
const fields = ref([
|
|
const fields = ref([
|
|
{
|
|
{
|
|
@@ -162,15 +164,48 @@ const params = reactive({
|
|
d: '',
|
|
d: '',
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+const selectChange = (value) => {
|
|
|
|
+ selectedRowKeys.value = value;
|
|
|
|
+};
|
|
|
|
+
|
|
const handleAdd = () => {
|
|
const handleAdd = () => {
|
|
curRow.value = null;
|
|
curRow.value = null;
|
|
showEditNoticeDialog.value = true;
|
|
showEditNoticeDialog.value = true;
|
|
};
|
|
};
|
|
-const handleDelete = () => {
|
|
|
|
- console.log('delete');
|
|
|
|
|
|
+const handleDestroy = () => {
|
|
|
|
+ if (!selectedRowKeys.value.length) {
|
|
|
|
+ MessagePlugin.error('请选择要作废的记录');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
|
+ header: '操作警告',
|
|
|
|
+ body: `确定要作废当前选择的所有记录吗`,
|
|
|
|
+ confirmBtn: '确定',
|
|
|
|
+ cancelBtn: '取消',
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
+ confirmDia.hide();
|
|
|
|
+ const res = await noticeDestroyApi(row.id).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
|
+ fetchData();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
};
|
|
};
|
|
const handleCancelPublish = (row) => {
|
|
const handleCancelPublish = (row) => {
|
|
- console.log(row);
|
|
|
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
|
+ header: '操作警告',
|
|
|
|
+ body: `确定要撤销发布当前信息吗`,
|
|
|
|
+ confirmBtn: '确定',
|
|
|
|
+ cancelBtn: '取消',
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
+ confirmDia.hide();
|
|
|
|
+ const res = await noticeCancelPublishApi(row.id).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
|
+ fetchData();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
};
|
|
};
|
|
const handleFeedbackView = (row) => {
|
|
const handleFeedbackView = (row) => {
|
|
console.log(row);
|
|
console.log(row);
|
|
@@ -180,8 +215,18 @@ const handleEdit = (row) => {
|
|
showEditNoticeDialog.value = true;
|
|
showEditNoticeDialog.value = true;
|
|
};
|
|
};
|
|
const handlePublish = (row) => {
|
|
const handlePublish = (row) => {
|
|
- console.log(row);
|
|
|
|
|
|
+ const confirmDia = DialogPlugin({
|
|
|
|
+ header: '操作警告',
|
|
|
|
+ body: `确定要发布当前信息吗`,
|
|
|
|
+ confirmBtn: '确定',
|
|
|
|
+ cancelBtn: '取消',
|
|
|
|
+ onConfirm: async () => {
|
|
|
|
+ confirmDia.hide();
|
|
|
|
+ const res = await noticePublishApi(row.id).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
|
+ fetchData();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
-
|
|
|
|
-<style></style>
|
|
|