stockPrint.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-row style="float:right;">
  6. <el-col :span="24">
  7. <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
  8. </el-col>
  9. </el-row>
  10. </div>
  11. <div class="app-container" style="background-color: white;">
  12. <div id="print_content">
  13. <div class="print_main_content">
  14. <div class="order_title_panl">
  15. <span class="main_title">耗材管理查询表</span>
  16. </div>
  17. <div style="text-align:right;margin-bottom:20px;font-size: 18px;">
  18. 打印时间:{{time_now}}
  19. </div>
  20. <div class="table_panel">
  21. <table class="table">
  22. <thead>
  23. <tr>
  24. <td width="80">耗材类型</td>
  25. <td width="80">耗材名称</td>
  26. <td width="80">规格&单位</td>
  27. <td width="80">进货单价</td>
  28. <td width="80">生产商</td>
  29. <td width="80">入库数量</td>
  30. <td width="80">出库数量</td>
  31. <td width="80">剩余库存</td>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <tr v-for='(item,index) in tableList' :key="index">
  36. <td>{{getGoodType(item.good_type_id)}}</td>
  37. <td>{{item.good_name }}</td>
  38. <td><span>{{item.specification_name }} / {{item.packing_unit}}</span></td>
  39. <td>{{item.price}}</td>
  40. <td>{{getManufacture(item.manufacturer)}}</td>
  41. <td>{{getInCount(item.good_id)}}</td>
  42. <!-- <td><span>{{getOutCount(item.good_id) + getAutoCount(item.good_id)}}</span></td> -->
  43. <td><span>{{getInCount(item.good_id) - getStockCount(item.good_id)}}{{item.packing_unit}}</span></td>
  44. <!-- <td>{{getInCount(item.good_id)- getOutCount(item.good_id) - getAutoCount(item.good_id)}}</td> -->
  45. <!-- <td>{{getCancelCount(item.good_id)}}{{item .packing_unit}}</td> -->
  46. <td> {{getStockCount(item.good_id)}} {{item.packing_unit}} </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  58. import { getAllStockList,GetAllGoodType,getStockDrugCount } from "@/api/stock";
  59. import print from 'print-js'
  60. const moment = require('moment')
  61. export default {
  62. components:{
  63. BreadCrumb
  64. },
  65. data(){
  66. return{
  67. crumbs: [
  68. { path: false, name: '库存管理' },
  69. { path: false, name: '库存查询' },
  70. { path: false, name: '库存查询打印' },
  71. ],
  72. start_time:"",
  73. end_time:"",
  74. drug_name:"",
  75. drug_spec:"",
  76. keyword:"",
  77. tableData:[],
  78. time_now:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
  79. type_name:"",
  80. limit:"",
  81. page:"",
  82. WarehouseInfo: {
  83. loading: false,
  84. warehouseInfoDate: [],
  85. },
  86. tableList:[],
  87. goodType:[],
  88. manufacturerList:[],
  89. countList:[],
  90. outCountList:[],
  91. autoCountList:[],
  92. cancelCountList:[],
  93. }
  94. },
  95. methods:{
  96. printAction: function() {
  97. const style = '@media print { .print_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 20px 0; } .order_title_panl { text-align: center; } .main_title { font-size: 18px; line-height: 40px; font-weight: 500; } .table_panel { } .table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } thead tr td { border: 1px solid; text-align: center; font-size: 16px; padding: 15px 5px; } tbody tr td { border: 1px solid; text-align: center; font-size: 16px; padding: 10px 5px; white-space: pre-line;} .proj { padding: 5px 0; text-align: left; } .proj_title { font-size: 16px; font-weight: 500; line-height: 25px; } .proj_item { font-size: 15px; line-height: 20px; } .zone_name { font-weight: 500; } }'
  98. printJS({
  99. printable: 'print_content',
  100. type: 'html',
  101. documentTitle: ' ',
  102. style: style,
  103. scanStyles: false
  104. })
  105. },
  106. getlist(){
  107. const params = {
  108. page: this.page,
  109. limit: this.limit,
  110. keywords: this.keywords,
  111. start_time:this.start_time,
  112. end_time:this.end_time,
  113. type:this.type_name,
  114. }
  115. getAllStockList(params).then(response=>{
  116. if(response.data.state == 1){
  117. var list = response.data.data.list
  118. console.log("list22222",list)
  119. this.tableList = list
  120. var total = response.data.data.total
  121. console.log("total",total)
  122. this.total = total
  123. var manufacturerList = response.data.data.manufacturerList
  124. this.manufacturerList = manufacturerList
  125. }
  126. })
  127. },
  128. GetAllGoodType() {
  129. GetAllGoodType().then(response => {
  130. if (response.data.state == 0) {
  131. this.$message.error(response.data.msg);
  132. return false;
  133. } else {
  134. for (let i = 0; i < response.data.data.goodType.length; i++) {
  135. this.goodType.push(response.data.data.goodType[i]);
  136. }
  137. }
  138. });
  139. },
  140. stockInCount: function(row) {
  141. let total = 0;
  142. for (let i = 0; i < row.query_warehousing_info.length; i++) {
  143. total = total + row.query_warehousing_info[i].warehousing_count;
  144. }
  145. return total;
  146. },
  147. salesReturnCount: function(row) {
  148. let total = 0;
  149. for (let i = 0; i < row.query_sales_return_info.length; i++) {
  150. total = total + row.query_sales_return_info[i].count;
  151. }
  152. return total;
  153. },
  154. stockOutCount: function(row) {
  155. let total = 0;
  156. for (let i = 0; i < row.query_warehouseout_info.length; i++) {
  157. total = total + row.query_warehouseout_info[i].count;
  158. }
  159. return total;
  160. },
  161. cancelStockCount: function(row) {
  162. let total = 0;
  163. for (let i = 0; i < row.query_cancel_stock_info.length; i++) {
  164. total = total + row.query_cancel_stock_info[i].count;
  165. }
  166. return total;
  167. },
  168. getGoodType(id){
  169. var name = ""
  170. for(let i=0;i<this.goodType.length;i++){
  171. if(id == this.goodType[i].id){
  172. name = this.goodType[i].type_name
  173. }
  174. }
  175. return name
  176. },
  177. getManufacture(id){
  178. var name = ""
  179. for(let i=0;i<this.manufacturerList.length;i++){
  180. if(id == this.manufacturerList[i].id){
  181. name = this.manufacturerList[i].manufacturer_name
  182. }
  183. }
  184. return name
  185. },
  186. getStockDrugCount(){
  187. var params ={
  188. keywords: this.keywords,
  189. start_time:this.start_time,
  190. end_time:this.end_time,
  191. }
  192. getStockDrugCount(params).then(response=>{
  193. if(response.data.state == 1){
  194. var count = response.data.data.count
  195. console.log("入库统计",count)
  196. this.countList = count
  197. var outlist = response.data.data.outList
  198. console.log("出库数量",outlist)
  199. this.outCountList = outlist
  200. var autoCount = response.data.data.autoCount
  201. console.log("autoCount",autoCount)
  202. this.autoCountList = autoCount
  203. var totalCount = response.data.data.totalCount
  204. console.log("totalcount",totalCount)
  205. this.cancelCountList = totalCount
  206. }
  207. })
  208. },
  209. getInCount(id){
  210. var count= ""
  211. for(let i=0;i<this.countList.length;i++){
  212. if(id == this.countList[i].good_id){
  213. count = this.countList[i].count
  214. }
  215. }
  216. return count
  217. },
  218. getOutCount(id){
  219. var count = ""
  220. for(let i=0;i<this.outCountList.length;i++){
  221. if(id == this.outCountList[i].good_id){
  222. count = this.outCountList[i].count
  223. }
  224. }
  225. return count
  226. },
  227. getAutoCount(id){
  228. var count= ""
  229. for(let i=0;i<this.autoCountList.length;i++){
  230. if(id == this.autoCountList[i].good_id){
  231. count = this.autoCountList[i].count
  232. }
  233. }
  234. return count
  235. },
  236. getCancelCount(id){
  237. var count = 0
  238. for(let i=0;i<this.cancelCountList.length;i++){
  239. if(id == this.cancelCountList[i].good_id){
  240. count = this.cancelCountList[i].count
  241. }
  242. }
  243. return count
  244. },
  245. getStockCount(id){
  246. var stock_count = 0
  247. for(let i=0;i<this.countList.length;i++){
  248. if(id == this.countList[i].good_id){
  249. stock_count = this.countList[i].stock_count
  250. }
  251. }
  252. return stock_count
  253. }
  254. },
  255. created(){
  256. var starttime = this.$route.query.start_time
  257. this.start_time = starttime
  258. var endtime = this.$route.query.end_time
  259. this.end_time = endtime
  260. var type_name = this.$route.query.type_name
  261. this.type_name = type_name
  262. var keyword = this.$route.query.keyword
  263. this.keyword = keyword
  264. this.page = this.$route.query.page
  265. this.limit = this.$route.query.limit
  266. this.getlist()
  267. this.GetAllGoodType()
  268. this.getStockDrugCount()
  269. }
  270. }
  271. </script>
  272. <style rel="stylesheet/scss" lang="scss" scoped>
  273. .print_main_content {
  274. background-color: white;
  275. max-width: 1500px;
  276. margin: 0 auto;
  277. padding: 0 0 20px 0;
  278. .order_title_panl {
  279. text-align: center;
  280. .main_title {
  281. font-size: 18px;
  282. line-height: 40px;
  283. font-weight: 500;
  284. }
  285. }
  286. .table_panel {
  287. .table {
  288. width: 100%;
  289. border: 1px solid;
  290. border-collapse: collapse;
  291. padding: 2px;
  292. thead {
  293. tr {
  294. td {
  295. border: 1px solid;
  296. text-align: center;
  297. font-size: 18px;
  298. padding: 15px 5px;
  299. }
  300. }
  301. }
  302. tbody {
  303. tr {
  304. td {
  305. border: 1px solid;
  306. text-align: center;
  307. font-size: 18px;
  308. padding: 10px 5px;
  309. white-space: pre-line;
  310. .proj {
  311. padding: 5px 0;
  312. text-align: left;
  313. .proj_title {
  314. font-size: 16px;
  315. font-weight: 500;
  316. line-height: 25px;
  317. }
  318. .proj_item {
  319. font-size: 15px;
  320. line-height: 20px;
  321. .zone_name {
  322. font-weight: 500;
  323. }
  324. }
  325. }
  326. }
  327. }
  328. }
  329. }
  330. }
  331. }
  332. </style>