neworder.vue 52 KB

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