stockInOrder.vue 57KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <!--<bread-crumb :crumbs='crumbs'></bread-crumb>-->
  5. <bread-crumb :crumbs="crumbs"></bread-crumb>
  6. <el-button
  7. size="small"
  8. @click="handleWarehouse"
  9. class="filter-item"
  10. style="float:right;"
  11. type="primary"
  12. icon="el-icon-circle-plus-outline"
  13. >新增</el-button
  14. >
  15. </div>
  16. <div class="app-container">
  17. <div class="cell clearfix">
  18. <label class="title"><span class="name">仓库</span> :</label>
  19. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeStoreHouse">
  20. <el-option
  21. v-for="(option, index) in list"
  22. :key="index"
  23. :label="option.storehouse_name"
  24. :value="option.id">
  25. </el-option>
  26. </el-select>
  27. <el-input
  28. size="small"
  29. style="width: 200px;"
  30. v-model.trim="searchKey"
  31. class="filter-item"
  32. placeholder="单据编码/制单人/耗材名称"
  33. />
  34. <el-button
  35. size="small"
  36. class="filter-item"
  37. type="primary"
  38. icon="el-icon-search"
  39. @click="search"
  40. >搜索</el-button
  41. >
  42. <div style="margin-left:10px;">
  43. <label class="title"><span class="name">入库时间</span> : </label>
  44. <el-date-picker
  45. size="small"
  46. v-model="start_time"
  47. prefix-icon="el-icon-date"
  48. :editable="false"
  49. style="width: 196px;"
  50. type="date"
  51. placeholder="选择日期时间"
  52. align="right"
  53. format="yyyy-MM-dd"
  54. value-format="yyyy-MM-dd"
  55. @change="startTimeChange"
  56. ></el-date-picker>
  57. <span class="cellLine"> - </span>
  58. <el-date-picker
  59. size="small"
  60. v-model="end_time"
  61. prefix-icon="el-icon-date"
  62. :editable="false"
  63. style="width: 196px;"
  64. type="date"
  65. placeholder="选择日期时间"
  66. align="right"
  67. format="yyyy-MM-dd"
  68. value-format="yyyy-MM-dd"
  69. @change="endTimeChange"
  70. ></el-date-picker>
  71. </div>
  72. <!-- <div style="margin-left: 10px">
  73. <span>审核状态:</span>
  74. <el-select
  75. v-model="check_id"
  76. style="width: 140px; margin-right: 10px"
  77. placeholder="请选择"
  78. @change="changeTypeName"
  79. >
  80. <el-option
  81. v-for="item in checkList"
  82. :key="item.id"
  83. :label="item.name"
  84. :value="item.id"
  85. >
  86. </el-option>
  87. </el-select>
  88. </div> -->
  89. </div>
  90. <div class="cell clearfix">
  91. <el-checkbox
  92. style="width: 70px"
  93. v-model="checkAllStatus"
  94. @change="changeCheck"
  95. >全选</el-checkbox
  96. >
  97. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  98. <el-button size="small" type="primary" @click="toPrint">打印</el-button>
  99. <el-button size="small" type="primary" @click="toExport" @disabled="exportLoding">导出</el-button>
  100. <span>&nbsp;&nbsp;</span>
  101. <label class="title"><span class="name">审核状态</span> :</label>
  102. <el-select size="small" v-model="check_type" filterable placeholder="请选择仓库" style="width:200px" @change="changeCheckType">
  103. <el-option
  104. v-for="(option, index) in checkList"
  105. :key="index"
  106. :label="option.name"
  107. :value="option.id">
  108. </el-option>
  109. </el-select>
  110. </div>
  111. <el-table
  112. ref="multipleTable"
  113. :data="Warehouse.warehouseDate"
  114. :class="signAndWeighBoxPatients"
  115. style="width: 100%"
  116. border
  117. highlight-current-row
  118. v-loading="Warehouse.loading"
  119. @selection-change="select"
  120. :row-style="{ color: '#303133' }"
  121. :header-cell-style="{
  122. backgroundColor: 'rgb(245, 247, 250)',
  123. color: '#606266'
  124. }"
  125. @current-change="handleSearch"
  126. >
  127. <el-table-column align="center" type="selection" width="55">
  128. </el-table-column>
  129. <el-table-column label="单据日期" align="center">
  130. <template slot-scope="scope">
  131. {{ scope.row.warehousing_time | parseTime("{y}-{m}-{d}") }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="单据编号" align="center">
  135. <template slot-scope="scope">
  136. {{ scope.row.warehousing_order }}
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="仓库名称" align="center">
  140. <template slot-scope="scope">
  141. {{getHouseName(scope.row.storehouse_id)}}
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="制单人" align="center">
  145. <template slot-scope="scope">
  146. {{ getXuserName(scope.row.creater) }}
  147. </template>
  148. </el-table-column>
  149. <el-table-column label="审核人" align="center" v-if="org_id == 3877 || org_id == 10318">
  150. <template slot-scope="scope">
  151. {{ getXuserName(scope.row.checker) }}
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="入库方式" align="center">
  155. <template slot-scope="scope">
  156. <span v-if="scope.row.is_sys == 12">调拨入库</span>
  157. <span v-if="scope.row.is_sys == 0">手动入库</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="审核状态" align="center">
  161. <template slot-scope="scope">
  162. <span v-if="scope.row.is_check == 1">已审核</span>
  163. <span v-if="scope.row.is_check == 2">未审核</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="操作" align="center" width="260px">
  167. <template slot-scope="scope">
  168. <el-tooltip
  169. class="item"
  170. effect="dark"
  171. content="编辑"
  172. placement="top"
  173. >
  174. <el-button
  175. size="small"
  176. type="primary"
  177. icon="el-icon-edit-outline"
  178. @click="handleEdit(scope.$index, scope.row)"
  179. >
  180. </el-button>
  181. </el-tooltip>
  182. <el-tooltip
  183. class="item"
  184. effect="dark"
  185. content="删除"
  186. placement="top"
  187. >
  188. <el-button
  189. size="small"
  190. type="danger"
  191. icon="el-icon-delete"
  192. @click="handleDelete(scope.$index, scope.row)"
  193. >
  194. </el-button>
  195. </el-tooltip>
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. <el-pagination
  200. @size-change="handleSizeChange"
  201. @current-change="handleCurrentChange"
  202. :page-sizes="[5, 10, 50, 100]"
  203. :page-size="5"
  204. background
  205. style="margin-top:20px;text-align: right"
  206. layout="total, sizes, prev, pager, next, jumper"
  207. :total="total"
  208. >
  209. </el-pagination>
  210. <div v-show="tableShow" style="margin-top:10px;">
  211. <el-table
  212. :data="tableList"
  213. :class="signAndWeighBoxPatients"
  214. style="width: 100%"
  215. border
  216. highlight-current-row
  217. v-loading="Warehouse.loading"
  218. @selection-change="select"
  219. :row-style="{ color: '#303133' }"
  220. :header-cell-style="{
  221. backgroundColor: 'rgb(245, 247, 250)',
  222. color: '#606266'
  223. }"
  224. fit
  225. >
  226. <el-table-column label="耗材名称" align="center">
  227. <template slot-scope="scope">
  228. <span v-if="scope.row.is_total == 0">
  229. {{ scope.row.GoodInfo.good_name }}
  230. </span>
  231. </template>
  232. </el-table-column>
  233. <el-table-column label="耗材类型" align="center">
  234. <template slot-scope="scope">
  235. <span v-if="scope.row.is_total ==0">
  236. {{ getTypeName(scope.row.GoodInfo.good_type_id)}}
  237. </span>
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="规格&单位" align="center">
  241. <template slot-scope="scope">
  242. <span v-if="scope.row.is_total == 0">
  243. {{ scope.row.GoodInfo.specification_name}} / {{scope.row.GoodInfo.packing_unit}}
  244. </span>
  245. </template>
  246. </el-table-column>
  247. <el-table-column label="国家编码" align="center">
  248. <template slot-scope="scope">
  249. <span v-if="scope.row.is_total == 0">
  250. {{ scope.row.GoodInfo.social_security_directory_code}}
  251. </span>
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="批号" align="center">
  255. <template slot-scope="scope">
  256. <span v-if="scope.row.is_total== 0">
  257. {{ scope.row.number}}
  258. </span>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="仓库名称" align="center">
  262. <template slot-scope="scope">
  263. <span v-if="scope.row.is_total == 0">
  264. {{getHouseName(scope.row.storehouse_id)}}
  265. </span>
  266. </template>
  267. </el-table-column>
  268. <el-table-column label="入库数量" align="center">
  269. <template slot-scope="scope">
  270. <span v-if="scope.row.is_total == 0">{{ scope.row.warehousing_count}}{{scope.row.GoodInfo.packing_unit}} </span>
  271. </template>
  272. </el-table-column>
  273. <!-- <el-table-column label="零售价" align="center">
  274. <template slot-scope="scope">
  275. {{ scope.row.packing_price}}
  276. </template>
  277. </el-table-column> -->
  278. <el-table-column label="进货价" align="center">
  279. <template slot-scope="scope">
  280. <span v-if="scope.row.is_total == 0">
  281. {{ scope.row.price}}
  282. </span>
  283. </template>
  284. </el-table-column>
  285. <el-table-column label="总价" align="center">
  286. <template slot-scope="scope">
  287. <span v-if="scope.row.is_total==0">
  288. {{ (scope.row.warehousing_count * scope.row.price).toFixed(2)}}
  289. </span>
  290. <span v-if="scope.row.is_total== 1">
  291. {{(scope.row.total_count).toFixed(2)}}
  292. </span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="生产厂家" align="center">
  296. <template slot-scope="scope">
  297. <span v-if="scope.row.is_total == 0">
  298. {{ getManufactuerName(scope.row.manufacturer)}}
  299. </span>
  300. </template>
  301. </el-table-column>
  302. <el-table-column label="生产日期" align="center">
  303. <template slot-scope="scope">
  304. <span v-if="scope.row.is_total == 0">
  305. {{ getTime(scope.row.product_date,"{y}-{m}-{d}")}}
  306. </span>
  307. </template>
  308. </el-table-column>
  309. <el-table-column label="有效期" align="center">
  310. <template slot-scope="scope">
  311. <span v-if="scope.row.is_total == 0">
  312. {{ getTime(scope.row.expiry_date,"{y}-{m}-{d}")}}
  313. </span>
  314. </template>
  315. </el-table-column>
  316. <el-table-column label="经销商" align="center">
  317. <template slot-scope="scope">
  318. <span v-if="scope.row.is_total == 0">
  319. {{ getDealerName(scope.row.dealer)}}
  320. </span>
  321. </template>
  322. </el-table-column>
  323. <el-table-column label="批准文号" align="center" v-if="org_id!=10653&&org_id!=0">
  324. <template slot-scope="scope">
  325. <span v-if="scope.row.is_total ==0"> {{ scope.row.license_number}}</span>
  326. </template>
  327. </el-table-column>
  328. <el-table-column label="生产许可证号" align="center" v-if="org_id ==10653 || org_id == 0">
  329. <template slot-scope="scope">
  330. <span v-if="scope.row.is_total ==0"> {{ scope.row.license_number}}</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="注册编码" align="center">
  334. <template slot-scope="scope">
  335. <span v-if="scope.row.is_total == 0">
  336. {{ scope.row.register_number}}
  337. </span>
  338. </template>
  339. </el-table-column>
  340. <el-table-column label="备注" align="center">
  341. <template slot-scope="scope">
  342. <span v-if="scope.row.is_total == 0">
  343. {{ scope.row.remark }}
  344. </span>
  345. </template>
  346. </el-table-column>
  347. </el-table>
  348. </div>
  349. </div>
  350. <el-dialog
  351. title="详情"
  352. :visible.sync="dialogVisible"
  353. width="80%"
  354. >
  355. <span>
  356. <div>
  357. <el-row>
  358. <span style="font-size: 18px;color: #606266">入库单详情</span>
  359. </el-row>
  360. <el-row style="float:left;">
  361. <span style="color: #606266"
  362. >入库单号: {{ WarehouseInfo.warehouse.warehousing_order }}</span
  363. >
  364. </el-row>
  365. </div>
  366. <div class="cell clearfix">
  367. <span style="width: 300px;color: #606266;float:right">单据日期:{{ WarehouseInfo.warehouse.warehousing_time | parseTime("{y}-{m}-{d}")}} </span>
  368. <span style="width: 300px;color: #606266;float:right">厂商:{{ getManufactuerName(WarehouseInfo.warehouse.manufacturer) }}</span>
  369. <span style="width: 300px;color: #606266"
  370. >经销商:{{ getDealerName(WarehouseInfo.warehouse.dealer) }} </span>
  371. </div>
  372. <div class="cell clearfix" style="margin-top: 10px">
  373. <el-button size="small" icon="el-icon-edit" @click="editRecord"
  374. >编辑</el-button
  375. >
  376. <el-button size="small" icon="el-icon-delete" @click="deleteRecord"
  377. >删除</el-button
  378. >
  379. <el-row :gutter="12" style="margin-top: 10px">
  380. <el-table
  381. :data="WarehouseInfo.warehouseInfoDate"
  382. :class="signAndWeighBoxPatients"
  383. style="width: 100%"
  384. border
  385. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  386. >
  387. <el-table-column min-width="35" align="center">
  388. <template slot="header" slot-scope="scope">
  389. <span>耗材类型</span>
  390. </template>
  391. <template slot-scope="scope">
  392. <span v-if="scope.row.good_type_id != 0">{{
  393. getTypeName(scope.row.good_type_id)
  394. }}</span>
  395. </template>
  396. </el-table-column>
  397. <el-table-column min-width="35" align="center">
  398. <template slot="header" slot-scope="scope">
  399. <span>耗材名称</span>
  400. </template>
  401. <template slot-scope="scope">
  402. <span v-if="scope.row.good_id != 0">{{
  403. getTypeNameOne(scope.row.good_id)
  404. }}</span>
  405. </template>
  406. </el-table-column>
  407. <el-table-column min-width="35" align="center">
  408. <template slot="header" slot-scope="scope">
  409. <span>规格型号</span>
  410. </template>
  411. <template slot-scope="scope">
  412. <span v-if="scope.row.good_id != 0">{{
  413. getSpecificationName(scope.row.good_id)
  414. }}</span>
  415. </template>
  416. </el-table-column>
  417. <el-table-column min-width="23" align="center">
  418. <template slot="header" slot-scope="scope">
  419. <span>进货价</span>
  420. </template>
  421. <template slot-scope="scope">
  422. <span>{{ scope.row.price }}</span>
  423. </template>
  424. </el-table-column>
  425. <el-table-column min-width="23" align="center">
  426. <template slot="header" slot-scope="scope">
  427. <span>入库数量</span>
  428. </template>
  429. <template slot-scope="scope">
  430. <span>{{ scope.row.warehousing_count }}</span>
  431. </template>
  432. </el-table-column>
  433. <el-table-column label="总价" min-width="20" align="center">
  434. <template slot-scope="scope">
  435. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  436. </template>
  437. </el-table-column>
  438. <el-table-column align="center" min-width="25">
  439. <template slot="header" slot-scope="scope">
  440. <span>批号</span>
  441. </template>
  442. <template slot-scope="scope">
  443. <span>{{ scope.row.number }}</span>
  444. </template>
  445. </el-table-column>
  446. <el-table-column label="生产日期" min-width="40" align="center">
  447. <template v-if="scope.row.product_date != 0" slot-scope="scope">
  448. {{ scope.row.product_date }}
  449. </template>
  450. </el-table-column>
  451. <el-table-column label="有效日期" min-width="40" align="center">
  452. <template v-if="scope.row.expiry_date != 0" slot-scope="scope">
  453. {{ scope.row.expiry_date }}
  454. </template>
  455. </el-table-column>
  456. <el-table-column label="备注" min-width="20" align="center">
  457. <template slot-scope="scope">
  458. <el-popover placement="top-start" width="250" trigger="hover">
  459. <div>{{ scope.row.remark }}</div>
  460. <span slot="reference" v-if="scope.row.remark.length > 20">{{
  461. scope.row.remark.substr(0, 20) + "..."
  462. }}</span>
  463. <span slot="reference" v-else>{{ scope.row.remark }}</span>
  464. </el-popover>
  465. </template>
  466. </el-table-column>
  467. </el-table>
  468. </el-row>
  469. </div>
  470. </span>
  471. <span slot="footer" class="dialog-footer">
  472. <el-button @click="dialogVisible = false">取 消</el-button>
  473. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  474. </span>
  475. </el-dialog>
  476. <el-dialog
  477. title="新增"
  478. :visible.sync="editDialogVisible"
  479. width="80%"
  480. >
  481. <span>
  482. <div style="margin-bottom:10px">
  483. <label class="title"><span class="name">入库时间</span> : </label>
  484. <el-date-picker size="small" v-model="warehousing_time" prefix-icon="el-icon-date" :editable="false"
  485. style="width: 196px;" type="date" placeholder="选择日期时间" align="right" format="yyyy-MM-dd"
  486. value-format="yyyy-MM-dd"></el-date-picker>
  487. <label class="title" style="margin-left:10px;"><span class="name">经 销 商</span> : </label>
  488. <el-select size="small" v-model="form.dealer" clearable placeholder="请选择经销商" @change="changeDealer">
  489. <el-option
  490. v-for="(option, index) in dealer"
  491. :key="index"
  492. :label="option.dealer_name"
  493. :value="option.id">
  494. </el-option>
  495. </el-select>
  496. <label class="title" style="margin-left:10px;"><span class="name">厂商</span> : </label>
  497. <el-select size="small" v-model="form.manufacturer" clearable placeholder="请选择厂商" @change="changeManufacturer">
  498. <el-option
  499. v-for="(option, index) in manufacturer"
  500. :key="index"
  501. :label="option.manufacturer_name"
  502. :value="option.id">
  503. </el-option>
  504. </el-select>
  505. </div>
  506. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  507. <el-table
  508. id="oictable"
  509. :data="recordInfo.recordData"
  510. :class="signAndWeighBoxPatients"
  511. style="width: 100%"
  512. border
  513. max-height="450"
  514. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  515. >
  516. <el-table-column align="center" width="200">
  517. <template slot="header" slot-scope="scope">
  518. <span>商品类型<span style="color: red">*</span></span>
  519. </template>
  520. <template slot-scope="scope">
  521. <el-form-item style="padding-top: 15px">
  522. <el-input
  523. placeholder="请输入商品类型"
  524. v-model="scope.row.good_type_id"
  525. :value="typeName(scope.row.good_type_id)"
  526. @focus="showDialog(scope.$index, scope.row)"
  527. ></el-input>
  528. </el-form-item>
  529. </template>
  530. </el-table-column>
  531. <el-table-column align="center" width="200">
  532. <template slot="header" slot-scope="scope">
  533. <span>规格名称<span style="color: red">*</span></span>
  534. </template>
  535. <template slot-scope="scope">
  536. <el-form-item style="padding-top: 15px">
  537. <el-input
  538. placeholder="请输入规格名称"
  539. v-model="scope.row.good_id"
  540. :value="specificationName(scope.row.good_id)"
  541. @focus="showDialog(scope.$index, scope.row)"
  542. ></el-input>
  543. </el-form-item>
  544. </template>
  545. </el-table-column>
  546. <el-table-column align="center" width="150">
  547. <template slot="header" slot-scope="scope">
  548. <span>单价<span style="color: red">*</span></span>
  549. </template>
  550. <template slot-scope="scope">
  551. <!--<el-input type="number" v-model="scope.row.price" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  552. <el-form-item
  553. :prop="'recordData.' + scope.$index + '.price'"
  554. :rules="tableRules.price"
  555. style="padding-top: 17px"
  556. >
  557. <el-input
  558. placeholder="请输入单价"
  559. type="number"
  560. v-model="scope.row.price"
  561. ></el-input>
  562. </el-form-item>
  563. </template>
  564. </el-table-column>
  565. <el-table-column align="center" width="180">
  566. <template slot="header" slot-scope="scope">
  567. <span>入库数量<span style="color: red">*</span></span>
  568. </template>
  569. <template slot-scope="scope">
  570. <!--{{scope.row.warehousing_count}}-->
  571. <!--<el-input type="number" v-model="scope.row.warehousing_count" @blur="handleBlur(scope.$index, scope.row)"></el-input>-->
  572. <el-form-item
  573. :prop="'recordData.' + scope.$index + '.warehousing_count'"
  574. :rules="tableRules.warehousing_count"
  575. style="padding-top: 17px"
  576. >
  577. <el-input
  578. placeholder="请输入入库数量"
  579. type="number"
  580. v-model="scope.row.warehousing_count"
  581. ></el-input>
  582. </el-form-item>
  583. </template>
  584. </el-table-column>
  585. <el-table-column label="总价" align="center" width="150">
  586. <template slot-scope="scope">
  587. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  588. </template>
  589. </el-table-column>
  590. <el-table-column align="center" width="150">
  591. <template slot="header" slot-scope="scope">
  592. <span>批号</span>
  593. </template>
  594. <template slot-scope="scope">
  595. <el-form-item style="padding-top: 15px">
  596. <el-input
  597. placeholder="请输入批号"
  598. v-model="scope.row.number"
  599. ></el-input>
  600. </el-form-item>
  601. </template>
  602. </el-table-column>
  603. <el-table-column label="生产日期" width="250" align="center">
  604. <template slot-scope="scope">
  605. <el-date-picker
  606. prefix-icon="el-icon-date"
  607. style="width: 145px"
  608. v-model="scope.row.product_date"
  609. type="date"
  610. placeholder="选择日期时间"
  611. format="yyyy-MM-dd"
  612. value-format="yyyy-MM-dd"
  613. ></el-date-picker>
  614. </template>
  615. </el-table-column>
  616. <el-table-column label="有效日期" width="250" align="center">
  617. <template slot-scope="scope">
  618. <el-date-picker
  619. prefix-icon="el-icon-date"
  620. style="width: 145px"
  621. v-model="scope.row.expiry_date"
  622. type="date"
  623. placeholder="选择日期时间"
  624. format="yyyy-MM-dd"
  625. value-format="yyyy-MM-dd"
  626. ></el-date-picker>
  627. </template>
  628. </el-table-column>
  629. <el-table-column label="备注" width="150" align="center">
  630. <template slot-scope="scope">
  631. <el-input v-model="scope.row.remark"></el-input>
  632. </template>
  633. </el-table-column>
  634. <el-table-column
  635. label="操作"
  636. fixed="right"
  637. align="center"
  638. width="150"
  639. >
  640. <template slot-scope="scope">
  641. <el-tooltip
  642. class="item"
  643. effect="dark"
  644. content="新增"
  645. placement="top"
  646. >
  647. <el-button
  648. size="mini"
  649. type="primary"
  650. icon="el-icon-circle-plus-outline"
  651. @click="handleEditTwo(scope.$index, scope.row)"
  652. >
  653. </el-button>
  654. </el-tooltip>
  655. <el-tooltip
  656. class="item"
  657. effect="dark"
  658. content="删除"
  659. placement="top"
  660. >
  661. <el-button
  662. size="mini"
  663. type="danger"
  664. icon="el-icon-delete"
  665. @click="DeleteWarehouseInfoItem(scope.$index, scope.row)"
  666. >
  667. </el-button>
  668. </el-tooltip>
  669. </template>
  670. </el-table-column>
  671. </el-table>
  672. </el-form>
  673. </span>
  674. <span slot="footer" class="dialog-footer">
  675. <el-button @click="editDialogVisible = false">取 消</el-button>
  676. <el-button type="primary" @click="submit()">保 存</el-button>
  677. </span>
  678. </el-dialog>
  679. <stock-in-dialog
  680. ref="dialog"
  681. :propForm="propForm"
  682. :visibility="isVisibility"
  683. v-on:dialog-comfirm="comfirm"
  684. v-on:dialog-cancle="cancle">
  685. </stock-in-dialog>
  686. </div>
  687. </template>
  688. <script>
  689. import stockInDialog from "./Dialog/stockInDialog";
  690. import { uParseTime } from "@/utils/tools";
  691. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  692. import {
  693. deleteWarehouseInfo,
  694. GetAllConfig,
  695. GetAllGoodInfo,
  696. GetAllGoodType,
  697. getWarehouseInfoList,
  698. getWarehouseList,
  699. DeleteWarehouseInfoItem,
  700. GetAllGoodInfoByID,
  701. EditWarehouse,
  702. getExportStockList
  703. } from "@/api/stock";
  704. import { GetAllDrugInfoByID,postDrugWarehouse} from "@/api/drug/drug_stock";
  705. import BreadCrumb from "../components/bread-crumb";
  706. export default {
  707. name: "stockIn",
  708. components: { BreadCrumb, stockInDialog },
  709. created() {
  710. var nowDate = new Date();
  711. var nowYear = nowDate.getFullYear();
  712. var nowMonth = nowDate.getMonth() + 1;
  713. var nowDay = nowDate.getDate();
  714. this.end_time =
  715. nowYear +
  716. "-" +
  717. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  718. "-" +
  719. (nowDay < 10 ? "0" + nowDay : nowDay);
  720. nowDate.setMonth(nowDate.getMonth() - 1);
  721. nowYear = nowDate.getFullYear();
  722. nowMonth = nowDate.getMonth() + 1;
  723. nowDay = nowDate.getDate();
  724. this.start_time =
  725. nowYear +
  726. "-" +
  727. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  728. "-" +
  729. (nowDay < 10 ? "0" + nowDay : nowDay);
  730. this.org_id = this.$store.getters.xt_user.org.id
  731. this.GetWarehouse();
  732. this.GetConfigInfo();
  733. this.fetchAllAdminUsers();
  734. this.GetAllGoodType()
  735. this.GetAllGoodInfo()
  736. },
  737. data() {
  738. var checkGoodId = (rule, value, callback) => {
  739. setTimeout(() => {
  740. if (value == "" || value == 0) {
  741. return callback(new Error("规格名称不能为空"));
  742. }
  743. }, 2000);
  744. };
  745. return {
  746. crumbs: [
  747. { path: false, name: "库存管理" },
  748. { path: false, name: "入库单" }
  749. ],
  750. searchKey: "",
  751. type: 1,
  752. page: 1,
  753. limit: 5,
  754. checked: false,
  755. total: 0,
  756. pageTotal: 0,
  757. pageSelect: 0,
  758. adminUserOptions: [],
  759. multipleSelection: [],
  760. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  761. start_time: "",
  762. end_time: "",
  763. goodType: [],
  764. goodInfo: [],
  765. manufacturer: [],
  766. selectedTableData: [],
  767. dealer: [],
  768. Warehouse: {
  769. loading: false,
  770. warehouseDate: [],
  771. tableCurrentIndex: ""
  772. },
  773. WarehouseInfo: {
  774. loading: false,
  775. warehouseInfoDate: [],
  776. warehouse: {}
  777. },
  778. startTime: "",
  779. dialogVisible:false,
  780. editDialogVisible:false,
  781. recordInfo: {
  782. recordData: [],
  783. stock_in_code: "",
  784. current_index: ""
  785. },
  786. tableRules: {
  787. price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
  788. warehousing_count: [
  789. { required: true, message: "数量不能为空", trigge: "blur" }
  790. ],
  791. good_id: [{ validator: checkGoodId, trigger: "blur" }]
  792. },
  793. form: {
  794. manufacturer:0,
  795. dealer:0
  796. },
  797. warehousing_time: '',
  798. warehouse:{},
  799. propForm: {
  800. goods: [],
  801. goodType: [],
  802. goodInfo: [],
  803. goodUnit: [],
  804. title: '入库',
  805. formValue: {
  806. good_type_id: '',
  807. good_id: '',
  808. number: '',
  809. product_date: '',
  810. expiry_date: '',
  811. warehousing_count: '',
  812. price: '',
  813. remark: '',
  814. dealer: '',
  815. manufacturer: ''
  816. },
  817. isCreated: 1,
  818. isVisibility: false,
  819. drug_id:1,
  820. },
  821. drug_id:1,
  822. tableShow:false,
  823. tableList:[],
  824. isVisibility:false,
  825. order_id:0,
  826. exportList:[],
  827. checkAllStatus:false,
  828. list:[],
  829. storehouse_id:0,
  830. check_type:0,
  831. checkList:[
  832. {id:0,name:"全部"},
  833. {id:1,name:"已审核"},
  834. {id:2,name:"未审核"},
  835. ],
  836. check_id: 0,
  837. exportLoding:false,
  838. org_id:0
  839. };
  840. },
  841. methods: {
  842. changeTypeName() {
  843. this.getlist();
  844. },
  845. getlist() {
  846. var params = {
  847. check_id: this.check_id,
  848. start_time: this.start_time,
  849. end_time: this.end_time,
  850. keyword: this.keywords,
  851. page: this.page,
  852. limit: this.limit,
  853. };
  854. getAllSecondOrderList(params).then((response) => {
  855. if (response.data.state == 1) {
  856. var list = response.data.data.list;
  857. this.tableList = list;
  858. var total = response.data.data.total;
  859. this.total = total;
  860. this.houseList = response.data.data.houseList;
  861. this.doctorList = response.data.data.doctorList;
  862. }
  863. });
  864. },
  865. changeCheckType(){
  866. this.GetWarehouse()
  867. },
  868. changeCheck() {
  869. this.$refs.multipleTable.clearSelection();
  870. if (this.checkAllStatus) {
  871. this.$refs.multipleTable.toggleAllSelection();
  872. }
  873. },
  874. search: function() {
  875. const Params = {
  876. page: this.page,
  877. limit: this.limit,
  878. start_time: this.start_time,
  879. end_time: this.end_time,
  880. type: this.type,
  881. keywords: this.searchKey,
  882. storehouse_id:this.storehouse_id,
  883. check_type:this.check_type,
  884. };
  885. this.Warehouse.warehouseDate = [];
  886. getWarehouseList(Params).then(response => {
  887. if (response.data.state == 0) {
  888. this.Warehouse.loading = false;
  889. this.$message.error(response.data.msg);
  890. return false;
  891. } else {
  892. this.Warehouse.loading = false;
  893. this.total = response.data.data.total;
  894. for (let i = 0; i < response.data.data.list.length; i++) {
  895. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  896. }
  897. }
  898. });
  899. },
  900. GetWarehouse: function() {
  901. const Params = {
  902. page: this.page,
  903. limit: this.limit,
  904. start_time: this.start_time,
  905. end_time: this.end_time,
  906. type: this.type,
  907. keywords: this.searchKey,
  908. storehouse_id:this.storehouse_id,
  909. check_type:this.check_type,
  910. };
  911. this.Warehouse.warehouseDate = [];
  912. getWarehouseList(Params).then(response => {
  913. if (response.data.state == 0) {
  914. this.Warehouse.loading = false;
  915. this.$message.error(response.data.msg);
  916. return false;
  917. } else {
  918. this.Warehouse.loading = false;
  919. this.total = response.data.data.total;
  920. for (let i = 0; i < response.data.data.list.length; i++) {
  921. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  922. }
  923. this.list = []
  924. var obj = {id:0,storehouse_name:"全部"}
  925. this.list.push(obj)
  926. for(let i=0;i<response.data.data.houselist.length;i++){
  927. this.list.push(response.data.data.houselist[i])
  928. }
  929. }
  930. });
  931. },
  932. tableRowClassName({ row, rowIndex }) {
  933. // 把每一行的索引放进row
  934. row.index = rowIndex;
  935. },
  936. onRowClick(row, event, column) {
  937. this.WarehouseInfo.warehouseInfoDate = [];
  938. this.Warehouse.tableCurrentIndex = row.index;
  939. const params = {
  940. id: row.id
  941. };
  942. this.WarehouseInfo.loading = true;
  943. getWarehouseInfoList(params).then(response => {
  944. if (response.data.state == 0) {
  945. this.WarehouseInfo.loading = false;
  946. this.$message.error(response.data.msg);
  947. return false;
  948. } else {
  949. this.WarehouseInfo.loading = false;
  950. for (let i = 0; i < response.data.data.info.length; i++) {
  951. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i]);
  952. }
  953. }
  954. });
  955. },
  956. getXuserName(id) {
  957. if (id <= 0) {
  958. return "";
  959. }
  960. var name = "";
  961. if (
  962. this.adminUserOptions == null ||
  963. typeof this.adminUserOptions.length === "undefined"
  964. ) {
  965. return name;
  966. }
  967. var leng = this.adminUserOptions.length;
  968. if (leng == 0) {
  969. return name;
  970. }
  971. for (let index = 0; index < leng; index++) {
  972. if (this.adminUserOptions[index].id == id) {
  973. name = this.adminUserOptions[index].name;
  974. break;
  975. }
  976. }
  977. return name;
  978. },
  979. fetchAllDoctorAndNurse() {
  980. fetchAllDoctorAndNurse().then(response => {
  981. if (response.data.state == 1) {
  982. this.doctorOptions = response.data.data.doctors;
  983. }
  984. });
  985. },
  986. fetchAllAdminUsers() {
  987. fetchAllAdminUsers().then(response => {
  988. if (response.data.state == 1) {
  989. this.adminUserOptions = response.data.data.users;
  990. var alen = this.adminUserOptions.length;
  991. for (let index = 0; index < alen; index++) {
  992. if (this.adminUserOptions[index].user_type == 2) {
  993. // this.doctorOptions.push(this.adminUserOptions[index]);
  994. }
  995. }
  996. }
  997. });
  998. },
  999. getSpecificationName: function(id) {
  1000. let name = "";
  1001. for (let i = 0; i < this.goodInfo.length; i++) {
  1002. if (this.goodInfo[i].id == id) {
  1003. name = this.goodInfo[i].specification_name;
  1004. }
  1005. }
  1006. return name;
  1007. },
  1008. getTypeName: function(id) {
  1009. let name = "";
  1010. for (let i = 0; i < this.goodType.length; i++) {
  1011. if (this.goodType[i].id == id) {
  1012. name = this.goodType[i].type_name;
  1013. }
  1014. }
  1015. return name;
  1016. },
  1017. getTypeNameOne:function(id){
  1018. let name = "";
  1019. for (let i = 0; i < this.goodInfo.length; i++) {
  1020. if (this.goodInfo[i].id == id) {
  1021. name = this.goodInfo[i].good_name;
  1022. }
  1023. }
  1024. return name;
  1025. },
  1026. GetAllGoodType: function() {
  1027. GetAllGoodType().then(response => {
  1028. if (response.data.state == 0) {
  1029. this.$message.error(response.data.msg);
  1030. return false;
  1031. } else {
  1032. for (let i = 0; i < response.data.data.goodType.length; i++) {
  1033. this.goodType.push(response.data.data.goodType[i]);
  1034. }
  1035. }
  1036. });
  1037. },
  1038. GetAllGoodInfo: function() {
  1039. GetAllGoodInfo().then(response => {
  1040. if (response.data.state == 0) {
  1041. this.$message.error(response.data.msg);
  1042. return false;
  1043. } else {
  1044. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  1045. this.goodInfo.push(response.data.data.goodInfo[i]);
  1046. }
  1047. }
  1048. });
  1049. },
  1050. clicks: function() {
  1051. },
  1052. handleWarehouse: function() {
  1053. this.$router.push({ path: "/stock/in/add", query: { type: this.type } });
  1054. },
  1055. handleReturnSales: function() {
  1056. // this.$router.push({path:'/patients/create'}
  1057. if (this.multipleSelection.length <= 0) {
  1058. this.$message.error("请选择退货商品");
  1059. return;
  1060. }
  1061. const ids = [];
  1062. for (let i = 0; i < this.multipleSelection.length; i++) {
  1063. ids.push(this.multipleSelection[i].id);
  1064. }
  1065. this.$router.push({ name: "salesReturn", query: { id: ids.join("&") } });
  1066. },
  1067. handleReturnSalesRecord: function() {
  1068. this.$router.push({ name: "salesReutrnRecord" });
  1069. },
  1070. handleWarehouseRecord: function() {
  1071. this.$router.push({ name: "warehouseRecord" });
  1072. },
  1073. handleSelectionChange: function(val) {
  1074. this.multipleSelection = val;
  1075. },
  1076. handleSizeChange(val) {
  1077. this.limit = val;
  1078. this.GetWarehouse();
  1079. },
  1080. handleCurrentChange(val) {
  1081. this.page = val;
  1082. this.GetWarehouse();
  1083. },
  1084. startTimeChange(val) {
  1085. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  1086. if (time > 0) {
  1087. this.$message.error("结束时间不能小于开始时间");
  1088. this.start_time = "";
  1089. } else {
  1090. this.startTime = this.getTimestamp(val);
  1091. this.GetWarehouse();
  1092. this.getlist()
  1093. }
  1094. },
  1095. endTimeChange(val) {
  1096. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  1097. if (time < 0) {
  1098. this.$message.error("结束时间不能小于开始时间");
  1099. this.end_time = "";
  1100. } else {
  1101. this.GetWarehouse();
  1102. this.getlist()
  1103. }
  1104. },
  1105. getTimestamp(time) {
  1106. // 把时间日期转成时间戳
  1107. return new Date(time).getTime() / 1000;
  1108. },
  1109. getTime(val, temp) {
  1110. if (val != 0) {
  1111. return uParseTime(val, temp);
  1112. } else {
  1113. return "";
  1114. }
  1115. },
  1116. calculate: function(val) {
  1117. return Math.round(parseFloat(val) * 100) / 100;
  1118. },
  1119. GetConfigInfo: function() {
  1120. GetAllConfig().then(response => {
  1121. if (response.data.state == 0) {
  1122. this.$message.error(response.data.msg);
  1123. return false;
  1124. } else {
  1125. this.manufacturer = response.data.data.manufacturer;
  1126. this.dealer = response.data.data.dealer;
  1127. // this.list = response.data.data.list
  1128. this.getlist()
  1129. }
  1130. });
  1131. },
  1132. getManufactuerName: function(manufacturer_id) {
  1133. for (let i = 0; i < this.manufacturer.length; i++) {
  1134. if (this.manufacturer[i].id == manufacturer_id) {
  1135. return this.manufacturer[i].manufacturer_name;
  1136. }
  1137. }
  1138. },
  1139. getDealerName: function(dealer_id) {
  1140. for (let i = 0; i < this.dealer.length; i++) {
  1141. if (this.dealer[i].id == dealer_id) {
  1142. return this.dealer[i].dealer_name;
  1143. }
  1144. }
  1145. },
  1146. handleEdit: function(index, row) {
  1147. this.$router.push({path:"/stock/in/order/edit?id="+row.id+"&supply_warehouse_id="+row.supply_warehouse_id+"&is_sys="+row.is_sys+"&is_check="+row.is_check+"&type="+row.type})
  1148. },
  1149. handleDelete: function(index, row) {
  1150. if(row.is_sys== 12){
  1151. this.$message.error("调拨入库数据不能删除!")
  1152. return false
  1153. }
  1154. if(row.supply_warehouse_id > 0){
  1155. this.$message.error("采购入库单不能删除!")
  1156. return false
  1157. }
  1158. if(row.is_check == 1){
  1159. this.$message.error("已审核的单据不能删除!")
  1160. return false
  1161. }
  1162. const ids = [];
  1163. ids.push(row.id);
  1164. const idStr = ids.join(",");
  1165. const params = {
  1166. ids: idStr
  1167. };
  1168. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  1169. confirmButtonText: "确定",
  1170. cancelButtonText: "取消",
  1171. type: "warning"
  1172. })
  1173. .then(() => {
  1174. deleteWarehouseInfo(params).then(response => {
  1175. if (response.data.state == 0) {
  1176. this.$message.error(response.data.msg);
  1177. return false;
  1178. } else {
  1179. this.$notify({
  1180. title: "成功",
  1181. message: "删除成功",
  1182. type: "success",
  1183. duration: 2000
  1184. });
  1185. for (let i = 0; i < ids.length; i++) {
  1186. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  1187. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  1188. this.Warehouse.warehouseDate.splice(y, 1);
  1189. }
  1190. }
  1191. }
  1192. }
  1193. });
  1194. })
  1195. .catch(() => {});
  1196. },
  1197. select(selection) {
  1198. var ids= []
  1199. for(let i=0;i<selection.length;i++){
  1200. ids.push(selection[i].id)
  1201. }
  1202. this.exportList = []
  1203. var str = ids.join(",")
  1204. this.order_id = str
  1205. this.selectedTableData = selection;
  1206. this.getlist()
  1207. },
  1208. batchDelete() {
  1209. if (this.selectedTableData.length <= 0) {
  1210. this.$message.error("请选择要删除的记录");
  1211. return;
  1212. }
  1213. const ids = [];
  1214. const idOne = []
  1215. for (let i = 0; i < this.selectedTableData.length; i++) {
  1216. if(this.selectedTableData[i].is_check == 1){
  1217. this.$message.error("已审核单据不能删除!")
  1218. return false
  1219. }
  1220. if(this.selectedTableData[i].is_sys ==12){
  1221. this.$message.error("调拨入库数据不能删除!")
  1222. return false
  1223. }
  1224. ids.push(this.selectedTableData[i].id);
  1225. if(this.selectedTableData[i].supply_warehouse_id >0){
  1226. idOne.push(this.selectedTableData[i].supply_warehouse_id)
  1227. }
  1228. }
  1229. for(let i=0;i<idOne.length;i++){
  1230. if(idOne[i] >0){
  1231. this.$message.error("采购入库数据不能删除!")
  1232. return false
  1233. }
  1234. }
  1235. const idStr = ids.join(",");
  1236. const params = {
  1237. ids: idStr
  1238. };
  1239. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  1240. confirmButtonText: "确定",
  1241. cancelButtonText: "取消",
  1242. type: "warning"
  1243. }).then(() => {
  1244. deleteWarehouseInfo(params).then(response => {
  1245. if (response.data.state == 0) {
  1246. this.$message.error(response.data.msg);
  1247. return false;
  1248. } else {
  1249. this.$notify({
  1250. title: "成功",
  1251. message: "删除成功",
  1252. type: "success",
  1253. duration: 2000
  1254. });
  1255. for (let i = 0; i < ids.length; i++) {
  1256. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  1257. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  1258. this.Warehouse.warehouseDate.splice(y, 1);
  1259. }
  1260. }
  1261. }
  1262. }
  1263. });
  1264. })
  1265. .catch(() => {});
  1266. },
  1267. // handleSearch(id){
  1268. // this.WarehouseInfo.warehouseInfoDate = [];
  1269. // this.GetOrderDetail(id)
  1270. // this.drug_id = id
  1271. // this.dialogVisible = true
  1272. // },
  1273. handleSearch(val){
  1274. this.tableList= []
  1275. this.GetOrderDetail(val.id)
  1276. this.drug_id = val.id
  1277. },
  1278. GetOrderDetail: function(id) {
  1279. const params = {
  1280. id: id
  1281. };
  1282. getWarehouseInfoList(params).then(response => {
  1283. if (response.data.state == 0) {
  1284. this.$message.error(response.data.msg);
  1285. return false;
  1286. } else {
  1287. this.tableShow = true
  1288. var obj = {name:"总计",total_count:0,is_total:1}
  1289. for (let i = 0; i < response.data.data.info.length; i++) {
  1290. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i]);
  1291. response.data.data.info[i].price = response.data.data.info[i].price.toString();
  1292. response.data.data.info[i].warehousing_count = response.data.data.info[i].warehousing_count.toString();
  1293. this.recordInfo.recordData.push(response.data.data.info[i]);
  1294. console.log("tablelist+++==+",this.tableList)
  1295. response.data.data.info[i].total_count = (response.data.data.info[i].warehousing_count * response.data.data.info[i].price).toFixed(2)
  1296. response.data.data.info[i].is_total = 0
  1297. obj.total_count += (response.data.data.info[i].warehousing_count * response.data.data.info[i].price)
  1298. this.tableList.push(response.data.data.info[i])
  1299. }
  1300. this.tableList.push(obj)
  1301. this.warehouse = response.data.data.warehousing;
  1302. this.warehousing_time = this.getTime(this.warehouse.warehousing_time,"{y}-{m}-{d}");
  1303. this.WarehouseInfo.warehouse = response.data.data.warehousing;
  1304. }
  1305. });
  1306. },
  1307. editRecord: function() {
  1308. this.editDialogVisible = true
  1309. },
  1310. deleteRecord: function() {
  1311. const ids = [];
  1312. ids.push(this.WarehouseInfo.warehouse.id);
  1313. const idStr = ids.join(",");
  1314. const params = {
  1315. ids: idStr
  1316. };
  1317. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  1318. confirmButtonText: "确定",
  1319. cancelButtonText: "取消",
  1320. type: "warning"
  1321. })
  1322. .then(() => {
  1323. deleteWarehouseInfo(params).then(response => {
  1324. if (response.data.state == 0) {
  1325. this.$message.error(response.data.msg);
  1326. return false;
  1327. } else {
  1328. this.$notify({
  1329. title: "成功",
  1330. message: "删除成功",
  1331. type: "success",
  1332. duration: 2000
  1333. });
  1334. this.$router.back(-1);
  1335. }
  1336. });
  1337. })
  1338. .catch(() => {});
  1339. },
  1340. typeName: function(good_type_id) {
  1341. let name = "";
  1342. for (let i = 0; i < this.goodType.length; i++) {
  1343. if (this.goodType[i].id == good_type_id) {
  1344. name = this.goodType[i].type_name;
  1345. }
  1346. }
  1347. return name;
  1348. },
  1349. showDialog(index, row) {
  1350. this.currentIndex = index;
  1351. const params = {
  1352. manufacturer_id: this.form.manufacturer,
  1353. dealer_id: this.form.dealer
  1354. };
  1355. this.propForm.goods = []
  1356. GetAllGoodInfoByID(params).then(response => {
  1357. if (response.data.state == 0) {
  1358. this.$message.error(response.data.msg);
  1359. return false;
  1360. } else {
  1361. if (response.data.data.goodInfo.length <= 0) {
  1362. this.$message.error("该厂商或经销商没有物品信息");
  1363. return;
  1364. }
  1365. this.$refs.dialog.show();
  1366. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  1367. this.propForm.goodType.push(
  1368. response.data.data.goodInfo[i].type
  1369. );
  1370. }
  1371. const obj = {};
  1372. this.propForm.goodType = this.propForm.goodType.reduce(
  1373. (cur, next) => {
  1374. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1375. return cur;
  1376. },
  1377. []
  1378. ); // 设置cur默认类型为数组,并且初始值为空的数组
  1379. }
  1380. for (let i = 0; i < this.propForm.goodType.length; i++) {
  1381. let goodInfo = [];
  1382. let goodObj = {};
  1383. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  1384. var respObj = response.data.data.goodInfo[a];
  1385. respObj["isSelected"] = false;
  1386. if (respObj.type.id == this.propForm.goodType[i].id) {
  1387. goodInfo.push(respObj);
  1388. }
  1389. }
  1390. const obj = {};
  1391. goodInfo = goodInfo.reduce((cur, next) => {
  1392. obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
  1393. return cur;
  1394. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  1395. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo);
  1396. this.propForm.goods.push(goodObj);
  1397. }
  1398. });
  1399. },
  1400. specificationName: function(drug_id) {
  1401. let name = "";
  1402. for (let i = 0; i < this.goodInfo.length; i++) {
  1403. if (this.goodInfo[i].id == drug_id) {
  1404. name = this.goodInfo[i].specification_name;
  1405. }
  1406. }
  1407. return name;
  1408. },
  1409. submit() {
  1410. this.$refs["tableForm"].validate(valid => {
  1411. if (valid) {
  1412. const array = this.recordInfo.recordData;
  1413. for (let i = 0; i < array.length; i++) {
  1414. if (array[i].good_type_id == 0) {
  1415. this.$message.error("商品类型不能为空");
  1416. return;
  1417. }
  1418. if (array[i].good_id == 0) {
  1419. this.$message.error("规格名称不能为空");
  1420. return;
  1421. }
  1422. }
  1423. const params = {
  1424. stockIn: this.recordInfo.recordData
  1425. };
  1426. EditWarehouse(
  1427. params,
  1428. this.warehousing_time,
  1429. this.drug_id,
  1430. this.type,
  1431. this.form.manufacturer,
  1432. this.form.dealer
  1433. ).then(response => {
  1434. if (response.data.state == 0) {
  1435. this.$message.error(response.data.msg);
  1436. return false;
  1437. } else {
  1438. this.$message.success("保存成功");
  1439. this.dialogVisible = false
  1440. this.editDialogVisible = false
  1441. }
  1442. });
  1443. } else {
  1444. return false;
  1445. }
  1446. });
  1447. },
  1448. changeManufacturer(val) {
  1449. },
  1450. changeDealer(val) {
  1451. },
  1452. DeleteWarehouseInfoItem: function(index, row) {
  1453. if (row.id == 0) {
  1454. this.recordInfo.recordData.splice(index, 1);
  1455. } else {
  1456. const params = {
  1457. id: row.id
  1458. };
  1459. this.$confirm("确认删除该入库商品信息记录?", "删除入库商品信息记录", {
  1460. confirmButtonText: "确定",
  1461. cancelButtonText: "取消",
  1462. type: "warning"
  1463. })
  1464. .then(() => {
  1465. DeleteWarehouseInfoItem(params).then(response => {
  1466. if (response.data.state == 0) {
  1467. this.$message.error(response.data.msg);
  1468. return false;
  1469. } else {
  1470. this.$message.success("删除成功");
  1471. this.recordInfo.recordData.splice(index, 1);
  1472. }
  1473. });
  1474. })
  1475. .catch(() => {});
  1476. }
  1477. },
  1478. handleEditTwo: function(index, row) {
  1479. const tempObj = {};
  1480. tempObj["id"] = 0;
  1481. tempObj["good_type_id"] = 0;
  1482. tempObj["good_id"] = 0;
  1483. tempObj["number"] = "";
  1484. tempObj["product_date"] = "";
  1485. tempObj["expiry_date"] = "";
  1486. tempObj["warehousing_count"] = "";
  1487. tempObj["price"] = "";
  1488. tempObj["remark"] = "";
  1489. tempObj["dealer"] = "";
  1490. tempObj["manufacturer"] = "";
  1491. this.recordInfo.recordData.push(tempObj);
  1492. },
  1493. comfirm: function(val) {
  1494. this.$refs.dialog.hide();
  1495. this.propForm.goodType = [];
  1496. this.propForm.goods = [];
  1497. if (val.selectedGoodInfo.length > 0) {
  1498. for (let i = val.selectedGoodInfo.length - 1; ; i--) {
  1499. if (i == 0) {
  1500. this.recordInfo.recordData[this.currentIndex].good_type_id =
  1501. val.selectedGoodInfo[i].good_type_id;
  1502. this.recordInfo.recordData[this.currentIndex].good_id =
  1503. val.selectedGoodInfo[i].id;
  1504. this.recordInfo.recordData[
  1505. this.currentIndex
  1506. ].price = val.selectedGoodInfo[i].buy_price.toString();
  1507. } else {
  1508. const tempForm = {};
  1509. tempForm["id"] = 0;
  1510. tempForm["good_type_id"] = val.selectedGoodInfo[i].good_type_id;
  1511. tempForm["good_id"] = val.selectedGoodInfo[i].id;
  1512. tempForm["number"] = "";
  1513. tempForm["product_date"] = "";
  1514. tempForm["expiry_date"] = "";
  1515. tempForm["warehousing_count"] = "";
  1516. tempForm["price"] = val.selectedGoodInfo[i].buy_price.toString();
  1517. tempForm["remark"] = "";
  1518. tempForm["dealer"] = "";
  1519. tempForm["manufacturer"] = "";
  1520. this.recordInfo.recordData.splice(
  1521. this.currentIndex + 1,
  1522. 0,
  1523. tempForm
  1524. );
  1525. }
  1526. }
  1527. }
  1528. this.currentIndex = -1;
  1529. },
  1530. cancle: function() {
  1531. this.$refs.dialog.hide();
  1532. this.propForm.goods = [];
  1533. this.propForm.goodType = [];
  1534. },
  1535. toPrint(){
  1536. if(this.order_id == ""){
  1537. this.$message.error("请勾选入库单")
  1538. }else{
  1539. this.$router.push("/stock/in/detail/print?id="+this.order_id)
  1540. }
  1541. },
  1542. getlist(){
  1543. this.exportLoding = true
  1544. var params = {
  1545. id:this.order_id,
  1546. start_time:this.start_time,
  1547. end_time:this.end_time,
  1548. storehouse_id:this.storehouse_id,
  1549. }
  1550. getExportStockList(params).then(response=>{
  1551. if(response.data.state == 1){
  1552. var list = response.data.data.list
  1553. for(let i=0;i<this.goodType.length;i++){
  1554. for(let j=0;j<list.length;j++){
  1555. if(this.goodType[i].id == list[j].good_type_id){
  1556. list[j].good_type_name = this.goodType[i].type_name
  1557. }
  1558. }
  1559. }
  1560. for(let i=0;i<list.length;i++){
  1561. list[i].unit = list[i].specification_name +"/"+ list[i].packing_unit
  1562. list[i].total_price = (list[i].warehousing_count * list[i].price).toFixed(2)
  1563. list[i].expiry_date = this.getTime(list[i].expiry_date,"{y}-{m}-{d}")
  1564. list[i].product_date = this.getTime(list[i].product_date,"{y}-{m}-{d}")
  1565. for(let j=0;j<this.manufacturer.length;j++){
  1566. if(list[i].manufacturer == this.manufacturer[j].id){
  1567. list[i].manufacturer = this.manufacturer[j].manufacturer_name
  1568. }
  1569. }
  1570. for(let z=0;z<this.dealer.length;z++){
  1571. if(list[i].dealer == this.dealer[z].id){
  1572. list[i].dealer = this.dealer[z].dealer_name
  1573. }
  1574. }
  1575. }
  1576. this.exportLoding = false
  1577. this.exportList = list
  1578. }
  1579. })
  1580. },
  1581. toExport(){
  1582. if(this.order_id == ""){
  1583. this.$message.error("请勾选入库单")
  1584. return
  1585. }
  1586. console.log("this.wowoowow",this.exportList)
  1587. import('@/vendor/Export2Excel').then(excel => {
  1588. for(let i=0;i<this.exportList.length;i++){
  1589. for(let j=0;j<this.goodType.length;j++){
  1590. if(this.exportList[i].good_type_id == this.goodType[j].id){
  1591. this.exportList[i].good_type_id = this.goodType[j].type_name
  1592. }
  1593. }
  1594. if(this.exportList[i].dealer == 0){
  1595. this.exportList[i].dealer = ""
  1596. }
  1597. if(this.exportList[i].manufacturer == 0){
  1598. this.exportList[i].manufacturer = ""
  1599. }
  1600. if(this.exportList[i].good_type_id == 0){
  1601. this.exportList[i].good_type_id = ""
  1602. }
  1603. this.exportList[i].warehousing_time = this.getTime(this.exportList[i].warehousing_time,"{y}-{m}-{d}")
  1604. }
  1605. const tHeader = ['单据日期','耗材名称','耗材类型', '规格&单位','批号','入库数量','进货价','总价','生产厂家','生产日期','有效期','经销商','批准文号','备注']
  1606. const filterVal = ['warehousing_time','good_name', 'good_type_id', 'unit','number','warehousing_count','price','total_price','manufacturer','product_date','expiry_date','dealer','license_number','remark']
  1607. const data = this.formatJson(filterVal, this.exportList)
  1608. excel.export_json_to_excel({
  1609. header: tHeader,
  1610. data,
  1611. filename: '耗材入库单详情'
  1612. })
  1613. this.downloadLoading = false
  1614. })
  1615. },
  1616. formatJson(filterVal, jsonData) {
  1617. return jsonData.map(v => filterVal.map(j => v[j]));
  1618. },
  1619. getHouseName(id){
  1620. var storehouse_name = ""
  1621. for(let i=0;i<this.list.length;i++){
  1622. if(id == this.list[i].id){
  1623. storehouse_name = this.list[i].storehouse_name
  1624. }
  1625. }
  1626. return storehouse_name
  1627. },
  1628. changeStoreHouse(){
  1629. this.GetWarehouse();
  1630. this.getlist()
  1631. }
  1632. }
  1633. };
  1634. </script>
  1635. <style rel="stylesheet/css" lang="scss" scoped>
  1636. .information {
  1637. border: 1px #dcdfe6 solid;
  1638. padding: 30px 20px 30px 20px;
  1639. .border {
  1640. border-bottom: 1px #dcdfe6 solid;
  1641. margin: 0px 0 20px 0;
  1642. }
  1643. }
  1644. .edit_separater {
  1645. border-top: 1px solid rgb(233, 233, 233);
  1646. margin-top: 15px;
  1647. margin-bottom: 15px;
  1648. }
  1649. </style>
  1650. <style>
  1651. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1652. font-size: 12px;
  1653. }
  1654. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1655. background: #6fb5fa;
  1656. }
  1657. .count {
  1658. color: #bd2c00;
  1659. }
  1660. .el-table td,
  1661. .el-table th.is-leaf,
  1662. .el-table--border,
  1663. .el-table--group {
  1664. border-color: #d0d3da;
  1665. }
  1666. .el-table--border::after,
  1667. .el-table--group::after,
  1668. .el-table::before {
  1669. background-color: #d0d3da;
  1670. }
  1671. </style>