stockFlow.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container ">
  7. <div class="cell clearfix">
  8. 耗材名称:{{this.$route.query.good_name}} &nbsp;
  9. 库存: {{this.$route.query.overCount}}{{packing_unit}} &nbsp;
  10. 规格:{{this.$route.query.specification_name}} &nbsp;
  11. 厂家:{{this.$route.query.manufacturer}}
  12. </div>
  13. <div class="cell clearfix">
  14. <span>日期查询:</span>
  15. <el-date-picker
  16. size="small"
  17. v-model="start_time"
  18. prefix-icon="el-icon-date"
  19. :editable="false"
  20. style="width: 196px;"
  21. type="date"
  22. placeholder="选择日期时间"
  23. align="right"
  24. format="yyyy-MM-dd"
  25. value-format="yyyy-MM-dd"
  26. @change="startTimeChange"
  27. ></el-date-picker>-
  28. <el-date-picker
  29. size="small"
  30. v-model="end_time"
  31. prefix-icon="el-icon-date"
  32. :editable="false"
  33. style="width: 196px;margin-right:10px;"
  34. type="date"
  35. placeholder="选择日期时间"
  36. align="right"
  37. format="yyyy-MM-dd"
  38. value-format="yyyy-MM-dd"
  39. @change="endTimeChange"
  40. ></el-date-picker>
  41. <span>出入库方式:</span>
  42. <el-select v-model="stock_type" style="width:160px;margin-right:10px;" placeholder="请选择" @change="changeDrug">
  43. <el-option
  44. v-for="(item,index) in stockType"
  45. :key="index"
  46. :label="item.name"
  47. :value="item.id">
  48. </el-option>
  49. </el-select>
  50. </div>
  51. <el-table
  52. :data="tableList"
  53. border
  54. style="width: 100%">
  55. <el-table-column prop="date" label="序号" width="180" align="center">
  56. <template slot-scope="scope">
  57. {{scope.$index + 1}}
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="drug_type" label="出入库方式" width="180" align="center">
  61. <template slot-scope="scope">
  62. <span v-if="scope.row.consumable_type == 1">手动入库</span>
  63. <span v-if="scope.row.consumable_type == 2">手动出库</span>
  64. <span v-if="scope.row.consumable_type == 3">自动出库</span>
  65. <span v-if="scope.row.consumable_type == 4">手动退库</span>
  66. <span v-if="scope.row.consumable_type == 5">报损数量</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="drug_name" label="出/入库单据编码" align="center">
  70. <template slot-scope="scope">
  71. <span v-if="scope.row.consumable_type == 1">{{scope.row.warehousing_order}}</span>
  72. <span v-if="scope.row.consumable_type == 2">{{scope.row.warehouse_out_order_number}}</span>
  73. <span v-if="scope.row.consumable_type == 3">{{scope.row.warehouse_out_order_number}}</span>
  74. <span v-if="scope.row.consumable_type == 4">{{scope.row.cancel_order_number}}</span>
  75. <span v-if="scope.row.consumable_type == 5">{{scope.row.warehouse_out_order_number}}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column prop="drug_name" label="操作日期" align="center">
  79. <template slot-scope="scope">
  80. {{getTime(scope.row.ctime)}}
  81. </template>
  82. </el-table-column>
  83. <el-table-column prop="drug_name" label="数量" align="center">
  84. <template slot-scope="scope">
  85. <span>{{scope.row.count}}{{packing_unit}}</span>
  86. </template>
  87. </el-table-column>
  88. <!-- <el-table-column label="是否退库" align="center">
  89. <template slot-scope="scope">
  90. <span v-if="scope.row.is_edit == 2">是</span>
  91. <span v-if="scope.row.is_edit ==1">否</span>
  92. </template>
  93. </el-table-column> -->
  94. <el-table-column label="批次" align="center">
  95. <template slot-scope="scope">
  96. <span>{{scope.row.number}}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="drug_name" label="进/出货单价" align="center">
  100. <template slot-scope="scope">
  101. <span>{{scope.row.price}}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column prop="drug_name" label="有效期" align="center">
  105. <template slot-scope="scope" >
  106. <span>{{getTime(scope.row.expire_date,"{y}-{h}-{d}")}}</span>
  107. </template>
  108. </el-table-column>
  109. <!-- <el-table-column prop="drug_name" label="批准文号" align="center">
  110. <template slot-scope="scope" >
  111. <span>{{scope.row.license_number}}</span>
  112. </template>
  113. </el-table-column> -->
  114. <el-table-column prop="drug_name" label="生产商" align="center">
  115. <template slot-scope="scope">
  116. <span > {{getManufacturer(scope.row.manufacturer)}}</span>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. <el-pagination
  121. @size-change="handleSizeChange"
  122. @current-change="handleCurrentChange"
  123. :page-sizes="[10, 50, 100,500,1000]"
  124. :page-size="10"
  125. background
  126. align="right"
  127. style="margin-top:20px;"
  128. layout="total, sizes, prev, pager, next, jumper"
  129. :total="total"
  130. >
  131. </el-pagination>
  132. </div>
  133. </div>
  134. </template>
  135. <script>
  136. import { uParseTime } from '@/utils/tools'
  137. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  138. import {getStockDrugCount,getStockFlow} from "@/api/stock"
  139. export default {
  140. name: 'stockIn',
  141. created() {
  142. var nowDate = new Date();
  143. var nowYear = nowDate.getFullYear();
  144. var nowMonth = nowDate.getMonth() + 1;
  145. var nowDay = nowDate.getDate();
  146. this.end_time =
  147. nowYear +
  148. "-" +
  149. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  150. "-" +
  151. (nowDay < 10 ? "0" + nowDay : nowDay);
  152. nowDate.setMonth(nowDate.getMonth() - 1);
  153. nowYear = nowDate.getFullYear();
  154. nowMonth = nowDate.getMonth() + 1;
  155. nowDay = nowDate.getDate();
  156. this.start_time =
  157. nowYear +
  158. "-" +
  159. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  160. "-" +
  161. (nowDay < 10 ? "0" + nowDay : nowDay);
  162. // this.getlist()
  163. // this.getStockOutList()
  164. // this.getStockDrugCount()
  165. this.getStockFlow()
  166. this.packing_unit = this.$route.query.packing_unit
  167. },
  168. components: {
  169. BreadCrumb
  170. },
  171. data() {
  172. return {
  173. crumbs: [
  174. { path: false, name: '库存管理' },
  175. { path: '/stock/drugs/stock/query', name: '药品库存查询' },
  176. { path:'/drugstock/in/drugstockflow',name:'库存流水'}
  177. ],
  178. keywords: '',
  179. total: 0,
  180. multipleSelection: [],
  181. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  182. start_time: '',
  183. end_time: '',
  184. page: 1,
  185. limit: 10,
  186. goodType: [],
  187. goodInfo: [],
  188. tempArr: [],
  189. sameRowArr: [],
  190. WarehouseInfo: {
  191. loading: false,
  192. warehouseInfoDate: []
  193. },
  194. tableData:[],
  195. drug_category:0,
  196. stock_type:0,
  197. drugCategory:[
  198. {id:0,name:"全部"}
  199. ],
  200. drugTypeList:[],
  201. tableList:[],
  202. manufacturerList:[],
  203. stockType:[
  204. {id:0,name:"全部"},
  205. {id:1,name:"手动入库"},
  206. {id:2,name:"手动出库"},
  207. {id:3,name:"自动出库"},
  208. {id:4,name:"手动退库"},
  209. {id:5,name:"报损数量"},
  210. ],
  211. countList:[],
  212. outCountList:[],
  213. autoCountList:[],
  214. keywords:"",
  215. obj:{},
  216. packing_unit:"",
  217. cancelCountList:[]
  218. }
  219. },
  220. methods:{
  221. handleSizeChange(val) {
  222. this.limit = val
  223. this.getStockFlow()
  224. },
  225. handleCurrentChange(val) {
  226. this.page = val
  227. this.getStockFlow()
  228. },
  229. startTimeChange: function(val) {
  230. this.tableList = []
  231. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  232. if (time > 0) {
  233. this.$message.error("开始时间不能大于结束时间");
  234. this.start_time = "";
  235. } else {
  236. this.getStockFlow()
  237. }
  238. },
  239. endTimeChange: function(val) {
  240. this.tableList = []
  241. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  242. if (time < 0) {
  243. this.$message.error("结束时间不能小于开始时间");
  244. this.end_time = "";
  245. } else {
  246. this.getStockFlow()
  247. }
  248. },
  249. getManufacturer(id){
  250. var name = ""
  251. for(let i=0;i<this.manufacturerList.length;i++){
  252. if(id == this.manufacturerList[i].id){
  253. name = this.manufacturerList[i].manufacturer_name
  254. }
  255. }
  256. return name
  257. },
  258. getTime(val) {
  259. if(val < 0){
  260. return ""
  261. }
  262. if(val == ""){
  263. return ""
  264. }else {
  265. return uParseTime(val, '{y}-{m}-{d}')
  266. }
  267. },
  268. //入库详情
  269. // getlist(){
  270. // var params= {
  271. // limit:this.limit,
  272. // page:this.page,
  273. // id:this.$route.query.id,
  274. // start_time:this.start_time,
  275. // end_time:this.end_time,
  276. // is_sys:this.stockType
  277. // }
  278. // getStockInList(params).then(response=>{
  279. // if(response.data.state == 1){
  280. // var list = response.data.data.list
  281. // for(let i=0;i<list.length;i++){
  282. // list[i].stock_way = 4
  283. // this.tableList.push(list[i])
  284. // }
  285. // var total = response.data.data.total
  286. // this.total = total
  287. // // console.log("入库数据",this.tableList)
  288. // var manufacturerList = response.data.data.manufacturerList
  289. // this.manufacturerList = manufacturerList
  290. // }
  291. // })
  292. // },
  293. // getStockOutList(){
  294. // var params= {
  295. // limit:this.limit,
  296. // page:this.page,
  297. // id:this.$route.query.id,
  298. // start_time:this.start_time,
  299. // end_time:this.end_time,
  300. // is_sys:this.stock_type
  301. // }
  302. // getStockOutList(params).then(response=>{
  303. // if(response.data.state == 1){
  304. // var outList = response.data.data.outList
  305. // console.log("outList990-0000990",outList)
  306. // for(let i=0;i<outList.length;i++){
  307. // if(outList[i].is_sys == 0){
  308. // outList[i].stock_way = 3
  309. // }
  310. // if(outList[i].is_sys == 1){
  311. // outList[i].stock_way = 2
  312. // }
  313. // this.tableList.push(outList[i])
  314. // }
  315. // console.log("hhhhhhhhhh",this.tableList)
  316. // var total = response.data.data.total
  317. // this.total = total
  318. // }
  319. // })
  320. // },
  321. getStockDrugCount(){
  322. var params ={
  323. keywords: this.keywords,
  324. start_time:this.start_time,
  325. end_time:this.end_time,
  326. }
  327. getStockDrugCount(params).then(response=>{
  328. if(response.data.state == 1){
  329. var count = response.data.data.count
  330. // console.log("详情入库统计",count)
  331. this.countList = count
  332. var outlist = response.data.data.outList
  333. // console.log("详情出库数量",outlist)
  334. this.outCountList = outlist
  335. var autoCount = response.data.data.autoCount
  336. // console.log("详情自动出库",autoCount)
  337. this.autoCountList = autoCount
  338. var totalCount = response.data.data.totalCount
  339. // console.log("totalcount",totalCount)
  340. this.cancelCountList = totalCount
  341. }
  342. })
  343. },
  344. getInCount(id){
  345. var count= ""
  346. for(let i=0;i<this.countList.length;i++){
  347. if(id == this.countList[i].good_id){
  348. count = this.countList[i].count
  349. }
  350. }
  351. return count
  352. },
  353. getOutCount(id){
  354. console.log("id222",id)
  355. var count = ""
  356. for(let i=0;i<this.outCountList.length;i++){
  357. if(id == this.outCountList[i].good_id){
  358. count = this.outCountList[i].count
  359. }
  360. }
  361. return count
  362. },
  363. getAutoCount(id){
  364. var count= ""
  365. for(let i=0;i<this.autoCountList.length;i++){
  366. if(id == this.autoCountList[i].good_id){
  367. count = this.autoCountList[i].count
  368. }
  369. }
  370. return count
  371. },
  372. getCancelCount(id){
  373. var count = 0
  374. for(let i=0;i<this.cancelCountList.length;i++){
  375. if(id == this.cancelCountList[i].good_id){
  376. count = this.cancelCountList[i].count
  377. }
  378. }
  379. return count
  380. },
  381. getTimestamp(time) {
  382. // 把时间日期转成时间戳
  383. return new Date(time).getTime() / 1000;
  384. },
  385. changeDrug(val){
  386. this.tableList= []
  387. this.stock_type = val
  388. this.getStockFlow()
  389. },
  390. getStockCount(id){
  391. var stock_count = 0
  392. for(let i=0;i<this.countList.length;i++){
  393. if(id == this.countList[i].good_id){
  394. stock_count = this.countList[i].stock_count
  395. }
  396. }
  397. return stock_count
  398. },
  399. getStockFlow(){
  400. var params= {
  401. limit:this.limit,
  402. page:this.page,
  403. good_id:this.$route.query.id,
  404. start_time:this.start_time,
  405. end_time:this.end_time,
  406. is_sys:this.stock_type
  407. }
  408. getStockFlow(params).then(response=>{
  409. if(response.data.state == 1){
  410. var list = response.data.data.list
  411. console.log("list2323",list)
  412. var total = response.data.data.total
  413. console.log("total",total)
  414. this.tableList = list
  415. this.total = total
  416. var manufacturerList = response.data.data.manufacturerList
  417. this.manufacturerList = manufacturerList
  418. }
  419. })
  420. }
  421. }
  422. }
  423. </script>
  424. <style rel="stylesheet/css" lang="scss" scoped>
  425. .information {
  426. border: 1px #dcdfe6 solid;
  427. padding: 30px 20px 30px 20px;
  428. .border {
  429. border-bottom: 1px #dcdfe6 solid;
  430. margin: 0px 0 20px 0;
  431. }
  432. }
  433. .title {
  434. background: #409eff;
  435. height: 44px;
  436. line-height: 44px;
  437. padding: 0 0 0 10px;
  438. color: #fff;
  439. margin: 0 0 10px 0;
  440. }
  441. .edit_separater {
  442. border-top: 1px solid rgb(233, 233, 233);
  443. margin-top: 15px;
  444. margin-bottom: 15px;
  445. }
  446. </style>
  447. <style>
  448. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  449. font-size: 12px;
  450. }
  451. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  452. background: #6fb5fa;
  453. }
  454. .count {
  455. color: #bd2c00;
  456. }
  457. .el-table td,
  458. .el-table th.is-leaf,
  459. .el-table--border,
  460. .el-table--group {
  461. border-color: #d0d3da;
  462. }
  463. .el-table--border::after,
  464. .el-table--group::after,
  465. .el-table::before {
  466. background-color: #d0d3da;
  467. }
  468. </style>