Commit 99f03ee2 by wangyalan-git

bug修改

parent 150a5216
...@@ -3,9 +3,31 @@ ...@@ -3,9 +3,31 @@
<!-- 表格栏 --> <!-- 表格栏 -->
<el-card class="filter-container mt15" <el-card class="filter-container mt15"
shadow="never"> shadow="never">
<el-row type="flex" class="btn-groups"> <el-form :inline="true"
:model="listQuery"
size="small">
<el-form-item label="库房名称:">
<el-input v-model="listQuery.name"
class="input-width"
placeholder="请输入库房名称"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary"
@click="handleSearchList"
icon="el-icon-search"
size="small">搜索
</el-button>
<el-button @click="handleResetSearch"
icon="el-icon-refresh"
size="small">重置
</el-button>
</el-form-item>
<el-button type="primary" @click="handleAdd" class="btn-add">新增</el-button>
</el-form>
<!-- <el-row type="flex" class="btn-groups">
<el-button type="primary" @click="handleAdd">新增</el-button> <el-button type="primary" @click="handleAdd">新增</el-button>
</el-row> </el-row> -->
<div class="table-container"> <div class="table-container">
<el-table :data="list" <el-table :data="list"
v-loading="listLoading" v-loading="listLoading"
...@@ -58,6 +80,7 @@ import { getDepartmentList, editDepart } from '@/api/inventory' ...@@ -58,6 +80,7 @@ import { getDepartmentList, editDepart } from '@/api/inventory'
import AddDepartmentModal from './modules/addDepartmentModal' import AddDepartmentModal from './modules/addDepartmentModal'
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
name: '',
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10
} }
......
<template>  <template>
 
<div class="app-container"> <div class="app-container">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<el-card class="filter-container" <el-card class="filter-container" shadow="never">
shadow="never"> <el-form :inline="true" :model="listQuery" size="small">
<el-form :inline="true"
:model="listQuery"
size="small">
<el-form-item label="物品名称:"> <el-form-item label="物品名称:">
<el-input v-model="listQuery.name" <el-input
v-model="listQuery.name"
class="input-width" class="input-width"
placeholder="请输入物品名称"></el-input> placeholder="请输入物品名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="物品类别:"> <el-form-item label="物品类别:">
<el-select v-model="listQuery.goodsCategoryId" <el-select
v-model="listQuery.goodsCategoryId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别"> placeholder="请选择物品类别"
<el-option v-for="item in categoryOptions" >
<el-option
v-for="item in categoryOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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.supplierId" <el-select
filterable
v-model="listQuery.supplierId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择供应商"> placeholder="请选择供应商"
<el-option v-for="item in supplierOptions" >
<el-option
v-for="item in supplierOptions"
:key="item.id" :key="item.id"
:label="item.supplierName" :label="item.supplierName"
:value="item.id"></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">
v-if="$store.getters.type == 1"> <el-select
<el-select v-model="listQuery.stockRoomId" v-model="listQuery.stockRoomId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择库房"> placeholder="请选择库房"
<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"
:value="item.id"></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">搜索 size="small"
>搜索
</el-button> </el-button>
<el-button @click="handleResetSearch" <el-button
@click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置 size="small"
>重置
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<!-- 表格栏 --> <!-- 表格栏 -->
<el-card class="filter-container mt15" <el-card class="filter-container mt15" shadow="never">
shadow="never">
<el-row type="flex" class="btn-groups" justify="end"> <el-row type="flex" class="btn-groups" justify="end">
<el-button type="primary" @click="handleAdd">新增</el-button> <el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="success" @click="handleScanPut">扫码入库</el-button> <el-button type="success" @click="handleScanPut">扫码入库</el-button>
...@@ -69,57 +86,62 @@ ...@@ -69,57 +86,62 @@
<el-button type="warning" @click="handleImport">导入</el-button> <el-button type="warning" @click="handleImport">导入</el-button>
</el-row> </el-row>
<div class="table-container"> <div class="table-container">
<el-table :data="list" <el-table
:data="list"
v-loading="listLoading" v-loading="listLoading"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border> border
<el-table-column type="selection" >
<el-table-column
type="selection"
align="center" align="center"
width="50"></el-table-column> width="50"
<el-table-column label="物品名称" ></el-table-column>
align="center"> <el-table-column label="物品名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="型号" <el-table-column label="型号" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.goodsNo }}</template>
<template slot-scope="scope">{{scope.row.goodsNo}}</template>
</el-table-column> </el-table-column>
<el-table-column label="条形码" <el-table-column label="条形码" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.barCode }}</template>
<template slot-scope="scope">{{scope.row.barCode}}</template>
</el-table-column> </el-table-column>
<el-table-column label="物品类别" <el-table-column label="物品类别" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.goodsCategoryName}}</template> scope.row.goodsCategoryName
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="数量" <el-table-column label="数量" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.goodsNum }}</template>
<template slot-scope="scope">{{scope.row.goodsNum}}</template>
</el-table-column> </el-table-column>
<el-table-column label="价格" <el-table-column label="价格" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.price || 0 }}</template>
<template slot-scope="scope">{{scope.row.price || 0}}</template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" <el-table-column label="供应商" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.supplierName || '--'}}</template> scope.row.supplierName || "--"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="所属库房" <el-table-column label="所属库房" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template> scope.row.stockRoomName || "--"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作" align="center">
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px">
<el-button size="mini" <el-button
size="mini"
type="warning" type="warning"
@click="handleUpdate(scope.row)">修改 @click="handleUpdate(scope.row)"
>修改
</el-button> </el-button>
</div> </div>
<el-button size="mini" <el-button
size="mini"
type="danger" type="danger"
@click="handleDelete(scope.row.id)">删除 @click="handleDelete(scope.row.id)"
>删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -127,14 +149,16 @@ ...@@ -127,14 +149,16 @@
</div> </div>
<!-- 分页栏 --> <!-- 分页栏 -->
<div class="pagination-container"> <div class="pagination-container">
<el-pagination background <el-pagination
background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="listQuery.pageNum" :current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize" :page-size="listQuery.pageSize"
:page-sizes="[10,30,50]" :page-sizes="[10, 30, 50]"
:total="total"> :total="total"
>
</el-pagination> </el-pagination>
</div> </div>
</el-card> </el-card>
...@@ -147,32 +171,37 @@ ...@@ -147,32 +171,37 @@
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from "moment";
import { getGoodsList, getGoodsCategoryList, getStockRooms, updateGoods } from '@/api/inventory' import {
import { getSuppliersList } from '@/api/supplier' getGoodsList,
import AddGoodsModal from './modules/addGoodsModal' getGoodsCategoryList,
import ImportGoodsModal from './modules/importGoodsModal' getStockRooms,
import ScanPutStorage from './modules/scanPutStorage' updateGoods,
import ScanOutStorage from './modules/scanOutStorage' } from "@/api/inventory";
import UpdateStoreModal from './modules/updateStoreModal' import { getSuppliersList } from "@/api/supplier";
import AddGoodsModal from "./modules/addGoodsModal";
import ImportGoodsModal from "./modules/importGoodsModal";
import ScanPutStorage from "./modules/scanPutStorage";
import ScanOutStorage from "./modules/scanOutStorage";
import UpdateStoreModal from "./modules/updateStoreModal";
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: '', name: "",
goodsCategoryId: '', goodsCategoryId: "",
supplierId: '', supplierId: "",
stockRoomId: '' stockRoomId: "",
} };
export default { export default {
name: 'StoreList', name: "StoreList",
components: { components: {
ScanOutStorage, ScanOutStorage,
AddGoodsModal, AddGoodsModal,
ImportGoodsModal, ImportGoodsModal,
ScanPutStorage, ScanPutStorage,
UpdateStoreModal UpdateStoreModal,
}, },
data() { data() {
return { return {
...@@ -183,130 +212,133 @@ export default { ...@@ -183,130 +212,133 @@ export default {
multipleSelection: [], multipleSelection: [],
categoryOptions: [], categoryOptions: [],
supplierOptions: [], supplierOptions: [],
depotOptions: [] depotOptions: [],
} };
}, },
created() { created() {
this.getList() this.getList();
this.getGoodsCategoryList() this.getGoodsCategoryList();
this.getSuppliersList() this.getSuppliersList();
this.getStockRooms() this.getStockRooms();
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
if (!time) { if (!time) {
return '--' return "--";
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
} }
return moment(time).format("YYYY-MM-DD HH:mm:ss");
},
}, },
methods: { methods: {
handleResetSearch() { handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery) this.listQuery = Object.assign({}, defaultListQuery);
this.getList() this.getList();
}, },
handleSearchList() { handleSearchList() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.listQuery.pageSize = val this.listQuery.pageSize = val;
this.getList() this.getList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.pageNum = val this.listQuery.pageNum = val;
this.getList() this.getList();
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals;
}, },
// 删除 // 删除
handleDelete(id) { handleDelete(id) {
this.$confirm('是否删除该物品?', '提示', { this.$confirm("是否删除该物品?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => {
updateGoods({ id: id, deleteStatus: 0 }).then(res => {
this.getList()
}) })
}).catch(() => { .then(() => {
updateGoods({ id: id, deleteStatus: 0 }).then((res) => {
this.getList();
});
}) })
.catch(() => {});
}, },
// 修改 // 修改
handleUpdate(row) { handleUpdate(row) {
this.$refs.updateStore.update(row) this.$refs.updateStore.update(row);
}, },
// 物品类别 // 物品类别
getGoodsCategoryList() { getGoodsCategoryList() {
getGoodsCategoryList().then(res => { getGoodsCategoryList().then((res) => {
this.categoryOptions = res.data.list this.categoryOptions = res.data.list;
}) });
}, },
// 供应商 // 供应商
getSuppliersList() { getSuppliersList() {
getSuppliersList().then(res => { getSuppliersList().then((res) => {
this.supplierOptions = res.data.list this.supplierOptions = res.data.list;
}) });
}, },
// 库房 // 库房
getStockRooms() { getStockRooms() {
getStockRooms({ status: 1 }).then(res => { getStockRooms({ status: 1 }).then((res) => {
this.depotOptions = res.data.list this.depotOptions = 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) { if (this.$store.getters.type == 2) {
this.listQuery.stockRoomId = this.$store.getters.stockRoomId this.listQuery.stockRoomId = this.$store.getters.stockRoomId;
} }
getGoodsList(this.listQuery).then(res => { getGoodsList(this.listQuery)
this.listLoading = false .then((res) => {
this.list = res.data.list this.listLoading = false;
this.total = res.data.total this.list = res.data.list;
}).catch(err => { this.total = res.data.total;
this.listLoading = false
}) })
.catch((err) => {
this.listLoading = false;
});
}, },
// 新增 // 新增
handleAdd() { handleAdd() {
this.$refs.addGoods.add() this.$refs.addGoods.add();
}, },
// 扫码入库 // 扫码入库
handleScanPut() { handleScanPut() {
this.$refs.scanPut.add() this.$refs.scanPut.add();
}, },
handleScanOut() { handleScanOut() {
this.$refs.scanOut.add() this.$refs.scanOut.add();
}, },
// 导入 // 导入
handleImport() { handleImport() {
this.$refs.importGoods.add() this.$refs.importGoods.add();
} },
} },
} };
</script> </script>
<style scoped> <style scoped>
.app-container { .app-container {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
.input-width { .input-width {
width: 180px; width: 180px;
} }
.btn-groups button { .btn-groups button {
width: 100px; width: 100px;
} }
</style> </style>
<template>  <template>
 
<div class="app-container"> <div class="app-container">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<el-card class="filter-container" <el-card class="filter-container" shadow="never">
shadow="never"> <el-form :inline="true" :model="listQuery" size="small">
<el-form :inline="true"
:model="listQuery"
size="small">
<el-form-item label="物品名称:"> <el-form-item label="物品名称:">
<el-input v-model="listQuery.goodsMame" <el-input
v-model="listQuery.goodsMame"
class="input-width" class="input-width"
placeholder="请输入物品名称"></el-input> placeholder="请输入物品名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="物品类别:"> <el-form-item label="物品类别:">
<el-select v-model="listQuery.goodsCategoryId" <el-select
v-model="listQuery.goodsCategoryId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别"> placeholder="请选择物品类别"
<el-option v-for="item in categoryOptions" >
<el-option
v-for="item in categoryOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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.departId" <el-select
v-model="listQuery.departId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择部门"> placeholder="请选择部门"
<el-option v-for="item in departmentOptions" >
<el-option
v-for="item in departmentOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></el-option> :value="item.id"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 超级管理员可见--> <!-- 超级管理员可见-->
<el-form-item label="库房:" v-if="$store.getters.type == 1"> <el-form-item label="库房:" v-if="$store.getters.type == 1">
<el-select v-model="listQuery.stockRoomId" <el-select
v-model="listQuery.stockRoomId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择库房"> placeholder="请选择库房"
<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"
:value="item.id"></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-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
type="daterange" type="daterange"
...@@ -53,119 +68,160 @@ ...@@ -53,119 +68,160 @@
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
@change="changeDate"> @change="changeDate"
>
</el-date-picker> </el-date-picker>
</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">搜索 size="small"
>搜索
</el-button> </el-button>
<el-button @click="handleResetSearch" <el-button
@click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置 size="small"
>重置
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<!-- 表格栏 --> <!-- 表格栏 -->
<el-card class="filter-container mt15" <el-card class="filter-container mt15" shadow="never">
shadow="never">
<div class="table-container"> <div class="table-container">
<el-table :data="list" <el-table
:data="list"
v-loading="listLoading" v-loading="listLoading"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border> border
<el-table-column type="selection" >
<el-table-column
type="selection"
align="center" align="center"
width="50"></el-table-column> width="50"
<el-table-column label="物品名称" ></el-table-column>
align="center"> <el-table-column label="物品名称" align="center">
<template slot-scope="scope">{{scope.row.goodsName}}</template> <template slot-scope="scope">{{ scope.row.goodsName }}</template>
</el-table-column> </el-table-column>
<el-table-column label="型号" <el-table-column label="型号" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.goodsNo }}</template>
<template slot-scope="scope">{{scope.row.goodsNo}}</template>
</el-table-column> </el-table-column>
<el-table-column label="物品类别" <el-table-column label="物品类别" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.categoryName }}</template>
<template slot-scope="scope">{{scope.row.categoryName}}</template>
</el-table-column> </el-table-column>
<el-table-column label="数量" <el-table-column label="数量" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.outboundNum }}</template>
<template slot-scope="scope">{{scope.row.outboundNum}}</template>
</el-table-column> </el-table-column>
<el-table-column label="申领人" <el-table-column label="申领人" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{$store.getters.type == 1? scope.row.backOutboundName : scope.row.receptOutboundName}}</template> $store.getters.type == 1
? scope.row.backOutboundName
: scope.row.receptOutboundName
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="所属部门" <el-table-column label="所属部门" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.departmentName || '--'}}</template> scope.row.departmentName || "--"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="所属库房" <el-table-column label="所属库房" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template> scope.row.stockRoomName || "--"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="出库日期" <el-table-column label="出库日期" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.createtime | formatTime }}</template> scope.row.createtime | formatTime
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作" width="220" align="center">
width="220"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" <el-button
size="mini"
type="warning" type="warning"
@click="handleUpdate(scope.row)">修改 @click="handleUpdate(scope.row)"
>修改
</el-button> </el-button>
<el-button size="mini" <el-button
size="mini"
type="danger" type="danger"
@click="handleDelete(scope.row)">删除 @click="handleDelete(scope.row)"
>删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="export-container">
<div class="content">
<el-button
@click="exportData(0)"
:loading="exportLoading"
size="small"
>导出全部数据
</el-button>
<el-button
@click="exportData(1)"
:loading="exportLoading"
size="small"
>导出本页数据
</el-button>
<el-button
@click="exportData(2)"
:loading="exportLoading"
size="small"
>导出已选数据
</el-button>
</div>
</div>
</div> </div>
<!-- 分页栏 --> <!-- 分页栏 -->
<div class="pagination-container"> <div class="pagination-container">
<el-pagination background <el-pagination
background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="listQuery.pageNum" :current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize" :page-size="listQuery.pageSize"
:page-sizes="[10,30,50]" :page-sizes="[10, 30, 50]"
:total="total"> :total="total"
>
</el-pagination> </el-pagination>
</div> </div>
</el-card> </el-card>
<!-- 弹窗 --> <!-- 弹窗 -->
<update-num-modal ref="updateNum" <update-num-modal ref="updateNum" @ok="getList"></update-num-modal>
@ok="getList"></update-num-modal>
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from "moment";
import { getOutboundRecordList, getGoodsCategoryList, getStockRooms, getDepartmentList,updateOutboundRecord } from '@/api/inventory' import {
import UpdateNumModal from './modules/updateNumModal' getOutboundRecordList,
getGoodsCategoryList,
getStockRooms,
getDepartmentList,
updateOutboundRecord,
} from "@/api/inventory";
import UpdateNumModal from "./modules/updateNumModal";
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
goodsCategoryId: '', goodsCategoryId: "",
stockRoomId: '', stockRoomId: "",
goodsMame: '', goodsMame: "",
memberName: '', memberName: "",
departId: '', departId: "",
startTime:'', startTime: "",
endTime:'' endTime: "",
} };
export default { export default {
name: 'WarehouseAdmin', name: "WarehouseAdmin",
components: {UpdateNumModal}, components: { UpdateNumModal },
data() { data() {
return { return {
dateRange: [], dateRange: [],
...@@ -173,126 +229,204 @@ export default { ...@@ -173,126 +229,204 @@ export default {
list: [], list: [],
total: 0, total: 0,
listLoading: false, listLoading: false,
exportLoading: false,
multipleSelection: [], multipleSelection: [],
categoryOptions: [], categoryOptions: [],
depotOptions: [], depotOptions: [],
departmentOptions: [] departmentOptions: [],
} };
}, },
created() { created() {
this.getList() this.getList();
this.getGoodsCategoryList() this.getGoodsCategoryList();
this.getStockRooms() this.getStockRooms();
this.getDepartmentList() this.getDepartmentList();
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
if (!time) { if (!time) {
return '--' return "--";
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
} }
return moment(time).format("YYYY-MM-DD HH:mm:ss");
},
}, },
methods: { methods: {
// 选择时间 // 选择时间
changeDate(value){ changeDate(value) {
if(value){ if (value) {
this.listQuery.startTime = value[0] this.listQuery.startTime = value[0];
this.listQuery.endTime = value[1] this.listQuery.endTime = value[1];
}else { } else {
this.listQuery.startTime =null this.listQuery.startTime = null;
this.listQuery.endTime = null this.listQuery.endTime = null;
} }
console.log('value',value) console.log("value", value);
}, },
handleResetSearch() { handleResetSearch() {
this.dateRange = null this.dateRange = null;
this.listQuery = Object.assign({}, defaultListQuery) this.listQuery = Object.assign({}, defaultListQuery);
this.getList() this.getList();
}, },
handleSearchList() { handleSearchList() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.listQuery.pageSize = val this.listQuery.pageSize = val;
this.getList() this.getList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.pageNum = val this.listQuery.pageNum = val;
this.getList() this.getList();
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals;
}, },
// 物品类别 // 物品类别
getGoodsCategoryList() { getGoodsCategoryList() {
getGoodsCategoryList().then(res => { getGoodsCategoryList().then((res) => {
this.categoryOptions = res.data.list this.categoryOptions = res.data.list;
}) });
}, },
// 库房 // 库房
getStockRooms() { getStockRooms() {
getStockRooms({status: 1}).then(res => { getStockRooms({ status: 1 }).then((res) => {
this.depotOptions = res.data.list this.depotOptions = res.data.list;
}) });
}, },
getDepartmentList() { getDepartmentList() {
getDepartmentList().then(res => { getDepartmentList().then((res) => {
this.departmentOptions = res.data.list 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) { if (this.$store.getters.type == 2) {
this.listQuery.stockRoomId = this.$store.getters.stockRoomId this.listQuery.stockRoomId = this.$store.getters.stockRoomId;
} }
getOutboundRecordList(this.listQuery).then(res => { getOutboundRecordList(this.listQuery)
this.listLoading = false .then((res) => {
this.list = res.data.list this.listLoading = false;
this.total = res.data.total this.list = res.data.list;
}).catch(err => { this.total = res.data.total;
this.listLoading = false
}) })
.catch((err) => {
this.listLoading = false;
});
}, },
// 修改/ // 修改/
handleUpdate(row){ handleUpdate(row) {
this.$refs.updateNum.update(row) this.$refs.updateNum.update(row);
}, },
// 删除 // 删除
handleDelete(row){ handleDelete(row) {
this.$confirm('是否删除该条出库记录?', '提示', { this.$confirm("是否删除该条出库记录?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => {
updateOutboundRecord({id: row.id,deleteStatus: 0 }).then(res=>{
this.getList()
}) })
}).catch(() => { .then(() => {
updateOutboundRecord({ id: row.id, deleteStatus: 0 }).then((res) => {
this.getList();
}); });
})
.catch(() => {});
}, },
// 导出数据
exportData(type) {
this.exportLoading = true;
if (type == 0) {
// 导出全部数据
let params = Object.assign({}, this.listQuery);
params.pageSize = this.total;
getOutboundRecordList(params)
.then((res) => {
this.exportExcel(res.data.list);
})
.catch(() => {
this.exportLoading = false;
this.$message.error("获取导出数据失败,请重试!");
});
} else if (type == 2) {
// 导出选中数据
if (this.multipleSelection.length == 0) {
this.exportLoading = false;
this.$message.warning("请选择要导出的数据");
return;
} }
} this.exportExcel(this.multipleSelection);
} else {
// 导出本页数据
this.exportExcel(this.list);
}
},
// 导出表格
exportExcel(list) {
require.ensure([], () => {
const { export_json_to_excel } = require("@/vendor/Export2Excel");
const tHeader = [
"物品名称",
"型号",
"物品类别",
"数量",
"申领人",
"所属部门",
"所属库房",
"出库日期",
];
const filterVal = [
"goodsName",
"goodsNo",
"categoryName",
"outboundNum",
"outboundName",
"departmentName",
"stockRoomName",
"createtime",
];
const data = this.formatJson(filterVal, list);
export_json_to_excel(tHeader, data, "出库列表");
this.exportLoading = false;
});
},
// 格式化导出数据
formatJson(filterVal, jsonData) {
return jsonData.map((v) => {
return filterVal.map((j) => {
if (j === "outboundName") {
if (this.$store.getters.type == 1) {
return v["backOutboundName"];
} else {
return v["receptOutboundName"];
}
} else if (j === "createtime") {
return this.$options.filters.formatTime(v[j]);
} else {
return v[j] || "--";
}
});
});
},
},
};
</script> </script>
<style scoped> <style scoped>
.app-container { .app-container {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
.input-width { .input-width {
width: 180px; width: 180px;
} }
</style> </style>
<template>  <template>
 
<div class="app-container"> <div class="app-container">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<el-card class="filter-container" <el-card class="filter-container" shadow="never">
shadow="never"> <el-form :inline="true" :model="listQuery" size="small">
<el-form :inline="true"
:model="listQuery"
size="small">
<el-form-item label="供应商:"> <el-form-item label="供应商:">
<el-select v-model="listQuery.supplierId" <el-select
v-model="listQuery.supplierId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择供应商"> placeholder="请选择供应商"
<el-option v-for="item in supplierOptions" >
<el-option
v-for="item in supplierOptions"
:key="item.id" :key="item.id"
:label="item.supplierName" :label="item.supplierName"
:value="item.id"></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.goodsCategoryId" <el-select
v-model="listQuery.goodsCategoryId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别" placeholder="请选择物品类别"
@visible-change="handleOpenCate"> @visible-change="handleOpenCate"
<el-option v-for="item in categoryOptions" >
<el-option
v-for="item in categoryOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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.goodsId" <el-select
filterable
v-model="listQuery.goodsId"
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品" placeholder="请选择物品"
@visible-change="handleOpenGoods"> @visible-change="handleOpenGoods"
<el-option v-for="item in goodOptions" >
<el-option
v-for="item in goodOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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">搜索 size="small"
>搜索
</el-button> </el-button>
<el-button @click="handleResetSearch" <el-button
@click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置 size="small"
>重置
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<!-- 表格栏 --> <!-- 表格栏 -->
<el-card class="filter-container mt15" <el-card class="filter-container mt15" shadow="never">
shadow="never">
<div class="table-container"> <div class="table-container">
<ve-line :data="chartData" <ve-line
:data="chartData"
:legend-visible="false" :legend-visible="false"
:loading="loading" :loading="loading"
:data-empty="dataEmpty" :data-empty="dataEmpty"
...@@ -68,180 +85,196 @@ ...@@ -68,180 +85,196 @@
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from "moment";
import { str2Date } from '@/utils/date' import { str2Date } from "@/utils/date";
import { getSuppliersList } from '@/api/supplier' import { getSuppliersList } from "@/api/supplier";
import { getGoodsList, getGoodsCategoryList } from '@/api/inventory' import { getGoodsList, getGoodsCategoryList } from "@/api/inventory";
import { getInventoryList } from '@/api/report' import { getInventoryList } from "@/api/report";
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
goodsId: '', goodsId: "",
supplierId: '', supplierId: "",
goodsCategoryId: '' goodsCategoryId: "",
} };
export default { export default {
name: 'InventoryChart', name: "InventoryChart",
data() { data() {
return { return {
categoryOptions: [], categoryOptions: [],
supplierOptions: [], supplierOptions: [],
goodOptions: [], goodOptions: [],
inventoryList: [], inventoryList: [],
orderCountDate: '', orderCountDate: "",
statusOptions: [{ statusOptions: [
label: '启用', {
value: 1 label: "启用",
value: 1,
}, },
{ {
label: '禁用', label: "禁用",
value: 0 value: 0,
}], },
],
listQuery: Object.assign({}, defaultListQuery), listQuery: Object.assign({}, defaultListQuery),
list: [], list: [],
total: 0, total: 0,
listLoading: false, listLoading: false,
multipleSelection: [], multipleSelection: [],
chartData: { chartData: {
columns: ['data', 'num'], columns: ["data", "num"],
rows: [] rows: [],
}, },
loading: false, loading: false,
dataEmpty: false dataEmpty: false,
} };
}, },
created() { created() {
this.getSuppliersList() this.getSuppliersList();
// this.getData() // this.getData()
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
if (!time) { if (!time) {
return '--' return "--";
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
} }
return moment(time).format("YYYY-MM-DD HH:mm:ss");
},
}, },
methods: { methods: {
getDay(day) { getDay(day) {
var today = new Date() var today = new Date();
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetday_milliseconds) //注意,这行是关键代码 today.setTime(targetday_milliseconds); //注意,这行是关键代码
var tYear = today.getFullYear() var tYear = today.getFullYear();
var tMonth = today.getMonth() var tMonth = today.getMonth();
var tDate = today.getDate() var tDate = today.getDate();
tMonth = this.doHandleMonth(tMonth + 1) tMonth = this.doHandleMonth(tMonth + 1);
tDate = this.doHandleMonth(tDate) tDate = this.doHandleMonth(tDate);
console.log('tYear + \'-\' + tMonth + \'-\' + tDate',tYear + '-' + tMonth + '-' + tDate) console.log(
return tYear + '-' + tMonth + '-' + tDate "tYear + '-' + tMonth + '-' + tDate",
tYear + "-" + tMonth + "-" + tDate
);
return tYear + "-" + tMonth + "-" + tDate;
}, },
doHandleMonth(month) { doHandleMonth(month) {
var m = month var m = month;
if (month.toString().length == 1) { if (month.toString().length == 1) {
m = '0' + month m = "0" + month;
} }
return m return m;
}, },
formatEveryDay() { formatEveryDay() {
let start1 = this.getDay(-7) let start1 = this.getDay(-7);
let end1 = this.getDay(0) let end1 = this.getDay(0);
console.log('start1','end1',start1,end1) console.log("start1", "end1", start1, end1);
let dateList = [] let dateList = [];
var startTime = this.getDate(start1) var startTime = this.getDate(start1);
var endTime = this.getDate(end1) var endTime = this.getDate(end1);
while ((endTime.getTime() - startTime.getTime()) >= 0) { while (endTime.getTime() - startTime.getTime() >= 0) {
var year = startTime.getFullYear() var year = startTime.getFullYear();
var month = startTime.getMonth() + 1 < 10 ? '0' + (startTime.getMonth() + 1) : startTime.getMonth() + 1 var month =
var day = startTime.getDate().toString().length == 1 ? '0' + startTime.getDate() : startTime.getDate() startTime.getMonth() + 1 < 10
dateList.push(year + '-' + month + '-' + day) ? "0" + (startTime.getMonth() + 1)
startTime.setDate(startTime.getDate() + 1) : startTime.getMonth() + 1;
var day =
startTime.getDate().toString().length == 1
? "0" + startTime.getDate()
: startTime.getDate();
dateList.push(year + "-" + month + "-" + day);
startTime.setDate(startTime.getDate() + 1);
} }
console.log('dateList',dateList) console.log("dateList", dateList);
return dateList return dateList;
}, },
getDate(datestr) { getDate(datestr) {
var temp = datestr.split('-') var temp = datestr.split("-");
var date = new Date(temp[0], temp[1] - 1, temp[2]) var date = new Date(temp[0], temp[1] - 1, temp[2]);
console.log('date', date) console.log("date", date);
return date return date;
}, },
handleOpenCate(visible) { handleOpenCate(visible) {
if (visible) { if (visible) {
this.getGoodsCategoryList() this.getGoodsCategoryList();
} }
}, },
handleOpenGoods(visible) { handleOpenGoods(visible) {
if (visible) { if (visible) {
this.getGoodsList() this.getGoodsList();
} }
}, },
// 物品 // 物品
getGoodsList() { getGoodsList() {
getGoodsList({ getGoodsList({
goodsCategoryI: this.listQuery.goodsCategoryId, goodsCategoryI: this.listQuery.goodsCategoryId,
supplierId: this.listQuery.supplierId supplierId: this.listQuery.supplierId,
}).then(res => { }).then((res) => {
this.goodOptions = res.data.list this.goodOptions = res.data.list;
}) });
}, },
// 物品类别 // 物品类别
getGoodsCategoryList() { getGoodsCategoryList() {
getGoodsCategoryList({ supplierId: this.listQuery.supplierId }).then(res => { getGoodsCategoryList({ supplierId: this.listQuery.supplierId }).then(
this.categoryOptions = res.data.list (res) => {
}) this.categoryOptions = res.data.list;
}
);
}, },
// 供应商 // 供应商
getSuppliersList() { getSuppliersList() {
getSuppliersList().then(res => { getSuppliersList().then((res) => {
this.supplierOptions = res.data.list this.supplierOptions = res.data.list;
}) });
}, },
getList() { getList() {
if (!this.listQuery.goodsId) { if (!this.listQuery.goodsId) {
this.$message.warning('请选择物品') this.$message.warning("请选择物品");
return return;
} }
getInventoryList({ dateList: this.formatEveryDay(), goodsId: this.listQuery.goodsId }).then(res => { getInventoryList({
this.chartData.rows = res.data dateList: this.formatEveryDay(),
console.log('res', this.chartData) 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();
}, },
handleSearchList() { handleSearchList() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals;
}, },
handleAdd() { handleAdd() {
this.$refs.addGoods.add() this.$refs.addGoods.add();
} },
} },
} };
</script> </script>
<style scoped> <style scoped>
.app-container { .app-container {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
.input-width { .input-width {
width: 180px; width: 180px;
} }
.btn-groups button { .btn-groups button {
width: 100px; width: 100px;
} }
</style> </style>
<template>  <template>
 
<div class="app-container"> <div class="app-container">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<el-card class="filter-container" <el-card class="filter-container" shadow="never">
shadow="never"> <el-form :inline="true" :model="listQuery" size="small">
<el-form :inline="true"
:model="listQuery"
size="small">
<el-form-item label="供应商:"> <el-form-item label="供应商:">
<el-select v-model="listQuery.supplierId" <el-select
v-model="listQuery.supplierId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择供应商"> placeholder="请选择供应商"
<el-option v-for="item in supplierOptions" >
<el-option
v-for="item in supplierOptions"
:key="item.id" :key="item.id"
:label="item.supplierName" :label="item.supplierName"
:value="item.id"></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.goodsCategoryId" <el-select
v-model="listQuery.goodsCategoryId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品类别" placeholder="请选择物品类别"
@visible-change="handleOpenCate"> @visible-change="handleOpenCate"
<el-option v-for="item in categoryOptions" >
<el-option
v-for="item in categoryOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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.goodsId" <el-select
v-model="listQuery.goodsId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择物品" placeholder="请选择物品"
@visible-change="handleOpenGoods"> @visible-change="handleOpenGoods"
<el-option v-for="item in goodOptions" >
<el-option
v-for="item in goodOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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="出库日期:">
...@@ -48,27 +61,32 @@ ...@@ -48,27 +61,32 @@
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期"> end-placeholder="结束日期"
>
</el-date-picker> </el-date-picker>
</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">搜索 size="small"
>搜索
</el-button> </el-button>
<el-button @click="handleResetSearch" <el-button
@click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置 size="small"
>重置
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<!-- 表格栏 --> <!-- 表格栏 -->
<el-card class="filter-container mt15" <el-card class="filter-container mt15" shadow="never">
shadow="never">
<div class="table-container"> <div class="table-container">
<ve-line :data="chartData" <ve-line
:data="chartData"
:legend-visible="false" :legend-visible="false"
:loading="loading" :loading="loading"
:data-empty="dataEmpty" :data-empty="dataEmpty"
...@@ -78,21 +96,21 @@ ...@@ -78,21 +96,21 @@
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from "moment";
import { str2Date } from '@/utils/date' import { str2Date } from "@/utils/date";
import { getSuppliersList } from '@/api/supplier' import { getSuppliersList } from "@/api/supplier";
import { getGoodsList, getGoodsCategoryList } from '@/api/inventory' import { getGoodsList, getGoodsCategoryList } from "@/api/inventory";
import { getRecipientList } from '@/api/report' import { getRecipientList } from "@/api/report";
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
goodsId: '', goodsId: "",
supplierId: '', supplierId: "",
goodsCategoryId: '', goodsCategoryId: "",
} };
export default { export default {
name: 'Recipients', name: "Recipients",
data() { data() {
return { return {
dataRange: [], dataRange: [],
...@@ -100,189 +118,211 @@ export default { ...@@ -100,189 +118,211 @@ export default {
supplierOptions: [], supplierOptions: [],
goodOptions: [], goodOptions: [],
inventoryList: [], inventoryList: [],
orderCountDate: '', orderCountDate: "",
statusOptions: [{ statusOptions: [
label: '启用', {
value: 1 label: "启用",
value: 1,
}, },
{ {
label: '禁用', label: "禁用",
value: 0 value: 0,
}], },
],
listQuery: Object.assign({}, defaultListQuery), listQuery: Object.assign({}, defaultListQuery),
list: [], list: [],
total: 0, total: 0,
listLoading: false, listLoading: false,
multipleSelection: [], multipleSelection: [],
chartData: { chartData: {
columns: ['data', 'num'], columns: ["data", "num"],
rows: [] rows: [],
}, },
loading: false, loading: false,
dataEmpty: false dataEmpty: false,
} };
}, },
created() { created() {
this.getSuppliersList() this.getSuppliersList();
this.formatEveryDay() this.formatEveryDay();
// this.getData() // this.getData()
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
if (!time) { if (!time) {
return '--' return "--";
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
} }
return moment(time).format("YYYY-MM-DD HH:mm:ss");
},
}, },
methods: { methods: {
getDay(day) { getDay(day) {
var today = new Date() var today = new Date();
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetday_milliseconds) //注意,这行是关键代码 today.setTime(targetday_milliseconds); //注意,这行是关键代码
var tYear = today.getFullYear() var tYear = today.getFullYear();
var tMonth = today.getMonth() var tMonth = today.getMonth();
var tDate = today.getDate() var tDate = today.getDate();
tMonth = this.doHandleMonth(tMonth + 1) tMonth = this.doHandleMonth(tMonth + 1);
tDate = this.doHandleMonth(tDate) tDate = this.doHandleMonth(tDate);
console.log('tYear + \'-\' + tMonth + \'-\' + tDate', tYear + '-' + tMonth + '-' + tDate) console.log(
return tYear + '-' + tMonth + '-' + tDate "tYear + '-' + tMonth + '-' + tDate",
tYear + "-" + tMonth + "-" + tDate
);
return tYear + "-" + tMonth + "-" + tDate;
}, },
doHandleMonth(month) { doHandleMonth(month) {
var m = month var m = month;
if (month.toString().length == 1) { if (month.toString().length == 1) {
m = '0' + month m = "0" + month;
} }
return m return m;
}, },
formatEveryDay() { formatEveryDay() {
let start1 = this.getDay(-6) let start1 = this.getDay(-6);
let end1 = this.getDay(0) let end1 = this.getDay(0);
console.log('start1', 'end1', start1, end1) console.log("start1", "end1", start1, end1);
let dateList = [] let dateList = [];
var startTime = this.getDate(start1) var startTime = this.getDate(start1);
var endTime = this.getDate(end1) var endTime = this.getDate(end1);
while ((endTime.getTime() - startTime.getTime()) >= 0) { while (endTime.getTime() - startTime.getTime() >= 0) {
var year = startTime.getFullYear() var year = startTime.getFullYear();
var month = startTime.getMonth() + 1 < 10 ? '0' + (startTime.getMonth() + 1) : startTime.getMonth() + 1 var month =
var day = startTime.getDate().toString().length == 1 ? '0' + startTime.getDate() : startTime.getDate() startTime.getMonth() + 1 < 10
dateList.push(year + '-' + month + '-' + day) ? "0" + (startTime.getMonth() + 1)
startTime.setDate(startTime.getDate() + 1) : startTime.getMonth() + 1;
var day =
startTime.getDate().toString().length == 1
? "0" + startTime.getDate()
: startTime.getDate();
dateList.push(year + "-" + month + "-" + day);
startTime.setDate(startTime.getDate() + 1);
} }
console.log(' this.dataRange', dateList, this.dataRange) console.log(" this.dataRange", dateList, this.dataRange);
this.dataRange = [dateList[0], dateList[dateList.length - 1]] this.dataRange = [dateList[0], dateList[dateList.length - 1]];
}, },
getDate(datestr) { getDate(datestr) {
var temp = datestr.split('-') var temp = datestr.split("-");
var date = new Date(temp[0], temp[1] - 1, temp[2]) var date = new Date(temp[0], temp[1] - 1, temp[2]);
console.log('date', date) console.log("date", date);
return date return date;
}, },
//获取两日期之间日期列表函数 //获取两日期之间日期列表函数
getdiffdate(stime, etime) { getdiffdate(stime, etime) {
//初始化日期列表,数组 //初始化日期列表,数组
var diffdate = new Array() var diffdate = new Array();
var i = 0 var i = 0;
//开始日期小于等于结束日期,并循环 //开始日期小于等于结束日期,并循环
while (stime <= etime) { while (stime <= etime) {
diffdate[i] = stime diffdate[i] = stime;
//获取开始日期时间戳 //获取开始日期时间戳
var stime_ts = new Date(stime).getTime() var stime_ts = new Date(stime).getTime();
console.log('当前日期:' + stime + '当前时间戳:' + stime_ts) console.log("当前日期:" + stime + "当前时间戳:" + stime_ts);
//增加一天时间戳后的日期 //增加一天时间戳后的日期
var next_date = stime_ts + (24 * 60 * 60 * 1000) var next_date = stime_ts + 24 * 60 * 60 * 1000;
//拼接年月日,这里的月份会返回(0-11),所以要+1 //拼接年月日,这里的月份会返回(0-11),所以要+1
var next_dates_y = new Date(next_date).getFullYear() + '-' 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_m =
var next_dates_d = (new Date(next_date).getDate() < 10) ? '0' + new Date(next_date).getDate() : new Date(next_date).getDate() 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 stime = next_dates_y + next_dates_m + next_dates_d;
//增加数组key //增加数组key
i++ i++;
} }
return diffdate return diffdate;
}, },
handleOpenCate(visible) { handleOpenCate(visible) {
if (visible) { if (visible) {
this.getGoodsCategoryList() this.getGoodsCategoryList();
} }
}, },
handleOpenGoods(visible) { handleOpenGoods(visible) {
if (visible) { if (visible) {
this.getGoodsList() this.getGoodsList();
} }
}, },
// 物品 // 物品
getGoodsList() { getGoodsList() {
getGoodsList({ getGoodsList({
goodsCategoryI: this.listQuery.goodsCategoryId, goodsCategoryI: this.listQuery.goodsCategoryId,
supplierId: this.listQuery.supplierId supplierId: this.listQuery.supplierId,
}).then(res => { }).then((res) => {
this.goodOptions = res.data.list this.goodOptions = res.data.list;
}) });
}, },
// 物品类别 // 物品类别
getGoodsCategoryList() { getGoodsCategoryList() {
getGoodsCategoryList({ supplierId: this.listQuery.supplierId }).then(res => { getGoodsCategoryList({ supplierId: this.listQuery.supplierId }).then(
this.categoryOptions = res.data.list (res) => {
}) this.categoryOptions = res.data.list;
}
);
}, },
// 供应商 // 供应商
getSuppliersList() { getSuppliersList() {
getSuppliersList().then(res => { getSuppliersList().then((res) => {
this.supplierOptions = res.data.list this.supplierOptions = res.data.list;
}) });
}, },
getList() { getList() {
if (!this.listQuery.goodsId) { if (!this.listQuery.goodsId) {
this.$message.warning('请选择物品') this.$message.warning("请选择物品");
return return;
} }
let dateList = this.getdiffdate(this.dataRange[0], this.dataRange[1]) let dateList = this.getdiffdate(this.dataRange[0], this.dataRange[1]);
console.log('dateList', dateList) console.log("dateList", dateList);
getRecipientList({ dateList: dateList, goodsId: this.listQuery.goodsId }).then(res => { getRecipientList({
this.chartData.rows = res.data dateList: dateList,
}) goodsId: this.listQuery.goodsId,
}).then((res) => {
this.chartData.rows = res.data;
});
}, },
handleResetSearch() { handleResetSearch() {
this.dataRange = null this.dataRange = null;
this.listQuery = Object.assign({}, defaultListQuery) this.listQuery = Object.assign({}, defaultListQuery);
this.getList() this.getList();
}, },
handleSearchList() { handleSearchList() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals;
}, },
handleAdd() { handleAdd() {
this.$refs.addGoods.add() this.$refs.addGoods.add();
} },
} },
} };
</script> </script>
<style scoped> <style scoped>
.app-container { .app-container {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
.input-width { .input-width {
width: 180px; width: 180px;
} }
.btn-groups button { .btn-groups button {
width: 100px; width: 100px;
} }
</style> </style>
<template>  <template>
 
<div class="app-container"> <div class="app-container">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<el-card class="filter-container" <el-card class="filter-container" shadow="never">
shadow="never"> <el-form :inline="true" :model="listQuery" size="small">
<el-form :inline="true"
:model="listQuery"
size="small">
<el-form-item label="用户名称:"> <el-form-item label="用户名称:">
<el-input v-model="listQuery.name" <el-input
v-model="listQuery.name"
class="input-width" class="input-width"
placeholder="请输入用户名称"></el-input> placeholder="请输入用户名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="部门:"> <el-form-item label="部门:">
<el-select v-model="listQuery.departId" <el-select
v-model="listQuery.departId"
filterable
class="input-width" class="input-width"
clearable clearable
placeholder="请选择部门"> placeholder="请选择部门"
<el-option v-for="item in departmentOptions" >
<el-option
v-for="item in departmentOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id"></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">搜索 size="small"
>搜索
</el-button> </el-button>
<el-button @click="handleResetSearch" <el-button
@click="handleResetSearch"
icon="el-icon-refresh" icon="el-icon-refresh"
size="small">重置 size="small"
>重置
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button class="btn-add" <el-button
class="btn-add"
size="small" size="small"
type="primary" type="primary"
@click="handleAdd">导入用户 @click="handleAdd"
>导入用户
</el-button> </el-button>
<el-button class="btn-add" <el-button
class="btn-add"
size="small" size="small"
type="primary" type="primary"
@click="addVMember">微V导入 @click="addVMember"
>微V导入
</el-button> </el-button>
</el-form> </el-form>
</el-card> </el-card>
<!-- 表格栏 --> <!-- 表格栏 -->
<el-card class="filter-container mt15" <el-card class="filter-container mt15" shadow="never">
shadow="never">
<div class="table-container"> <div class="table-container">
<el-table :data="list" <el-table
:data="list"
v-loading="listLoading" v-loading="listLoading"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border> border
<el-table-column type="selection" >
<el-table-column
type="selection"
align="center" align="center"
width="50"></el-table-column> width="50"
<el-table-column label="姓名" ></el-table-column>
align="center"> <el-table-column label="姓名" align="center">
<template slot-scope="scope">{{scope.row.name}}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="员工编号" <el-table-column label="员工编号" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.jobNo || '--'}}</template> scope.row.jobNo || "--"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="部门" <el-table-column label="部门" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.departName || '--'}}</template> scope.row.departName || "--"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="联系方式" <el-table-column label="联系方式" align="center">
align="center"> <template slot-scope="scope">{{ scope.row.phone }}</template>
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态" <el-table-column label="状态" align="center">
align="center"> <template slot-scope="scope">{{
<template slot-scope="scope">{{scope.row.status? '启用': '禁用'}}</template> scope.row.status ? "启用" : "禁用"
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作" width="220" align="center">
width="220"
align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" <el-button
size="mini"
type="primary" type="primary"
@click="handleDisable(scope.row)"> @click="handleDisable(scope.row)"
{{scope.row.status? '禁用': '启用'}} >
{{ scope.row.status ? "禁用" : "启用" }}
</el-button> </el-button>
<el-button size="mini" <el-button
size="mini"
type="success" type="success"
@click="handleSet(scope.row)">设置为管理员 @click="handleSet(scope.row)"
>设置为管理员
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -95,47 +114,54 @@ ...@@ -95,47 +114,54 @@
</div> </div>
<!-- 分页栏 --> <!-- 分页栏 -->
<div class="pagination-container"> <div class="pagination-container">
<el-pagination background <el-pagination
background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="listQuery.pageNum" :current-page.sync="listQuery.pageNum"
:page-size="listQuery.pageSize" :page-size="listQuery.pageSize"
:page-sizes="[10,30,50]" :page-sizes="[10, 30, 50]"
:total="total"> :total="total"
>
</el-pagination> </el-pagination>
</div> </div>
</el-card> </el-card>
<!-- end --> <!-- end -->
<!-- 弹窗 --> <!-- 弹窗 -->
<add-admin ref="addAdmin" <add-admin ref="addAdmin" @ok="getList"></add-admin>
@ok="getList"></add-admin> <import-member-modal ref="importMember" @ok="getList"></import-member-modal>
<import-member-modal ref="importMember" <import-v-member-modal
@ok="getList"></import-member-modal> ref="importVMember"
<import-v-member-modal ref="importVMember" @ok="getList"
@ok="getList"></import-v-member-modal> ></import-v-member-modal>
<!-- end --> <!-- end -->
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from "moment";
import { getMemberList, getAuditDetail, updateMcht,updateMember } from '@/api/user' import {
import { getDepartmentList } from '@/api/inventory' getMemberList,
import AddAdmin from './modules/AddAdmin' getAuditDetail,
import ImportMemberModal from './modules/importMemberModal' updateMcht,
import ImportVMemberModal from './modules/importVMemberModal' updateMember,
} from "@/api/user";
import { getDepartmentList } from "@/api/inventory";
import AddAdmin from "./modules/AddAdmin";
import ImportMemberModal from "./modules/importMemberModal";
import ImportVMemberModal from "./modules/importVMemberModal";
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
name: null, name: null,
departId: null, departId: null,
accountType: 1 accountType: 1,
} };
export default { export default {
name: 'UserList', name: "UserList",
components: { AddAdmin, ImportMemberModal,ImportVMemberModal }, components: { AddAdmin, ImportMemberModal, ImportVMemberModal },
data() { data() {
return { return {
departmentOptions: [], departmentOptions: [],
...@@ -144,101 +170,103 @@ export default { ...@@ -144,101 +170,103 @@ export default {
total: 0, total: 0,
listLoading: false, listLoading: false,
multipleSelection: [], multipleSelection: [],
} };
}, },
created() { created() {
this.getList() this.getList();
this.getDepartmentList() this.getDepartmentList();
}, },
filters: { filters: {
formatTime(time) { formatTime(time) {
if (!time) { if (!time) {
return '--' return "--";
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
} }
return moment(time).format("YYYY-MM-DD HH:mm:ss");
},
}, },
methods: { methods: {
// 部门 // 部门
getDepartmentList() { getDepartmentList() {
getDepartmentList().then(res => { getDepartmentList().then((res) => {
this.departmentOptions = res.data.list this.departmentOptions = res.data.list;
}) });
}, },
handleResetSearch() { handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery) this.listQuery = Object.assign({}, defaultListQuery);
this.getList() this.getList();
}, },
handleSearchList() { handleSearchList() {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.getList() this.getList();
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.pageNum = 1 this.listQuery.pageNum = 1;
this.listQuery.pageSize = val this.listQuery.pageSize = val;
this.getList() this.getList();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.pageNum = val this.listQuery.pageNum = val;
this.getList() this.getList();
}, },
handleSelectionChange(vals) { handleSelectionChange(vals) {
this.multipleSelection = vals this.multipleSelection = vals;
}, },
//请求数据 //请求数据
getList() { getList() {
this.listLoading = true this.listLoading = true;
//请求数据 //请求数据
getMemberList(this.listQuery).then(res => { getMemberList(this.listQuery)
this.listLoading = false .then((res) => {
this.list = res.data.list this.listLoading = false;
this.total = res.data.total this.list = res.data.list;
}).catch(err => { this.total = res.data.total;
this.listLoading = false
}) })
.catch((err) => {
this.listLoading = false;
});
}, },
// 导入用户 // 导入用户
handleAdd() { handleAdd() {
this.$refs.importMember.add() this.$refs.importMember.add();
}, },
// 从微V导入用户 // 从微V导入用户
addVMember() { addVMember() {
this.$refs.importVMember.add() this.$refs.importVMember.add();
}, },
// 设置为管理员 // 设置为管理员
handleSet(row) { handleSet(row) {
this.$refs.addAdmin.add(row) this.$refs.addAdmin.add(row);
}, },
handleDisable(row){ handleDisable(row) {
let status = row.status? '0': '1' let status = row.status ? "0" : "1";
updateMember({id: row.id,status: status }).then(res=>{ updateMember({ id: row.id, status: status }).then((res) => {
this.getList() this.getList();
}) });
}, },
} },
} };
</script> </script>
<style scoped> <style scoped>
.app-container { .app-container {
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
padding: 0 15px; padding: 0 15px;
margin-top: 0; margin-top: 0;
} }
.el-row { .el-row {
margin-bottom: 20px; margin-bottom: 20px;
} }
.mt15 { .mt15 {
margin-top: 15px; margin-top: 15px;
} }
.el-input { .el-input {
width: 200px; width: 200px;
} }
.input-width { .input-width {
width: 180px; width: 180px;
} }
</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