selfDrugBatchNumber.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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>{{drug.dose}}{{drug.dose_unit}}*{{drug.min_number}}{{drug.min_unit}}/{{drug.max_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. <!-- <span>
  51. <el-button type="primary" size="small" @click="toExprot">导出</el-button>
  52. <el-button type="primary" size="small" @click="toTongBu">同步</el-button>
  53. </span> -->
  54. </div>
  55. <el-table
  56. :data="tableList"
  57. border
  58. style="width: 100%">
  59. <el-table-column prop="date" label="序号" width="180" align="center">
  60. <template slot-scope="scope">
  61. {{scope.$index + 1}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="drug_type" label="出入库方式" width="180" align="center">
  65. <template slot-scope="scope">
  66. <span v-if="scope.row.consumable_type == 1">手动入库</span>
  67. <span v-if="scope.row.consumable_type == 2">手动出库</span>
  68. <span v-if="scope.row.consumable_type == 3">自动出库</span>
  69. <span v-if="scope.row.consumable_type == 4">手动退库</span>
  70. <span v-if="scope.row.consumable_type == 7">自动退库</span>
  71. <span v-if="scope.row.consumable_type == 5">报损数量</span>
  72. <span v-if="scope.row.consumable_type == 10">盘盈</span>
  73. <span v-if="scope.row.consumable_type == 11">盘亏</span>
  74. <span v-if="scope.row.consumable_type == 12">调拨出库</span>
  75. <span v-if="scope.row.consumable_type == 13">调拨入库</span>
  76. <span v-if="scope.row.consumable_type == 15">结算出库</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column prop="drug_name" label="入库单据编码" align="center">
  80. <template slot-scope="scope">
  81. <span v-if="scope.row.consumable_type == 1">{{scope.row.warehousing_order}}</span>
  82. <span v-if="scope.row.consumable_type == 2 || scope.row.consumable_type == 3 || scope.row.consumable_type == 12 || scope.row.consumable_type == 15">{{scope.row.warehouse_out_order_number}}</span>
  83. <span v-if="scope.row.consumable_type == 4 || scope.row.consumable_type == 7">{{scope.row.cancel_order_number}}</span>
  84. <span v-if="scope.row.consumable_type == 5">{{scope.row.warehouse_out_order_number}}</span>
  85. <span v-if="scope.row.consumable_type == 10 || scope.row.consumable_type == 11 || scope.row.consumable_type == 13">{{scope.row.warehousing_order}}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="drug_name" label="入库日期" align="center">
  89. <template slot-scope="scope">
  90. {{getTime(scope.row.ctime,"{y}-{h}-{d}")}}
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="drug_name" label="操作日期" align="center">
  94. <template slot-scope="scope">
  95. {{getTime(scope.row.operate_time,"{y}-{h}-{d}")}}
  96. </template>
  97. </el-table-column>
  98. <el-table-column prop="drug_name" label="入库数量&单位" align="center">
  99. <template slot-scope="scope">
  100. <span v-if="scope.row.consumable_type != 2 && scope.row.consumable_type != 3 && scope.row.consumable_type != 5 && scope.row.consumable_type != 7">{{scope.row.count}}{{scope.row.max_unit}}</span>
  101. <span v-if="(scope.row.consumable_type == 2 || scope.row.consumable_type == 3 || scope.row.consumable_type == 5 || scope.row.consumable_type == 7) && parseInt(scope.row.count/scope.row.BaseDrugLib.min_number) >0">{{parseInt(scope.row.count/scope.row.BaseDrugLib.min_number)}}{{scope.row.BaseDrugLib.max_unit}}</span>
  102. <span v-if="(scope.row.consumable_type == 2 || scope.row.consumable_type == 3 || scope.row.consumable_type == 5 || scope.row.consumable_type == 7) && scope.row.count%scope.row.BaseDrugLib.min_number >0">{{scope.row.count%scope.row.BaseDrugLib.min_number}}{{scope.row.BaseDrugLib.min_unit}}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column prop="drug_name" label="有效期" align="center">
  106. <template slot-scope="scope">
  107. {{getTime(scope.row.expire_date,"{y}-{h}-{d}")}}
  108. </template>
  109. </el-table-column>
  110. <el-table-column prop="drug_name" label="剩余库存" align="center">
  111. <template slot-scope="scope">
  112. {{ scope.row.over_count }} {{ drug.min_unit }}
  113. </template>
  114. </el-table-column>
  115. <el-table-column prop="remark" label="备注" align="center">
  116. <template slot-scope="scope">
  117. <span > {{scope.row.remark}}</span>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <el-pagination
  122. @size-change="handleSizeChange"
  123. @current-change="handleCurrentChange"
  124. :page-sizes="[10, 50, 100,500,1000]"
  125. :page-size="10"
  126. background
  127. align="right"
  128. style="margin-top:20px;"
  129. layout="total, sizes, prev, pager, next, jumper"
  130. :total="total"
  131. >
  132. </el-pagination>
  133. </div>
  134. <setting-dialog
  135. ref="dialog"
  136. ></setting-dialog>
  137. </div>
  138. </template>
  139. <script>
  140. import { uParseTime } from '@/utils/tools'
  141. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  142. import { getSelfDrugBatchNumberList } from '@/api/drug/drug'
  143. export default {
  144. components: {
  145. BreadCrumb
  146. },
  147. data(){
  148. return{
  149. crumbs: [
  150. { path: false, name: '库存管理' },
  151. { path: '/stock/drugs/stock/query', name: '药品库存查询' },
  152. { path:'/drugstock/in/drugstockflow',name:'库存流水'}
  153. ],
  154. keywords: '',
  155. total: 0,
  156. multipleSelection: [],
  157. signAndWeighBoxPatients: 'sign-and-weigh-box-patients',
  158. start_time: '',
  159. end_time: '',
  160. page: 1,
  161. limit: 10,
  162. goodType: [],
  163. goodInfo: [],
  164. tempArr: [],
  165. sameRowArr: [],
  166. WarehouseInfo: {
  167. loading: false,
  168. warehouseInfoDate: []
  169. },
  170. tableData:[],
  171. drug_category:0,
  172. stock_type:0,
  173. drugCategory:[
  174. {id:0,name:"全部"}
  175. ],
  176. drugTypeList:[],
  177. tableList:[],
  178. manufacturerList:[],
  179. list:[],
  180. stockType:[
  181. {id:0,name:"全部"},
  182. {id:1,name:"手动入库"},
  183. {id:2,name:"手动出库"},
  184. {id:3,name:"自动出库"},
  185. {id:4,name:"手动退库"},
  186. {id:10,name:"盘盈"},
  187. {id:11,name:"盘亏"},
  188. {id:12,name:"调拨出库"},
  189. {id:13,name:"调拨入库"},
  190. {id:15,name:"结算出库"}
  191. ],
  192. outList:[],
  193. countList:[],
  194. outCountList:[],
  195. autoCountList:[],
  196. drugOutList:[],
  197. total:0,
  198. houseList:[],
  199. patientList:[],
  200. drug:{},
  201. patients:[]
  202. }
  203. },
  204. created(){
  205. this.getlist()
  206. },
  207. methods:{
  208. startTimeChange: function(val) {
  209. this.tableList = []
  210. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  211. if (time > 0) {
  212. this.$message.error("开始时间不能大于结束时间");
  213. this.start_time = "";
  214. } else {
  215. this.getlist()
  216. }
  217. },
  218. endTimeChange: function(val) {
  219. this.tableList = []
  220. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  221. if (time < 0) {
  222. this.$message.error("结束时间不能小于开始时间");
  223. this.end_time = "";
  224. } else {
  225. this.getlist()
  226. }
  227. },
  228. changeDrug(val){
  229. this.tableList= []
  230. this.stock_type = val
  231. this.getlist()
  232. },
  233. handleSizeChange(val) {
  234. this.limit = val
  235. this.getlist()
  236. },
  237. handleCurrentChange(val) {
  238. this.page = val
  239. this.getlist()
  240. },
  241. getlist(){
  242. var params = {
  243. drug_id:this.$route.query.drug_id,
  244. start_time:this.start_time,
  245. end_time:this.end_time,
  246. page:this.page,
  247. limit:this.limit,
  248. patient_id:this.$route.query.patient_id,
  249. }
  250. getSelfDrugBatchNumberList(params).then(response=>{
  251. if(response.data.state ==1){
  252. var list = response.data.data.list
  253. this.tableList =list
  254. var total = response.data.data.total
  255. this.total = total
  256. this.drug =response.data.data.drug
  257. }
  258. })
  259. },
  260. getName(drug_id){
  261. var name = ""
  262. if(drug_id == this.drug.id){
  263. name = this.drug.drug_name
  264. }
  265. return name
  266. },
  267. getTime(val) {
  268. if(val < 0){
  269. return ""
  270. }
  271. if(val == ""){
  272. return ""
  273. }else {
  274. return uParseTime(val, '{y}-{m}-{d}')
  275. }
  276. },
  277. }
  278. }
  279. </script>