stockFlow.vue 15KB

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