feat: 写手端逻辑处理
This commit is contained in:
@ -3,131 +3,149 @@
|
||||
*/
|
||||
|
||||
import Http from '@/api';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const getWriterCode = () => {
|
||||
const route = useRoute();
|
||||
return route.params.writerCode as string;
|
||||
return route?.params?.writerCode as string;
|
||||
};
|
||||
// 内容稿件-批量添加(写手)
|
||||
export const postWorksBatchWriter = (params: {}) => {
|
||||
export const postWorksBatchWriter = (params = {}, writerCode: string) => {
|
||||
return Http.post('/v1/writer/works/batch', params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件-分页(写手)
|
||||
export const getWorksPageWriter = (params: {}) => {
|
||||
export const getWorksPageWriter = (writerCode: string, params = {}) => {
|
||||
return Http.get('/v1/writer/works', params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件-详情(写手)
|
||||
export const getWorksDetailWriter = (id: string) => {
|
||||
return Http.get(`/v1/writer/works/${id}`, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
});
|
||||
export const getWorksDetailWriter = (writerCode: string, id: string) => {
|
||||
return Http.get(
|
||||
`/v1/writer/works/${id}`,
|
||||
{},
|
||||
{
|
||||
headers: { 'writer-code': writerCode },
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// 内容稿件-修改(写手)
|
||||
export const putWorksUpdateWriter = (params = {}) => {
|
||||
export const putWorksUpdateWriter = (writerCode: string, params = {}) => {
|
||||
const { id, ...rest } = params as { id: string; [key: string]: any };
|
||||
return Http.put(`/v1/writer/works/${id}`, rest, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件-删除(写手)
|
||||
export const deleteWorkWriter = (id: string) => {
|
||||
export const deleteWorkWriter = (writerCode: string, id: string) => {
|
||||
return Http.delete(`/v1/writer/works/${id}`, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件-获取模板(写手)
|
||||
export const getTemplateUrlWriter = () => {
|
||||
return Http.get('/v1/writer/works/template', {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
});
|
||||
export const getTemplateUrlWriter = (writerCode: string) => {
|
||||
return Http.get(
|
||||
'/v1/writer/works/template',
|
||||
{},
|
||||
{
|
||||
headers: { 'writer-code': writerCode },
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// 内容稿件审核-分页(写手)
|
||||
export const getWorkAuditsPageWriter = (params: any) => {
|
||||
export const getWorkAuditsPageWriter = (writerCode: string, params = {}) => {
|
||||
return Http.get('/v1/writer/work-audits', params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件审核-详情(写手)
|
||||
export const getWorkAuditsDetailWriter = (id: string) => {
|
||||
return Http.get(`/v1/writer/work-audits/${id}`, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
});
|
||||
export const getWorkAuditsDetailWriter = (writerCode: string, id: string) => {
|
||||
return Http.get(
|
||||
`/v1/writer/work-audits/${id}`,
|
||||
{},
|
||||
{
|
||||
headers: { 'writer-code': writerCode },
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// 内容稿件审核-多个详情(写手)
|
||||
export const getWorkAuditsBatchDetailWriter = (params: any) => {
|
||||
export const getWorkAuditsBatchDetailWriter = (writerCode: string, params = {}) => {
|
||||
return Http.get('/v1/writer/work-audits/list', params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件-审核(写手)
|
||||
export const patchWorkAuditsAuditWriter = (id: string, params = {}) => {
|
||||
return Http.patch(`/v1/writer/work-audits/${id}/audit`, params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
});
|
||||
export const patchWorkAuditsAuditWriter = (id: string, writerCode: string) => {
|
||||
return Http.patch(
|
||||
`/v1/writer/work-audits/${id}/audit`,
|
||||
{},
|
||||
{
|
||||
headers: { 'writer-code': writerCode },
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// 内容稿件-批量审核(写手)
|
||||
export const patchWorkAuditsBatchAuditWriter = (params: {}) => {
|
||||
export const patchWorkAuditsBatchAuditWriter = (writerCode: string, params: {}) => {
|
||||
return Http.patch('/v1/writer/work-audits/batch-audit', params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件审核-修改(写手)
|
||||
export const putWorkAuditsUpdateWriter = (params = {}) => {
|
||||
export const putWorkAuditsUpdateWriter = (writerCode: string, params = {}) => {
|
||||
const { id: auditId, ...rest } = params as { id: string; [key: string]: any };
|
||||
return Http.put(`/v1/writer/work-audits/${auditId}`, rest, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件审核-审核通过(写手)
|
||||
export const putWorkAuditsAuditPassWriter = (params = {}) => {
|
||||
export const putWorkAuditsAuditPassWriter = (writerCode: string, params = {}) => {
|
||||
const { id: auditId, ...rest } = params as { id: string; [key: string]: any };
|
||||
return Http.put(`/v1/writer/work-audits/${auditId}/audit-pass`, rest, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件审核-AI审查(写手)
|
||||
export const postWorkAuditsAiReviewWriter = (params = {}) => {
|
||||
const { id: auditId, ...rest } = params as { id: string; [key: string]: any };
|
||||
const { id: auditId, writerCode, ...rest } = params as { id: string; writerCode: string; [key: string]: any };
|
||||
return Http.post(`/v1/writer/work-audits/${auditId}/ai-review`, rest, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件审核-获取AI审查结果(写手)
|
||||
export const getWorkAuditsAiReviewResultWriter = (id: string, ticket: string) => {
|
||||
return Http.get(`/v1/writer/work-audits/${id}/ai-review/${ticket}`, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
});
|
||||
export const getWorkAuditsAiReviewResultWriter = (id: string, ticket: string, writerCode: string) => {
|
||||
return Http.get(
|
||||
`/v1/writer/work-audits/${id}/ai-review/${ticket}`,
|
||||
{},
|
||||
{
|
||||
headers: { 'writer-code': writerCode },
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
// 内容稿件-通过链接获取稿件
|
||||
export const postWorksByLinkWriter = (params = {}) => {
|
||||
export const postWorksByLinkWriter = (writerCode: string, params = {}) => {
|
||||
return Http.post('/v1/writer/works/by-link', params, {
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 内容稿件-通过文档获取稿件
|
||||
export const postWorksByFileWriter = (params = {}, config = {}) => {
|
||||
return Http.post('/v1/writer/works/by-file', params, {
|
||||
...config,
|
||||
headers: { 'writer-code': getWriterCode() },
|
||||
});
|
||||
return Http.post('/v1/writer/works/by-file', params, config);
|
||||
};
|
||||
|
||||
@ -6,18 +6,31 @@ export default function useGetAiReviewResult({
|
||||
}: {
|
||||
cardInfo: any;
|
||||
updateAiReview: (ai_review: any) => void;
|
||||
startAiReviewFn: (params: { id: string; platform: string; content: string }) => Promise<any>;
|
||||
getAiReviewResultFn: (id: string, ticket: string) => Promise<any>;
|
||||
startAiReviewFn: (params: {
|
||||
id: string;
|
||||
platform: string;
|
||||
content: string;
|
||||
writerCode: string | undefined;
|
||||
}) => Promise<any>;
|
||||
getAiReviewResultFn: (id: string, ticket: string, writerCode: string | undefined) => Promise<any>;
|
||||
}) {
|
||||
const route = useRoute();
|
||||
const statusPollingTimer = ref<number | null>(null);
|
||||
const ticket = ref('');
|
||||
const checkLoading = ref(false);
|
||||
const checkResult = ref<any>({});
|
||||
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const handleStartCheck = async () => {
|
||||
checkLoading.value = true;
|
||||
const { id, platform, content } = cardInfo.value;
|
||||
const { code, data } = await startAiReviewFn({ id, platform, content });
|
||||
const { code, data } = await startAiReviewFn({
|
||||
id,
|
||||
platform,
|
||||
content,
|
||||
writerCode: writerCode.value as string | undefined,
|
||||
});
|
||||
if (code === 200) {
|
||||
ticket.value = data.ticket;
|
||||
startStatusPolling();
|
||||
@ -32,7 +45,11 @@ export default function useGetAiReviewResult({
|
||||
const startStatusPolling = () => {
|
||||
clearStatusPollingTimer();
|
||||
statusPollingTimer.value = setInterval(async () => {
|
||||
const { code, data } = await getAiReviewResultFn(cardInfo.value.id, ticket.value);
|
||||
const { code, data } = await getAiReviewResultFn(
|
||||
cardInfo.value.id,
|
||||
ticket.value,
|
||||
writerCode.value as string | undefined,
|
||||
);
|
||||
if (code === 200 && data.status === 1) {
|
||||
checkResult.value = data.ai_review;
|
||||
updateAiReview?.(data.ai_review);
|
||||
|
||||
@ -1,19 +1,12 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible"
|
||||
title="删除内容稿件"
|
||||
width="480px"
|
||||
@close="onClose"
|
||||
>
|
||||
<a-modal v-model:visible="visible" title="删除内容稿件" width="480px" @close="onClose">
|
||||
<div class="flex items-center">
|
||||
<img :src="icon1" width="20" height="20" class="mr-12px" />
|
||||
<span>确认删除 {{ projectName }} 这个内容稿件吗?</span>
|
||||
</div>
|
||||
<template #footer>
|
||||
<a-button size="medium" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" class="ml-16px" status="danger" size="medium" @click="onDelete"
|
||||
>确认删除</a-button
|
||||
>
|
||||
<a-button type="primary" class="ml-16px" status="danger" size="medium" @click="onDelete">确认删除</a-button>
|
||||
</template>
|
||||
</a-modal>
|
||||
</template>
|
||||
@ -24,12 +17,14 @@ import { deleteWorkWriter } from '@/api/all/generationWorkshop-writer.ts';
|
||||
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
|
||||
const update = inject('update');
|
||||
const route = useRoute();
|
||||
|
||||
const visible = ref(false);
|
||||
const projectId = ref(null);
|
||||
const projectName = ref('');
|
||||
|
||||
const isBatch = computed(() => Array.isArray(projectId.value));
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
function onClose() {
|
||||
visible.value = false;
|
||||
@ -46,10 +41,10 @@ const open = (record) => {
|
||||
};
|
||||
|
||||
async function onDelete() {
|
||||
const { code } = await deleteWorkWriter(projectId.value);
|
||||
const { code } = await deleteWorkWriter(writerCode.value, projectId.value);
|
||||
if (code === 200) {
|
||||
AMessage.success('删除成功');
|
||||
update()
|
||||
update();
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,9 +74,6 @@
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="['uploader', 'last_modifier'].includes(column.dataIndex)" #cell="{ record }">
|
||||
{{ record[column.dataIndex].name || record[column.dataIndex].mobile }}
|
||||
</template>
|
||||
<template
|
||||
#cell="{ record }"
|
||||
v-else-if="
|
||||
@ -95,14 +92,16 @@
|
||||
<template v-else-if="column.dataIndex === 'operation'" #cell="{ record }">
|
||||
<div class="flex items-center">
|
||||
<img class="mr-8px cursor-pointer" :src="icon1" width="14" height="14" @click="onDelete(record)" />
|
||||
<a-button type="outline" size="mini" @click="onCheck(record)" v-if="audit_status === AuditStatus.Pending"
|
||||
>审核</a-button
|
||||
>
|
||||
<a-button
|
||||
type="outline"
|
||||
size="mini"
|
||||
@click="onCheck(record)"
|
||||
v-if="audit_status === AuditStatus.Pending"
|
||||
>审核</a-button
|
||||
@click="onScan(record)"
|
||||
v-else-if="audit_status === AuditStatus.Auditing"
|
||||
>查看</a-button
|
||||
>
|
||||
<a-button type="outline" size="mini" @click="onScan(record)" v-else>查看</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else #cell="{ record }">
|
||||
@ -111,7 +110,6 @@
|
||||
</a-table-column>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -161,6 +159,8 @@ const props = defineProps({
|
||||
const route = useRoute();
|
||||
const tableRef = ref(null);
|
||||
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const handleSorterChange = (column, order) => {
|
||||
emits('sorterChange', column, order === 'ascend' ? 'asc' : 'desc');
|
||||
};
|
||||
@ -168,17 +168,17 @@ const onDelete = (item) => {
|
||||
emits('delete', item);
|
||||
};
|
||||
const onCheck = (item) => {
|
||||
patchWorkAuditsAuditWriter(item.id);
|
||||
patchWorkAuditsAuditWriter(item.id, writerCode.value);
|
||||
slsWithCatch('writerManuscriptCheckIds', [item.id]);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
};
|
||||
const onScan = (item) => {
|
||||
slsWithCatch('writerManuscriptCheckIds', [item.id]);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
};
|
||||
const onDetail = (item) => {
|
||||
router.push(
|
||||
`/writer/manuscript/check-list/detail/${item.id}/${route.params.writerCode}?source=check&audit_status=${props.audit_status}`,
|
||||
`/writer/manuscript/check-list/detail/${item.id}/${writerCode.value}?source=check&audit_status=${props.audit_status}`,
|
||||
);
|
||||
};
|
||||
const getCustomerOpinionInfo = (value) => {
|
||||
|
||||
@ -31,11 +31,6 @@ export const TABLE_COLUMNS1 = [
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '上传人员',
|
||||
dataIndex: 'uploader',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '最后修改时间',
|
||||
dataIndex: 'last_modified_at',
|
||||
@ -44,11 +39,6 @@ export const TABLE_COLUMNS1 = [
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '修改人员',
|
||||
dataIndex: 'last_modifier',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operation',
|
||||
@ -113,11 +103,11 @@ export const TABLE_COLUMNS2 = [
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '修改人员',
|
||||
dataIndex: 'last_modifier',
|
||||
width: 180,
|
||||
},
|
||||
// {
|
||||
// title: '修改人员',
|
||||
// dataIndex: 'last_modifier',
|
||||
// width: 180,
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operation',
|
||||
@ -176,11 +166,11 @@ export const TABLE_COLUMNS3 = [
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '修改人员',
|
||||
dataIndex: 'last_modifier',
|
||||
width: 180,
|
||||
},
|
||||
// {
|
||||
// title: '修改人员',
|
||||
// dataIndex: 'last_modifier',
|
||||
// width: 180,
|
||||
// },
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operation',
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
<div class="filter-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid mb-16px">
|
||||
<a-tabs v-model="query.audit_status" @tab-click="handleTabClick">
|
||||
<a-tab-pane :title="item.label" v-for="item in AUDIT_STATUS_LIST" :key="item.value"></a-tab-pane>
|
||||
<template #extra>
|
||||
<!-- <template #extra>
|
||||
<a-button type="outline" size="medium" @click="handleShareModal">分享内容稿件</a-button>
|
||||
</template>
|
||||
</template> -->
|
||||
</a-tabs>
|
||||
<FilterBlock
|
||||
v-model:query="query"
|
||||
@ -117,11 +117,13 @@ const query = ref(cloneDeep(INITIAL_QUERY));
|
||||
|
||||
const addManuscriptModalRef = ref(null);
|
||||
const deleteManuscriptModalRef = ref(null);
|
||||
const shareManuscriptModalRef = ref(null);
|
||||
// const shareManuscriptModalRef = ref(null);
|
||||
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const getData = async () => {
|
||||
const { page, page_size } = pageInfo.value;
|
||||
const { code, data } = await getWorkAuditsPageWriter({
|
||||
const { code, data } = await getWorkAuditsPageWriter(writerCode.value, {
|
||||
...query.value,
|
||||
page,
|
||||
page_size,
|
||||
@ -154,10 +156,10 @@ const handleBatchCheck = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
patchWorkAuditsBatchAuditWriter({ ids: selectedRowKeys.value });
|
||||
patchWorkAuditsBatchAuditWriter(writerCode.value, { ids: selectedRowKeys.value });
|
||||
|
||||
slsWithCatch('writerManuscriptCheckIds', selectedRowKeys.value);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
};
|
||||
const handleBatchView = () => {
|
||||
if (!selectedRows.value.length) {
|
||||
@ -166,7 +168,7 @@ const handleBatchView = () => {
|
||||
}
|
||||
|
||||
slsWithCatch('writerManuscriptCheckIds', selectedRowKeys.value);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
};
|
||||
|
||||
const handleTabClick = (key) => {
|
||||
@ -180,9 +182,9 @@ const handleTabClick = (key) => {
|
||||
getData();
|
||||
};
|
||||
|
||||
const handleShareModal = () => {
|
||||
shareManuscriptModalRef.value.open();
|
||||
};
|
||||
// const handleShareModal = () => {
|
||||
// shareManuscriptModalRef.value.open();
|
||||
// };
|
||||
|
||||
const handleDelete = (item) => {
|
||||
const { id, title } = item;
|
||||
|
||||
@ -14,7 +14,6 @@ import {
|
||||
postWorkAuditsAiReviewWriter,
|
||||
getWorkAuditsAiReviewResultWriter,
|
||||
putWorkAuditsAuditPassWriter,
|
||||
postWorkAuditsAiReviewWriter,
|
||||
} from '@/api/all/generationWorkshop-writer.ts';
|
||||
|
||||
export default {
|
||||
@ -35,6 +34,8 @@ export default {
|
||||
const selectCardInfo = ref({});
|
||||
const selectedImageInfo = ref(null);
|
||||
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const { handleStartCheck, handleAgainCheck, ticket, checkLoading } = useGetAiReviewResult({
|
||||
cardInfo: selectCardInfo,
|
||||
startAiReviewFn: postWorkAuditsAiReviewWriter,
|
||||
@ -45,7 +46,7 @@ export default {
|
||||
});
|
||||
|
||||
const onBack = () => {
|
||||
router.push({ path: `/writer/manuscript/check-list/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check-list/${writerCode.value}` });
|
||||
};
|
||||
|
||||
const onChangeCard = (item) => {
|
||||
@ -79,7 +80,7 @@ export default {
|
||||
};
|
||||
|
||||
const getWorkAudits = async () => {
|
||||
const { code, data } = await getWorkAuditsBatchDetailWriter({ ids: workIds.value });
|
||||
const { code, data } = await getWorkAuditsBatchDetailWriter(writerCode.value, { ids: workIds.value });
|
||||
if (code === 200) {
|
||||
const _data = (data ?? []).map((item) => ({
|
||||
...item,
|
||||
@ -125,7 +126,7 @@ export default {
|
||||
}
|
||||
|
||||
contentCardRef.value?.validate().then(async () => {
|
||||
const { code, data } = await putWorkAuditsUpdateWriter(selectCardInfo.value);
|
||||
const { code, data } = await putWorkAuditsUpdateWriter(writerCode.value, selectCardInfo.value);
|
||||
if (code === 200) {
|
||||
isSaved.value = true;
|
||||
AMessage.success('当前内容稿件已保存');
|
||||
@ -148,7 +149,7 @@ export default {
|
||||
contentCardRef.value?.validate().then(async () => {
|
||||
try {
|
||||
submitLoading.value = true;
|
||||
const { code, data } = await putWorkAuditsAuditPassWriter(selectCardInfo.value);
|
||||
const { code, data } = await putWorkAuditsAuditPassWriter(writerCode.value, selectCardInfo.value);
|
||||
if (code === 200) {
|
||||
onCheckSuccess();
|
||||
}
|
||||
|
||||
@ -33,9 +33,10 @@ export default {
|
||||
|
||||
const isVideo = computed(() => dataSource.value.type === EnumManuscriptType.Video);
|
||||
const sourceInfo = computed(() => SOURCE_MAP.get(source) ?? DEFAULT_SOURCE_INFO);
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const onBack = () => {
|
||||
router.push({ path: `${sourceInfo.value.routePath}/${route.params.writerCode}` });
|
||||
router.push({ path: `${sourceInfo.value.routePath}/${writerCode.value}` });
|
||||
};
|
||||
|
||||
const initData = () => {
|
||||
@ -52,7 +53,7 @@ export default {
|
||||
const getData = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const { code, data } = await getWorksDetailWriter(workId.value);
|
||||
const { code, data } = await getWorksDetailWriter(writerCode.value, workId.value);
|
||||
if (code === 200) {
|
||||
dataSource.value = data;
|
||||
initData();
|
||||
@ -112,7 +113,7 @@ export default {
|
||||
console.log('审核详情');
|
||||
} else {
|
||||
slsWithCatch('writerManuscriptCheckIds', [workId.value]);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
}
|
||||
};
|
||||
|
||||
@ -125,7 +126,7 @@ export default {
|
||||
size="medium"
|
||||
type="outline"
|
||||
class="mr-12px"
|
||||
onClick={() => router.push(`/writer/manuscript/edit/${route.params.writerCode}/${workId.value}`)}
|
||||
onClick={() => router.push(`/writer/manuscript/edit/${writerCode.value}/${workId.value}`)}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
|
||||
@ -23,6 +23,7 @@ export default {
|
||||
const isSaved = ref(false);
|
||||
|
||||
const workId = ref(route.params.id);
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const onCancel = () => {
|
||||
const isModified = !isEqual(dataSource.value, remoteDataSource.value);
|
||||
@ -41,14 +42,14 @@ export default {
|
||||
}
|
||||
|
||||
const filteredWorks = omit(dataSource.value, 'videoInfo');
|
||||
const { code, data } = await putWorksUpdateWriter({ id: workId.value, ...filteredWorks });
|
||||
const { code, data } = await putWorksUpdateWriter(writerCode.value, { id: workId.value, ...filteredWorks });
|
||||
if (code === 200) {
|
||||
AMessage.success('保存成功');
|
||||
isSaved.value = true;
|
||||
|
||||
if (check) {
|
||||
slsWithCatch('writerManuscriptCheckIds', [workId.value]);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
} else {
|
||||
onBack();
|
||||
}
|
||||
@ -56,7 +57,7 @@ export default {
|
||||
});
|
||||
};
|
||||
const getData = async () => {
|
||||
const { code, data } = await getWorksDetailWriter(workId.value);
|
||||
const { code, data } = await getWorksDetailWriter(writerCode.value, workId.value);
|
||||
if (code === 200) {
|
||||
const { type, files } = data;
|
||||
const _data = { ...data, videoInfo: cloneDeep(INITIAL_VIDEO_INFO) };
|
||||
@ -82,7 +83,7 @@ export default {
|
||||
dataSource.value.videoInfo = { ...dataSource.value.videoInfo, ...newVideoInfo };
|
||||
};
|
||||
const onBack = () => {
|
||||
router.push({ path: `/writer/manuscript/list/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/list/${writerCode.value}` });
|
||||
};
|
||||
onMounted(() => {
|
||||
workId && getData();
|
||||
|
||||
@ -1,19 +1,12 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible"
|
||||
title="删除稿件"
|
||||
width="480px"
|
||||
@close="onClose"
|
||||
>
|
||||
<a-modal v-model:visible="visible" title="删除稿件" width="480px" @close="onClose">
|
||||
<div class="flex items-center">
|
||||
<img :src="icon1" width="20" height="20" class="mr-12px" />
|
||||
<span>确认删除 {{ projectName }} 这个稿件吗?</span>
|
||||
</div>
|
||||
<template #footer>
|
||||
<a-button size="large" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" class="ml-16px" status="danger" size="large" @click="onDelete"
|
||||
>确认删除</a-button
|
||||
>
|
||||
<a-button type="primary" class="ml-16px" status="danger" size="large" @click="onDelete">确认删除</a-button>
|
||||
</template>
|
||||
</a-modal>
|
||||
</template>
|
||||
@ -24,12 +17,14 @@ import { deleteWorkWriter } from '@/api/all/generationWorkshop-writer.ts';
|
||||
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
|
||||
const update = inject('update');
|
||||
const route = useRoute();
|
||||
|
||||
const visible = ref(false);
|
||||
const projectId = ref(null);
|
||||
const projectName = ref('');
|
||||
|
||||
const isBatch = computed(() => Array.isArray(projectId.value));
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
function onClose() {
|
||||
visible.value = false;
|
||||
@ -46,10 +41,10 @@ const open = (record) => {
|
||||
};
|
||||
|
||||
async function onDelete() {
|
||||
const { code } = await deleteWorkWriter(projectId.value);
|
||||
const { code } = await deleteWorkWriter(writerCode.value, projectId.value);
|
||||
if (code === 200) {
|
||||
AMessage.success('删除成功');
|
||||
update()
|
||||
update();
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,8 @@ import {
|
||||
postWorksByLinkWriter,
|
||||
postWorksByFileWriter,
|
||||
} from '@/api/all/generationWorkshop-writer.ts';
|
||||
import { getTemplateUrl } from '@/api/all/generationWorkshop';
|
||||
|
||||
import { slsWithCatch } from '@/utils/stroage.ts';
|
||||
|
||||
import TextOverTips from '@/components/text-over-tips';
|
||||
@ -59,6 +61,7 @@ export default {
|
||||
const isLink = computed(() => uploadType.value === UPLOAD_TYPE.LINK);
|
||||
const isLocal = computed(() => uploadType.value === UPLOAD_TYPE.LOCAL);
|
||||
const isDefault = computed(() => taskStatus.value === TASK_STATUS.DEFAULT);
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
// 模态框标题
|
||||
const getTitle = () => {
|
||||
@ -95,7 +98,7 @@ export default {
|
||||
if (!errors) {
|
||||
taskStatus.value = TASK_STATUS.LOADING;
|
||||
const { link } = form.value;
|
||||
const { code, data } = await postWorksByLinkWriter({ link });
|
||||
const { code, data } = await postWorksByLinkWriter(writerCode.value, { link });
|
||||
if (code === 200) {
|
||||
taskStatus.value = TASK_STATUS.SUCCESS;
|
||||
works.value = data;
|
||||
@ -128,18 +131,19 @@ export default {
|
||||
const { code, data } = await postWorksByFileWriter(formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'writer-code': writerCode.value,
|
||||
},
|
||||
});
|
||||
if (code === 200) {
|
||||
taskStatus.value = TASK_STATUS.SUCCESS;
|
||||
works.value = data;
|
||||
works.value = data ? [data] : [];
|
||||
}
|
||||
};
|
||||
|
||||
// 跳转编辑
|
||||
const goUpload = () => {
|
||||
slsWithCatch('writerWaitUploadWorks', JSON.stringify(works.value));
|
||||
router.push(`/writer/manuscript/upload/${route.params.writerCode}`);
|
||||
router.push(`/writer/manuscript/upload/${writerCode.value}`);
|
||||
onClose();
|
||||
};
|
||||
|
||||
@ -157,7 +161,7 @@ export default {
|
||||
|
||||
// 下载模板
|
||||
const handleDownloadTemplate = async () => {
|
||||
const { code, data } = await getTemplateUrlWriter();
|
||||
const { code, data } = await getTemplateUrlWriter(writerCode.value);
|
||||
if (code === 200) {
|
||||
window.open(data.download_url, '_blank');
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ const { dataSource, pageInfo, onPageChange, onPageSizeChange, resetPageInfo } =
|
||||
getData();
|
||||
},
|
||||
});
|
||||
const route = useRoute();
|
||||
const query = ref(cloneDeep(INITIAL_QUERY));
|
||||
const addManuscriptModalRef = ref(null);
|
||||
const deleteManuscriptModalRef = ref(null);
|
||||
@ -64,7 +65,7 @@ const uploadManuscriptModalRef = ref(null);
|
||||
|
||||
const getData = async () => {
|
||||
const { page, page_size } = pageInfo.value;
|
||||
const { code, data } = await getWorksPageWriter({
|
||||
const { code, data } = await getWorksPageWriter(route.params.writerCode, {
|
||||
...query.value,
|
||||
page,
|
||||
page_size,
|
||||
|
||||
@ -38,6 +38,7 @@ export default {
|
||||
const uploadLoading = ref(false);
|
||||
const workId = route.params.id;
|
||||
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
const onCancel = () => {
|
||||
cancelUploadModal.value?.open(works.value.length);
|
||||
};
|
||||
@ -76,7 +77,7 @@ export default {
|
||||
const onSubmit = async (action) => {
|
||||
uploadLoading.value = true;
|
||||
const filteredWorks = map(works.value, (work) => omit(work, 'videoInfo'));
|
||||
const { code, data } = await postWorksBatchWriter({ works: filteredWorks });
|
||||
const { code, data } = await postWorksBatchWriter({ works: filteredWorks }, writerCode.value);
|
||||
if (code === 200) {
|
||||
uploadLoading.value = false;
|
||||
if (action === 'batchUpload') {
|
||||
@ -84,9 +85,9 @@ export default {
|
||||
} else {
|
||||
if (action === 'uploadAndCheck') {
|
||||
slsWithCatch('writerManuscriptCheckIds', [workId]);
|
||||
router.push({ path: `/writer/manuscript/check/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/check/${writerCode.value}` });
|
||||
} else {
|
||||
router.push({ path: `/writer/manuscript/list/${route.params.writerCode}` });
|
||||
router.push({ path: `/writer/manuscript/list/${writerCode.value}` });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user