123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs="crumbs"></bread-crumb>
- <el-row style="float:right;">
- <el-col :span="24">
- <el-button size="small" icon="el-icon-printer" type="primary" @click="printAction">打印</el-button>
- </el-col>
- </el-row>
- </div>
- <div class="app-container" style="background-color: white;">
- <div id="print_content">
- <div class="print_main_content">
- <div class="order_title_panl">
- <span class="main_title">耗材管理查询表</span>
- </div>
- <div style="text-align:right;margin-bottom:20px;font-size: 18px;">
- 打印时间:{{time_now}}
- </div>
- <div class="table_panel">
- <table class="table">
- <thead>
- <tr>
- <td width="60">商品编码</td>
- <td width="80">耗材名称</td>
- <td width="80">耗材类型</td>
- <td width="80">规格型号</td>
- <td width="80">入库数量</td>
- <td width="80">入库退货</td>
- <td width="80">实际入库</td>
- <td width="80">出库数量</td>
- <td width="80">出库退库</td>
- <td width="80">实际出库</td>
- <td width="80">剩余库存</td>
- </tr>
- </thead>
- <tbody>
- <tr v-for='(item,index) in WarehouseInfo.warehouseInfoDate' :key="index">
- <td>{{item.good_code}}</td>
- <td>{{item.good_name}}</td>
- <td>{{item.type.type_name}}</td>
- <td>{{item.specification_name}}</td>
- <td>{{stockInCount(item)}}</td>
- <td>{{salesReturnCount(item)}}</td>
- <td> {{ stockInCount(item) - salesReturnCount(item) }}</td>
- <td>{{ stockOutCount(item) }}</td>
- <td>{{cancelStockCount(item) }}</td>
- <td>{{ stockOutCount(item) - cancelStockCount(item)}}</td>
- <td>{{stockInCount(item) -salesReturnCount(item) -stockOutCount(item) +cancelStockCount(item)}}</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
- import { getAllStockQueryList } from "@/api/stock";
- import print from 'print-js'
- const moment = require('moment')
- export default {
- components:{
- BreadCrumb
- },
- data(){
- return{
- crumbs: [
- { path: false, name: '库存管理' },
- { path: false, name: '自备药查询' },
- { path: false, name: '自备药打印' },
- ],
- start_time:"",
- end_time:"",
- drug_name:"",
- drug_spec:"",
- keyword:"",
- tableData:[],
- time_now:moment(new Date()).add('year',0).format("YYYY-MM-DD"),
- type_name:"",
- limit:20,
- page:1,
- WarehouseInfo: {
- loading: false,
- warehouseInfoDate: []
- },
- }
- },
- methods:{
- printAction: function() {
- 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; } }'
- printJS({
- printable: 'print_content',
- type: 'html',
- documentTitle: ' ',
- style: style,
- scanStyles: false
- })
- },
- getlist(){
- const Params = {
- page: this.page,
- limit: this.limit,
- keyword: this.keywords,
- start_time:this.start_time,
- end_time:this.end_time,
- type_name:this.type_name,
- };
- this.WarehouseInfo.loading = true;
- this.WarehouseInfo.warehouseInfoDate = [];
- getAllStockQueryList(Params).then(response => {
- if (response.data.state == 0) {
- this.WarehouseInfo.loading = false;
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.WarehouseInfo.loading = false;
- this.total = response.data.data.total;
- for (let i = 0; i < response.data.data.list.length; i++) {
- this.WarehouseInfo.warehouseInfoDate.push( response.data.data.list[i]);
- }
- }
- console.log("打印数据源头",this.WarehouseInfo.warehouseInfoDate)
- });
- },
- stockInCount: function(row) {
- let total = 0;
- for (let i = 0; i < row.query_warehousing_info.length; i++) {
- total = total + row.query_warehousing_info[i].warehousing_count;
- }
- return total;
- },
- salesReturnCount: function(row) {
- let total = 0;
- for (let i = 0; i < row.query_sales_return_info.length; i++) {
- total = total + row.query_sales_return_info[i].count;
- }
- return total;
- },
- stockOutCount: function(row) {
- let total = 0;
- for (let i = 0; i < row.query_warehouseout_info.length; i++) {
- total = total + row.query_warehouseout_info[i].count;
- }
- return total;
- },
- cancelStockCount: function(row) {
- let total = 0;
- for (let i = 0; i < row.query_cancel_stock_info.length; i++) {
- total = total + row.query_cancel_stock_info[i].count;
- }
- return total;
- },
- },
- created(){
- var starttime = this.$route.query.start_time
- this.start_time = starttime
- var endtime = this.$route.query.end_time
- this.end_time = endtime
- var type_name = this.$route.query.type_name
- this.type_name = type_name
- var keyword = this.$route.query.keyword
- this.keyword = keyword
-
- this.getlist()
- }
- }
- </script>
-
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- .print_main_content {
- background-color: white;
- max-width: 1500px;
- 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: 18px;
- padding: 15px 5px;
- }
- }
- }
- tbody {
- tr {
- td {
- border: 1px solid;
- text-align: center;
- font-size: 18px;
- 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;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|