更新仓库管理

This commit is contained in:
2023-11-04 16:40:16 +08:00
parent 5521f07c18
commit 0deb38647e
110 changed files with 17806 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
<!--
* @Author: zwq
* @Date: 2023-08-22 15:01:54
* @LastEditors: zwq
* @LastEditTime: 2023-11-04 16:32:13
* @Description:
-->
<template>
<el-row :gutter="10" class="chart-container">
<el-col :span="14">
<div class="chart-card">
<barChart
ref="barChart"
height="500px"
title="库存总览"
v-if="overviewList.length"
:histogram="overviewList" />
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</div>
</el-col>
<el-col :span="10">
<div class="chart-card">
<pieChart
ref="pieChart"
height="600px"
v-if="rateList.length"
:pie-data="rateList" />
<!-- 没有数据 -->
<div class="no-data-bg" v-else></div>
</div>
</el-col>
</el-row>
</template>
<script>
import barChart from '../../chart/BarChart.vue';
import pieChart from '../../chart/PieChart.vue';
import {
getOverview,
getRate,
} from '@/api/warehouse/warehouseLocation';
export default {
data() {
return {
urlOptions: {
allURL: getOverview,
rateURL: getRate
},
overviewList: [],
rateList: []
};
},
components: {
barChart,
pieChart
},
mounted() {
this.getDataList();
},
methods: {
// 获取数据列表
getDataList() {
const data = {
storageType : 2
}
this.urlOptions.allURL(data).then((response) => {
this.overviewList = response.data;
this.$nextTick(() => {
this.$refs.barChart.initChart();
});
});
this.urlOptions.rateURL(data).then((response) => {
this.rateList = response.data;
this.$nextTick(() => {
this.$refs.pieChart.initChart();
});
});
},
},
};
</script>
<style scoped>
.chart-container {
min-height: calc(100vh - 120px - 8px);
background-color: #f0f2f7;
}
.chart-card {
min-height: calc(100vh - 120px - 8px);
background-color: #fff;
padding: 16px;
border-radius: 8px;
}
</style>

View File

@@ -0,0 +1,156 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2023-11-03 14:56:25
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input
v-model="dataForm.name"
clearable
placeholder="请输入名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
placeholder="请输入编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格" prop="spec">
<el-input
v-model="dataForm.spec"
clearable
placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select
v-model="dataForm.unit"
filterable
clearable
:style="{ width: '100%' }"
placeholder="请选择单位">
<el-option
v-for="item in urlOptions.dictList.dict0"
:key="item.id"
:label="item.label"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单日消耗量" prop="dailyUse">
<el-input-number
v-model="dataForm.dailyUse"
clearable
placeholder="请输入单日消耗量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="允许留存时间" prop="allowTime">
<el-input-number
v-model="dataForm.allowTime"
clearable
placeholder="请输入允许留存时间" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="enabled" label="是否可用">
<el-select
v-model="dataForm.enabled"
filterable
clearable
:style="{ width: '100%' }"
placeholder="请选择是否可用">
<el-option
v-for="item in isorno"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWarehouseGoods,
updateWarehouseGoods,
getWarehouseGoods,
getCode,
} from '@/api/warehouse/warehouseGoods';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: true,
getDictList: true,
codeURL: getCode,
createURL: createWarehouseGoods,
updateURL: updateWarehouseGoods,
infoURL: getWarehouseGoods,
},
nameList: ['unit_dict'],
dataForm: {
id: undefined,
code: '',
name: '',
spec: '',
unit: '',
dailyUse: 0,
allowTime: 0,
enabled: 1,
remark: '',
},
dataRule: {
code: [
{ required: true, message: '库位编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '库位名称不能为空', trigger: 'blur' },
],
},
isorno: [
{
id: 0,
name: '不可用',
},
{
id: 1,
name: '可用',
},
],
};
},
methods: {},
};
</script>

View File

@@ -0,0 +1,183 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import codeFilter from '../../mixins/code-filter';
import {
deleteWarehouseGoods,
getWarehouseGoodsPage,
} from "@/api/warehouse/warehouseGoods";
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'name',
label: '名称',
},
{
prop: 'code',
label: '编码',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
},
{
prop: 'allowTime',
label: '允许留存时长(天)',
},
{
prop: 'dailyUse',
label: '单日消耗量',
},
{
prop: 'enabled',
label: '是否可用',
filter: codeFilter('deactivate'),
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseGoodsPage,
deleteURL: deleteWarehouseGoods,
},
tableProps,
listQuery:{
storageType:2
},
tableBtn: [
this.$auth.hasPermi(`end-material:warehouse-goods:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`end-material:warehouse-goods:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v)=>v),
tableData: [],
formConfig: [
{
type: 'input',
label: '名称',
placeholder: '名称',
param: 'name',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('end-material:warehouse-goods:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
AddOrUpdate,
},
created() {},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@@ -0,0 +1,192 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:isFold="true"
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="库位详情"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseRealtimeHisPage,
} from '@/api/warehouse/warehouseRealtime';
import { getListByType } from '@/api/warehouse/warehouseGoods';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'name',
label: '物品名称',
},
{
prop: 'code',
label: '物品编码',
},
{
prop: 'spec',
label: '物品规格',
},
{
prop: 'num',
label: '出入库数量',
},
{
prop: 'goodsBatch',
label: '物品批次',
},
{
prop: 'operateStatus',
label: '操作状态',
filter: publicFormatter('warehouse_operate_status'),
},
{
prop: 'operateTime',
label: '操作时间',
filter: parseTime,
minWidth: 150,
},
{
prop: 'operator',
label: '操作人',
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeHisPage,
},
listQuery: {
storageType: 2,
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`end-material:warehouse-realtime-location-his:query`)
? {
type: 'info',
btnName: '详情',
}
: undefined,
].filter((v) => v),
drawerVisible: false,
formConfig: [
{
type: 'select',
label: '物品名称',
selectOptions: [],
param: 'goodsId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '操作人',
placeholder: '操作人',
param: 'operator',
},
{
type: 'select',
label: '操作状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
],
};
},
components: {
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'warehouse_operate_status',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
getListByType(this.listQuery.storageType).then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.goodsId = val.goodsId;
this.listQuery.operator = val.operator;
this.listQuery.operateStatus = val.status;
this.listQuery.operateTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,82 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2023-11-03 16:20:19
* @Description:
-->
<template>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:height="300"
:table-data="tableData" />
</template>
<script>
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseLocationHisDet } from '@/api/warehouse/warehouseRealtimeLocation';
const tableProps = [
{
prop: 'name',
label: '物品名称',
align: 'center',
},
{
prop: 'code',
label: '物品编码',
align: 'center',
},
{
prop: 'spec',
label: '物品规格',
align: 'center',
},
{
prop: 'batchCode',
label: '物品批次',
align: 'center',
},
{
prop: 'num',
label: '数量',
align: 'center',
},
{
prop: 'allowTime',
label: '允许留存时长(天)',
align: 'center',
},
{
prop: 'remark',
label: '备注',
align: 'center',
},
];
export default {
data() {
return {
tableData: [],
tableProps,
listQuery: {
pageSize: 100,
pageNo: 1,
total: 1,
},
dataListLoading: false,
};
},
methods: {
// 获取数据列表
init(id) {
this.dataListLoading = true;
getWarehouseLocationHisDet(id).then((response) => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,223 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:isFold="true"
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="库位详情"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
取消
</el-button>
</el-col>
</el-row>
</slot>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseLocationHisPage,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { listByWarehouse } from '@/api/warehouse/warehouseLocation';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'name',
label: '库位名称',
},
{
prop: 'code',
label: '库位编码',
},
{
prop: 'type',
label: '库位类型',
filter: publicFormatter('location_type'),
},
{
prop: 'palletCode',
label: '托盘编码',
},
{
prop: 'operateStatus',
label: '操作状态',
filter: publicFormatter('warehouse_operate_status'),
},
{
prop: 'createTime',
label: '操作时间',
filter: parseTime,
minWidth: 150,
},
{
prop: 'creator',
label: '操作人',
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseLocationHisPage,
},
listQuery: {
storageType: 2,
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`end-material:warehouse-realtime-location-his:query`)
? {
type: 'info',
btnName: '详情',
}
: undefined,
].filter((v) => v),
drawerVisible: false,
formConfig: [
{
type: 'select',
label: '库位名',
selectOptions: [],
param: 'name',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '托盘编码',
placeholder: '托盘编码',
param: 'code',
},
{
type: 'select',
label: '操作状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '操作时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'warehouse_operate_status',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
listByWarehouse(this.listQuery.storageType).then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.locationId = val.name;
this.listQuery.palletCode = val.code;
this.listQuery.operateStatus = val.status;
this.listQuery.createTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'info') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = val.data.name + ' -产品信息';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,221 @@
<!--
* @Author: zwq
* @Date: 2023-08-21 14:26:23
* @LastEditors: zwq
* @LastEditTime: 2023-11-04 14:46:59
* @Description:
-->
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<div class="tips">
<el-tag effect="dark" color="#7362F3" style="border: none">缓存</el-tag>
<el-tag effect="dark" color="#16DC09" style="border: none">活动</el-tag>
<el-tag effect="dark" color="#FFA08F" style="border: none">其它</el-tag>
</div>
<div class="mainbody">
<div v-for="i in total" :key="i">
<el-row>
<el-col :span="24">
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="a in wareData.one.slice((i - 1) * 10, i * 10)"
:key="a.id + a.code"
:title="a.name"
style="background: #fff8e8; float: left">
<div
class="dashboard-layout-item-cricle"
:style="{
background: bgColor[a.type - 1],
}" />
<p class="p-name">{{ a.name }}</p>
</div>
</el-row>
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="b in wareData.two.slice((i - 1) * 10, i * 10)"
:key="b.id + b.code"
:title="b.name"
style="background: #fff8e8; float: left">
<div
class="dashboard-layout-item-cricle"
:style="{
background: bgColor[b.type - 1],
}" />
<p class="p-name">{{ b.name }}</p>
</div>
</el-row>
</el-col>
</el-row>
<el-divider class="divider"></el-divider>
<el-row>
<el-col :span="24">
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="c in wareData.there.slice((i - 1) * 10, i * 10)"
:key="c.id + c.code"
:title="c.name"
style="background: #fff8e8; float: left">
<div
class="dashboard-layout-item-cricle"
:style="{
background: bgColor[c.type - 1],
}" />
<p class="p-name">{{ c.name }}</p>
</div>
</el-row>
<el-row type="flex" class="flex-warp">
<div
class="dashboard-layout-item"
v-for="d in wareData.four.slice((i - 1) * 10, i * 10)"
:key="d.id + d.code"
:title="d.name"
style="background: #fff8e8; float: left">
<div
class="dashboard-layout-item-cricle"
:style="{
background: bgColor[d.type - 1],
}" />
<p class="p-name">{{ d.name }}</p>
</div>
</el-row>
</el-col>
</el-row>
</div>
</div>
</div>
</template>
<script>
import { listByWarehouse, listAll } from '@/api/warehouse/warehouseLocation';
export default {
data() {
return {
wareData: {
one: [],
two: [],
there: [],
four: [],
},
total: 0,
bgColor: ['#7362F3', '#16DC09', '#FFA08F'],
formConfig: [
{
type: 'button',
btnName: '刷新',
name: 'search',
color: 'primary',
},
],
};
},
components: {},
mounted() {
this.getDataList();
},
methods: {
// 获取数据列表
getDataList() {
(this.wareData = {
one: [],
two: [],
there: [],
four: [],
}),
listAll(1).then((response) => {
response.data.forEach((a, b) => {
if (b % 4 === 0) {
this.wareData.one.push(a);
} else if (b % 4 === 1) {
this.wareData.two.push(a);
} else if (b % 4 === 2) {
this.wareData.there.push(a);
} else if (b % 4 === 3) {
this.wareData.four.push(a);
}
});
this.total = Math.ceil(response.data.length / 40);
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>
<style lang="scss" scoped>
.mainbody {
display: flex;
gap: 70px;
flex-direction: column;
}
.flex-warp {
flex-wrap: nowrap;
}
.dashboard-layout-item {
width: 100px;
text-align: center;
height: 32px;
box-shadow: 0px 3px 6px 0px rgba(166, 174, 190, 0.8);
border-radius: 2px 4px 4px 2px;
margin: 0 3px 8px 0;
display: flex;
align-items: center;
justify-content: center;
position: relative;
.dashboard-layout-item-cricle {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 6px;
position: absolute;
top: 10px;
left: 3px;
}
.p-name {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-left: 15px;
}
&:hover {
cursor: pointer;
z-index: 10;
transform: scale(1.3) translateZ(0);
}
&:nth-child(2n) {
margin-right: 30px;
}
&:first-child {
margin-left: 50px;
}
&:last-child {
margin-right: 30px;
}
}
.el-divider--horizontal {
margin: 10px 0;
}
.el-divider {
background-color: black;
}
.tips {
position: absolute;
top: 22px;
right: 120px;
}
</style>

View File

@@ -0,0 +1,202 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2023-11-04 16:32:54
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="仓库名称" prop="warehouseName">
<el-input
v-model="dataForm.warehouseName"
readonly
placeholder="请输入仓库名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品名称" prop="goodsId">
<el-select
v-model="dataForm.goodsId"
filterable
clearable
:disabled="dataForm.id ? true : false"
:style="{ width: '100%' }"
@change="setGoodInfo"
placeholder="请选择物品名称">
<el-option
v-for="item in goodsArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品编码" prop="code">
<el-input
v-model="dataForm.code"
readonly
placeholder="请输入物品编码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品规格" prop="spec">
<el-input
v-model="dataForm.spec"
readonly
placeholder="请输入物品规格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物品批次" prop="goodsBatch">
<el-input
v-if="!dataForm.id ? true : false"
v-model="dataForm.goodsBatch"
clearable
placeholder="请输入物品批次" />
<el-select
v-else
v-model="dataForm.goodsBatch"
filterable
clearable
@change="setBatchInfo"
placeholder="请选择物品名称">
<el-option
v-for="(item, index) in Batch"
:key="index"
:label="item.goodsBatch"
:value="item.goodsBatch"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入库数量" prop="numDet">
<el-input-number
v-model="dataForm.numDet"
clearable
:min="0"
:max="max?max:9999999"
placeholder="请输入入库数量" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../mixins/basic-add';
import {
createWarehouseRealtime,
outWarehouseRealtime,
getWarehouseRealtime,
getWarehouseRealtimeDet,
} from '@/api/warehouse/warehouseRealtime';
import { getListByType } from '@/api/warehouse/warehouseGoods';
import { getWarehouseList } from '@/api/warehouse/warehouse-info';
import { mapGetters } from 'vuex';
export default {
mixins: [basicAdd],
computed: {
...mapGetters(['nickname']),
},
data() {
return {
urlOptions: {
getOption: true,
createURL: createWarehouseRealtime,
updateURL: outWarehouseRealtime,
infoURL: getWarehouseRealtime,
},
dataForm: {
id: undefined,
warehouseName: '',
warehouseId: '',
goodsId: '',
code: '',
spec: '',
goodsBatch: '',
numDet: '',
operator: '',
},
goodsArr: [],
Batch: [],
max: 0,
dataRule: {
goodsId: [
{ required: true, message: '物品名称不能为空', trigger: 'change' },
],
goodsBatch: [
{
required: true,
message: '物品批次不能为空,若无请填写无',
trigger: 'blur',
},
],
numDet: [
{ required: true, message: '入库数量不能为空', trigger: 'blur' },
],
},
};
},
created() {},
methods: {
getArr() {
this.dataForm.operator = this.nickname
getListByType(2).then((response) => {
this.goodsArr = response.data;
});
getWarehouseList().then((response) => {
response.data.forEach((item) => {
if (item.storageType === 2) {
this.dataForm.warehouseName = item.name;
this.dataForm.warehouseId = item.id;
}
});
});
},
setGoodInfo() {
this.goodsArr.forEach((item) => {
if (item.id === this.dataForm.goodsId) {
this.dataForm.code = item.code;
this.dataForm.spec = item.spec;
}
});
},
setBatchInfo(){
this.Batch.forEach((item) => {
if (item.goodsBatch === this.dataForm.goodsBatch) {
this.max = item.numDet
}
});
},
outWare(data) {
this.getArr();
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm.realTimeId = data.id;
this.dataForm.id = data.id;
this.dataForm.goodsId = data.goodsId;
this.dataForm.code = data.code;
this.dataForm.spec = data.spec;
getWarehouseRealtimeDet(data.id).then((res) => {
this.Batch = res.data;
});
// this.urlOptions.infoURL(data.id).then((response) => {
// this.dataForm = response.data;
// });
});
},
},
};
</script>

View File

@@ -0,0 +1,193 @@
<!--
* @Author: zwq
* @Date: 2023-11-03 16:37:06
* @LastEditors: zwq
* @LastEditTime: 2023-11-04 16:33:02
* @Description:
-->
<template>
<div class="app-container">
<search-bar
:isFold="true"
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-table
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
border
v-loading="dataListLoading"
style="width: 100%"
ref="dataList">
<el-table-column type="expand">
<template slot-scope="scope">
<product :warehouse-id="scope.row.id"></product>
</template>
</el-table-column>
<el-table-column prop="warehouseName" label="仓库名称" />
<el-table-column prop="name" label="物品名称" />
<el-table-column prop="code" label="物品编码" />
<el-table-column prop="spec" label="物品规格" />
<el-table-column prop="num" label="数量" />
<el-table-column prop="operator" label="操作人" />
<el-table-column prop="latestInTime" label="最新入库时间">
<template v-slot="scope">
<span>{{ parseTime(scope.row.latestInTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="latestOutTime" label="最新出库时间">
<template v-slot="scope">
<span>{{ parseTime(scope.row.latestOutTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="scope">
<el-button
size="mini"
type="text"
@click="handleClick({ data: scope.row, type: 'out' })"
v-hasPermi="['end-material:warehouse-realtime:update']">
出库
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import product from './product-mini';
import basicPage from '../../mixins/basic-page';
import { getListByType } from '@/api/warehouse/warehouseGoods';
import AddOrUpdate from './add-or-updata';
import { getWarehouseRealtimePage } from '@/api/warehouse/warehouseRealtime';
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimePage,
},
tableData: [],
listQuery: {
storageType: 2,
},
formConfig: [
{
type: 'select',
label: '物品名称',
selectOptions: [],
param: 'goodsId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '操作人',
placeholder: '操作人',
param: 'operator',
},
{
type: 'datePicker',
label: '最新入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'datePicker',
label: '最新出库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime1',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('end-material:warehouse-realtime:create') ? 'button' : '',
btnName: '入库',
name: 'add',
color: 'success',
plain: true,
},
],
};
},
components: {
product,
AddOrUpdate,
},
created() {
getListByType(this.listQuery.storageType).then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.goodsId = val.goodsId;
this.listQuery.operator = val.operator;
this.listQuery.latestInTime = val.searchTime?val.searchTime:null;
this.listQuery.latestOutTime = val.searchTime1?val.searchTime1:null;
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '入库';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
default:
console.log(val);
}
},
otherMethods(val){
this.addOrUpdateVisible = true;
this.addOrEditTitle = "出库";
this.$nextTick(() => {
this.$refs.addOrUpdate.outWare(val.data);
});
}
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>

View File

@@ -0,0 +1,71 @@
<!--
* @Author: zwq
* @Date: 2023-08-24 14:47:58
* @LastEditors: zwq
* @LastEditTime: 2023-11-04 10:31:56
* @Description:
-->
<template>
<div>
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
max-height="200"
:table-data="tableData" />
</div>
</template>
<script>
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseRealtimeDet } from '@/api/warehouse/warehouseRealtime';
const tableProps = [
{
prop: 'goodsBatch',
label: '产品批次',
},
{
prop: 'numDet',
label: '批次数量',
},
{
prop: 'createTime',
label: '入库时间',
filter: parseTime,
},
];
export default {
props: {
warehouseId: {
type: String,
default: '',
},
},
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeDet
},
tableProps,
tableData: [],
dataListLoading: false,
};
},
components: {
},
created() {},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.warehouseId).then(response => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// 取值范围: xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@@ -0,0 +1,93 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2023-11-03 14:51:33
* @Description:
-->
<template>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:height="300"
:table-data="tableData" />
</template>
<script>
import { parseTime } from '../../mixins/code-filter';
import { getWarehouseRealtimeLocation } from '@/api/warehouse/warehouseRealtimeLocation';
const tableProps = [
{
prop: 'name',
label: '物品名称',
align: 'center',
},
{
prop: 'code',
label: '物品编码',
align: 'center',
},
{
prop: 'spec',
label: '物品规格',
align: 'center',
},
{
prop: 'goodsBatch',
label: '物品批次',
align: 'center',
},
{
prop: 'num',
label: '数量',
align: 'center',
},
{
prop: 'allowTime',
label: '允许留存时长(天)',
align: 'center',
},
{
prop: 'inTime',
label: '入库时间',
align: 'center',
filter: parseTime,
},
{
prop: 'leftTime',
label: '剩余留存时长(天)',
align: 'center',
},
{
prop: 'remark',
label: '备注',
align: 'center',
},
];
export default {
data() {
return {
tableData: [],
tableProps,
listQuery: {
pageSize: 100,
pageNo: 1,
total: 1,
},
dataListLoading: false,
};
},
methods: {
// 获取数据列表
init(id) {
this.dataListLoading = true;
getWarehouseRealtimeLocation(id).then((response) => {
this.tableData = response.data;
this.dataListLoading = false;
});
},
},
};
</script>

View File

@@ -0,0 +1,122 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'35%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
新增产品
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="产品" prop="productInfo">
<el-select
v-model="dataForm.productInfo"
style="width: 100%"
filterable
value-key="id"
placeholder="请选择产品">
<el-option
v-for="item in productArr"
:key="item.id"
:label="item.name"
:value="item" />
</el-select>
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
getListByType
} from "@/api/warehouse/warehouseGoods";
export default {
data() {
return {
visible: false,
dataForm: {
index: -1,
productInfo: '',
},
productArr: [],
dataRule: {
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(index) {
if (index >= 0) {
this.dataForm.index = index;
}
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
getListByType(2).then((response) => {
this.productArr = response.data;
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.dataForm.productInfo.goodsId = this.dataForm.productInfo.id
this.dataForm.productInfo.remark = ''
// 修改的提交
if (this.dataForm.index >= 0) {
this.visible = false;
this.$emit('refreshDataList', this.dataForm);
return;
}
// 添加的提交
this.visible = false;
this.$emit('refreshDataList', this.dataForm);
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@@ -0,0 +1,317 @@
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:destroy-on-close="true"
:wrapper-closable="false"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">库位信息</small-title>
<div class="content">
<div class="visual-part">
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
label-position="top"
@keyup.enter.native="dataFormSubmit">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="库位名称" prop="name">
<el-input
v-model="dataForm.name"
disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="托盘编码" prop="palletCode">
<el-input
v-model="dataForm.palletCode"
@input="$forceUpdate()"
placeholder="请输入托盘编码" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
产品信息
<!-- <el-alert
title="产品信息新增和修改后,需点击最下方保存按钮确定修改"
type="warning"
show-icon></el-alert> -->
</small-title>
<div class="attr-list">
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:add-button-show="addButtonShow"
@emitButtonClick="addNew"
@emitFun="inputChange"
:height="400"
:table-data="productAttributeList">
<method-btn
slot="handleBtn"
:width="70"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
</div>
</div>
<div style="position: absolute; bottom: 24px; right: 24px">
<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
<span>
<el-button type="primary" @click="dataFormSubmit()">入库</el-button>
</span>
</div>
<product-attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="addList" />
</el-drawer>
</template>
<script>
import productAttrAdd from './attr-add';
import inputArea from '../../mixins/inputArea';
import SmallTitle from './SmallTitle';
import { inWarehouseRealtimeLocation,
getWarehouseRealtimeLocation } from '@/api/warehouse/warehouseRealtimeLocation';
const tableBtn = [
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'name',
label: '物品名称',
align: 'center',
},
{
prop: 'code',
label: '物品编码',
align: 'center',
},
{
prop: 'spec',
label: '物品规格',
align: 'center',
},
{
prop: 'goodsBatch',
label: '物品批次',
align: 'center',
subcomponent: inputArea,
width: 100,
},
{
prop: 'num',
label: '数量',
align: 'center',
subcomponent: inputArea,
width: 100,
},
{
prop: 'remark',
label: '备注',
align: 'center',
subcomponent: inputArea,
width: 100,
},
];
export default {
components: { productAttrAdd, SmallTitle },
data() {
return {
visible: false,
addOrUpdateVisible: false,
tableBtn,
tableProps,
productAttributeList: [],
addButtonShow: '新增',
operator: '',
dataForm: {
id: null,
name: '',
palletCode: '',
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataRule: {
// palletCode: [
// {
// required: true,
// message: '托盘编码不能为空',
// trigger: 'blur',
// },
// ],
},
};
},
methods: {
initData() {
this.productAttributeList.splice(0);
},
init(val,nickname) {
this.operator = nickname
this.dataForm.id = val.id;
this.dataForm.name = val.name;
this.dataForm.palletCode = val.palletCode;
this.initData();
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
// 获取产品详情
// 获取产品的属性列表
this.getList();
}
});
},
getList() {
// 获取产品的属性列表
getWarehouseRealtimeLocation(this.dataForm.id).then((response) => {
this.productAttributeList = response.data;
});
},
inputChange(data) {
switch (data.sType) {
case 1:
this.productAttributeList[data._pageIndex - 1][data.prop] =
data[data.prop];
break;
case 2:
this.productAttributeList[data._pageIndex - 1][data.prop] =
data.string ? data.string.split('+')[0] : '';
this.productAttributeList[data._pageIndex - 1][data.prop + 'Name'] =
data.string ? data.string.split('+')[1] : '';
break;
default:
console.log(val);
}
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
this.productAttributeList.splice(raw.data._pageIndex - 1, 1);
})
.catch(() => {});
} else {
this.addNew(raw.data._pageIndex);
}
},
// 表单提交
dataFormSubmit() {
this.productAttributeList.forEach((item) => {
item.id = '';
});
const data = {
realtimeLocationId : this.dataForm.id,
palletCode : this.dataForm.palletCode,
operator : this.operator,
goodsInfos: this.productAttributeList
}
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// 修改的提交
if (this.dataForm.id) {
inWarehouseRealtimeLocation(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
}
});
},
// 新增 / 修改
addNew(index) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(index);
});
},
addList(data) {
this.productAttributeList.push(data.productInfo);
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
this.initData();
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-form-item {
margin: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 10px;
}
.drawer >>> .content {
padding: 0 24px 30px;
display: flex;
flex-direction: column;
height: 100%;
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
</style>

View File

@@ -0,0 +1,279 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:isFold="true"
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="100"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<drawer
v-if="drawerVisible"
ref="drawerRef"
@refreshDataList="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<slot name="footer">
<el-row slot="footer" type="flex" justify="end">
<el-col :span="24">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
取消
</el-button>
</el-col>
</el-row>
</slot>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import Drawer from './drawer';
import basicPage from '../../mixins/basic-page';
import { parseTime } from '../../mixins/code-filter';
import {
getWarehouseRealtimeLocationPage,
outWarehouseRealtimeLocation,
} from '@/api/warehouse/warehouseRealtimeLocation';
import { listByWarehouse } from '@/api/warehouse/warehouseLocation';
import { listData } from '@/api/system/dict/data';
import { publicFormatter } from '@/utils/dict';
import { mapGetters } from 'vuex';
const tableProps = [
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'name',
label: '库位名称',
},
{
prop: 'code',
label: '库位编码',
},
{
prop: 'type',
label: '库位类型',
filter: publicFormatter('location_type'),
},
{
prop: 'status',
label: '库位状态',
filter: publicFormatter('AreaDetStatus'),
},
{
prop: 'palletCode',
label: '托盘编码',
},
{
prop: 'inTime',
label: '入库时间',
filter: parseTime,
minWidth: 150,
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage],
computed: {
...mapGetters(['nickname']),
},
data() {
return {
urlOptions: {
getDataListURL: getWarehouseRealtimeLocationPage,
outURL: outWarehouseRealtimeLocation,
},
listQuery: {
storageType: 2,
},
tableData: [],
tableProps,
tableBtn: [
this.$auth.hasPermi(`end-material:warehouse-realtime-location:query`)
? {
type: 'info',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`end-material:warehouse-realtime-location:query`)
? {
type: 'out',
btnName: '出库',
}
: undefined,
this.$auth.hasPermi(`end-material:warehouse-realtime-location:query`)
? {
type: 'in',
btnName: '入库',
}
: undefined,
].filter((v) => v),
drawerVisible: false,
formConfig: [
{
type: 'select',
label: '库位名',
selectOptions: [],
param: 'name',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '托盘编码',
placeholder: '托盘编码',
param: 'code',
},
{
type: 'select',
label: '库位状态',
selectOptions: [],
param: 'status',
defaultSelect: '',
filterable: true,
labelField: 'label',
valueField: 'value',
},
{
type: 'datePicker',
label: '入库时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "timestamp",
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
],
};
},
components: {
AddOrUpdate,
Drawer,
},
created() {
const queryParams = {
pageNo: 1,
pageSize: 99,
dictType: 'AreaDetStatus',
};
listData(queryParams).then((response) => {
this.formConfig[2].selectOptions = response.data.list;
});
listByWarehouse(this.listQuery.storageType).then((response) => {
this.formConfig[0].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.locationId = val.name;
this.listQuery.palletCode = val.code;
this.listQuery.status = val.status;
this.listQuery.inTime = val.searchTime?val.searchTime:null;
this.getDataList();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'out') {
this.$confirm(
`确定对${'[名称=' + val.data.name + ']'}执行出库操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
const data = {
realtimeLocationId: val.data.id,
operator: this.nickname,
};
this.urlOptions.outURL(data).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => {});
} else if (val.type === 'in') {
this.drawerVisible = true;
this.$nextTick(() => {
this.$refs.drawerRef.init(val.data, this.nickname);
});
} else if (val.type === 'info') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = val.data.name + ' -产品信息';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
handleCancel() {
this.addOrUpdateVisible = false;
this.addOrEditTitle = '';
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>