index.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. highlight-current-row
  10. :selectConfig="selectConfig"
  11. :table-events="{
  12. //element talbe事件都能传
  13. }"
  14. :action-list="[]"
  15. @get-list="getList"
  16. @moreSearch="() => (dialogVisibleThree = true)"
  17. >
  18. <template #contractCode="{ item }">
  19. <div
  20. style="cursor: pointer; color: #409eff"
  21. @click="handleClickContractCode(item)"
  22. >
  23. {{ item.contractCode }}
  24. </div>
  25. </template>
  26. <template #arrivalStatus="{ item }">
  27. <span
  28. style="cursor: pointer; color: #409eff"
  29. @click="handleClickArrivalStatus(item)"
  30. >
  31. {{ dictValueLabel(item.arrivalStatus, arrivalStatus) }}
  32. </span>
  33. <span v-if="item.isTransit == 1">(有在途)</span>
  34. </template>
  35. <template #btn="{ item }">
  36. <div>
  37. <el-button type="primary" link @click="handleUpdateData(item)"
  38. >修改</el-button
  39. >
  40. </div>
  41. </template>
  42. </byTable>
  43. </div>
  44. <el-dialog
  45. :title="modalType === 'add' ? '发货登记' : '到货通知'"
  46. v-model="dialogVisible"
  47. width="80%"
  48. destroy-on-close
  49. >
  50. <byForm
  51. :formConfig="formConfig"
  52. :formOption="formOption"
  53. v-model="formData.data"
  54. :rules="rules"
  55. ref="byform"
  56. v-loading="submitLoading"
  57. >
  58. <template #detailSlot>
  59. <div style="width: 100%">
  60. <el-table
  61. :data="
  62. modalType === 'add'
  63. ? formData.data.deliverGoodsDetailsList
  64. : formData.data.arrivalDetailList
  65. "
  66. >
  67. <el-table-column
  68. prop="productDefinition"
  69. label="物品类型"
  70. :formatter="
  71. (row) =>
  72. row.productDefinition == 1
  73. ? '产品'
  74. : row.productDefinition == 2
  75. ? '物料'
  76. : ''
  77. "
  78. />
  79. <el-table-column prop="productCode" label="物品编码" />
  80. <el-table-column prop="productName" label="物品名称" />
  81. <el-table-column prop="productSpec" label="规格" />
  82. <el-table-column
  83. prop="productUnit"
  84. label="单位"
  85. :formatter="
  86. (row) => dictValueLabel(row.productUnit, productUnit)
  87. "
  88. />
  89. <el-table-column prop="count" label="采购数量" />
  90. <el-table-column
  91. prop="alreadyDeliverGoodsQuantity"
  92. label="累计发货"
  93. v-if="modalType === 'add'"
  94. />
  95. <el-table-column
  96. prop="deliverGoodsQuantity"
  97. label="本次发货"
  98. min-width="150"
  99. v-if="modalType === 'add'"
  100. >
  101. <template #default="{ row, $index }">
  102. <el-form-item
  103. :prop="
  104. 'deliverGoodsDetailsList.' +
  105. $index +
  106. '.deliverGoodsQuantity'
  107. "
  108. :rules="rules.deliverGoodsQuantity"
  109. :inline-message="true"
  110. >
  111. <el-input-number
  112. v-model="row.deliverGoodsQuantity"
  113. :precision="2"
  114. :controls="false"
  115. :min="0"
  116. onmousewheel="return false;"
  117. />
  118. </el-form-item>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. prop="transitQuantity"
  123. label="剩余在途"
  124. v-if="modalType === 'edit'"
  125. />
  126. <el-table-column
  127. prop="deliverGoodsQuantity"
  128. label="本次到货"
  129. min-width="150"
  130. v-if="modalType === 'edit'"
  131. >
  132. <template #default="{ row, $index }">
  133. <el-form-item
  134. :prop="
  135. 'arrivalDetailList.' + $index + '.deliverGoodsQuantity'
  136. "
  137. :rules="rules.deliverGoodsQuantity"
  138. :inline-message="true"
  139. >
  140. <el-input-number
  141. v-model="row.deliverGoodsQuantity"
  142. :precision="2"
  143. :controls="false"
  144. :min="0"
  145. onmousewheel="return false;"
  146. />
  147. </el-form-item>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. </div>
  152. </template>
  153. </byForm>
  154. <template #footer>
  155. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  156. <el-button
  157. type="primary"
  158. @click="submitForm()"
  159. size="large"
  160. :loading="submitLoading"
  161. >
  162. 确 定
  163. </el-button>
  164. </template>
  165. </el-dialog>
  166. <el-dialog
  167. :title="'到货详情'"
  168. v-model="dialogVisibleOne"
  169. width="80%"
  170. destroy-on-close
  171. >
  172. <byForm
  173. :formConfig="formConfigOne"
  174. :formOption="formOption"
  175. v-model="formData.dataOne"
  176. :rules="rules"
  177. ref="byformOne"
  178. >
  179. <template #detailSlot>
  180. <div style="width: 100%">
  181. <el-table :data="formData.dataOne.purchaseDetailVoList">
  182. <el-table-column prop="productCustomCode" label="物品编码" />
  183. <el-table-column prop="productName" label="物品名称" />
  184. <el-table-column prop="count" label="采购数量" />
  185. <el-table-column prop="deliverGoodsQuantity" label="已发货">
  186. <template #default="{ row }">
  187. <div>
  188. <el-popover
  189. placement="bottom-start"
  190. title="发货详情"
  191. :width="500"
  192. trigger="hover"
  193. >
  194. <div default>
  195. <el-table :data="row.deliverGoodsDetailList">
  196. <el-table-column
  197. label="发货时间"
  198. prop="createTime"
  199. width="155"
  200. />
  201. <el-table-column
  202. label="物流单号"
  203. prop="logisticsCode"
  204. />
  205. <el-table-column
  206. label="数量"
  207. prop="deliverGoodsQuantity"
  208. width="100"
  209. />
  210. </el-table>
  211. </div>
  212. <template #reference>
  213. <div style="cursor: pointer; color: #0084ff">
  214. {{ row.deliverGoodsQuantity }}
  215. </div>
  216. </template>
  217. </el-popover>
  218. </div>
  219. </template>
  220. </el-table-column>
  221. <!-- <el-table-column prop="arrivalQuantity" label="已到货">
  222. <template #default="{ row }">
  223. <div>
  224. <el-popover
  225. placement="bottom-start"
  226. title="到货详情"
  227. :width="500"
  228. trigger="hover"
  229. >
  230. <div default>
  231. <el-table :data="row.arrivalDetailList">
  232. <el-table-column
  233. label="到货时间"
  234. prop="createTime"
  235. width="155"
  236. />
  237. <el-table-column
  238. label="物流单号"
  239. prop="logisticsCode"
  240. />
  241. <el-table-column
  242. label="数量"
  243. prop="count"
  244. width="100"
  245. />
  246. </el-table>
  247. </div>
  248. <template #reference>
  249. <div style="cursor: pointer; color: #0084ff">
  250. {{ row.arrivalQuantity }}
  251. </div>
  252. </template>
  253. </el-popover>
  254. </div>
  255. </template>
  256. </el-table-column> -->
  257. <el-table-column prop="receiptQuantity" label="已入库">
  258. <template #default="{ row }">
  259. <div>
  260. <el-popover
  261. placement="bottom-start"
  262. title="入库详情"
  263. :width="500"
  264. trigger="hover"
  265. >
  266. <div default>
  267. <el-table :data="row.receiptList">
  268. <el-table-column
  269. label="入库时间"
  270. prop="createTime"
  271. width="155"
  272. />
  273. <el-table-column
  274. label="入库单号"
  275. prop="logisticsCode"
  276. />
  277. <el-table-column
  278. label="数量"
  279. prop="quantity"
  280. width="100"
  281. />
  282. </el-table>
  283. </div>
  284. <template #reference>
  285. <div style="cursor: pointer; color: #0084ff">
  286. {{ row.receiptQuantity }}
  287. </div>
  288. </template>
  289. </el-popover>
  290. </div>
  291. </template>
  292. </el-table-column>
  293. <el-table-column prop="purchaseBackQuantity" label="退货">
  294. <template #default="{ row }">
  295. <div>
  296. <el-popover
  297. placement="bottom-start"
  298. title="退货详情"
  299. :width="500"
  300. trigger="hover"
  301. >
  302. <div default>
  303. <el-table :data="row.purchaseBackDetailsList">
  304. <el-table-column
  305. label="申请时间"
  306. prop="createTime"
  307. width="155"
  308. />
  309. <el-table-column label="申请数量" prop="quantity" />
  310. <el-table-column
  311. label="已退数量"
  312. prop="returnedQuantity"
  313. />
  314. <el-table-column
  315. label="操作"
  316. width="90"
  317. align="center"
  318. >
  319. <template #default="{ row, $index }">
  320. <el-button
  321. type="primary"
  322. text
  323. @click="handleClickStatus(row)"
  324. >查看关联</el-button
  325. >
  326. </template>
  327. </el-table-column>
  328. </el-table>
  329. </div>
  330. <template #reference>
  331. <div style="cursor: pointer; color: #0084ff">
  332. {{ row.purchaseBackQuantity }}
  333. </div>
  334. </template>
  335. </el-popover>
  336. </div>
  337. </template>
  338. </el-table-column>
  339. <el-table-column prop="qualityQuantity" label="已质检数量" />
  340. <el-table-column prop="noQualifiedCount" label="不合格数量" />
  341. </el-table>
  342. </div>
  343. </template>
  344. </byForm>
  345. <template #footer>
  346. <el-button @click="dialogVisibleOne = false" size="large"
  347. >取 消</el-button
  348. >
  349. </template>
  350. </el-dialog>
  351. <el-dialog
  352. :title="'采购退货'"
  353. v-model="dialogVisibleTwo"
  354. width="60%"
  355. destroy-on-close
  356. >
  357. <byForm
  358. :formConfig="formConfigTwo"
  359. :formOption="formOption"
  360. v-model="formData.dataTwo"
  361. :rules="rulesTwo"
  362. ref="byformTwo"
  363. v-loading="loadingTwo"
  364. >
  365. <template #detailSlot>
  366. <div style="width: 100%">
  367. <el-table :data="formData.dataTwo.purchaseBackDetailsList">
  368. <el-table-column
  369. prop="subscribeCode"
  370. label="申购单号"
  371. width="110"
  372. />
  373. <el-table-column
  374. prop="planArrivalTime"
  375. label="要求到货时间"
  376. width="160"
  377. />
  378. <el-table-column
  379. prop="productCustomCode"
  380. label="物品编码"
  381. width="110"
  382. />
  383. <el-table-column
  384. prop="productName"
  385. label="物品名称"
  386. width="160"
  387. />
  388. <el-table-column
  389. prop="productUnit"
  390. label="物品单位"
  391. width="80"
  392. :formatter="
  393. (row) => dictValueLabel(row.productUnit, productUnit)
  394. "
  395. />
  396. <el-table-column
  397. prop="price"
  398. label="单价"
  399. width="60"
  400. :formatter="
  401. (row) => dictValueLabel(row.productUnit, productUnit)
  402. "
  403. />
  404. <el-table-column prop="count" label="采购数量" width="100" />
  405. <el-table-column
  406. prop="defectiveQuantity"
  407. label="次品数量"
  408. width="100"
  409. />
  410. <el-table-column
  411. prop="quantity"
  412. label="退货数量"
  413. min-width="150"
  414. fixed="right"
  415. >
  416. <template #default="{ row, $index }">
  417. <el-form-item
  418. :prop="'purchaseBackDetailsList.' + $index + '.quantity'"
  419. :rules="rulesTwo.quantity"
  420. :inline-message="true"
  421. >
  422. <el-input-number
  423. v-model="row.quantity"
  424. :precision="0"
  425. :controls="false"
  426. :min="0"
  427. onmousewheel="return false;"
  428. />
  429. </el-form-item>
  430. </template>
  431. </el-table-column>
  432. </el-table>
  433. </div>
  434. </template>
  435. <template #countryId>
  436. <div>
  437. <el-select
  438. v-model="formData.dataTwo.countryId"
  439. placeholder="国家"
  440. @change="(val) => getCityData(val, '20', true)"
  441. style="width: 100%"
  442. >
  443. <el-option
  444. v-for="item in countryData"
  445. :label="item.chineseName"
  446. :value="item.id"
  447. >
  448. </el-option>
  449. </el-select>
  450. </div>
  451. </template>
  452. <template #provinceId>
  453. <div style="width: 100%">
  454. <selectCity
  455. placeholder="省/洲"
  456. @change="(val) => getCityData(val, '30', true)"
  457. addressId="provinceId"
  458. addressName="provinceName"
  459. v-model="formData.dataTwo"
  460. :data="provinceData"
  461. >
  462. </selectCity>
  463. </div>
  464. </template>
  465. <template #cityId>
  466. <div style="width: 100%">
  467. <selectCity
  468. placeholder="城市"
  469. addressId="cityId"
  470. addressName="cityName"
  471. v-model="formData.dataTwo"
  472. :data="cityData"
  473. >
  474. </selectCity>
  475. </div>
  476. </template>
  477. </byForm>
  478. <template #footer>
  479. <el-button @click="dialogVisibleTwo = false" size="large"
  480. >取 消</el-button
  481. >
  482. <el-button
  483. type="primary"
  484. @click="submitFormTwo()"
  485. size="large"
  486. :loading="loadingTwo"
  487. >
  488. 确 定
  489. </el-button>
  490. </template>
  491. </el-dialog>
  492. <el-dialog
  493. :title="'高级检索'"
  494. v-model="dialogVisibleThree"
  495. width="500px"
  496. destroy-on-close
  497. >
  498. <el-form
  499. :model="sourceList.pagination"
  500. label-width="100px"
  501. label-position="top"
  502. >
  503. <el-form-item label="采购单号">
  504. <el-input
  505. v-model="sourceList.pagination.contractCode"
  506. placeholder="请输入"
  507. />
  508. </el-form-item>
  509. <el-form-item label="供应商">
  510. <el-select
  511. v-model="sourceList.pagination.supplyId"
  512. placeholder="请选择"
  513. style="width: 100%"
  514. >
  515. <el-option
  516. v-for="item in supplierData"
  517. :label="item.name"
  518. :value="item.id"
  519. >
  520. </el-option>
  521. </el-select>
  522. </el-form-item>
  523. <el-form-item label="收货仓库">
  524. <el-select
  525. v-model="sourceList.pagination.receiptWarehouseId"
  526. placeholder="请选择"
  527. style="width: 100%"
  528. >
  529. <el-option
  530. v-for="item in warehouseList"
  531. :label="item.label"
  532. :value="item.value"
  533. >
  534. </el-option>
  535. </el-select>
  536. </el-form-item>
  537. <el-form-item label="采购金额">
  538. <el-row>
  539. <el-col :span="8">
  540. <el-input-number
  541. v-model="sourceList.pagination.startAmount"
  542. placeholder="请输入"
  543. :controls="false"
  544. :min="1"
  545. :precision="2"
  546. style="width: 100%"
  547. onmousewheel="return false;"
  548. />
  549. </el-col>
  550. <el-col :span="2" style="text-align: center"> 到 </el-col>
  551. <el-col :span="8">
  552. <el-input-number
  553. v-model="sourceList.pagination.endAmount"
  554. placeholder="请输入"
  555. :controls="false"
  556. :min="1"
  557. :precision="2"
  558. style="width: 100%"
  559. onmousewheel="return false;"
  560. />
  561. </el-col>
  562. </el-row>
  563. </el-form-item>
  564. <el-form-item label="采购人">
  565. <el-select
  566. v-model="sourceList.pagination.purchaseUserId"
  567. placeholder="请选择"
  568. style="width: 100%"
  569. >
  570. <el-option
  571. v-for="item in userList"
  572. :label="item.label"
  573. :value="item.value"
  574. >
  575. </el-option>
  576. </el-select>
  577. </el-form-item>
  578. <el-form-item label="采购时间">
  579. <!-- <el-date-picker
  580. v-model="sourceList.pagination.arr"
  581. type="datetimerange"
  582. range-separator="到"
  583. start-placeholder="请选择"
  584. end-placeholder="请选择"
  585. /> -->
  586. <el-date-picker
  587. v-model="sourceList.pagination.arr"
  588. type="daterange"
  589. range-separator="到"
  590. start-placeholder="请选择"
  591. end-placeholder="请选择"
  592. value-format="YYYY-MM-DD HH:mm:ss"
  593. />
  594. </el-form-item>
  595. <el-row>
  596. <el-col :span="7">
  597. <el-form-item label="采购状态">
  598. <el-select
  599. v-model="sourceList.pagination.purchaseStatus"
  600. placeholder="请选择"
  601. style="width: 100%"
  602. >
  603. <el-option
  604. v-for="item in statusData"
  605. :label="item.label"
  606. :value="item.value"
  607. >
  608. </el-option>
  609. </el-select>
  610. </el-form-item>
  611. </el-col>
  612. <el-col :span="1"></el-col>
  613. <el-col :span="7">
  614. <el-form-item label="到货状态">
  615. <el-select
  616. v-model="sourceList.pagination.arrivalStatus"
  617. placeholder="请选择"
  618. style="width: 100%"
  619. >
  620. <el-option
  621. v-for="item in arrivalStatus"
  622. :label="item.label"
  623. :value="item.value"
  624. >
  625. </el-option>
  626. </el-select>
  627. </el-form-item>
  628. </el-col>
  629. <el-col :span="1"></el-col>
  630. <el-col :span="7">
  631. <el-form-item label="付款状态">
  632. <el-select
  633. v-model="sourceList.pagination.payStatus"
  634. placeholder="请选择"
  635. style="width: 100%"
  636. >
  637. <el-option
  638. v-for="item in paymentStatus"
  639. :label="item.label"
  640. :value="item.value"
  641. >
  642. </el-option>
  643. </el-select>
  644. </el-form-item>
  645. </el-col>
  646. </el-row>
  647. </el-form>
  648. <template #footer>
  649. <el-button @click="handleReset" size="large">重置</el-button>
  650. <el-button @click="handleQuery" type="primary" size="large"
  651. >搜索</el-button
  652. >
  653. </template>
  654. </el-dialog>
  655. <el-dialog
  656. :title="'查看'"
  657. v-model="recordDialog"
  658. width="900"
  659. destroy-on-close
  660. >
  661. <byForm
  662. :formConfig="recordFormConfig"
  663. :formOption="recordFormOption"
  664. v-model="recordFormData.data"
  665. >
  666. <template #products>
  667. <div style="width: 100%">
  668. <el-table :data="recordFormData.data.list">
  669. <el-table-column
  670. prop="logisticsCompanyName"
  671. label="物流/快递公司"
  672. />
  673. <el-table-column prop="code" label="物流/快递单号" />
  674. <el-table-column
  675. prop="logisticsStatus"
  676. label="物流状态"
  677. width="100"
  678. :formatter="(row) => handleShowKdStatus(row.logisticsStatus)"
  679. />
  680. <el-table-column prop="createTime" label="创建时间" width="155" />
  681. <el-table-column label="操作" width="90" align="center">
  682. <template #default="{ row, $index }">
  683. <el-button type="primary" text @click="pushKdRoute(row)"
  684. >查看</el-button
  685. >
  686. </template>
  687. </el-table-column>
  688. </el-table>
  689. </div>
  690. </template>
  691. </byForm>
  692. <template #footer>
  693. <el-button @click="recordDialog = false" size="large">取 消</el-button>
  694. </template>
  695. </el-dialog>
  696. <!-- <el-drawer v-model="dialogVisibleThree" direction="rtl">
  697. <template #header>
  698. <h4>高级检索</h4>
  699. </template>
  700. <template #default>
  701. <byForm
  702. :formConfig="formConfig"
  703. :formOption="ListOption"
  704. v-model="sourceList.pagination"
  705. >
  706. <template #slot> 可自定义所需功能 </template>
  707. </byForm>
  708. </template>
  709. <template #footer>
  710. <div style="flex: auto">
  711. <el-button @click="handleReset" size="large">重置</el-button>
  712. <el-button @click="handleQuery" type="primary" size="large"
  713. >搜索</el-button
  714. >
  715. </div>
  716. </template>
  717. </el-drawer> -->
  718. <el-dialog
  719. :title="'修改合同'"
  720. v-model="purchaseDialog"
  721. width="1200"
  722. destroy-on-close
  723. >
  724. <byForm
  725. :formConfig="purchaseFormConfig"
  726. :formOption="formOption"
  727. v-model="formData.purchaseData"
  728. :rules="purchaseFormRules"
  729. ref="purchaseDom"
  730. >
  731. <template #details>
  732. <div style="width: 100%">
  733. <el-table :data="formData.purchaseData.purchaseDetailList">
  734. <el-table-column
  735. prop="productDefinition"
  736. label="物品类型"
  737. :formatter="
  738. (row) =>
  739. row.productDefinition == 1
  740. ? '产品'
  741. : row.productDefinition == 2
  742. ? '物料'
  743. : ''
  744. "
  745. width="100"
  746. />
  747. <el-table-column
  748. prop="productCustomCode"
  749. label="物品编码"
  750. min-width="150"
  751. />
  752. <el-table-column
  753. prop="productName"
  754. label="物品名称"
  755. min-width="160"
  756. />
  757. <el-table-column
  758. prop="productUnit"
  759. label="单位"
  760. :formatter="
  761. (row) => dictValueLabel(row.productUnit, productUnit)
  762. "
  763. width="80"
  764. />
  765. <el-table-column prop="count" label="采购数量" width="100" />
  766. <el-table-column prop="price" label="单价" min-width="150">
  767. <template #default="{ row, $index }">
  768. <el-form-item
  769. :prop="'purchaseDetailList.' + $index + '.price'"
  770. :rules="purchaseFormRules.price"
  771. :inline-message="true"
  772. >
  773. <el-input-number
  774. :model-value="
  775. formData.purchaseData.purchaseDetailList[$index].price
  776. "
  777. :precision="4"
  778. :controls="false"
  779. :min="0"
  780. onmousewheel="return false;"
  781. @change="(val) => handleChangeMoney(val, $index, 'price')"
  782. />
  783. </el-form-item>
  784. </template>
  785. </el-table-column>
  786. <el-table-column prop="amount" label="金额" width="120" />
  787. </el-table>
  788. </div>
  789. </template>
  790. <template #otherDetails>
  791. <div style="width: 100%">
  792. <el-table :data="formData.purchaseData.otherFeeList">
  793. <el-table-column prop="name" label="费用名称" min-width="150">
  794. <template #default="{ row, $index }">
  795. <el-form-item
  796. :prop="'otherFeeList.' + $index + '.name'"
  797. :rules="purchaseFormRules.name"
  798. :inline-message="true"
  799. >
  800. <el-input v-model="row.name" placeholder="请输入" />
  801. </el-form-item>
  802. </template>
  803. </el-table-column>
  804. <el-table-column prop="price" label="金额" min-width="150">
  805. <template #default="{ row, $index }">
  806. <el-form-item
  807. :prop="'otherFeeList.' + $index + '.price'"
  808. :rules="purchaseFormRules.price"
  809. :inline-message="true"
  810. >
  811. <el-input-number
  812. v-model="row.price"
  813. :precision="4"
  814. :controls="false"
  815. onmousewheel="return false;"
  816. @change="handleChangeAmount"
  817. />
  818. </el-form-item>
  819. </template>
  820. </el-table-column>
  821. <el-table-column prop="remark" label="备注" min-width="150">
  822. <template #default="{ row, $index }">
  823. <el-form-item
  824. :prop="'otherFeeList.' + $index + '.remark'"
  825. :inline-message="true"
  826. >
  827. <el-input v-model="row.remark" placeholder="请输入" />
  828. </el-form-item>
  829. </template>
  830. </el-table-column>
  831. </el-table>
  832. </div>
  833. </template>
  834. <template #fileSlot>
  835. <div style="width: 100%">
  836. <el-upload
  837. v-model:fileList="fileList"
  838. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  839. :data="uploadData"
  840. multiple
  841. :before-upload="handleBeforeUpload"
  842. :on-success="handleSuccess"
  843. :on-preview="onPreviewFile"
  844. >
  845. <el-button disabled>选择</el-button>
  846. </el-upload>
  847. </div>
  848. </template>
  849. </byForm>
  850. <template #footer>
  851. <el-button @click="purchaseDialog = false" size="large"
  852. >取 消</el-button
  853. >
  854. <el-button
  855. type="primary"
  856. @click="submitUpdate()"
  857. size="large"
  858. :loading="loadingTwo"
  859. >
  860. 确 定
  861. </el-button>
  862. </template>
  863. </el-dialog>
  864. </div>
  865. </template>
  866. <script setup>
  867. import { ElMessage, ElMessageBox } from "element-plus";
  868. import byTable from "@/components/byTable/index";
  869. import byForm from "@/components/byForm/index";
  870. import { computed } from "vue";
  871. import selectCity from "@/components/selectCity/index.vue";
  872. import useUserStore from "@/store/modules/user";
  873. const loading = ref(false);
  874. const loadingTwo = ref(false);
  875. const submitLoading = ref(false);
  876. const sourceList = ref({
  877. data: [],
  878. pagination: {
  879. total: 3,
  880. pageNum: 1,
  881. pageSize: 10,
  882. arr: [],
  883. },
  884. });
  885. const dialogVisible = ref(false);
  886. const dialogVisibleOne = ref(false);
  887. const dialogVisibleTwo = ref(false);
  888. const dialogVisibleThree = ref(false);
  889. const modalType = ref("add");
  890. let rules = ref({
  891. deliverGoodsId: [
  892. { required: true, message: "请选择快递单号", trigger: "change" },
  893. ],
  894. logisticsCompanyCode: [
  895. { required: true, message: "请选择物流公司", trigger: "change" },
  896. ],
  897. code: [{ required: true, message: "请输入物流/快递单号", trigger: "blur" }],
  898. deliverGoodsQuantity: [
  899. { required: true, message: "请输入本次发货", trigger: "blur" },
  900. ],
  901. aa: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
  902. });
  903. let rulesTwo = ref({
  904. contacts: [{ required: true, message: "请输入收件人", trigger: "blur" }],
  905. phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
  906. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  907. quantity: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
  908. detailedAddress: [
  909. { required: true, message: "请输入详细地址", trigger: "blur" },
  910. ],
  911. });
  912. const { proxy } = getCurrentInstance();
  913. const arrivalStatus = [
  914. {
  915. label: "未到货",
  916. value: "0",
  917. },
  918. {
  919. label: "部分到货",
  920. value: "10",
  921. },
  922. {
  923. label: "已到货",
  924. value: "20",
  925. },
  926. ];
  927. const statusData = ref([
  928. {
  929. label: "审批中",
  930. value: "10",
  931. },
  932. {
  933. label: "驳回",
  934. value: "20",
  935. },
  936. {
  937. label: "已采购",
  938. value: "30",
  939. },
  940. {
  941. label: "结束",
  942. value: "99",
  943. },
  944. {
  945. label: "已作废",
  946. value: "88",
  947. },
  948. ]);
  949. const paymentStatus = ref([
  950. {
  951. label: "未付款",
  952. value: "0",
  953. },
  954. {
  955. label: "部分付款",
  956. value: "10",
  957. },
  958. {
  959. label: "已付款",
  960. value: "20",
  961. },
  962. {
  963. label: "付款结束",
  964. value: "30",
  965. },
  966. ]);
  967. const inRransitData = ref([
  968. {
  969. label: "有在途",
  970. value: "1",
  971. },
  972. {
  973. label: "无在途",
  974. value: "0",
  975. },
  976. ]);
  977. const deptData = ref([]);
  978. const selectConfig = computed(() => [
  979. {
  980. label: "采购状态",
  981. prop: "purchaseStatus",
  982. data: statusData.value,
  983. },
  984. {
  985. label: "到货状态",
  986. prop: "arrivalStatus",
  987. data: arrivalStatus,
  988. },
  989. {
  990. label: "付款状态",
  991. prop: "payStatus",
  992. data: paymentStatus.value,
  993. },
  994. {
  995. label: "有无在途",
  996. prop: "isTransit",
  997. data: inRransitData.value,
  998. },
  999. {
  1000. label: "项目组",
  1001. prop: "deptId",
  1002. data: deptData.value,
  1003. },
  1004. ]);
  1005. const config = computed(() => {
  1006. return [
  1007. {
  1008. attrs: {
  1009. label: "采购单号",
  1010. prop: "contractCode",
  1011. slot: "contractCode",
  1012. },
  1013. },
  1014. {
  1015. attrs: {
  1016. label: "供应商",
  1017. prop: "supplyName",
  1018. },
  1019. },
  1020. {
  1021. attrs: {
  1022. label: "收货仓库",
  1023. prop: "receiptWarehouseName",
  1024. width: 140,
  1025. },
  1026. },
  1027. {
  1028. attrs: {
  1029. label: "采购金额",
  1030. prop: "amount",
  1031. width: 120,
  1032. },
  1033. render(amount) {
  1034. return proxy.moneyFormat(amount, 2);
  1035. },
  1036. },
  1037. {
  1038. attrs: {
  1039. label: "采购人",
  1040. prop: "purchaseName",
  1041. width: 130,
  1042. },
  1043. },
  1044. {
  1045. attrs: {
  1046. label: "项目组",
  1047. prop: "deptName",
  1048. width: 150,
  1049. },
  1050. },
  1051. {
  1052. attrs: {
  1053. label: "采购时间",
  1054. prop: "createTime",
  1055. width: 160,
  1056. },
  1057. },
  1058. {
  1059. attrs: {
  1060. label: "采购状态",
  1061. prop: "purchaseStatus",
  1062. width: 100,
  1063. },
  1064. render(status) {
  1065. const current = statusData.value.find((x) => x.value == status);
  1066. if (current) return current.label;
  1067. },
  1068. },
  1069. {
  1070. attrs: {
  1071. label: "到货状态",
  1072. prop: "arrivalStatus",
  1073. slot: "arrivalStatus",
  1074. width: 100,
  1075. },
  1076. },
  1077. {
  1078. attrs: {
  1079. label: "付款状态",
  1080. prop: "payStatus",
  1081. width: 100,
  1082. },
  1083. render(status) {
  1084. return proxy.dictValueLabel(status, paymentStatus.value);
  1085. },
  1086. },
  1087. {
  1088. attrs: {
  1089. label: "操作",
  1090. slot: "btn",
  1091. width: "80",
  1092. align: "center",
  1093. fixed: "right",
  1094. },
  1095. },
  1096. ];
  1097. });
  1098. let formData = reactive({
  1099. data: {},
  1100. dataOne: {},
  1101. dataTwo: {},
  1102. purchaseData: {},
  1103. });
  1104. const formOption = reactive({
  1105. inline: true,
  1106. labelWidth: 100,
  1107. itemWidth: 100,
  1108. });
  1109. const byform = ref(null);
  1110. const byformTwo = ref(null);
  1111. let formConfig = reactive([]);
  1112. let formConfigOne = computed(() => [
  1113. {
  1114. type: "title",
  1115. title: "基础信息",
  1116. },
  1117. {
  1118. type: "input",
  1119. prop: "supplyName",
  1120. label: "供应商",
  1121. disabled: true,
  1122. itemWidth: 50,
  1123. },
  1124. {
  1125. type: "input",
  1126. prop: "purchaseCode",
  1127. label: "采购单号",
  1128. disabled: true,
  1129. itemWidth: 50,
  1130. },
  1131. {
  1132. type: "title",
  1133. title: "采购明细",
  1134. },
  1135. {
  1136. type: "slot",
  1137. slotName: "detailSlot",
  1138. label: "",
  1139. },
  1140. ]);
  1141. let formConfigTwo = computed(() => [
  1142. {
  1143. type: "title",
  1144. title: "基础信息",
  1145. },
  1146. {
  1147. type: "input",
  1148. prop: "supplyName",
  1149. label: "供应商",
  1150. disabled: true,
  1151. itemWidth: 50,
  1152. },
  1153. {
  1154. type: "input",
  1155. prop: "purchaseCode",
  1156. label: "采购单号",
  1157. disabled: true,
  1158. itemWidth: 50,
  1159. },
  1160. {
  1161. type: "title",
  1162. title: "采购明细",
  1163. },
  1164. {
  1165. type: "slot",
  1166. slotName: "detailSlot",
  1167. label: "",
  1168. },
  1169. {
  1170. type: "title",
  1171. title: "收货信息",
  1172. },
  1173. {
  1174. type: "input",
  1175. prop: "contacts",
  1176. label: "收件人",
  1177. itemWidth: 20,
  1178. placeholder: "收件人",
  1179. },
  1180. {
  1181. type: "input",
  1182. prop: "phone",
  1183. label: " ",
  1184. itemWidth: 80,
  1185. placeholder: "联系电话",
  1186. style: {
  1187. width: "30%",
  1188. },
  1189. },
  1190. {
  1191. type: "slot",
  1192. slotName: "countryId",
  1193. prop: "countryId",
  1194. label: "收件地址",
  1195. itemWidth: 33.33,
  1196. },
  1197. {
  1198. type: "slot",
  1199. slotName: "provinceId",
  1200. label: " ",
  1201. itemWidth: 33.33,
  1202. },
  1203. {
  1204. type: "slot",
  1205. slotName: "cityId",
  1206. prop: "cityId",
  1207. label: " ",
  1208. itemWidth: 33.33,
  1209. },
  1210. {
  1211. type: "input",
  1212. itemType: "textarea",
  1213. prop: "detailedAddress",
  1214. },
  1215. ]);
  1216. const logisticsData = ref([]);
  1217. const getLogisticsData = (row) => {
  1218. proxy.post("/companyInfo/list", { pageNum: 1, pageSize: 999 }).then((res) => {
  1219. logisticsData.value = res.reverse();
  1220. logisticsData.value = logisticsData.value.map((x) => ({
  1221. label: x.name,
  1222. value: x.code,
  1223. }));
  1224. });
  1225. };
  1226. const configData = computed(() => [
  1227. [
  1228. {
  1229. type: "title",
  1230. title: "基础信息",
  1231. },
  1232. {
  1233. type: "input",
  1234. prop: "supplyName",
  1235. label: "供应商",
  1236. disabled: true,
  1237. itemWidth: 50,
  1238. },
  1239. {
  1240. type: "input",
  1241. prop: "purchaseCode",
  1242. label: "采购单号",
  1243. disabled: true,
  1244. itemWidth: 50,
  1245. },
  1246. {
  1247. type: "select",
  1248. label: "物流信息",
  1249. prop: "logisticsCompanyCode",
  1250. filterable: true,
  1251. data: logisticsData.value,
  1252. itemWidth: 50,
  1253. style: {
  1254. width: "100%",
  1255. },
  1256. },
  1257. {
  1258. type: "input",
  1259. label: " ",
  1260. prop: "code",
  1261. placeholder: "物流/快递单号",
  1262. itemWidth: 50,
  1263. },
  1264. {
  1265. type: "title",
  1266. title: "发货明细",
  1267. },
  1268. {
  1269. type: "slot",
  1270. slotName: "detailSlot",
  1271. label: "",
  1272. },
  1273. ],
  1274. [
  1275. {
  1276. type: "title",
  1277. title: "基础信息",
  1278. },
  1279. {
  1280. type: "input",
  1281. prop: "supplyName",
  1282. label: "供应商",
  1283. disabled: true,
  1284. itemWidth: 50,
  1285. },
  1286. {
  1287. type: "input",
  1288. prop: "purchaseCode",
  1289. label: "采购单号",
  1290. disabled: true,
  1291. itemWidth: 50,
  1292. },
  1293. {
  1294. type: "select",
  1295. label: "物流/快递单号",
  1296. prop: "deliverGoodsId",
  1297. itemWidth: 50,
  1298. style: {
  1299. width: "100%",
  1300. },
  1301. },
  1302. {
  1303. type: "title",
  1304. title: "发货明细",
  1305. },
  1306. {
  1307. type: "slot",
  1308. slotName: "detailSlot",
  1309. label: "",
  1310. },
  1311. ],
  1312. ]);
  1313. const deliverData = ref([]);
  1314. const getList = async (req) => {
  1315. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  1316. loading.value = true;
  1317. proxy
  1318. .post("/purchase/pageByWdly", sourceList.value.pagination)
  1319. .then((message) => {
  1320. sourceList.value.data = message.rows.map((x) => ({
  1321. ...x,
  1322. ...JSON.parse(x.victoriatouristJson),
  1323. }));
  1324. sourceList.value.pagination.total = message.total;
  1325. setTimeout(() => {
  1326. loading.value = false;
  1327. }, 200);
  1328. });
  1329. };
  1330. const submitForm = () => {
  1331. byform.value.handleSubmit((valid) => {
  1332. if (modalType.value === "add") {
  1333. const list = formData.data.deliverGoodsDetailsList;
  1334. const total = list.reduce(
  1335. (total, x) => (total += Number(x.deliverGoodsQuantity)),
  1336. 0
  1337. );
  1338. if (!(total > 0)) {
  1339. return ElMessage({
  1340. message: `本次发货不能为0!`,
  1341. type: "info",
  1342. });
  1343. }
  1344. // for (let i = 0; i < list.length; i++) {
  1345. // const e = list[i];
  1346. // if (
  1347. // Number(e.alreadyDeliverGoodsQuantity) +
  1348. // Number(e.deliverGoodsQuantity) >
  1349. // Number(e.count)
  1350. // ) {
  1351. // return ElMessage({
  1352. // message: `本次发货加累计发货不可大于采购数量!`,
  1353. // type: "info",
  1354. // });
  1355. // }
  1356. // }
  1357. submitLoading.value = true;
  1358. formData.data.deliverGoodsDetailsList = list.map((x) => ({
  1359. purchaseDetailId: x.purchaseDetailId,
  1360. deliverGoodsQuantity: x.deliverGoodsQuantity,
  1361. }));
  1362. proxy.post("/deliverGoods/add", formData.data).then((res) => {
  1363. ElMessage({
  1364. message: `操作成功!`,
  1365. type: "success",
  1366. });
  1367. dialogVisible.value = false;
  1368. submitLoading.value = false;
  1369. getList();
  1370. });
  1371. } else if (modalType.value === "edit") {
  1372. submitLoading.value = true;
  1373. formData.data.arrivalDetailList = formData.data.arrivalDetailList.map(
  1374. (x) => ({
  1375. bussinessId: x.bussinessId,
  1376. purchaseDetailId: x.purchaseDetailId,
  1377. deliverGoodsDetailsId: x.deliverGoodsDetailsId,
  1378. count: x.deliverGoodsQuantity,
  1379. })
  1380. );
  1381. const victoriatouristJson = {
  1382. deliverGoodsId: formData.data.deliverGoodsId,
  1383. logisticsCompanyCode: formData.data.logisticsCompanyCode,
  1384. code: formData.data.code,
  1385. };
  1386. formData.data.victoriatouristJson = JSON.stringify(victoriatouristJson);
  1387. proxy.post("/arrival/addByWdly", formData.data).then((res) => {
  1388. ElMessage({
  1389. message: `操作成功!`,
  1390. type: "success",
  1391. });
  1392. dialogVisible.value = false;
  1393. submitLoading.value = false;
  1394. getList();
  1395. });
  1396. }
  1397. });
  1398. };
  1399. const submitFormTwo = () => {
  1400. byformTwo.value.handleSubmit((valid) => {
  1401. loadingTwo.value = true;
  1402. let submitData = { ...formData.dataTwo };
  1403. submitData.purchaseBackDetailsList = submitData.purchaseBackDetailsList.map(
  1404. (x) => ({
  1405. purchaseDetailsId: x.id,
  1406. productId: x.bussinessId,
  1407. quantity: x.quantity,
  1408. })
  1409. );
  1410. proxy.post("/purchaseBack/add", submitData).then(
  1411. (res) => {
  1412. ElMessage({
  1413. message: `操作成功!`,
  1414. type: "success",
  1415. });
  1416. dialogVisibleTwo.value = false;
  1417. loadingTwo.value = false;
  1418. getList();
  1419. },
  1420. (err) => {
  1421. loadingTwo.value = false;
  1422. }
  1423. );
  1424. });
  1425. };
  1426. const getDtl = (row) => {
  1427. modalType.value = "edit";
  1428. proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
  1429. formData.data = res;
  1430. dialogVisible.value = true;
  1431. });
  1432. };
  1433. const handleEdit = (row, status) => {
  1434. let purchaseStatusName = status == 88 ? "作废" : "结束";
  1435. const data = { ...row, purchaseStatus: status };
  1436. // 弹窗提示是否删除
  1437. ElMessageBox.confirm(
  1438. `此操作将${purchaseStatusName}该数据, 是否继续?`,
  1439. "提示",
  1440. {
  1441. confirmButtonText: "确定",
  1442. cancelButtonText: "取消",
  1443. type: "warning",
  1444. }
  1445. ).then(() => {
  1446. // 删除
  1447. proxy.post("/purchase/edit", data).then((res) => {
  1448. ElMessage({
  1449. message: `${purchaseStatusName}成功`,
  1450. type: "success",
  1451. });
  1452. getList();
  1453. });
  1454. });
  1455. };
  1456. const handleArrival = (row, type) => {
  1457. modalType.value = type;
  1458. if (type === "add") {
  1459. formConfig = configData.value[0];
  1460. proxy.post("/deliverGoodsDetails/detail", { id: row.id }).then((res) => {
  1461. formData.data = {
  1462. purchaseId: row.id,
  1463. supplyName: row.supplyName,
  1464. purchaseCode: row.contractCode,
  1465. supplyId: res.supplyId,
  1466. code: "",
  1467. logisticsCompanyCode: "",
  1468. deliverGoodsDetailsList: res.map((x) => ({
  1469. ...x,
  1470. purchaseDetailId: x.id,
  1471. alreadyDeliverGoodsQuantity: x.deliverGoodsQuantity,
  1472. deliverGoodsQuantity:
  1473. Number(x.count) - Number(x.deliverGoodsQuantity),
  1474. })),
  1475. };
  1476. dialogVisible.value = true;
  1477. });
  1478. } else if (type === "edit") {
  1479. formConfig = configData.value[1];
  1480. proxy.post("/deliverGoods/list", { id: row.id }).then((res) => {
  1481. deliverData.value = res;
  1482. formConfig[3].data = res.map((x) => ({
  1483. ...x,
  1484. label: x.code,
  1485. value: x.id,
  1486. }));
  1487. formData.data = {
  1488. purchaseId: row.id,
  1489. supplyName: row.supplyName,
  1490. purchaseCode: row.contractCode,
  1491. supplyId: row.supplyId,
  1492. code: "",
  1493. logisticsCompanyCode: "",
  1494. deliverGoodsId: "",
  1495. arrivalDetailList: [],
  1496. };
  1497. dialogVisible.value = true;
  1498. });
  1499. }
  1500. };
  1501. watch(
  1502. () => formData.data.deliverGoodsId,
  1503. (val) => {
  1504. if (val) {
  1505. const current = deliverData.value.find((x) => x.id === val);
  1506. formData.data.logisticsCompanyCode = current
  1507. ? current.logisticsCompanyCode
  1508. : "";
  1509. formData.data.code = current ? current.code : "";
  1510. proxy.post("/deliverGoods/detail", { id: val }).then((res) => {
  1511. formData.data.arrivalDetailList = res.map((x) => ({
  1512. count: x.count,
  1513. productName: x.name,
  1514. productSpec: x.spec,
  1515. productUnit: x.unit,
  1516. productType: x.type,
  1517. productCode: x.code,
  1518. bussinessId: x.productId,
  1519. purchaseDetailId: x.purchaseDetailId,
  1520. deliverGoodsDetailsId: x.id,
  1521. transitQuantity: x.transitQuantity,
  1522. deliverGoodsQuantity: x.deliverGoodsQuantity,
  1523. productDefinition: x.definition,
  1524. }));
  1525. });
  1526. }
  1527. }
  1528. );
  1529. const handleClickContractCode = (row) => {
  1530. proxy.$router.replace({
  1531. path: "/platform_manage/process/processApproval",
  1532. query: {
  1533. flowKey: row.processInstanceId,
  1534. id: row.flowId,
  1535. businessId: row.id,
  1536. processType: 20,
  1537. random: proxy.random(),
  1538. },
  1539. });
  1540. };
  1541. const handleClickArrivalStatus = (row) => {
  1542. proxy
  1543. .post("/deliverGoods/arrivalDetail", { purchaseId: row.id })
  1544. .then((res) => {
  1545. formData.dataOne = {
  1546. supplyName: row.supplyName,
  1547. purchaseCode: row.contractCode,
  1548. purchaseDetailVoList: res.purchaseDetailVoList,
  1549. };
  1550. dialogVisibleOne.value = true;
  1551. });
  1552. };
  1553. const handleReturnGoods = (row) => {
  1554. proxy.post("/purchase/detail", { id: row.id }).then((res) => {
  1555. formData.dataTwo = {
  1556. purchaseId: row.id,
  1557. supplyName: row.supplyName,
  1558. purchaseCode: row.contractCode,
  1559. countryId: "44",
  1560. purchaseBackDetailsList: res.purchaseDetailList.map((x) => ({
  1561. ...x,
  1562. planArrivalTime: res.planArrivalTime,
  1563. subscribeCode: res.subscribeCode,
  1564. })),
  1565. };
  1566. getCityData(formData.dataTwo.countryId, "20");
  1567. dialogVisibleTwo.value = true;
  1568. });
  1569. };
  1570. const countryData = ref([]);
  1571. const provinceData = ref([]);
  1572. const cityData = ref([]);
  1573. const getCityData = (id, type, flag) => {
  1574. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1575. if (type === "20") {
  1576. provinceData.value = res;
  1577. if (flag) {
  1578. formData.data.provinceId = "";
  1579. formData.data.provinceName = "";
  1580. formData.data.cityId = "";
  1581. formData.data.cityName = "";
  1582. }
  1583. } else if (type === "30") {
  1584. cityData.value = res;
  1585. if (flag) {
  1586. formData.data.cityId = "";
  1587. formData.data.cityName = "";
  1588. }
  1589. } else {
  1590. countryData.value = res;
  1591. }
  1592. });
  1593. };
  1594. const productUnit = ref([]);
  1595. const fundsPaymentMethod = ref([]);
  1596. const supplierData = ref([]);
  1597. const warehouseList = ref([]);
  1598. const userList = ref([]);
  1599. const getDict = () => {
  1600. proxy.getDictOne(["unit", "funds_payment_method"]).then((res) => {
  1601. productUnit.value = res["unit"].map((x) => ({
  1602. label: x.dictValue,
  1603. value: x.dictKey,
  1604. }));
  1605. fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
  1606. label: x.dictValue,
  1607. value: x.dictKey,
  1608. }));
  1609. });
  1610. proxy
  1611. .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
  1612. .then((res) => {
  1613. supplierData.value = res.rows;
  1614. });
  1615. proxy.get("/purchase/getDepts").then((res) => {
  1616. deptData.value = res.data.map((x) => ({
  1617. ...x,
  1618. label: x.deptName,
  1619. value: x.deptId,
  1620. }));
  1621. });
  1622. proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1623. if (res.rows && res.rows.length > 0) {
  1624. warehouseList.value = res.rows.map((item) => {
  1625. return {
  1626. label: item.name,
  1627. value: item.id,
  1628. };
  1629. });
  1630. }
  1631. });
  1632. proxy
  1633. .get("/tenantUser/list", {
  1634. pageNum: 1,
  1635. pageSize: 10000,
  1636. tenantId: useUserStore().user.tenantId,
  1637. })
  1638. .then((res) => {
  1639. userList.value = res.rows.map((item) => {
  1640. return {
  1641. label: item.nickName,
  1642. value: item.userId,
  1643. };
  1644. });
  1645. });
  1646. };
  1647. getCityData("0");
  1648. getList();
  1649. getLogisticsData();
  1650. getDict();
  1651. const handleQuery = () => {
  1652. if (
  1653. sourceList.value.pagination.arr &&
  1654. sourceList.value.pagination.arr.length > 1
  1655. ) {
  1656. sourceList.value.pagination.purchaseStartTime =
  1657. sourceList.value.pagination.arr[0];
  1658. sourceList.value.pagination.purchaseEndTime =
  1659. sourceList.value.pagination.arr[1];
  1660. }
  1661. dialogVisibleThree.value = false;
  1662. getList();
  1663. };
  1664. const handleReset = () => {
  1665. sourceList.value.pagination = {
  1666. pageNum: sourceList.value.pagination.pageNum,
  1667. pageSize: sourceList.value.pagination.pageSize,
  1668. arr: [],
  1669. };
  1670. handleQuery();
  1671. };
  1672. const kdStatusData = ref([
  1673. {
  1674. label: "在途",
  1675. value: "0",
  1676. },
  1677. {
  1678. label: "揽收",
  1679. value: "1",
  1680. },
  1681. {
  1682. label: "疑难",
  1683. value: "2",
  1684. },
  1685. {
  1686. label: "签收",
  1687. value: "3",
  1688. },
  1689. {
  1690. label: "退签",
  1691. value: "4",
  1692. },
  1693. {
  1694. label: "派件",
  1695. value: "5",
  1696. },
  1697. {
  1698. label: "退回",
  1699. value: "6",
  1700. },
  1701. {
  1702. label: "转投",
  1703. value: "7",
  1704. },
  1705. {
  1706. label: "清关",
  1707. value: "8",
  1708. },
  1709. {
  1710. label: "拒签",
  1711. value: "14",
  1712. },
  1713. {
  1714. label: "完成",
  1715. value: "15",
  1716. },
  1717. ]);
  1718. const recordDialog = ref(false);
  1719. const recordFormOption = reactive({
  1720. disabled: false,
  1721. inline: true,
  1722. labelWidth: 100,
  1723. itemWidth: 100,
  1724. rules: [],
  1725. });
  1726. const recordFormConfig = reactive([
  1727. {
  1728. type: "title",
  1729. title: "物流数据",
  1730. },
  1731. {
  1732. type: "slot",
  1733. slotName: "products",
  1734. },
  1735. ]);
  1736. const recordFormData = reactive({
  1737. data: {
  1738. list: [],
  1739. },
  1740. });
  1741. const handleClickStatus = (row) => {
  1742. recordDialog.value = true;
  1743. proxy
  1744. .post("/purchaseBack/getLogisticsInfo", { id: row.purchaseBackId })
  1745. .then((res) => {
  1746. recordFormData.data.list = res;
  1747. });
  1748. };
  1749. const handleShowKdStatus = (status) => {
  1750. const current = kdStatusData.value.find((x) => x.value === status);
  1751. if (current && current.label) {
  1752. return current.label;
  1753. } else {
  1754. return "异常";
  1755. }
  1756. };
  1757. const pushKdRoute = (row) => {
  1758. proxy.$router.push({
  1759. name: "Logistics",
  1760. query: {
  1761. keyword: row.code,
  1762. },
  1763. });
  1764. };
  1765. const purchaseDialog = ref(false);
  1766. const fileList = ref([]);
  1767. const purchaseDom = ref(null);
  1768. const purchaseFormConfig = computed(() => [
  1769. {
  1770. type: "title",
  1771. title: "基础信息",
  1772. },
  1773. {
  1774. type: "input",
  1775. prop: "deptName",
  1776. label: "采购部门",
  1777. disabled: true,
  1778. itemWidth: 25,
  1779. },
  1780. {
  1781. type: "input",
  1782. prop: "purchaseName",
  1783. label: "采购人",
  1784. disabled: true,
  1785. itemWidth: 25,
  1786. },
  1787. {
  1788. type: "date",
  1789. itemType: "datetime",
  1790. prop: "purchaseName",
  1791. label: "采购时间",
  1792. disabled: true,
  1793. itemWidth: 25.01,
  1794. style: {
  1795. width: "100%",
  1796. },
  1797. },
  1798. {
  1799. type: "select",
  1800. label: "供应商",
  1801. prop: "supplyId",
  1802. filterable: true,
  1803. data: supplierData.value,
  1804. disabled: true,
  1805. itemWidth: 25,
  1806. style: {
  1807. width: "100%",
  1808. },
  1809. },
  1810. {
  1811. type: "select",
  1812. label: "是否合同",
  1813. prop: "isAgreement",
  1814. data: [
  1815. {
  1816. label: "是",
  1817. value: "1",
  1818. },
  1819. {
  1820. label: "否",
  1821. value: "0",
  1822. },
  1823. ],
  1824. disabled: true,
  1825. itemWidth: 25,
  1826. style: {
  1827. width: "100%",
  1828. },
  1829. },
  1830. {
  1831. type: "select",
  1832. label: "付款方式",
  1833. prop: "paymentMethod",
  1834. data: fundsPaymentMethod.value,
  1835. itemWidth: 25,
  1836. disabled: true,
  1837. style: {
  1838. width: "100%",
  1839. },
  1840. },
  1841. {
  1842. type: "input",
  1843. label: "采购单号",
  1844. prop: "contractCode",
  1845. disabled: true,
  1846. itemWidth: 25,
  1847. },
  1848. {
  1849. type: "input",
  1850. itemType: "textarea",
  1851. label: "采购说明",
  1852. prop: "purchaseContent",
  1853. disabled: true,
  1854. itemWidth: 50,
  1855. },
  1856. {
  1857. type: "title",
  1858. title: "采购明细",
  1859. },
  1860. {
  1861. type: "slot",
  1862. slotName: "details",
  1863. label: "",
  1864. },
  1865. {
  1866. type: "title",
  1867. title: "其他费用",
  1868. },
  1869. {
  1870. type: "slot",
  1871. slotName: "otherDetails",
  1872. label: "",
  1873. },
  1874. {
  1875. type: "number",
  1876. prop: "freight",
  1877. label: "运费",
  1878. itemWidth: 25,
  1879. precision: 2,
  1880. min: -9999999,
  1881. controls: false,
  1882. fn: () => handleChangeAmount(),
  1883. style: {
  1884. width: "100%",
  1885. },
  1886. },
  1887. {
  1888. type: "number",
  1889. prop: "preferential",
  1890. label: "优惠",
  1891. itemWidth: 25,
  1892. precision: 2,
  1893. min: -9999999,
  1894. controls: false,
  1895. fn: () => handleChangeAmount(),
  1896. style: {
  1897. width: "100%",
  1898. },
  1899. },
  1900. {
  1901. type: "input",
  1902. prop: "amount",
  1903. label: "采购总金额",
  1904. disabled: true,
  1905. itemWidth: 100,
  1906. style: {
  1907. width: "25%",
  1908. },
  1909. },
  1910. {
  1911. type: "slot",
  1912. slotName: "fileSlot",
  1913. label: "附件",
  1914. },
  1915. ]);
  1916. const purchaseFormRules = ref({
  1917. name: [{ required: true, message: "请输入费用名称", trigger: "blur" }],
  1918. price: [{ required: true, message: "请输入单价/金额", trigger: "blur" }],
  1919. freight: [{ required: true, message: "请输入运费", trigger: "blur" }],
  1920. preferential: [{ required: true, message: "请输入优惠", trigger: "blur" }],
  1921. });
  1922. const handleUpdateData = (row) => {
  1923. let val = row.id;
  1924. purchaseDialog.value = true;
  1925. proxy
  1926. .post("/purchase/detail", {
  1927. id: val,
  1928. })
  1929. .then((res) => {
  1930. let jsonData = {};
  1931. if (res.victoriatouristJson) {
  1932. jsonData = JSON.parse(res.victoriatouristJson);
  1933. }
  1934. formData.purchaseData = { ...res, ...jsonData };
  1935. formData.purchaseData.purchaseDetailList =
  1936. formData.purchaseData.purchaseDetailList.map((x) => ({
  1937. ...x,
  1938. subscribeCount: x.subscribeQuantity,
  1939. purchaseCount: x.purchaseQuantity,
  1940. }));
  1941. });
  1942. proxy.post("/fileInfo/getList", { businessIdList: [val] }).then((fileObj) => {
  1943. formData.purchaseData.fileList = fileObj[val] || [];
  1944. if (
  1945. formData.purchaseData.fileList &&
  1946. formData.purchaseData.fileList.length > 0
  1947. ) {
  1948. fileList.value = formData.purchaseData.fileList.map((item) => {
  1949. return {
  1950. raw: item,
  1951. name: item.fileName,
  1952. url: item.fileUrl,
  1953. };
  1954. });
  1955. }
  1956. });
  1957. };
  1958. // 计算采购总金额
  1959. const handleChangeAmount = () => {
  1960. let sum = 0;
  1961. for (let i = 0; i < formData.purchaseData.purchaseDetailList.length; i++) {
  1962. const e = formData.purchaseData.purchaseDetailList[i];
  1963. // e.amount = parseFloat(e.count * e.price).toFixed(4);
  1964. sum += Number(e.amount);
  1965. }
  1966. for (let i = 0; i < formData.purchaseData.otherFeeList.length; i++) {
  1967. const e = formData.purchaseData.otherFeeList[i];
  1968. sum += Number(e.price);
  1969. }
  1970. sum += formData.purchaseData.freight;
  1971. sum += formData.purchaseData.preferential;
  1972. formData.purchaseData.amount = parseFloat(sum).toFixed(4);
  1973. };
  1974. const handleChangeMoney = (val, index, key) => {
  1975. formData.purchaseData.purchaseDetailList[index][key] = val;
  1976. for (let i = 0; i < formData.purchaseData.purchaseDetailList.length; i++) {
  1977. formData.purchaseData.purchaseDetailList[i].amount = parseFloat(
  1978. formData.purchaseData.purchaseDetailList[i].count *
  1979. formData.purchaseData.purchaseDetailList[i].price
  1980. ).toFixed(4);
  1981. }
  1982. handleChangeAmount();
  1983. };
  1984. const onPreviewFile = (file) => {
  1985. window.open(file.raw.fileUrl, "_blank");
  1986. };
  1987. const submitUpdate = () => {
  1988. purchaseDom.value.handleSubmit(() => {
  1989. loadingTwo.value = true;
  1990. const data = proxy.deepClone(formData.purchaseData);
  1991. const jsonData = JSON.parse(data.victoriatouristJson);
  1992. const victoriatouristJson = {
  1993. ...jsonData,
  1994. otherFeeList: data.otherFeeList,
  1995. freight: data.freight,
  1996. preferential: data.preferential,
  1997. };
  1998. data.victoriatouristJson = JSON.stringify(victoriatouristJson);
  1999. proxy.post("/purchase/purchaseCorrect", data).then((res) => {
  2000. ElMessage({
  2001. message: `操作成功`,
  2002. type: "success",
  2003. });
  2004. purchaseDialog.value = false;
  2005. loadingTwo.value = false;
  2006. getList();
  2007. });
  2008. });
  2009. };
  2010. </script>
  2011. <style lang="scss" scoped>
  2012. .tenant {
  2013. padding: 20px;
  2014. }
  2015. </style>