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

drugStockFlow.vue 16KB

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