增加导入导出

This commit is contained in:
liux 2026-01-23 18:17:52 +08:00
parent 2fb5341550
commit 03fc862fbd
3 changed files with 134 additions and 127 deletions

View File

@ -78,11 +78,11 @@
:inline="true" :inline="true"
v-show="showSearch" v-show="showSearch"
label-width="68px" label-width="68px"
> >
<el-form-item label="所属区域" prop="areaId"> <el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="queryParams.areaId" <el-cascader v-model="queryParams.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false" :options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{ :props="{
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'label' value:'id',label:'label'
@ -141,40 +141,41 @@
@click="handleBatchDel" @click="handleBatchDel"
>批量删除</el-button> >批量删除</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <el-col :span="1.5">
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url"
:show-file-list="false"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
>
<el-button
type="success"
size="mini"
>批量导入
</el-button>
</el-upload>
</el-col>
<!-- <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
size="mini" plain size="mini" plain
:disabled="multiple" :disabled="multiple"
@click="handleBatchEdit" @click="handleBatchEdit"
>批量修改类别 >批量修改类别
</el-button> </el-button>
</el-col>
<el-col :span="1.5">
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url"
:show-file-list="false"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
>
<el-button
type="success"
size="mini"
>批量导入
</el-button>
</el-upload>
</el-col> </el-col>
<el-col :span="1.5">
<el-col :span="1.5">
<el-button <el-button
size="mini" size="mini"
@click="importTemplate" @click="importTemplate"
>模板下载 >模板下载
</el-button> </el-button>
</el-col> --> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -186,22 +187,22 @@
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span> <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="原料编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" /> <el-table-column label="原料编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="原料名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="原料名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="原料类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" /> <el-table-column label="原料类别" align="center" key="materialTypeName" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="120"/> <el-table-column label="计量单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" /> <el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" />
<!-- <el-table-column label="原料规格" align="center" key="size" prop="size" :show-overflow-tooltip="true" width="100"/> <!-- <el-table-column label="原料规格" align="center" key="size" prop="size" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="原料税率" align="center" key="taxRate" prop="taxRate" :show-overflow-tooltip="true" width="100"> <el-table-column label="原料税率" align="center" key="taxRate" prop="taxRate" :show-overflow-tooltip="true" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.taxRate">{{ scope.row.taxRate }}%</span> <span v-if="scope.row.taxRate">{{ scope.row.taxRate }}%</span>
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="原料进价(元)" align="center" key="unitPrice" prop="unitPrice" :show-overflow-tooltip="true" width="150"> <el-table-column label="原料进价(元)" align="center" key="unitPrice" prop="unitPrice" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span> <span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column label="营养信息名称" align="center" key="nutritionName" prop="nutritionName" :show-overflow-tooltip="true"/> <el-table-column label="营养信息名称" align="center" key="nutritionName" prop="nutritionName" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" width="150"/> --> <!-- <el-table-column label="条码" align="center" key="barCode" prop="barCode" :show-overflow-tooltip="true" width="150"/> -->
@ -249,13 +250,13 @@
<el-form-item label="所属区域" prop="areaId"> <el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="form.areaId" :disabled="isEditType" <el-cascader v-model="form.areaId" :disabled="isEditType"
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false" :options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{ :props="{
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'label' value:'id',label:'label'
}" clearable> }" clearable>
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="原料类别" prop="materialTypeName"> <el-form-item label="原料类别" prop="materialTypeName">
@ -266,8 +267,8 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleSubmit"> </el-button> <el-button type="primary" @click="handleSubmit"> </el-button>
<el-button @click="open=false"> </el-button> <el-button @click="open=false"> </el-button>
@ -278,20 +279,20 @@
<!-- 批量修改原料类别对话框 --> <!-- 批量修改原料类别对话框 -->
<el-dialog title="批量修改原料类别" :visible.sync="openEdit" <el-dialog title="批量修改原料类别" :visible.sync="openEdit"
width="500px" append-to-body :close-on-click-modal="false"> width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="120px"> <el-form ref="editForm" :model="editForm" :rules="editRules" label-width="120px">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="原料名称" prop="materialTypeName"> <el-form-item label="原料名称" prop="materialTypeName">
<el-input v-model="editForm.materialTypeName" placeholder="请输入原料名称" :readonly="true" /> <el-input v-model="editForm.materialTypeName" placeholder="请输入原料名称" :readonly="true" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row> <!-- <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="新类别" prop="categroyId"> <el-form-item label="新类别" prop="categroyId">
<el-cascader v-model="editForm.categroyId" <el-cascader v-model="editForm.categroyId"
:options="treeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false" :options="treeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
:props="{ :props="{
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: true,// checkStrictly: true,//
value:'id',label:'categoryName' value:'id',label:'categoryName'
@ -355,7 +356,7 @@ export default {
pageSize: 10, pageSize: 10,
areaId:null, areaId:null,
materialName:"", materialName:"",
materialCode:"", materialCode:"",
categoryIdList:[] categoryIdList:[]
}, },
// //
@ -371,7 +372,7 @@ export default {
form: { form: {
materialTypeName: "", materialTypeName: "",
parentId: "", parentId: "",
goodsType: "", goodsType: "",
}, },
// //
rules: { rules: {
@ -383,7 +384,7 @@ export default {
}, },
] ]
}, },
parentId: undefined, parentId: undefined,
treeAreaOptions:[],// treeAreaOptions:[],//
batchIds:[], batchIds:[],
multipleSelection:[], multipleSelection:[],
@ -402,13 +403,13 @@ export default {
] ]
}, },
// //
upload: { upload: {
// //
isUploading: false, isUploading: false,
// //
headers: { Authorization: 'Bearer ' + getToken() }, headers: { Authorization: 'Bearer ' + getToken() },
// //
url: process.env.VUE_APP_BASE_API + '/smart-canteen/api/v1/menumaterial/batch/import/material', url: process.env.VUE_APP_BASE_API + '/smart-canteen/ims_order_goods/import/commodity',
}, },
}; };
}, },
@ -436,18 +437,18 @@ export default {
systemMaterialTreeApi(param).then((response) => { systemMaterialTreeApi(param).then((response) => {
this.treeOptions = response.data; this.treeOptions = response.data;
this.addLevel(this.treeOptions) this.addLevel(this.treeOptions)
console.log("this.treeOptions",this.treeOptions) console.log("this.treeOptions",this.treeOptions)
if(this.treeOptions && this.treeOptions.length > 0){ if(this.treeOptions && this.treeOptions.length > 0){
this.getList(); this.getList();
} else { } else {
this.getList(); this.getList();
} }
}); });
}, },
addLevel(nodes, level = 0) { addLevel(nodes, level = 0) {
nodes.forEach(node => { nodes.forEach(node => {
node.level = level; // node.level = level; //
if (node.children) { // if (node.children) { //
this.addLevel(node.children, level + 1); this.addLevel(node.children, level + 1);
} }
}); });
@ -457,19 +458,19 @@ export default {
console.log(data) console.log(data)
// this.handleQuery(); // this.handleQuery();
}, },
handleCheckChange(data, checked, indeterminate) { handleCheckChange(data, checked, indeterminate) {
this.handleQuery(); this.handleQuery();
}, },
/* 树节点增加 */ /* 树节点增加 */
appendTreeNode(data) { appendTreeNode(data) {
this.isEditType=false; this.isEditType=false;
this.form={} this.form={}
this.resetForm("form"); this.resetForm("form");
this.$set(this.form,"parentId",data.id) this.$set(this.form,"parentId",data.id)
this.$set(this.form,"goodsType",data.categoryType) this.$set(this.form,"goodsType",data.categoryType)
this.open = true; this.open = true;
this.title = "新增"; this.title = "新增";
}, },
/* 树节点修改 */ /* 树节点修改 */
editTreeNode(data) { editTreeNode(data) {
this.isEditType=true; this.isEditType=true;
@ -480,7 +481,7 @@ export default {
}; };
this.$set(this.form,"materialTypeId",data.id) this.$set(this.form,"materialTypeId",data.id)
this.$set(this.form,"materialTypeName",data.categoryName) this.$set(this.form,"materialTypeName",data.categoryName)
this.$set(this.form,"goodsType",data.categoryType) this.$set(this.form,"goodsType",data.categoryType)
this.open = true; this.open = true;
this.title = "修改"; this.title = "修改";
}, },
@ -517,7 +518,7 @@ export default {
this.getTreeData(); this.getTreeData();
this.$refs.materialDialog.getTypeTreeData(); this.$refs.materialDialog.getTypeTreeData();
}); });
} else { } else {
addMaterialTypeApi(this.form).then(response => { addMaterialTypeApi(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -528,7 +529,7 @@ export default {
} }
}); });
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
@ -551,8 +552,8 @@ export default {
"pageNum": this.queryParams.pageNum, "pageNum": this.queryParams.pageNum,
"areaId": this.queryParams.areaId, "areaId": this.queryParams.areaId,
"materialName": this.queryParams.materialName, "materialName": this.queryParams.materialName,
"materialCode": this.queryParams.materialCode, "materialCode": this.queryParams.materialCode,
"goodsType": 1, "goodsType": 1,
"materialTypeIds": this.$refs.typeTree.getCheckedKeys(), "materialTypeIds": this.$refs.typeTree.getCheckedKeys(),
} }
getMaterialListApi(params).then((response) => { getMaterialListApi(params).then((response) => {
@ -564,7 +565,7 @@ export default {
//- //-
getAreaTreeData() { getAreaTreeData() {
systemAreaTreeApi({}).then((response) => { systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data; this.treeAreaOptions = response.data;
}); });
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -576,7 +577,7 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.title = "修改"; this.title = "修改";
this.dialogVisible = true; this.dialogVisible = true;
// $refs 访 // $refs 访
this.$nextTick(() => { this.$nextTick(() => {
// setFormData // setFormData
@ -604,7 +605,7 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
if (Number(row.hasInventory) === 1) { if (Number(row.hasInventory) === 1) {
this.$modal.msgWarning("该物料仍有库存,无法删除!"); this.$modal.msgWarning("该物料仍有库存,无法删除!");
return; return;
@ -619,7 +620,7 @@ export default {
this.getList(); this.getList();
}) })
.catch(() => {}); .catch(() => {});
}, },
handleSelectionChange(selection){ handleSelectionChange(selection){
this.multipleSelection = selection this.multipleSelection = selection
this.batchIds = [] this.batchIds = []
@ -641,7 +642,7 @@ export default {
removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => { removeMaterialApi({"materialId":this.batchIds.join(",")}).then(response => {
this.getList(); this.getList();
this.$refs.multipleTable.clearSelection() this.$refs.multipleTable.clearSelection()
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}); });
}, },
// //
@ -651,7 +652,7 @@ export default {
}, },
handleSubmitEdit(){ handleSubmitEdit(){
this.$refs["editForm"].validate(valid => { this.$refs["editForm"].validate(valid => {
if (valid) { if (valid) {
let param = { let param = {
materialIdList:this.batchIds, materialIdList:this.batchIds,
categroyId:this.editForm.categroyId categroyId:this.editForm.categroyId
@ -673,10 +674,10 @@ export default {
this.upload.isUploading = true this.upload.isUploading = true
}, },
// //
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.isUploading = false this.upload.isUploading = false
this.$refs.upload.clearFiles() this.$refs.upload.clearFiles()
this.$modal.msgSuccess("后台导入中,请稍后刷新列表!"); this.$modal.msgSuccess(response.msg);
this.getList() this.getList()
}, },
@ -687,7 +688,7 @@ export default {
downloadFileByUrl(url) downloadFileByUrl(url)
}, },
// getParentName(list, id) { // getParentName(list, id) {
// try { // try {
// list.forEach((e) => { // list.forEach((e) => {
@ -702,7 +703,7 @@ export default {
// }); // });
// } catch (error) {} // } catch (error) {}
// }, // },
}, },
}; };

View File

@ -260,7 +260,7 @@
</div> </div>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="handleImportCancel"> </el-button> <el-button @click="handleImportCancel"> </el-button>
<el-button type="primary" @click="submitUpload" :loading="uploading">开始上传</el-button> <el-button type="primary" @click="submitUpload" :loading="uploading">开始上传</el-button>
</div> </div>
</el-dialog> </el-dialog>

View File

@ -4,7 +4,7 @@
<el-form-item label="所属区域" prop="areaId"> <el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="queryParams.areaId" <el-cascader v-model="queryParams.areaId"
:options="treeOptions" :filterable="true" style="width: 240px;" :show-all-levels="false" :options="treeOptions" :filterable="true" style="width: 240px;" :show-all-levels="false"
:props="{ :props="{
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'label' value:'id',label:'label'
@ -18,43 +18,44 @@
:label="item.warehouseName" :label="item.warehouseName"
:value="item.warehouseId" :value="item.warehouseId"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="货品类别" prop="materialTypeIds"> <el-form-item label="货品类别" prop="materialTypeIds">
<el-cascader v-model="queryParams.materialTypeIds" <el-cascader v-model="queryParams.materialTypeIds"
:options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false" :options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:props="{ :props="{
multiple: true, multiple: true,
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'categoryName' value:'id',label:'categoryName'
}" collapse-tags> }" collapse-tags>
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
<el-form-item label="货品名称" prop="materialName"> <el-form-item label="货品名称" prop="materialName">
<el-input <el-input
v-model="queryParams.materialName" v-model="queryParams.materialName"
placeholder="请输入货品名称" placeholder="请输入货品名称"
clearable maxlength="30" clearable maxlength="30"
style="width: 240px" style="width: 240px"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="条码" prop="barCode"> <!-- <el-form-item label="条码" prop="barCode">
<el-input <el-input
v-model="queryParams.barCode" v-model="queryParams.barCode"
placeholder="请输入条码" placeholder="请输入条码"
clearable maxlength="30" clearable maxlength="30"
style="width: 240px" style="width: 240px"
/> />
</el-form-item> --> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="el-icon-button" size="mini" @click="handleExport">导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -68,14 +69,14 @@
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true"/> <el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true"/>
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" width="100"/> <el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true" width="120"> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span> <span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
<span v-if="!scope.row.salesMode">/</span> <span v-if="!scope.row.salesMode">/</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true"/> <el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true"/>
<el-table-column label="货品仓库" align="center" prop="warehouseName" :show-overflow-tooltip="true"/> <el-table-column label="货品仓库" align="center" prop="warehouseName" :show-overflow-tooltip="true"/>
<el-table-column label="当前库存数" align="center" prop="materialNum" :show-overflow-tooltip="true" width="120"/> <el-table-column label="当前库存数" align="center" prop="materialNum" :show-overflow-tooltip="true" width="120"/>
<!-- <el-table-column label="库存金额" align="center" prop="totalPrice" :show-overflow-tooltip="true" width="120"> <!-- <el-table-column label="库存金额" align="center" prop="totalPrice" :show-overflow-tooltip="true" width="120">
@ -94,17 +95,17 @@
</el-table-column> </el-table-column>
<!-- <el-table-column label="总库存数" align="center" prop="totalNum" :show-overflow-tooltip="true" width="120"/> --> <!-- <el-table-column label="总库存数" align="center" prop="totalNum" :show-overflow-tooltip="true" width="120"/> -->
<!-- <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width"> <!-- <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
>配置库存</el-button> >配置库存</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@click="handleView(scope.row)" @click="handleView(scope.row)"
>批次详情</el-button> >批次详情</el-button>
</template> </template>
</el-table-column> --> </el-table-column> -->
@ -122,16 +123,16 @@
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :close-on-click-modal="false"> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="最小库存:" prop="minNum"> <el-form-item label="最小库存:" prop="minNum">
<el-input <el-input
v-model="form.minNum" v-model="form.minNum"
type="text" clearable type="text" clearable
placeholder="请输入最小库存" placeholder="请输入最小库存"
maxlength="7" @input="(v)=>(form.minNum=v.replace(/[^\d]/g,''))" maxlength="7" @input="(v)=>(form.minNum=v.replace(/[^\d]/g,''))"
/> />
</el-form-item> </el-form-item>
<el-form-item label="最大库存:" prop="maxNum"> <el-form-item label="最大库存:" prop="maxNum">
<el-input v-model="form.maxNum" <el-input v-model="form.maxNum"
type="text" clearable type="text" clearable
placeholder="请输入最大库存" placeholder="请输入最大库存"
maxlength="7" @input="(v)=>(form.maxNum=v.replace(/[^\d]/g,''))" maxlength="7" @input="(v)=>(form.maxNum=v.replace(/[^\d]/g,''))"
/> />
@ -145,7 +146,7 @@
</div> </div>
</template> </template>
<script> <script>
import { systemAreaTreeApi } from "@/api/base/stall"; import { systemAreaTreeApi } from "@/api/base/stall";
// import { supplierQualificationWarningPageApi } from "@/api/foodManage/supplierManage"; // import { supplierQualificationWarningPageApi } from "@/api/foodManage/supplierManage";
import { drpWareHousePageApi,systemMaterialTreeApi,getStockMaterialListApi,editStockMaterialApi } from "@/api/foodManage/stockManage"; import { drpWareHousePageApi,systemMaterialTreeApi,getStockMaterialListApi,editStockMaterialApi } from "@/api/foodManage/stockManage";
@ -175,16 +176,16 @@ export default {
// //
title: "", title: "",
// //
open: false, open: false,
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
areaId: null, areaId: null,
warehouseId: null, warehouseId: null,
materialTypeIds: [], materialTypeIds: [],
materialName: "", materialName: "",
barCode: "", barCode: "",
}, },
// //
form: {}, form: {},
@ -199,28 +200,28 @@ export default {
} }
}; };
}, },
created() { created() {
this.getTreeData(); this.getTreeData();
this.getMaterialTree() this.getMaterialTree()
this.getList(); this.getList();
}, },
methods: { methods: {
// //
getTreeData() { getTreeData() {
systemAreaTreeApi({}).then((response) => { systemAreaTreeApi({}).then((response) => {
this.treeOptions = response.data; this.treeOptions = response.data;
}); });
}, },
//- //-
handleAreaChange(e){ handleAreaChange(e){
this.getWareHouseData() this.getWareHouseData()
}, },
/** 查询货品下拉结构 */ /** 查询货品下拉结构 */
getWareHouseData() { getWareHouseData() {
drpWareHousePageApi({ areaId:this.queryParams.areaId }).then((response) => { drpWareHousePageApi({ areaId:this.queryParams.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[]; this.wareHouseOptions = response.rows||[];
this.$set(this.queryParams,'warehouseId',null) this.$set(this.queryParams,'warehouseId',null)
}); });
}, },
/** 查询货品类别下拉树结构 */ /** 查询货品类别下拉树结构 */
getMaterialTree() { getMaterialTree() {
@ -228,24 +229,24 @@ export default {
// goodsType:1 // goodsType:1
} }
systemMaterialTreeApi(param).then((response) => { systemMaterialTreeApi(param).then((response) => {
this.materialTreeOptions = response.data; this.materialTreeOptions = response.data;
}); });
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
areaId: null, areaId: null,
warehouseId: null, warehouseId: null,
materialTypeIds: [], materialTypeIds: [],
materialName: "", materialName: "",
barCode: "", barCode: "",
} }
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
@ -254,11 +255,11 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
let param = { let param = {
"pageNum": this.queryParams.pageNum, "pageNum": this.queryParams.pageNum,
"pageSize": this.queryParams.pageSize, "pageSize": this.queryParams.pageSize,
"areaId": this.queryParams.areaId, "areaId": this.queryParams.areaId,
"warehouseId": this.queryParams.warehouseId, "warehouseId": this.queryParams.warehouseId,
"materialTypeIds": this.queryParams.materialTypeIds, "materialTypeIds": this.queryParams.materialTypeIds,
"materialName": this.queryParams.materialName "materialName": this.queryParams.materialName
} }
getStockMaterialListApi(param).then(response => { getStockMaterialListApi(param).then(response => {
@ -266,11 +267,11 @@ export default {
this.total = Number(response.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
}); });
}, },
/** 配置库存按钮操作 */ /** 配置库存按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.form = Object.assign({}, row) this.form = Object.assign({}, row)
this.open = true; this.open = true;
this.title = "配置库存"; this.title = "配置库存";
}, },
@ -287,19 +288,24 @@ export default {
reset() { reset() {
this.form = {}; this.form = {};
this.resetForm("form"); this.resetForm("form");
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
editStockMaterialApi(this.form).then(response => { editStockMaterialApi(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} }
}); });
}, },
handleExport() {
this.download('smart-canteen/api/v1/drpinventory/export', {
...this.queryParams
}, `货品库存${new Date().getDate()}.xlsx`)
}
} }
}; };
</script> </script>