Commit 3ac1c8d7 authored by chenqikuai's avatar chenqikuai

草稿箱

parent ec79069d
...@@ -128,7 +128,7 @@ export function getCopyRights(payload: { ...@@ -128,7 +128,7 @@ export function getCopyRights(payload: {
export function deleteCopyRights(ids: number[]) { export function deleteCopyRights(ids: number[]) {
return $ajax({ return $ajax({
type: "delete", type: "delete",
url: "/api/copyright", url: "/api/copyrights",
params: { params: {
ids, ids,
}, },
......
...@@ -422,7 +422,7 @@ const handleClickSave = async () => { ...@@ -422,7 +422,7 @@ const handleClickSave = async () => {
if (res && res.code === 200) { if (res && res.code === 200) {
ElMessage.success("保存成功"); ElMessage.success("保存成功");
router.push({ router.push({
name: "copyrightManagement", name: "draftBox",
}); });
} }
} }
......
...@@ -7,12 +7,18 @@ ...@@ -7,12 +7,18 @@
height="100%" height="100%"
element-loading-text="加载中..." element-loading-text="加载中..."
> >
<template #record_work_type="slotProps">
{{ (workTypeMapping as any)[slotProps.record_work_type] }}</template
>
<template #create_time="slotProps">
{{ formatTime(slotProps.create_time) }}
</template>
<template #operate="slotProps"> <template #operate="slotProps">
<syMoreOperate <syMoreOperate
:teleport="true" :teleport="true"
:list="operateList" :list="operateList"
@click-item="(value) => handleClickItem(value, slotProps)" @click-item="(value) => handleClickItem(value, slotProps)"
:margin-left="300" :margin-left="-50"
> >
<Icon <Icon
icon-name="iconbianzu7" icon-name="iconbianzu7"
...@@ -29,10 +35,14 @@ import Table from "@/components/Table/index.vue"; ...@@ -29,10 +35,14 @@ import Table from "@/components/Table/index.vue";
import { tableColumns } from "./table"; import { tableColumns } from "./table";
import Icon from "@/components/Icon/index.vue"; import Icon from "@/components/Icon/index.vue";
import { ref } from "vue"; import { ref } from "vue";
import { syMoreOperate } from "cqk-sy-ui"; import { syMoreOperate, formatTime } from "cqk-sy-ui";
import { useTableScrollListener } from "@/components/Table/hooks"; import { useTableScrollListener } from "@/components/Table/hooks";
import { workTypeMapping } from "../copyrightManagement/statusMapping";
import { router } from "@/router";
import { deleteCopyRights } from "@/service/copyrightService";
import { ElMessage } from "element-plus";
const emit = defineEmits(["scrollToEnd"]); const emit = defineEmits(["scrollToEnd", "refresh"]);
const tableRef = ref<InstanceType<typeof Table>>(); const tableRef = ref<InstanceType<typeof Table>>();
...@@ -50,20 +60,31 @@ const operateList = [ ...@@ -50,20 +60,31 @@ const operateList = [
name: "编辑", name: "编辑",
value: "编辑", value: "编辑",
click: (slotProps: any) => { click: (slotProps: any) => {
// router.push({
console.log(slotProps.status, "show slotProps Status"); name: "addCopyRight",
query: {
id: slotProps.id,
},
});
}, },
}, },
{ {
name: "删除", name: "删除",
value: "删除", value: "删除",
click: (slotProps: any) => { click: async (slotProps: any) => {
// const res = await deleteCopyRights([slotProps.id]);
console.log(slotProps.status, "show slotProps status"); if (res && res.code === 200) {
ElMessage.success("删除成功");
emit("refresh");
}
}, },
}, },
]; ];
defineExpose({
tableRef,
});
const handleClickItem = (value: any, slotProps: any) => { const handleClickItem = (value: any, slotProps: any) => {
operateList.find((i) => i.value === value)?.click(slotProps); operateList.find((i) => i.value === value)?.click(slotProps);
}; };
......
...@@ -45,9 +45,11 @@ ...@@ -45,9 +45,11 @@
</div> </div>
<div class="flex-grow overflow-hidden"> <div class="flex-grow overflow-hidden">
<DraftBoxTable <DraftBoxTable
ref="DraftBoxTableRef"
:loading="loading" :loading="loading"
:data="tableData" :data="tableData"
@scrollToEnd="fetchNextPage" @scrollToEnd="fetchNextPage"
@refresh="handleRefresh"
></DraftBoxTable> ></DraftBoxTable>
</div> </div>
</div> </div>
...@@ -61,43 +63,48 @@ import Avatar from "@/components/Avatar/index.vue"; ...@@ -61,43 +63,48 @@ import Avatar from "@/components/Avatar/index.vue";
import Title from "@/components/Title.vue"; import Title from "@/components/Title.vue";
import Search from "@/components/Search/index.vue"; import Search from "@/components/Search/index.vue";
import Icon from "@/components/Icon/index.vue"; import Icon from "@/components/Icon/index.vue";
import { syButton } from "cqk-sy-ui";
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import DraftBoxTable from "./draftBoxTable.vue"; import DraftBoxTable from "./draftBoxTable.vue";
import { useTableData } from "@/components/Table/hooks"; import { useTableData } from "@/components/Table/hooks";
import { debounce } from "lodash"; import { debounce } from "lodash";
import CopyRightNotify from "@/components/Dialogs/CopyRightNotify/index.vue"; import CopyRightNotify from "@/components/Dialogs/CopyRightNotify/index.vue";
import { getCopyRights } from "@/service/copyrightService";
import { eStatusOfCopyright } from "@/components/ApproveStatus/status";
const DraftBoxTableRef = ref<InstanceType<typeof DraftBoxTable>>();
const copyRightNotifyVisible = ref(false); const copyRightNotifyVisible = ref(false);
const searchValue = ref(""); const searchValue = ref("");
const fetchTableData = ({ const fetchTableData = async ({
page, page,
page_size, page_size,
}: { }: {
page: number; page: number;
page_size: number; page_size: number;
}): Promise<any> => { }) => {
return new Promise<any>((r) => { const res = await getCopyRights({
setTimeout(() => { record_no: "",
r({ record_work_name: searchValue.value,
total: 100, record_work_status: [eStatusOfCopyright.WAITING_SUBMIT],
data: "1" page,
.repeat(page_size) page_size,
.split("")
.map((i, index) => ({
name: index + (page - 1) * page_size,
id: searchValue.value,
})),
});
}, 1000);
}); });
return {
total: res?.data.total || 0,
data: res?.data.results || [],
};
}; };
const { fetchNextPage, tableData, loading, refetch } = useTableData({ const { fetchNextPage, tableData, loading, refetch } = useTableData({
fetchData: fetchTableData, fetchData: fetchTableData,
}); });
const refetchDebounce = debounce(refetch, 500); function handleRefresh() {
DraftBoxTableRef.value?.tableRef?.scrollTo(0, 0);
refetch();
}
const refetchDebounce = debounce(handleRefresh, 500);
watch(searchValue, () => { watch(searchValue, () => {
refetchDebounce(); refetchDebounce();
}); });
......
...@@ -3,16 +3,18 @@ import { iTableColumn } from "@/components/Table/types"; ...@@ -3,16 +3,18 @@ import { iTableColumn } from "@/components/Table/types";
export const tableColumns = [ export const tableColumns = [
{ {
label: "版权名称", label: "版权名称",
prop: "name", prop: "record_work_name",
minWidth: 200, minWidth: 200,
}, },
{ {
label: "作品类型", label: "作品类型",
prop: "id", prop: "record_work_type",
slotName: "record_work_type",
}, },
{ {
label: "提交日期", label: "提交日期",
prop: "date", prop: "create_time",
slotName: "create_time",
}, },
{ {
label: "操作", label: "操作",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment