index.vue 58 KB

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