inventoryDetails.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div>
  3. <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom:10px;">
  4. <div>
  5. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changehouseList">
  6. <el-option
  7. v-for="(option, index) in houseList"
  8. :key="index"
  9. :label="option.storehouse_name"
  10. :value="option.id">
  11. </el-option>
  12. </el-select>
  13. <el-input
  14. size="small"
  15. style="width: 200px;margin-left:10px;"
  16. class="filter-item"
  17. v-model.trim="searchKey"
  18. placeholder="请输入药品名称"
  19. />
  20. <el-button
  21. size="small"
  22. class="filter-item"
  23. type="primary"
  24. icon="el-icon-search"
  25. @click="search"
  26. >搜索</el-button
  27. >
  28. </div>
  29. <div>
  30. <el-button size="small" type="primary" @click="print">盘点模版打印</el-button>
  31. </div>
  32. <!-- <div>
  33. <el-button size="small" type="primary" @click="print">打印</el-button>
  34. <el-button size="small" type="primary">导出</el-button>
  35. </div> -->
  36. </div>
  37. <el-table :data="tableData" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" style="width:100%">
  38. <el-table-column prop="date" label="药品名称" align="center">
  39. <template slot-scope="scope">
  40. {{scope.row.drug_name}}
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="name" label="规格" width="200" align="center">
  44. <template slot-scope="scope">
  45. {{scope.row.specification_name}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="name" label="单位" width="100" align="center">
  49. <template slot-scope="scope">
  50. {{scope.row.warehousing_unit}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="name" label="进价" width="100" align="center">
  54. <template slot-scope="scope">
  55. {{scope.row.last_price}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="name" label="生产厂商" width="200" align="center">
  59. <template slot-scope="scope">
  60. {{scope.row.manufacturer}}
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="name" label="有效日期" width="200" align="center">
  64. <template slot-scope="scope">
  65. {{getTime(scope.row.expiry_date)}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="name" label="仓库名称" width="200" align="center">
  69. <template slot-scope="scope">
  70. {{getHouseName(scope.row.storehouse_id)}}
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="name" label="盘点前数量" width="100" align="center">
  74. <template slot-scope="scope">
  75. <span v-if="scope.row.stock_max_number>0">{{scope.row.stock_max_number}}{{scope.row.warehousing_unit}} </span>
  76. <span v-if="scope.row.stock_min_number>0">{{scope.row.stock_min_number}}{{scope.row.min_unit}}</span>
  77. <span v-if="scope.row.stock_max_number == 0 && scope.row.stock_min_number == 0">0</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="name" label="盘点后数量" width="100" align="center">
  81. <template slot-scope="scope">
  82. <span v-if="scope.row.last_stock_max_number > 0">{{scope.row.last_stock_max_number}}{{scope.row.warehousing_unit}}</span>
  83. <span v-if="scope.row.last_stock_min_number>0">{{scope.row.last_stock_min_number}}{{scope.row.min_unit}}</span>
  84. <span v-if="scope.row.last_stock_max_number == 0 && scope.row.last_stock_min_number == 0">0</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="name" label="盘点类型" width="120" align="center">
  88. <template slot-scope="scope">
  89. <span v-if="scope.row.inventory_type == 10">盘盈</span>
  90. <span v-if="scope.row.inventory_type == 11">盘亏</span>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <el-pagination
  95. @size-change="handleSizeChange"
  96. @current-change="handleCurrentChange"
  97. :page-sizes="[10, 20, 50, 100]"
  98. :page-size="10"
  99. background
  100. style="margin-top:20px;text-align: right"
  101. layout="total, sizes, prev, pager, next, jumper"
  102. :total="total"
  103. >
  104. </el-pagination>
  105. </div>
  106. </template>
  107. <script>
  108. import { uParseTime } from '@/utils/tools'
  109. import { getInventoryDetailList } from "@/api/drug/drug"
  110. export default {
  111. name: "inventory",
  112. data() {
  113. return{
  114. searchKey:'',
  115. value1:'',
  116. value2:'',
  117. tableData: [],
  118. dialogVisible:false,
  119. form: {
  120. name: '',
  121. },
  122. total: 0,
  123. limit:10,
  124. page:1,
  125. storehouse_id:0,
  126. }
  127. },
  128. methods:{
  129. search(){
  130. this.getlist()
  131. },
  132. print(){
  133. this.$router.push({path:'/stock/drugs/inventoryPrint'})
  134. },
  135. handleSizeChange(val){
  136. this.limit = val
  137. this.getlist()
  138. },
  139. handleCurrentChange(val){
  140. this.page = val
  141. this.getlist()
  142. },
  143. getlist(){
  144. var params = {
  145. limit:this.limit,
  146. page:this.page,
  147. keyword:this.searchKey,
  148. storehouse_id:this.storehouse_id,
  149. }
  150. getInventoryDetailList(params).then(response=>{
  151. if(response.data.state == 1){
  152. this.total = response.data.data.total
  153. this.tableData = response.data.data.list
  154. this.doctorList = response.data.data.doctorList
  155. var obj = {id:0,storehouse_name:"全部"}
  156. this.houseList= []
  157. this.houseList.push(obj)
  158. for(let i=0;i<response.data.data.houseList.length;i++){
  159. this.houseList.push(response.data.data.houseList[i])
  160. }
  161. }
  162. })
  163. },
  164. getTime(val) {
  165. if(val == undefined){
  166. return ""
  167. }
  168. if(val < 0){
  169. return ""
  170. }
  171. if(val == ""){
  172. return ""
  173. }else {
  174. return uParseTime(val, '{y}-{m}-{d}')
  175. }
  176. },
  177. changehouseList(){
  178. this.houseList = []
  179. this.getlist()
  180. },
  181. getHouseName(id){
  182. var storehouse_name = ""
  183. for(let i=0;i<this.houseList.length;i++){
  184. if(id == this.houseList[i].id){
  185. storehouse_name = this.houseList[i].storehouse_name
  186. }
  187. }
  188. if(storehouse_name == "全部"){
  189. return ""
  190. }else{
  191. return storehouse_name
  192. }
  193. }
  194. },
  195. created(){
  196. this.getlist()
  197. },
  198. mounted() {
  199. },
  200. };
  201. </script>