Merge commit '892234762d1c9de0a0540a722428fe8cc4970f12' into test_任务管理v2

* commit '892234762d1c9de0a0540a722428fe8cc4970f12': (35 commits)
  refactor(material-center): 重构删除文件模态框组件
  perf(material-center): 优化原料上传逻辑
  refactor(user): 重构用户信息获
  perf: 调整
  perf: 增加拖拽文件进入态
  perf: 增加maskClosable限制
  perf(add-raw-material-drawer): 添加文件夹上传检查并调整样式
  perf: 去掉轮训
  perf: 标签为空展示
  perf(table): 更新标签文本样式
  ``` style(ant-select.scss): 更新复选样式和标签样式在`ant-select.scss`文件中添加了复选相关的样式,并对`.ant-tag`元素进行了详细的样式定义,包括内边距、边框半径、背景色等。同时调整了`.ant-tag .anticon-close`的字体大小。
  ``` perf(ant-tag.scss): 更新标签样式并增加字体属性更新了.ant-tag的样式,包括:- 将border-radius从2px改为4px- 添加了font-family, font-style和font-weight属性feat(add-raw-material-drawer, edit-raw-material-modal): 增加标签渲染功能 ```
  perf: 标签选择交互调整
  style(layout): 优化导航栏右侧菜单项样式
  style(input): 优化输入框样式和功能
  style(button): 调整按钮激活状态样式
  feat(manuscript): 新增稿件来源列并优化相关展示
  feat(material-center): 增加原料库编辑功能并优化列表展示
  feat: 添加文件类型扩展名常量和优化表格列显示
  feat: 优化原料库上传功能和标签管理
  ...
This commit is contained in:
lq
2025-09-19 10:37:17 +08:00
61 changed files with 2071 additions and 271 deletions

View File

@ -14,18 +14,25 @@
<p class="cts mt-36px !color-#211F24 mb-24px">验证成功请更改密码</p>
<Form ref="formRef" :model="formData" :rules="formRules" auto-label-width class="w-348 form-wrap">
<FormItem name="password" class="password-form-item">
<Input.Password v-model:value="formData.password" placeholder="新密码" size="large" class="!h-48px">
<Input.Password
v-model:value="formData.password"
class="!h-48px"
placeholder="新密码"
size="large"
@change="onPasswordChange"
>
<template #iconRender="visible">
<img :src="visible ? icon2 : icon1" width="20" height="20" class="cursor-pointer" />
</template>
</Input.Password>
</FormItem>
<FormItem name="confirm_password" class="password-form-item">
<FormItem class="password-form-item !mb-36px" name="confirm_password">
<Input.Password
v-model:value="formData.confirm_password"
placeholder="密码确认"
size="large"
class="!h-48px"
@change="onPasswordChange"
>
<template #iconRender="visible">
<img :src="visible ? icon2 : icon1" width="20" height="20" class="cursor-pointer" />
@ -37,7 +44,7 @@
type="primary"
:disabled="disabledSubmitBtn"
:loading="submitLoading"
class="w-full !h-48px mt-36px !rounded-8px"
class="w-full !h-48px mt-36px !rounded-8px h-22px"
@click="handleSubmit"
>完成更改
</Button>
@ -54,7 +61,9 @@
<p class="cts !text-12px !lh-20px !color-#939499" v-if="countdown > 0">
{{ countdown }} 秒后您可以再次发送验证码
</p>
<Button type="text" class="pl-0" v-if="hasGetCode && countdown === 0" @click="getCaptcha">重新发送</Button>
<Button v-if="hasGetCode && countdown === 0" class="pl-0 h-22px" type="text" @click="getCaptcha"
>重新发送
</Button>
</template>
</div>
@ -79,6 +88,11 @@ import icon2 from '@/assets/img/login/icon-open.png';
const emit = defineEmits(['success', 'cancel']);
const INITIAL_FORM_DATA = {
captcha: '',
password: '',
confirm_password: '',
};
const visible = ref(false);
const phone = ref('');
const isCheckPass = ref(false);
@ -90,11 +104,7 @@ const timer = ref<number | null>(null);
const hasGetCode = ref(false);
const submitLoading = ref(false);
const verificationCodeRef = ref(null);
const formData = ref({
captcha: '',
password: '',
confirm_password: '',
});
const formData = ref(cloneDeep(INITIAL_FORM_DATA));
const formRules = {
password: [
@ -113,7 +123,7 @@ const formRules = {
{
required: true,
validator: (_rule, value) => {
if (value !== formData.value.password) {
if (value && value !== formData.value.password) {
return Promise.reject('确认密码与设置的密码不同');
}
return Promise.resolve();
@ -143,6 +153,12 @@ const onCheckPass = (captcha) => {
formData.value.captcha = captcha;
};
const onPasswordChange = () => {
nextTick(() => {
formRef.value.clearValidate('confirm_password');
});
};
const getCaptcha = async () => {
try {
const { code, message: msg } = await postUpdatePasswordCaptcha();
@ -216,6 +232,8 @@ const onClose = () => {
countdown.value = 0;
hasGetCode.value = false;
submitLoading.value = false;
isCheckPass.value = false;
formData.value = cloneDeep(INITIAL_FORM_DATA);
formRef.value?.resetFields();
formRef.value?.clearValidate();
clearTimer();

View File

@ -39,14 +39,10 @@
.ant-form {
.ant-form-item {
&:not(:last-child) {
margin-bottom: 24px !important;
}
margin-bottom: 24px !important;
.ant-input-affix-wrapper {
border-radius: 8px !important;
}
}
}

View File

@ -7,10 +7,9 @@
ref="inputRef"
:key="index"
:value="item.value"
:class="{ error: item.error, fill: item.value }"
:class="{ error: isError, fill: item.value }"
@input="handleInput(index, $event.target.value)"
@focus="handleFocus(index)"
@blur="handleBlur(index)"
@focus="handleFocus"
:maxlength="1"
placeholder=""
/>
@ -34,11 +33,21 @@ const emits = defineEmits(['success']);
const codeArray = ref([]);
const activeIndex = ref(0); // 当前激活的输入框索引
const errorMessage = ref('');
const isError = ref(false);
const inputRef = ref(null);
const handleFocus = (index) => {
isError.value = false;
errorMessage.value = '';
};
// 处理输入事件
const handleInput = (index, value) => {
if (!value || !/^\d$/.test(value)) return;
if (!value) {
return;
}
isError.value = false;
errorMessage.value = '';
codeArray.value[index].value = value;
@ -48,45 +57,36 @@ const handleInput = (index, value) => {
}
};
const handleFocus = (index) => {
activeIndex.value = index;
};
const handleBlur = (index) => {
const _value = codeArray.value[index].value;
if (!_value || !/^\d$/.test(_value)) {
codeArray.value[index].error = true;
} else {
if (errorMessage.value) {
codeArray.value.forEach((item) => {
item.error = false;
});
}
errorMessage.value = '';
codeArray.value[index].error = false;
}
};
// 验证验证码逻辑
const validateCode = async () => {
const captcha = codeArray.value.map((item) => item.value).join('');
const { code } = await postCheckUpdatePasswordCaptcha({ captcha });
if (code === 200) {
emits('success', captcha);
} else {
activeIndex.value = 0;
inputRef.value?.[activeIndex.value]?.focus?.();
errorMessage.value = '验证码错误,请检查后重试';
codeArray.value.forEach((item) => {
item.error = true;
item.value = '';
});
}
return new Promise((resolve, reject) => {
isError.value = codeArray.value.some((_value) => !_value);
isError.value ? reject() : resolve();
});
};
const onSubmit = () => {
validateCode().then(async () => {
const captcha = codeArray.value.map((item) => item.value).join('');
const { code } = await postCheckUpdatePasswordCaptcha({ captcha });
if (code === 200) {
emits('success', captcha);
} else {
inputRef.value?.[activeIndex.value]?.blur?.();
activeIndex.value = 0;
errorMessage.value = '验证码错误,请检查后重试';
isError.value = true;
codeArray.value.forEach((item) => {
item.value = '';
});
}
});
};
const init = () => {
activeIndex.value = 0;
errorMessage.value = '';
isError.value = false;
inputRef.value = null;
codeArray.value = new Array(6).fill().map(() => ({ value: '', error: false }));
@ -100,7 +100,7 @@ watch(
() => codeArray.value,
(newVal) => {
if (newVal.every((item) => item.value)) {
validateCode();
onSubmit();
}
},
{ deep: true },
@ -129,17 +129,20 @@ defineExpose({ init });
caret-color: #6d4cfe;
&.error {
border-color: #f64b31 !important;
}
&:hover {
border-color: #6d4cfe !important;
}
&:focus-within {
border-color: #6d4cfe !important;
}
&.fill {
color: #6d4cfe;
}
&.error {
border-color: #f64b31 !important;
}
}
}
}

View File

@ -43,12 +43,12 @@
<img :src="visible ? icon2 : icon1" width="20" height="20" class="cursor-pointer" />
</template>
</Input.Password>
<p class="color-#F64B31 text-12px font-400 lh-20px font-family-regular" v-show="errMsg">
<p v-show="errMsg" class="color-#F64B31 h-20px text-12px font-400 lh-20px font-family-regular">
{{ errMsg }}
</p>
</FormItem>
<FormItem class="mt-52px">
<FormItem class="mt-32px">
<div class="text-12px flex justify-center items-center mb-16px">
<Checkbox v-model:checked="hasCheck" class="mr-8px"></Checkbox>
<span class="text-12px color-#737478 font-400 lh-20px font-family-regular"
@ -67,14 +67,18 @@
登录
</Button>
<div class="flex justify-between btn-row">
<Button
type="text"
class="!color-#939499 !p-0 !h-22px hover:color-#6D4CFE"
size="small"
@click="onForgetPassword"
>
忘记密码
</Button>
<div>
<Button
v-show="!isCaptchaLogin"
class="!color-#939499 !p-0 !h-22px hover:color-#6D4CFE"
size="small"
type="text"
@click="onForgetPassword"
>
忘记密码
</Button>
</div>
<Button
type="text"
class="!color-#939499 !p-0 !h-22px hover:color-#6D4CFE"
@ -101,7 +105,7 @@
import { Button, Checkbox, Form, FormItem, Input, message, Tabs, Typography } from 'ant-design-vue';
import PuzzleVerification from '../PuzzleVerification.vue';
import SelectAccountModal from '../select-account-modal/index.vue';
import { fetchAuthorizationsCaptcha, fetchLoginCaptCha, fetchProfileInfo, postLoginPassword } from '@/api/all/login';
import { fetchAuthorizationsCaptcha, fetchLoginCaptCha, fetchUserInfo, postLoginPassword } from '@/api/all/login';
import { postClearRateLimiter } from '@/api/all/common';
import { joinEnterpriseByInviteCode } from '@/api/all';
import { computed, onUnmounted, reactive, ref } from 'vue';
@ -264,7 +268,7 @@ const onTabChange = () => {
// 获取用户信息
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
const { code, data } = await fetchUserInfo();
if (code === 200) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
@ -279,6 +283,7 @@ const getProfileInfo = async () => {
selectAccountModalRef.value.open();
}
} else {
userStore.setUserInfo(data);
router.push({ name: 'Trial' });
}
}

View File

@ -2,11 +2,13 @@
<template>
<div class="flex items-center w-400 h-100%">
<div class="w-full bg-#fff rounded-16px px-40px py-32px flex flex-col items-center">
<div class="flex items-center mb-24px w-full cursor-pointer" @click="onBack">
<icon-left size="24" class="mr-4px color-#000" />
<span class="color-#000 text-20px font-500 lh-28px font-family-medium">{{
isResetPassword ? '重置密码' : '手机注册'
}}</span>
<div class="flex items-center mb-24px w-full">
<div class="flex items-center cursor-pointer" @click="onBack">
<icon-left class="mr-4px color-#000" size="24" />
<span class="color-#000 text-20px font-500 lh-28px font-family-medium">{{
isResetPassword ? '重置密码' : '手机注册'
}}</span>
</div>
</div>
<Form ref="formRef" :model="formData" :rules="formRules" auto-label-width class="w-320 form-wrap">
<FormItem name="mobile">
@ -19,14 +21,14 @@
/>
</FormItem>
<FormItem name="password" class="password-form-item">
<Input.Password v-model:value="formData.password" placeholder="新密码" @change="clearErrorMsg">
<Input.Password v-model:value="formData.password" placeholder="新密码" @change="onPasswordChange">
<template #iconRender="visible">
<img :src="visible ? icon2 : icon1" width="20" height="20" class="cursor-pointer" />
</template>
</Input.Password>
</FormItem>
<FormItem name="confirm_password" class="password-form-item">
<Input.Password v-model:value="formData.confirm_password" placeholder="密码确认" @change="clearErrorMsg">
<Input.Password v-model:value="formData.confirm_password" placeholder="密码确认" @change="onPasswordChange">
<template #iconRender="visible">
<img :src="visible ? icon2 : icon1" width="20" height="20" class="cursor-pointer" />
</template>
@ -48,12 +50,12 @@
</div>
</template>
</Input>
<p class="color-#F64B31 text-12px font-400 lh-20px font-family-regular" v-show="errMsg">
<p class="color-#F64B31 text-12px font-400 lh-20px h-20px font-family-regular">
{{ errMsg }}
</p>
</FormItem>
<FormItem class="mt-52px">
<FormItem class="mt-32px">
<div class="text-12px flex justify-center items-center mb-16px">
<Checkbox v-model:checked="hasCheck" class="mr-8px"></Checkbox>
<span class="text-12px color-#737478 font-400 lh-20px font-family-regular"
@ -90,7 +92,7 @@ import PuzzleVerification from '../PuzzleVerification.vue';
import SelectAccountModal from '../select-account-modal/index.vue';
import { postClearRateLimiter } from '@/api/all/common';
import {
fetchProfileInfo,
fetchUserInfo,
postForgetPassword,
postForgetPasswordCaptcha,
postRegister,
@ -186,7 +188,7 @@ const formRules = {
// if (value.length < 6) {
// return Promise.reject('密码长度不能小于6位');
// }
if (value !== formData.value.password) {
if (value && value !== formData.value.password) {
return Promise.reject('确认密码与设置的密码不同');
}
return Promise.resolve();
@ -229,13 +231,20 @@ const canGetCaptcha = computed(() => {
});
const disabledSubmitBtn = computed(() => {
return !isPassPassword.value || !hasCheck.value || !isLegalMobile.value || !formData.value.password.trim();
return !isPassPassword.value || !hasCheck.value || !isLegalMobile.value || !formData.value.password.trim() || !formData.value.captcha;
});
const clearErrorMsg = () => {
errMsg.value = '';
};
const onPasswordChange = () => {
clearErrorMsg();
nextTick(() => {
formRef.value.clearValidate('confirm_password');
});
};
const validateField = (field) => {
formRef.value.validateFields(field);
};
@ -286,8 +295,9 @@ const handleVerificationSubmit = async () => {
// 获取用户信息
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
const { code, data } = await fetchUserInfo();
if (code === 200) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
accounts.value = enterprises;
@ -302,6 +312,7 @@ const getProfileInfo = async () => {
selectAccountModalRef.value.open();
}
} else {
userStore.setUserInfo(data);
router.push({ name: 'Trial' });
}
}
@ -339,7 +350,7 @@ const handleSubmit = async () => {
}, 1500);
return;
}
;
userStore.setToken(data.access_token);

View File

@ -6,11 +6,11 @@
}
.ant-input-affix-wrapper {
height: 48px;
padding: 0 10px;
padding: 10px 16px;
border-radius: 8px !important;
.ant-input {
border-radius: 8px !important;
font-size: 16px;
font-size: 16px !important;
font-style: normal;
font-weight: 400;
line-height: 24px;
@ -44,16 +44,17 @@
}
}
}
:deep(.btn-login) {
&:disabled {
background-color: #c5b7ff !important;
}
&:not(:disabled) {
&:hover {
background-color: $color-primary-3 !important;
}
}
}
//:deep(.btn-login) {
// //&:disabled {
// // background-color: #c5b7ff !important;
// //}
// //&:not(:disabled) {
// // &:hover {
// // background-color: $color-primary-3 !important;
// // }
// //}
//}
.login-bg {
position: fixed;
left: 0;

View File

@ -23,23 +23,23 @@
</Input>
</Space>
</div>
<div class="filter-row-item">
<span class="label">序号</span>
<Space size="medium">
<Input
v-model:value="query.uid"
class="!w-160px"
placeholder="请输入序号"
size="medium"
allowClear
@change="handleSearch"
>
<template #prefix>
<icon-search />
</template>
</Input>
</Space>
</div>
<!-- <div class="filter-row-item">-->
<!-- <span class="label">序号</span>-->
<!-- <Space size="medium">-->
<!-- <Input-->
<!-- v-model:value="query.uid"-->
<!-- class="!w-160px"-->
<!-- placeholder="请输入序号"-->
<!-- size="medium"-->
<!-- allowClear-->
<!-- @change="handleSearch"-->
<!-- >-->
<!-- <template #prefix>-->
<!-- <icon-search />-->
<!-- </template>-->
<!-- </Input>-->
<!-- </Space>-->
<!-- </div>-->
<div class="filter-row-item" v-if="query.audit_status === AuditStatus.Pending">
<span class="label">上传时间</span>
<DatePicker.RangePicker
@ -83,7 +83,7 @@
<div class="filter-row-item">
<Button type="primary" ghost class="mr-12px" size="medium" @click="handleSearch">
<template #icon>
<icon-search class="mr-8px"/>
<icon-search class="mr-8px" />
</template>
<template #default>搜索</template>
</Button>

View File

@ -60,6 +60,9 @@
<template v-else-if="column.dataIndex === 'title'" #customRender="{ record }">
<TextOverTips :context="record.title" :line="3" class="title" @click="onDetail(record)" />
</template>
<template v-else-if="column.dataIndex === 'origin'" #customRender="{ record }">
{{ ORIGIN_LIST.find((item) => item.value === record.origin)?.label ?? '-' }}
</template>
<template v-else-if="column.dataIndex === 'type'" #customRender="{ record }">
<div class="flex items-center">
<img :src="record.type === EnumManuscriptType.Image ? icon2 : icon3" width="16" height="16" class="mr-4px" />
@ -113,6 +116,7 @@ import { ref } from 'vue';
import { Button, Tooltip, Table, Image } from 'ant-design-vue';
const { Column } = Table;
import { formatTableField, exactFormatTime } from '@/utils/tools';
import { ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
import { EnumManuscriptType } from '@/views/material-center/components/finished-products/manuscript/list/constants';
import { patchWorkAuditsAudit } from '@/api/all/generationWorkshop';
import {
@ -123,8 +127,8 @@ import { AuditStatus } from '@/views/material-center/components/finished-product
import { slsWithCatch } from '@/utils/stroage.ts';
import TextOverTips from '@/components/text-over-tips'
import ImgLazyLoad from "@/components/img-lazy-load";
import TextOverTips from '@/components/text-over-tips';
import ImgLazyLoad from '@/components/img-lazy-load';
import ShareModal from '@/views/material-center/components/finished-products/manuscript/components/share-manuscript-modal/share-modal.vue';
import HoverImagePreview from '@/components/hover-image-preview';

View File

@ -20,6 +20,11 @@ export const TABLE_COLUMNS1 = [
dataIndex: 'title',
width: 300,
},
{
title: '来源',
dataIndex: 'origin',
width: 120,
},
{
title: '客户意见',
dataIndex: 'customer_opinion',

View File

@ -309,7 +309,7 @@ export default {
placeholder="请输入标题"
size="large"
class="!w-500px"
maxlength={30}
maxlength={20}
showCount
/>
</FormItem>

View File

@ -25,20 +25,20 @@
@change="handleSearch"
/>
</div> -->
<div class="filter-row-item">
<span class="label">序号</span>
<Input
v-model:value="query.uid"
class="!w-160px"
placeholder="请输入序号"
allowClear
@change="handleSearch"
>
<template #prefix>
<icon-search />
</template>
</Input>
</div>
<!-- <div class="filter-row-item">-->
<!-- <span class="label">序号</span>-->
<!-- <Input-->
<!-- v-model:value="query.uid"-->
<!-- class="!w-160px"-->
<!-- placeholder="请输入序号"-->
<!-- allowClear-->
<!-- @change="handleSearch"-->
<!-- >-->
<!-- <template #prefix>-->
<!-- <icon-search />-->
<!-- </template>-->
<!-- </Input>-->
<!-- </div>-->
<div class="filter-row-item">
<span class="label">审核状态</span>
<CommonSelect

View File

@ -38,6 +38,11 @@ export const TABLE_COLUMNS = [
dataIndex: 'audit_status',
width: 120,
},
{
title: '来源',
dataIndex: 'origin',
width: 120,
},
{
title: '上传时间',
dataIndex: 'created_at',

View File

@ -47,6 +47,9 @@
<template v-else-if="column.dataIndex === 'title'" #customRender="{ record }">
<TextOverTips :context="record.title" :line="3" class="title" @click="onDetail(record)" />
</template>
<template v-else-if="column.dataIndex === 'origin'" #customRender="{ record }">
{{ ORIGIN_LIST.find((item) => item.value === record.origin)?.label ?? '-' }}
</template>
<template v-else-if="column.dataIndex === 'audit_status'" #customRender="{ record }">
<div
class="flex items-center w-fit h-28px px-8px rounded-2px"
@ -96,6 +99,7 @@ import { Button, Tooltip, Table, Image } from 'ant-design-vue';
const { Column } = Table;
import { formatTableField, exactFormatTime } from '@/utils/tools';
import { TABLE_COLUMNS } from './constants';
import { ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
import {
CHECK_STATUS,
EnumManuscriptType,
@ -104,7 +108,7 @@ import { CUSTOMER_OPINION } from '@/views/material-center/components/finished-pr
import TextOverTips from '@/components/text-over-tips';
import HoverImagePreview from '@/components/hover-image-preview';
import ImgLazyLoad from "@/components/img-lazy-load";
import ImgLazyLoad from '@/components/img-lazy-load';
import icon1 from '@/assets/img/media-account/icon-delete.png';
import icon2 from '@/assets/img/creative-generation-workshop/icon-photo.png';

View File

@ -1,7 +1,7 @@
export const INITIAL_QUERY = {
title: '',
// project_ids: [],
uid: '',
// uid: '',
audit_status: undefined,
created_at: [],
sort_column: undefined,

View File

@ -0,0 +1,537 @@
<script lang="tsx">
import { Drawer, Button, Upload, Table, Input, Progress, message, Select, Modal, Tag, Tooltip } from 'ant-design-vue';
const { Column } = Table;
const { TextArea } = Input;
const { Option } = Select;
// import CommonSelect from '@/components/common-select';
import ImgLazyLoad from '@/components/img-lazy-load';
// import TextOverTips from '@/components/text-over-tips';
import axios from 'axios';
import { formatFileSize, getVideoInfo, getFileExtension } from '@/utils/tools';
import { getRawMaterialTagsList, postBatchRawMaterial, posRawMaterialTags } from '@/api/all/generationWorkshop';
import { getFilePreSignedUrl } from '@/api/all/common';
import {
imageExtensions,
videoExtensions,
documentExtensions,
} from '@/views/material-center/components/raw-material/constants';
import icon1 from '@/assets/img/media-account/icon-delete.png';
import icon2 from '../../img/icon-no-text.png';
enum EnumUploadStatus {
done = 'done',
error = 'error',
uploading = 'uploading',
}
export default defineComponent({
emits: ['update'],
setup(_, { emit, expose }) {
const visible = ref(false);
const submitLoading = ref(false);
const uploadData = ref([]);
const tagData = ref([]);
const modalRef = ref(null);
const isDragOver = ref(false);
const uploadSuccessNum = computed(() => {
return uploadData.value.filter((item) => item.uploadStatus === EnumUploadStatus.done).length;
});
// 添加拖拽事件处理函数
const handleDragEnter = (e) => {
e.preventDefault();
isDragOver.value = true;
};
const handleDragOver = (e) => {
e.preventDefault();
isDragOver.value = true;
};
const handleDragLeave = (e) => {
e.preventDefault();
isDragOver.value = false;
};
const handleDrop = (e) => {
e.preventDefault();
isDragOver.value = false;
};
const getTagData = async () => {
const { code, data } = await getRawMaterialTagsList();
if (code === 200) {
tagData.value = data ?? [];
}
};
const handleTagChange = (value, option, record) => {
if (value.length < 6) {
record.tag_ids = value;
} else {
message.warning('最多选择5个');
}
};
// 添加处理标签输入的函数
const handleTagInputPressEnter = async (e, record) => {
const inputValue = e.target.value.trim();
if (!inputValue) return;
const _target = tagData.value.find((item) => item.name === inputValue);
if (_target) {
return;
}
if (record.tag_ids.length >= 5) {
message.warning('最多选择5个');
return;
}
try {
const { code, data } = await posRawMaterialTags({ name: inputValue });
if (code === 200 && data) {
tagData.value.push({
id: data.id,
name: data.name,
});
e.target.value = '';
record.tag_ids = [...record.tag_ids, data.id];
}
} catch (error) {
message.error('添加标签失败');
}
};
const onCancel = () => {
if (!uploadData.value.length) {
onClose();
return;
}
modalRef.value = Modal.warning({
title: '确定要取消上传吗?',
content: '取消后上传将中断,已传输的内容不会保存',
cancelText: '取消',
okText: '确定',
centered: true,
footer: (
<div class="flex items-center justify-end mt-24px">
<Button
onClick={() => {
modalRef.value.destroy();
onClose();
}}
class="mr-12px"
>
确认取消
</Button>
<Button
type="primary"
onClick={() => {
modalRef.value.destroy();
}}
>
继续上传
</Button>
</div>
),
});
};
const open = () => {
getTagData();
visible.value = true;
};
const onClose = () => {
visible.value = false;
uploadData.value = [];
tagData.value = [];
modalRef.value?.destroy();
modalRef.value = null;
submitLoading.value = false;
isDragOver.value = false;
};
const handleUpload = async (option) => {
const { file } = option;
const { name, size, type, uid } = file;
let statusText = '';
const ext = name.slice(name.lastIndexOf('.')).toLowerCase();
const isImage = imageExtensions.includes(ext);
const isVideo = videoExtensions.includes(ext);
const isDocument = documentExtensions.includes(ext);
if (!isImage && !isVideo && !isDocument) {
statusText = '当前格式不支持';
} else if (
(isImage && size > 20 * 1024 * 1024) || // 图片大于20MB
(isVideo && size > 1000 * 1024 * 1024) || // 视频大于1000MB
(isDocument && size > 20 * 1024 * 1024) // 文档大于20MB
) {
statusText = '文件大小超出限制';
}
const { fileTypeLabel, cover, fileType } = await getFileInfo(file);
const currentData = {
uid,
name,
// type,
type: fileType,
uploadStatus: statusText ? EnumUploadStatus.error : EnumUploadStatus.uploading,
statusText,
percent: 0,
size,
fileTypeLabel,
tag_ids: [],
cover,
file: '',
};
uploadData.value.push(currentData);
if (statusText) return;
try {
const response = await getFilePreSignedUrl({ suffix: getFileExtension(name) });
const { upload_url, file_url } = response?.data;
const _target = uploadData.value.find((item) => item.uid === uid);
_target.file = file_url;
if (!upload_url) {
throw new Error('未能获取有效的预签名上传地址');
}
const blob = new Blob([file], { type });
await axios.put(upload_url, blob, {
headers: { 'Content-Type': type },
onUploadProgress: (progressEvent) => {
const percentCompleted = Math.round(progressEvent.progress * 100);
_target.percent = percentCompleted;
percentCompleted === 100 && (_target.uploadStatus = EnumUploadStatus.done);
},
});
} catch {
currentData.uploadStatus = EnumUploadStatus.error;
}
};
const getFileInfo = async (file: any) => {
const { name } = file;
const ext = name.slice(name.lastIndexOf('.')).toLowerCase();
if (imageExtensions.includes(ext)) {
return {
fileTypeLabel: '图片',
fileType: 0,
cover: URL.createObjectURL(file),
};
} else if (videoExtensions.includes(ext)) {
const { firstFrame } = await getVideoInfo(file);
return {
fileTypeLabel: '视频',
fileType: 1,
cover: firstFrame,
};
} else if (documentExtensions.includes(ext)) {
return {
fileTypeLabel: '文本',
fileType: 2,
cover: icon2,
};
} else {
return {
fileType: '',
fileTypeLabel: '其他',
cover: '',
};
}
};
const onConfirm = async () => {
const hasUploading = uploadData.value.some((item) => item.uploadStatus === EnumUploadStatus.uploading);
if (hasUploading) {
modalRef.value = Modal.warning({
title: '上传未完成',
content: <p class="h-22px">当前原料正在上传中关闭弹窗将导致上传失败请等待上传完成后再点击确定</p>,
okText: '我知道了',
centered: true,
});
return;
}
const raw_materials = uploadData.value.filter((item) => item.uploadStatus !== EnumUploadStatus.error);
const { code } = await postBatchRawMaterial({ raw_materials });
if (code === 200) {
message.success('上传成功');
emit('update');
onClose();
}
};
const openDeleteModal = (file) => {
modalRef.value = Modal.warning({
title: '确定删除该文件吗?',
content: <p class="h-22px"></p>,
cancelText: '取消',
okText: '确定',
centered: true,
footer: (
<div class="flex items-center justify-end mt-24px">
<Button
onClick={() => {
modalRef.value.destroy();
}}
class="mr-12px"
>
取消
</Button>
<Button
type="primary"
onClick={() => {
uploadData.value = uploadData.value.filter((item) => item.uid !== file.uid);
modalRef.value.destroy();
}}
>
确定
</Button>
</div>
),
});
};
const renderUploadStatus = (record) => {
if (record.uploadStatus === EnumUploadStatus.error) {
return (
<div>
<p class="upload-text">上传失败</p>
<p class="upload-text !color-#F64B31">{record.statusText}</p>
</div>
);
}
return (
<div>
<span class="upload-text ml-26px">
{record.uploadStatus === EnumUploadStatus.done ? '上传成功' : '上传中'}
</span>
<Progress percent={record.percent} class="m-0 p-0 " />
</div>
);
};
const renderUploadList = () => {
if (!uploadData.value.length) return null;
return (
<>
<p class="cts !color-#939499 mb-10px">
已上传<span class="!color-#211F24">{`${uploadSuccessNum.value}/${uploadData.value.length}`}</span>
</p>
<Table
ref="tableRef"
dataSource={uploadData.value}
pagination={false}
class="w-100% flex-1"
scroll={{ y: '100%' }}
>
<Column
title="文件名称"
dataIndex="name"
key="name"
width={380}
ellipsis={true}
customRender={({ text, record }) => {
return (
<div class="flex items-center justify-end">
<ImgLazyLoad width={64} height={64} src={record.cover} class="!rounded-6px mr-16px flex-shrink-0" />
<TextArea
v-model:value={record.name}
placeholder="请输入文件名称"
size="large"
class="w-full !h-72px"
showCount
maxlength={20}
/>
</div>
);
}}
/>
<Column
title="上传状态"
dataIndex="uploadStatus"
key="uploadStatus"
width={164}
customRender={({ text, record }) => renderUploadStatus(record)}
/>
<Column
title="标签"
dataIndex="tag_ids"
key="tag_ids"
width={243}
customRender={({ text, record }) => {
return (
<Select
disabled={record.uploadStatus === EnumUploadStatus.uploading}
value={record.tag_ids}
mode="multiple"
size="middle"
placeholder="请选择标签"
allowClear
autoClearSearchValue
class="w-full"
showSearch
showArrow
maxTagCount={5}
options={tagData.value}
optionFilterProp="name"
field-names={{ label: 'name', value: 'id' }}
onChange={(value, option) => handleTagChange(value, option, record)}
onInputKeyDown={(e) => {
// 检测回车键
if (e.key === 'Enter') {
e.preventDefault();
handleTagInputPressEnter(e, record);
}
}}
v-slots={{
tagRender: (val) => {
const { label, value } = val;
if (label.length > 5) {
return (
<div class="my-2px">
<Tooltip title={label}>
<Tag
closable
onClose={() => (record.tag_ids = record.tag_ids.filter((item) => item !== value))}
class="mr-0 !color-#55585F h-20px !lh-20px !text-12px"
>
{label.slice(0, 5) + '...'}
</Tag>
</Tooltip>
</div>
);
} else {
return (
<div class="my-2px">
<Tag
closable
onClose={() => (record.tag_ids = record.tag_ids.filter((item) => item !== value))}
class="mr-0 !color-#55585F h-20px !lh-20px !text-12px"
>
{label}
</Tag>
</div>
);
}
},
}}
/>
);
}}
/>
<Column title="类型" dataIndex="fileTypeLabel" key="fileTypeLabel" width={80} />
<Column
title="大小"
dataIndex="size"
key="size"
width={100}
customRender={({ record }) => {
return formatFileSize(record.size);
}}
/>
<Column
title="操作"
key="action"
width={80}
fixed="right"
align="right"
customRender={({ text, record }) => {
return (
<div class="flex items-center justify-end">
<img
alt=""
class="cursor-pointer"
src={icon1}
width="14"
height="14"
onClick={() => openDeleteModal(record)}
/>
</div>
);
}}
/>
</Table>
</>
);
};
expose({
open,
});
return () => (
<Drawer
width={1100}
title="上传到原料库"
rootClassName="xt-add-raw-material-modal"
v-model:open={visible.value}
onClose={onClose}
maskClosable={false}
>
<section class="content flex-1 pt-8px px-24px pb-24px overflow-hidden flex flex-col">
<div class="rounded-16px bg-#F7F8FA p-16px flex flex-col items-center mb-24px">
<Upload
file-list={uploadData.value}
action="/"
multiple
customRequest={handleUpload}
class="w-full mb-16px"
showUploadList={false}
>
<div
class={`upload-box rounded-8px cursor-pointer h-100px w-full border border-dashed border-#D7D7D9 flex flex-col items-center justify-center w-full ${
isDragOver.value ? 'bg-#F0EDFF' : 'bg-#F7F8FA'
}`}
onDragenter={handleDragEnter}
onDragover={handleDragOver}
onDragleave={handleDragLeave}
onDrop={handleDrop}
>
<icon-plus size="14" class="mb-10px color-#55585F" />
<span class="cts">点击或拖拽文件到此处上传</span>
</div>
</Upload>
<p class="mb-4px cts !color-#939499 !text-12px !lh-20px">{`视频格式视频格式MP4、AVI、MOV大小<1000MB`}</p>
<p class="mb-4px cts !color-#939499 !text-12px !lh-20px">{`图片格式PNG、JPG、JPEG、GIF、WEBP、BMP大小<20MB`}</p>
<p class="cts !color-#939499 !text-12px !lh-20px">{`文本格式TXT、DOC、DOCX、PDF大小<20MB`}</p>
</div>
{renderUploadList()}
</section>
<footer class="footer h-68px px-24px flex items-center justify-end">
<div class="flex items-center">
<Button size="large" onClick={onCancel} class="mr-12px">
取消
</Button>
<Button size="large" type="primary" onClick={onConfirm} loading={submitLoading.value}>
确定
</Button>
</div>
</footer>
</Drawer>
);
},
});
</script>
<style lang="scss">
@import './style.scss';
</style>

View File

@ -0,0 +1,110 @@
.xt-add-raw-material-modal {
.ant-drawer-header {
height: 58px;
border-bottom: none;
}
.ant-upload {
width: 100%;
}
.ant-select {
//.ant-select-selection-overflow-item {
// max-width: 50%;
//}
}
.ant-drawer-body {
padding: 0;
display: flex;
flex-direction: column;
.cts {
color: #211f24;
font-family: $font-family-regular;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 22px;
}
.content {
.upload-box {
transition: all 0.3s;
&:hover {
border-color: #6d4cfe;
}
}
.upload-text {
color: #000;
text-align: center;
font-family: $font-family-regular;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
.ant-progress {
display: flex;
align-items: center;
justify-content: center;
.ant-progress-outer {
position: relative;
width: 100%;
height: 6px !important;
margin: 0;
padding: 0;
.ant-progress-inner {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
width: 100px;
height: 6px !important;
background: var(--BG-200, #F2F3F5);
.ant-progress-bg {
height: 6px !important;
background-color: #6D4CFE;
}
}
}
.ant-progress-text {
color: var(--Text-1, #211F24);
font-family: $font-family-regular;
font-size: 12px;
font-style: normal;
font-weight: 400;
.anticon {
font-size: 16px;
}
}
&.ant-progress-status-success {
.ant-progress-outer {
.ant-progress-bg {
background-color: #25C883;
}
}
.ant-progress-text {
color: #25C883;
}
}
}
}
.footer {
}
}
}

View File

@ -0,0 +1,291 @@
<script lang="tsx">
import { ref } from 'vue';
import { Button, Modal, Form, FormItem, Input, message, Select, Tag, Tooltip } from 'ant-design-vue';
import TextOverTips from '@/components/text-over-tips';
const { TextArea } = Input;
import { formatFileSize, exactFormatTime } from '@/utils/tools';
import {
getRawMaterialDetail,
putRawMaterial,
getRawMaterialTagsList,
posRawMaterialTags,
} from '@/api/all/generationWorkshop';
import { TABS_LIST, ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
const INITIAL_FORM = {
name: '',
tag_ids: [],
uid: '',
type: '',
origin: '',
size: '',
created_at: '',
uploader: {
name: '',
mobile: '',
},
};
export default {
setup(props, { emit, expose }) {
const formRef = ref();
const id = ref('');
const visible = ref(false);
const submitLoading = ref(false);
const form = ref(cloneDeep(INITIAL_FORM));
const tagOptions = ref([]);
const rules = {
mobile: [
{
required: true,
validator: (_rule, value) => {
if (!value) {
return Promise.reject('请填写手机号');
}
if (!/^1[3-9]\d{9}$/.test(value)) {
return Promise.reject('手机号格式不正确');
} else {
return Promise.resolve();
}
},
trigger: ['blur', 'change'],
},
],
operator_name: [{ required: true, message: '请输入运营人员' }],
};
const getMaterialDetail = async () => {
const { code, data } = await getRawMaterialDetail(id.value);
if (code === 200) {
form.value = data;
}
};
const getTags = async () => {
const { code, data } = await getRawMaterialTagsList();
if (code === 200) {
tagOptions.value = data;
}
};
const reset = () => {
form.value = cloneDeep(INITIAL_FORM);
tagOptions.value = [];
submitLoading.value = false;
id.value = '';
};
const open = (materialId = '') => {
id.value = materialId;
getMaterialDetail();
getTags();
visible.value = true;
};
const onClose = () => {
reset();
visible.value = false;
};
const onSubmit = () => {
formRef.value.validate().then(async () => {
try {
submitLoading.value = true;
const { code } = await putRawMaterial({ id: id.value, ...form.value });
if (code === 200) {
message.success('修改成功');
emit('update');
onClose();
}
} finally {
submitLoading.value = false;
}
});
};
const handleTagChange = (value) => {
if (value.length < 6) {
form.value.tag_ids = value;
} else {
message.warning('最多选择5个');
}
};
const deleteTag = (tagId) => {
form.value.tag_ids = form.value.tag_ids.filter((item) => item !== tagId);
};
// 添加处理标签输入的函数
const handleTagInputPressEnter = async (e) => {
const inputValue = e.target.value.trim();
if (!inputValue) return;
const _target = tagOptions.value.find((item) => item.name === inputValue);
if (_target) {
return;
}
if (form.value.tag_ids.length >= 5) {
message.warning('最多选择5个');
return;
}
try {
const { code, data } = await posRawMaterialTags({ name: inputValue });
if (code === 200 && data) {
tagOptions.value.push({
id: data.id,
name: data.name,
});
e.target.value = '';
form.value.tag_ids = [...form.value.tag_ids, data.id];
}
} catch (error) {
message.error('添加标签失败');
}
};
expose({ open });
return () => (
<Modal
v-model:open={visible.value}
title="编辑素材"
wrapClassName="edit-material-modal"
width="480px"
centered
maskClosable={false}
onCancel={onClose}
v-slots={{
footer: () => (
<div class="flex">
<Button onClick={onClose}>取消</Button>
<Button type="primary" loading={submitLoading.value} onClick={onSubmit}>
确定
</Button>
</div>
),
}}
>
<Form
ref={formRef}
model={form.value}
rules={rules}
layout="horizontal"
labelAlign="right"
labelCol={{ span: 4 }}
wrapperCol={{ span: 20 }}
>
<FormItem label="文件名称" name="name">
<TextArea
v-model:value={form.value.name}
placeholder="请输入..."
size="large"
class="!h-72px"
showCount
maxlength={20}
/>
</FormItem>
<FormItem label="序号" name="uid">
<Input v-model:value={form.value.uid} placeholder="请输入..." size="large" disabled />
</FormItem>
<FormItem label="类型" name="type">
<Input
value={TABS_LIST.find((item) => item.value === form.value.type)?.label ?? '-'}
placeholder="请输入..."
size="large"
disabled
/>
</FormItem>
<FormItem label="标签" name="tag_ids" v-model:value={form.value.tag_ids}>
<Select
value={form.value.tag_ids}
mode="multiple"
size="large"
placeholder="请选择标签"
allowClear
autoClearSearchValue
class="w-full"
showSearch
showArrow
maxTagCount={5}
optionFilterProp="name"
options={tagOptions.value}
field-names={{ label: 'name', value: 'id' }}
onChange={handleTagChange}
onInputKeyDown={(e) => {
// 检测回车键
if (e.key === 'Enter') {
e.preventDefault();
handleTagInputPressEnter(e);
}
}}
v-slots={{
tagRender: (val) => {
const { label, value } = val;
if (label.length > 5) {
return (
<div class="my-2px">
<Tooltip title={label}>
<Tag
closable
onClose={() => (form.value.tag_ids = form.value.tag_ids.filter((item) => item !== value))}
class="mr-0"
>
{`${label.slice(0, 5)}...`}
</Tag>
</Tooltip>
</div>
);
} else {
return (
<div class="my-2px">
<Tag
closable
onClose={() => (form.value.tag_ids = form.value.tag_ids.filter((item) => item !== value))}
class=" mr-0 "
>
{label}
</Tag>
</div>
);
}
},
}}
/>
</FormItem>
<FormItem label="来源" name="origin">
<Input
value={ORIGIN_LIST.find((item) => item.value === form.value.origin)?.label ?? '-'}
placeholder="请输入..."
size="large"
disabled
/>
</FormItem>{' '}
<FormItem label="大小" name="size">
<Input value={formatFileSize(form.value.size)} placeholder="请输入..." size="large" disabled />
</FormItem>
<FormItem label="上传时间" name="created_at">
<Input value={exactFormatTime(form.value.created_at)} placeholder="请输入..." size="large" disabled />
</FormItem>
<FormItem label="上传人员" name="uploader">
<Input
value={form.value.uploader.name || form.value.uploader.mobile}
placeholder="请输入..."
size="large"
disabled
/>
</FormItem>
</Form>
</Modal>
);
},
};
</script>
<style lang="scss">
@import './style.scss';
</style>

View File

@ -16,13 +16,30 @@
</Input>
</div>
<div class="filter-row-item">
<span class="label">序号</span>
<Input v-model:value="query.uid" class="!w-160px" placeholder="请输入序号" allowClear @change="handleSearch">
<template #prefix>
<icon-search />
</template>
</Input>
<span class="label">标签</span>
<Select
v-model:value="query.tag_ids"
:field-names="{ label: 'name', value: 'id' }"
:maxTagCount="1"
:options="tagData"
allowClear
class="!w-200px"
mode="multiple"
optionFilterProp="name"
placeholder="请选择标签"
showArrow
showSearch
@change="handleSearch"
/>
</div>
<!-- <div class="filter-row-item">-->
<!-- <span class="label">序号</span>-->
<!-- <Input v-model:value="query.uid" class="!w-160px" placeholder="请输入序号" allowClear @change="handleSearch">-->
<!-- <template #prefix>-->
<!-- <icon-search />-->
<!-- </template>-->
<!-- </Input>-->
<!-- </div>-->
<div class="filter-row-item">
<span class="label">上传时间</span>
<DatePicker.RangePicker
@ -54,8 +71,9 @@
<script setup>
import { defineEmits, defineProps, ref, nextTick } from 'vue';
import { Button, Input, DatePicker } from 'ant-design-vue';
import { Button, Input, DatePicker, Select } from 'ant-design-vue';
import dayjs from 'dayjs';
import { getRawMaterialTagsList } from '@/api/all/generationWorkshop';
const props = defineProps({
query: {
@ -67,6 +85,14 @@ const props = defineProps({
const emits = defineEmits(['search', 'reset', 'update:query']);
const created_at = ref([]);
const tagData = ref([]);
const getTagData = async () => {
const { code, data } = await getRawMaterialTagsList();
if (code === 200) {
tagData.value = data ?? [];
}
};
const handleSearch = () => {
emits('update:query', props.query);
@ -96,4 +122,18 @@ const handleReset = () => {
created_at.value = [];
emits('reset');
};
onMounted(() => {
getTagData();
});
</script>
<style lang="scss" scoped>
.common-filter-wrap {
:deep(.ant-select) {
.ant-select-selection-overflow-item {
max-width: 50%;
}
}
}
</style>

View File

@ -17,7 +17,9 @@ import { Button, Modal, message } from 'ant-design-vue';
import { deleteRawMaterial, batchDeleteRawMaterials } from '@/api/all/generationWorkshop';
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
const update = inject('update');
// const update = inject('update');
const emits = defineEmits(['update', 'batchUpdate']);
const visible = ref(false);
const fileId = ref(null);

View File

@ -33,8 +33,13 @@
</template>
<template v-if="column.dataIndex === 'name'" #customRender="{ record }">
<div class="flex items-center">
<HoverImagePreview :src="record.cover">
<ImgLazyLoad :width="64" :height="64" :src="record.cover" class="!rounded-6px mr-16px" />
<HoverImagePreview :src="record.type === RawMaterialType.Text ? icon2 : record.cover">
<ImgLazyLoad
:height="64"
:src="record.type === RawMaterialType.Text ? icon2 : record.cover"
:width="64"
class="!rounded-6px mr-16px"
/>
</HoverImagePreview>
<div class="flex-1 flex flex-col overflow-hidden">
<TextOverTips :context="record.name" :line="1" class="cts mb-4px regular" />
@ -45,6 +50,17 @@
<template v-else-if="column.dataIndex === 'type'" #customRender="{ record }">
{{ TABS_LIST.find((item) => item.value === record.type)?.label ?? '-' }}
</template>
<template v-else-if="column.dataIndex === 'tags'" #customRender="{ record }">
<div v-if="record.tags.length > 0" class="flex flex-wrap gap-4px">
<Tag v-for="tag in record.tags" :key="tag.id" class="mr-0 rounded-4px bg-#F2F3F5 px-8px">
<Tooltip v-if="tag.name.length > 5" :title="tag.name">
<span class="cts !color-#55585F !lh-20px !text-12px"> {{ `${tag.name.slice(0, 5)}...` }} </span>
</Tooltip>
<span v-else class="cts !color-#55585F !lh-20px !text-12px"> {{ tag.name }} </span>
</Tag>
</div>
<template v-else> -</template>
</template>
<template v-else-if="column.dataIndex === 'size'" #customRender="{ record }">
<span class="cts num">{{ formatFileSize(record.size) }}</span>
</template>
@ -60,7 +76,10 @@
<template v-else-if="column.dataIndex === 'operation'" #customRender="{ record }">
<div class="flex items-center">
<img class="mr-8px cursor-pointer" :src="icon1" width="14" height="14" @click="onDelete(record)" />
<Button type="primary" ghost size="small" @click="onDownload(record)">下载</Button>
<Button class="mr-8px !h-24px !px-12px" ghost size="small" type="primary" @click="onEdit(record)"
>编辑
</Button>
<Button class="!h-24px !px-12px" ghost size="small" type="primary" @click="onDownload(record)">下载</Button>
</div>
</template>
<template v-else #customRender="{ record }">
@ -72,11 +91,11 @@
<script setup>
import { ref, computed } from 'vue';
import { Button, Tooltip, Table, Image } from 'ant-design-vue';
import { Button, Tooltip, Table, Tag } from 'ant-design-vue';
const { Column } = Table;
import { formatTableField, exactFormatTime, formatFileSize, downloadByUrl } from '@/utils/tools';
import { slsWithCatch } from '@/utils/stroage.ts';
import { TABS_LIST, ORIGIN_LIST } from '../../constants';
// import { slsWithCatch } from '@/utils/stroage.ts';
import { TABS_LIST, ORIGIN_LIST, RawMaterialType } from '../../constants';
import TextOverTips from '@/components/text-over-tips';
// import ShareModal from '@/views/material-center/components/finished-products/manuscript/components/share-manuscript-modal/share-modal.vue';
@ -84,11 +103,9 @@ import HoverImagePreview from '@/components/hover-image-preview';
import ImgLazyLoad from '@/components/img-lazy-load';
import icon1 from '@/assets/img/media-account/icon-delete.png';
// import icon2 from '@/assets/img/creative-generation-workshop/icon-photo.png';
// import icon3 from '@/assets/img/creative-generation-workshop/icon-video.png';
// import icon4 from '@/assets/img/error-img.png';
import icon2 from '../../img/icon-no-text.png';
const emits = defineEmits(['sorterChange', 'delete', 'select', 'selectAll']);
const emits = defineEmits(['sorterChange', 'delete', 'select', 'selectAll', 'edit']);
const router = useRouter();
const props = defineProps({
@ -129,6 +146,9 @@ const onDelete = (item) => {
const onDownload = (item) => {
downloadByUrl(item.file);
};
const onEdit = (item) => {
emits('edit', item);
};
</script>
<style scoped lang="scss">

View File

@ -0,0 +1,74 @@
<template>
<Modal
v-model:open="visible"
:title="isEdit ? '编辑标签' : '添加新标签'"
centered
width="400px"
@cancel="onClose"
>
<Form ref="formRef" :model="form" :rules="rules" auto-label-width layout="horizontal">
<FormItem :label="isEdit ? '标签名称' : '新标签名称'" name="name" required>
<Input v-model:value="form.name" placeholder="请输入…" />
</FormItem>
</Form>
<template #footer>
<Button @click="onClose">取消</Button>
<Button class="ml-16px" type="primary" @click="onSubmit">确认</Button>
</template>
</Modal>
</template>
<script setup>
import { ref, nextTick } from 'vue';
import { Button, Modal, Form, FormItem, Input, message } from 'ant-design-vue';
import { posRawMaterialTags, putRawMaterialTag } from '@/api/all/generationWorkshop';
const emits = defineEmits(['success', 'close']);
const visible = ref(false);
const isEdit = ref(false);
const formRef = ref();
const form = ref({ name: '' });
const tagId = ref('');
const rules = {
name: [{ required: true, message: '请输入标签名称' }],
};
function resetForm() {
nextTick(() => {
formRef.value?.clearValidate();
});
}
function onClose() {
visible.value = false;
form.value.name = '';
tagId.value = '';
isEdit.value = false;
resetForm();
}
const open = (record = {}) => {
const { id = '', name = '' } = record;
tagId.value = id;
isEdit.value = !!id;
form.value.name = name;
visible.value = true;
};
async function onSubmit() {
formRef.value.validate().then(async () => {
const _fn = isEdit.value ? putRawMaterialTag : posRawMaterialTags;
const _params = isEdit.value ? { id: tagId.value, ...form.value } : form.value;
const { code } = await _fn(_params);
if (code === 200) {
message.success(isEdit.value ? '编辑成功' : '添加成功');
emits('success');
onClose();
}
});
}
defineExpose({ open });
</script>

View File

@ -0,0 +1,56 @@
<!--
* @Author: RenXiaoDong
* @Date: 2025-06-26 17:23:52
-->
<template>
<Modal v-model:open="visible" centered title="删除标签" width="400px" @cancel="onClose">
<div class="flex items-center">
<img :src="icon1" class="mr-12px" height="20" width="20" />
<span>确认删除 "{{ tagName }}" 这个标签吗</span>
</div>
<template #footer>
<Button size="large" @click="onClose">取消</Button>
<Button class="ml-16px" danger size="large" type="primary" @click="onSubmit">确认删除</Button>
</template>
</Modal>
</template>
<script setup>
import { ref } from 'vue';
import { Button, message, Modal } from 'ant-design-vue';
import { deleteRawMaterialTag } from '@/api/all/generationWorkshop';
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
const emits = defineEmits(['success', 'close']);
const visible = ref(false);
const tagId = ref('');
const tagName = ref('');
const onClose = () => {
visible.value = false;
tagId.value = '';
tagName.value = '';
emits('close');
};
const open = (record) => {
const { id = '', name = '' } = record;
tagId.value = id;
tagName.value = name;
visible.value = true;
};
const onSubmit = async () => {
const { code } = await deleteRawMaterialTag(tagId.value);
if (code === 200) {
message.success('删除成功');
emits('success');
onClose();
}
};
defineExpose({ open });
</script>

View File

@ -0,0 +1,132 @@
<!--
* @Author: RenXiaoDong
* @Date: 2025-06-25 17:58:28
-->
<template>
<Modal
v-model:open="visible"
:footer="null"
:maskClosable="false"
centered
title="标签管理"
width="800px"
wrapClassName="raw-material-tags-manage-modal"
@cancel="close"
>
<div class="flex items-center justify-between mb-16px">
<div class="filter-row-item flex items-center">
<span class="s1 !color-#211F24 mr-12px">标签名称</span>
<Input
v-model:value="query.name"
allowClear
class="w-240px"
placeholder="请输入..."
size="medium"
@change="handleSearch"
>
<template #prefix>
<icon-search />
</template>
</Input>
</div>
<Button type="primary" @click="openAdd">
<template #icon>
<icon-plus class="mr-8px" size="16" />
</template>
<template #default>添加新标签</template>
</Button>
</div>
<div class="h-300px">
<div v-if="showDataSource.length" class="tag-list">
<Tooltip v-for="tag in showDataSource" :key="tag.id" placement="bottom" title="双击修改标签名">
<div class="tag-item cursor-pointer" @dblclick="openEdit(tag)">
<span>{{ tag.name }}</span>
<img :src="iconDelete" class="delete-icon" @click="openDelete(tag)" />
</div>
</Tooltip>
</div>
<template v-else>
<NoData>
<span class="s1 mb-32px mt-8px">暂无标签</span>
<Button size="large" type="primary" @click="openAdd">
<template #icon>
<icon-plus class="mr-8px" size="16" />
</template>
<template #default>去添加</template>
</Button>
</NoData>
</template>
</div>
<AddTag ref="addTagRef" @success="update" />
<DeleteTag ref="deleteTagRef" @success="update" />
</Modal>
</template>
<script setup>
import { ref } from 'vue';
import { Button, Modal, Input, Tooltip } from 'ant-design-vue';
import { getRawMaterialTagsList } from '@/api/all/generationWorkshop';
import AddTag from './add-tag.vue';
import DeleteTag from './delete-tag.vue';
import iconDelete from '@/assets/img/media-account/icon-delete-1.png';
const emit = defineEmits(['update']);
const visible = ref(false);
const allDataSource = ref([]);
const showDataSource = ref([]);
const addTagRef = ref(null);
const deleteTagRef = ref(null);
const query = ref({
name: '',
});
const getData = async () => {
const { code, data } = await getRawMaterialTagsList();
if (code === 200) {
allDataSource.value = data ?? [];
showDataSource.value = allDataSource.value;
}
};
const handleSearch = () => {
showDataSource.value = allDataSource.value.filter((item) => item.name.includes(query.value.name));
};
const open = () => {
visible.value = true;
getData();
};
const close = () => {
showDataSource.value = [];
allDataSource.value = [];
query.value.name = '';
visible.value = false;
};
const openAdd = () => {
// 打开新增标签弹窗
addTagRef.value.open();
};
function openEdit(record) {
addTagRef.value.open(record);
}
function openDelete(record) {
deleteTagRef.value.open(record);
}
const update = () => {
getData();
emit('update');
};
defineExpose({ open });
</script>
<style lang="scss">
@import './style.scss';
</style>

View File

@ -0,0 +1,51 @@
.raw-material-tags-manage-modal {
border-radius: 8px;
.ant-modal-body {
// padding: 24px 24px 44px !important;
overflow: hidden;
display: flex;
flex-direction: column;
.arcanto-btn {
width: fit-content;
.ant-btn-icon {
line-height: 16px;
}
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
.tag-item {
height: 24px;
display: flex;
align-items: center;
background: #f5f5f5;
border-radius: 4px;
padding: 4px 12px;
position: relative;
.delete-icon {
position: absolute;
z-index: 1;
top: -6px;
right: -6px;
cursor: pointer;
width: 12px;
height: 12px;
display: none;
}
&:hover {
.delete-icon {
display: block;
}
}
}
}
}
}

View File

@ -5,6 +5,10 @@ export enum RawMaterialType {
Text = 2,
}
export const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp'];
export const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.wmv', '.m4v'];
export const documentExtensions = ['.txt', '.doc', '.docx', '.pdf', '.xls', '.xlsx'];
export const TABS_LIST = [
{
label: '全部',
@ -37,9 +41,10 @@ export const ORIGIN_LIST = [
export const INITIAL_QUERY = {
name: '',
uid: '',
// uid: '',
type: RawMaterialType.All,
created_at: [],
tag_ids: [],
sort_column: undefined,
sort_order: undefined,
};
@ -55,6 +60,11 @@ export const TABLE_COLUMNS = [
dataIndex: 'type',
width: 80,
},
{
title: '标签',
dataIndex: 'tags',
width: 190,
},
{
title: '来源',
dataIndex: 'origin',
@ -81,7 +91,7 @@ export const TABLE_COLUMNS = [
{
title: '操作',
dataIndex: 'operation',
width: 100,
width: 180,
fixed: 'right',
}
]
},
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,14 +1,20 @@
<script lang="tsx">
import { provide } from 'vue';
import { Tabs, TabPane, Button, Pagination } from 'ant-design-vue';
import { provide, ref } from 'vue';
import { TABS_LIST, RawMaterialType, INITIAL_QUERY, TABLE_COLUMNS } from './constants';
import { Tabs, TabPane, Button, Pagination } from 'ant-design-vue';
import FilterBlock from './components/filter-block/index.vue';
import RawMaterialTable from './components/table/index.vue';
import DeleteRawMaterialModal from './components/table/delete-file-modal.vue';
import TagsManageModal from './components/tags-manage-modal';
import AddRawMaterialDrawer from './components/add-raw-material-drawer';
import EditRawMaterialDrawer from './components/edit-raw-material-modal';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
import { getRawMaterialsPage } from '@/api/all/generationWorkshop';
import icon3 from '@/assets/img/media-account/icon-tag.png';
export default defineComponent({
setup(_, { attrs, slots, expose }) {
const {
@ -27,6 +33,10 @@ export default defineComponent({
});
const deleteRawMaterialModalRef = ref(null);
const tagsManageModalRef = ref(null);
const addRawMaterialDrawerRef = ref(null);
const editRawMaterialDrawerRef = ref(null);
const query = ref(cloneDeep(INITIAL_QUERY));
const handleSearch = () => {
getData();
@ -70,6 +80,10 @@ export default defineComponent({
deleteRawMaterialModalRef.value?.open({ id, name: `${name}` });
};
const handleEdit = (item) => {
editRawMaterialDrawerRef.value?.open(item.id);
};
const handleTabClick = (key) => {
query.value.type = key;
reload();
@ -81,6 +95,13 @@ export default defineComponent({
getData();
};
const handleOpenTagsModal = () => {
tagsManageModalRef.value?.open();
};
const handleAddMaterial = () => {
addRawMaterialDrawerRef.value?.open();
};
onMounted(() => {
getData();
});
@ -88,7 +109,37 @@ export default defineComponent({
return () => (
<div class="raw-material-wrap h-full flex flex-col">
<div class="bg-white rounded-t-8px">
<Tabs v-model:activeKey={query.value.type} onTabClick={handleTabClick}>
<Tabs
v-model:activeKey={query.value.type}
onTabClick={handleTabClick}
v-slots={{
rightExtra: () => (
<div class="flex items-center">
<Button
type="primary"
ghost
size="medium"
onClick={handleOpenTagsModal}
v-slots={{
icon: () => <img src={icon3} width="16" height="16" class="mr-8px" />,
}}
>
标签管理
</Button>
<Button
type="primary"
size="medium"
class="ml-12px"
onClick={handleAddMaterial}
v-slots={{
icon: () => <icon-plus size="16" class="mr-8px" />,
default: () => '上传原料',
}}
/>
</div>
),
}}
>
{TABS_LIST.map((item) => (
<TabPane key={item.value} tab={item.label}>
{item.label}
@ -121,6 +172,7 @@ export default defineComponent({
onDelete={handleDelete}
onSelect={handleSelect}
onSelectAll={handleSelectAll}
onEdit={handleEdit}
/>
{pageInfo.value.total > 0 && (
<div class="pagination-row">
@ -137,6 +189,10 @@ export default defineComponent({
</div>
)}
</div>
<TagsManageModal ref={tagsManageModalRef} />
<AddRawMaterialDrawer ref={addRawMaterialDrawerRef} onUpdate={getData} />
<EditRawMaterialDrawer ref={editRawMaterialDrawerRef} onUpdate={getData} />
<DeleteRawMaterialModal ref={deleteRawMaterialModalRef} onBatchUpdate={onBatchSuccess} onUpdate={getData} />
</div>
);

View File

@ -15,10 +15,10 @@
>
<div class="flex items-center justify-between mb-16px">
<div class="filter-row-item flex items-center">
<span class="s1 !color-#211F24 mr-12px">分组名称</span>
<span class="s1 !color-#211F24 mr-12px">标签名称</span>
<Input
v-model:value="query.name"
placeholder="请搜索..."
placeholder="请输入..."
class="w-240px"
size="medium"
allowClear

View File

@ -10,7 +10,7 @@
</div>
</div>
</Layout.Header>
<Layout class="flex trial-content items-center">
<Layout class="flex trial-content items-center mt-24px">
<div class="w-800px">
<!-- 未建联 -->
<section class="w-full" v-if="!primary_enterprise">
@ -234,7 +234,7 @@ const handleSubmit = async () => {
const { code } = await postCreateEnterprises(formData.value);
if (code === 200) {
await userStore.getUserInfo();
const { primary_enterprise } = userStore.userInfo;
if (primary_enterprise) {
enterpriseStore.setEnterpriseInfo(primary_enterprise);

View File

@ -12,14 +12,18 @@
:deep(.ant-steps) {
.ant-steps-item {
margin-left: 0;
.ant-steps-item-icon {
width: 10px;
height: 10px;
}
.ant-steps-item-container {
cursor: text;
.ant-steps-item-icon {
width: 10px;
height: 10px;
}
.ant-steps-item-content {
margin-top: 8px;
.ant-steps-item-title {
color: var(--Text-1, #211f24);
color: var(--Text-1, #211f24) !important;
font-family: $font-family-regular;
font-size: 16px;
font-style: normal;
@ -27,7 +31,7 @@
line-height: 24px;
}
.ant-steps-item-description {
color: var(--Text-3, #737478);
color: var(--Text-3, #737478) !important;
font-family: $font-family-regular;
font-size: 14px;
font-style: normal;
@ -35,6 +39,16 @@
line-height: 22px;
}
}
.ant-steps-item-tail {
top: 4px;
&::after {
height: 1px !important;
}
}
}
&.ant-steps-item-wait {
.ant-steps-icon {
.ant-steps-icon-dot {

View File

@ -23,23 +23,23 @@
</Input>
</Space>
</div>
<div class="filter-row-item">
<span class="label">序号</span>
<Space size="medium">
<Input
v-model:value="query.uid"
class="!w-160px"
placeholder="请输入序号"
size="middle"
allowClear
@change="handleSearch"
>
<template #prefix>
<icon-search />
</template>
</Input>
</Space>
</div>
<!-- <div class="filter-row-item">-->
<!-- <span class="label">序号</span>-->
<!-- <Space size="medium">-->
<!-- <Input-->
<!-- v-model:value="query.uid"-->
<!-- class="!w-160px"-->
<!-- placeholder="请输入序号"-->
<!-- size="middle"-->
<!-- allowClear-->
<!-- @change="handleSearch"-->
<!-- >-->
<!-- <template #prefix>-->
<!-- <icon-search />-->
<!-- </template>-->
<!-- </Input>-->
<!-- </Space>-->
<!-- </div>-->
<div class="filter-row-item" v-if="query.audit_status === AuditStatus.Pending">
<span class="label">上传时间</span>
<DatePicker.RangePicker

View File

@ -62,6 +62,9 @@
<template v-else-if="column.dataIndex === 'title'" #customRender="{ record }">
<TextOverTips :context="record.title" :line="3" class="title" @click="onDetail(record)" />
</template>
<template v-else-if="column.dataIndex === 'origin'" #customRender="{ record }">
{{ ORIGIN_LIST.find((item) => item.value === record.origin)?.label ?? '-' }}
</template>
<template v-else-if="column.dataIndex === 'type'" #customRender="{ record }">
<div class="flex items-center">
<img :src="record.type === EnumManuscriptType.Image ? icon2 : icon3" width="16" height="16" class="mr-4px" />
@ -109,6 +112,8 @@
import { ref, computed } from 'vue';
import { Button, Tooltip, Table, Image } from 'ant-design-vue';
const { Column } = Table;
import { ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
import { formatTableField, exactFormatTime } from '@/utils/tools';
import { EnumManuscriptType } from '@/views/writer-material-center/components/finished-products/manuscript/list/constants';
import { patchWorkAuditsAuditWriter } from '@/api/all/generationWorkshop-writer.ts';
@ -122,11 +127,12 @@ import { slsWithCatch } from '@/utils/stroage.ts';
import TextOverTips from '@/components/text-over-tips';
import HoverImagePreview from '@/components/hover-image-preview';
import ImgLazyLoad from "@/components/img-lazy-load";
import ImgLazyLoad from '@/components/img-lazy-load';
import icon1 from '@/assets/img/media-account/icon-delete.png';
import icon2 from '@/assets/img/creative-generation-workshop/icon-photo.png';
import icon3 from '@/assets/img/creative-generation-workshop/icon-video.png';
import { ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
// import icon4 from '@/assets/img/error-img.png';
const emits = defineEmits(['sorterChange', 'delete', 'select', 'selectAll']);

View File

@ -20,6 +20,11 @@ export const TABLE_COLUMNS1 = [
dataIndex: 'title',
width: 300,
},
{
title: '来源',
dataIndex: 'origin',
width: 120,
},
// {
// title: '客户意见',
// dataIndex: 'customer_opinion',

View File

@ -1,3 +1,4 @@
<script src="../../../../../../material-center/components/finished-products/manuscript/check-list/constants.ts"></script>
<script lang="jsx">
import axios from 'axios';
import { Button, Form, FormItem, Input, message, Upload } from 'ant-design-vue';
@ -309,7 +310,7 @@ export default {
placeholder="请输入标题"
size="large"
class="!w-500px"
maxlength={30}
maxlength={20}
showCount
/>
</FormItem>

View File

@ -26,23 +26,23 @@
@change="handleSearch"
/>
</div> -->
<div class="filter-row-item">
<span class="label">序号</span>
<Space size="medium">
<Input
v-model:value="query.uid"
class="!w-160px"
placeholder="请输入序号"
size="middle"
allowClear
@change="handleSearch"
>
<template #prefix>
<icon-search />
</template>
</Input>
</Space>
</div>
<!-- <div class="filter-row-item">-->
<!-- <span class="label">序号</span>-->
<!-- <Space size="medium">-->
<!-- <Input-->
<!-- v-model:value="query.uid"-->
<!-- class="!w-160px"-->
<!-- placeholder="请输入序号"-->
<!-- size="middle"-->
<!-- allowClear-->
<!-- @change="handleSearch"-->
<!-- >-->
<!-- <template #prefix>-->
<!-- <icon-search />-->
<!-- </template>-->
<!-- </Input>-->
<!-- </Space>-->
<!-- </div>-->
<div class="filter-row-item">
<span class="label">审核状态</span>
<CommonSelect

View File

@ -33,6 +33,11 @@ export const TABLE_COLUMNS = [
dataIndex: 'audit_status',
width: 180,
},
{
title: '来源',
dataIndex: 'origin',
width: 120,
},
{
title: '上传时间',
dataIndex: 'created_at',
@ -63,6 +68,6 @@ export const TABLE_COLUMNS = [
title: '操作',
dataIndex: 'operation',
width: 200,
fixed: 'right'
fixed: 'right',
},
];

View File

@ -39,6 +39,9 @@
<template v-else-if="column.dataIndex === 'title'" #customRender="{ record }">
<TextOverTips :context="record.title" :line="3" class="title" @click="onDetail(record)" />
</template>
<template v-else-if="column.dataIndex === 'origin'" #customRender="{ record }">
{{ ORIGIN_LIST.find((item) => item.value === record.origin)?.label ?? '-' }}
</template>
<template v-else-if="column.dataIndex === 'audit_status'" #customRender="{ record }">
<div
class="flex items-center w-fit h-28px px-8px rounded-2px"
@ -88,6 +91,7 @@ import { Button, Tooltip, Table, Image } from 'ant-design-vue';
const { Column } = Table;
import { formatTableField, exactFormatTime } from '@/utils/tools';
import { TABLE_COLUMNS } from './constants';
import { ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
import {
CHECK_STATUS,
EnumManuscriptType,
@ -95,11 +99,12 @@ import {
import TextOverTips from '@/components/text-over-tips';
import HoverImagePreview from '@/components/hover-image-preview';
import ImgLazyLoad from "@/components/img-lazy-load";
import ImgLazyLoad from '@/components/img-lazy-load';
import icon1 from '@/assets/img/media-account/icon-delete.png';
import icon2 from '@/assets/img/creative-generation-workshop/icon-photo.png';
import icon3 from '@/assets/img/creative-generation-workshop/icon-video.png';
import { ORIGIN_LIST } from '@/views/material-center/components/raw-material/constants';
// import icon4 from '@/assets/img/error-img.png';
const emits = defineEmits(['edit', 'sorterChange', 'delete']);

View File

@ -1,7 +1,7 @@
export const INITIAL_QUERY = {
title: '',
// project_ids: [],
uid: '',
// uid: '',
audit_status: '',
created_at: [],
sort_column: undefined,
@ -11,13 +11,13 @@ export const INITIAL_QUERY = {
export enum EnumCheckStatus {
All = '',
Wait = 1,
Checking = 2,
Checking = 2,
Passed = 3,
}
export enum EnumManuscriptType {
All = '',
Image = 0,
Video = 1,
Video = 1,
}
export const CHECK_STATUS = [