accessories.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906
  1. <template>
  2. <block v-if="!isBom">
  3. <view class="search-box">
  4. <up-search placeholder="搜索关键词" v-model="keyword" height="35" @blur="onSearch" :clearabled="false"
  5. :showAction="false" />
  6. <view v-if="content.where.condition" class="clear" @click.stop="onSearch('')">
  7. <up-icon name="close-circle-fill" size="20" />
  8. </view>
  9. </view>
  10. <view style="height: 20rpx;" />
  11. </block>
  12. <My_listbox v-if="!isBom" ref="listBox" :empty="!list.length" :pullDown="!isBom" @getlist="getList">
  13. <showList :result="resultIds" :list='list' @onClick="onSelect" />
  14. <view style="height: 200rpx;" />
  15. </My_listbox>
  16. <view v-else class="bom">
  17. <view class="left">
  18. <view class="class1" :class="active.class1 == index ? 'class1active' : ''" @click="changeClass1(index)"
  19. v-for="(item, index) in bomList" :key="item.plm_bomid" hover-class="navigator-hover">
  20. {{ item.bomname }}
  21. </view>
  22. </view>
  23. <view class="right">
  24. <view class="select" v-if="bomList[active.class1].subdep.length">
  25. <up-select v-model:current="active.class2" :label="bomList[active.class1].subdep[active.class2].bomname"
  26. :options="bomList[active.class1].subdep" @select="selectClass2" labelName="bomname" />
  27. <up-select v-if="bomList[active.class1].subdep[active.class2].subdep.length"
  28. v-model:current="active.class3"
  29. :label="bomList[active.class1].subdep[active.class2].subdep[active.class3].bomname"
  30. :options="bomList[active.class1].subdep[active.class2].subdep" @select="selectClass3"
  31. labelName="bomname" />
  32. </view>
  33. </view>
  34. </view>
  35. <view class="footer">
  36. <My-button :text="`确定添加(${resultIds.length})`" @onClick="onAdd" />
  37. </view>
  38. </template>
  39. <script setup>
  40. import { ref, reactive, getCurrentInstance, computed } from 'vue';
  41. import { onLoad } from '@dcloudio/uni-app';
  42. import showList from "./accessoriesList.vue";
  43. const { $Http } = getCurrentInstance().proxy;
  44. const listBox = ref(null);
  45. const isBom = ref(false);
  46. let result = reactive([]);
  47. const resultIds = ref([]);
  48. const content = reactive({
  49. loading: false,
  50. "pageNumber": 1,
  51. "pageSize": 20,
  52. "where": {
  53. "condition": ""
  54. }
  55. })
  56. function onAdd() {
  57. $Http.selectAcc(result)
  58. }
  59. function onSelect(e) {
  60. if (result.some(item => item.itemid == e.itemid)) {
  61. result = result.filter(item => item.itemid != e.itemid);
  62. } else {
  63. result.push(e);
  64. }
  65. resultIds.value = result.map(item => item.itemid);
  66. }
  67. const list = ref([]);
  68. onLoad((options) => {
  69. console.log("options", options)
  70. console.log("$Http", $Http)
  71. result = result.concat(JSON.parse(options.list || '[]'));
  72. resultIds.value = result.map(item => item.itemid);
  73. console.log("初始选中", result, resultIds.value)
  74. let content1 = $Http.content1;
  75. content.sys_enterpriseid = content1.sys_enterpriseid;
  76. content.sa_workorderid = content1.sa_workorderid;
  77. if (content1.sku) $Http.basic({
  78. "id": 2025080610424703,
  79. "content": content1
  80. }).then(res => {
  81. console.log("查询产品是否存在BOM", res)
  82. if (res.data == 0) {
  83. // 不存在BOM
  84. getList(true);
  85. } else {
  86. // 存在BOM
  87. isBom.value = true;
  88. getBomList();
  89. }
  90. })
  91. })
  92. function selectClass2(index) {
  93. console.log(index)
  94. active.class2 = index;
  95. active.class3 = 0;
  96. }
  97. function selectClass3(index) {
  98. active.class3 = index;
  99. }
  100. const bomList = ref([
  101. {
  102. "bom": [
  103. {
  104. "plm_bomid": 1,
  105. "bomfullname": "集成灶",
  106. "subdep": [
  107. {
  108. "plm_bomid": 11,
  109. "bomfullname": "集成灶/排油烟模块",
  110. "subdep": [
  111. {
  112. "plm_bomid": 16,
  113. "bomfullname": "集成灶/排油烟模块/烟管连接件",
  114. "subdep": [
  115. {
  116. "plm_bomid": 30,
  117. "bomfullname": "集成灶/排油烟模块/烟管连接件/风门转接板",
  118. "subdep": [],
  119. "isdeep": 1,
  120. "num": "1",
  121. "bomname": "风门转接板",
  122. "rowindex": 29,
  123. "items": [
  124. {
  125. "begindate": "2025-07-18 00:00:00",
  126. "itemname": "600无缝板摩卡单色C(2米)",
  127. "module": "排油烟模块",
  128. "itemno": "LSAQPT00404",
  129. "spec": "",
  130. "sa_aftersalesbom_pjsid": 92,
  131. "itemid": 117810,
  132. "component": "烟管连接件",
  133. "enddate": "2025-08-15 00:00:00",
  134. "sa_aftersalesbomid": 2,
  135. "attinfos": [],
  136. "price": 0,
  137. "siteid": "lsa",
  138. "accessorie": "风门转接板",
  139. "model": "GB6201",
  140. "rowindex": 10,
  141. "brand": [],
  142. "typename": "风门转接板",
  143. "status": "",
  144. "tradefield": [
  145. {
  146. "itemid": 117810,
  147. "rowindex": 10,
  148. "tradefield": "建材家居"
  149. }
  150. ]
  151. }
  152. ],
  153. "parentid": 16
  154. },
  155. {
  156. "plm_bomid": 29,
  157. "bomfullname": "集成灶/排油烟模块/烟管连接件/烟管接头",
  158. "subdep": [],
  159. "isdeep": 1,
  160. "num": "1",
  161. "bomname": "烟管接头",
  162. "rowindex": 28,
  163. "parentid": 16
  164. },
  165. {
  166. "plm_bomid": 28,
  167. "bomfullname": "集成灶/排油烟模块/烟管连接件/烟管延长接头",
  168. "subdep": [],
  169. "isdeep": 1,
  170. "num": "1",
  171. "bomname": "烟管延长接头",
  172. "rowindex": 27,
  173. "parentid": 16
  174. },
  175. {
  176. "plm_bomid": 27,
  177. "bomfullname": "集成灶/排油烟模块/烟管连接件/烟管堵盖",
  178. "subdep": [],
  179. "isdeep": 1,
  180. "num": "1",
  181. "bomname": "烟管堵盖",
  182. "rowindex": 26,
  183. "parentid": 16
  184. }
  185. ],
  186. "isdeep": 0,
  187. "num": "1",
  188. "bomname": "烟管连接件",
  189. "rowindex": 15,
  190. "parentid": 11
  191. },
  192. {
  193. "plm_bomid": 15,
  194. "bomfullname": "集成灶/排油烟模块/风道过渡面板",
  195. "subdep": [],
  196. "isdeep": 1,
  197. "num": "1",
  198. "bomname": "风道过渡面板",
  199. "rowindex": 14,
  200. "items": [
  201. {
  202. "begindate": "2025-07-15 00:00:00",
  203. "itemname": "600无缝板顺理成章",
  204. "module": "排油烟模块",
  205. "itemno": "LSAQPT00904",
  206. "spec": "",
  207. "sa_aftersalesbom_pjsid": 46,
  208. "itemid": 117714,
  209. "component": "风道过渡面板",
  210. "enddate": "2025-08-15 00:00:00",
  211. "sa_aftersalesbomid": 2,
  212. "attinfos": [],
  213. "price": 0,
  214. "siteid": "lsa",
  215. "accessorie": "",
  216. "model": "GB6281",
  217. "rowindex": 1,
  218. "brand": [],
  219. "typename": "风道过渡面板",
  220. "status": "",
  221. "tradefield": [
  222. {
  223. "itemid": 117714,
  224. "rowindex": 1,
  225. "tradefield": "建材家居"
  226. }
  227. ]
  228. }
  229. ],
  230. "parentid": 11
  231. },
  232. {
  233. "plm_bomid": 14,
  234. "bomfullname": "集成灶/排油烟模块/风道组件",
  235. "subdep": [
  236. {
  237. "plm_bomid": 26,
  238. "bomfullname": "集成灶/排油烟模块/风道组件/集油弯头密封圈",
  239. "subdep": [],
  240. "isdeep": 1,
  241. "num": "1",
  242. "bomname": "集油弯头密封圈",
  243. "rowindex": 25,
  244. "items": [
  245. {
  246. "begindate": "2025-07-15 00:00:00",
  247. "itemname": "600无缝板爵士白",
  248. "module": "排油烟模块",
  249. "itemno": "LSAQTS00074",
  250. "spec": "",
  251. "sa_aftersalesbom_pjsid": 60,
  252. "itemid": 117720,
  253. "component": "风道组件",
  254. "enddate": "2025-08-15 00:00:00",
  255. "sa_aftersalesbomid": 2,
  256. "attinfos": [],
  257. "price": 0,
  258. "siteid": "lsa",
  259. "accessorie": "集油弯头密封圈",
  260. "model": "GB6281",
  261. "rowindex": 2,
  262. "brand": [],
  263. "typename": "集油弯头密封圈",
  264. "status": "",
  265. "tradefield": [
  266. {
  267. "itemid": 117720,
  268. "rowindex": 2,
  269. "tradefield": "建材家居"
  270. }
  271. ]
  272. },
  273. {
  274. "begindate": "2025-07-15 00:00:00",
  275. "itemname": "600v双层蜂香板慈宫金碧(2.6米)",
  276. "module": "排油烟模块",
  277. "itemno": "LSAFZZ00214",
  278. "spec": "",
  279. "sa_aftersalesbom_pjsid": 61,
  280. "itemid": 117746,
  281. "component": "风道组件",
  282. "enddate": "2025-08-15 00:00:00",
  283. "sa_aftersalesbomid": 2,
  284. "attinfos": [],
  285. "price": 0,
  286. "siteid": "lsa",
  287. "accessorie": "集油弯头密封圈",
  288. "model": "GB626FV",
  289. "rowindex": 3,
  290. "brand": [],
  291. "typename": "集油弯头密封圈",
  292. "status": "",
  293. "tradefield": [
  294. {
  295. "itemid": 117746,
  296. "rowindex": 7,
  297. "tradefield": "建材家居"
  298. }
  299. ]
  300. },
  301. {
  302. "begindate": "2025-07-15 00:00:00",
  303. "itemname": "68套色门框线白橡木",
  304. "module": "排油烟模块",
  305. "itemno": "LSAFZZ00083",
  306. "spec": "",
  307. "sa_aftersalesbom_pjsid": 62,
  308. "itemid": 117733,
  309. "component": "风道组件",
  310. "enddate": "2025-08-15 00:00:00",
  311. "sa_aftersalesbomid": 2,
  312. "attinfos": [],
  313. "price": 0,
  314. "siteid": "lsa",
  315. "accessorie": "集油弯头密封圈",
  316. "model": "LSA.EM-TL-004",
  317. "rowindex": 4,
  318. "brand": [],
  319. "typename": "集油弯头密封圈",
  320. "status": "",
  321. "tradefield": [
  322. {
  323. "itemid": 117733,
  324. "rowindex": 5,
  325. "tradefield": "建材家居"
  326. }
  327. ]
  328. }
  329. ],
  330. "parentid": 14
  331. },
  332. {
  333. "plm_bomid": 25,
  334. "bomfullname": "集成灶/排油烟模块/风道组件/集油弯头",
  335. "subdep": [],
  336. "isdeep": 1,
  337. "num": "1",
  338. "bomname": "集油弯头",
  339. "rowindex": 24,
  340. "items": [
  341. {
  342. "begindate": "2025-07-15 00:00:00",
  343. "itemname": "600V双层蜂香板星辰-伽马2(3米)",
  344. "module": "排油烟模块",
  345. "itemno": "LSAQSX00127",
  346. "spec": "",
  347. "sa_aftersalesbom_pjsid": 64,
  348. "itemid": 117747,
  349. "component": "风道组件",
  350. "enddate": "2025-08-15 00:00:00",
  351. "sa_aftersalesbomid": 2,
  352. "attinfos": [],
  353. "price": 0,
  354. "siteid": "lsa",
  355. "accessorie": "集油弯头",
  356. "model": "LSA.XB-201012",
  357. "rowindex": 5,
  358. "brand": [],
  359. "typename": "集油弯头",
  360. "status": "",
  361. "tradefield": [
  362. {
  363. "itemid": 117747,
  364. "rowindex": 8,
  365. "tradefield": "建材家居"
  366. }
  367. ]
  368. }
  369. ],
  370. "parentid": 14
  371. },
  372. {
  373. "plm_bomid": 24,
  374. "bomfullname": "集成灶/排油烟模块/风道组件/卡箍φ16-25",
  375. "subdep": [],
  376. "isdeep": 1,
  377. "num": "1",
  378. "bomname": "卡箍φ16-25",
  379. "rowindex": 23,
  380. "parentid": 14
  381. },
  382. {
  383. "plm_bomid": 23,
  384. "bomfullname": "集成灶/排油烟模块/风道组件/下油管φ19",
  385. "subdep": [],
  386. "isdeep": 1,
  387. "num": "1",
  388. "bomname": "下油管φ19",
  389. "rowindex": 22,
  390. "parentid": 14
  391. }
  392. ],
  393. "isdeep": 0,
  394. "num": "1",
  395. "bomname": "风道组件",
  396. "rowindex": 13,
  397. "parentid": 11
  398. },
  399. {
  400. "plm_bomid": 13,
  401. "bomfullname": "集成灶/排油烟模块/蜗壳上盖板",
  402. "subdep": [],
  403. "isdeep": 1,
  404. "num": "1",
  405. "bomname": "蜗壳上盖板",
  406. "rowindex": 12,
  407. "parentid": 11
  408. },
  409. {
  410. "plm_bomid": 12,
  411. "bomfullname": "集成灶/排油烟模块/蜗壳组件",
  412. "subdep": [
  413. {
  414. "plm_bomid": 22,
  415. "bomfullname": "集成灶/排油烟模块/蜗壳组件/清洗加热垫",
  416. "subdep": [],
  417. "isdeep": 1,
  418. "num": "1",
  419. "bomname": "清洗加热垫",
  420. "rowindex": 21,
  421. "items": [
  422. {
  423. "begindate": "2025-07-15 00:00:00",
  424. "itemname": "600无缝板竹节拉丝(2.6米)",
  425. "module": "排油烟模块",
  426. "itemno": "LSAQQM00023",
  427. "spec": "",
  428. "sa_aftersalesbom_pjsid": 73,
  429. "itemid": 117750,
  430. "component": "蜗壳组件",
  431. "enddate": "2025-08-15 00:00:00",
  432. "sa_aftersalesbomid": 2,
  433. "attinfos": [],
  434. "price": 0,
  435. "siteid": "lsa",
  436. "accessorie": "清洗加热垫",
  437. "model": "LSA-BJ-QB03",
  438. "rowindex": 6,
  439. "brand": [],
  440. "typename": "清洗加热垫",
  441. "status": "",
  442. "tradefield": [
  443. {
  444. "itemid": 117750,
  445. "rowindex": 9,
  446. "tradefield": "建材家居"
  447. }
  448. ]
  449. },
  450. {
  451. "begindate": "2025-07-15 00:00:00",
  452. "itemname": "600无缝板风中骑士(2米)",
  453. "module": "排油烟模块",
  454. "itemno": "LSAQTS00016",
  455. "spec": "",
  456. "sa_aftersalesbom_pjsid": 74,
  457. "itemid": 117737,
  458. "component": "蜗壳组件",
  459. "enddate": "2025-08-15 00:00:00",
  460. "sa_aftersalesbomid": 2,
  461. "attinfos": [],
  462. "price": 0,
  463. "siteid": "lsa",
  464. "accessorie": "清洗加热垫",
  465. "model": "",
  466. "rowindex": 7,
  467. "brand": [],
  468. "typename": "清洗加热垫",
  469. "status": "",
  470. "tradefield": [
  471. {
  472. "itemid": 117737,
  473. "rowindex": 6,
  474. "tradefield": "建材家居"
  475. }
  476. ]
  477. }
  478. ],
  479. "parentid": 12
  480. },
  481. {
  482. "plm_bomid": 21,
  483. "bomfullname": "集成灶/排油烟模块/蜗壳组件/法兰盘密封圈",
  484. "subdep": [],
  485. "isdeep": 1,
  486. "num": "1",
  487. "bomname": "法兰盘密封圈",
  488. "rowindex": 20,
  489. "items": [
  490. {
  491. "begindate": "2025-07-15 00:00:00",
  492. "itemname": "450V双层蜂香板波斯蓝(2.6米)",
  493. "module": "排油烟模块",
  494. "itemno": "LSAFZZ00106",
  495. "spec": "",
  496. "sa_aftersalesbom_pjsid": 75,
  497. "itemid": 117725,
  498. "component": "蜗壳组件",
  499. "enddate": "2025-08-15 00:00:00",
  500. "sa_aftersalesbomid": 2,
  501. "attinfos": [],
  502. "price": 0,
  503. "siteid": "lsa",
  504. "accessorie": "法兰盘密封圈",
  505. "model": "GB426FV",
  506. "rowindex": 8,
  507. "brand": [],
  508. "typename": "法兰盘密封圈",
  509. "status": "",
  510. "tradefield": [
  511. {
  512. "itemid": 117725,
  513. "rowindex": 3,
  514. "tradefield": "建材家居"
  515. }
  516. ]
  517. }
  518. ],
  519. "parentid": 12
  520. },
  521. {
  522. "plm_bomid": 20,
  523. "bomfullname": "集成灶/排油烟模块/蜗壳组件/电机法兰盘",
  524. "subdep": [],
  525. "isdeep": 1,
  526. "num": "1",
  527. "bomname": "电机法兰盘",
  528. "rowindex": 19,
  529. "parentid": 12
  530. },
  531. {
  532. "plm_bomid": 19,
  533. "bomfullname": "集成灶/排油烟模块/蜗壳组件/风帽",
  534. "subdep": [],
  535. "isdeep": 1,
  536. "num": "1",
  537. "bomname": "风帽",
  538. "rowindex": 18,
  539. "items": [
  540. {
  541. "begindate": "2025-07-15 00:00:00",
  542. "itemname": "120V缝板摩卡单色A",
  543. "module": "排油烟模块",
  544. "itemno": "LSAFZZ00991",
  545. "spec": "",
  546. "sa_aftersalesbom_pjsid": 79,
  547. "itemid": 117727,
  548. "component": "蜗壳组件",
  549. "enddate": "2025-08-15 00:00:00",
  550. "sa_aftersalesbomid": 2,
  551. "attinfos": [],
  552. "price": 0,
  553. "siteid": "lsa",
  554. "accessorie": "风帽",
  555. "model": "GXC-120V",
  556. "rowindex": 9,
  557. "brand": [],
  558. "typename": "风帽",
  559. "status": "",
  560. "tradefield": [
  561. {
  562. "itemid": 117727,
  563. "rowindex": 4,
  564. "tradefield": "建材家居"
  565. }
  566. ]
  567. }
  568. ],
  569. "parentid": 12
  570. },
  571. {
  572. "plm_bomid": 18,
  573. "bomfullname": "集成灶/排油烟模块/蜗壳组件/排烟电机插头",
  574. "subdep": [],
  575. "isdeep": 1,
  576. "num": "1",
  577. "bomname": "排烟电机插头",
  578. "rowindex": 17,
  579. "parentid": 12
  580. },
  581. {
  582. "plm_bomid": 17,
  583. "bomfullname": "集成灶/排油烟模块/蜗壳组件/排烟电机",
  584. "subdep": [],
  585. "isdeep": 1,
  586. "num": "1",
  587. "bomname": "排烟电机",
  588. "rowindex": 16,
  589. "parentid": 12
  590. }
  591. ],
  592. "isdeep": 0,
  593. "num": "1",
  594. "bomname": "蜗壳组件",
  595. "rowindex": 11,
  596. "parentid": 11
  597. }
  598. ],
  599. "isdeep": 0,
  600. "num": "1",
  601. "bomname": "排油烟模块",
  602. "rowindex": 10,
  603. "parentid": 1
  604. },
  605. {
  606. "plm_bomid": 3,
  607. "bomfullname": "集成灶/顶板组件",
  608. "subdep": [
  609. {
  610. "plm_bomid": 4,
  611. "bomfullname": "集成灶/顶板组件/顶板玻璃",
  612. "subdep": [],
  613. "isdeep": 1,
  614. "num": "1",
  615. "bomname": "顶板玻璃",
  616. "rowindex": 4,
  617. "parentid": 3
  618. },
  619. {
  620. "plm_bomid": 5,
  621. "bomfullname": "集成灶/顶板组件/照明玻璃",
  622. "subdep": [],
  623. "isdeep": 1,
  624. "num": "2",
  625. "bomname": "照明玻璃",
  626. "rowindex": 5,
  627. "parentid": 3
  628. },
  629. {
  630. "plm_bomid": 6,
  631. "bomfullname": "集成灶/顶板组件/前端玻璃",
  632. "subdep": [],
  633. "isdeep": 1,
  634. "num": "3",
  635. "bomname": "前端玻璃",
  636. "rowindex": 6,
  637. "parentid": 3
  638. },
  639. {
  640. "plm_bomid": 7,
  641. "bomfullname": "集成灶/顶板组件/内衬玻璃",
  642. "subdep": [],
  643. "isdeep": 1,
  644. "num": "4",
  645. "bomname": "内衬玻璃",
  646. "rowindex": 7,
  647. "parentid": 3
  648. },
  649. {
  650. "plm_bomid": 8,
  651. "bomfullname": "集成灶/顶板组件/照明灯",
  652. "subdep": [],
  653. "isdeep": 1,
  654. "num": "5",
  655. "bomname": "照明灯",
  656. "rowindex": 8,
  657. "parentid": 3
  658. },
  659. {
  660. "plm_bomid": 9,
  661. "bomfullname": "集成灶/顶板组件/氛围灯",
  662. "subdep": [],
  663. "isdeep": 1,
  664. "num": "7",
  665. "bomname": "氛围灯",
  666. "rowindex": 9,
  667. "parentid": 3
  668. }
  669. ],
  670. "isdeep": 1,
  671. "num": "1",
  672. "bomname": "顶板组件",
  673. "rowindex": 3,
  674. "parentid": 1
  675. },
  676. {
  677. "plm_bomid": 2,
  678. "bomfullname": "集成灶/吸烟腔组件",
  679. "subdep": [],
  680. "isdeep": 1,
  681. "num": "1",
  682. "bomname": "吸烟腔组件",
  683. "rowindex": 2,
  684. "parentid": 1
  685. }
  686. ],
  687. "isdeep": 0,
  688. "num": "2",
  689. "bomname": "集成灶",
  690. "rowindex": 1,
  691. "parentid": 0
  692. }
  693. ]
  694. }
  695. ]);
  696. let active = reactive({
  697. class1: 0,
  698. class2: 0,
  699. class3: 0,
  700. });
  701. function changeClass1(index) {
  702. active.class1 = index;
  703. active.class2 = 0;
  704. active.class3 = 0;
  705. }
  706. // 有bom
  707. function getBomList() {
  708. $Http.basic({
  709. "id": "2025080610425503",
  710. content: {
  711. "sa_aftersalesbomid": content.sa_workorderid,
  712. "sys_enterpriseid": content.sys_enterpriseid,
  713. }
  714. }).then(res => {
  715. console.log("获取bom配件列表", res)
  716. if (res.code == 1) {
  717. // bomList.value = res.data;
  718. bomList.value = processBomData(bomList.value)
  719. console.log("bomList", bomList.value);
  720. } else {
  721. if (res.msg) uni.showToast({
  722. title: res.msg,
  723. icon: 'none'
  724. });
  725. }
  726. })
  727. }
  728. function processBomData(originalData) {
  729. // 1. 提取所有一级分类节点
  730. const topLevelNodes = [];
  731. // 遍历原始数据
  732. originalData.forEach(dataSet => {
  733. dataSet.bom?.forEach(rootNode => {
  734. // 提取根节点下的一级分类
  735. if (rootNode.subdep && rootNode.subdep.length > 0) {
  736. topLevelNodes.push(...rootNode.subdep);
  737. }
  738. });
  739. });
  740. // 2. 递归处理节点
  741. const processNode = (node) => {
  742. // 创建新节点副本
  743. const newNode = { ...node };
  744. // 处理子节点
  745. if (node.subdep && node.subdep.length > 0) {
  746. newNode.subdep = node.subdep.map(subNode => processNode(subNode));
  747. }
  748. return newNode;
  749. };
  750. // 3. 处理所有一级分类节点
  751. return topLevelNodes.map(node => processNode(node));
  752. }
  753. // 无BOM
  754. const keyword = ref('');
  755. function onSearch(e) {
  756. if (content.where.condition == e) return;
  757. content.where.condition = e;
  758. keyword.value = e;
  759. getList(true);
  760. }
  761. function getList(init = false) {
  762. if (isBom.value) return;
  763. if (content.loading) return;
  764. if (init) content.pageNumber = 1;
  765. content.loading = true;
  766. $Http.basic({
  767. "id": "2025080610425103",
  768. content
  769. }).then(res => {
  770. console.log("获取配件列表", res)
  771. content.loading = false;
  772. listBox.value.refreshToComplete();
  773. listBox.value.setHeight();
  774. res.data = res.data.map(item => {
  775. item.imageUrl = item.attinfos.length ? $Http.getSpecifiedImage(item.attinfos[0]) : ''
  776. return item;
  777. });
  778. if (res.code == 1) {
  779. list.value = reactive(res.firstPage ? res.data : list.value.concat(res.data));
  780. content.pageTotal = res.pageTotal;
  781. content.pageNumber = res.pageNumber;
  782. } else {
  783. if (res.msg) uni.showToast({
  784. title: res.msg,
  785. icon: 'none'
  786. });
  787. }
  788. })
  789. }
  790. </script>
  791. <style lang="scss" scoped>
  792. .bom {
  793. width: 100vw;
  794. display: flex;
  795. min-height: 100vh;
  796. .left {
  797. width: 250rpx;
  798. background: #fff;
  799. margin-right: 20rpx;
  800. flex-shrink: 0;
  801. .class1 {
  802. padding: 30rpx 30rpx;
  803. width: 250rpx;
  804. box-sizing: border-box;
  805. background: #FFFFFF;
  806. border-radius: 0rpx 8rpx 0rpx 0rpx;
  807. font-family: PingFang SC, PingFang SC;
  808. font-size: 28rpx;
  809. color: #999999;
  810. }
  811. .class1active {
  812. position: relative;
  813. background: #F7F7FF;
  814. color: #3774F6;
  815. }
  816. .class1active::after {
  817. content: '';
  818. position: absolute;
  819. left: 0;
  820. top: 0;
  821. width: 8rpx;
  822. height: 100%;
  823. background: #3774F6;
  824. }
  825. }
  826. .right {
  827. flex: 1;
  828. .select {
  829. display: flex;
  830. justify-content: space-around;
  831. align-items: center;
  832. height: 90rpx;
  833. width: 100%;
  834. background: #fff;
  835. padding-right: 30rpx;
  836. }
  837. }
  838. }
  839. .search-box {
  840. position: relative;
  841. padding: 20rpx;
  842. background: #fff;
  843. .clear {
  844. position: absolute;
  845. display: flex;
  846. align-items: center;
  847. right: 0;
  848. top: 50%;
  849. transform: translateY(-50%);
  850. width: 80rpx;
  851. padding-left: 10rpx;
  852. height: 70rpx;
  853. z-index: 2;
  854. }
  855. }
  856. .footer {
  857. position: fixed;
  858. bottom: 0;
  859. left: 0;
  860. width: 100%;
  861. height: 120rpx;
  862. padding: 10rpx 20rpx;
  863. background: #fff;
  864. box-sizing: border-box;
  865. }
  866. </style>