Commit 99f03ee2 by wangyalan-git

bug修改

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