1.同步库存预警设置代码
parent
cfe6ad73e7
commit
f7bcb8cc85
@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="formData" label-width="200px" style="margin-bottom: -15px">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="仓库:">
|
||||
<el-input v-model="formData.invName" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="货位:">
|
||||
<el-input v-model="formData.invSpaceName" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="产品名称:">
|
||||
<el-input v-model="formData.productName" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="规格型号:">
|
||||
<el-input v-model="formData.ggxh" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="低库存预警数量:">
|
||||
<el-input v-model="formData.lowStockNum" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="库存积压预警数量:">
|
||||
<el-input v-model="formData.overStockNum" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="近效期预警时间:">
|
||||
<el-input v-model="formData.recentDateTime" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="近效期预警时间单位:">
|
||||
<el-input v-show="formData.isDateBy == 1" value="天" disabled></el-input>
|
||||
<el-input v-show="formData.isDateBy == 2" value="小时" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider></el-divider>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启低库存预警">
|
||||
<el-select v-model="formData.lowStock">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启负库存预警">
|
||||
<el-select v-model="formData.lackStock">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启库存积压预警">
|
||||
<el-select v-model="formData.overStock">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启产品过期预警">
|
||||
<el-select v-model="formData.expireDate">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启近效期预警">
|
||||
<el-select v-model="formData.recentDate">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click.native="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click.native="addInvRemindSet()" :loading="formLoading"
|
||||
>提交
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getInfoByInvId, saveInvRemindSet} from "@/api/system/invRemindSet";
|
||||
|
||||
export default {
|
||||
name: "addInvRemindSetDialog",
|
||||
props: {
|
||||
invId: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
closeDialog: {
|
||||
type: Function,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
relId: null,
|
||||
ggxh: null,
|
||||
deptCode: null,
|
||||
invCode: null,
|
||||
invSpaceCode: null,
|
||||
lowStock: false,
|
||||
lackStock: false,
|
||||
overStock: false,
|
||||
expireDate: false,
|
||||
recentDate: false,
|
||||
lowStockNum: null,
|
||||
overStockNum: null,
|
||||
recentDateTime: null,
|
||||
isDateBy: null,
|
||||
invName: null,
|
||||
invSpaceName: null,
|
||||
productName: null
|
||||
},
|
||||
formLoading: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getRemindSetInfo() {
|
||||
getInfoByInvId({invId: this.invId}).then((res) => {
|
||||
if (res.code === 20000) {
|
||||
this.formData = res.data;
|
||||
this.formData.lowStock = false;
|
||||
this.formData.lackStock = false;
|
||||
this.formData.overStock = false;
|
||||
this.formData.expireDate = false;
|
||||
this.formData.recentDate = false;
|
||||
} else {
|
||||
this.$message.error(res.meesage);
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$message.error(error.message);
|
||||
})
|
||||
},
|
||||
addInvRemindSet() {
|
||||
if (!this.formData.lowStock && !this.formData.lackStock && !this.formData.overStock && !this.formData.expireDate && !this.formData.recentDate) {
|
||||
this.$message.warning("至少开启一项预警!");
|
||||
return;
|
||||
}
|
||||
saveInvRemindSet(this.formData, "add").then((res) => {
|
||||
if (res.code === 20000) {
|
||||
this.closeDialog();
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$message.error(error.message);
|
||||
this.closeDialog();
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
document.body.ondrop = function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getRemindSetInfo();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style type="text/scss" lang="scss">
|
||||
</style>
|
||||
|
@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="formData" label-width="200px">
|
||||
<el-card>
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启低库存预警">
|
||||
<el-select v-model="formData.lowStock">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启负库存预警">
|
||||
<el-select v-model="formData.lackStock">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启库存积压预警">
|
||||
<el-select v-model="formData.overStock">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启产品过期预警">
|
||||
<el-select v-model="formData.expireDate">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-form-item class="query-form-item" label="是否开启近效期预警">
|
||||
<el-select v-model="formData.recentDate">
|
||||
<el-option :value="true" label="开启"></el-option>
|
||||
<el-option :value="false" label="关闭"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
|
||||
<el-divider></el-divider>
|
||||
|
||||
<el-form v-model="productQuery" label-width="100px" v-show="showSearch">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item class="query-form-item" label="仓库名称:">
|
||||
<el-select v-model="productQuery.invCode" placeholder="请选择所属仓库"
|
||||
@change="invChange"
|
||||
style="width: 90%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in invList"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.code">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item class="query-form-item" label="货位名称:">
|
||||
<el-select v-model="productQuery.invSpaceCode" placeholder="请选择货位"
|
||||
@change="invSpaceChange"
|
||||
clearable
|
||||
style="width: 90%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in spaceList"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.code">
|
||||
<span style="float: left">{{ item.name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item class="query-form-item" label="物资名称:">
|
||||
<el-input v-model="productQuery.cpmctymc" clearable style="width: 90%"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item class="query-form-item" label="产品DI:">
|
||||
<el-input v-model="productQuery.nameCode" clearable style="width: 90%"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item class="query-form-item" label="供应商名称:">
|
||||
<el-input v-model="productQuery.supName" clearable style="width: 90%"></el-input>
|
||||
</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" @click.native="queryProductList" icon="el-icon-search">搜索</el-button>
|
||||
<el-button type="primary" @click.native="formSubmit" icon="el-icon-check">选入</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" :data="productList" style="width: 100%" border ref="multipleTable"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column type="index" label="序号" width="50"></el-table-column>
|
||||
<el-table-column label="物资名称" prop="cpmctymc" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="规格型号" prop="ggxh" width="200" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="仓库名称" prop="invName" width="200"></el-table-column>
|
||||
<el-table-column label="供应商名称" prop="supName" width="200" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="生产企业" prop="ylqxzcrbarmc" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column label="注册备案号" prop="zczbhhzbapzbh" show-overflow-tooltip></el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="productTotal>0"
|
||||
:total="productTotal"
|
||||
:page.sync="productQuery.page"
|
||||
:limit.sync="productQuery.limit"
|
||||
@pagination="getInvProductList"
|
||||
/>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getInvListByUser} from "@/api/system/invWarehouse";
|
||||
import {getInvSpaceList} from "@/api/inventory/invSpace";
|
||||
import {isBlank} from "@/utils/strUtil";
|
||||
import {batchAddInvRemindSet} from "@/api/system/invRemindSet";
|
||||
import {getInvProduct} from "@/api/inventory/invPorduct";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
closeDialog: {
|
||||
type: Function,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
name: "addInvRemindSetDialog",
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
deptCode: this.$store.getters.locDeptCode,
|
||||
invCode: this.$store.getters.locInvCode,
|
||||
invSpaceCode: null,
|
||||
lowStock: false,
|
||||
lackStock: false,
|
||||
overStock: false,
|
||||
expireDate: false,
|
||||
recentDate: false
|
||||
},
|
||||
invList: [],
|
||||
spaceList: [],
|
||||
productList: [],
|
||||
formLoading: false,
|
||||
productVisible: false,
|
||||
loading: false,
|
||||
productQuery: {
|
||||
invCode: this.$store.getters.locInvCode,
|
||||
invSpaceCode: null,
|
||||
cpmctymc: null,
|
||||
nameCode: null,
|
||||
page: 1,
|
||||
limit: 10
|
||||
},
|
||||
productTotal: 0,
|
||||
multipleSelection: [],
|
||||
showSearch: true
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
hideSearch() {
|
||||
this.showSearch = !this.showSearch;
|
||||
},
|
||||
invChange() {
|
||||
this.multipleSelection = [];
|
||||
this.spaceList = [];
|
||||
this.formData.invSpaceCode = null;
|
||||
this.formData.relId = null;
|
||||
this.formData.ggxh = null;
|
||||
this.getInvProductList();
|
||||
this.getSpaceList();
|
||||
},
|
||||
getInvList() {
|
||||
getInvListByUser()
|
||||
.then((response) => {
|
||||
this.invList = response.data || [];
|
||||
this.getSpaceList();
|
||||
this.getInvProductList();
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
getSpaceList() {
|
||||
let params = {invWarehouseCode: this.formData.invCode, status: 1};
|
||||
getInvSpaceList(params).then((res) => {
|
||||
this.spaceList = res.data.list || [];
|
||||
})
|
||||
},
|
||||
invSpaceChange() {
|
||||
this.multipleSelection = [];
|
||||
},
|
||||
formSubmit() {
|
||||
let message = this.verifyFormData();
|
||||
if (message !== "success") {
|
||||
this.$message.error(message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let relIdList = [];
|
||||
if (this.multipleSelection.length > 0) {
|
||||
this.multipleSelection.forEach((item) => {
|
||||
relIdList.push(item.relIdFk);
|
||||
});
|
||||
} else {
|
||||
this.$message.error("请选择需要预警的产品");
|
||||
return;
|
||||
}
|
||||
|
||||
//添加预警设置
|
||||
let params = {
|
||||
lowStock: this.formData.lowStock,
|
||||
lackStock: this.formData.lackStock,
|
||||
overStock: this.formData.overStock,
|
||||
expireDate: this.formData.expireDate,
|
||||
recentDate: this.formData.recentDate,
|
||||
deptCode: this.formData.deptCode,
|
||||
invCode: this.formData.invCode,
|
||||
invSpaceCode: this.formData.invSpaceCode,
|
||||
relIdList: relIdList
|
||||
};
|
||||
batchAddInvRemindSet(params).then((res) => {
|
||||
if (res.code === 20000) {
|
||||
this.$message.success("添加成功");
|
||||
this.closeDialog();
|
||||
} else {
|
||||
this.$message.error(res.message);
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$message.error(error.message);
|
||||
this.closeDialog();
|
||||
})
|
||||
},
|
||||
verifyFormData() {
|
||||
if (isBlank(this.formData.invCode)) {
|
||||
return "请选择预警仓库";
|
||||
}
|
||||
if (this.formData.lowStock === false && this.formData.lackStock === false && this.formData.overStock === false && this.formData.expireDate === false && this.formData.recentDate === false) {
|
||||
return "至少开启一项预警";
|
||||
}
|
||||
return "success";
|
||||
},
|
||||
selectProduct() {
|
||||
this.productVisible = true;
|
||||
this.getInvProductList();
|
||||
this.productQuery = {
|
||||
invCode: this.formData.invCode,
|
||||
invSpaceCode: this.formData.invSpaceCode,
|
||||
page: 1,
|
||||
limit: 10
|
||||
};
|
||||
this.productTotal = 0;
|
||||
},
|
||||
getInvProductList() {
|
||||
getInvProduct(this.productQuery).then((res) => {
|
||||
if (res.code === 20000) {
|
||||
this.productList = res.data.list || [];
|
||||
this.productTotal = res.data.total || 0;
|
||||
} else {
|
||||
this.productList = [];
|
||||
this.productTotal = 0;
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$message.error(error.message);
|
||||
this.productList = [];
|
||||
this.productTotal = 0;
|
||||
})
|
||||
},
|
||||
onReset() {
|
||||
this.productQuery = {
|
||||
invCode: this.formData.invCode,
|
||||
invSpaceCode: this.formData.invSpaceCode,
|
||||
cpmctymc: null,
|
||||
nameCode: null,
|
||||
page: 1,
|
||||
limit: 10
|
||||
};
|
||||
this.productTotal = 0;
|
||||
this.productList = [];
|
||||
this.getInvProductList()
|
||||
},
|
||||
queryProductList() {
|
||||
this.getInvProductList();
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getInvList();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style type="text/scss" lang="scss">
|
||||
.el-radio {
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue