Commit 9d62c95a by wangyalan-git

报表日期修改

parent b2e78f39
......@@ -63,10 +63,10 @@
<el-card class="filter-container mt15"
shadow="never">
<el-row type="flex" class="btn-groups" justify="end">
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="success" @click="handleScanPut">扫码入库</el-button>
<el-button type="info" @click="handleScanOut">扫码出库</el-button>
<el-button type="warning" @click="handleImport">导入</el-button>
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="success" @click="handleScanPut">扫码入库</el-button>
<el-button type="info" @click="handleScanOut">扫码出库</el-button>
<el-button type="warning" @click="handleImport">导入</el-button>
</el-row>
<div class="table-container">
<el-table :data="list"
......@@ -111,12 +111,16 @@
<el-table-column label="操作"
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="warning"
@click="handleUpdate(scope.row)">修改</el-button>
<div style="margin-bottom: 10px;">
<el-button size="mini"
type="warning"
@click="handleUpdate(scope.row)">修改
</el-button>
</div>
<el-button size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
@click="handleDelete(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -134,7 +138,7 @@
</el-pagination>
</div>
</el-card>
<!-- 弹窗-->
<!-- 弹窗-->
<add-goods-modal ref="addGoods" @ok="getList"></add-goods-modal>
<import-goods-modal ref="importGoods" @ok="getList"></import-goods-modal>
<scan-put-storage ref="scanPut" @ok="getList"></scan-put-storage>
......@@ -144,8 +148,8 @@
</template>
<script>
import moment from 'moment'
import { getGoodsList,getGoodsCategoryList,getStockRooms, updateGoods } from '@/api/inventory'
import {getSuppliersList} from '@/api/supplier'
import { getGoodsList, getGoodsCategoryList, getStockRooms, updateGoods } from '@/api/inventory'
import { getSuppliersList } from '@/api/supplier'
import AddGoodsModal from './modules/addGoodsModal'
import ImportGoodsModal from './modules/importGoodsModal'
import ScanPutStorage from './modules/scanPutStorage'
......@@ -218,37 +222,37 @@ export default {
this.multipleSelection = vals
},
// 删除
handleDelete(id){
handleDelete(id) {
this.$confirm('是否删除该物品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateGoods({id: id,deleteStatus: 0 }).then(res=>{
updateGoods({ id: id, deleteStatus: 0 }).then(res => {
this.getList()
})
}).catch(() => {
});
})
},
// 修改
handleUpdate(row){
handleUpdate(row) {
this.$refs.updateStore.update(row)
},
// 物品类别
getGoodsCategoryList(){
getGoodsCategoryList().then(res=>{
this.categoryOptions = res.data.list
getGoodsCategoryList() {
getGoodsCategoryList().then(res => {
this.categoryOptions = res.data.list
})
},
// 供应商
getSuppliersList(){
getSuppliersList().then(res=>{
this.supplierOptions = res.data.list
getSuppliersList() {
getSuppliersList().then(res => {
this.supplierOptions = res.data.list
})
},
// 库房
getStockRooms(){
getStockRooms({status: 1}).then(res=>{
getStockRooms() {
getStockRooms({ status: 1 }).then(res => {
this.depotOptions = res.data.list
})
},
......@@ -257,8 +261,8 @@ export default {
this.listLoading = true
//请求数据
console.log('listQuery', this.listQuery)
if(this.$store.getters.type == 2){
this.listQuery.stockRoomId = this.$store.getters.stockRoomId
if (this.$store.getters.type == 2) {
this.listQuery.stockRoomId = this.$store.getters.stockRoomId
}
getGoodsList(this.listQuery).then(res => {
this.listLoading = false
......@@ -269,18 +273,18 @@ export default {
})
},
// 新增
handleAdd(){
handleAdd() {
this.$refs.addGoods.add()
},
// 扫码入库
handleScanPut(){
handleScanPut() {
this.$refs.scanPut.add()
},
handleScanOut(){
handleScanOut() {
this.$refs.scanOut.add()
},
// 导入
handleImport(){
handleImport() {
this.$refs.importGoods.add()
}
}
......@@ -301,7 +305,8 @@ export default {
.input-width {
width: 180px;
}
.btn-groups button{
.btn-groups button {
width: 100px;
}
</style>
......@@ -41,7 +41,7 @@
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库日期:" >
<el-form-item label="出库日期:">
<el-date-picker
v-model="dataRange"
type="daterange"
......@@ -145,7 +145,7 @@ export default {
var tDate = today.getDate()
tMonth = this.doHandleMonth(tMonth + 1)
tDate = this.doHandleMonth(tDate)
console.log('tYear + \'-\' + tMonth + \'-\' + tDate',tYear + '-' + tMonth + '-' + tDate)
console.log('tYear + \'-\' + tMonth + \'-\' + tDate', tYear + '-' + tMonth + '-' + tDate)
return tYear + '-' + tMonth + '-' + tDate
},
doHandleMonth(month) {
......@@ -156,9 +156,9 @@ export default {
return m
},
formatEveryDay() {
let start1 = this.getDay(-7)
let start1 = this.getDay(-6)
let end1 = this.getDay(0)
console.log('start1','end1',start1,end1)
console.log('start1', 'end1', start1, end1)
let dateList = []
var startTime = this.getDate(start1)
var endTime = this.getDate(end1)
......@@ -169,8 +169,8 @@ export default {
dateList.push(year + '-' + month + '-' + day)
startTime.setDate(startTime.getDate() + 1)
}
console.log(' this.dataRange',dateList, this.dataRange)
this.dataRange = [dateList[0],dateList[dateList.length-1]]
console.log(' this.dataRange', dateList, this.dataRange)
this.dataRange = [dateList[0], dateList[dateList.length - 1]]
},
getDate(datestr) {
var temp = datestr.split('-')
......@@ -178,6 +178,34 @@ export default {
console.log('date', date)
return date
},
//获取两日期之间日期列表函数
getdiffdate(stime, etime) {
//初始化日期列表,数组
var diffdate = new Array()
var i = 0
//开始日期小于等于结束日期,并循环
while (stime <= etime) {
diffdate[i] = stime
//获取开始日期时间戳
var stime_ts = new Date(stime).getTime()
console.log('当前日期:' + stime + '当前时间戳:' + stime_ts)
//增加一天时间戳后的日期
var next_date = stime_ts + (24 * 60 * 60 * 1000)
//拼接年月日,这里的月份会返回(0-11),所以要+1
var next_dates_y = new Date(next_date).getFullYear() + '-'
var next_dates_m = (new Date(next_date).getMonth() + 1 < 10) ? '0' + (new Date(next_date).getMonth() + 1) + '-' : (new Date(next_date).getMonth() + 1) + '-'
var next_dates_d = (new Date(next_date).getDate() < 10) ? '0' + new Date(next_date).getDate() : new Date(next_date).getDate()
stime = next_dates_y + next_dates_m + next_dates_d
//增加数组key
i++
}
return diffdate
},
handleOpenCate(visible) {
if (visible) {
this.getGoodsCategoryList()
......@@ -210,16 +238,18 @@ export default {
})
},
getList() {
if(!this.listQuery.goodsId){
if (!this.listQuery.goodsId) {
this.$message.warning('请选择物品')
return
}
getRecipientList({ dateList: this.dataRange, goodsId: this.listQuery.goodsId }).then(res => {
let dateList = this.getdiffdate(this.dataRange[0], this.dataRange[1])
console.log('dateList', dateList)
getRecipientList({ dateList: dateList, goodsId: this.listQuery.goodsId }).then(res => {
this.chartData.rows = res.data
})
},
handleResetSearch() {
this.dataRange = null
this.dataRange = null
this.listQuery = Object.assign({}, defaultListQuery)
this.getList()
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment