Commit 6d75d46a by wangyalan-git

物品新增和导入物品,部门,报表管理

parent bf9f35cc
...@@ -98,3 +98,27 @@ export function addGoodList(data) { ...@@ -98,3 +98,27 @@ export function addGoodList(data) {
data data
}) })
} }
// 万科后台_部门分页操作
export function getDepartmentList(params) {
return request({
url: 'vankeDepartment/list',
method: 'get',
params
})
}
// 万科后台_部门插入操作
export function addDepart(params) {
return request({
url: 'vankeDepartment/insertDepartment',
method: 'post',
params
})
}
// 万科后台_根据部门id修改一条数据
export function editDepart(params) {
return request({
url: 'vankeDepartment/updateDepartment',
method: 'post',
params
})
}
import request from '@/utils/request' import request from '@/utils/request'
// 获取商品举报列表 // 万科后台_根据物品id 以及时间list 查询这个时间段内每天的领用情况
export function reportList(params) {
export function getRecipientList(data) {
return request({ return request({
url: '/report/quperPageList', url: 'vankeStatisticalChart/selectGoodsCollection',
method: 'get', method: 'post',
params data
}) })
} }
// 举报详情 // 万科后台_根据物品id 以及时间list 查询这个时间段内每天的库存信息
export function reportDetail(params) { export function getInventoryList(data) {
return request({ return request({
url: '/report/detail', url: 'vankeStatisticalChart/OutVankeGoodsStockChange',
method: 'get', method: 'post',
params data
})
}
// 举报处理
export function reportHanlde(params) {
return request({
url: '/report/process',
method: 'get',
params
}) })
} }
...@@ -106,6 +106,20 @@ export const asyncRouterMap = [ ...@@ -106,6 +106,20 @@ export const asyncRouterMap = [
meta: { title: '领用情况', icon: 'product-list' }, meta: { title: '领用情况', icon: 'product-list' },
}] }]
}, },
// 部门管理
{
path: '/dep',
component: Layout,
redirect: '/dep/departmentList',
name: 'dep',
meta: { title: '部门管理', icon: 'sms-subject' },
children: [{
path: 'departmentList',
name: 'departmentList',
component: () => import('@/views/dep/DepartmentList'),
meta: { title: '部门列表', icon: 'product-list' }
}]
},
// 管理员 // 管理员
{ {
path: '/use', path: '/use',
......
...@@ -3,6 +3,9 @@ const getters = { ...@@ -3,6 +3,9 @@ const getters = {
device: state => state.app.device, device: state => state.app.device,
token: state => state.user.token, token: state => state.user.token,
avatar: state => state.user.avatar, avatar: state => state.user.avatar,
stockRoomId: state => state.user.stockRoomId,
type: state => state.user.type,
memberId: state => state.user.memberId,
userId: state => state.user.userId, userId: state => state.user.userId,
name: state => state.user.name, name: state => state.user.name,
roles: state => state.user.roles, roles: state => state.user.roles,
......
...@@ -7,6 +7,8 @@ const user = { ...@@ -7,6 +7,8 @@ const user = {
token: getToken(), token: getToken(),
name: '', name: '',
userId: getCookie("userId"), userId: getCookie("userId"),
memeberId: getCookie("memeberId"),
stockRoomId: getCookie("stockRoomId"),
avatar: '', avatar: '',
roles: [] roles: []
}, },
...@@ -25,6 +27,18 @@ const user = { ...@@ -25,6 +27,18 @@ const user = {
state.userId = userId state.userId = userId
setCookie("userId", userId, 15) setCookie("userId", userId, 15)
}, },
SET_MEMBERID: (state, memeberId) => {
state.memeberId = memeberId
setCookie("memeberId", memeberId, 15)
},
SET_STOCKROOMID: (state, stockRoomId) => {
state.stockRoomId = stockRoomId
setCookie("stockRoomId", stockRoomId, 15)
},
SET_TYPE: (state, type) => {
state.type = type
setCookie("type", type, 15)
},
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles
} }
...@@ -60,6 +74,9 @@ const user = { ...@@ -60,6 +74,9 @@ const user = {
commit('SET_NAME', data.username) commit('SET_NAME', data.username)
commit('SET_AVATAR', data.icon) commit('SET_AVATAR', data.icon)
commit('SET_USERID', data.userId) commit('SET_USERID', data.userId)
commit('SET_MEMBERID', data.memberId)
commit('SET_STOCKROOMID', data.stockRoomId)
commit('SET_TYPE', data.type)
resolve(response) resolve(response)
}).catch(error => { }).catch(error => {
reject(error) reject(error)
......
<template> 
<div class="app-container">
<!-- 表格栏 -->
<el-card class="filter-container mt15"
shadow="never">
<el-row type="flex" class="btn-groups">
<el-button type="primary" @click="handleAdd">新增</el-button>
</el-row>
<div class="table-container">
<el-table :data="list"
v-loading="listLoading"
@selection-change="handleSelectionChange"
border>
<el-table-column type="selection"
align="center"
width="50"></el-table-column>
<el-table-column label="物品类别"
align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="创建时间"
align="center">
<template slot-scope="scope">{{scope.row.createtime | formatTime}}</template>
</el-table-column>
<el-table-column label="操作"
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页栏 -->
<div class="pagination-container">
<el-pagination background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize"
:page-sizes="[10,30,50]"
:total="total">
</el-pagination>
</div>
</el-card>
<!-- 弹窗-->
<add-department-modal ref="addDepartment" @ok="getList"></add-department-modal>
</div>
</template>
<script>
import moment from 'moment'
import { getDepartmentList, editDepart } from '@/api/inventory'
import AddDepartmentModal from './modules/addDepartmentModal'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10
}
export default {
name: 'DepartmentList',
components: {AddDepartmentModal},
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
list: [],
total: 0,
listLoading: false,
multipleSelection: [],
}
},
created() {
this.getList()
},
filters: {
formatTime(time) {
if (!time) {
return '--'
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
}
},
methods: {
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery)
this.getList()
},
handleSearchList() {
this.listQuery.pageNum = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.pageNum = 1
this.listQuery.pageSize = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.pageNum = val
this.getList()
},
handleSelectionChange(vals) {
this.multipleSelection = vals
},
//请求数据
getList() {
this.listLoading = true
//请求数据
console.log('listQuery', this.listQuery)
getDepartmentList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
}).catch(err => {
this.listLoading = false
})
},
// 添加
handleAdd(){
this.$refs.addDepartment.add()
},
// 删除
handleDelete(id){
this.$confirm('是否删除该部门?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
editDepart({id: id,deleteStatus: 0 }).then(res=>{
this.getList()
})
}).catch(() => {
});
}
}
}
</script>
<style scoped>
.app-container {
font-size: 14px;
color: #606266;
padding: 0 15px;
margin-top: 0;
}
.mt15 {
margin-top: 15px;
}
.input-width {
width: 180px;
}
.btn-groups button{
width: 100px;
}
</style>
<template>
<el-dialog :visible.sync="visible"
:title="title"
center
width="500px">
<!-- start -->
<el-form :model="model"
ref="attributeForm"
v-loading="loading"
label-width="150px">
<el-form-item label="部门:"
:rules="[{required: true, trigger: 'blur', message: '请输入部门名称'}]"
prop="name">
<el-input size="small"
class="input-width"
placeholder="请输入部门名称"
v-model="model.name"></el-input>
</el-form-item>
</el-form>
<div slot="footer">
<el-button type="primary"
@click="submit">确认</el-button>
<el-button @click="close">取消</el-button>
</div>
<!-- end -->
</el-dialog>
</template>
<script>
import { addDepart } from '@/api/inventory'
// 移动属性
export default {
name: 'addDepartmentModal',
data () {
return {
visible: false,
title: null,
loading: false,
id: null,
model: {}
}
},
methods: {
init () {
this.model = {
name: null
}
this.$nextTick(() => {
this.$refs.attributeForm.clearValidate()
})
},
add(){
this.id = null
this.title="新增部门"
this.init()
this.visible= true
},
// detail (id) {
// this.id = id
// this.init()
// this.visible = true
// this.title = '移动属性'
// this.loading = true
// getAttribute(id).then(res => {
// this.model = res.data
// this.loading = false
// }).catch(err => {
// this.loading = false
// this.close()
// })
// },
// 提交保存
submit () {
this.$refs.attributeForm.validate((valid) => {
if (valid) {
// 验证通过
addDepart(this.model).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
}).catch(err => {
this.loading = false
})
}
})
},
close () {
this.$emit('close')
this.visible = false
}
}
}
</script>
<style scoped>
.input-width {
width: 200px;
}
</style>
...@@ -15,10 +15,12 @@ ...@@ -15,10 +15,12 @@
<el-button type="primary" <el-button type="primary"
@click="handleSearchList" @click="handleSearchList"
icon="el-icon-search" icon="el-icon-search"
size="small">搜索</el-button> size="small">搜索
</el-button>
<el-button @click="handleResetSearch" <el-button @click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置</el-button> size="small">重置
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
...@@ -43,7 +45,8 @@ ...@@ -43,7 +45,8 @@
</el-table-column> </el-table-column>
<el-table-column label="入库人" <el-table-column label="入库人"
align="center"> align="center">
<template slot-scope="scope">{{scope.row.backInboundName || '--'}}</template> <template slot-scope="scope">{{$store.getters.type == 1? scope.row.backInboundName : scope.row.receptInboundName}}
</template>
</el-table-column> </el-table-column>
<el-table-column label="入库日期" <el-table-column label="入库日期"
align="center"> align="center">
...@@ -60,10 +63,12 @@ ...@@ -60,10 +63,12 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" <el-button size="mini"
type="success" type="success"
@click="handleView(scope.row)">查看详情</el-button> @click="handleView(scope.row)">查看详情
</el-button>
<el-button size="mini" <el-button size="mini"
type="primary" type="primary"
@click="exportEntry(scope.row.id)">生成入库单</el-button> @click="exportEntry(scope.row.id)">生成入库单
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -101,7 +106,7 @@ const defaultListQuery = { ...@@ -101,7 +106,7 @@ const defaultListQuery = {
export default { export default {
name: 'StockAdmin', name: 'StockAdmin',
components: {inventoryDetailsModal}, components: { inventoryDetailsModal },
data() { data() {
return { return {
listQuery: Object.assign({}, defaultListQuery), listQuery: Object.assign({}, defaultListQuery),
...@@ -147,7 +152,10 @@ export default { ...@@ -147,7 +152,10 @@ export default {
getList() { getList() {
this.listLoading = true this.listLoading = true
//请求数据 //请求数据
console.log('listQuery',this.listQuery) console.log('listQuery', this.listQuery)
if(this.$store.getters.type == 2){
this.listQuery.stockRoomId = this.$store.getters.stockRoomId
}
getInboundRecordList(this.listQuery).then(res => { getInboundRecordList(this.listQuery).then(res => {
this.listLoading = false this.listLoading = false
this.list = res.data.list this.list = res.data.list
...@@ -170,6 +178,7 @@ export default { ...@@ -170,6 +178,7 @@ export default {
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
......
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 超级管理员可见--> <!-- 超级管理员可见-->
<el-form-item label="库房:"> <el-form-item label="库房:"
v-if="$store.getters.type == 1">
<el-select v-model="listQuery.stockRoomId" <el-select v-model="listQuery.stockRoomId"
class="input-width" class="input-width"
clearable clearable
...@@ -103,6 +104,14 @@ ...@@ -103,6 +104,14 @@
align="center"> align="center">
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template> <template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="操作"-->
<!-- align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button size="mini"-->
<!-- type="danger"-->
<!-- @click="handleDelete(scope.row.id)">删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table> </el-table>
</div> </div>
<!-- 分页栏 --> <!-- 分页栏 -->
...@@ -125,7 +134,7 @@ ...@@ -125,7 +134,7 @@
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import { getGoodsList,getGoodsCategoryList,getStockRooms, getAuditDetail, updateMcht } from '@/api/inventory' import { getGoodsList,getGoodsCategoryList,getStockRooms, editGoods } from '@/api/inventory'
import {getSuppliersList} from '@/api/supplier' import {getSuppliersList} from '@/api/supplier'
import AddGoodsModal from './modules/addGoodsModal' import AddGoodsModal from './modules/addGoodsModal'
import ImportGoodsModal from './modules/importGoodsModal' import ImportGoodsModal from './modules/importGoodsModal'
...@@ -192,6 +201,19 @@ export default { ...@@ -192,6 +201,19 @@ export default {
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals
}, },
// 删除
// handleDelete(id){
// this.$confirm('是否删除该物品?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// editGoods({id: id,deleteStatus: 0 }).then(res=>{
// this.getList()
// })
// }).catch(() => {
// });
// },
// 物品类别 // 物品类别
getGoodsCategoryList(){ getGoodsCategoryList(){
getGoodsCategoryList().then(res=>{ getGoodsCategoryList().then(res=>{
...@@ -215,6 +237,9 @@ export default { ...@@ -215,6 +237,9 @@ export default {
this.listLoading = true this.listLoading = true
//请求数据 //请求数据
console.log('listQuery', this.listQuery) console.log('listQuery', this.listQuery)
if(this.$store.getters.type == 2){
this.listQuery.stockRoomId = this.$store.getters.stockRoomId
}
getGoodsList(this.listQuery).then(res => { getGoodsList(this.listQuery).then(res => {
this.listLoading = false this.listLoading = false
this.list = res.data.list this.list = res.data.list
......
...@@ -16,43 +16,45 @@ ...@@ -16,43 +16,45 @@
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别"> placeholder="请选择物品类别">
<el-option v-for="item in statusOptions" <el-option v-for="item in categoryOptions"
:key="item.value" :key="item.id"
:label="item.label" :label="item.name"
:value="item.value"></el-option> :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="部门:"> <el-form-item label="部门:">
<el-select v-model="listQuery.stockRoomId" <el-select v-model="listQuery.departId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择部门"> placeholder="请选择部门">
<el-option v-for="item in statusOptions" <el-option v-for="item in departmentOptions"
:key="item.value" :key="item.id"
:label="item.label" :label="item.name"
:value="item.value"></el-option> :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 超级管理员可见--> <!-- 超级管理员可见-->
<el-form-item label="库房:"> <el-form-item label="库房:" v-if="$store.getters.type == 1">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.stockRoomId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择库房"> placeholder="请选择库房">
<el-option v-for="item in statusOptions" <el-option v-for="item in depotOptions"
:key="item.value" :key="item.id"
:label="item.label" :label="item.name"
:value="item.value"></el-option> :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" <el-button type="primary"
@click="handleSearchList" @click="handleSearchList"
icon="el-icon-search" icon="el-icon-search"
size="small">搜索</el-button> size="small">搜索
</el-button>
<el-button @click="handleResetSearch" <el-button @click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置</el-button> size="small">重置
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
...@@ -118,15 +120,16 @@ ...@@ -118,15 +120,16 @@
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import { getOutboundRecordList,getGoodsCategoryList, getAuditDetail, updateMcht } from '@/api/inventory' import { getOutboundRecordList, getGoodsCategoryList, getStockRooms, getDepartmentList } from '@/api/inventory'
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
accouuntType: 1, goodsCategoryId: '',
name: '', stockRoomId: '',
phone: '', goodsMame: '',
status: '' memberName: '',
departId: ''
} }
export default { export default {
...@@ -139,11 +142,16 @@ export default { ...@@ -139,11 +142,16 @@ export default {
total: 0, total: 0,
listLoading: false, listLoading: false,
multipleSelection: [], multipleSelection: [],
categoryOptions: [],
depotOptions: [],
departmentOptions: []
} }
}, },
created() { created() {
this.getList() this.getList()
this.getGoodsCategoryList() this.getGoodsCategoryList()
this.getStockRooms()
this.getDepartmentList()
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
...@@ -175,16 +183,30 @@ export default { ...@@ -175,16 +183,30 @@ export default {
this.multipleSelection = vals this.multipleSelection = vals
}, },
// 物品类别 // 物品类别
getGoodsCategoryList(){ getGoodsCategoryList() {
getGoodsCategoryList().then(res=>{ getGoodsCategoryList().then(res => {
this.categoryOptions = res.data.list
})
},
// 库房
getStockRooms() {
getStockRooms().then(res => {
this.depotOptions = res.data.list
})
},
getDepartmentList() {
getDepartmentList().then(res => {
this.departmentOptions = res.data.list
}) })
}, },
//请求数据 //请求数据
getList() { getList() {
this.listLoading = true this.listLoading = true
//请求数据 //请求数据
console.log('listQuery',this.listQuery) console.log('listQuery', this.listQuery)
if (this.$store.getters.type == 2) {
this.listQuery.stockRoomId = this.$store.getters.stockRoomId
}
getOutboundRecordList(this.listQuery).then(res => { getOutboundRecordList(this.listQuery).then(res => {
this.listLoading = false this.listLoading = false
this.list = res.data.list this.list = res.data.list
...@@ -203,6 +225,7 @@ export default { ...@@ -203,6 +225,7 @@ export default {
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
class="input-width" class="input-width"
clearable clearable
placeholder="库房" placeholder="库房"
:disabled="scope.row.id? true: false"> :disabled="scope.row.id || ($store.getters.type == 2)? true: false">
<el-option v-for="item in depotOptions" <el-option v-for="item in depotOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
...@@ -226,7 +226,7 @@ export default { ...@@ -226,7 +226,7 @@ export default {
prict: '', prict: '',
supplierId: '', supplierId: '',
goodsCategoryId: '', goodsCategoryId: '',
stockRoomId: '', stockRoomId: this.$store.getters.stockRoomId,
barCode: '', barCode: '',
isOK: true isOK: true
},) },)
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
class="input-width" class="input-width"
clearable clearable
placeholder="库房" placeholder="库房"
:disabled="scope.row.id? true: false"> :disabled="scope.row.id || ($store.getters.type == 2)? true: false">
<el-option v-for="item in depotOptions" <el-option v-for="item in depotOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
......
...@@ -7,36 +7,38 @@ ...@@ -7,36 +7,38 @@
:model="listQuery" :model="listQuery"
size="small"> size="small">
<el-form-item label="供应商:"> <el-form-item label="供应商:">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.supplierId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择供应商"> placeholder="请选择供应商">
<el-option v-for="item in statusOptions" <el-option v-for="item in supplierOptions"
:key="item.value" :key="item.id"
:label="item.label" :label="item.supplierName"
:value="item.value"></el-option> :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物品类别:"> <el-form-item label="物品类别:">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.goodsCategoryId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别"> placeholder="请选择物品类别"
<el-option v-for="item in statusOptions" @visible-change="handleOpenCate">
:key="item.value" <el-option v-for="item in categoryOptions"
:label="item.label" :key="item.id"
:value="item.value"></el-option> :label="item.name"
:value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物品:"> <el-form-item label="物品:">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.goodsId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品"> placeholder="请选择物品"
<el-option v-for="item in statusOptions" @visible-change="handleOpenGoods">
:key="item.value" <el-option v-for="item in goodOptions"
:label="item.label" :key="item.id"
:value="item.value"></el-option> :label="item.name"
:value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
:legend-visible="false" :legend-visible="false"
:loading="loading" :loading="loading"
:data-empty="dataEmpty" :data-empty="dataEmpty"
:settings="chartSettings"></ve-line> ></ve-line>
</div> </div>
</el-card> </el-card>
</div> </div>
...@@ -68,40 +70,25 @@ ...@@ -68,40 +70,25 @@
<script> <script>
import moment from 'moment' import moment from 'moment'
import { str2Date } from '@/utils/date' import { str2Date } from '@/utils/date'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit' import { getSuppliersList } from '@/api/supplier'
import { getGoodsList, getGoodsCategoryList } from '@/api/inventory'
import { getInventoryList } from '@/api/report'
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
accouuntType: 1, goodsId: '',
name: '', supplierId: '',
phone: '', goodsCategoryId: ''
status: ''
}
const DATA_FROM_BACKEND = {
columns: ['date', 'orderCount', 'orderAmount'],
rows: [
{ date: '2018-11-01', orderCount: 10, orderAmount: 1093 },
{ date: '2018-11-02', orderCount: 20, orderAmount: 2230 },
{ date: '2018-11-03', orderCount: 33, orderAmount: 3623 },
{ date: '2018-11-04', orderCount: 50, orderAmount: 6423 },
{ date: '2018-11-05', orderCount: 80, orderAmount: 8492 },
{ date: '2018-11-06', orderCount: 60, orderAmount: 6293 },
{ date: '2018-11-07', orderCount: 20, orderAmount: 2293 },
{ date: '2018-11-08', orderCount: 60, orderAmount: 6293 },
{ date: '2018-11-09', orderCount: 50, orderAmount: 5293 },
{ date: '2018-11-10', orderCount: 30, orderAmount: 3293 },
{ date: '2018-11-11', orderCount: 20, orderAmount: 2293 },
{ date: '2018-11-12', orderCount: 80, orderAmount: 8293 },
{ date: '2018-11-13', orderCount: 100, orderAmount: 10293 },
{ date: '2018-11-14', orderCount: 10, orderAmount: 1293 },
{ date: '2018-11-15', orderCount: 40, orderAmount: 4293 }
]
} }
export default { export default {
name: 'InventoryChart', name: 'InventoryChart',
data() { data() {
return { return {
categoryOptions: [],
supplierOptions: [],
goodOptions: [],
inventoryList: [],
orderCountDate: '', orderCountDate: '',
statusOptions: [{ statusOptions: [{
label: '启用', label: '启用',
...@@ -116,14 +103,8 @@ export default { ...@@ -116,14 +103,8 @@ export default {
total: 0, total: 0,
listLoading: false, listLoading: false,
multipleSelection: [], multipleSelection: [],
chartSettings: {
xAxisType: 'time',
area: true,
axisSite: { right: ['orderAmount'] },
labelMap: { 'orderCount': '订单数量', 'orderAmount': '订单金额' }
},
chartData: { chartData: {
columns: [], columns: ['data', 'num'],
rows: [] rows: []
}, },
loading: false, loading: false,
...@@ -131,8 +112,8 @@ export default { ...@@ -131,8 +112,8 @@ export default {
} }
}, },
created() { created() {
this.initOrderCountDate() this.getSuppliersList()
this.getData() // this.getData()
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
...@@ -143,6 +124,97 @@ export default { ...@@ -143,6 +124,97 @@ export default {
} }
}, },
methods: { methods: {
getDay(num, str) {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
},
formatDate(date) {
date = new Date(date)
let myyear = date.getFullYear()
let mymonth = date.getMonth() + 1
let myweekday = date.getDate()
mymonth < 10 ? mymonth = '0' + mymonth : mymonth
myweekday < 10 ? myweekday = '0' + myweekday : myweekday
return `${myyear}-${mymonth}-${myweekday}`
},
mGetDate() {
var date = new Date()
var year = date.getFullYear()
var month = date.getMonth() + 1
var d = new Date(year, month, 0)
return d.getDate()
},
getNowM(e) {
let now = new Date()
let current_month_num = this.mGetDate()
let current_month = []
for (let i = 1; i <= current_month_num; i++) {
let day = now.setDate(i)
let everyDay = this.formatDate(day)
current_month.push(everyDay)
}
console.log('current_month', current_month)
return current_month
},
getWeekDay() {
let that = this
let dateString = that.formatDate(new Date())//当天的日期,例如2020-2-28
let presentDate = new Date(dateString)
let today = presentDate.getDay() !== 0 ? presentDate.getDay() : 7
return Array.from(new Array(7), function (val, index) {
return that.formatDate(new Date(presentDate.getTime() - (today - index - 1) * 24 * 60 * 60 * 1000))
})
},
handleOpenCate(visible) {
if (visible) {
this.getGoodsCategoryList()
}
},
handleOpenGoods(visible) {
if (visible) {
this.getGoodsList()
}
},
// 物品
getGoodsList() {
getGoodsList({
goodsCategoryI: this.listQuery.goodsCategoryId,
supplierId: this.listQuery.supplierId
}).then(res => {
this.goodOptions = res.data.list
})
},
// 物品类别
getGoodsCategoryList() {
getGoodsCategoryList({ supplierId: this.listQuery.supplierId }).then(res => {
this.categoryOptions = res.data.list
})
},
// 供应商
getSuppliersList() {
getSuppliersList().then(res => {
this.supplierOptions = res.data.list
})
},
getList() {
if(!this.listQuery.goodsId){
this.$message.warning('请选择物品')
return
}
getInventoryList({ dateList: this.getWeekDay(), goodsId: this.listQuery.goodsId }).then(res => {
this.chartData.rows = res.data
console.log('res', this.chartData)
})
},
handleResetSearch() { handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery) this.listQuery = Object.assign({}, defaultListQuery)
this.getList() this.getList()
...@@ -151,39 +223,10 @@ export default { ...@@ -151,39 +223,10 @@ export default {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1
this.getList() this.getList()
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals
}, },
initOrderCountDate() { handleAdd() {
let start = new Date()
start.setFullYear(2018)
start.setMonth(10)
start.setDate(1)
const end = new Date()
end.setTime(start.getTime() + 1000 * 60 * 60 * 24 * 7)
this.orderCountDate = [start, end]
},
getData() {
setTimeout(() => {
this.chartData = {
columns: ['date', 'orderCount', 'orderAmount'],
rows: []
}
for (let i = 0; i < DATA_FROM_BACKEND.rows.length; i++) {
let item = DATA_FROM_BACKEND.rows[i]
let currDate = str2Date(item.date)
let start = this.orderCountDate[0]
let end = this.orderCountDate[1]
if (currDate.getTime() >= start.getTime() && currDate.getTime() <= end.getTime()) {
this.chartData.rows.push(item)
}
}
this.dataEmpty = false
this.loading = false
}, 1000)
},
handleAdd(){
this.$refs.addGoods.add() this.$refs.addGoods.add()
} }
} }
...@@ -204,7 +247,8 @@ export default { ...@@ -204,7 +247,8 @@ export default {
.input-width { .input-width {
width: 180px; width: 180px;
} }
.btn-groups button{
.btn-groups button {
width: 100px; width: 100px;
} }
</style> </style>
...@@ -7,36 +7,38 @@ ...@@ -7,36 +7,38 @@
:model="listQuery" :model="listQuery"
size="small"> size="small">
<el-form-item label="供应商:"> <el-form-item label="供应商:">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.supplierId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择供应商"> placeholder="请选择供应商">
<el-option v-for="item in statusOptions" <el-option v-for="item in supplierOptions"
:key="item.value" :key="item.id"
:label="item.label" :label="item.supplierName"
:value="item.value"></el-option> :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物品类别:"> <el-form-item label="物品类别:">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.goodsCategoryId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别"> placeholder="请选择物品类别"
<el-option v-for="item in statusOptions" @visible-change="handleOpenCate">
:key="item.value" <el-option v-for="item in categoryOptions"
:label="item.label" :key="item.id"
:value="item.value"></el-option> :label="item.name"
:value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物品:"> <el-form-item label="物品:">
<el-select v-model="listQuery.status" <el-select v-model="listQuery.goodsId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品"> placeholder="请选择物品"
<el-option v-for="item in statusOptions" @visible-change="handleOpenGoods">
:key="item.value" <el-option v-for="item in goodOptions"
:label="item.label" :key="item.id"
:value="item.value"></el-option> :label="item.name"
:value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -60,7 +62,7 @@ ...@@ -60,7 +62,7 @@
:legend-visible="false" :legend-visible="false"
:loading="loading" :loading="loading"
:data-empty="dataEmpty" :data-empty="dataEmpty"
:settings="chartSettings"></ve-line> ></ve-line>
</div> </div>
</el-card> </el-card>
</div> </div>
...@@ -68,40 +70,25 @@ ...@@ -68,40 +70,25 @@
<script> <script>
import moment from 'moment' import moment from 'moment'
import { str2Date } from '@/utils/date' import { str2Date } from '@/utils/date'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit' import { getSuppliersList } from '@/api/supplier'
import { getGoodsList, getGoodsCategoryList } from '@/api/inventory'
import { getRecipientList } from '@/api/report'
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
accouuntType: 1, goodsId: '',
name: '', supplierId: '',
phone: '', goodsCategoryId: ''
status: ''
}
const DATA_FROM_BACKEND = {
columns: ['date', 'orderCount', 'orderAmount'],
rows: [
{ date: '2018-11-01', orderCount: 10, orderAmount: 1093 },
{ date: '2018-11-02', orderCount: 20, orderAmount: 2230 },
{ date: '2018-11-03', orderCount: 33, orderAmount: 3623 },
{ date: '2018-11-04', orderCount: 50, orderAmount: 6423 },
{ date: '2018-11-05', orderCount: 80, orderAmount: 8492 },
{ date: '2018-11-06', orderCount: 60, orderAmount: 6293 },
{ date: '2018-11-07', orderCount: 20, orderAmount: 2293 },
{ date: '2018-11-08', orderCount: 60, orderAmount: 6293 },
{ date: '2018-11-09', orderCount: 50, orderAmount: 5293 },
{ date: '2018-11-10', orderCount: 30, orderAmount: 3293 },
{ date: '2018-11-11', orderCount: 20, orderAmount: 2293 },
{ date: '2018-11-12', orderCount: 80, orderAmount: 8293 },
{ date: '2018-11-13', orderCount: 100, orderAmount: 10293 },
{ date: '2018-11-14', orderCount: 10, orderAmount: 1293 },
{ date: '2018-11-15', orderCount: 40, orderAmount: 4293 }
]
} }
export default { export default {
name: 'Recipients', name: 'Recipients',
data() { data() {
return { return {
categoryOptions: [],
supplierOptions: [],
goodOptions: [],
inventoryList: [],
orderCountDate: '', orderCountDate: '',
statusOptions: [{ statusOptions: [{
label: '启用', label: '启用',
...@@ -116,14 +103,8 @@ export default { ...@@ -116,14 +103,8 @@ export default {
total: 0, total: 0,
listLoading: false, listLoading: false,
multipleSelection: [], multipleSelection: [],
chartSettings: {
xAxisType: 'time',
area: true,
axisSite: { right: ['orderAmount'] },
labelMap: { 'orderCount': '订单数量', 'orderAmount': '订单金额' }
},
chartData: { chartData: {
columns: [], columns: ['data', 'num'],
rows: [] rows: []
}, },
loading: false, loading: false,
...@@ -131,8 +112,8 @@ export default { ...@@ -131,8 +112,8 @@ export default {
} }
}, },
created() { created() {
this.initOrderCountDate() this.getSuppliersList()
this.getData() // this.getData()
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
...@@ -143,6 +124,96 @@ export default { ...@@ -143,6 +124,96 @@ export default {
} }
}, },
methods: { methods: {
getDay(num, str) {
var today = new Date()
var nowTime = today.getTime()
var ms = 24 * 3600 * 1000 * num
today.setTime(parseInt(nowTime + ms))
var oYear = today.getFullYear()
var oMoth = (today.getMonth() + 1).toString()
if (oMoth.length <= 1) oMoth = '0' + oMoth
var oDay = today.getDate().toString()
if (oDay.length <= 1) oDay = '0' + oDay
return oYear + str + oMoth + str + oDay
},
formatDate(date) {
date = new Date(date)
let myyear = date.getFullYear()
let mymonth = date.getMonth() + 1
let myweekday = date.getDate()
mymonth < 10 ? mymonth = '0' + mymonth : mymonth
myweekday < 10 ? myweekday = '0' + myweekday : myweekday
return `${myyear}-${mymonth}-${myweekday}`
},
mGetDate() {
var date = new Date()
var year = date.getFullYear()
var month = date.getMonth() + 1
var d = new Date(year, month, 0)
return d.getDate()
},
getNowM(e) {
let now = new Date()
let current_month_num = this.mGetDate()
let current_month = []
for (let i = 1; i <= current_month_num; i++) {
let day = now.setDate(i)
let everyDay = this.formatDate(day)
current_month.push(everyDay)
}
console.log('current_month', current_month)
return current_month
},
getWeekDay() {
let that = this
let dateString = that.formatDate(new Date())//当天的日期,例如2020-2-28
let presentDate = new Date(dateString)
let today = presentDate.getDay() !== 0 ? presentDate.getDay() : 7
return Array.from(new Array(7), function (val, index) {
return that.formatDate(new Date(presentDate.getTime() - (today - index - 1) * 24 * 60 * 60 * 1000))
})
},
handleOpenCate(visible) {
if (visible) {
this.getGoodsCategoryList()
}
},
handleOpenGoods(visible) {
if (visible) {
this.getGoodsList()
}
},
// 物品
getGoodsList() {
getGoodsList({
goodsCategoryI: this.listQuery.goodsCategoryId,
supplierId: this.listQuery.supplierId
}).then(res => {
this.goodOptions = res.data.list
})
},
// 物品类别
getGoodsCategoryList() {
getGoodsCategoryList({ supplierId: this.listQuery.supplierId }).then(res => {
this.categoryOptions = res.data.list
})
},
// 供应商
getSuppliersList() {
getSuppliersList().then(res => {
this.supplierOptions = res.data.list
})
},
getList() {
if(!this.listQuery.goodsId){
this.$message.warning('请选择物品')
return
}
getRecipientList({ dateList: this.getWeekDay(), goodsId: this.listQuery.goodsId }).then(res => {
this.chartData.rows = res.data
})
},
handleResetSearch() { handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery) this.listQuery = Object.assign({}, defaultListQuery)
this.getList() this.getList()
...@@ -151,39 +222,10 @@ export default { ...@@ -151,39 +222,10 @@ export default {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1
this.getList() this.getList()
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals
}, },
initOrderCountDate() { handleAdd() {
let start = new Date()
start.setFullYear(2018)
start.setMonth(10)
start.setDate(1)
const end = new Date()
end.setTime(start.getTime() + 1000 * 60 * 60 * 24 * 7)
this.orderCountDate = [start, end]
},
getData() {
setTimeout(() => {
this.chartData = {
columns: ['date', 'orderCount', 'orderAmount'],
rows: []
}
for (let i = 0; i < DATA_FROM_BACKEND.rows.length; i++) {
let item = DATA_FROM_BACKEND.rows[i]
let currDate = str2Date(item.date)
let start = this.orderCountDate[0]
let end = this.orderCountDate[1]
if (currDate.getTime() >= start.getTime() && currDate.getTime() <= end.getTime()) {
this.chartData.rows.push(item)
}
}
this.dataEmpty = false
this.loading = false
}, 1000)
},
handleAdd(){
this.$refs.addGoods.add() this.$refs.addGoods.add()
} }
} }
...@@ -204,7 +246,8 @@ export default { ...@@ -204,7 +246,8 @@ export default {
.input-width { .input-width {
width: 180px; width: 180px;
} }
.btn-groups button{
.btn-groups button {
width: 100px; width: 100px;
} }
</style> </style>
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