stockFlow.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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. <span v-if="scope.row.consumable_type == 4">手动退库</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. </template>
  76. </el-table-column>
  77. <el-table-column prop="drug_name" label="操作日期" align="center">
  78. <template slot-scope="scope">
  79. {{getTime(scope.row.ctime)}}
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="drug_name" label="数量" align="center">
  83. <template slot-scope="scope">
  84. <span>{{scope.row.count}}{{packing_unit}}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="是否退库" align="center">
  88. <template slot-scope="scope">
  89. <span v-if="scope.row.is_edit == 2">是</span>
  90. <span v-if="scope.row.is_edit ==1">否</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="批次" align="center">
  94. <template slot-scope="scope">
  95. <span>{{scope.row.number}}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column prop="drug_name" label="进/出货单价" align="center">
  99. <template slot-scope="scope">
  100. <span>{{scope.row.price}}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="drug_name" label="有效期" align="center">
  104. <template slot-scope="scope" >
  105. <span>{{getTime(scope.row.expire_date,"{y}-{h}-{d}")}}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column prop="drug_name" label="批准文号" align="center">
  109. <template slot-scope="scope" >
  110. <span>{{scope.row.license_number}}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column prop="drug_name" label="生产商" align="center">
  114. <template slot-scope="scope">
  115. <span > {{getManufacturer(scope.row.manufacturer)}}</span>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <el-pagination
  120. @size-change="handleSizeChange"
  121. @current-change="handleCurrentChange"
  122. :page-sizes="[10, 50, 100,500,1000]"
  123. :page-size="10"
  124. background
  125. align="right"
  126. style="margin-top:20px;"
  127. layout="total, sizes, prev, pager, next, jumper"
  128. :total="total"
  129. >
  130. </el-pagination>
  131. </div>
  132. </div>
  133. </template>
  134. <script>
  135. import { uParseTime } from '@/utils/tools'
  136. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  137. import {getStockDrugCount,getStockFlow} from "@/api/stock"
  138. export default {
  139. name: 'stockIn',
  140. created() {
  141. var nowDate = new Date();
  142. var nowYear = nowDate.getFullYear();
  143. var nowMonth = nowDate.getMonth() + 1;
  144. var nowDay = nowDate.getDate();
  145. this.end_time =
  146. nowYear +
  147. "-" +
  148. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  149. "-" +
  150. (nowDay < 10 ? "0" + nowDay : nowDay);
  151. nowDate.setMonth(nowDate.getMonth() - 1);
  152. nowYear = nowDate.getFullYear();
  153. nowMonth = nowDate.getMonth() + 1;
  154. nowDay = nowDate.getDate();
  155. this.start_time =
  156. nowYear +
  157. "-" +
  158. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  159. "-" +
  160. (nowDay < 10 ? "0" + nowDay : nowDay);
  161. // this.getlist()
  162. // this.getStockOutList()
  163. this.getStockDrugCount()
  164. this.getStockFlow()
  165. this.packing_unit = this.$route.query.packing_unit
  166. },
  167. components: {
  168. BreadCrumb
  169. },
  170. data() {
  171. return {
  172. crumbs: [
  173. { path: false, name: '库存管理' },
  174. { path: '/stock/drugs/stock/query', name: '药品库存查询' },
  175. { path:'/drugstock/in/drugstockflow',name:'库存流水'}
  176. ],
  177. keywords: '',
  178. total: 0,
  179. multipleSelection: [],
  180. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  181. start_time: '',
  182. end_time: '',
  183. page: 1,
  184. limit: 10,
  185. goodType: [],
  186. goodInfo: [],
  187. tempArr: [],
  188. sameRowArr: [],
  189. WarehouseInfo: {
  190. loading: false,
  191. warehouseInfoDate: []
  192. },
  193. tableData:[],
  194. drug_category:0,
  195. stock_type:0,
  196. drugCategory:[
  197. {id:0,name:"全部"}
  198. ],
  199. drugTypeList:[],
  200. tableList:[],
  201. manufacturerList:[],
  202. stockType:[
  203. {id:0,name:"全部"},
  204. {id:1,name:"手动入库"},
  205. {id:2,name:"手动出库"},
  206. {id:3,name:"自动出库"},
  207. {id:4,name:"手动退库"},
  208. ],
  209. countList:[],
  210. outCountList:[],
  211. autoCountList:[],
  212. keywords:"",
  213. obj:{},
  214. packing_unit:"",
  215. cancelCountList:[]
  216. }
  217. },
  218. methods:{
  219. handleSizeChange(val) {
  220. this.limit = val
  221. this.getStockFlow()
  222. },
  223. handleCurrentChange(val) {
  224. this.page = val
  225. this.getStockFlow()
  226. },
  227. startTimeChange: function(val) {
  228. this.tableList = []
  229. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  230. if (time > 0) {
  231. this.$message.error("开始时间不能大于结束时间");
  232. this.start_time = "";
  233. } else {
  234. this.getStockFlow()
  235. }
  236. },
  237. endTimeChange: function(val) {
  238. this.tableList = []
  239. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  240. if (time < 0) {
  241. this.$message.error("结束时间不能小于开始时间");
  242. this.end_time = "";
  243. } else {
  244. this.getStockFlow()
  245. }
  246. },
  247. getManufacturer(id){
  248. var name = ""
  249. for(let i=0;i<this.manufacturerList.length;i++){
  250. if(id == this.manufacturerList[i].id){
  251. name = this.manufacturerList[i].manufacturer_name
  252. }
  253. }
  254. return name
  255. },
  256. getTime(val) {
  257. if(val < 0){
  258. return ""
  259. }
  260. if(val == ""){
  261. return ""
  262. }else {
  263. return uParseTime(val, '{y}-{m}-{d}')
  264. }
  265. },
  266. //入库详情
  267. // getlist(){
  268. // var params= {
  269. // limit:this.limit,
  270. // page:this.page,
  271. // id:this.$route.query.id,
  272. // start_time:this.start_time,
  273. // end_time:this.end_time,
  274. // is_sys:this.stockType
  275. // }
  276. // getStockInList(params).then(response=>{
  277. // if(response.data.state == 1){
  278. // var list = response.data.data.list
  279. // for(let i=0;i<list.length;i++){
  280. // list[i].stock_way = 4
  281. // this.tableList.push(list[i])
  282. // }
  283. // var total = response.data.data.total
  284. // this.total = total
  285. // // console.log("入库数据",this.tableList)
  286. // var manufacturerList = response.data.data.manufacturerList
  287. // this.manufacturerList = manufacturerList
  288. // }
  289. // })
  290. // },
  291. // getStockOutList(){
  292. // var params= {
  293. // limit:this.limit,
  294. // page:this.page,
  295. // id:this.$route.query.id,
  296. // start_time:this.start_time,
  297. // end_time:this.end_time,
  298. // is_sys:this.stock_type
  299. // }
  300. // getStockOutList(params).then(response=>{
  301. // if(response.data.state == 1){
  302. // var outList = response.data.data.outList
  303. // console.log("outList990-0000990",outList)
  304. // for(let i=0;i<outList.length;i++){
  305. // if(outList[i].is_sys == 0){
  306. // outList[i].stock_way = 3
  307. // }
  308. // if(outList[i].is_sys == 1){
  309. // outList[i].stock_way = 2
  310. // }
  311. // this.tableList.push(outList[i])
  312. // }
  313. // console.log("hhhhhhhhhh",this.tableList)
  314. // var total = response.data.data.total
  315. // this.total = total
  316. // }
  317. // })
  318. // },
  319. getStockDrugCount(){
  320. var params ={
  321. keywords: this.keywords,
  322. start_time:this.start_time,
  323. end_time:this.end_time,
  324. }
  325. getStockDrugCount(params).then(response=>{
  326. if(response.data.state == 1){
  327. var count = response.data.data.count
  328. // console.log("详情入库统计",count)
  329. this.countList = count
  330. var outlist = response.data.data.outList
  331. // console.log("详情出库数量",outlist)
  332. this.outCountList = outlist
  333. var autoCount = response.data.data.autoCount
  334. // console.log("详情自动出库",autoCount)
  335. this.autoCountList = autoCount
  336. var totalCount = response.data.data.totalCount
  337. // console.log("totalcount",totalCount)
  338. this.cancelCountList = totalCount
  339. }
  340. })
  341. },
  342. getInCount(id){
  343. var count= ""
  344. for(let i=0;i<this.countList.length;i++){
  345. if(id == this.countList[i].good_id){
  346. count = this.countList[i].count
  347. }
  348. }
  349. return count
  350. },
  351. getOutCount(id){
  352. console.log("id222",id)
  353. var count = ""
  354. for(let i=0;i<this.outCountList.length;i++){
  355. if(id == this.outCountList[i].good_id){
  356. count = this.outCountList[i].count
  357. }
  358. }
  359. return count
  360. },
  361. getAutoCount(id){
  362. var count= ""
  363. for(let i=0;i<this.autoCountList.length;i++){
  364. if(id == this.autoCountList[i].good_id){
  365. count = this.autoCountList[i].count
  366. }
  367. }
  368. return count
  369. },
  370. getCancelCount(id){
  371. var count = 0
  372. for(let i=0;i<this.cancelCountList.length;i++){
  373. if(id == this.cancelCountList[i].good_id){
  374. count = this.cancelCountList[i].count
  375. }
  376. }
  377. return count
  378. },
  379. getTimestamp(time) {
  380. // 把时间日期转成时间戳
  381. return new Date(time).getTime() / 1000;
  382. },
  383. changeDrug(val){
  384. this.tableList= []
  385. this.stock_type = val
  386. this.getStockFlow()
  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.stock_type
  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>