AddItems.vue 45 KB

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