库存对比

20231126-yw
wj 1 year ago
parent 4399e5a71d
commit 267bd274ff

@ -0,0 +1,56 @@
import axios from "@/utils/request";
export function stockComparePage(params) {
return axios({
url: "/udiwms/stockCompare/page",
method: "POST",
data: params
});
}
export function selectInvProductDetail(params) {
return axios({
url: "/udiwms/stockCompare/selectInvProductDetail",
method: "POST",
data: params
});
}
export function stockCompareSave(params) {
return axios({
url: "/udiwms/stockCompare/save",
method: "POST",
data: params
});
}
export function stockCompareDelete(compareId) {
return axios({
url: `/udiwms/stockCompare/delete/${compareId}`,
method: "DELETE",
});
}
export function stockCompareAddProduct(params) {
return axios({
url: "/udiwms/stockCompare/addProduct",
method: "POST",
data: params
});
}
export function stockCompareDetailPage(params) {
return axios({
url: "/udiwms/stockCompare/detail/page",
method: "POST",
data: params
});
}
export function stockCompareDetailDel(params) {
return axios({
url: "/udiwms/stockCompare/detail/del",
method: "DELETE",
data: params
});
}

@ -0,0 +1,310 @@
import {
selectInvProductDetail, stockCompareAddProduct,
stockCompareDelete, stockCompareDetailDel, stockCompareDetailPage,
stockComparePage,
stockCompareSave
} from "@/api/inventory/stockCompareApi";
import {mainActionMap, stockCompareStatusEnum} from "@/utils/data";
import data from "@/views/system/dict/data.vue";
let filterQuery = {
page: 1,
limit: 10,
id: null,
thrSysId: null,
invCode: null,
mainAction: null,
action: null,
remark: null,
status: null,
}
let param = {
thrSysId: null,
invCode: null,
action: null,
mainAction: '',
compareDate: [],
compareStartDate: '',
compareEndDate: '',
remark: null,
}
let selectProductQuery = {
page: 1, limit: 10, compareId: null
}
export default {
computed: {
stockCompareStatusEnum() {
return stockCompareStatusEnum
},
data() {
return data
},
mainActionMap() {
return mainActionMap
}
},
data() {
return {
showSearch: true,
compareId: null,
editRow: null,
saveLoading: false,
showDialog: false,
loading: false,
stockCompareDetailLoading: false,
stockCompareDetailList: [],
stockCompareDetailTotal: 0,
stockCompareDetailQuery: {
page: 1,
limit: 10
},
// --------选入产品--------------
showAddProductDialog: false,
productLoading: false,
productList: [],
checkProductList: [],
productTotal: 0,
// ---------------------------
filterQuery: {...filterQuery},
list: [],
total: 0,
param: {...param},
selectProductQuery: {...selectProductQuery},
paramRules: {
thrSysId: [{required: true, message: '第三方系统不能为空', trigger: 'change'}],
invCode: [{required: true, message: '所属仓库不能为空', trigger: 'change'}],
compareDate: [{required: true, message: '对比时间不能为空', trigger: 'change'}],
remark: [{required: true, message: '备注描述不能为空', trigger: 'blur'}],
},
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
let now = new Date();
const end = new Date(now - 24 * 60 * 60 * 1000);
const start = new Date(now - 24 * 60 * 60 * 1000);
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
let now = new Date();
const end = new Date(now - 24 * 60 * 60 * 1000);
const start = new Date(now - 24 * 60 * 60 * 1000);
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
let now = new Date();
const end = new Date(now - 24 * 60 * 60 * 1000);
const start = new Date(now - 24 * 60 * 60 * 1000);
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}],
disabledDate(time) {
const now = new Date();
const oneDayAgo = new Date(now - 24 * 60 * 60 * 1000);
return time.getTime() >= oneDayAgo;
},
firstDayOfWeek: 1
},
}
},
created() {
this.getList()
},
methods: {
checkProduct(isAll) {
let param = {
compareId: this.compareId,
isAll: isAll,
productIds: this.checkProductList
}
stockCompareAddProduct(param).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.showAddProductDialog = false
this.stockCompareDetailQuery.page = 1
this.getStockCompareDetailList()
})
},
addProductSelectionChange(row) {
this.checkProductList = row.map(i => {
return {productId: i.productId}
})
},
//触发对比
compareFunc() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
setTimeout(() => {
loading.close();
}, 2000);
},
showAddProduct() {
this.selectProductQuery = {...selectProductQuery, compareId: this.compareId}
this.productList = []
this.checkProductList = []
this.productTotal = 0
this.showAddProductDialog = true
this.selectInvProductDetailList()
},
getStockCompareDetailList() {
this.stockCompareDetailQuery.compareId = this.compareId
this.stockCompareDetailLoading = true
stockCompareDetailPage(this.stockCompareDetailQuery).then(res => {
this.stockCompareDetailLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.stockCompareDetailList = res.data.list || []
this.stockCompareDetailTotal = res.data.total || 0
}).catch(e => {
this.stockCompareDetailLoading = false
})
},
selectInvProductDetailList() {
this.productLoading = true
selectInvProductDetail(this.selectProductQuery).then(res => {
this.productLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.productList = res.data.list || []
this.productTotal = res.data.total || 0
}).catch(e => {
this.productLoading = false
})
},
saveStockCompare() {
this.saveLoading = true
this.$refs.stockCompare.validate(valid => {
if (valid) {
this.param.compareStartDate = this.param.compareDate[0]
this.param.compareEndDate = this.param.compareDate[1]
stockCompareSave(this.param).then(res => {
this.saveLoading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.stockCompareDetailList = []
this.stockCompareDetailTotal = 0
this.compareId = res.data
this.editRow = {status: stockCompareStatusEnum.DRAFT.key}
}).catch(e => {
this.saveLoading = false
})
}
this.saveLoading = false
})
},
removeDetail(row) {
this.$confirm("此操作将永久移除该条数据,是否继续", "提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
let param = {
compareId: row.compareId,
productId: row.productId,
mainAction: row.mainAction,
batchNo: row.batchNo
}
stockCompareDetailDel(param).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.$message.success(res.message)
this.stockCompareDetailQuery.page = 1
this.getStockCompareDetailList()
})
})
},
del(row) {
this.$confirm("此操作将永久删除该条数据,是否继续", "提示", {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(res => {
stockCompareDelete(row.id).then(res => {
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.filterQuery.page = 1
this.getList()
})
})
},
edit(row) {
this.compareId = row.id
this.editRow = row
this.saveLoading = false
this.param = {
thrSysId: row.thrSysId,
invCode: row.invCode,
action: row.action,
mainAction: row.mainAction,
compareDate: [row.compareStartDate, row.compareEndDate],
compareStartDate: row.compareStartDate,
compareEndDate: row.compareEndDate,
remark: row.remark
}
this.showDialog = true
this.stockCompareDetailQuery.page = 1
this.stockCompareDetailQuery.limit = 10
this.stockCompareDetailQuery.compareId = this.compareId
this.getStockCompareDetailList()
},
add() {
this.param = {...param}
this.compareId = null
this.editRow = null
this.showDialog = true
this.saveLoading = false
},
hideSearch() {
this.showSearch = !this.showSearch
},
onReset() {
this.showSearch = true
this.filterQuery = {...filterQuery}
},
onSubmit() {
this.filterQuery.page = 1
this.getList()
},
getList() {
this.loading = true
stockComparePage(this.filterQuery).then(res => {
this.loading = false
if (res.code != 20000) {
this.$message.error(res.message)
return
}
this.list = res.data.list || []
this.total = res.data.total || 0
}).catch(res => {
this.loading = false
})
}
}
}

@ -0,0 +1,293 @@
<template>
<div>
<el-card>
<el-form :model="filterQuery" class="query-form" size="mini" label-width="auto" v-show="showSearch">
<el-row>
<el-col :span="6">
<el-form-item class="query-form-item" label="记录号:">
<el-input v-model="filterQuery.id" placeholder="请输入记录号"
style="width: 90%"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="状态:">
<el-select v-model="filterQuery.status" @clear="filterQuery.status=null" placeholder="请选择状态" style="width: 90%" clearable>
<el-option v-for="item in stockCompareStatusEnum" :key="item.key" :label="item.desc" :value="item.key"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="备注描述:">
<el-input v-model="filterQuery.remark" clearable placeholder="请输入备注描述" style="width: 90%"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="第三方系统:">
<thirdSysSelect :value.sync="filterQuery.thrSysId"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="所属仓库:">
<invSelect :value.sync="filterQuery.invCode"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="出入库类型:">
<mainActionSelect :value.sync="filterQuery.mainAction"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="query-form-item" label="单据类型:">
<actionSelect :value.sync="filterQuery.action" :mainAction="filterQuery.mainAction"
:invCode="filterQuery.invCode"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn">
<el-button-group>
<el-button icon="el-icon-view" type="primary" @click="hideSearch">/</el-button>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
>重置
</el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"
>查询
</el-button>
<el-button type="primary" icon="el-icon-plus" @click="add"
>添加
</el-button>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<el-table
v-loading="loading"
:data="list"
style="width: 100%; margin-top: 20px"
highlight-current-row
border
max-height="300"
height="300">
<el-table-column label="序号" width="50" type="index"></el-table-column>
<el-table-column label="记录号" width="160" prop="id"/>
<el-table-column label="备注描述" width="160" prop="remark"/>
<el-table-column label="状态" width="80" prop="statusDesc"/>
<el-table-column label="第三方系统" width="160" prop="thrSysName"/>
<el-table-column label="仓库" width="110" prop="invName"/>
<el-table-column label="对比日期区间" width="170">
<template slot-scope="scope">
{{ scope.row.compareStartDate }} {{ scope.row.compareEndDate }}
</template>
</el-table-column>
<el-table-column label="出入库类型" width="110" prop="mainAction">
<template slot-scope="scope">
{{ mainActionMap[scope.row.mainAction] || '全部' }}
</template>
</el-table-column>
<el-table-column label="单据类型" width="110" prop="actionName">
<template scope="scope">
{{ scope.row.actionName || '未选择' }}
</template>
</el-table-column>
<el-table-column label="创建时间" width="160" prop="createTime"/>
<el-table-column label="对比时间" width="160" prop="compareTime"/>
<el-table-column label="操作人" width="110" prop="createUserName"/>
<el-table-column fixed="right" width="100" label="操作">
<template slot-scope="scope">
<el-button type="text" @click="edit(scope.row)"></el-button>
<el-button type="text" @click="del(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</el-card>
<el-dialog
append-to-body
:title="compareId?'编辑对比':'新增对比'"
:visible="true"
v-if="showDialog"
@close="showDialog = false;filterQuery.page = 1;getList()"
width="60%"
>
<el-card class="dialogCard">
<el-form :model="param" ref="stockCompare" :disabled="compareId" :rules="paramRules" class="query-form"
size="mini" label-width="auto">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item class="query-form-item" prop="thrSysId" label="第三方系统:">
<thirdSysSelect :value.sync="param.thrSysId"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="query-form-item" prop="invCode" label="所属仓库:">
<invSelect :value.sync="param.invCode"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="query-form-item" label="出入库类型:">
<mainActionSelect :value.sync="param.mainAction"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="query-form-item" label="单据类型:">
<actionSelect :value.sync="param.action" :mainAction="param.mainAction" :invCode="param.invCode"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="query-form-item" prop="compareDate" label="对比时间:">
<el-date-picker
style="width: 90%"
v-model="param.compareDate"
type="daterange"
align="right"
unlink-panels
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="query-form-item" label="备注描述:" prop="remark">
<el-input class="w90-percent" type="textarea" v-model="param.remark"
:autosize="{minRows: 2, maxRows: 6}" show-word-limit clearable :maxlength="500"/>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="!compareId">
<el-col align="center">
<el-button @click="saveStockCompare" :loading="saveLoading" type="primary">下一步</el-button>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card v-if="compareId" class="dialogSecCard">
<el-row v-if="editRow&&editRow.status==stockCompareStatusEnum.DRAFT.key">
<el-col align="right">
<el-button icon="el-icon-refresh" @click="stockCompareDetailQuery.page=1;getStockCompareDetailList()">
</el-button>
<el-button type="primary" @click="showAddProduct"></el-button>
<el-button type="primary" @click="compareFunc"></el-button>
</el-col>
</el-row>
<el-row style="margin-top: 10px">
<el-table v-loading="stockCompareDetailLoading"
:data="stockCompareDetailList"
highlight-current-row
max-height="300"
height="300">
<el-table-column label="序号" width="50" type="index"/>
<el-table-column label="最小销售标识" width="110" prop="nameCode"/>
<el-table-column label="产品名称" width="110" prop="productName"/>
<el-table-column label="规格型号" width="110" prop="ggxh"/>
<el-table-column label="出入库类型" width="90" prop="mainAction">
<template scope="scope">
{{ mainActionMap[scope.row.mainAction] }}
</template>
</el-table-column>
<el-table-column label="数量" width="80" prop="count"/>
<el-table-column label="产品描述" width="110" prop="cpms"/>
<el-table-column label="生产厂家" width="110" prop="manufactory"/>
<el-table-column label="医疗器械注册/备案人名称" width="220" prop="ylqxzcrbarmc"/>
<el-table-column label="注册证/备案批准编号" width="220" prop="zczbhhzbapzbh"/>
<el-table-column label="操作" v-if="editRow&&editRow.status==stockCompareStatusEnum.DRAFT.key" width="80"
fixed="right">
<template scope="scope">
<el-button type="text" @click="removeDetail(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="stockCompareDetailTotal>0"
:total="stockCompareDetailTotal"
:limit.sync="stockCompareDetailQuery.limit"
:page.sync="stockCompareDetailQuery.page"
@pagination="getList"
></pagination>
</el-row>
</el-card>
</el-dialog>
<el-dialog
:visible="showAddProductDialog"
v-if="showAddProductDialog"
width="60%"
@close="showAddProductDialog=false"
>
<el-card>
<template slot="header">
<el-row>
<el-col :span="12" align="left">选择产品</el-col>
<el-col :span="12" align="right">
<el-button icon="el-icon-refresh" @click="selectProductQuery.page = 1;selectInvProductDetailList()">刷新
</el-button>
<el-button icon="el-icon-check" type="primary" :disabled="!checkProductList.length"
@click="checkProduct(false)">选中选入
</el-button>
<el-button icon="el-icon-check" type="primary" @click="checkProduct(true)"></el-button>
</el-col>
</el-row>
</template>
<el-table
v-loading="productLoading"
:data="productList"
ref="addProductTable"
style="width: 100%; margin-top: 20px"
@selection-change="addProductSelectionChange"
@row-click="(row)=>{this.$refs.addProductTable.toggleRowSelection(row)}"
max-height="300"
height="300"
>
<el-table-column label="" width="50" type="selection"/>
<!-- <el-table-column label="序号" width="50" type="index"/>-->
<el-table-column label="最小销售标识" width="120" prop="nameCode"/>
<el-table-column label="产品名称" width="120" prop="cpmctymc"/>
<el-table-column label="规格型号" width="120" prop="ggxh"/>
<el-table-column label="出入库类型" width="90" prop="mainAction">
<template slot-scope="scope">
{{ mainActionMap[scope.row.mainAction] }}
</template>
</el-table-column>
<el-table-column label="数量" width="80" prop="count"/>
<el-table-column label="产品描述" width="120" prop="cpms"/>
<el-table-column label="生产厂家" width="110" prop="manufactory"/>
<el-table-column label="医疗器械注册/备案人名称" width="220" prop="ylqxzcrbarmc"/>
<el-table-column label="注册证/备案批准编号" width="220" prop="zczbhhzbapzbh"/>
</el-table>
<pagination
v-show="productTotal>0"
:total="productTotal"
:limit.sync="selectProductQuery.limit"
:page.sync="selectProductQuery.page"
@pagination="selectInvProductDetailList"
></pagination>
</el-card>
</el-dialog>
</div>
</template>
<script src="./stockCompare.js"/>
<style></style>
<style scoped>
.dialogCard {
margin: -30px -5px 0px;
}
.dialogSecCard {
margin: 5px -5px -10px;
}
</style>
Loading…
Cancel
Save