asn.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843
  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-btn
  281. round
  282. flat
  283. push
  284. color="dark"
  285. icon="delete"
  286. @click="deleteData(props.row.id)"
  287. >
  288. <q-tooltip
  289. content-class="bg-amber text-black shadow-4"
  290. :offset="[10, 10]"
  291. content-style="font-size: 12px"
  292. >{{ $t("delete") }}</q-tooltip
  293. >
  294. </q-btn>
  295. </q-td>
  296. </template>
  297. <template v-else-if="editMode">
  298. <template v-if="props.row.id === editid">
  299. <q-td key="action" :props="props" style="width: 100px">
  300. <q-btn
  301. round
  302. flat
  303. push
  304. color="secondary"
  305. icon="check"
  306. @click="editDataSubmit()"
  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("confirmedit") }}</q-tooltip
  313. >
  314. </q-btn>
  315. <q-btn
  316. round
  317. flat
  318. push
  319. color="red"
  320. icon="close"
  321. @click="editDataCancel()"
  322. >
  323. <q-tooltip
  324. content-class="bg-amber text-black shadow-4"
  325. :offset="[10, 10]"
  326. content-style="font-size: 12px"
  327. >{{ $t("canceledit") }}</q-tooltip
  328. >
  329. </q-btn>
  330. </q-td>
  331. </template>
  332. <template v-else-if="props.row.id !== editid"></template>
  333. </template>
  334. </q-tr>
  335. </template>
  336. </q-table>
  337. </transition>
  338. <template>
  339. <div v-show="max !== 0" class="q-pa-lg flex flex-center">
  340. <div>{{ total }}</div>
  341. <q-pagination
  342. v-model="current"
  343. color="black"
  344. :max="max"
  345. :max-pages="6"
  346. boundary-links
  347. @click="
  348. getSearchList(current);
  349. paginationIpt = current;
  350. "
  351. />
  352. <div>
  353. <input
  354. v-model="paginationIpt"
  355. @blur="changePageEnter"
  356. @keyup.enter="changePageEnter"
  357. style="width: 60px; text-align: center"
  358. />
  359. </div>
  360. </div>
  361. <div v-show="max === 0" class="q-pa-lg flex flex-center">
  362. <q-btn flat push color="dark" :label="$t('no_data')"></q-btn>
  363. </div>
  364. </template>
  365. <q-dialog v-model="newForm">
  366. <q-card class="shadow-24">
  367. <q-bar
  368. class="bg-light-blue-10 text-white rounded-borders"
  369. style="height: 50px"
  370. >
  371. <div>{{ $t("newtip") }}</div>
  372. <q-space />
  373. <q-btn dense flat icon="close" v-close-popup>
  374. <q-tooltip content-class="bg-amber text-black shadow-4">{{
  375. $t("index.close")
  376. }}</q-tooltip>
  377. </q-btn>
  378. </q-bar>
  379. <q-card-section style="max-height: 325px; width: 400px" class="scroll">
  380. <q-select
  381. dense
  382. outlined
  383. square
  384. v-model="newFormData.bound_code_type"
  385. :label="'单据类型'"
  386. autofocus
  387. :options="bound_code_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_bs_type"
  401. :label="'业务类型'"
  402. :options="bound_bs_type_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_desc"
  416. :label="'出入库类别'"
  417. :options="bound_desc_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-select
  427. dense
  428. outlined
  429. square
  430. v-model="newFormData.bound_department"
  431. :label="'部门'"
  432. :options="bound_department_list"
  433. option-label="label"
  434. option-value="value"
  435. emit-value
  436. map-options
  437. transition-show="scale"
  438. transition-hide="scale"
  439. :rules="[(val) => (val && val.length > 0) || error1]"
  440. />
  441. <q-input
  442. dense
  443. outlined
  444. square
  445. v-model="newFormData.creater"
  446. :label="'经办人'"
  447. :rules="[(val) => (val && val.length > 0) || error1]"
  448. />
  449. </q-card-section>
  450. <div style="float: right; padding: 15px 15px 15px 0">
  451. <q-btn
  452. color="white"
  453. text-color="black"
  454. style="margin-right: 25px"
  455. @click="newDataCancel()"
  456. >{{ $t("cancel") }}</q-btn
  457. >
  458. <q-btn color="primary" @click="newDataSubmit()">{{
  459. $t("submit")
  460. }}</q-btn>
  461. </div>
  462. </q-card>
  463. </q-dialog>
  464. <q-dialog v-model="deleteForm">
  465. <q-card class="shadow-24">
  466. <q-bar
  467. class="bg-light-blue-10 text-white rounded-borders"
  468. style="height: 50px"
  469. >
  470. <div>{{ $t("delete") }}</div>
  471. <q-space />
  472. <q-btn dense flat icon="close" v-close-popup>
  473. <q-tooltip>{{ $t("index.close") }}</q-tooltip>
  474. </q-btn>
  475. </q-bar>
  476. <q-card-section
  477. style="max-height: 325px; width: 400px"
  478. class="scroll"
  479. >{{ $t("deletetip") }}</q-card-section
  480. >
  481. <div style="float: right; padding: 15px 15px 15px 0">
  482. <q-btn
  483. color="white"
  484. text-color="black"
  485. style="margin-right: 25px"
  486. @click="deleteDataCancel()"
  487. >{{ $t("cancel") }}</q-btn
  488. >
  489. <q-btn color="primary" @click="deleteDataSubmit()">{{
  490. $t("submit")
  491. }}</q-btn>
  492. </div>
  493. </q-card>
  494. </q-dialog>
  495. <q-dialog v-model="newBatchForm">
  496. <q-card class="shadow-24">
  497. <q-bar
  498. class="bg-light-blue-10 text-white rounded-borders"
  499. style="height: 50px"
  500. >
  501. <div>{{ "新建批次" }}</div>
  502. <q-space />
  503. <q-btn dense flat icon="close" v-close-popup>
  504. <q-tooltip content-class="bg-amber text-black shadow-4">{{
  505. $t("index.close")
  506. }}</q-tooltip>
  507. </q-btn>
  508. </q-bar>
  509. <q-card-section style="min-height: 325px; width: 500px" class="scroll">
  510. <div class="text-h6 q-mb-md">{{ "批次信息" }}</div>
  511. <div class="row q-gutter-x-md">
  512. <div class="col column q-gutter-y-md">
  513. <q-select
  514. dense
  515. outlined
  516. square
  517. v-model="newBatchFormData.goods_code"
  518. :label="'物料编码'"
  519. :options="product_list"
  520. option-label="value"
  521. option-value="value"
  522. emit-value
  523. map-options
  524. transition-show="scale"
  525. transition-hide="scale"
  526. :rules="[(val) => (val && val.length > 0) || error1]"
  527. :onClick="assignGoodsCode()"
  528. />
  529. </div>
  530. <div class="col column q-gutter-y-md">
  531. <q-input
  532. outlined
  533. dense
  534. color="primary"
  535. v-model="product_filter"
  536. :placeholder="'搜索名称'"
  537. autofocus
  538. @input="getProductSearchList()"
  539. @keyup.enter="getProductSearchList()"
  540. >
  541. <template v-slot:append>
  542. <q-icon name="search" />
  543. </template>
  544. </q-input>
  545. </div>
  546. </div>
  547. <q-select
  548. dense
  549. outlined
  550. square
  551. v-model="newBatchFormData.goods_code"
  552. :label="'物料'"
  553. :options="product_list"
  554. option-label="label"
  555. option-value="value"
  556. emit-value
  557. map-options
  558. :readonly="false"
  559. transition-show="scale"
  560. transition-hide="scale"
  561. :rules="[(val) => (val && val.length > 0) || error1]"
  562. />
  563. <q-input
  564. dense
  565. outlined
  566. square
  567. v-model="newBatchFormData.goods_desc"
  568. :label="'名称'"
  569. :rules="[(val) => (val && val.length > 0) || error1]"
  570. />
  571. <div class="row q-gutter-x-md">
  572. <div class="col column q-gutter-y-md">
  573. <!-- <q-input
  574. dense
  575. outlined
  576. square
  577. v-model.number="newBatchFormData.goods_weight"
  578. :label="'单重'"
  579. type="number"
  580. :rules="[(val) => (val && val > 0) || error1]"
  581. /> -->
  582. <q-input
  583. dense
  584. outlined
  585. square
  586. v-model.number="newBatchFormData.goods_qty"
  587. :label="'数量'"
  588. type="number"
  589. :rules="[(val) => (val && val > 0) || error1]"
  590. />
  591. <q-input
  592. dense
  593. outlined
  594. square
  595. v-model="newBatchFormData.goods_package"
  596. :label="'包装'"
  597. :rules="[(val) => (val && val.length > 0) || error1]"
  598. />
  599. <q-toggle
  600. v-model="isorder"
  601. :label="isorder ? '自动编码' : '手动编码(建议)'"
  602. />
  603. </div>
  604. <div class="col column q-gutter-y-md">
  605. <q-input
  606. dense
  607. outlined
  608. square
  609. v-model="newBatchFormData.goods_unit"
  610. :label="'单位'"
  611. :rules="[(val) => (val && val.length > 0) || error1]"
  612. />
  613. <q-input
  614. dense
  615. outlined
  616. square
  617. v-model="newBatchFormData.goods_std"
  618. :label="'规格/备注'"
  619. :rules="[(val) => (val && val.length > 0) || error1]"
  620. />
  621. </div>
  622. </div>
  623. <div class="row q-gutter-x-md" v-show="!isorder">
  624. <div class="col column q-gutter-y-md">
  625. <q-input
  626. dense
  627. outlined
  628. square
  629. v-model="batch_number_year"
  630. type="number"
  631. :label="'年'"
  632. :rules="[(val) => (val && val > 0) || error1]"
  633. />
  634. </div>
  635. <div class="col column q-gutter-y-md">
  636. <q-input
  637. dense
  638. outlined
  639. square
  640. v-model="batch_number_month"
  641. :label="'月'"
  642. type="number"
  643. :rules="[(val) => (val && val > 0) || error1]"
  644. />
  645. </div>
  646. <div class="col column q-gutter-y-md">
  647. <q-input
  648. dense
  649. outlined
  650. v-model="batch_number_batch"
  651. type="number"
  652. :label="'批'"
  653. :rules="[(val) => (val && val > 0) || '请输入正确的批号']"
  654. />
  655. </div>
  656. </div>
  657. <q-input
  658. v-show="!isorder"
  659. dense
  660. outlined
  661. square
  662. v-model.number="newBatchFormData.bound_batch_order"
  663. :label="'批号——年月第几批(202504009)'"
  664. class="centered-input"
  665. type="number"
  666. :rules="[(val) => (val && val > 0) || error1]"
  667. />
  668. <q-input
  669. dense
  670. outlined
  671. square
  672. v-model="newBatchFormData.creater"
  673. :label="'经办人'"
  674. :rules="[(val) => (val && val.length > 0) || error1]"
  675. />
  676. </q-card-section>
  677. <div style="float: right; padding: 15px 15px 15px 0">
  678. <q-btn
  679. color="white"
  680. text-color="black"
  681. style="margin-right: 25px"
  682. @click="newBatchCancel()"
  683. >{{ $t("cancel") }}</q-btn
  684. >
  685. <q-btn color="primary" @click="newBatchSubmit()">{{
  686. $t("submit")
  687. }}</q-btn>
  688. </div>
  689. </q-card>
  690. </q-dialog>
  691. <q-dialog
  692. v-model="detailForm"
  693. transition-show="jump-down"
  694. transition-hide="jump-up"
  695. >
  696. <q-card style="min-width: 1150px">
  697. <q-bar
  698. class="bg-light-blue-10 text-white rounded-borders"
  699. style="height: 50px"
  700. >
  701. <div>
  702. {{ "批次信息" }}
  703. </div>
  704. <q-space></q-space>
  705. <q-btn dense flat icon="close" v-close-popup>
  706. <q-tooltip
  707. content-class="bg-amber text-black shadow-4"
  708. :offset="[20, 20]"
  709. content-style="font-size: 12px"
  710. >
  711. {{ $t("index.close") }}</q-tooltip
  712. >
  713. </q-btn>
  714. </q-bar>
  715. <q-card-section class="q-pt-md">
  716. <q-tabs v-model="activeTab">
  717. <q-tab name="tab1" label="入库信息" />
  718. <!-- <q-tab name="tab2" label="货物信息" /> -->
  719. </q-tabs>
  720. </q-card-section>
  721. <!-- 选项卡内容 -->
  722. <q-tab-panels v-model="activeTab" animated>
  723. <q-tab-panel name="tab1" style="height: 70px">
  724. <div class="row q-gutter-x-md">
  725. <div class="col column q-gutter-y-md">
  726. <q-input
  727. dense
  728. outlined
  729. square
  730. v-model="table_detail.bound_date"
  731. :label="'单据时间'"
  732. :readonly="true"
  733. />
  734. </div>
  735. <div class="col column q-gutter-y-md">
  736. <q-input
  737. dense
  738. outlined
  739. square
  740. v-model="table_detail.bound_code"
  741. :label="'单据编码'"
  742. :readonly="true"
  743. />
  744. </div>
  745. </div>
  746. </q-tab-panel>
  747. </q-tab-panels>
  748. <div
  749. style="float: right; padding: 15px 15px 50px 15px; min-width: 100%"
  750. flow="row wrap"
  751. >
  752. <q-card class="q-mb-md" bordered>
  753. <q-card-actions
  754. class="q-px-none"
  755. style="position: absolute; right: 20px; top: 10px; z-index: 100"
  756. >
  757. <q-btn
  758. icon="add"
  759. flat
  760. dense
  761. color="primary"
  762. @click="addbatch(table_detail.id)"
  763. :label="$t('stock.add')"
  764. />
  765. </q-card-actions>
  766. <q-card-section>
  767. <template>
  768. <div class="text-h6 q-mb-md">{{ "批次信息" }}</div>
  769. <q-table
  770. v-if="batch_detail.length > 0"
  771. :data="batch_detail"
  772. :columns="columns_batch"
  773. row-key="id"
  774. flat
  775. bordered
  776. hide-pagination
  777. class="my-sticky-table scrollable-table"
  778. :style="{ 'max-height': '400px' }"
  779. :container-style="{ height: 'auto' }"
  780. :pagination="{ rowsPerPage: 0 }"
  781. >
  782. <template v-slot:body-cell-actions="props">
  783. <q-td :props="props">
  784. <q-btn
  785. icon="print"
  786. flat
  787. v-print="getPrintConfig(props.row)"
  788. @click="setCurrentBatch(props.row)"
  789. >
  790. <q-tooltip>打印条码</q-tooltip>
  791. </q-btn>
  792. </q-td>
  793. </template>
  794. </q-table>
  795. </template>
  796. </q-card-section>
  797. </q-card>
  798. </div>
  799. </q-card>
  800. </q-dialog>
  801. <div id="printBarcode" class="print-area">
  802. <div class="q-pa-md text-center" style="flex: none">
  803. <div class="row no-wrap">
  804. <div class="col text-left">
  805. <p style="font-weight: 500">{{ currentgoods.goods_desc }}</p>
  806. </div>
  807. <div class="col text-right">
  808. <p>
  809. 数量: {{ currentgoods.goods_qty }}{{ currentgoods.goods_unit }}
  810. </p>
  811. </div>
  812. </div>
  813. <svg ref="barcodeElement" style="width: 100%; height: auto"></svg>
  814. </div>
  815. </div>
  816. </div>
  817. </template>
  818. <router-view />
  819. <script>
  820. import { getauth, postauth, putauth, deleteauth } from 'boot/axios_request'
  821. import JsBarcode from 'jsbarcode'
  822. import { date, exportFile, LocalStorage, QToggle } from 'quasar'
  823. export default {
  824. components: {
  825. QToggle
  826. },
  827. name: 'Pageasnlist',
  828. data () {
  829. return {
  830. createDate1: '',
  831. createDate2: '',
  832. date_range: '',
  833. proxyDate: '',
  834. date: '',
  835. goods_code: '',
  836. goods_desc: '',
  837. openid: '',
  838. login_name: '',
  839. authin: '0',
  840. warehouse_code: '',
  841. warehouse_name: '',
  842. searchUrl: '',
  843. pathname: 'bound/list/',
  844. pathfilename: 'bound/file/',
  845. pathname_previous: '',
  846. pathname_next: '',
  847. separator: 'cell',
  848. loading: false,
  849. height: '',
  850. printObj: {
  851. id: 'printMe',
  852. popTitle: this.$t('inbound.asn')
  853. },
  854. table_list: [],
  855. table_detail: {},
  856. batch_detail: [],
  857. bound_code_type_list: [],
  858. bound_code_type_map: [],
  859. bound_bs_type_list: [],
  860. bound_bs_type_map: [],
  861. bound_desc_list: [],
  862. bound_desc_map: [],
  863. bound_department_list: [],
  864. bound_department_map: [],
  865. bound_status_list: [],
  866. bound_status_map: [],
  867. product_list: [],
  868. product_map: [],
  869. batch_number_year: '',
  870. batch_number_month: '',
  871. batch_number_batch: '',
  872. columns: [
  873. { name: 'detail', label: '详情', field: 'detail', align: 'center' },
  874. {
  875. name: 'bound_date',
  876. label: '单据日期',
  877. field: 'bound_date',
  878. align: 'center'
  879. },
  880. {
  881. name: 'bound_code',
  882. label: '单据编号',
  883. field: 'bound_code',
  884. align: 'center'
  885. },
  886. {
  887. name: 'bound_code_type',
  888. label: '单据类型',
  889. field: 'bound_code_type',
  890. align: 'center'
  891. },
  892. {
  893. name: 'bound_bs_type',
  894. label: '业务类型',
  895. field: 'bound_bs_type',
  896. align: 'center'
  897. },
  898. {
  899. name: 'bound_desc',
  900. label: '出入库类别',
  901. field: 'bound_desc',
  902. align: 'center'
  903. },
  904. {
  905. name: 'bound_department',
  906. label: '部门',
  907. field: 'bound_department',
  908. align: 'center'
  909. },
  910. { name: 'creater', label: '经办人', field: 'creater', align: 'center' },
  911. {
  912. name: 'bound_status',
  913. label: '状态',
  914. field: 'bound_status',
  915. align: 'center'
  916. },
  917. { name: 'action', label: '操作', align: 'center' }
  918. ],
  919. // 列定义
  920. columns_batch: [
  921. {
  922. name: 'actions',
  923. label: '操作',
  924. align: 'center',
  925. style: 'width: 80px'
  926. },
  927. {
  928. name: 'bound_batch_order',
  929. label: '批次',
  930. field: (row) => row.bound_batch.bound_batch_order,
  931. align: 'center'
  932. },
  933. {
  934. name: 'goods_desc',
  935. label: '货物',
  936. field: (row) => row.bound_batch.goods_desc,
  937. align: 'center'
  938. },
  939. {
  940. name: 'plan_weight',
  941. label: '计划入库重量',
  942. field: (row) => row.bound_batch.goods_qty, // 确保字段路径正确
  943. align: 'center',
  944. style: 'width: 150px'
  945. },
  946. {
  947. name: 'actual_weight',
  948. label: '实际入库重量',
  949. field: (row) => row.bound_batch.goods_in_qty, // 根据实际字段调整
  950. align: 'center',
  951. style: 'width: 150px'
  952. },
  953. {
  954. name: 'unit',
  955. label: '单位',
  956. field: (row) => row.bound_batch.goods_unit,
  957. align: 'center',
  958. style: 'width: 10px'
  959. },
  960. {
  961. name: 'package',
  962. label: '包装',
  963. field: (row) => row.bound_batch.goods_package,
  964. align: 'center',
  965. style: 'width: 10px'
  966. }
  967. ],
  968. filter: '',
  969. product_filter: '',
  970. pagination: {
  971. page: 1,
  972. rowsPerPage: 11
  973. },
  974. newForm: false,
  975. newBatchForm: false,
  976. newFormData: {},
  977. newBatchFormData: {},
  978. newDetailFormData: {},
  979. editid: 0,
  980. editFormData: {},
  981. editMode: false,
  982. deleteForm: false,
  983. detailForm: false,
  984. deleteid: 0,
  985. detailid: 0,
  986. bar_code: '',
  987. error1: this.$t('goods.view_goodslist.error1'),
  988. max: 0,
  989. total: 0,
  990. paginationIpt: 1,
  991. current: 1,
  992. onlyread: true,
  993. bound_batch_list: [],
  994. activeTab: 'tab1',
  995. isorder: false,
  996. order: 'false',
  997. printConfig: {
  998. id: 'printBarcode'
  999. },
  1000. currentBarcode: null,
  1001. currentgoods: {}
  1002. }
  1003. },
  1004. computed: {
  1005. interval () {
  1006. return (
  1007. this.$t('download_center.start') +
  1008. ' - ' +
  1009. this.$t('download_center.end')
  1010. )
  1011. }
  1012. },
  1013. methods: {
  1014. assignGoodsCode () {
  1015. console.log('data', this.newBatchFormData.goods_code)
  1016. console.log(
  1017. 'product_map',
  1018. this.product_map[this.newBatchFormData.goods_code]
  1019. )
  1020. if (this.product_map[this.newBatchFormData.goods_code]) {
  1021. this.newBatchFormData.goods_desc =
  1022. this.product_map[this.newBatchFormData.goods_code].product_name
  1023. this.newBatchFormData.goods_std =
  1024. this.product_map[this.newBatchFormData.goods_code].product_std
  1025. this.newBatchFormData.goods_unit =
  1026. this.product_map[this.newBatchFormData.goods_code].product_unit
  1027. this.newBatchFormData.goods_package =
  1028. this.product_map[this.newBatchFormData.goods_code].product_package
  1029. this.newBatchFormData.goods_weight = 1
  1030. }
  1031. // this.newBatchFormData.goods_code = this.product_map[this.newBatchFormData.goods_code].product_code
  1032. // this.newBatchFormData.goods_std = this.product_map[this.newBatchFormData.goods_code].goods_std
  1033. // this.newBatchFormData.goods_package = this.product_map[this.newBatchFormData.goods_code].goods_package
  1034. },
  1035. setCurrentBatch (item) {
  1036. this.currentBarcode = item.bound_batch?.bound_number || ''
  1037. this.currentgoods = item.bound_batch
  1038. },
  1039. getPrintConfig () {
  1040. this.generateBarcode()
  1041. return {
  1042. id: 'printBarcode'
  1043. }
  1044. },
  1045. generateBarcode () {
  1046. this.$refs.barcodeElement.innerHTML = ''
  1047. try {
  1048. JsBarcode(this.$refs.barcodeElement, this.currentBarcode, {
  1049. format: 'CODE128',
  1050. displayValue: true,
  1051. fontSize: 16,
  1052. height: 60,
  1053. margin: 10
  1054. })
  1055. } catch (error) {
  1056. console.error('条码生成失败:', error)
  1057. }
  1058. },
  1059. getList (params = {}) {
  1060. var _this = this
  1061. _this.loading = true
  1062. // 合并基础参数
  1063. const baseParams = {
  1064. page: _this.current,
  1065. base_type: '0',
  1066. page_size: _this.pagination.rowsPerPage
  1067. }
  1068. // 创建URLSearchParams处理参数
  1069. const queryParams = new URLSearchParams({
  1070. ...baseParams,
  1071. ...params
  1072. })
  1073. console.log(queryParams)
  1074. // 过滤空值参数
  1075. Array.from(queryParams.entries()).forEach(([key, value]) => {
  1076. if (value === '' || value === null || value === undefined) {
  1077. queryParams.delete(key)
  1078. }
  1079. })
  1080. getauth(`${_this.pathname}?${queryParams}`)
  1081. .then((res) => {
  1082. _this.table_list = res.results
  1083. _this.total = res.count
  1084. _this.max = Math.ceil(res.count / _this.pagination.rowsPerPage) || 0
  1085. _this.pathname_previous = res.previous
  1086. _this.pathname_next = res.next
  1087. })
  1088. .catch((err) => {
  1089. _this.$q.notify({
  1090. message: err.detail,
  1091. icon: 'close',
  1092. color: 'negative'
  1093. })
  1094. })
  1095. .finally(() => {
  1096. _this.loading = false
  1097. })
  1098. },
  1099. changePageEnter () {
  1100. if (Number(this.paginationIpt) < 1) {
  1101. this.current = 1
  1102. this.paginationIpt = 1
  1103. } else if (Number(this.paginationIpt) > this.max) {
  1104. this.current = this.max
  1105. this.paginationIpt = this.max
  1106. } else {
  1107. this.current = Number(this.paginationIpt)
  1108. }
  1109. this.getSearchList(this.current)
  1110. },
  1111. getProductSearchList () {
  1112. var _this = this
  1113. _this.loading = true
  1114. const params = {
  1115. product_name__icontains: _this.product_filter,
  1116. max_page: 1000
  1117. }
  1118. const queryParams = new URLSearchParams({
  1119. ...params
  1120. })
  1121. console.log(queryParams)
  1122. // 过滤空值参数
  1123. Array.from(queryParams.entries()).forEach(([key, value]) => {
  1124. if (value === '' || value === null || value === undefined) {
  1125. queryParams.delete(key)
  1126. }
  1127. })
  1128. console.log(`warehouse/product/?${queryParams}`)
  1129. getauth(`warehouse/product/?${queryParams}`)
  1130. .then((res) => {
  1131. _this.product_list = res.results.map((item) => ({
  1132. label: item.product_name,
  1133. value: item.product_code
  1134. }))
  1135. _this.product_map = res.results.reduce((acc, item) => {
  1136. acc[item.product_code] = item
  1137. return acc
  1138. }, {})
  1139. })
  1140. .catch((err) => {
  1141. _this.$q.notify({
  1142. message: err.detail,
  1143. icon: 'close',
  1144. color: 'negative'
  1145. })
  1146. })
  1147. .finally(() => {
  1148. _this.loading = false
  1149. })
  1150. },
  1151. // 带搜索条件加载
  1152. getSearchList (page = 1) {
  1153. this.current = page
  1154. this.paginationIpt = page
  1155. this.getList({
  1156. goods_desc__icontains: this.filter,
  1157. document_date__range: this.date_range
  1158. })
  1159. },
  1160. downloadlistData () {
  1161. this.getfileList()
  1162. },
  1163. getfileList () {
  1164. var _this = this
  1165. _this.loading = true
  1166. const params = {
  1167. goods_desc__icontains: _this.filter,
  1168. document_date__range: _this.date_range
  1169. }
  1170. const queryParams = new URLSearchParams({
  1171. ...params
  1172. })
  1173. console.log(queryParams)
  1174. // 过滤空值参数
  1175. Array.from(queryParams.entries()).forEach(([key, value]) => {
  1176. if (value === '' || value === null || value === undefined) {
  1177. queryParams.delete(key)
  1178. }
  1179. })
  1180. console.log(`${_this.pathfilename}?${queryParams}`)
  1181. getauth(`${_this.pathfilename}?${queryParams}`)
  1182. .then((res) => {
  1183. var timeStamp = Date.now()
  1184. var formattedString = date.formatDate(timeStamp, 'YYYYMMDDHHmmss')
  1185. const status = exportFile(
  1186. _this.pathfilename + 'list' + formattedString + '.csv',
  1187. '\uFEFF' + res,
  1188. 'text/csv'
  1189. )
  1190. if (status !== true) {
  1191. _this.$q.notify({
  1192. message: 'Browser denied file download...',
  1193. color: 'negative',
  1194. icon: 'warning'
  1195. })
  1196. }
  1197. })
  1198. .catch((err) => {
  1199. _this.$q.notify({
  1200. message: err.detail,
  1201. icon: 'close',
  1202. color: 'negative'
  1203. })
  1204. })
  1205. .finally(() => {
  1206. _this.loading = false
  1207. })
  1208. },
  1209. getListPrevious () {
  1210. var _this = this
  1211. if (LocalStorage.has('auth')) {
  1212. getauth(_this.pathname_previous, {})
  1213. .then((res) => {
  1214. _this.table_list = res.results
  1215. _this.pathname_previous = res.previous
  1216. _this.pathname_next = res.next
  1217. })
  1218. .catch((err) => {
  1219. _this.$q.notify({
  1220. message: err.detail,
  1221. icon: 'close',
  1222. color: 'negative'
  1223. })
  1224. })
  1225. } else {
  1226. }
  1227. },
  1228. getListNext () {
  1229. var _this = this
  1230. if (LocalStorage.has('auth')) {
  1231. getauth(_this.pathname_next, {})
  1232. .then((res) => {
  1233. _this.table_list = res.results
  1234. _this.pathname_previous = res.previous
  1235. _this.pathname_next = res.next
  1236. })
  1237. .catch((err) => {
  1238. _this.$q.notify({
  1239. message: err.detail,
  1240. icon: 'close',
  1241. color: 'negative'
  1242. })
  1243. })
  1244. }
  1245. },
  1246. reFresh () {
  1247. var _this = this
  1248. _this.getSearchList()
  1249. },
  1250. newDataSubmit () {
  1251. var _this = this
  1252. _this.newFormData.bound_type = 'in'
  1253. _this.newFormData.openid = _this.openid
  1254. postauth(_this.pathname, _this.newFormData)
  1255. .then((res) => {
  1256. _this.getSearchList()
  1257. _this.newDataCancel()
  1258. if (res.status_code !== 500) {
  1259. _this.$q.notify({
  1260. message: '成功新增数据',
  1261. icon: 'check',
  1262. color: 'green'
  1263. })
  1264. }
  1265. })
  1266. .catch((err) => {
  1267. _this.$q.notify({
  1268. message: err.detail,
  1269. icon: 'close',
  1270. color: 'negative'
  1271. })
  1272. })
  1273. },
  1274. newBatchSubmit () {
  1275. var _this = this
  1276. _this.newBatchFormData.openid = _this.openid
  1277. _this.newBatchFormData.warehouse_code = _this.warehouse_code
  1278. _this.newBatchFormData.warehouse_name = _this.warehouse_name
  1279. _this.newBatchFormData.order = _this.order
  1280. console.log('当前的order是', _this.newBatchFormData.order)
  1281. postauth('bound/batch/', _this.newBatchFormData)
  1282. .then((res) => {
  1283. if (res.status_code !== 500) {
  1284. _this.newDetailFormData.bound_batch = res.id
  1285. _this.newDetailFormData.creater = _this.login_name
  1286. postauth('bound/detail/', _this.newDetailFormData).then(
  1287. (res) => {
  1288. if (res.status_code !== 500) {
  1289. _this.detailData(_this.newDetailFormData)
  1290. _this.$q.notify({
  1291. message: '成功新增数据',
  1292. icon: 'check',
  1293. color: 'green'
  1294. })
  1295. }
  1296. },
  1297. (err) => {
  1298. _this.$q.notify({
  1299. message: err.detail,
  1300. icon: 'close',
  1301. color: 'negative'
  1302. })
  1303. }
  1304. )
  1305. }
  1306. })
  1307. .catch((err) => {
  1308. _this.$q.notify({
  1309. message: err.detail,
  1310. icon: 'close',
  1311. color: 'negative'
  1312. })
  1313. })
  1314. },
  1315. newDataCancel () {
  1316. var _this = this
  1317. _this.newForm = false
  1318. _this.newFormData = {
  1319. bound_code_type: '',
  1320. bound_bs_type: '',
  1321. bound_desc: '',
  1322. bound_department: '',
  1323. creater: ''
  1324. }
  1325. },
  1326. addbatch (bound_number) {
  1327. var _this = this
  1328. _this.newBatchForm = true
  1329. _this.batch_number_year = _this.date.slice(0, 4)
  1330. _this.batch_number_month = _this.date.slice(5, 7)
  1331. _this.newBatchFormData.creater = _this.login_name
  1332. _this.newDetailFormData = {
  1333. id: bound_number,
  1334. bound_list: bound_number
  1335. }
  1336. },
  1337. editData (e) {
  1338. var _this = this
  1339. _this.editMode = true
  1340. _this.editid = e.id
  1341. _this.editFormData = {
  1342. bound_date: e.bound_date,
  1343. bound_code: e.bound_code,
  1344. bound_code_type: e.bound_code_type,
  1345. bound_bs_type: e.bound_bs_type,
  1346. bound_desc: e.bound_desc,
  1347. bound_department: e.bound_department,
  1348. creater: _this.login_name
  1349. }
  1350. },
  1351. change_status (e) {
  1352. var _this = this
  1353. var status_FormData = {
  1354. bound_date: e.bound_date,
  1355. bound_code: e.bound_code,
  1356. bound_code_type: e.bound_code_type,
  1357. bound_bs_type: e.bound_bs_type,
  1358. bound_desc: e.bound_desc,
  1359. bound_department: e.bound_department,
  1360. creater: _this.login_name,
  1361. bound_type: 'in',
  1362. bound_status: '101'
  1363. }
  1364. putauth(_this.pathname + e.id + '/', status_FormData)
  1365. .then((res) => {
  1366. _this.editDataCancel()
  1367. _this.getSearchList()
  1368. if (res.status_code !== 500) {
  1369. _this.$q.notify({
  1370. message: '开始入库',
  1371. icon: 'check',
  1372. color: 'green'
  1373. })
  1374. }
  1375. })
  1376. .catch((err) => {
  1377. _this.$q.notify({
  1378. message: err.detail,
  1379. icon: 'close',
  1380. color: 'negative'
  1381. })
  1382. })
  1383. },
  1384. editDataSubmit () {
  1385. var _this = this
  1386. _this.editFormData.bound_type = 'in'
  1387. putauth(_this.pathname + _this.editid + '/', _this.editFormData)
  1388. .then((res) => {
  1389. _this.editDataCancel()
  1390. _this.getSearchList()
  1391. if (res.status_code !== 500) {
  1392. _this.$q.notify({
  1393. message: '成功编辑数据',
  1394. icon: 'check',
  1395. color: 'green'
  1396. })
  1397. }
  1398. })
  1399. .catch((err) => {
  1400. _this.$q.notify({
  1401. message: err.detail,
  1402. icon: 'close',
  1403. color: 'negative'
  1404. })
  1405. })
  1406. },
  1407. editDataCancel () {
  1408. var _this = this
  1409. _this.editMode = false
  1410. _this.editid = 0
  1411. _this.editFormData = {
  1412. bound_date: '',
  1413. bound_code: '',
  1414. bound_code_type: '',
  1415. bound_bs_type: '',
  1416. bound_desc: '',
  1417. bound_department: '',
  1418. creater: ''
  1419. }
  1420. },
  1421. deleteData (e) {
  1422. var _this = this
  1423. _this.deleteForm = true
  1424. _this.deleteid = e
  1425. },
  1426. detailData (e) {
  1427. var _this = this
  1428. _this.detailForm = true
  1429. _this.detailid = e.id
  1430. console.log('detail查询的id是:', _this.detailid)
  1431. getauth(_this.pathname + _this.detailid + '/')
  1432. .then((res) => {
  1433. _this.table_detail = res
  1434. })
  1435. .catch((err) => {
  1436. _this.$q.notify({
  1437. message: err.detail,
  1438. icon: 'close',
  1439. color: 'negative'
  1440. })
  1441. })
  1442. console.log('detail查询的结果是:', _this.table_detail)
  1443. getauth('bound/detail/?max_page=1000&bound_list=' + _this.detailid)
  1444. .then((res) => {
  1445. _this.batch_detail = res.results
  1446. })
  1447. .catch((err) => {
  1448. _this.$q.notify({
  1449. message: err.detail,
  1450. icon: 'close',
  1451. color: 'negative'
  1452. })
  1453. })
  1454. console.log('batch查询的结果是:', _this.batch_detail)
  1455. console.log('batch长度查询的结果是:', _this.batch_detail.length)
  1456. },
  1457. deleteDataSubmit () {
  1458. var _this = this
  1459. deleteauth(_this.pathname + _this.deleteid + '/')
  1460. .then((res) => {
  1461. _this.deleteDataCancel()
  1462. _this.getSearchList()
  1463. _this.$q.notify({
  1464. message: '成功删除数据',
  1465. icon: 'check',
  1466. color: 'green'
  1467. })
  1468. })
  1469. .catch((err) => {
  1470. _this.$q.notify({
  1471. message: err.detail,
  1472. icon: 'close',
  1473. color: 'negative'
  1474. })
  1475. })
  1476. },
  1477. deleteDataCancel () {
  1478. var _this = this
  1479. _this.deleteForm = false
  1480. _this.deleteid = 0
  1481. },
  1482. updateProxy () {
  1483. var _this = this
  1484. _this.proxyDate = _this.date
  1485. }
  1486. },
  1487. created () {
  1488. var _this = this
  1489. if (LocalStorage.has('openid')) {
  1490. _this.openid = LocalStorage.getItem('openid')
  1491. } else {
  1492. _this.openid = ''
  1493. LocalStorage.set('openid', '')
  1494. }
  1495. if (LocalStorage.has('warehouse_code')) {
  1496. _this.warehouse_code = LocalStorage.getItem('warehouse_code')
  1497. }
  1498. if (LocalStorage.has('warehouse_name')) {
  1499. _this.warehouse_name = LocalStorage.getItem('warehouse_name')
  1500. }
  1501. if (LocalStorage.has('login_name')) {
  1502. _this.login_name = LocalStorage.getItem('login_name')
  1503. } else {
  1504. _this.login_name = ''
  1505. LocalStorage.set('login_name', '')
  1506. }
  1507. if (LocalStorage.has('auth')) {
  1508. const timeStamp = Date.now()
  1509. const formattedString = date.formatDate(timeStamp, 'YYYY/MM/DD')
  1510. _this.date = formattedString
  1511. console.log(_this.date)
  1512. _this.authin = '1'
  1513. _this.getList()
  1514. } else {
  1515. _this.authin = '0'
  1516. }
  1517. getauth('warehouse/boundcodetype/', {})
  1518. .then((res) => {
  1519. _this.bound_code_type_list = res.results.map((item) => ({
  1520. label: item.bound_code_type_name,
  1521. value: item.bound_code_type_code
  1522. }))
  1523. // 编码 → 名称的映射(普通对象,确保响应式)
  1524. _this.bound_code_type_map = res.results.reduce((acc, item) => {
  1525. acc[item.bound_code_type_code] = item.bound_code_type_name
  1526. return acc
  1527. }, {})
  1528. })
  1529. .catch((err) => {
  1530. _this.$q.notify({
  1531. message: err.detail,
  1532. icon: 'close',
  1533. color: 'negative'
  1534. })
  1535. })
  1536. getauth('warehouse/boundtype/', {})
  1537. .then((res) => {
  1538. _this.bound_desc_list = res.results.map((item) => ({
  1539. label: item.bound_type_name,
  1540. value: item.bound_type_code
  1541. }))
  1542. // 编码 → 名称的映射(普通对象,确保响应式)
  1543. _this.bound_desc_map = res.results.reduce((acc, item) => {
  1544. acc[item.bound_type_code] = item.bound_type_name
  1545. return acc
  1546. }, {})
  1547. })
  1548. .catch((err) => {
  1549. _this.$q.notify({
  1550. message: err.detail,
  1551. icon: 'close',
  1552. color: 'negative'
  1553. })
  1554. })
  1555. getauth('warehouse/department/?max_page=1000', {})
  1556. .then((res) => {
  1557. _this.bound_department_list = res.results.map((item) => ({
  1558. label: item.department_name,
  1559. value: item.department_code
  1560. }))
  1561. _this.bound_department_map = res.results.reduce((acc, item) => {
  1562. acc[item.department_code] = item.department_name
  1563. return acc
  1564. }, {})
  1565. })
  1566. .catch((err) => {
  1567. _this.$q.notify({
  1568. message: err.detail,
  1569. icon: 'close',
  1570. color: 'negative'
  1571. })
  1572. })
  1573. getauth('warehouse/boundbusiness/', {})
  1574. .then((res) => {
  1575. _this.bound_bs_type_list = res.results.map((item) => ({
  1576. label: item.bound_bs_name,
  1577. value: item.bound_bs_code
  1578. }))
  1579. // 编码 → 名称的映射(普通对象,确保响应式)
  1580. _this.bound_bs_type_map = res.results.reduce((acc, item) => {
  1581. acc[item.bound_bs_code] = item.bound_bs_name
  1582. return acc
  1583. }, {})
  1584. })
  1585. .catch((err) => {
  1586. _this.$q.notify({
  1587. message: err.detail,
  1588. icon: 'close',
  1589. color: 'negative'
  1590. })
  1591. })
  1592. getauth('warehouse/status/', {})
  1593. .then((res) => {
  1594. _this.bound_status_list = res.results.map((item) => ({
  1595. label: item.bound_status_name,
  1596. value: item.bound_status_code
  1597. }))
  1598. _this.bound_status_map = res.results.reduce((acc, item) => {
  1599. acc[item.bound_status_code] = item.bound_status_name
  1600. return acc
  1601. }, {})
  1602. })
  1603. .catch((err) => {
  1604. _this.$q.notify({
  1605. message: err.detail,
  1606. icon: 'close',
  1607. color: 'negative'
  1608. })
  1609. })
  1610. },
  1611. mounted () {
  1612. var _this = this
  1613. if (_this.$q.platform.is.electron) {
  1614. _this.height = String(_this.$q.screen.height - 290) + 'px'
  1615. } else {
  1616. _this.height = _this.$q.screen.height - 290 + '' + 'px'
  1617. }
  1618. _this.newFormData.creater = _this.login_name
  1619. },
  1620. updated () {},
  1621. destroyed () {},
  1622. watch: {
  1623. isorder: function (val) {
  1624. console.log(val)
  1625. if (val) {
  1626. this.order = 'true'
  1627. } else {
  1628. this.order = 'false'
  1629. }
  1630. },
  1631. batch_number_batch: function (val) {
  1632. console.log(val)
  1633. this.newBatchFormData.bound_batch_order =
  1634. this.batch_number_year * 100000 + this.batch_number_month * 1000 + Number(val)
  1635. },
  1636. createDate1 (val) {
  1637. if (val) {
  1638. if (val.to) {
  1639. this.createDate2 = `${val.from} - ${val.to}`
  1640. this.date_range = `${val.from},${val.to} `
  1641. // this.downloadhUrl = this.pathname + 'filelist/?' + 'document_date__range=' + this.date_range
  1642. } else {
  1643. this.createDate2 = `${val}`
  1644. this.dateArray = val.split('/')
  1645. this.searchUrl =
  1646. this.pathname +
  1647. '?' +
  1648. 'document_date__year=' +
  1649. this.dateArray[0] +
  1650. '&' +
  1651. 'document_date__month=' +
  1652. this.dateArray[1] +
  1653. '&' +
  1654. 'document_date__day=' +
  1655. this.dateArray[2]
  1656. // this.downloadhUrl = this.pathname + 'filelist/?' + 'document_date__year=' + this.dateArray[0] + '&' + 'document_date__month=' + this.dateArray[1] + '&' + 'document_date__day=' + this.dateArray[2]
  1657. }
  1658. this.date_range = this.date_range.replace(/\//g, '-')
  1659. this.getSearchList()
  1660. this.$refs.qDateProxy.hide()
  1661. } else {
  1662. this.createDate2 = ''
  1663. this.date_range = ''
  1664. this.getSearchList()
  1665. }
  1666. }
  1667. }
  1668. }
  1669. </script>
  1670. <style scoped>
  1671. /* 添加在 <style> 中 */
  1672. .q-date__calendar-item--selected {
  1673. transition: all 0.3s ease;
  1674. background-color: #1976d2 !important;
  1675. }
  1676. .q-date__range {
  1677. background-color: rgba(25, 118, 210, 0.1);
  1678. }
  1679. :deep(.q-field__label) {
  1680. margin-top: 8px;
  1681. align-self: center;
  1682. }
  1683. :deep(.q-field__control-container) {
  1684. padding-left: 50px;
  1685. margin-top: -5px;
  1686. }
  1687. /* 修改打印样式 */
  1688. #printBarcode {
  1689. width: 80mm; /* 标准标签纸宽度 */
  1690. max-width: 50mm;
  1691. padding: 2mm;
  1692. box-sizing: border-box;
  1693. }
  1694. /* 打印时强制缩放 */
  1695. @media print {
  1696. body {
  1697. margin: 0 !important;
  1698. visibility: hidden;
  1699. }
  1700. #printBarcode,
  1701. #printBarcode * {
  1702. visibility: visible;
  1703. width: 100% !important;
  1704. max-width: 100% !important;
  1705. }
  1706. /* 强制单页布局 */
  1707. .print-area {
  1708. page-break-inside: avoid;
  1709. break-inside: avoid;
  1710. display: flex;
  1711. flex-direction: column;
  1712. gap: 2mm;
  1713. }
  1714. /* 条码缩放 */
  1715. svg {
  1716. transform: scale(0.9);
  1717. transform-origin: center top;
  1718. max-height: 30mm !important;
  1719. }
  1720. /* 文本适配 */
  1721. p {
  1722. font-size: 9pt !important;
  1723. margin: 0;
  1724. line-height: 1.2;
  1725. white-space: nowrap;
  1726. overflow: hidden;
  1727. text-overflow: ellipsis;
  1728. }
  1729. /* 网格布局优化 */
  1730. .row {
  1731. display: grid !important;
  1732. grid-template-columns: 1fr 1fr;
  1733. gap: 1mm;
  1734. }
  1735. }
  1736. /* 在样式文件中添加 */
  1737. .centered-input ::v-deep .q-field__control {
  1738. justify-content: center;
  1739. }
  1740. .centered-input ::v-deep input {
  1741. text-align: center;
  1742. -moz-appearance: textfield; /* 隐藏Firefox的数字箭头 */
  1743. }
  1744. /* 隐藏Chrome/Safari的数字箭头 */
  1745. .centered-input ::v-deep input::-webkit-inner-spin-button {
  1746. -webkit-appearance: none;
  1747. margin: 0;
  1748. }
  1749. /* 修改滚动样式 */
  1750. .scrollable-table {
  1751. flex: 1; /* 允许表格填充剩余空间 */
  1752. display: flex;
  1753. flex-direction: column;
  1754. }
  1755. .scrollable-table .q-table__container {
  1756. flex: 1;
  1757. overflow: auto;
  1758. }
  1759. .scrollable-table .q-table__top {
  1760. position: sticky;
  1761. top: 0;
  1762. background: white;
  1763. z-index: 1;
  1764. }
  1765. .my-sticky-table .q-table__middle {
  1766. overflow-y: auto !important;
  1767. }
  1768. </style>