Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

drugStockFlow.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  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. 药品名称:<span>{{getName(this.$route.query.drug_id)}}</span>&nbsp;
  9. 库存: {{this.$route.query.over_plus}}
  10. 规格:<span>{{this.$route.query.unit}}</span>&nbsp;
  11. 厂家:<span>{{this.$route.query.manufacturer}}</span>&nbsp;
  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 == 7">自动退库</span>
  67. <span v-if="scope.row.consumable_type == 5">报损数量</span>
  68. <span v-if="scope.row.consumable_type == 10">盘盈</span>
  69. <span v-if="scope.row.consumable_type == 11">盘亏</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column prop="drug_name" label="出/入库单据编码" align="center">
  73. <template slot-scope="scope">
  74. <span v-if="scope.row.consumable_type == 1">{{scope.row.warehousing_order}}</span>
  75. <span v-if="scope.row.consumable_type == 2 || scope.row.consumable_type == 3">{{scope.row.warehouse_out_order_number}}</span>
  76. <span v-if="scope.row.consumable_type == 4 || scope.row.consumable_type == 7">{{scope.row.cancel_order_number}}</span>
  77. <span v-if="scope.row.consumable_type == 5">{{scope.row.warehouse_out_order_number}}</span>
  78. <span v-if="scope.row.consumable_type == 10 || scope.row.consumable_type == 11">{{scope.row.warehousing_order}}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column prop="drug_name" label="操作日期" align="center">
  82. <template slot-scope="scope">
  83. {{getTime(scope.row.ctime,"{y}-{h}-{d}")}}
  84. </template>
  85. </el-table-column>
  86. <el-table-column prop="drug_name" label="数量" align="center">
  87. <template slot-scope="scope">
  88. {{scope.row.count}}
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="drug_name" label="单位" align="center">
  92. <template slot-scope="scope">
  93. {{scope.row.max_unit}}
  94. </template>
  95. </el-table-column>
  96. <!-- <el-table-column prop="drug_name" label="剩余量" align="center">
  97. <template slot-scope="scope">
  98. {{getCountList(scope.row.BaseDrugLib.min_number,scope.row.DrugWarehouseInfo,scope.row.BaseDrugLib.max_unit,scope.row.BaseDrugLib.min_unit)}}
  99. </template>
  100. </el-table-column> -->
  101. <el-table-column prop="drug_name" label="单价" align="center">
  102. <template slot-scope="scope">
  103. <span>{{scope.row.price}}</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="drug_name" label="有效期" align="center">
  107. <template slot-scope="scope">
  108. {{getTime(scope.row.expire_date,"{y}-{h}-{d}")}}
  109. </template>
  110. </el-table-column>
  111. <el-table-column prop="drug_name" label="批号" align="center">
  112. <template slot-scope="scope">
  113. <span>{{scope.row.batch_number}}</span>
  114. </template>
  115. </el-table-column>
  116. <!-- <el-table-column prop="drug_name" label="生产商" align="center">
  117. <template slot-scope="scope">
  118. {{getManufacturer(scope.row.manufacturer)}}
  119. </template>
  120. </el-table-column> -->
  121. </el-table>
  122. <el-pagination
  123. @size-change="handleSizeChange"
  124. @current-change="handleCurrentChange"
  125. :page-sizes="[10, 50, 100,500,1000]"
  126. :page-size="10"
  127. background
  128. align="right"
  129. style="margin-top:20px;"
  130. layout="total, sizes, prev, pager, next, jumper"
  131. :total="total"
  132. >
  133. </el-pagination>
  134. </div>
  135. <setting-dialog
  136. ref="dialog"
  137. ></setting-dialog>
  138. </div>
  139. </template>
  140. <script>
  141. import { uParseTime } from '@/utils/tools'
  142. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  143. import { getDrugStockFlow,getOutDrugStockFlow,getDrugCountList,getDrugFlow } from '@/api/drug/drug_stock'
  144. import SettingDialog from './settingDialog/index'
  145. import { getDictionaryDataConfig } from "@/utils/data";
  146. export default {
  147. name: 'stockIn',
  148. created() {
  149. var nowDate = new Date();
  150. var nowYear = nowDate.getFullYear();
  151. var nowMonth = nowDate.getMonth() + 1;
  152. var nowDay = nowDate.getDate();
  153. this.end_time =
  154. nowYear +
  155. "-" +
  156. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  157. "-" +
  158. (nowDay < 10 ? "0" + nowDay : nowDay);
  159. nowDate.setMonth(nowDate.getMonth() - 1);
  160. nowYear = nowDate.getFullYear();
  161. nowMonth = nowDate.getMonth() + 1;
  162. nowDay = nowDate.getDate();
  163. this.start_time =
  164. nowYear +
  165. "-" +
  166. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  167. "-" +
  168. (nowDay < 10 ? "0" + nowDay : nowDay);
  169. var drugCategory = getDictionaryDataConfig('system','drug_category')
  170. this.drugCategory.push(...drugCategory)
  171. this.drugTypeList = getDictionaryDataConfig('system','drug_type')
  172. // this.getlist()
  173. // this.getOutList()
  174. // this.getDrugCountList()
  175. this.getDrugFlow()
  176. },
  177. components: {
  178. SettingDialog,
  179. BreadCrumb
  180. },
  181. data() {
  182. return {
  183. crumbs: [
  184. { path: false, name: '库存管理' },
  185. { path: '/stock/drugs/stock/query', name: '药品库存查询' },
  186. { path:'/drugstock/in/drugstockflow',name:'库存流水'}
  187. ],
  188. keywords: '',
  189. total: 0,
  190. multipleSelection: [],
  191. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  192. start_time: '',
  193. end_time: '',
  194. page: 1,
  195. limit: 10,
  196. goodType: [],
  197. goodInfo: [],
  198. tempArr: [],
  199. sameRowArr: [],
  200. WarehouseInfo: {
  201. loading: false,
  202. warehouseInfoDate: []
  203. },
  204. tableData:[],
  205. drug_category:0,
  206. stock_type:0,
  207. drugCategory:[
  208. {id:0,name:"全部"}
  209. ],
  210. drugTypeList:[],
  211. tableList:[],
  212. manufacturerList:[],
  213. list:[],
  214. stockType:[
  215. {id:0,name:"全部"},
  216. {id:1,name:"手动入库"},
  217. {id:2,name:"手动出库"},
  218. {id:3,name:"自动出库"},
  219. {id:4,name:"手动退库"},
  220. {id:10,name:"盘盈"},
  221. {id:11,name:"盘亏"}
  222. ],
  223. outList:[],
  224. countList:[],
  225. outCountList:[],
  226. autoCountList:[],
  227. drugOutList:[],
  228. total:0,
  229. drug:{},
  230. }
  231. },
  232. methods:{
  233. getlist(){
  234. console.log("2332233232",this.$route.query.drug_id)
  235. var params = {
  236. drug_id:this.$route.query.drug_id,
  237. start_time:this.start_time,
  238. end_time:this.end_time,
  239. page:this.page,
  240. limit:this.limit,
  241. stock_type:this.stock_type,
  242. }
  243. console.log("params23322323232332",params)
  244. getDrugStockFlow(params).then(response=>{
  245. if(response.data.state == 1){
  246. var list = response.data.data.list
  247. console.log("库存数量",list)
  248. for(let i=0;i<list.length;i++){
  249. list[i].drug_way = 4
  250. this.tableList.push(list[i])
  251. }
  252. var total = response.data.data.total
  253. this.total = total
  254. var manufacturerList = response.data.data.manufacturerList
  255. this.manufacturerList = manufacturerList
  256. }
  257. })
  258. },
  259. getOutList(){
  260. var params = {
  261. drug_id:this.$route.query.drug_id,
  262. start_time:this.start_time,
  263. end_time:this.end_time,
  264. page:this.page,
  265. limit:this.limit,
  266. stock_type:this.stock_type,
  267. }
  268. getOutDrugStockFlow(params).then(response=>{
  269. if(response.data.state == 1){
  270. var outList = response.data.data.outList
  271. console.log("outlist",outList)
  272. for(let i=0;i<outList.length;i++){
  273. if(outList[i].is_sys == 1){
  274. outList[i].drug_way = 2
  275. }
  276. if(outList[i].is_sys == 0){
  277. console.log("进来22222")
  278. outList[i].drug_way = 1
  279. }
  280. this.tableList.push(outList[i])
  281. }
  282. this.total = response.data.data.total
  283. console.log("出库列表数据",this.tableList)
  284. }
  285. })
  286. },
  287. handleSizeChange(val) {
  288. this.limit = val
  289. this.getDrugFlow()
  290. },
  291. handleCurrentChange(val) {
  292. this.page = val
  293. this.getDrugFlow()
  294. },
  295. startTimeChange: function(val) {
  296. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  297. if (time > 0) {
  298. this.$message.error("开始时间不能大于结束时间");
  299. this.start_time = "";
  300. } else {
  301. this.getDrugFlow()
  302. }
  303. },
  304. endTimeChange: function(val) {
  305. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  306. if (time < 0) {
  307. this.$message.error("结束时间不能小于开始时间");
  308. this.end_time = "";
  309. } else {
  310. this.getDrugFlow()
  311. }
  312. },
  313. getManufacturer(id){
  314. var name = ""
  315. for(let i=0;i<this.manufacturerList.length;i++){
  316. if(id == this.manufacturerList[i].id){
  317. name = this.manufacturerList[i].manufacturer_name
  318. }
  319. }
  320. return name
  321. },
  322. getTime(val) {
  323. if(val < 0){
  324. return ""
  325. }
  326. if(val == ""){
  327. return ""
  328. }else {
  329. return uParseTime(val, '{y}-{m}-{d}')
  330. }
  331. },
  332. getDrugCountList(){
  333. var params = {
  334. keyword: this.keywords,
  335. start_time:this.start_time,
  336. end_time:this.end_time,
  337. }
  338. getDrugCountList(params).then(response=>{
  339. if(response.data.state == 1){
  340. var countlist = response.data.data.countList
  341. // console.log("入库数据",countlist)
  342. this.countList = countlist
  343. var outcountlist = response.data.data.outCountList
  344. // console.log("出库数据",outcountlist)
  345. this.outCountList = outcountlist
  346. var aucountlist = response.data.data.auCountList
  347. // console.log("自动数据",aucountlist)
  348. this.autoCountList = aucountlist
  349. var minCount = response.data.data.minCount
  350. // console.log("minCount",minCount)
  351. this.minCount = minCount
  352. var info = response.data.data.info
  353. for(let i=0;i<info.length;i++){
  354. if(info[i].count_unit == info[i].max_unit){
  355. info[i].count = info[i].count * info[i].min_number
  356. }
  357. }
  358. // console.log("info2222222",info)
  359. this.drugOutList = info
  360. }
  361. })
  362. },
  363. getInCount(id){
  364. var count = ""
  365. for(let i=0;i<this.countList.length;i++){
  366. if(id == this.countList[i].drug_id){
  367. count = this.countList[i].count
  368. }
  369. }
  370. return count
  371. },
  372. getOutCount(id){
  373. var count = ""
  374. for(let i=0;i<this.outCountList.length;i++){
  375. if(id == this.outCountList[i].drug_id){
  376. count = this.outCountList[i].count
  377. }
  378. }
  379. return count
  380. },
  381. getAutoCount(id){
  382. var count= ""
  383. for(let i=0;i<this.autoCountList.length;i++){
  384. if(id == this.autoCountList[i].drug_id){
  385. count = this.autoCountList[i].count
  386. }
  387. }
  388. return count
  389. },
  390. getTimestamp(time) { // 把时间日期转成时间戳
  391. return (new Date(time)).getTime() / 1000
  392. },
  393. changeDrug(val){
  394. this.tableList = []
  395. this.getDrugFlow()
  396. },
  397. getMinCount(id){
  398. var count=""
  399. for(let i=0;i<this.minCount.length;i++){
  400. if(id == this.minCount[i].drug_id){
  401. count = this.minCount[i].count
  402. }
  403. }
  404. return count
  405. },
  406. getCount(drug_id,min_number,max_unit,min_unit){
  407. var count= 0
  408. var str = ""
  409. var min_str = ""
  410. for(let i=0;i<this.drugOutList.length;i++){
  411. if(drug_id == this.drugOutList[i].drug_id){
  412. count += parseInt(this.drugOutList[i].count)
  413. }
  414. }
  415. if(parseInt(count/min_number)!=0){
  416. str = parseInt(count/min_number)+ max_unit
  417. }
  418. if((count%min_number)!=0){
  419. min_str = count%min_number + min_unit
  420. }
  421. return str + min_str
  422. },
  423. getCountOne(drug_id){
  424. var count= 0
  425. for(let i=0;i<this.drugOutList.length;i++){
  426. if(drug_id == this.drugOutList[i].drug_id){
  427. count += parseInt(this.drugOutList[i].count)
  428. }
  429. }
  430. return count
  431. },
  432. getCountTwo(drug_id,min_number,max_unit,min_unit){
  433. var total_count = 0
  434. var out_count = 0
  435. var count = 0
  436. var str = ""
  437. var str_min = ""
  438. total_count = this.getInCount(drug_id) * min_number
  439. out_count = this.getCountOne(drug_id)
  440. count = total_count-out_count
  441. if(parseInt(count/min_number)!=0){
  442. str = parseInt(count/min_number) + max_unit
  443. }
  444. if((count%min_number)!=0){
  445. str_min = count%min_number + min_unit
  446. }
  447. console.log("str2323222",str)
  448. console.log("str22333333",str_min)
  449. return str+str_min
  450. },
  451. getDrugFlow(){
  452. var params = {
  453. drug_id:this.$route.query.drug_id,
  454. start_time:this.start_time,
  455. end_time:this.end_time,
  456. page:this.page,
  457. limit:this.limit,
  458. stock_type:this.stock_type,
  459. }
  460. getDrugFlow(params).then(response=>{
  461. if(response.data.state ==1){
  462. var list = response.data.data.list
  463. console.log("list232323232",list)
  464. this.tableList = list
  465. var total = response.data.data.total
  466. console.log("total23232",total)
  467. this.total =total
  468. this.manufacturerList = response.data.data.manufacturerList
  469. this.dealerList = response.data.data.dealerList
  470. var drug = response.data.data.drug
  471. console.log("drug233223232323223",drug)
  472. this.drug = drug
  473. }
  474. })
  475. },
  476. getCountList(min_number,val,max_unit,min_unit){
  477. var total = 0
  478. var str = ""
  479. var str_min = ""
  480. for(let i=0;i<val.length;i++){
  481. total += (val[i].stock_max_number * min_number + val[i].stock_min_number)
  482. }
  483. if(parseInt(total/min_number)!=0){
  484. str = parseInt(total/min_number) + max_unit
  485. }
  486. if((total%min_number)!=0){
  487. str_min = total%min_number + min_unit
  488. }
  489. return str+str_min
  490. },
  491. getName(drug_id){
  492. var name = ""
  493. if(drug_id == this.drug.id){
  494. name = this.drug.drug_name
  495. }
  496. return name
  497. }
  498. }
  499. }
  500. </script>
  501. <style rel="stylesheet/css" lang="scss" scoped>
  502. .information {
  503. border: 1px #dcdfe6 solid;
  504. padding: 30px 20px 30px 20px;
  505. .border {
  506. border-bottom: 1px #dcdfe6 solid;
  507. margin: 0px 0 20px 0;
  508. }
  509. }
  510. .title {
  511. background: #409eff;
  512. height: 44px;
  513. line-height: 44px;
  514. padding: 0 0 0 10px;
  515. color: #fff;
  516. margin: 0 0 10px 0;
  517. }
  518. .edit_separater {
  519. border-top: 1px solid rgb(233, 233, 233);
  520. margin-top: 15px;
  521. margin-bottom: 15px;
  522. }
  523. </style>
  524. <style>
  525. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  526. font-size: 12px;
  527. }
  528. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  529. background: #6fb5fa;
  530. }
  531. .count {
  532. color: #bd2c00;
  533. }
  534. .el-table td,
  535. .el-table th.is-leaf,
  536. .el-table--border,
  537. .el-table--group {
  538. border-color: #d0d3da;
  539. }
  540. .el-table--border::after,
  541. .el-table--group::after,
  542. .el-table::before {
  543. background-color: #d0d3da;
  544. }
  545. </style>