Crunchy
2025-06-14 7e460156de73171f9660ce48f80703e79f8b478d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<template>
  <div class="out-bound">
    <div class="out-bound-main">
      <el-row type="flex" align="middle" class="main-top">
        <el-col :span="2" :style="{color:'#409EFF'}"> <span class="iconfont icon-taizhangzhangbuxinxichaxun" /> 收发存管理</el-col>
        <el-col :span="20">
          <TableSearch :excel-name="'收发存管理表'" :show="false" :file="file" :get-list="getInventoryList" :search-data="searchData" :search-params="searchModel" />
        </el-col>
        <el-col :span="2">
        <!-- <el-button @click="goToOutboundLedger" icon="iconfont icon-caiwushoufacunguanli">查看台账</el-button> -->
        </el-col>
      </el-row>
      <el-table
        :row-class-name="onTableRowClassName"
        :row-style="{height:0+'px'}"
        :cell-style="{padding:8+'px',textAlign: 'center'}"
        :header-cell-style="{borderRight:'0px',textAlign: 'center',background:'#52626F',color:'#fff', height:'10px', padding:'0px'}"
        :stripe="true"
        :data="tableData"
        :border="true"
        header-row-class-name="table-header"
      >
        <!-- <el-table-column
        type="selection"
        width="55">
      </el-table-column> -->
        <el-table-column
          type="index"
          label="序号"
        />
        <el-table-column
          prop="productCode"
          label="产品编码"
        />
        <el-table-column
          prop="productName"
          label="产品名称"
        />
        <el-table-column
          prop="productModel"
          label="规格型号"
        />
        <el-table-column
          prop="productUnit"
          label="单位"
        />
        <el-table-column
          prop="beginningInventory"
          label="初期库存数量"
        />
        <el-table-column
          prop="issueInCurrentPeriod"
          label="本期出库数量"
        />
        <el-table-column
          prop="currentPeriod"
          label="本期入库数量"
        />
        <el-table-column
          prop="closingInventory"
          label="期末库存数量"
        />
      <!-- <el-table-column
        label="操作">
 
        <el-button size="mini" type="text" @click="delItem()">删除</el-button>
      </el-table-column> -->
      </el-table>
      <div class="out-bound-foot">
        <el-pagination
          :current-page="searchModel.pageNo"
          :page-sizes="[10, 15, 20, 25]"
          :page-size="searchModel.pageSize"
          layout="->, total, sizes, prev, pager, next, jumper"
          :total="total"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>
 
  </div>
</template>
 
<script>
import { getInventoryList, file } from '@/api/outbound'
import TableSearch from '@/components/TableSearch'
export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'gray',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  components: {
    TableSearch
  },
  data() {
    return {
      file,
      getInventoryList,
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
            picker.$emit('pick', [start, end])
          }
        }]
      },
      inType: '',
      inStatus: '',
      deptName: '',
      statusType: {},
      queryParams: {
        encode: '',
        type: '',
        depositor: ''
      },
      total: 0,
      searchModel: {
        pageNo: 1,
        pageSize: 10,
        endTime: '',
        startTime: ''
      },
      tableData: []
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    delItem() {
      console.log('删除')
    },
    searchData(res) {
      console.log(res)
      const { row, total, startTime, endTime } = res
      this.tableData = row
      this.total = total
      this.searchModel.startTime = startTime
      this.searchModel.endTime = endTime
    },
    onTableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 != 0) {
        return 'onAcitve'
      } else {
        return ''
      }
    },
    goToOutboundLedger() {
    },
    fetchData() {
      this.listLoading = true
      this.listLoading = true
      const obj = {}
      const arr = Object.keys(this.searchModel).filter(key => this.searchModel[key])
      arr.forEach(item => obj[item] = this.searchModel[item])
      console.log(obj)
      getInventoryList(obj).then(response => {
        this.tableData = response.data.row
        this.total = response.data.total
        this.listLoading = false
      })
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '../../styles/variables.scss';
 
.out-bound {
 min-height: calc(100vh - 100px);
 padding: 25px;
 background: $mainBg;
 display: flex;
 flex-direction: column;
 .out-bound-main{
  background: #fff;
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
//  .el-table--striped .el-table__body tr.el-table__row--striped td {
//     background: #F2F2F2 !important;
// }
  .main-top{}
  .table-header{
    background: #6095FB;
  }
  .el-table{
    flex: 1;
   ::v-deep .onAcitve td{
    background-color: #F2F2F2 !important;
  }
  }
  .out-bound-foot{
  margin-top: 25px;
  .el-pagination{
    display: flex;
    justify-content: right;
  }
 }
 }
 
}
 
// /deep/.el-table--striped .el-table__body tr.el-table__row--striped td {
//     background: #1e116d;
// }
</style>