index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896
  1. <template>
  2. <div class="user">
  3. <div class="tree">
  4. <treeList
  5. title="产品分类"
  6. submitType="1"
  7. :data="treeListData"
  8. v-model="sourceList.pagination.productClassifyId"
  9. @change="treeChange"
  10. @changeTreeList="getTreeList"
  11. >
  12. </treeList>
  13. </div>
  14. <div class="content">
  15. <byTable
  16. :source="sourceList.data"
  17. :pagination="sourceList.pagination"
  18. :config="config"
  19. :loading="loading"
  20. highlight-current-row
  21. :selectConfig="selectConfig"
  22. :table-events="{
  23. //element talbe事件都能传
  24. select: select,
  25. }"
  26. :action-list="[
  27. {
  28. text: 'Excel导入',
  29. action: () => openExcel(),
  30. disabled: false,
  31. },
  32. {
  33. text: '添加产品',
  34. action: () => openModal('add'),
  35. disabled: false,
  36. },
  37. ]"
  38. @get-list="getList"
  39. >
  40. <template #pic="{ item }">
  41. <div v-if="item.fileList.length > 0">
  42. <img
  43. :src="item.fileList[0].fileUrl"
  44. class="pic"
  45. @click="handleClickFile(item.fileList[0])"
  46. />
  47. </div>
  48. <div v-else></div>
  49. </template>
  50. </byTable>
  51. </div>
  52. <el-dialog
  53. :title="modalType == 'add' ? '添加' : '编辑'"
  54. v-model="dialogVisible"
  55. width="500"
  56. v-loading="loading"
  57. >
  58. <byForm
  59. :formConfig="formConfig"
  60. :formOption="formOption"
  61. v-model="formData.data"
  62. :rules="rules"
  63. ref="byform"
  64. >
  65. <template #productPic>
  66. <div>
  67. <el-upload
  68. v-model:fileList="fileList"
  69. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  70. :data="uploadData"
  71. list-type="picture-card"
  72. :on-remove="handleRemove"
  73. :on-success="handleSuccess"
  74. :before-upload="handleBeforeUpload"
  75. >
  76. <el-icon><Plus /></el-icon>
  77. </el-upload>
  78. </div>
  79. </template>
  80. <template #combination>
  81. <el-form
  82. ref="tableForm"
  83. :model="formData.data"
  84. :rules="rules"
  85. style="margin-top: 15px"
  86. >
  87. <el-form-item
  88. label="组合明细"
  89. v-show="formData.data.combination == 1"
  90. >
  91. <el-button
  92. type="primary"
  93. @click="openProduct = true"
  94. style="margin-bottom: 10px"
  95. >
  96. 添加
  97. </el-button>
  98. <el-table :data="formData.data.productCombinationList">
  99. <el-table-column prop="code" label="产品编码" />
  100. <el-table-column prop="name" label="产品名称" />
  101. <el-table-column
  102. prop="linkQuantity"
  103. label="组合数量"
  104. min-width="150"
  105. >
  106. <template #default="{ row, $index }">
  107. <el-form-item
  108. :prop="
  109. 'productCombinationList.' + $index + '.linkQuantity'
  110. "
  111. :rules="rules.linkQuantity"
  112. :inline-message="true"
  113. >
  114. <el-input
  115. v-model="row.linkQuantity"
  116. placeholder="请输入"
  117. />
  118. </el-form-item>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="zip" label="操作" width="100">
  122. <template #default="{ $index }">
  123. <el-button
  124. type="primary"
  125. link
  126. @click="handleRemoveProduct($index)"
  127. >删除</el-button
  128. >
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. </el-form-item>
  133. </el-form>
  134. </template>
  135. <template #one>
  136. <div style="width: 100%">
  137. <el-row>
  138. <el-col :span="4">
  139. <el-input
  140. v-model="formData.data.victoriatouristJson.newProductsDay1"
  141. placeholder="请输入"
  142. disabled
  143. />
  144. </el-col>
  145. <el-col :span="1" style="text-align: center"> ~ </el-col>
  146. <el-col :span="4">
  147. <el-input
  148. v-model="formData.data.victoriatouristJson.newProductsDay"
  149. placeholder="请输入"
  150. @change="changeDay(10)"
  151. >
  152. </el-input>
  153. </el-col>
  154. <el-col :span="1" style="text-align: center"> : </el-col>
  155. <el-col :span="6">
  156. <el-input
  157. v-model="
  158. formData.data.victoriatouristJson.newProductsExpectedSales
  159. "
  160. placeholder="预期销量"
  161. />
  162. </el-col>
  163. </el-row>
  164. </div>
  165. </template>
  166. <template #two>
  167. <div style="width: 100%">
  168. <el-row>
  169. <el-col :span="4">
  170. <el-input
  171. v-model="formData.data.victoriatouristJson.growUpDay1"
  172. placeholder="请输入"
  173. disabled
  174. />
  175. </el-col>
  176. <el-col :span="1" style="text-align: center"> ~ </el-col>
  177. <el-col :span="4">
  178. <el-input
  179. v-model="formData.data.victoriatouristJson.growUpDay"
  180. placeholder="请输入"
  181. @change="changeDay(20)"
  182. >
  183. </el-input>
  184. </el-col>
  185. <el-col :span="1" style="text-align: center"> : </el-col>
  186. <el-col :span="6">
  187. <el-input
  188. v-model="
  189. formData.data.victoriatouristJson.growUpExpectedSales
  190. "
  191. placeholder="预期销量"
  192. />
  193. </el-col>
  194. </el-row>
  195. </div>
  196. </template>
  197. <template #three>
  198. <el-row style="width: 100%">
  199. <el-col :span="5">
  200. 大于{{ formData.data.victoriatouristJson.attDay }}天:
  201. </el-col>
  202. <el-col :span="6">
  203. <el-input
  204. v-model="formData.data.victoriatouristJson.matureExpectedSales"
  205. placeholder="预期销量"
  206. />
  207. </el-col>
  208. </el-row>
  209. </template>
  210. </byForm>
  211. <template #footer>
  212. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  213. <el-button
  214. type="primary"
  215. @click="submitForm('byform')"
  216. size="large"
  217. :loading="submitLoading"
  218. >
  219. 确 定
  220. </el-button>
  221. </template>
  222. </el-dialog>
  223. <el-dialog
  224. title="Excel导入"
  225. v-model="openExcelDialog"
  226. width="400"
  227. v-loading="loading"
  228. >
  229. <template #footer>
  230. <el-button @click="openExcelDialog = false" size="large"
  231. >取 消</el-button
  232. >
  233. <el-button
  234. type="primary"
  235. @click="submitExcel()"
  236. size="large"
  237. :loading="submitLoading"
  238. >
  239. 确 定
  240. </el-button>
  241. </template>
  242. </el-dialog>
  243. <el-dialog
  244. v-model="openProduct"
  245. title="选择产品"
  246. width="70%"
  247. append-to-body
  248. >
  249. <SelectProduct @handleSelect="handleSelect"></SelectProduct>
  250. <template #footer>
  251. <span class="dialog-footer">
  252. <el-button @click="openProduct = false">取消</el-button>
  253. </span>
  254. </template>
  255. </el-dialog>
  256. </div>
  257. </template>
  258. <script setup>
  259. /* eslint-disable vue/no-unused-components */
  260. import { ElMessage, ElMessageBox } from "element-plus";
  261. import byTable from "@/components/byTable/index";
  262. import byForm from "@/components/byForm/index";
  263. import treeList from "@/components/product/treeList";
  264. import SelectProduct from "@/components/WDLY/product/SelectProduct";
  265. import { computed, defineComponent, ref } from "vue";
  266. let openProduct = ref(false);
  267. const loading = ref(false);
  268. const submitLoading = ref(false);
  269. const sourceList = ref({
  270. data: [],
  271. pagination: {
  272. total: 3,
  273. pageNum: 1,
  274. pageSize: 10,
  275. type: "",
  276. productClassifyId: "",
  277. keyword: "",
  278. definition: "1",
  279. },
  280. });
  281. let dialogVisible = ref(false);
  282. let openExcelDialog = ref(false);
  283. let modalType = ref("add");
  284. let rules = ref({
  285. productClassifyId: [
  286. { required: true, message: "请选择产品分类", trigger: "change" },
  287. ],
  288. type: [{ required: true, message: "请选择产品类型", trigger: "change" }],
  289. name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
  290. unit: [{ required: true, message: "请选择单位", trigger: "change" }],
  291. linkQuantity: [
  292. { required: true, message: "请输入组合数量", trigger: "blur" },
  293. ],
  294. });
  295. const { proxy } = getCurrentInstance();
  296. const selectConfig = computed(() => {
  297. return [
  298. {
  299. label: "产品类型",
  300. prop: "type",
  301. data: [
  302. {
  303. label: "成品",
  304. value: "1",
  305. },
  306. {
  307. label: "半成品",
  308. value: "2",
  309. },
  310. ],
  311. },
  312. {
  313. label: "生命周期",
  314. prop: "lifeCycle",
  315. data: [
  316. {
  317. label: "新品",
  318. value: "1",
  319. },
  320. {
  321. label: "成长",
  322. value: "2",
  323. },
  324. {
  325. label: "成熟",
  326. value: "3",
  327. },
  328. ],
  329. },
  330. ];
  331. });
  332. const config = computed(() => {
  333. return [
  334. {
  335. attrs: {
  336. label: "产品类型",
  337. prop: "type",
  338. },
  339. render(type) {
  340. return type == 1 ? "成品" : type == 2 ? "半成品" : "";
  341. },
  342. },
  343. {
  344. attrs: {
  345. label: "产品编码",
  346. prop: "code",
  347. },
  348. },
  349. {
  350. attrs: {
  351. label: "产品名称",
  352. prop: "name",
  353. },
  354. },
  355. {
  356. attrs: {
  357. label: "图片",
  358. prop: "unit",
  359. slot: "pic",
  360. },
  361. },
  362. {
  363. attrs: {
  364. label: "单位",
  365. prop: "unit",
  366. },
  367. },
  368. {
  369. attrs: {
  370. label: "规格型号",
  371. prop: "spec",
  372. },
  373. },
  374. {
  375. attrs: {
  376. label: "管理部门",
  377. prop: "deptName",
  378. },
  379. },
  380. {
  381. attrs: {
  382. label: "生命周期",
  383. prop: "lifeCycle",
  384. },
  385. },
  386. {
  387. attrs: {
  388. label: "京东供价",
  389. prop: "jdPurchasePrice",
  390. },
  391. },
  392. {
  393. attrs: {
  394. label: "标准售价",
  395. prop: "sellingPrice",
  396. },
  397. },
  398. {
  399. attrs: {
  400. label: "标准采购价",
  401. prop: "purchasePrice",
  402. },
  403. },
  404. {
  405. attrs: {
  406. label: "产品备注",
  407. prop: "remark",
  408. },
  409. },
  410. {
  411. attrs: {
  412. label: "操作",
  413. width: "200",
  414. align: "right",
  415. },
  416. // 渲染 el-button,一般用在最后一列。
  417. renderHTML(row) {
  418. return [
  419. {
  420. attrs: {
  421. label: "修改",
  422. type: "primary",
  423. text: true,
  424. },
  425. el: "button",
  426. click() {
  427. getDtl(row);
  428. },
  429. },
  430. {
  431. attrs: {
  432. label: "删除",
  433. type: "danger",
  434. text: true,
  435. },
  436. el: "button",
  437. click() {
  438. // 弹窗提示是否删除
  439. ElMessageBox.confirm(
  440. "此操作将永久删除该数据, 是否继续?",
  441. "提示",
  442. {
  443. confirmButtonText: "确定",
  444. cancelButtonText: "取消",
  445. type: "warning",
  446. }
  447. ).then(() => {
  448. // 删除
  449. proxy
  450. .post("/productInfo/delete", {
  451. id: row.id,
  452. })
  453. .then((res) => {
  454. ElMessage({
  455. message: "删除成功",
  456. type: "success",
  457. });
  458. getList();
  459. });
  460. });
  461. },
  462. },
  463. ];
  464. },
  465. },
  466. ];
  467. });
  468. const uploadData = ref({});
  469. const fileList = ref([]);
  470. const fileListCopy = ref([]);
  471. let formData = reactive({
  472. data: {},
  473. });
  474. const formOption = reactive({
  475. inline: true,
  476. labelWidth: 100,
  477. itemWidth: 100,
  478. rules: [],
  479. });
  480. const byform = ref(null);
  481. const treeListData = ref([]);
  482. const formConfig = computed(() => {
  483. return [
  484. {
  485. type: "treeSelect",
  486. prop: "productClassifyId",
  487. label: "产品分类",
  488. data: [],
  489. },
  490. {
  491. type: "select",
  492. prop: "type",
  493. label: "产品类型",
  494. required: true,
  495. data: [
  496. {
  497. label: "成品",
  498. id: "1",
  499. },
  500. {
  501. label: "半成品",
  502. id: "2",
  503. },
  504. ],
  505. },
  506. {
  507. type: "input",
  508. prop: "name",
  509. label: "产品名称",
  510. },
  511. {
  512. type: "input",
  513. prop: "spec",
  514. label: "规格型号",
  515. },
  516. {
  517. type: "select",
  518. prop: "unit",
  519. label: "单位",
  520. required: true,
  521. data: [
  522. {
  523. label: "个",
  524. id: "个",
  525. },
  526. {
  527. label: "双",
  528. id: "双",
  529. },
  530. ],
  531. },
  532. {
  533. type: "slot",
  534. slotName: "productPic",
  535. prop: "fileList",
  536. label: "产品图片",
  537. },
  538. {
  539. type: "input",
  540. prop: "remark",
  541. label: "备注",
  542. itemType: "textarea",
  543. },
  544. {
  545. type: "radio",
  546. prop: "combination",
  547. label: "是否组合",
  548. required: true,
  549. border: true,
  550. data: [
  551. { label: "是", value: "1" },
  552. { label: "否", value: "0" },
  553. ],
  554. },
  555. {
  556. type: "json",
  557. prop: "victoriatouristJson",
  558. json: [
  559. {
  560. type: "input",
  561. prop: "jdPurchasePrice",
  562. label: "京东供价",
  563. itemWidth: 33,
  564. style: {
  565. width: "100%",
  566. "margin-right": "10px",
  567. },
  568. },
  569. {
  570. type: "input",
  571. prop: "sellingPrice",
  572. label: "标准售价",
  573. itemWidth: 33,
  574. },
  575. {
  576. type: "input",
  577. prop: "purchasePrice",
  578. label: "标准采购价",
  579. itemWidth: 33,
  580. },
  581. {
  582. type: "date",
  583. prop: "clearancePeriod",
  584. label: "库存清空期限",
  585. itemWidth: 50,
  586. format: "YYYY-MM-DD",
  587. },
  588. ],
  589. },
  590. // {
  591. // type: "title",
  592. // title: "组合明细",
  593. // label: "",
  594. // },
  595. {
  596. type: "slot",
  597. slotName: "combination",
  598. label: "",
  599. },
  600. {
  601. type: "title",
  602. title: "生命周期规则",
  603. label: "",
  604. },
  605. {
  606. type: "slot",
  607. slotName: "one",
  608. label: "新品期",
  609. },
  610. {
  611. type: "slot",
  612. slotName: "two",
  613. label: "成长期",
  614. },
  615. {
  616. type: "slot",
  617. slotName: "three",
  618. label: "成熟期",
  619. },
  620. ];
  621. });
  622. const newPassword = () => {
  623. formData.data.password = generatePassword();
  624. };
  625. const generatePassword = () => {
  626. var length = 12,
  627. charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
  628. password = "";
  629. for (var i = 0, n = charset.length; i < length; ++i) {
  630. password += charset.charAt(Math.floor(Math.random() * n));
  631. }
  632. return password;
  633. };
  634. const getList = async (req) => {
  635. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  636. loading.value = true;
  637. proxy
  638. .post("/productInfo/page", sourceList.value.pagination)
  639. .then((message) => {
  640. console.log(message);
  641. sourceList.value.data = message.rows.map((x) => ({
  642. ...x,
  643. fileList: [],
  644. ...JSON.parse(x.victoriatouristJson),
  645. }));
  646. sourceList.value.pagination.total = message.total;
  647. setTimeout(() => {
  648. loading.value = false;
  649. }, 200);
  650. const productIdList = message.rows.map((x) => x.id);
  651. // 请求文件数据并回显
  652. if (productIdList.length > 0) {
  653. proxy
  654. .post("/fileInfo/getList", { businessIdList: productIdList })
  655. .then((fileObj) => {
  656. for (let i = 0; i < sourceList.value.data.length; i++) {
  657. const e = sourceList.value.data[i];
  658. for (const key in fileObj) {
  659. if (e.id === key) {
  660. e.fileList = fileObj[key];
  661. }
  662. }
  663. }
  664. });
  665. }
  666. });
  667. };
  668. const treeChange = (e) => {
  669. console.log(e);
  670. sourceList.value.pagination.productClassifyId = e.id;
  671. getList({ productClassifyId: e.id });
  672. };
  673. const openModal = () => {
  674. dialogVisible.value = true;
  675. modalType.value = "add";
  676. formData.data = {
  677. definition: "1",
  678. type: "1",
  679. fileList: [],
  680. combination: "1",
  681. victoriatouristJson: {
  682. combination: 1,
  683. newProductsDay1: 0,
  684. newProductsDay: 60,
  685. growUpDay1: 61,
  686. growUpDay: 120,
  687. attDay: 120,
  688. },
  689. productCombinationList: [],
  690. };
  691. fileList.value = [];
  692. fileListCopy.value = [];
  693. };
  694. const openExcel = () => {
  695. openExcelDialog.value = true;
  696. };
  697. const submitExcel = () => {
  698. openExcelDialog.value = false;
  699. };
  700. const TreetenantId = ref("");
  701. const selection = ref({
  702. data: [],
  703. });
  704. const select = (_selection, row) => {
  705. selection.value.data = _selection;
  706. console.log(_selection.length);
  707. };
  708. const tree = ref(null);
  709. const submitForm = () => {
  710. byform.value.handleSubmit((valid) => {
  711. if (formData.data.combination == 1) {
  712. if (!formData.data.productCombinationList.length > 0) {
  713. return ElMessage({
  714. message: "请添加组合明细",
  715. type: "info",
  716. });
  717. }
  718. formData.data.victoriatouristJson = JSON.parse(
  719. formData.data.victoriatouristJson
  720. );
  721. formData.data.victoriatouristJson.productCombinationList =
  722. formData.data.productCombinationList;
  723. formData.data.victoriatouristJson.combination = formData.data.combination;
  724. delete formData.data.productCombinationList;
  725. delete formData.data.combination;
  726. formData.data.victoriatouristJson = JSON.stringify(
  727. formData.data.victoriatouristJson
  728. );
  729. }
  730. formData.data.fileList = fileListCopy.value.map((x) => ({
  731. id: x.id,
  732. fileName: x.fileName,
  733. }));
  734. submitLoading.value = true;
  735. proxy.post("/productInfo/" + modalType.value, formData.data).then(
  736. (res) => {
  737. ElMessage({
  738. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  739. type: "success",
  740. });
  741. dialogVisible.value = false;
  742. submitLoading.value = false;
  743. getList();
  744. },
  745. (err) => {
  746. submitLoading.value = false;
  747. }
  748. );
  749. });
  750. };
  751. const getTreeList = () => {
  752. proxy
  753. .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
  754. .then((message) => {
  755. treeListData.value = message;
  756. formConfig.value[0].data = message;
  757. });
  758. };
  759. const getDtl = (row) => {
  760. modalType.value = "edit";
  761. proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
  762. fileList.value = row.fileList.map((x) => ({ ...x, url: x.fileUrl }));
  763. fileListCopy.value = [...fileList.value];
  764. res.type = res.type + ""; //type回显
  765. res.definition = "1"; //产品
  766. res.victoriatouristJson = JSON.parse(res.victoriatouristJson);
  767. res.combination = res.victoriatouristJson.combination + "";
  768. res.productCombinationList = res.victoriatouristJson.productCombinationList;
  769. formData.data = res;
  770. dialogVisible.value = true;
  771. });
  772. };
  773. getTreeList();
  774. getList();
  775. const handleBeforeUpload = async (file) => {
  776. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  777. uploadData.value = res.uploadBody;
  778. fileListCopy.value.push({
  779. id: res.id,
  780. fileName: res.fileName,
  781. path: res.fileUrl,
  782. url: res.fileUrl,
  783. uid: file.uid,
  784. });
  785. };
  786. const handleSuccess = (res, file, files) => {
  787. // 查当前file的index值去赋值对应的copy变量的值
  788. // let uid = file.uid;
  789. // const index = fileList.value.findIndex((x) => x.uid === uid);
  790. // fileListCopy.value[index].uid = uid;
  791. };
  792. const handleRemove = (file) => {
  793. const index = fileListCopy.value.findIndex(
  794. (x) => x.uid === file.uid || x.id === file.id
  795. );
  796. fileListCopy.value.splice(index, 1);
  797. };
  798. const handleClickFile = (file) => {
  799. window.open(file.fileUrl, "_blank");
  800. };
  801. const handleRemoveProduct = (index) => {
  802. formData.data.productCombinationList.splice(index, 1);
  803. return ElMessage({
  804. message: "删除成功!",
  805. type: "success",
  806. });
  807. };
  808. const pushGoods = (goods) => {
  809. const arr = goods.map((x) => ({
  810. linkProductId: x.id,
  811. linkQuantity: "",
  812. name: x.name,
  813. code: x.code,
  814. }));
  815. formData.data.productCombinationList =
  816. formData.data.productCombinationList.concat(arr);
  817. return ElMessage({
  818. message: "添加成功!",
  819. type: "success",
  820. });
  821. };
  822. const changeDay = (type) => {
  823. if (type == 10) {
  824. formData.data.victoriatouristJson.growUpDay1 =
  825. Number(formData.data.victoriatouristJson.newProductsDay) + 1;
  826. } else if (type == 20) {
  827. formData.data.victoriatouristJson.attDay = Number(
  828. formData.data.victoriatouristJson.growUpDay
  829. );
  830. }
  831. };
  832. const handleSelect = (row) => {
  833. const flag = formData.data.productCombinationList.some(
  834. (x) => x.linkProductId === row.id
  835. );
  836. if (flag)
  837. return ElMessage({
  838. message: "该产品已选择",
  839. type: "info",
  840. });
  841. const product = {
  842. linkProductId: row.id,
  843. linkQuantity: "",
  844. name: row.name,
  845. code: row.code,
  846. };
  847. formData.data.productCombinationList.push(product);
  848. return ElMessage({
  849. message: "选择成功",
  850. type: "success",
  851. });
  852. };
  853. </script>
  854. <style lang="scss" scoped>
  855. .user {
  856. padding: 20px;
  857. display: flex;
  858. justify-content: space-between;
  859. .tree {
  860. width: 300px;
  861. }
  862. .content {
  863. width: calc(100% - 320px);
  864. }
  865. }
  866. .pic {
  867. object-fit: contain;
  868. width: 50px;
  869. height: 50px;
  870. cursor: pointer;
  871. vertical-align: middle;
  872. }
  873. </style>