AddItems.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379
  1. <script lang="ts" setup>
  2. import { ref, watch, reactive, onMounted, h, computed } from 'vue';
  3. import { message } from 'ant-design-vue';
  4. import { PlusOutlined } from '@ant-design/icons-vue'; // 确保导入
  5. import VxeUI from 'vxe-table';
  6. import { useRequest } from 'alova/client';
  7. import { getDictionaryMethod, cpMedicinesMethod } from '@/request/api/dictionary.api';
  8. import { branchMethod } from '@/request/api/system.api';
  9. import { systemCpEditMethod, getAllSupplierMethod, getConditioningSchemeDetailMethod } from '@/request/api/care.api';
  10. import { UploadIFile } from '@/request/api/follow.api';
  11. import type { SystemItemModel } from '@/model/care.model';
  12. import RemoteSelect from '@/libs/v-select-page/RemoteSelect.vue';
  13. import SearchableSelect from '@/components/SearchableSelect.vue';
  14. import type { UploadFile } from 'ant-design-vue/es/upload/interface';
  15. import type { FormInstance } from 'ant-design-vue';
  16. import Derivation from '@/service/Derivation.vue';
  17. type SystemModel = Partial<SystemItemModel>;
  18. const props = defineProps<{ data: SystemModel }>();
  19. const formRef = ref<FormInstance>();
  20. const typeOptionsLoading = ref<boolean>(false);
  21. const typeOptions = ref<{ label: string; value: string }[]>([]);
  22. const supplierOptions = ref<{ label: string; value: string }[]>([]);
  23. const isRequired = ref<boolean>(true);
  24. const unitOptions = [
  25. { label: '袋', value: '袋' },
  26. { label: '包', value: '包' },
  27. { label: '贴', value: '贴' },
  28. { label: '次', value: '次' },
  29. ];
  30. const herbList = ref<any[]>([]);
  31. // function getHerb(value: string) {
  32. // console.log(value, 'value==>');
  33. // cpMedicinesMethod(1, 10, { keyword: value }).then((res) => {
  34. // herbList.value = res.data;
  35. // console.log(herbList.value, 'herbList==>');
  36. // });
  37. // }
  38. // 获取所有的机构
  39. const branch = ref<any[]>([]);
  40. const { loading: branchLoading } = useRequest(branchMethod).onSuccess(({ data }) => {
  41. const to = (data?: any[]): any[] => {
  42. return Array.isArray(data)
  43. ? data.map((item) => {
  44. return {
  45. ...item,
  46. value: item.id,
  47. key: item.id.toString(),
  48. children: to(item.children),
  49. };
  50. })
  51. : [];
  52. };
  53. branch.value = to(data);
  54. console.log(branch.value, '获取所有的机构');
  55. });
  56. const form = reactive<SystemItemModel>({
  57. institutionName: '',
  58. conditioningProgramType: '',
  59. conditioningProgramSupplierId: '',
  60. institutionId: '',
  61. cpDynamicPricingRule: [
  62. { min: 0, max: 0, priceType: 0, price: 0 },
  63. { min: 0, max: 0, priceType: 0, price: 0 },
  64. ],
  65. pricingType: '0',
  66. cpFixedPricingRule: {
  67. unitPrice: '',
  68. pricingUnit: '',
  69. convertDose: '',
  70. convertUnit: '',
  71. },
  72. cpPatientMatchRule: {
  73. sex: '', // 性别
  74. age: '', // 年龄
  75. diagnoseDiseaseNames: [], // 疾病
  76. diagnoseSyndromeNames: [], // 证型
  77. constitutionGroupNames: [], // 体质
  78. willillStateNames: [], // 欲病状态
  79. tabooCrowds: [], // 禁忌
  80. },
  81. cpMedicines: [{ name: '', dosage: '', id: '' }],
  82. isOffline: null,
  83. isDelivery: null,
  84. effect: '', // 功效
  85. photo: '', // 商品图片
  86. itemImgFirst: '', // 操作图片
  87. itemVideoFirst: '', // 操作视频
  88. attrFirst: '', // 特色
  89. attrSeventh: '', //使用注意
  90. attrSixth: '', // 疗程说明
  91. attrFifth: '', // 操作方法
  92. attrFourth: '', // 用法
  93. attrThird: '', // 制法
  94. status: '0', // 状态
  95. isForWrap: null, // 是否服务包项目
  96. isForInfer: null, // 是否调理方案项目
  97. });
  98. const checkedList = ref<string[]>(['1']); // 默认选中第一个
  99. const onlineArr = ref<string[]>([]);
  100. const deliverArr = ref<string[]>([]);
  101. const rules = {
  102. name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
  103. conditioningProgramType: [{ required: true, message: '请选择方案类型', trigger: 'change' }],
  104. // 移除 pricingType 验证,使用动态验证
  105. // 移除 conditioningProgramSupplierId 验证,使用动态验证
  106. institutionId: [{ required: true, message: '请选择机构名称', trigger: 'change' }],
  107. // 移除 isOffline 验证,使用动态验证
  108. // 移除 projectType 验证,使用自定义验证
  109. };
  110. const isShowOnline = ref<boolean>(false);
  111. const isShowDelivery = ref<boolean>(false);
  112. const supplierArr = ref<any[]>([]);
  113. // 获取所有的供应商
  114. async function getSupplier(params: any) {
  115. supplierOptions.value = [];
  116. const res = await getAllSupplierMethod(params);
  117. if (res && res.length > 0) {
  118. supplierArr.value = res;
  119. supplierOptions.value = res.map((item: any) => ({
  120. label: item.name,
  121. value: item.id,
  122. }));
  123. getisOffline(params.conditioningProgramSupplierId, params.isOffline, params.isDelivery, params.conditioningProgramTypes);
  124. }
  125. }
  126. function getisOffline(e: any, newOffline: any, newDelivery: any, newType: any) {
  127. let filterSupplierArr = supplierArr.value.filter((item: any) => item.id === e);
  128. if (filterSupplierArr.length > 0) {
  129. isShowOnline.value = filterSupplierArr.every((items: any) => {
  130. if (newType.length > 0) {
  131. if (items.offlineCPTypes?.includes(newType[0]) && items.onlineCPTypes?.includes(newType[0])) {
  132. return true;
  133. } else {
  134. if (items.offlineCPTypes?.includes(newType[0])) {
  135. form.isOffline = 'Y';
  136. return false;
  137. } else if (items.onlineCPTypes?.includes(newType[0])) {
  138. form.isOffline = 'N';
  139. return false;
  140. } else {
  141. form.isOffline = null;
  142. return false;
  143. }
  144. }
  145. } else {
  146. return false;
  147. }
  148. });
  149. if (isShowOnline.value) {
  150. if (newOffline) {
  151. onlineArr.value = [newOffline];
  152. if (onlineArr.value.length > 1) {
  153. onlineArr.value = [onlineArr.value[onlineArr.value.length - 1]];
  154. } else if (onlineArr.value.length === 0) {
  155. onlineArr.value = [];
  156. }
  157. // newOffline ==Y 线下项目 不需要配送
  158. if (newOffline === 'Y') {
  159. form.isDelivery = null;
  160. isShowDelivery.value = false;
  161. } else {
  162. isShowDelivery.value = true;
  163. }
  164. } else {
  165. isShowDelivery.value = false;
  166. }
  167. if (newDelivery) {
  168. deliverArr.value = [newDelivery];
  169. if (deliverArr.value.length > 1) {
  170. deliverArr.value = [deliverArr.value[deliverArr.value.length - 1]];
  171. } else if (deliverArr.value.length === 0) {
  172. deliverArr.value = [];
  173. }
  174. }
  175. }
  176. } else {
  177. isShowOnline.value = false;
  178. isShowDelivery.value = false;
  179. onlineArr.value = [];
  180. deliverArr.value = [];
  181. }
  182. }
  183. watch(
  184. [() => form.conditioningProgramType, () => form.institutionId, () => form.conditioningProgramSupplierId, () => form.isOffline, () => form.isDelivery],
  185. ([newType, newInstitutionId, newSupplierId, newOffline, newDelivery]) => {
  186. getSupplier({
  187. conditioningProgramTypes: newType ? [newType] : form.conditioningProgramType ? [form.conditioningProgramType] : [],
  188. collaborateDeptId: newInstitutionId ? newInstitutionId : form.institutionId ? form.institutionId : '',
  189. conditioningProgramSupplierId: newSupplierId ? newSupplierId : form.conditioningProgramSupplierId ? form.conditioningProgramSupplierId : '',
  190. isOffline: newOffline,
  191. isDelivery: newDelivery,
  192. });
  193. },
  194. { immediate: true }
  195. );
  196. function addHerb() {
  197. if (!form.cpMedicines) {
  198. form.cpMedicines = [];
  199. }
  200. form.cpMedicines.push({ name: '', dosage: '', id: '' });
  201. }
  202. function removeHerb(idx: number) {
  203. if (form.cpMedicines) {
  204. form.cpMedicines.splice(idx, 1);
  205. }
  206. }
  207. // 新增:处理自定义药材输入
  208. function handleCustomHerb(value: string, idx: number) {
  209. if (form.cpMedicines && form.cpMedicines[idx]) {
  210. form.cpMedicines[idx].name = value;
  211. form.cpMedicines[idx].id = value; // 自定义选项使用输入值作为ID
  212. }
  213. }
  214. function cancel() {
  215. VxeUI.modal.close(`add-items-modal`);
  216. }
  217. function doSubmit() {
  218. // 自定义验证:检查项目应用是否已选择
  219. if (!checkedList.value || checkedList.value.length === 0) {
  220. message.error('请选择项目应用');
  221. return;
  222. }
  223. form.isForWrap = checkedList.value.includes('1') ? 'Y' : null;
  224. form.isForInfer = checkedList.value.includes('2') ? 'Y' : null;
  225. // 服务包项目相关必填
  226. if (form.addType === 'itemsList' && checkedList.value.includes('1') || form.addType === 'system') {
  227. // 计价规则
  228. if (!form.pricingType) {
  229. message.error('请选择计价规则');
  230. return;
  231. }
  232. // 计价规则相关字段校验
  233. if (form.pricingType === '0') {
  234. const { unitPrice, pricingUnit, convertDose, convertUnit } = form.cpFixedPricingRule || {};
  235. const allFilled = unitPrice && pricingUnit && convertDose && convertUnit;
  236. if (!allFilled) {
  237. message.error('请将单价、计价单位、相当于、使用单位全部填写');
  238. return;
  239. }
  240. } else if (form.pricingType === '1') {
  241. const rule1 = form.cpDynamicPricingRule[0] || {};
  242. const rule2 = form.cpDynamicPricingRule[1] || {};
  243. const allFilled1 = rule1.min && typeof rule1.priceType !== 'undefined' && rule1.price;
  244. const allFilled2 = rule2.max && typeof rule2.priceType !== 'undefined' && rule2.price;
  245. if (!(allFilled1 && allFilled2)) {
  246. message.error('请将按穴位/经络/部位的所有计价字段全部填写');
  247. return;
  248. }
  249. }
  250. // 供应商
  251. if (!form.conditioningProgramSupplierId) {
  252. message.error('请选择供应商');
  253. return;
  254. }
  255. // 线下项目
  256. if (isShowOnline.value && !form.isOffline) {
  257. message.error('请选择是否为线下项目');
  258. return;
  259. }
  260. // 配送
  261. if (isShowDelivery.value && (!deliverArr.value || deliverArr.value.length === 0)) {
  262. message.error('请选择配送方式');
  263. return;
  264. }
  265. } else if (form.addType === 'itemsList') {
  266. // 计价规则非必填时,做全填/全空校验
  267. if (form.pricingType === '0') {
  268. const { unitPrice, pricingUnit, convertDose, convertUnit } = form.cpFixedPricingRule || {};
  269. const allFilled = unitPrice && pricingUnit && convertDose && convertUnit;
  270. const allEmpty = !unitPrice && !pricingUnit && !convertDose && !convertUnit;
  271. if (!(allFilled || allEmpty)) {
  272. message.error('单价、计价单位、相当于、使用单位要么全部填写,要么全部为空');
  273. return;
  274. }
  275. } else if (form.pricingType === '1') {
  276. const rule1 = form.cpDynamicPricingRule[0] || {};
  277. const rule2 = form.cpDynamicPricingRule[1] || {};
  278. const allFilled1 = rule1.min && typeof rule1.priceType !== 'undefined' && rule1.price;
  279. const allEmpty1 = !rule1.min && (typeof rule1.priceType === 'undefined' || rule1.priceType === '' || rule1.priceType === null) && !rule1.price;
  280. const allFilled2 = rule2.max && typeof rule2.priceType !== 'undefined' && rule2.price;
  281. const allEmpty2 = !rule2.max && (typeof rule2.priceType === 'undefined' || rule2.priceType === '' || rule2.priceType === null) && !rule2.price;
  282. if (!((allFilled1 && allFilled2) || (allEmpty1 && allEmpty2))) {
  283. message.error('按穴位/经络/部位的所有计价字段要么全部填写,要么全部为空');
  284. return;
  285. }
  286. }
  287. }
  288. // 调理方案项目相关必填
  289. if (form.addType === 'itemsList' && checkedList.value.includes('2')) {
  290. if (!hasDerivationLogic.value) {
  291. message.error('请设置推导逻辑');
  292. return;
  293. }
  294. }
  295. formRef.value
  296. ?.validate()
  297. .then(() => {
  298. form.photo = fileList.value[0]?.response?.url || fileList.value[0]?.url || '';
  299. form.itemImgFirst = optionsList.value[0]?.response?.url || optionsList.value[0]?.url || '';
  300. // form.itemVideoFirst = fileList.value[0]?.response?.url || fileList.value[0]?.url || '';
  301. // 合并推导逻辑数据到表单数据中
  302. if (hasDerivationLogic.value && derivationData.value.cpPatientMatchRule) {
  303. form.cpPatientMatchRule = { ...derivationData.value.cpPatientMatchRule };
  304. }
  305. // console.log('提交的最后数据', form);
  306. submit(form);
  307. })
  308. .catch((error) => {
  309. // console.error('Validation Error:', error);
  310. message.error('请完善必填项');
  311. });
  312. }
  313. // 获取方案类型
  314. async function getConditioningProgramType() {
  315. typeOptionsLoading.value = true;
  316. try {
  317. const res = await getDictionaryMethod('condition_type');
  318. if (res?.length > 0) {
  319. typeOptions.value = res; // 直接使用返回的数据
  320. }
  321. } catch (error) {
  322. // console.error('获取方案类型列表失败:', error);
  323. } finally {
  324. typeOptionsLoading.value = false;
  325. }
  326. }
  327. onMounted(async () => {
  328. // console.log(props.data, '获取传来的数据');
  329. // getHerb('');
  330. const deptId = localStorage.getItem('deptId');
  331. if (props.data.addType === 'system' && deptId) {
  332. form.institutionId = deptId;
  333. }
  334. if (props.data.addType === 'system') {
  335. isRequired.value = false;
  336. }
  337. form.addType = props.data.addType;
  338. if (props.data.id || props.data.sourceId) {
  339. const res: any = await getConditioningSchemeDetailMethod(props.data);
  340. // console.log(res, 'res==>');
  341. const checked: string[] = [];
  342. if (res.isForWrap === 'Y') checked.push('1');
  343. if (res.isForInfer === 'Y') checked.push('2');
  344. checkedList.value = checked.length > 0 ? checked : ['1', '2'];
  345. Object.assign(form, res);
  346. form.cpMedicines = (res.cpMedicines ?? []).map((item: any) => ({
  347. name: item.name || item.herbName || item.medicineName || '',
  348. dosage: item.dosage,
  349. id: item.id,
  350. }));
  351. // 处理推导逻辑数据回填
  352. if (res.cpPatientMatchRule) {
  353. derivationData.value = { cpPatientMatchRule: res.cpPatientMatchRule };
  354. hasDerivationLogic.value = true;
  355. }
  356. fileList.value = res.photo
  357. ? [
  358. {
  359. uid: '-1',
  360. name: 'image.png',
  361. status: 'done',
  362. url: res.photo,
  363. thumbUrl: res.photo,
  364. },
  365. ]
  366. : [];
  367. optionsList.value = res.itemImgFirst
  368. ? [
  369. {
  370. uid: '-1',
  371. name: 'image.png',
  372. status: 'done',
  373. url: res.itemImgFirst,
  374. thumbUrl: res.itemImgFirst,
  375. },
  376. ]
  377. : [];
  378. // 处理视频数据
  379. if (res.itemVideoFirst) {
  380. videoFileList.value = [
  381. {
  382. uid: '-1',
  383. name: '操作视频',
  384. status: 'done',
  385. url: res.itemVideoFirst,
  386. response: { url: res.itemVideoFirst },
  387. },
  388. ];
  389. }
  390. // console.log(props.data, 'form==>');
  391. if (props.data.addType === 'itemsList' && props.data.sourceId) {
  392. form.sourceId = form.id;
  393. form.institutionId = '';
  394. delete form.id;
  395. }
  396. }
  397. // 获取供应商
  398. // getSupplier({});
  399. // 获取方案类型
  400. getConditioningProgramType();
  401. // console.log(form, 'form==>');
  402. });
  403. const emits = defineEmits<{
  404. submit: [data?: SystemItemModel];
  405. addSubmit: [data?: SystemItemModel];
  406. }>();
  407. const { loading: submitting, send: submit } = useRequest(systemCpEditMethod, {
  408. immediate: false,
  409. }).onSuccess(({ data }) => {
  410. emits('submit');
  411. });
  412. const visible = ref<boolean>(false);
  413. const setVisible = (value: boolean): void => {
  414. visible.value = value;
  415. };
  416. const previewImg = ref<string>('');
  417. const uploadProps = reactive({ showRemoveIcon: true });
  418. // 商品图片
  419. const fileList = ref<UploadFile[]>([]);
  420. // 操作图片
  421. const optionsList = ref<UploadFile[]>([]);
  422. // 预览图片
  423. const handlePreview = async (file: UploadFile) => {
  424. previewImg.value = file.response?.url ?? file.thumbUrl;
  425. visible.value = true;
  426. };
  427. function customUpload(e: any) {
  428. // uploadApi 你的二次封装上传接口
  429. UploadIFile(e.file)
  430. .then((res) => {
  431. // 调用实例的成功方法通知组件该文件上传成功
  432. e.onSuccess(res, e);
  433. })
  434. .catch((err) => {
  435. // 调用实例的失败方法通知组件该文件上传失败
  436. e.onError(err);
  437. });
  438. }
  439. // 视频上传相关
  440. const accept = 'video/mp4,video/avi,video/mov,video/webm';
  441. const maxSize = 100 * 1024 * 1024; // 100MB
  442. const videoUrl = ref('');
  443. const uploading = ref(false);
  444. const progress = ref(0);
  445. const videoFileList = ref<UploadFile[]>([]);
  446. // 上传前校验
  447. function beforeVideoUpload(file: File) {
  448. const isValidType = accept.split(',').includes(file.type);
  449. if (!isValidType) {
  450. message.error('仅支持mp4、avi、mov、webm格式视频');
  451. return false;
  452. }
  453. const isValidSize = file.size <= maxSize;
  454. if (!isValidSize) {
  455. message.error('视频大小不能超过100MB');
  456. return false;
  457. }
  458. return true;
  459. }
  460. // 视频预览
  461. function handleVideoPreview(file: UploadFile) {
  462. const videoUrl = file.response?.url || file.url || form.itemVideoFirst;
  463. if (videoUrl) {
  464. // 创建一个模态框来预览视频
  465. VxeUI.modal.open({
  466. title: '视频预览',
  467. width: 800,
  468. height: 600,
  469. escClosable: true,
  470. destroyOnClose: true,
  471. slots: {
  472. default() {
  473. return h(
  474. 'div',
  475. {
  476. style: {
  477. display: 'flex',
  478. justifyContent: 'center',
  479. alignItems: 'center',
  480. height: '100%',
  481. },
  482. },
  483. [
  484. h('video', {
  485. src: videoUrl,
  486. controls: true,
  487. style: {
  488. maxWidth: '100%',
  489. maxHeight: '100%',
  490. borderRadius: '8px',
  491. },
  492. }),
  493. ]
  494. );
  495. },
  496. },
  497. });
  498. }
  499. }
  500. // 删除视频
  501. function removeVideo() {
  502. form.itemVideoFirst = '';
  503. videoFileList.value = [];
  504. message.success('视频已删除');
  505. }
  506. // 自定义上传
  507. function customVideoRequest(e: any) {
  508. const { file, onSuccess, onError, onProgress } = e;
  509. // 验证文件
  510. if (!beforeVideoUpload(file)) {
  511. onError(new Error('文件验证失败'));
  512. return;
  513. }
  514. uploading.value = true;
  515. progress.value = 0;
  516. // 模拟上传进度
  517. const progressInterval = setInterval(() => {
  518. if (progress.value < 90) {
  519. progress.value += Math.random() * 10;
  520. onProgress({ percent: progress.value });
  521. }
  522. }, 200);
  523. // 上传文件
  524. UploadIFile(file)
  525. .then((res: any) => {
  526. clearInterval(progressInterval);
  527. progress.value = 100;
  528. onProgress({ percent: 100 });
  529. // 设置视频URL
  530. form.itemVideoFirst = res?.url || res?.data?.url;
  531. // 更新文件列表
  532. videoFileList.value = [
  533. {
  534. uid: file.uid,
  535. name: file.name,
  536. status: 'done',
  537. url: form.itemVideoFirst,
  538. response: res,
  539. },
  540. ];
  541. onSuccess(res, e);
  542. uploading.value = false;
  543. message.success('视频上传成功');
  544. console.log('上传视频成功', form.itemVideoFirst);
  545. })
  546. .catch((err) => {
  547. clearInterval(progressInterval);
  548. uploading.value = false;
  549. progress.value = 0;
  550. onError(err);
  551. message.error('视频上传失败,请重试');
  552. console.error('视频上传失败:', err);
  553. });
  554. }
  555. // 视频上传状态变化
  556. function handleVideoChange(info: any) {
  557. const { file, fileList } = info;
  558. if (file.status === 'uploading') {
  559. uploading.value = true;
  560. } else if (file.status === 'done') {
  561. uploading.value = false;
  562. videoFileList.value = fileList;
  563. } else if (file.status === 'error') {
  564. uploading.value = false;
  565. message.error('视频上传失败');
  566. }
  567. }
  568. watch(
  569. () => form.pricingType,
  570. (val) => {
  571. if (val === '0' && !form.cpFixedPricingRule) {
  572. form.cpFixedPricingRule = {
  573. unitPrice: 0,
  574. pricingUnit: '',
  575. convertDose: 0,
  576. convertUnit: '',
  577. };
  578. } else {
  579. form.cpFixedPricingRule = null;
  580. }
  581. }
  582. );
  583. function bindchange(e: any) {
  584. form.conditioningProgramSupplierId = '';
  585. form.isOffline = null;
  586. }
  587. function onlineChange(value: any) {
  588. form.isOffline = value[value.length - 1];
  589. deliverArr.value = [];
  590. form.isDelivery = null;
  591. }
  592. function deliveryChange(value: any) {
  593. form.isDelivery = value[value.length - 1];
  594. }
  595. function getConditioningProgramSupplier(value: any) {
  596. onlineArr.value = [];
  597. deliverArr.value = [];
  598. form.isOffline = null;
  599. form.isDelivery = null;
  600. isShowDelivery.value = false;
  601. }
  602. // 修正参数以适配 a-tree-select 的 @select 事件
  603. function handleSelect(value: any, node: any) {
  604. form.institutionId = value;
  605. if (node && node.label) {
  606. form.institutionName = node.label;
  607. } else if (node && node.title) {
  608. form.institutionName = node.title;
  609. }
  610. }
  611. // 项目应用数据
  612. const plainOptions = [
  613. { id: '1', name: '服务包项目' },
  614. { id: '2', name: '调理方案项目' },
  615. ];
  616. // 推导逻辑
  617. const hasDerivationLogic = ref(false); // 添加推导逻辑状态跟踪
  618. const derivationData = ref<any>({});
  619. // 新增:判断推导逻辑内容是否为空
  620. const isDerivationEmpty = computed(() => {
  621. const rule = derivationData.value.cpPatientMatchRule;
  622. if (!rule) return true;
  623. // 检查所有字段都为空或未填写
  624. const fields = ['sex', 'age', 'diagnoseDiseaseNames', 'diagnoseSyndromeNames', 'constitutionGroupNames', 'willillStateNames', 'tabooCrowds'];
  625. return fields.every((key) => {
  626. const val = rule[key];
  627. if (Array.isArray(val)) return val.length === 0;
  628. return !val;
  629. });
  630. });
  631. function handleDerivation() {
  632. VxeUI.modal.open({
  633. title: `推导逻辑`,
  634. height: 750,
  635. width: 750,
  636. escClosable: true,
  637. destroyOnClose: true,
  638. id: `derivation-modal`,
  639. remember: true,
  640. storage: true,
  641. slots: {
  642. default() {
  643. return h(Derivation, {
  644. data: {
  645. ...props.data,
  646. // 传递当前的推导逻辑数据
  647. cpPatientMatchRule: derivationData.value.cpPatientMatchRule || form.cpPatientMatchRule,
  648. checkedList: checkedList.value,
  649. },
  650. onSubmit: (data: any) => {
  651. console.log('推导逻辑传来的数据', data);
  652. derivationData.value = data;
  653. hasDerivationLogic.value = true; // 设置推导逻辑已编辑
  654. },
  655. });
  656. },
  657. },
  658. });
  659. }
  660. </script>
  661. <template>
  662. <div class="form-container">
  663. <a-form ref="formRef" :model="form" :rules="rules" layout="horizontal">
  664. <a-form-item label="项目名称:" name="name" required>
  665. <a-input v-model:value="form.name" placeholder="请输入" />
  666. </a-form-item>
  667. <a-form-item label="方案类型:" name="conditioningProgramType" required>
  668. <a-select
  669. v-model:value="form.conditioningProgramType"
  670. :options="typeOptions"
  671. placeholder="请选择"
  672. allowClear
  673. :loading="typeOptionsLoading"
  674. :disabled="typeOptions.length === 0"
  675. @change="bindchange"
  676. />
  677. </a-form-item>
  678. <a-form-item label="项目应用:" required v-if="form.addType === 'itemsList'">
  679. <a-checkbox-group v-model:value="checkedList">
  680. <a-checkbox v-for="option in plainOptions" :key="option.id" :value="option.id">
  681. {{ option.name }}
  682. </a-checkbox>
  683. </a-checkbox-group>
  684. </a-form-item>
  685. <a-form-item label="计价规则:" name="pricingType" :required="checkedList.includes('1')">
  686. <a-radio-group v-model:value="form.pricingType">
  687. <a-radio value="0">一口价</a-radio>
  688. <a-radio value="1">按穴位/经络/部位</a-radio>
  689. </a-radio-group>
  690. </a-form-item>
  691. <div class="price-row" v-if="form.pricingType === '0' && form.cpFixedPricingRule">
  692. <span class="label">单价:</span>
  693. <a-input v-model:value="form.cpFixedPricingRule.unitPrice" placeholder="请输入" style="width: 100px" />
  694. <span style="margin: 0 8px">元</span>
  695. <span class="label" style="margin-left: 32px">计价单位:</span>
  696. <a-input v-model:value="form.cpFixedPricingRule.pricingUnit" placeholder="请输入" style="width: 100px" />
  697. <span style="margin-left: 32px">相当于</span>
  698. <a-input v-model:value="form.cpFixedPricingRule.convertDose" placeholder="请输入" style="width: 100px; margin-left: 8px" />
  699. <a-select v-model:value="form.cpFixedPricingRule.convertUnit" style="width: 100px; margin-left: 8px" :options="unitOptions" placeholder="请选择" />
  700. <span style="color: #aaa; margin-left: 8px">(使用单位)</span>
  701. </div>
  702. <div v-if="form.pricingType === '1'" class="per-rule">
  703. <div class="price-row">
  704. <span>计价1:</span>
  705. <span class="flex items-center"
  706. >当"穴位/经络/部位" ≤
  707. <a-input
  708. placeholder="请输入"
  709. class="w-20 ml-2 mr-2"
  710. v-model:value="form.cpDynamicPricingRule[0].min"
  711. @change="() => (form.cpDynamicPricingRule[1].max = form.cpDynamicPricingRule[0].min)"
  712. />个时,</span
  713. >
  714. <a-select
  715. v-model:value="form.cpDynamicPricingRule[0].priceType"
  716. :options="[
  717. { label: '单价', value: 0, priceType: 0 },
  718. { label: '一口价', value: 1, priceType: 1 },
  719. ]"
  720. style="width: 100px; margin: 0 4px"
  721. placeholder="请选择"
  722. />
  723. <span>=</span>
  724. <a-input v-model:value="form.cpDynamicPricingRule[0].price" style="width: 80px; margin: 0 4px" placeholder="请输入" />
  725. <span>元</span>
  726. </div>
  727. <div class="price-row">
  728. <span>计价2:</span>
  729. <span class="flex items-center"
  730. >当"穴位/经络/部位" &gt; <a-input placeholder="请输入" class="w-20 ml-2 mr-2" v-model:value="form.cpDynamicPricingRule[1].max" disabled />个时,</span
  731. >
  732. <a-select
  733. v-model:value="form.cpDynamicPricingRule[1].priceType"
  734. :options="[
  735. { label: '单价', value: 0, priceType: 0 },
  736. { label: '一口价', value: 1, priceType: 1 },
  737. ]"
  738. style="width: 100px; margin: 0 4px"
  739. placeholder="请选择"
  740. />
  741. <span>=</span>
  742. <a-input v-model:value="form.cpDynamicPricingRule[1].price" style="width: 80px; margin: 0 4px" placeholder="请输入" />
  743. <span>元</span>
  744. </div>
  745. </div>
  746. <a-form-item label="组成:">
  747. <div class="herb-list">
  748. <template v-for="(herb, idx) in form.cpMedicines" :key="herb.id">
  749. <div class="herb-item">
  750. <button class="herb-remove" v-if="form?.cpMedicines?.length > 1" @click="removeHerb(idx)" type="button">×</button>
  751. <!-- <RemoteSelect :load="cpMedicinesMethod" key-prop="name" v-model:value="herb.name" /> -->
  752. <SearchableSelect
  753. v-model="herb.name"
  754. :options="herbList"
  755. placeholder="请选择"
  756. value-key="name"
  757. label-key="name"
  758. key-key="id"
  759. :fetch-options="cpMedicinesMethod"
  760. style="width: 150px"
  761. :allow-custom-input="true"
  762. />
  763. <a-input v-model:value="herb.dosage" class="herb-dosage" placeholder="剂量" />
  764. <span>g</span>
  765. </div>
  766. </template>
  767. <button style="margin-left: 8px" @click="addHerb" type="button">+</button>
  768. </div>
  769. </a-form-item>
  770. <a-form-item label="特色:" v-if="form.addType === 'itemsList'">
  771. <textarea
  772. v-model="form.attrFirst"
  773. placeholder="请输入"
  774. rows="3"
  775. style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px; resize: vertical; font-family: inherit"
  776. />
  777. </a-form-item>
  778. <a-form-item label="功效:">
  779. <a-input v-model:value="form.effect" placeholder="请输入" />
  780. </a-form-item>
  781. <a-form-item label="制法:" v-if="form.addType === 'itemsList'">
  782. <a-input v-model:value="form.attrThird" placeholder="请输入" />
  783. </a-form-item>
  784. <a-form-item label="用法:" v-if="form.addType === 'itemsList'">
  785. <a-input v-model:value="form.attrFourth" placeholder="请输入" />
  786. </a-form-item>
  787. <a-form-item label="操作方法:" v-if="form.addType === 'itemsList'">
  788. <textarea
  789. v-model="form.attrFifth"
  790. placeholder="请输入"
  791. rows="3"
  792. style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px; resize: vertical; font-family: inherit"
  793. />
  794. </a-form-item>
  795. <div class="image-row">
  796. <a-form-item label="操作图片:" class="image-form-item" v-if="form.addType === 'itemsList'">
  797. <a-upload :showUploadList="uploadProps" v-model:file-list="optionsList" list-type="picture-card" @preview="handlePreview" :maxCount="1" :customRequest="customUpload">
  798. <div v-if="optionsList.length < 1">
  799. <PlusOutlined />
  800. <div style="margin-top: 8px">上传</div>
  801. </div>
  802. </a-upload>
  803. </a-form-item>
  804. <a-form-item label="商品图片:" class="image-form-item">
  805. <a-upload :showUploadList="uploadProps" v-model:file-list="fileList" list-type="picture-card" @preview="handlePreview" :maxCount="1" :customRequest="customUpload">
  806. <div v-if="fileList.length < 1">
  807. <PlusOutlined />
  808. <div style="margin-top: 8px">上传</div>
  809. </div>
  810. </a-upload>
  811. </a-form-item>
  812. </div>
  813. <a-form-item label="操作视频:" class="image-form-item" v-if="form.addType === 'itemsList'">
  814. <div class="video-upload-wrapper">
  815. <div class="video-upload-container">
  816. <a-upload
  817. :showUploadList="false"
  818. :custom-request="customVideoRequest"
  819. :max-count="1"
  820. :multiple="false"
  821. :before-upload="beforeVideoUpload"
  822. @change="handleVideoChange"
  823. :file-list="videoFileList"
  824. accept="video/mp4,video/avi,video/mov,video/webm"
  825. >
  826. <div v-if="!form.itemVideoFirst && !uploading" class="video-upload-btn">
  827. <PlusOutlined />
  828. <div style="margin-top: 8px">上传视频</div>
  829. <div class="video-upload-tip">mp4/avi/mov/webm<br />最大100MB</div>
  830. </div>
  831. <!-- 上传中状态 -->
  832. <div v-else-if="uploading" class="video-uploading">
  833. <div class="upload-progress">
  834. <a-progress :percent="progress" :show-info="false" size="small" stroke-color="#1890ff" />
  835. <div class="upload-text">上传中... {{ Math.round(progress) }}%</div>
  836. </div>
  837. </div>
  838. <!-- 视频预览 -->
  839. <div v-else class="video-preview-container">
  840. <div class="video-thumbnail">
  841. <video :src="form.itemVideoFirst" preload="metadata" class="video-preview" />
  842. <div class="video-overlay">
  843. <a-button
  844. type="primary"
  845. size="small"
  846. @click.stop="
  847. handleVideoPreview({
  848. uid: 'video-preview',
  849. name: '操作视频',
  850. url: form.itemVideoFirst,
  851. })
  852. "
  853. >
  854. 预览
  855. </a-button>
  856. <a-button danger size="small" @click.stop="removeVideo"> 删除 </a-button>
  857. </div>
  858. </div>
  859. <!-- <div class="video-info">
  860. <div class="video-name">操作视频</div>
  861. <div class="video-size">已上传</div>
  862. </div> -->
  863. </div>
  864. </a-upload>
  865. </div>
  866. </div>
  867. </a-form-item>
  868. <a-form-item label="疗程说明:" v-if="form.addType === 'itemsList'">
  869. <textarea
  870. v-model="form.attrSixth"
  871. placeholder="请输入"
  872. rows="3"
  873. style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px; resize: vertical; font-family: inherit"
  874. />
  875. </a-form-item>
  876. <a-form-item label="使用注意:" v-if="form.addType === 'itemsList'">
  877. <textarea
  878. v-model="form.attrSeventh"
  879. placeholder="请输入"
  880. rows="3"
  881. style="width: 100%; padding: 8px; border: 1px solid #d9d9d9; border-radius: 4px; resize: vertical; font-family: inherit"
  882. />
  883. </a-form-item>
  884. <a-form-item label="推导逻辑:" v-if="form.addType === 'itemsList'" :required="checkedList.includes('2')">
  885. <button @click="handleDerivation" v-if="!hasDerivationLogic || isDerivationEmpty">编辑</button>
  886. <div v-else @click="handleDerivation" style="cursor: pointer">
  887. <div v-if="derivationData.cpPatientMatchRule" class="derivation-container">
  888. <div v-if="derivationData.cpPatientMatchRule.sex" class="derivation-item">
  889. <span class="derivation-label">性别限制:</span>
  890. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.sex }}</span>
  891. </div>
  892. <div v-if="derivationData.cpPatientMatchRule.age" class="derivation-item">
  893. <span class="derivation-label">年龄限制:</span>
  894. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.age }}</span>
  895. </div>
  896. <div v-if="derivationData.cpPatientMatchRule.diagnoseDiseaseNames && derivationData.cpPatientMatchRule.diagnoseDiseaseNames.length > 0" class="derivation-item">
  897. <span class="derivation-label">专病:</span>
  898. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.diagnoseDiseaseNames.join('、') }}</span>
  899. </div>
  900. <div v-if="derivationData.cpPatientMatchRule.diagnoseSyndromeNames && derivationData.cpPatientMatchRule.diagnoseSyndromeNames.length > 0" class="derivation-item">
  901. <span class="derivation-label">证型:</span>
  902. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.diagnoseSyndromeNames.join('、') }}</span>
  903. </div>
  904. <div v-if="derivationData.cpPatientMatchRule.constitutionGroupNames && derivationData.cpPatientMatchRule.constitutionGroupNames.length > 0" class="derivation-item">
  905. <span class="derivation-label">体质:</span>
  906. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.constitutionGroupNames.join('、') }}</span>
  907. </div>
  908. <div v-if="derivationData.cpPatientMatchRule.willillStateNames && derivationData.cpPatientMatchRule.willillStateNames.length > 0" class="derivation-item">
  909. <span class="derivation-label">欲病状态:</span>
  910. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.willillStateNames.join('、') }}</span>
  911. </div>
  912. <div v-if="derivationData.cpPatientMatchRule.tabooCrowds && derivationData.cpPatientMatchRule.tabooCrowds.length > 0" class="derivation-item">
  913. <span class="derivation-label">禁忌人群:</span>
  914. <span class="derivation-content">{{ derivationData.cpPatientMatchRule.tabooCrowds.join('、') }}</span>
  915. </div>
  916. </div>
  917. </div>
  918. </a-form-item>
  919. <!-- 机构名称 -->
  920. <a-form-item label="机构名称:" v-if="form?.addType === 'itemsList'" required name="institutionId">
  921. <a-tree-select
  922. v-model:value="form.institutionId"
  923. style="width: 100%"
  924. :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
  925. placeholder="请选择"
  926. allow-clear
  927. tree-default-expand-all
  928. :tree-data="branch"
  929. @select="handleSelect"
  930. ></a-tree-select>
  931. </a-form-item>
  932. <a-form-item label="供应商:" name="conditioningProgramSupplierId" :required="checkedList.includes('1')">
  933. <a-select v-model:value="form.conditioningProgramSupplierId" :options="supplierOptions" placeholder="请选择" allowClear @change="getConditioningProgramSupplier" />
  934. </a-form-item>
  935. <a-form-item label="线下项目:" name="isOffline" v-if="isShowOnline" :required="checkedList.includes('1')">
  936. <a-checkbox-group v-model:value="onlineArr" @change="onlineChange">
  937. <a-checkbox value="Y">是</a-checkbox>
  938. <a-checkbox value="N">否</a-checkbox>
  939. </a-checkbox-group>
  940. </a-form-item>
  941. <a-form-item label="配送:" name="isDelivery" v-if="isShowDelivery" :required="checkedList.includes('1')">
  942. <a-checkbox-group v-model:value="deliverArr" @change="deliveryChange">
  943. <a-checkbox value="Y">支持</a-checkbox>
  944. <a-checkbox value="N">不支持</a-checkbox>
  945. </a-checkbox-group>
  946. </a-form-item>
  947. <a-form-item label="启用状态:" name="status" v-if="form.addType === 'itemsList'" required>
  948. <a-radio-group v-model:value="form.status">
  949. <a-radio value="0">启用</a-radio>
  950. <a-radio value="1">停用</a-radio>
  951. </a-radio-group>
  952. </a-form-item>
  953. <a-image
  954. :width="200"
  955. :style="{ display: 'none' }"
  956. :preview="{
  957. visible,
  958. onVisibleChange: setVisible,
  959. }"
  960. :src="previewImg"
  961. />
  962. <video :src="videoUrl" controls v-if="videoUrl" style="width: 100%; max-width: 500px; border-radius: 6px" preload="metadata" />
  963. <div class="form-actions-center">
  964. <a-button @click="cancel">取消</a-button>
  965. <a-button type="primary" style="background: #faad14; border: none" @click="doSubmit">确定</a-button>
  966. </div>
  967. </a-form>
  968. </div>
  969. </template>
  970. <style scoped>
  971. .form-container {
  972. width: 760px;
  973. margin: 0 auto;
  974. padding: 10px 0px 0 0;
  975. }
  976. .per-rule {
  977. margin-bottom: 16px;
  978. }
  979. .price-row {
  980. display: flex;
  981. align-items: center;
  982. margin-bottom: 10px;
  983. }
  984. .label {
  985. font-weight: 500;
  986. color: #222;
  987. margin-right: 8px;
  988. }
  989. .herb-list {
  990. display: flex;
  991. align-items: center;
  992. flex-wrap: wrap;
  993. }
  994. .herb-item {
  995. position: relative;
  996. display: flex;
  997. align-items: center;
  998. margin-right: 8px;
  999. margin-bottom: 8px;
  1000. padding-left: 16px;
  1001. }
  1002. .herb-dosage {
  1003. width: 70px;
  1004. /* padding: 2px 6px; */
  1005. font-size: 14px;
  1006. margin-right: 10px;
  1007. }
  1008. .herb-remove {
  1009. position: absolute;
  1010. left: 0;
  1011. top: 0;
  1012. background: #fff;
  1013. border: none;
  1014. color: #ff4d4f;
  1015. font-size: 14px;
  1016. cursor: pointer;
  1017. line-height: 1;
  1018. width: 16px;
  1019. height: 16px;
  1020. padding: 0;
  1021. display: flex;
  1022. align-items: center;
  1023. justify-content: center;
  1024. }
  1025. .form-actions-center {
  1026. display: flex;
  1027. justify-content: center;
  1028. gap: 16px;
  1029. /* margin-top: 32px; */
  1030. }
  1031. .slider-section {
  1032. margin-bottom: 16px;
  1033. }
  1034. .slider-labels {
  1035. display: flex;
  1036. justify-content: space-between;
  1037. width: 200px;
  1038. margin-left: 230px;
  1039. margin-bottom: 4px;
  1040. font-weight: 500;
  1041. color: #222;
  1042. }
  1043. .slider-row {
  1044. display: flex;
  1045. align-items: center;
  1046. }
  1047. .slider-desc {
  1048. color: #222;
  1049. white-space: nowrap;
  1050. display: flex;
  1051. flex-direction: column;
  1052. align-items: center;
  1053. justify-content: center;
  1054. }
  1055. .slider-value {
  1056. margin-left: 16px;
  1057. color: #faad14;
  1058. font-weight: bold;
  1059. }
  1060. .upload-btn {
  1061. display: flex;
  1062. flex-direction: column;
  1063. align-items: center;
  1064. justify-content: center;
  1065. min-height: 100px;
  1066. border: 1px dashed #d9d9d9;
  1067. border-radius: 6px;
  1068. background: #fafafa;
  1069. cursor: pointer;
  1070. transition: border-color 0.3s;
  1071. width: 100px;
  1072. }
  1073. .upload-btn:hover {
  1074. border-color: #1890ff;
  1075. background: #f0f7ff;
  1076. }
  1077. .upload-btn .anticon {
  1078. font-size: 16px;
  1079. color: #1890ff;
  1080. }
  1081. .upload-btn .upload-text {
  1082. margin-top: 8px;
  1083. color: #666;
  1084. font-size: 15px;
  1085. }
  1086. .video-preview {
  1087. border-radius: 6px;
  1088. /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); */
  1089. background: #000;
  1090. width: 120px !important;
  1091. height: 100px !important;
  1092. /* outline: none; */
  1093. }
  1094. .video-preview video {
  1095. border-radius: 6px;
  1096. /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); */
  1097. background: #000;
  1098. width: 120px;
  1099. height: 100px;
  1100. /* outline: none; */
  1101. }
  1102. .video-preview .ant-btn-link {
  1103. padding: 0;
  1104. font-size: 14px;
  1105. color: #ff4d4f;
  1106. }
  1107. .image-row {
  1108. display: flex;
  1109. gap: 32px;
  1110. align-items: flex-start;
  1111. margin-bottom: 16px;
  1112. }
  1113. .image-form-item {
  1114. flex: 1;
  1115. margin-bottom: 0 !important;
  1116. }
  1117. .image-form-item .ant-upload-picture-card-wrapper {
  1118. display: flex;
  1119. flex-direction: column;
  1120. align-items: flex-start;
  1121. }
  1122. .derivation-item {
  1123. display: flex;
  1124. align-items: center;
  1125. min-width: 200px;
  1126. max-width: 300px;
  1127. padding: 6px 12px;
  1128. background: #f5f5f5;
  1129. border-radius: 4px;
  1130. border: 1px solid #e8e8e8;
  1131. }
  1132. .derivation-label {
  1133. font-weight: 500;
  1134. color: #222;
  1135. margin-right: 8px;
  1136. white-space: nowrap;
  1137. font-size: 13px;
  1138. }
  1139. .derivation-content {
  1140. color: #555;
  1141. font-size: 13px;
  1142. flex: 1;
  1143. word-break: break-all;
  1144. }
  1145. .derivation-container {
  1146. display: flex;
  1147. flex-wrap: wrap;
  1148. gap: 16px;
  1149. align-items: flex-start;
  1150. }
  1151. .video-upload-wrapper {
  1152. display: flex;
  1153. align-items: flex-start;
  1154. }
  1155. .video-upload-container {
  1156. position: relative;
  1157. width: 130px;
  1158. height: 130px;
  1159. display: flex;
  1160. align-items: center;
  1161. justify-content: center;
  1162. border: 2px dashed #d9d9d9;
  1163. border-radius: 8px;
  1164. background: #fafafa;
  1165. cursor: pointer;
  1166. transition: all 0.3s ease;
  1167. overflow: hidden;
  1168. margin-bottom: 20px;
  1169. }
  1170. .video-upload-container:hover {
  1171. border-color: #1890ff;
  1172. background: #f0f7ff;
  1173. transform: translateY(-1px);
  1174. box-shadow: 0 2px 8px rgba(24, 144, 255, 0.1);
  1175. }
  1176. .video-upload-btn {
  1177. display: flex;
  1178. flex-direction: column;
  1179. align-items: center;
  1180. justify-content: center;
  1181. padding: 16px 12px;
  1182. text-align: center;
  1183. }
  1184. .video-upload-btn .anticon {
  1185. font-size: 20px;
  1186. color: #1890ff;
  1187. margin-bottom: 6px;
  1188. }
  1189. .video-upload-tip {
  1190. font-size: 11px;
  1191. color: #999;
  1192. margin-top: 6px;
  1193. line-height: 1.3;
  1194. }
  1195. .video-uploading {
  1196. position: absolute;
  1197. top: 0;
  1198. left: 0;
  1199. width: 100%;
  1200. height: 100%;
  1201. background: rgba(255, 255, 255, 0.95);
  1202. display: flex;
  1203. flex-direction: column;
  1204. align-items: center;
  1205. justify-content: center;
  1206. z-index: 10;
  1207. backdrop-filter: blur(2px);
  1208. }
  1209. .upload-progress {
  1210. display: flex;
  1211. flex-direction: column;
  1212. align-items: center;
  1213. gap: 8px;
  1214. width: 90%;
  1215. max-width: 160px;
  1216. }
  1217. .upload-text {
  1218. font-size: 12px;
  1219. color: #1890ff;
  1220. font-weight: 500;
  1221. text-align: center;
  1222. }
  1223. .video-preview-container {
  1224. display: flex;
  1225. flex-direction: column;
  1226. align-items: center;
  1227. justify-content: center;
  1228. width: 100%;
  1229. height: 100%;
  1230. padding: 10px;
  1231. background: #fafafa;
  1232. border-radius: 8px;
  1233. }
  1234. .video-thumbnail {
  1235. position: relative;
  1236. width: 100%;
  1237. height: 100px;
  1238. border-radius: 6px;
  1239. overflow: hidden;
  1240. background: #000;
  1241. display: flex;
  1242. align-items: center;
  1243. justify-content: center;
  1244. margin-bottom: 8px;
  1245. }
  1246. .video-thumbnail .video-preview {
  1247. width: 100%;
  1248. height: 100%;
  1249. object-fit: cover;
  1250. }
  1251. .video-overlay {
  1252. position: absolute;
  1253. top: 0;
  1254. left: 0;
  1255. width: 100%;
  1256. height: 100%;
  1257. background: rgba(0, 0, 0, 0.7);
  1258. border-radius: 6px;
  1259. display: flex;
  1260. align-items: center;
  1261. justify-content: center;
  1262. gap: 8px;
  1263. opacity: 0;
  1264. transition: opacity 0.3s ease;
  1265. }
  1266. .video-preview-container:hover .video-overlay {
  1267. opacity: 1;
  1268. }
  1269. .video-overlay .ant-btn {
  1270. background: rgba(255, 255, 255, 0.95);
  1271. border: none;
  1272. color: #333;
  1273. font-size: 11px;
  1274. padding: 3px 8px;
  1275. border-radius: 4px;
  1276. transition: all 0.3s ease;
  1277. min-width: 40px;
  1278. height: 28px;
  1279. line-height: 1.2;
  1280. display: flex;
  1281. align-items: center;
  1282. justify-content: center;
  1283. white-space: nowrap;
  1284. }
  1285. .video-overlay .ant-btn:hover {
  1286. background: rgba(255, 255, 255, 1);
  1287. transform: scale(1.05);
  1288. }
  1289. .video-overlay .ant-btn-danger {
  1290. background: rgba(255, 77, 79, 0.95);
  1291. color: #fff;
  1292. }
  1293. .video-overlay .ant-btn-danger:hover {
  1294. background: rgba(255, 77, 79, 1);
  1295. }
  1296. .video-info {
  1297. text-align: center;
  1298. font-size: 11px;
  1299. color: #666;
  1300. }
  1301. .video-name {
  1302. font-weight: 500;
  1303. color: #333;
  1304. margin-bottom: 2px;
  1305. }
  1306. .video-size {
  1307. color: #999;
  1308. font-size: 10px;
  1309. }
  1310. </style>