asn.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705
  1. <template>
  2. <div>
  3. <transition appear enter-active-class="animated fadeIn">
  4. <q-table
  5. class="my-sticky-header-column-table shadow-24"
  6. :data="table_list"
  7. row-key="id"
  8. :separator="separator"
  9. :loading="loading"
  10. :columns="columns"
  11. hide-bottom
  12. :pagination.sync="pagination"
  13. no-data-label="No data"
  14. no-results-label="No data you want"
  15. :table-style="{ height: height }"
  16. flat
  17. bordered
  18. >
  19. <template v-slot:top>
  20. <q-btn-group push>
  21. <q-btn
  22. :label="$t('new')"
  23. icon="add"
  24. @click="
  25. newForm = true;
  26. newFormData.creater = login_name;
  27. "
  28. >
  29. <q-tooltip
  30. content-class="bg-amber text-black shadow-4"
  31. :offset="[10, 10]"
  32. content-style="font-size: 12px"
  33. >{{ $t("newtip") }}</q-tooltip
  34. >
  35. </q-btn>
  36. <q-btn :label="$t('refresh')" icon="refresh" @click="reFresh()">
  37. <q-tooltip
  38. content-class="bg-amber text-black shadow-4"
  39. :offset="[10, 10]"
  40. content-style="font-size: 12px"
  41. >{{ $t("refreshtip") }}</q-tooltip
  42. >
  43. </q-btn>
  44. </q-btn-group>
  45. <q-space />
  46. <div class="flex items-center">
  47. <q-input
  48. outlined
  49. rounded
  50. dense
  51. debounce="200"
  52. color="primary"
  53. v-model="filter"
  54. :placeholder="'输入名称搜索'"
  55. @input="getSearchList()"
  56. @keyup.enter="getSearchList()"
  57. >
  58. <template v-slot:append>
  59. <q-icon name="search" />
  60. </template>
  61. </q-input>
  62. </div>
  63. </template>
  64. <template v-slot:body="props">
  65. <q-tr :props="props">
  66. <template v-if="props.row.id === editid">
  67. <q-td key="detail" :props="props">
  68. <q-btn
  69. round
  70. flat
  71. push
  72. color="black"
  73. icon="description"
  74. @click="detailData(props.row)"
  75. >
  76. <q-tooltip
  77. content-class="bg-amber text-black shadow-4"
  78. :offset="[10, 10]"
  79. content-style="font-size: 12px"
  80. >{{ "查看批次详情" }}</q-tooltip
  81. >
  82. </q-btn>
  83. </q-td>
  84. </template>
  85. <template v-else-if="props.row.id !== editid">
  86. <q-td key="detail" :props="props">
  87. <q-btn
  88. round
  89. flat
  90. push
  91. color="black"
  92. icon="description"
  93. @click="detailData(props.row)"
  94. >
  95. <q-tooltip
  96. content-class="bg-amber text-black shadow-4"
  97. :offset="[10, 10]"
  98. content-style="font-size: 12px"
  99. >{{ "查看批次详情" }}</q-tooltip
  100. >
  101. </q-btn>
  102. </q-td>
  103. </template>
  104. <template v-if="props.row.id === editid">
  105. <q-td key="bound_date" :props="props">{{
  106. props.row.bound_date
  107. }}</q-td>
  108. </template>
  109. <template v-else-if="props.row.id !== editid">
  110. <q-td key="bound_date" :props="props">{{
  111. props.row.bound_date
  112. }}</q-td>
  113. </template>
  114. <template v-if="props.row.id === editid">
  115. <q-td key="bound_code" :props="props">{{
  116. props.row.bound_code
  117. }}</q-td>
  118. </template>
  119. <template v-else-if="props.row.id !== editid">
  120. <q-td key="bound_code" :props="props">{{
  121. props.row.bound_code
  122. }}</q-td>
  123. </template>
  124. <template v-if="props.row.id === editid">
  125. <q-td key="bound_code_type" :props="props">
  126. <q-select
  127. dense
  128. outlined
  129. square
  130. v-model="editFormData.bound_code_type"
  131. :label="'单据类型'"
  132. autofocus
  133. :options="bound_code_type_list"
  134. option-label="label"
  135. option-value="value"
  136. emit-value
  137. map-options
  138. transition-show="scale"
  139. transition-hide="scale"
  140. :rules="[(val) => (val && val.length > 0) || error1]"
  141. />
  142. </q-td>
  143. </template>
  144. <template v-else-if="props.row.id !== editid">
  145. <q-td key="bound_code_type" :props="props">
  146. {{
  147. bound_code_type_map[props.row.bound_code_type] ||
  148. props.row.bound_code_type
  149. }}</q-td
  150. >
  151. </template>
  152. <template v-if="props.row.id === editid">
  153. <q-td key="bound_bs_type" :props="props">
  154. <q-select
  155. dense
  156. outlined
  157. square
  158. v-model="editFormData.bound_bs_type"
  159. :label="'单据类型'"
  160. :options="bound_bs_type_list"
  161. option-label="label"
  162. option-value="value"
  163. emit-value
  164. map-options
  165. transition-show="scale"
  166. transition-hide="scale"
  167. :rules="[(val) => (val && val.length > 0) || error1]"
  168. />
  169. </q-td>
  170. </template>
  171. <template v-else-if="props.row.id !== editid">
  172. <q-td key="bound_bs_type" :props="props">
  173. {{
  174. bound_bs_type_map[props.row.bound_bs_type] ||
  175. props.row.bound_bs_type
  176. }}</q-td
  177. >
  178. </template>
  179. <template v-if="props.row.id === editid">
  180. <q-td key="bound_desc" :props="props">
  181. <q-select
  182. dense
  183. outlined
  184. square
  185. v-model="editFormData.bound_desc"
  186. :label="'出入库类别'"
  187. :options="bound_desc_list"
  188. option-label="label"
  189. option-value="value"
  190. emit-value
  191. map-options
  192. transition-show="scale"
  193. transition-hide="scale"
  194. :rules="[(val) => (val && val.length > 0) || error1]"
  195. />
  196. </q-td>
  197. </template>
  198. <template v-else-if="props.row.id !== editid">
  199. <q-td key="bound_desc" :props="props">
  200. {{
  201. bound_desc_map[props.row.bound_desc] || props.row.bound_desc
  202. }}</q-td
  203. >
  204. </template>
  205. <template v-if="props.row.id === editid">
  206. <q-td key="bound_department" :props="props">
  207. <q-select
  208. dense
  209. outlined
  210. square
  211. v-model="editFormData.bound_department"
  212. :label="'部门'"
  213. :options="bound_department_list"
  214. option-label="label"
  215. option-value="value"
  216. emit-value
  217. map-options
  218. transition-show="scale"
  219. transition-hide="scale"
  220. :rules="[(val) => (val && val.length > 0) || error1]"
  221. />
  222. </q-td>
  223. </template>
  224. <template v-else-if="props.row.id !== editid">
  225. <q-td key="bound_department" :props="props">
  226. {{
  227. bound_department_map[props.row.bound_department] ||
  228. props.row.bound_department
  229. }}</q-td
  230. >
  231. </template>
  232. <template v-if="props.row.id === editid">
  233. <q-td key="creater" :props="props">
  234. <q-input
  235. dense
  236. outlined
  237. square
  238. v-model.number="editFormData.creater"
  239. :label="'经办人'"
  240. :rules="[(val) => (val && val > 0) || error1]"
  241. />
  242. </q-td>
  243. </template>
  244. <template v-else-if="props.row.id !== editid">
  245. <q-td key="creater" :props="props">{{ props.row.creater }}</q-td>
  246. </template>
  247. <template v-if="props.row.id === editid">
  248. <q-td key="bound_status" :props="props">
  249. {{
  250. bound_status_map[props.row.bound_status] ||
  251. props.row.bound_status
  252. }}</q-td
  253. >
  254. </template>
  255. <template v-else-if="props.row.id !== editid">
  256. <q-td key="bound_status" :props="props">
  257. {{
  258. bound_status_map[props.row.bound_status] ||
  259. props.row.bound_status
  260. }}</q-td
  261. >
  262. </template>
  263. <template v-if="!editMode">
  264. <q-td key="action" :props="props" style="width: 100px">
  265. <q-btn
  266. round
  267. flat
  268. push
  269. color="dark"
  270. icon="trolley"
  271. @click="change_status(props.row)"
  272. >
  273. <q-tooltip
  274. content-class="bg-amber text-black shadow-4"
  275. :offset="[10, 10]"
  276. content-style="font-size: 12px"
  277. >一键分拣</q-tooltip
  278. >
  279. </q-btn>
  280. </q-td>
  281. </template>
  282. <template v-else-if="editMode">
  283. <template v-if="props.row.id === editid">
  284. <q-td key="action" :props="props" style="width: 100px">
  285. <q-btn
  286. round
  287. flat
  288. push
  289. color="secondary"
  290. icon="check"
  291. @click="editDataSubmit()"
  292. >
  293. <q-tooltip
  294. content-class="bg-amber text-black shadow-4"
  295. :offset="[10, 10]"
  296. content-style="font-size: 12px"
  297. >{{ $t("confirmedit") }}</q-tooltip
  298. >
  299. </q-btn>
  300. <q-btn
  301. round
  302. flat
  303. push
  304. color="red"
  305. icon="close"
  306. @click="editDataCancel()"
  307. >
  308. <q-tooltip
  309. content-class="bg-amber text-black shadow-4"
  310. :offset="[10, 10]"
  311. content-style="font-size: 12px"
  312. >{{ $t("canceledit") }}</q-tooltip
  313. >
  314. </q-btn>
  315. </q-td>
  316. </template>
  317. <template v-else-if="props.row.id !== editid"></template>
  318. </template>
  319. </q-tr>
  320. </template>
  321. </q-table>
  322. </transition>
  323. <template>
  324. <div v-show="max !== 0" class="q-pa-lg flex flex-center">
  325. <div>{{ total }}</div>
  326. <q-pagination
  327. v-model="current"
  328. color="black"
  329. :max="max"
  330. :max-pages="6"
  331. boundary-links
  332. @click="
  333. getSearchList(current);
  334. paginationIpt = current;
  335. "
  336. />
  337. <div>
  338. <input
  339. v-model="paginationIpt"
  340. @blur="changePageEnter"
  341. @keyup.enter="changePageEnter"
  342. style="width: 60px; text-align: center"
  343. />
  344. </div>
  345. </div>
  346. <div v-show="max === 0" class="q-pa-lg flex flex-center">
  347. <q-btn flat push color="dark" :label="$t('no_data')"></q-btn>
  348. </div>
  349. </template>
  350. <q-dialog v-model="newForm">
  351. <q-card class="shadow-24">
  352. <q-bar
  353. class="bg-light-blue-10 text-white rounded-borders"
  354. style="height: 50px"
  355. >
  356. <div>{{ $t("newtip") }}</div>
  357. <q-space />
  358. <q-btn dense flat icon="close" v-close-popup>
  359. <q-tooltip content-class="bg-amber text-black shadow-4">{{
  360. $t("index.close")
  361. }}</q-tooltip>
  362. </q-btn>
  363. </q-bar>
  364. <q-card-section style="max-height: 325px; width: 400px" class="scroll">
  365. <q-select
  366. dense
  367. outlined
  368. square
  369. v-model="newFormData.bound_code_type"
  370. :label="'单据类型'"
  371. autofocus
  372. :options="bound_code_type_list"
  373. option-label="label"
  374. option-value="value"
  375. emit-value
  376. map-options
  377. transition-show="scale"
  378. transition-hide="scale"
  379. :rules="[(val) => (val && val.length > 0) || error1]"
  380. />
  381. <q-select
  382. dense
  383. outlined
  384. square
  385. v-model="newFormData.bound_bs_type"
  386. :label="'业务类型'"
  387. :options="bound_bs_type_list"
  388. option-label="label"
  389. option-value="value"
  390. emit-value
  391. map-options
  392. transition-show="scale"
  393. transition-hide="scale"
  394. :rules="[(val) => (val && val.length > 0) || error1]"
  395. />
  396. <q-select
  397. dense
  398. outlined
  399. square
  400. v-model="newFormData.bound_desc"
  401. :label="'出入库类别'"
  402. :options="bound_desc_list"
  403. option-label="label"
  404. option-value="value"
  405. emit-value
  406. map-options
  407. transition-show="scale"
  408. transition-hide="scale"
  409. :rules="[(val) => (val && val.length > 0) || error1]"
  410. />
  411. <q-select
  412. dense
  413. outlined
  414. square
  415. v-model="newFormData.bound_department"
  416. :label="'部门'"
  417. :options="bound_department_list"
  418. option-label="label"
  419. option-value="value"
  420. emit-value
  421. map-options
  422. transition-show="scale"
  423. transition-hide="scale"
  424. :rules="[(val) => (val && val.length > 0) || error1]"
  425. />
  426. <q-input
  427. dense
  428. outlined
  429. square
  430. v-model="newFormData.creater"
  431. :label="'经办人'"
  432. :rules="[(val) => (val && val.length > 0) || error1]"
  433. />
  434. </q-card-section>
  435. <div style="float: right; padding: 15px 15px 15px 0">
  436. <q-btn
  437. color="white"
  438. text-color="black"
  439. style="margin-right: 25px"
  440. @click="newDataCancel()"
  441. >{{ $t("cancel") }}</q-btn
  442. >
  443. <q-btn color="primary" @click="newDataSubmit()">{{
  444. $t("submit")
  445. }}</q-btn>
  446. </div>
  447. </q-card>
  448. </q-dialog>
  449. <q-dialog v-model="deleteForm">
  450. <q-card class="shadow-24">
  451. <q-bar
  452. class="bg-light-blue-10 text-white rounded-borders"
  453. style="height: 50px"
  454. >
  455. <div>{{ $t("delete") }}</div>
  456. <q-space />
  457. <q-btn dense flat icon="close" v-close-popup>
  458. <q-tooltip>{{ $t("index.close") }}</q-tooltip>
  459. </q-btn>
  460. </q-bar>
  461. <q-card-section
  462. style="max-height: 325px; width: 400px"
  463. class="scroll"
  464. >{{ $t("deletetip") }}</q-card-section
  465. >
  466. <div style="float: right; padding: 15px 15px 15px 0">
  467. <q-btn
  468. color="white"
  469. text-color="black"
  470. style="margin-right: 25px"
  471. @click="deleteDataCancel()"
  472. >{{ $t("cancel") }}</q-btn
  473. >
  474. <q-btn color="primary" @click="deleteDataSubmit()">{{
  475. $t("submit")
  476. }}</q-btn>
  477. </div>
  478. </q-card>
  479. </q-dialog>
  480. <q-dialog v-model="newBatchForm">
  481. <q-card class="shadow-24">
  482. <q-bar
  483. class="bg-light-blue-10 text-white rounded-borders"
  484. style="height: 50px"
  485. >
  486. <div>{{ "新建批次" }}</div>
  487. <q-space />
  488. <q-btn dense flat icon="close" v-close-popup>
  489. <q-tooltip content-class="bg-amber text-black shadow-4">{{
  490. $t("index.close")
  491. }}</q-tooltip>
  492. </q-btn>
  493. </q-bar>
  494. <q-card-section style="min-height: 325px; width: 500px" class="scroll">
  495. <div class="text-h6 q-mb-md">{{ "批次信息" }}</div>
  496. <div class="row q-gutter-x-md">
  497. <div class="col column q-gutter-y-md">
  498. <q-select
  499. dense
  500. outlined
  501. square
  502. v-model="newBatchFormData.goods_code"
  503. :label="'物料编码'"
  504. :options="product_list"
  505. option-label="value"
  506. option-value="value"
  507. emit-value
  508. map-options
  509. transition-show="scale"
  510. transition-hide="scale"
  511. :rules="[(val) => (val && val.length > 0) || error1]"
  512. />
  513. </div>
  514. <div class="col column q-gutter-y-md">
  515. <q-input
  516. outlined
  517. dense
  518. color="primary"
  519. v-model="product_filter"
  520. :placeholder="'搜索名称'"
  521. autofocus
  522. @input="getProductSearchList()"
  523. @keyup.enter="getProductSearchList()"
  524. >
  525. <template v-slot:append>
  526. <q-icon name="search" />
  527. </template>
  528. </q-input>
  529. </div>
  530. </div>
  531. <q-select
  532. dense
  533. outlined
  534. square
  535. v-model="newBatchFormData.goods_code"
  536. :label="'物料'"
  537. :options="product_list"
  538. option-label="label"
  539. option-value="value"
  540. emit-value
  541. map-options
  542. :readonly="true"
  543. transition-show="scale"
  544. transition-hide="scale"
  545. :rules="[(val) => (val && val.length > 0) || error1]"
  546. />
  547. <q-input
  548. dense
  549. outlined
  550. square
  551. v-model="newBatchFormData.goods_desc"
  552. :label="'名称'"
  553. :rules="[(val) => (val && val.length > 0) || error1]"
  554. />
  555. <div class="row q-gutter-x-md">
  556. <div class="col column q-gutter-y-md">
  557. <q-input
  558. dense
  559. outlined
  560. square
  561. v-model.number="newBatchFormData.goods_weight"
  562. :label="'单重'"
  563. type="number"
  564. :rules="[(val) => (val && val > 0) || error1]"
  565. />
  566. <q-input
  567. dense
  568. outlined
  569. square
  570. v-model="newBatchFormData.goods_std"
  571. :label="'规格/备注'"
  572. :rules="[(val) => (val && val.length > 0) || error1]"
  573. />
  574. </div>
  575. <div class="col column q-gutter-y-md">
  576. <q-input
  577. dense
  578. outlined
  579. square
  580. v-model="newBatchFormData.goods_unit"
  581. :label="'单位'"
  582. :rules="[(val) => (val && val.length > 0) || error1]"
  583. />
  584. <q-toggle
  585. v-model="isorder"
  586. :label="isorder ? '自动编码' : '手动编码(建议)'"
  587. />
  588. </div>
  589. </div>
  590. <q-input
  591. v-show="!isorder"
  592. dense
  593. outlined
  594. square
  595. v-model.number="newBatchFormData.bound_batch_order"
  596. :label="'批号——年月第几批(20250409)'"
  597. type="number"
  598. :rules="[(val) => (val && val > 0) || error1]"
  599. />
  600. <q-input
  601. dense
  602. outlined
  603. square
  604. v-model.number="newBatchFormData.goods_qty"
  605. :label="'数量'"
  606. type="number"
  607. :rules="[(val) => (val && val > 0) || error1]"
  608. />
  609. <q-input
  610. dense
  611. outlined
  612. square
  613. v-model="newBatchFormData.creater"
  614. :label="'经办人'"
  615. :rules="[(val) => (val && val.length > 0) || error1]"
  616. />
  617. </q-card-section>
  618. <div style="float: right; padding: 15px 15px 15px 0">
  619. <q-btn
  620. color="white"
  621. text-color="black"
  622. style="margin-right: 25px"
  623. @click="newBatchCancel()"
  624. >{{ $t("cancel") }}</q-btn
  625. >
  626. <q-btn color="primary" @click="newBatchSubmit()">{{
  627. $t("submit")
  628. }}</q-btn>
  629. </div>
  630. </q-card>
  631. </q-dialog>
  632. <q-dialog
  633. v-model="detailForm"
  634. transition-show="jump-down"
  635. transition-hide="jump-up"
  636. >
  637. <q-card style="min-width: 900px">
  638. <q-bar
  639. class="bg-light-blue-10 text-white rounded-borders"
  640. style="height: 50px"
  641. >
  642. <div>
  643. {{ "批次信息" }}
  644. </div>
  645. <q-space></q-space>
  646. <q-btn dense flat icon="close" v-close-popup>
  647. <q-tooltip
  648. content-class="bg-amber text-black shadow-4"
  649. :offset="[20, 20]"
  650. content-style="font-size: 12px"
  651. >
  652. {{ $t("index.close") }}</q-tooltip
  653. >
  654. </q-btn>
  655. </q-bar>
  656. <q-card-section class="q-pt-md">
  657. <q-tabs v-model="activeTab">
  658. <q-tab name="tab1" label="入库信息" />
  659. <!-- <q-tab name="tab2" label="货物信息" /> -->
  660. </q-tabs>
  661. </q-card-section>
  662. <!-- 选项卡内容 -->
  663. <q-tab-panels v-model="activeTab" animated>
  664. <q-tab-panel name="tab1" style="height: 70px">
  665. <div class="row q-gutter-x-md">
  666. <div class="col column q-gutter-y-md">
  667. <q-input
  668. dense
  669. outlined
  670. square
  671. v-model="table_detail.bound_date"
  672. :label="'单据时间'"
  673. :readonly="true"
  674. />
  675. </div>
  676. <div class="col column q-gutter-y-md">
  677. <q-input
  678. dense
  679. outlined
  680. square
  681. v-model="table_detail.bound_code"
  682. :label="'单据编码'"
  683. :readonly="true"
  684. />
  685. </div>
  686. </div>
  687. </q-tab-panel>
  688. </q-tab-panels>
  689. <div
  690. style="float: right; padding: 15px 15px 50px 15px; min-width: 100%"
  691. flow="row wrap"
  692. >
  693. <q-card class="q-mb-md" bordered>
  694. <q-card-actions
  695. class="q-px-none"
  696. style="position: absolute; right: 20px; top: 10px; z-index: 100"
  697. >
  698. <q-btn
  699. icon="add"
  700. flat
  701. dense
  702. color="primary"
  703. @click="addbatch(table_detail.id)"
  704. :label="$t('stock.add')"
  705. />
  706. </q-card-actions>
  707. <q-card-section>
  708. <template>
  709. <div class="text-h6 q-mb-md">{{ "批次信息" }}</div>
  710. <template v-if="batch_detail.length > 0">
  711. <div
  712. v-for="(item, index) in batch_detail"
  713. :key="index"
  714. class="row q-col-gutter-md q-mb-sm"
  715. >
  716. <div class="col-1">
  717. <!-- 修改打印按钮,使用v-print指令 -->
  718. <q-btn
  719. icon="print"
  720. flat
  721. v-print="getPrintConfig(item)"
  722. @click="setCurrentBatch(item)"
  723. >
  724. <q-tooltip>打印条码</q-tooltip>
  725. </q-btn>
  726. </div>
  727. <div class="col-3">
  728. <q-input
  729. v-model="item.bound_batch.sourced_number"
  730. :label="'批次'"
  731. :readonly="onlyread"
  732. dense
  733. outlined
  734. />
  735. </div>
  736. <div class="col-4">
  737. <q-input
  738. v-model="item.bound_batch.goods_desc"
  739. :label="'货物'"
  740. :readonly="onlyread"
  741. dense
  742. outlined
  743. />
  744. </div>
  745. <div class="col-2">
  746. <q-input
  747. v-model="item.bound_batch.goods_qty"
  748. :label="'数量'"
  749. :readonly="onlyread"
  750. dense
  751. outlined
  752. />
  753. </div>
  754. <div class="col-2">
  755. <q-input
  756. v-model="item.bound_batch.goods_unit"
  757. :label="'单位'"
  758. :readonly="onlyread"
  759. dense
  760. outlined
  761. />
  762. </div>
  763. <!-- <div class="col" style="max-width: 50px">
  764. <q-btn
  765. v-if="!onlyread"
  766. icon="delete"
  767. flat
  768. dense
  769. color="primary"
  770. @click="addbatch(table_detail.id)"
  771. style="margin-top: 1px"
  772. />
  773. </div> -->
  774. </div>
  775. </template>
  776. </template>
  777. </q-card-section>
  778. </q-card>
  779. </div>
  780. </q-card>
  781. </q-dialog>
  782. <div id="printBarcode" class="print-area">
  783. <div class="q-pa-md text-center" style="flex: none">
  784. <div class="row no-wrap">
  785. <div class="col text-left">
  786. <p style="font-weight: 500">{{ currentgoods.goods_desc }}</p>
  787. </div>
  788. <div class="col text-right">
  789. <p>
  790. 数量: {{ currentgoods.goods_qty }}{{ currentgoods.goods_unit }}
  791. </p>
  792. </div>
  793. </div>
  794. <svg ref="barcodeElement" style="width: 100%; height: auto"></svg>
  795. </div>
  796. </div>
  797. </div>
  798. </template>
  799. <router-view />
  800. <script>
  801. import { getauth, postauth, putauth, deleteauth } from 'boot/axios_request'
  802. import JsBarcode from 'jsbarcode'
  803. import { date, exportFile, LocalStorage, QToggle } from 'quasar'
  804. export default {
  805. components: {
  806. QToggle
  807. },
  808. name: 'Pageasnlist',
  809. data () {
  810. return {
  811. createDate1: '',
  812. createDate2: '',
  813. date_range: '',
  814. proxyDate: '',
  815. date: '',
  816. goods_code: '',
  817. goods_desc: '',
  818. openid: '',
  819. login_name: '',
  820. authin: '0',
  821. warehouse_code: '',
  822. warehouse_name: '',
  823. searchUrl: '',
  824. pathname: 'bound/list/',
  825. pathfilename: 'bound/file/',
  826. pathname_previous: '',
  827. pathname_next: '',
  828. separator: 'cell',
  829. loading: false,
  830. height: '',
  831. printObj: {
  832. id: 'printMe',
  833. popTitle: this.$t('inbound.asn')
  834. },
  835. table_list: [],
  836. table_detail: {},
  837. batch_detail: [],
  838. bound_code_type_list: [],
  839. bound_code_type_map: [],
  840. bound_bs_type_list: [],
  841. bound_bs_type_map: [],
  842. bound_desc_list: [],
  843. bound_desc_map: [],
  844. bound_department_list: [],
  845. bound_department_map: [],
  846. bound_status_list: [],
  847. bound_status_map: [],
  848. product_list: [],
  849. product_map: [],
  850. columns: [
  851. { name: 'detail', label: '详情', field: 'detail', align: 'center' },
  852. {
  853. name: 'bound_date',
  854. label: '单据日期',
  855. field: 'bound_date',
  856. align: 'center'
  857. },
  858. {
  859. name: 'bound_code',
  860. label: '单据编号',
  861. field: 'bound_code',
  862. align: 'center'
  863. },
  864. {
  865. name: 'bound_code_type',
  866. label: '单据类型',
  867. field: 'bound_code_type',
  868. align: 'center'
  869. },
  870. {
  871. name: 'bound_bs_type',
  872. label: '业务类型',
  873. field: 'bound_bs_type',
  874. align: 'center'
  875. },
  876. {
  877. name: 'bound_desc',
  878. label: '出入库类别',
  879. field: 'bound_desc',
  880. align: 'center'
  881. },
  882. {
  883. name: 'bound_department',
  884. label: '部门',
  885. field: 'bound_department',
  886. align: 'center'
  887. },
  888. { name: 'creater', label: '经办人', field: 'creater', align: 'center' },
  889. {
  890. name: 'bound_status',
  891. label: '状态',
  892. field: 'bound_status',
  893. align: 'center'
  894. },
  895. { name: 'action', label: '操作', align: 'center' }
  896. ],
  897. filter: '',
  898. product_filter: '',
  899. pagination: {
  900. page: 1,
  901. rowsPerPage: 11
  902. },
  903. newForm: false,
  904. newBatchForm: false,
  905. newFormData: {},
  906. newBatchFormData: {},
  907. newDetailFormData: {},
  908. editid: 0,
  909. editFormData: {},
  910. editMode: false,
  911. deleteForm: false,
  912. detailForm: false,
  913. deleteid: 0,
  914. detailid: 0,
  915. bar_code: '',
  916. error1: this.$t('goods.view_goodslist.error1'),
  917. max: 0,
  918. total: 0,
  919. paginationIpt: 1,
  920. current: 1,
  921. onlyread: true,
  922. bound_batch_list: [],
  923. activeTab: 'tab1',
  924. isorder: false,
  925. order: 'false',
  926. currentBarcode: '',
  927. printConfig: {
  928. id: 'printBarcode'
  929. },
  930. currentBarcode: null,
  931. currentgoods: {}
  932. }
  933. },
  934. computed: {
  935. interval () {
  936. return (
  937. this.$t('download_center.start') +
  938. ' - ' +
  939. this.$t('download_center.end')
  940. )
  941. }
  942. },
  943. methods: {
  944. setCurrentBatch (item) {
  945. this.currentBarcode = item.bound_batch?.bound_number || ''
  946. this.currentgoods = item.bound_batch
  947. },
  948. getPrintConfig () {
  949. this.generateBarcode()
  950. return {
  951. id: 'printBarcode'
  952. }
  953. },
  954. generateBarcode () {
  955. this.$refs.barcodeElement.innerHTML = ''
  956. try {
  957. JsBarcode(this.$refs.barcodeElement, this.currentBarcode, {
  958. format: 'CODE128',
  959. displayValue: true,
  960. fontSize: 16,
  961. height: 60,
  962. margin: 10
  963. })
  964. } catch (error) {
  965. console.error('条码生成失败:', error)
  966. }
  967. },
  968. getList (params = {}) {
  969. var _this = this
  970. _this.loading = true
  971. // 合并基础参数
  972. const baseParams = {
  973. page: _this.current,
  974. base_type: '0',
  975. page_size: _this.pagination.rowsPerPage
  976. }
  977. // 创建URLSearchParams处理参数
  978. const queryParams = new URLSearchParams({
  979. ...baseParams,
  980. ...params
  981. })
  982. console.log(queryParams)
  983. // 过滤空值参数
  984. Array.from(queryParams.entries()).forEach(([key, value]) => {
  985. if (value === '' || value === null || value === undefined) {
  986. queryParams.delete(key)
  987. }
  988. })
  989. getauth(`${_this.pathname}?${queryParams}`)
  990. .then((res) => {
  991. _this.table_list = res.results
  992. _this.total = res.count
  993. _this.max = Math.ceil(res.count / _this.pagination.rowsPerPage) || 0
  994. _this.pathname_previous = res.previous
  995. _this.pathname_next = res.next
  996. })
  997. .catch((err) => {
  998. _this.$q.notify({
  999. message: err.detail,
  1000. icon: 'close',
  1001. color: 'negative'
  1002. })
  1003. })
  1004. .finally(() => {
  1005. _this.loading = false
  1006. })
  1007. },
  1008. changePageEnter () {
  1009. if (Number(this.paginationIpt) < 1) {
  1010. this.current = 1
  1011. this.paginationIpt = 1
  1012. } else if (Number(this.paginationIpt) > this.max) {
  1013. this.current = this.max
  1014. this.paginationIpt = this.max
  1015. } else {
  1016. this.current = Number(this.paginationIpt)
  1017. }
  1018. this.getSearchList(this.current)
  1019. },
  1020. getProductSearchList () {
  1021. var _this = this
  1022. _this.loading = true
  1023. const params = {
  1024. product_name__icontains: _this.product_filter,
  1025. max_page: 1000
  1026. }
  1027. const queryParams = new URLSearchParams({
  1028. ...params
  1029. })
  1030. console.log(queryParams)
  1031. // 过滤空值参数
  1032. Array.from(queryParams.entries()).forEach(([key, value]) => {
  1033. if (value === '' || value === null || value === undefined) {
  1034. queryParams.delete(key)
  1035. }
  1036. })
  1037. console.log(`warehouse/product/?${queryParams}`)
  1038. getauth(`warehouse/product/?${queryParams}`)
  1039. .then((res) => {
  1040. _this.product_list = res.results.map((item) => ({
  1041. label: item.product_name,
  1042. value: item.product_code
  1043. }))
  1044. _this.product_map = res.results.reduce((acc, item) => {
  1045. acc[item.product_code] = item.product_name
  1046. return acc
  1047. }, {})
  1048. })
  1049. .catch((err) => {
  1050. _this.$q.notify({
  1051. message: err.detail,
  1052. icon: 'close',
  1053. color: 'negative'
  1054. })
  1055. })
  1056. .finally(() => {
  1057. _this.loading = false
  1058. })
  1059. },
  1060. // 带搜索条件加载
  1061. getSearchList (page = 1) {
  1062. this.current = page
  1063. this.paginationIpt = page
  1064. this.getList({
  1065. goods_desc__icontains: this.filter,
  1066. document_date__range: this.date_range
  1067. })
  1068. },
  1069. downloadlistData () {
  1070. this.getfileList()
  1071. },
  1072. getfileList () {
  1073. var _this = this
  1074. _this.loading = true
  1075. const params = {
  1076. goods_desc__icontains: _this.filter,
  1077. document_date__range: _this.date_range
  1078. }
  1079. const queryParams = new URLSearchParams({
  1080. ...params
  1081. })
  1082. console.log(queryParams)
  1083. // 过滤空值参数
  1084. Array.from(queryParams.entries()).forEach(([key, value]) => {
  1085. if (value === '' || value === null || value === undefined) {
  1086. queryParams.delete(key)
  1087. }
  1088. })
  1089. console.log(`${_this.pathfilename}?${queryParams}`)
  1090. getauth(`${_this.pathfilename}?${queryParams}`)
  1091. .then((res) => {
  1092. var timeStamp = Date.now()
  1093. var formattedString = date.formatDate(timeStamp, 'YYYYMMDDHHmmss')
  1094. const status = exportFile(
  1095. _this.pathfilename + 'list' + formattedString + '.csv',
  1096. '\uFEFF' + res,
  1097. 'text/csv'
  1098. )
  1099. if (status !== true) {
  1100. _this.$q.notify({
  1101. message: 'Browser denied file download...',
  1102. color: 'negative',
  1103. icon: 'warning'
  1104. })
  1105. }
  1106. })
  1107. .catch((err) => {
  1108. _this.$q.notify({
  1109. message: err.detail,
  1110. icon: 'close',
  1111. color: 'negative'
  1112. })
  1113. })
  1114. .finally(() => {
  1115. _this.loading = false
  1116. })
  1117. },
  1118. getListPrevious () {
  1119. var _this = this
  1120. if (LocalStorage.has('auth')) {
  1121. getauth(_this.pathname_previous, {})
  1122. .then((res) => {
  1123. _this.table_list = res.results
  1124. _this.pathname_previous = res.previous
  1125. _this.pathname_next = res.next
  1126. })
  1127. .catch((err) => {
  1128. _this.$q.notify({
  1129. message: err.detail,
  1130. icon: 'close',
  1131. color: 'negative'
  1132. })
  1133. })
  1134. } else {
  1135. }
  1136. },
  1137. getListNext () {
  1138. var _this = this
  1139. if (LocalStorage.has('auth')) {
  1140. getauth(_this.pathname_next, {})
  1141. .then((res) => {
  1142. _this.table_list = res.results
  1143. _this.pathname_previous = res.previous
  1144. _this.pathname_next = res.next
  1145. })
  1146. .catch((err) => {
  1147. _this.$q.notify({
  1148. message: err.detail,
  1149. icon: 'close',
  1150. color: 'negative'
  1151. })
  1152. })
  1153. }
  1154. },
  1155. reFresh () {
  1156. var _this = this
  1157. _this.getSearchList()
  1158. },
  1159. newDataSubmit () {
  1160. var _this = this
  1161. _this.newFormData.bound_type = 'in'
  1162. _this.newFormData.openid = _this.openid
  1163. postauth(_this.pathname, _this.newFormData)
  1164. .then((res) => {
  1165. _this.getSearchList()
  1166. _this.newDataCancel()
  1167. if (res.status_code != 500) {
  1168. _this.$q.notify({
  1169. message: '成功新增数据',
  1170. icon: 'check',
  1171. color: 'green'
  1172. })
  1173. }
  1174. })
  1175. .catch((err) => {
  1176. _this.$q.notify({
  1177. message: err.detail,
  1178. icon: 'close',
  1179. color: 'negative'
  1180. })
  1181. })
  1182. },
  1183. newBatchSubmit () {
  1184. var _this = this
  1185. _this.newBatchFormData.openid = _this.openid
  1186. _this.newBatchFormData.warehouse_code = _this.warehouse_code
  1187. _this.newBatchFormData.warehouse_name = _this.warehouse_name
  1188. _this.newBatchFormData.order = _this.order
  1189. console.log('当前的order是', _this.newBatchFormData.order)
  1190. postauth('bound/batch/', _this.newBatchFormData)
  1191. .then((res) => {
  1192. if (res.status_code != 500) {
  1193. _this.newDetailFormData.bound_batch = res.id
  1194. _this.newDetailFormData.creater = _this.login_name
  1195. postauth('bound/detail/', _this.newDetailFormData).then(
  1196. (res) => {
  1197. if (res.status_code != 500) {
  1198. _this.detailData(_this.newDetailFormData)
  1199. _this.$q.notify({
  1200. message: '成功新增数据',
  1201. icon: 'check',
  1202. color: 'green'
  1203. })
  1204. }
  1205. },
  1206. (err) => {
  1207. _this.$q.notify({
  1208. message: err.detail,
  1209. icon: 'close',
  1210. color: 'negative'
  1211. })
  1212. }
  1213. )
  1214. }
  1215. })
  1216. .catch((err) => {
  1217. _this.$q.notify({
  1218. message: err.detail,
  1219. icon: 'close',
  1220. color: 'negative'
  1221. })
  1222. })
  1223. },
  1224. newDataCancel () {
  1225. var _this = this
  1226. _this.newForm = false
  1227. _this.newFormData = {
  1228. bound_code_type: '',
  1229. bound_bs_type: '',
  1230. bound_desc: '',
  1231. bound_department: '',
  1232. creater: ''
  1233. }
  1234. },
  1235. addbatch (bound_number) {
  1236. var _this = this
  1237. _this.newBatchForm = true
  1238. _this.newDetailFormData = {
  1239. id: bound_number,
  1240. bound_list: bound_number
  1241. }
  1242. },
  1243. editData (e) {
  1244. var _this = this
  1245. _this.editMode = true
  1246. _this.editid = e.id
  1247. _this.editFormData = {
  1248. bound_date: e.bound_date,
  1249. bound_code: e.bound_code,
  1250. bound_code_type: e.bound_code_type,
  1251. bound_bs_type: e.bound_bs_type,
  1252. bound_desc: e.bound_desc,
  1253. bound_department: e.bound_department,
  1254. creater: _this.login_name
  1255. }
  1256. },
  1257. change_status (e) {
  1258. var _this = this
  1259. var status_FormData = {
  1260. bound_date: e.bound_date,
  1261. bound_code: e.bound_code,
  1262. bound_code_type: e.bound_code_type,
  1263. bound_bs_type: e.bound_bs_type,
  1264. bound_desc: e.bound_desc,
  1265. bound_department: e.bound_department,
  1266. creater: _this.login_name,
  1267. bound_type: 'in',
  1268. bound_status: '101'
  1269. }
  1270. putauth(_this.pathname + e.id + '/', status_FormData)
  1271. .then((res) => {
  1272. _this.editDataCancel()
  1273. _this.getSearchList()
  1274. if (res.status_code != 500) {
  1275. _this.$q.notify({
  1276. message: '开始入库',
  1277. icon: 'check',
  1278. color: 'green'
  1279. })
  1280. }
  1281. })
  1282. .catch((err) => {
  1283. _this.$q.notify({
  1284. message: err.detail,
  1285. icon: 'close',
  1286. color: 'negative'
  1287. })
  1288. })
  1289. },
  1290. editDataSubmit () {
  1291. var _this = this
  1292. _this.editFormData.bound_type = 'in'
  1293. putauth(_this.pathname + _this.editid + '/', _this.editFormData)
  1294. .then((res) => {
  1295. _this.editDataCancel()
  1296. _this.getSearchList()
  1297. if (res.status_code != 500) {
  1298. _this.$q.notify({
  1299. message: '成功编辑数据',
  1300. icon: 'check',
  1301. color: 'green'
  1302. })
  1303. }
  1304. })
  1305. .catch((err) => {
  1306. _this.$q.notify({
  1307. message: err.detail,
  1308. icon: 'close',
  1309. color: 'negative'
  1310. })
  1311. })
  1312. },
  1313. editDataCancel () {
  1314. var _this = this
  1315. _this.editMode = false
  1316. _this.editid = 0
  1317. _this.editFormData = {
  1318. bound_date: '',
  1319. bound_code: '',
  1320. bound_code_type: '',
  1321. bound_bs_type: '',
  1322. bound_desc: '',
  1323. bound_department: '',
  1324. creater: ''
  1325. }
  1326. },
  1327. deleteData (e) {
  1328. var _this = this
  1329. _this.deleteForm = true
  1330. _this.deleteid = e
  1331. },
  1332. detailData (e) {
  1333. var _this = this
  1334. _this.detailForm = true
  1335. _this.detailid = e.id
  1336. console.log('detail查询的id是:', _this.detailid)
  1337. getauth(_this.pathname + _this.detailid + '/')
  1338. .then((res) => {
  1339. _this.table_detail = res
  1340. })
  1341. .catch((err) => {
  1342. _this.$q.notify({
  1343. message: err.detail,
  1344. icon: 'close',
  1345. color: 'negative'
  1346. })
  1347. })
  1348. console.log('detail查询的结果是:', _this.table_detail)
  1349. getauth('bound/detail/?bound_list=' + _this.detailid)
  1350. .then((res) => {
  1351. _this.batch_detail = res.results
  1352. })
  1353. .catch((err) => {
  1354. _this.$q.notify({
  1355. message: err.detail,
  1356. icon: 'close',
  1357. color: 'negative'
  1358. })
  1359. })
  1360. console.log('batch查询的结果是:', _this.batch_detail)
  1361. console.log('batch长度查询的结果是:', _this.batch_detail.length)
  1362. },
  1363. deleteDataSubmit () {
  1364. var _this = this
  1365. deleteauth(_this.pathname + _this.deleteid + '/')
  1366. .then((res) => {
  1367. _this.deleteDataCancel()
  1368. _this.getSearchList()
  1369. _this.$q.notify({
  1370. message: '成功删除数据',
  1371. icon: 'check',
  1372. color: 'green'
  1373. })
  1374. })
  1375. .catch((err) => {
  1376. _this.$q.notify({
  1377. message: err.detail,
  1378. icon: 'close',
  1379. color: 'negative'
  1380. })
  1381. })
  1382. },
  1383. deleteDataCancel () {
  1384. var _this = this
  1385. _this.deleteForm = false
  1386. _this.deleteid = 0
  1387. },
  1388. updateProxy () {
  1389. var _this = this
  1390. _this.proxyDate = _this.date
  1391. }
  1392. },
  1393. created () {
  1394. var _this = this
  1395. if (LocalStorage.has('openid')) {
  1396. _this.openid = LocalStorage.getItem('openid')
  1397. } else {
  1398. _this.openid = ''
  1399. LocalStorage.set('openid', '')
  1400. }
  1401. if (LocalStorage.has('warehouse_code')) {
  1402. _this.warehouse_code = LocalStorage.getItem('warehouse_code')
  1403. }
  1404. if (LocalStorage.has('warehouse_name')) {
  1405. _this.warehouse_name = LocalStorage.getItem('warehouse_name')
  1406. }
  1407. if (LocalStorage.has('login_name')) {
  1408. _this.login_name = LocalStorage.getItem('login_name')
  1409. } else {
  1410. _this.login_name = ''
  1411. LocalStorage.set('login_name', '')
  1412. }
  1413. if (LocalStorage.has('auth')) {
  1414. const timeStamp = Date.now()
  1415. const formattedString = date.formatDate(timeStamp, 'YYYY/MM/DD')
  1416. _this.date = formattedString
  1417. console.log(_this.date)
  1418. _this.authin = '1'
  1419. _this.getList()
  1420. } else {
  1421. _this.authin = '0'
  1422. }
  1423. getauth('warehouse/boundcodetype/', {})
  1424. .then((res) => {
  1425. _this.bound_code_type_list = res.results.map((item) => ({
  1426. label: item.bound_code_type_name,
  1427. value: item.bound_code_type_code
  1428. }))
  1429. // 编码 → 名称的映射(普通对象,确保响应式)
  1430. _this.bound_code_type_map = res.results.reduce((acc, item) => {
  1431. acc[item.bound_code_type_code] = item.bound_code_type_name
  1432. return acc
  1433. }, {})
  1434. })
  1435. .catch((err) => {
  1436. _this.$q.notify({
  1437. message: err.detail,
  1438. icon: 'close',
  1439. color: 'negative'
  1440. })
  1441. })
  1442. getauth('warehouse/boundtype/', {})
  1443. .then((res) => {
  1444. _this.bound_desc_list = res.results.map((item) => ({
  1445. label: item.bound_type_name,
  1446. value: item.bound_type_code
  1447. }))
  1448. // 编码 → 名称的映射(普通对象,确保响应式)
  1449. _this.bound_desc_map = res.results.reduce((acc, item) => {
  1450. acc[item.bound_type_code] = item.bound_type_name
  1451. return acc
  1452. }, {})
  1453. })
  1454. .catch((err) => {
  1455. _this.$q.notify({
  1456. message: err.detail,
  1457. icon: 'close',
  1458. color: 'negative'
  1459. })
  1460. })
  1461. getauth('warehouse/department/?max_page=1000', {})
  1462. .then((res) => {
  1463. _this.bound_department_list = res.results.map((item) => ({
  1464. label: item.department_name,
  1465. value: item.department_code
  1466. }))
  1467. _this.bound_department_map = res.results.reduce((acc, item) => {
  1468. acc[item.department_code] = item.department_name
  1469. return acc
  1470. }, {})
  1471. })
  1472. .catch((err) => {
  1473. _this.$q.notify({
  1474. message: err.detail,
  1475. icon: 'close',
  1476. color: 'negative'
  1477. })
  1478. })
  1479. getauth('warehouse/boundbusiness/', {})
  1480. .then((res) => {
  1481. _this.bound_bs_type_list = res.results.map((item) => ({
  1482. label: item.bound_bs_name,
  1483. value: item.bound_bs_code
  1484. }))
  1485. // 编码 → 名称的映射(普通对象,确保响应式)
  1486. _this.bound_bs_type_map = res.results.reduce((acc, item) => {
  1487. acc[item.bound_bs_code] = item.bound_bs_name
  1488. return acc
  1489. }, {})
  1490. })
  1491. .catch((err) => {
  1492. _this.$q.notify({
  1493. message: err.detail,
  1494. icon: 'close',
  1495. color: 'negative'
  1496. })
  1497. })
  1498. getauth('warehouse/status/', {})
  1499. .then((res) => {
  1500. _this.bound_status_list = res.results.map((item) => ({
  1501. label: item.bound_status_name,
  1502. value: item.bound_status_code
  1503. }))
  1504. _this.bound_status_map = res.results.reduce((acc, item) => {
  1505. acc[item.bound_status_code] = item.bound_status_name
  1506. return acc
  1507. }, {})
  1508. })
  1509. .catch((err) => {
  1510. _this.$q.notify({
  1511. message: err.detail,
  1512. icon: 'close',
  1513. color: 'negative'
  1514. })
  1515. })
  1516. },
  1517. mounted () {
  1518. var _this = this
  1519. if (_this.$q.platform.is.electron) {
  1520. _this.height = String(_this.$q.screen.height - 290) + 'px'
  1521. } else {
  1522. _this.height = _this.$q.screen.height - 290 + '' + 'px'
  1523. }
  1524. _this.newFormData.creater = _this.login_name
  1525. },
  1526. updated () {},
  1527. destroyed () {},
  1528. watch: {
  1529. isorder: function (val) {
  1530. console.log(val)
  1531. if (val) {
  1532. this.order = 'true'
  1533. } else {
  1534. this.order = 'false'
  1535. }
  1536. },
  1537. createDate1 (val) {
  1538. if (val) {
  1539. if (val.to) {
  1540. this.createDate2 = `${val.from} - ${val.to}`
  1541. this.date_range = `${val.from},${val.to} `
  1542. // this.downloadhUrl = this.pathname + 'filelist/?' + 'document_date__range=' + this.date_range
  1543. } else {
  1544. this.createDate2 = `${val}`
  1545. this.dateArray = val.split('/')
  1546. this.searchUrl =
  1547. this.pathname +
  1548. '?' +
  1549. 'document_date__year=' +
  1550. this.dateArray[0] +
  1551. '&' +
  1552. 'document_date__month=' +
  1553. this.dateArray[1] +
  1554. '&' +
  1555. 'document_date__day=' +
  1556. this.dateArray[2]
  1557. // this.downloadhUrl = this.pathname + 'filelist/?' + 'document_date__year=' + this.dateArray[0] + '&' + 'document_date__month=' + this.dateArray[1] + '&' + 'document_date__day=' + this.dateArray[2]
  1558. }
  1559. this.date_range = this.date_range.replace(/\//g, '-')
  1560. this.getSearchList()
  1561. this.$refs.qDateProxy.hide()
  1562. } else {
  1563. this.createDate2 = ''
  1564. this.date_range = ''
  1565. this.getSearchList()
  1566. }
  1567. }
  1568. }
  1569. }
  1570. </script>
  1571. <style scoped>
  1572. /* 添加在 <style> 中 */
  1573. .q-date__calendar-item--selected {
  1574. transition: all 0.3s ease;
  1575. background-color: #1976d2 !important;
  1576. }
  1577. .q-date__range {
  1578. background-color: rgba(25, 118, 210, 0.1);
  1579. }
  1580. :deep(.q-field__label) {
  1581. margin-top: 8px;
  1582. align-self: center;
  1583. }
  1584. :deep(.q-field__control-container) {
  1585. padding-left: 50px;
  1586. margin-top: -5px;
  1587. }
  1588. /* 修改打印样式 */
  1589. #printBarcode {
  1590. width: 80mm; /* 标准标签纸宽度 */
  1591. max-width: 50mm;
  1592. padding: 2mm;
  1593. box-sizing: border-box;
  1594. }
  1595. /* 打印时强制缩放 */
  1596. @media print {
  1597. body {
  1598. margin: 0 !important;
  1599. visibility: hidden;
  1600. }
  1601. #printBarcode,
  1602. #printBarcode * {
  1603. visibility: visible;
  1604. width: 100% !important;
  1605. max-width: 100% !important;
  1606. }
  1607. /* 强制单页布局 */
  1608. .print-area {
  1609. page-break-inside: avoid;
  1610. break-inside: avoid;
  1611. display: flex;
  1612. flex-direction: column;
  1613. gap: 2mm;
  1614. }
  1615. /* 条码缩放 */
  1616. svg {
  1617. transform: scale(0.9);
  1618. transform-origin: center top;
  1619. max-height: 30mm !important;
  1620. }
  1621. /* 文本适配 */
  1622. p {
  1623. font-size: 9pt !important;
  1624. margin: 0;
  1625. line-height: 1.2;
  1626. white-space: nowrap;
  1627. overflow: hidden;
  1628. text-overflow: ellipsis;
  1629. }
  1630. /* 网格布局优化 */
  1631. .row {
  1632. display: grid !important;
  1633. grid-template-columns: 1fr 1fr;
  1634. gap: 1mm;
  1635. }
  1636. }
  1637. </style>