index.vue 58 KB

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