drugBatchNumber.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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)}}&nbsp;
  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. </div>
  42. <el-table
  43. :data="tableList"
  44. border
  45. style="width: 100%">
  46. <el-table-column prop="date" label="序号" width="180" align="center">
  47. <template slot-scope="scope">
  48. {{scope.$index + 1}}
  49. </template>
  50. </el-table-column>
  51. <el-table-column prop="drug_type" label="入库单据编码" width="180" align="center">
  52. <template slot-scope="scope">
  53. {{scope.row.warehousing_order}}
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="drug_name" label="操作日期" align="center">
  57. <template slot-scope="scope">
  58. {{getTime(scope.row.ctime)}}
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="drug_name" label="有效期" align="center">
  62. <template slot-scope="scope">
  63. {{getTime(scope.row.expiry_date,"{y}-{m}-{d}")}}
  64. </template>
  65. </el-table-column>
  66. <el-table-column prop="drug_name" label="批号" align="center">
  67. <template slot-scope="scope">
  68. {{scope.row.number}}
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="drug_name" label="入库数量" align="center">
  72. <template slot-scope="scope">
  73. {{scope.row.stock_max_number}}{{scope.row.max_unit}}{{scope.row.stock_min_number}}{{scope.row.min_unit}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column prop="drug_name" label="进货单价" align="center">
  77. <template slot-scope="scope">
  78. {{scope.row.price}}
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <el-pagination
  83. @size-change="handleSizeChange"
  84. @current-change="handleCurrentChange"
  85. :page-sizes="[10, 50, 100,500,1000]"
  86. :page-size="10"
  87. background
  88. align="right"
  89. style="margin-top:20px;"
  90. layout="total, sizes, prev, pager, next, jumper"
  91. :total="total"
  92. >
  93. </el-pagination>
  94. </div>
  95. <setting-dialog
  96. ref="dialog"
  97. ></setting-dialog>
  98. </div>
  99. </template>
  100. <script>
  101. import { uParseTime } from '@/utils/tools'
  102. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  103. import { getBatchOrderDetail,getDrugCountList } from '@/api/drug/drug_stock'
  104. import SettingDialog from './settingDialog/index'
  105. import { getDictionaryDataConfig } from "@/utils/data";
  106. export default {
  107. name: 'stockIn',
  108. created() {
  109. var nowDate = new Date();
  110. var nowYear = nowDate.getFullYear();
  111. var nowMonth = nowDate.getMonth() + 1;
  112. var nowDay = nowDate.getDate();
  113. this.end_time =
  114. nowYear +
  115. "-" +
  116. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  117. "-" +
  118. (nowDay < 10 ? "0" + nowDay : nowDay);
  119. nowDate.setMonth(nowDate.getMonth() - 1);
  120. nowYear = nowDate.getFullYear();
  121. nowMonth = nowDate.getMonth() + 1;
  122. nowDay = nowDate.getDate();
  123. this.start_time =
  124. nowYear +
  125. "-" +
  126. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  127. "-" +
  128. (nowDay < 10 ? "0" + nowDay : nowDay);
  129. var drugCategory = getDictionaryDataConfig('system','drug_category')
  130. this.drugCategory.push(...drugCategory)
  131. this.drugTypeList = getDictionaryDataConfig('system','drug_type')
  132. this.getlist()
  133. this.getDrugCountList()
  134. },
  135. components: {
  136. SettingDialog,
  137. BreadCrumb
  138. },
  139. data() {
  140. return {
  141. crumbs: [
  142. { path: false, name: '库存管理' },
  143. { path: '/stock/drugs/stock/query', name: '药品库存查询' },
  144. { path:'/drugstock/in/drugstockflow',name:'库存流水'}
  145. ],
  146. keywords: '',
  147. total: 0,
  148. multipleSelection: [],
  149. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  150. start_time: '',
  151. end_time: '',
  152. page: 1,
  153. limit: 10,
  154. goodType: [],
  155. goodInfo: [],
  156. tempArr: [],
  157. sameRowArr: [],
  158. WarehouseInfo: {
  159. loading: false,
  160. warehouseInfoDate: []
  161. },
  162. tableData:[],
  163. drug_category:0,
  164. drugCategory:[
  165. {id:0,name:"全部"}
  166. ],
  167. drugTypeList:[],
  168. tableList:[],
  169. manufacturerList:[],
  170. countList:[],
  171. outCountList:[],
  172. autoCountList:[],
  173. minCount:[],
  174. drugOutList:[],
  175. }
  176. },
  177. methods:{
  178. getlist(){
  179. var params = {
  180. drug_id:this.$route.query.drug_id,
  181. page:this.page,
  182. limit:this.limit,
  183. }
  184. getBatchOrderDetail(params).then(response=>{
  185. if(response.data.state == 1){
  186. var detail = response.data.data.detail
  187. console.log("detail2343434",detail)
  188. this.tableList = detail
  189. var total = response.data.data.total
  190. console.log("total",total)
  191. this.total = total
  192. }
  193. })
  194. },
  195. getTime(val) {
  196. if(val < 0){
  197. return ""
  198. }
  199. if(val == ""){
  200. return ""
  201. }else {
  202. return uParseTime(val, '{y}-{m}-{d}')
  203. }
  204. },
  205. handleSizeChange(val) {
  206. this.limit = val;
  207. this.getlist();
  208. },
  209. handleCurrentChange(val) {
  210. this.page = val;
  211. this.getlist();
  212. },
  213. startTimeChange(val){
  214. this.start_time = val
  215. this.getlist()
  216. },
  217. endTimeChange(val){
  218. this.end_time = val
  219. this.getlist()
  220. },
  221. getDrugCountList(){
  222. var params = {
  223. keyword: this.keywords,
  224. start_time:this.start_time,
  225. end_time:this.end_time,
  226. }
  227. getDrugCountList(params).then(response=>{
  228. if(response.data.state == 1){
  229. var countlist = response.data.data.countList
  230. console.log("入库数据",countlist)
  231. this.countList = countlist
  232. var outcountlist = response.data.data.outCountList
  233. console.log("出库数据",outcountlist)
  234. this.outCountList = outcountlist
  235. var aucountlist = response.data.data.auCountList
  236. console.log("自动数据",aucountlist)
  237. this.autoCountList = aucountlist
  238. var minCount = response.data.data.minCount
  239. console.log("minCount",minCount)
  240. this.minCount = minCount
  241. var info = response.data.data.info
  242. for(let i=0;i<info.length;i++){
  243. if(info[i].count_unit == info[i].max_unit){
  244. info[i].count = info[i].count * info[i].min_number
  245. }
  246. }
  247. console.log("info2222222",info)
  248. this.drugOutList = info
  249. }
  250. })
  251. },
  252. getInCount(id){
  253. var count = ""
  254. for(let i=0;i<this.countList.length;i++){
  255. if(id == this.countList[i].drug_id){
  256. count = this.countList[i].count
  257. }
  258. }
  259. return count
  260. },
  261. getOutCount(id){
  262. var count = ""
  263. for(let i=0;i<this.outCountList.length;i++){
  264. if(id == this.outCountList[i].drug_id){
  265. count = this.outCountList[i].count
  266. }
  267. }
  268. return count
  269. },
  270. getAutoCount(id){
  271. var count= ""
  272. for(let i=0;i<this.autoCountList.length;i++){
  273. if(id == this.autoCountList[i].drug_id){
  274. count = this.autoCountList[i].count
  275. }
  276. }
  277. return count
  278. },
  279. getMinCount(id){
  280. var count=""
  281. for(let i=0;i<this.minCount.length;i++){
  282. if(id == this.minCount[i].drug_id){
  283. count = this.minCount[i].count
  284. }
  285. }
  286. return count
  287. },
  288. getCount(drug_id,min_number,max_unit,min_unit){
  289. var count= 0
  290. var str = ""
  291. var min_str = ""
  292. for(let i=0;i<this.drugOutList.length;i++){
  293. if(drug_id == this.drugOutList[i].drug_id){
  294. count += parseInt(this.drugOutList[i].count)
  295. }
  296. }
  297. if(parseInt(count/min_number)!=0){
  298. str = parseInt(count/min_number)+ max_unit
  299. }
  300. if((count%min_number)!=0){
  301. min_str = count%min_number + min_unit
  302. }
  303. return str + min_str
  304. },
  305. getCountOne(drug_id){
  306. var count= 0
  307. for(let i=0;i<this.drugOutList.length;i++){
  308. if(drug_id == this.drugOutList[i].drug_id){
  309. count += parseInt(this.drugOutList[i].count)
  310. }
  311. }
  312. return count
  313. },
  314. getCountTwo(drug_id,min_number,max_unit,min_unit){
  315. var total_count = 0
  316. var out_count = 0
  317. var count = 0
  318. var str = ""
  319. var str_min = ""
  320. total_count = this.getInCount(drug_id) * min_number
  321. out_count = this.getCountOne(drug_id)
  322. count = total_count-out_count
  323. if(parseInt(count/min_number)!=0){
  324. str = parseInt(count/min_number) + max_unit
  325. }
  326. if((count%min_number)!=0){
  327. str_min = count%min_number + min_unit
  328. }
  329. return str+str_min
  330. }
  331. }
  332. }
  333. </script>
  334. <style rel="stylesheet/css" lang="scss" scoped>
  335. .information {
  336. border: 1px #dcdfe6 solid;
  337. padding: 30px 20px 30px 20px;
  338. .border {
  339. border-bottom: 1px #dcdfe6 solid;
  340. margin: 0px 0 20px 0;
  341. }
  342. }
  343. .title {
  344. background: #409eff;
  345. height: 44px;
  346. line-height: 44px;
  347. padding: 0 0 0 10px;
  348. color: #fff;
  349. margin: 0 0 10px 0;
  350. }
  351. .edit_separater {
  352. border-top: 1px solid rgb(233, 233, 233);
  353. margin-top: 15px;
  354. margin-bottom: 15px;
  355. }
  356. </style>
  357. <style>
  358. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  359. font-size: 12px;
  360. }
  361. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  362. background: #6fb5fa;
  363. }
  364. .count {
  365. color: #bd2c00;
  366. }
  367. .el-table td,
  368. .el-table th.is-leaf,
  369. .el-table--border,
  370. .el-table--group {
  371. border-color: #d0d3da;
  372. }
  373. .el-table--border::after,
  374. .el-table--group::after,
  375. .el-table::before {
  376. background-color: #d0d3da;
  377. }
  378. </style>