原料,营养信息对接
This commit is contained in:
parent
5afb4de81a
commit
2cdc19093d
|
|
@ -11,6 +11,39 @@ export function systemMaterialTreeApi(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 新增原料类别
|
||||
export function addMaterialTypeApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterialcategory/add',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//修改原料类别
|
||||
export function updateMaterialTypeApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterialcategory/edit',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//删除原料类别
|
||||
export function removeMaterialTypeApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterialcategory/remove',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 系统区域权限树
|
||||
export function systemAreaTreeApi(data) {
|
||||
|
|
@ -24,7 +57,7 @@ export function systemAreaTreeApi(data) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询区域列表
|
||||
// 查询原料列表
|
||||
export function getMaterialListApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/page',
|
||||
|
|
@ -35,54 +68,72 @@ export function getMaterialListApi(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 根据区域id,查询区域名称
|
||||
export function getMaterialNameApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v2/alloc/area/get-area-name',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 查询区域(食堂,档口,餐线)编号
|
||||
export function getMaterialNumApi(data) {
|
||||
return request({
|
||||
url: 'smart-canteen/api/v2/alloc/canteen/get-canteen-num',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 新增区域
|
||||
|
||||
// 新增原料
|
||||
export function addMaterialApi(data) {
|
||||
return request({
|
||||
url: 'smart-canteen/api/v2/alloc/area/add',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//修改区域
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/add',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑原料
|
||||
export function updateMaterialApi(data) {
|
||||
return request({
|
||||
url: 'smart-canteen/api/v2/alloc/area/update',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//删除区域
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/edit',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除原料
|
||||
export function removeMaterialApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/remove',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 批量删除原料
|
||||
export function batchRemoveMaterialApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/remove/batch',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 批量修改原料
|
||||
export function batchUpdateMaterialApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/material/batch/update/category',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
},
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 根据区域ID-获取原料单位下拉选
|
||||
//{current: 1, size: -1, ifListUse: 1, areaId: '421488254718578688'}
|
||||
export function getDrpUnitListApi(data) {
|
||||
return request({
|
||||
url: 'smart-canteen/api/v2/alloc/area/remove',
|
||||
url: '/smart-canteen//api/v1/drpunit/page',
|
||||
method: 'post',
|
||||
headers: {
|
||||
"merchant-id":"378915229716713472",
|
||||
|
|
@ -90,3 +141,21 @@ export function removeMaterialApi(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// // 查询区域(食堂,档口,餐线)编号
|
||||
// export function getMaterialNumApi(data) {
|
||||
// return request({
|
||||
// url: 'smart-canteen/api/v2/alloc/canteen/get-canteen-num',
|
||||
// method: 'post',
|
||||
// headers: {
|
||||
// "merchant-id":"378915229716713472",
|
||||
// },
|
||||
// data: data
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询获取所有食材营养信息
|
||||
// 查询获取所有营养信息
|
||||
export function listNutrition(query) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menunutrition/getMenuNutritionPage',
|
||||
|
|
@ -45,7 +45,7 @@ export function delNutrition(data) {
|
|||
})
|
||||
}
|
||||
|
||||
// 获取所有食材类别
|
||||
// 获取营养信息类别
|
||||
export function typeList(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menunutrition/all/type/list',
|
||||
|
|
@ -53,4 +53,20 @@ export function typeList(data) {
|
|||
data: data
|
||||
})
|
||||
}
|
||||
// 获取所有营养信息
|
||||
export function nutritionAllListApi(data) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menunutrition/all/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 获取营养信息-详细数据
|
||||
export function nutritionDetailApi(nutritionId) {
|
||||
return request({
|
||||
url: '/smart-canteen/api/v1/menumaterial/nutrition/detail/'+nutritionId,
|
||||
method: 'post',
|
||||
// data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="head-container">
|
||||
原料类别
|
||||
<el-input
|
||||
v-model="materialName"
|
||||
v-model="keyWord"
|
||||
placeholder="请输入关键字进行搜索"
|
||||
clearable
|
||||
maxlength="50"
|
||||
|
|
@ -22,20 +22,16 @@
|
|||
style="height: 700px; overflow: scroll"
|
||||
:data="treeOptions"
|
||||
:props="defaultProps"
|
||||
:show-checkbox="true"
|
||||
:default-expand-all="false"
|
||||
:expand-on-click-node="false"
|
||||
:filter-node-method="filterNode"
|
||||
ref="tree"
|
||||
ref="typeTree"
|
||||
node-key="id"
|
||||
:default-expand-all="false"
|
||||
highlight-current
|
||||
@node-click="handleNodeClick"
|
||||
>
|
||||
<span
|
||||
class="custom-tree-node"
|
||||
slot-scope="{ node, data }"
|
||||
@mousemove="onMousemove(data)"
|
||||
@mouseleave="onMouseleave()"
|
||||
>
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }" @mousemove="onMousemove(data)" @mouseleave="onMouseleave()">
|
||||
<span v-if="isMousemoveId === data.id && node.label.length > 10">{{
|
||||
node.label.slice(0, 10) + "..."
|
||||
}}</span>
|
||||
|
|
@ -81,27 +77,44 @@
|
|||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
|
||||
<el-form-item label="原料名称" prop="keyword">
|
||||
>
|
||||
<el-form-item label="所属区域" prop="areaId">
|
||||
<el-cascader v-model="queryParams.areaId"
|
||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: true,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'treeName'
|
||||
}" clearable>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="原料名称" prop="materialName">
|
||||
<el-input
|
||||
v-model="queryParams.keyword"
|
||||
v-model="queryParams.materialName"
|
||||
placeholder="请输入原料名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="条码" prop="keyword">
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input
|
||||
v-model="queryParams.keyword"
|
||||
v-model="queryParams.barCode"
|
||||
placeholder="请输入条码"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="原料编码" prop="materialCode">
|
||||
<el-input
|
||||
v-model="queryParams.materialCode"
|
||||
placeholder="请输入原料编码"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button
|
||||
|
|
@ -125,30 +138,73 @@
|
|||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['dish:material:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleBatchDel"
|
||||
>批量删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleBatchEdit"
|
||||
>批量修改类别
|
||||
</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"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
>批量导入
|
||||
</el-button>
|
||||
</el-upload>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="typeList" border>
|
||||
<el-table v-loading="loading" :data="tableList" ref="multipleTable" border :row-key="(row)=>{return row.materialId}" @selection-change="handleSelectionChange">
|
||||
|
||||
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template slot-scope="scope">
|
||||
<span>{{(queryParams.pageNum - 1) * 10 + scope.$index + 1}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原料编码" align="center" key="materialNum" prop="materialNum" show-overflow-tooltip/>
|
||||
<el-table-column label="所属区域" align="center" key="region" prop="region" show-overflow-tooltip/>
|
||||
<el-table-column label="原料类别" align="center" key="materialType" prop="materialType" show-overflow-tooltip/>
|
||||
<el-table-column label="原料名称" align="center" key="materialName" prop="materialName" show-overflow-tooltip/>
|
||||
<el-table-column label="营养信息名称" align="center" key="nutritionName" prop="nutritionName" show-overflow-tooltip/>
|
||||
<el-table-column label="单位" align="center" key="unit" prop="unit" show-overflow-tooltip/>
|
||||
<el-table-column label="条码" align="center" key="barcode" prop="barcode" show-overflow-tooltip/>
|
||||
<el-table-column label="原料进价(元)" align="center" key="purchasePrice" prop="purchasePrice" show-overflow-tooltip/>
|
||||
<el-table-column label="最近进价(元)" align="center" key="recentPrice" prop="recentPrice" show-overflow-tooltip/>
|
||||
<el-table-column label="最近入库时间" align="center" key="lastStockTime" prop="lastStockTime" show-overflow-tooltip/>
|
||||
<el-table-column label="月度均价(元)" align="center" key="monthlyAvgPrice" prop="monthlyAvgPrice" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<el-table-column label="原料编码" align="center" key="materialCode" prop="materialCode" :show-overflow-tooltip="true" width="100"/>
|
||||
<el-table-column label="所属区域" align="center" key="areaName" prop="areaName" :show-overflow-tooltip="true" width="120"/>
|
||||
<el-table-column label="原料类别" align="center" key="categoryName" prop="categoryName" :show-overflow-tooltip="true" width="120"/>
|
||||
<el-table-column label="原料名称" align="center" key="materialName" prop="materialName" :show-overflow-tooltip="true" width="120"/>
|
||||
<el-table-column label="单位" align="center" key="unitName" prop="unitName" :show-overflow-tooltip="true" width="100"/>
|
||||
<el-table-column label="营养信息名称" align="center" key="nutritionName" prop="nutritionName" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="条码" align="center" key="barcode" prop="barcode" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="原料进价(元)" align="center" key="purchasePrice" prop="purchasePrice" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="最近进价(元)" align="center" key="recentPrice" prop="recentPrice" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="最近入库时间" align="center" key="lastStockTime" prop="lastStockTime" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="月度均价(元)" align="center" key="monthlyAvgPrice" prop="monthlyAvgPrice" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="操作" align="center" width="180" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
|
|
@ -189,13 +245,15 @@
|
|||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
|
||||
|
||||
<el-form-item label="所属区域" prop="areaNameStr">
|
||||
<el-cascader
|
||||
v-model="form.areaNameStr" :show-all-levels="false" :filterable="true"
|
||||
:options="treeAreaOptions" :props="treeProps" collapse-tags
|
||||
@change="handleTreeChange"></el-cascader>
|
||||
<el-form-item label="所属区域" prop="areaId">
|
||||
<el-cascader v-model="form.areaId" :disabled="isEditType"
|
||||
:options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: true,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'treeName'
|
||||
}" clearable>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
|
||||
<el-row>
|
||||
|
|
@ -210,7 +268,7 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-row v-if="isEditType">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="原类别父节点" prop="superAreaName">
|
||||
<el-input
|
||||
|
|
@ -221,37 +279,71 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item label="新类别父节点" prop="areaNameStr">
|
||||
<el-cascader
|
||||
v-model="form.areaNameStr" :show-all-levels="false" :filterable="true"
|
||||
:options="treeAreaOptions" :props="treeProps" collapse-tags
|
||||
@change="handleTreeChange"></el-cascader>
|
||||
</el-form-item>
|
||||
|
||||
<el-row v-if="isEditType">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="新类别父节点" prop="newParentId">
|
||||
<el-cascader v-model="form.newParentId"
|
||||
:options="treeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: true,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'categoryName'
|
||||
}" clearable >
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button @click="open=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 批量修改原料类别对话框 -->
|
||||
<el-dialog title="批量修改原料类别" :visible.sync="openEdit"
|
||||
width="500px" append-to-body :close-on-click-modal="false">
|
||||
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="原料名称" prop="categoryNames">
|
||||
<el-input v-model="editForm.categoryNames" placeholder="请输入原料名称" :readonly="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="新类别" prop="categroyId">
|
||||
<el-cascader v-model="editForm.categroyId"
|
||||
:options="treeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||
:props="{
|
||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||
checkStrictly: true,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||
value:'id',label:'categoryName'
|
||||
}" clearable >
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="handleSubmitEdit">确 定</el-button>
|
||||
<el-button @click="openEdit=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改用户配置对话框 -->
|
||||
<material-dialog
|
||||
:visible.sync="dialogVisible"
|
||||
:title="title"
|
||||
@submit="handleDialogSubmit"
|
||||
ref="materialDialog"
|
||||
/>
|
||||
<material-dialog :visible.sync="dialogVisible" :title="title" @submit="handleDialogSubmit" ref="materialDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import { systemMaterialTreeApi,systemAreaTreeApi,getMaterialListApi,getMaterialNameApi,getMaterialNumApi,addMaterialApi,updateMaterialApi,removeMaterialApi } from "@/api/dish/material";
|
||||
import { systemMaterialTreeApi,addMaterialTypeApi,updateMaterialTypeApi,removeMaterialTypeApi,systemAreaTreeApi} from "@/api/dish/material";
|
||||
import { getMaterialListApi,addMaterialApi, updateMaterialApi, removeMaterialApi,batchRemoveMaterialApi,batchUpdateMaterialApi} from "@/api/dish/material";
|
||||
import MaterialDialog from './components/MaterialDialog.vue';
|
||||
|
||||
import { getToken } from '@/utils/auth'
|
||||
export default {
|
||||
name: "Material",
|
||||
components: {
|
||||
|
|
@ -278,17 +370,23 @@ export default {
|
|||
children: "children",
|
||||
label: "categoryName",
|
||||
},
|
||||
materialName:"",
|
||||
materialId:"",
|
||||
keyWord:"",//左侧树-关键字查询
|
||||
isEditType:false,//是否编辑
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
areaId:null,
|
||||
materialName:"",
|
||||
barCode:"",
|
||||
materialCode:"",
|
||||
materialType:1, //类型(1原料2商品)
|
||||
categoryIdList:[]
|
||||
},
|
||||
// 总条数
|
||||
total: 0,
|
||||
//列表数据
|
||||
typeList: undefined,
|
||||
tableList: undefined,
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
dialogVisible: false,
|
||||
|
|
@ -298,9 +396,8 @@ export default {
|
|||
form: {
|
||||
categoryName: "",
|
||||
parentId: "",
|
||||
categoryType: "",
|
||||
superAreaName: "",
|
||||
categoryCode: "",
|
||||
description: ""
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
|
|
@ -310,30 +407,40 @@ export default {
|
|||
message: "类别名称不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
categoryCode: [
|
||||
]
|
||||
},
|
||||
parentId: undefined,
|
||||
treeAreaOptions:[],//区域树
|
||||
batchIds:[],
|
||||
openEdit:false,
|
||||
editForm:{
|
||||
categoryNames:"",
|
||||
categroyId:null
|
||||
},
|
||||
editRules: {
|
||||
categroyId: [
|
||||
{
|
||||
required: true,
|
||||
message: "类别编码不能为空",
|
||||
trigger: "blur",
|
||||
message: "新类别不能为空",
|
||||
trigger: "change",
|
||||
},
|
||||
]
|
||||
},
|
||||
parentId: undefined,
|
||||
|
||||
treeAreaOptions:[],//区域树
|
||||
treeProps:{
|
||||
multiple: true,
|
||||
value:"id",
|
||||
label:"treeName",
|
||||
children:"children",
|
||||
//导入参数
|
||||
upload: {
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 设置上传的请求头部
|
||||
headers: { Authorization: 'Bearer ' + getToken() },
|
||||
// 上传的地址
|
||||
url: process.env.VUE_APP_BASE_API + '/smart-canteen/api/v1/menumaterial/batch/import/material',
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
materialName(val) {
|
||||
this.$refs.tree.filter(val);
|
||||
keyWord(val) {
|
||||
this.$refs.typeTree.filter(val);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
|
@ -348,226 +455,47 @@ export default {
|
|||
},
|
||||
/** 查询新增页面-上级类型下拉树结构 */
|
||||
getTreeData() {
|
||||
systemMaterialTreeApi({}).then((response) => {
|
||||
systemMaterialTreeApi({categoryType:1}).then((response) => {
|
||||
this.treeOptions = response.data;
|
||||
console.log("this.treeOptions",this.treeOptions)
|
||||
if(this.treeOptions && this.treeOptions.length > 0){
|
||||
// 确保树节点数据格式正确
|
||||
this.treeOptions = this.treeOptions.map(node => ({
|
||||
...node,
|
||||
categoryName: node.categoryName || node.treeName || node.label || '未命名'
|
||||
}));
|
||||
this.materialId = this.treeOptions[0].id;
|
||||
this.queryParams.materialType=this.treeOptions[0].categoryType;
|
||||
if(this.treeOptions && this.treeOptions.length > 0){
|
||||
this.getList();
|
||||
} else {
|
||||
this.materialId = "";
|
||||
} else {
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10;
|
||||
this.$refs.tree.setCurrentKey(null);
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
let params= {
|
||||
"materialName":this.materialName,
|
||||
"materialId":this.materialId,
|
||||
"size": this.queryParams.pageSize,
|
||||
"current": this.queryParams.pageNum
|
||||
}
|
||||
getMaterialListApi(params).then((response) => {
|
||||
this.typeList = response.records;
|
||||
this.total = Number(response.total);
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 节点单击事件 - 左侧树
|
||||
async handleNodeClick(data, node) {
|
||||
console.log(data)
|
||||
this.materialId = data.id;
|
||||
this.handleQuery();
|
||||
// this.handleQuery();
|
||||
},
|
||||
|
||||
// 节点单击事件 - 左侧树
|
||||
async getMaterialName(data) {
|
||||
let params= {
|
||||
"materialId":data.id
|
||||
}
|
||||
const res = await getMaterialNameApi(params);
|
||||
this.$set(this.form,"superMaterialName",res.msg)
|
||||
},
|
||||
// 节点单击事件 - 左侧树
|
||||
async getMaterialNum(data) {
|
||||
let params= {
|
||||
"superId":data.id||""
|
||||
}
|
||||
if(data.parentId=="-1"){
|
||||
params.canteenTreeType=-1
|
||||
}else{
|
||||
params.canteenTreeType=0
|
||||
}
|
||||
const res = await getMaterialNumApi(params);
|
||||
this.$set(this.form,"materialNum",res.data)
|
||||
},
|
||||
|
||||
|
||||
/* 树节点增加 */
|
||||
appendTreeNode(data) {
|
||||
this.reset();
|
||||
if(data.parentId=="-1"){
|
||||
this.$set(this.form,"superAreaName",data.categoryName)
|
||||
}else{
|
||||
this.$set(this.form,"superAreaName",data.categoryName)
|
||||
}
|
||||
this.isEditType=false;
|
||||
this.form={}
|
||||
this.resetForm("form");
|
||||
this.$set(this.form,"parentId",data.id)
|
||||
this.$set(this.form,"categoryType",data.categoryType)
|
||||
this.open = true;
|
||||
this.title = "新增";
|
||||
},
|
||||
/* 树节点删除 */
|
||||
removeTreeNode(data) {
|
||||
console.log(data, "删除时的数据源--");
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMaterialApi({"materialId":data.id});
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
/* 树节点修改 */
|
||||
editTreeNode(data) {
|
||||
this.reset();
|
||||
this.isEditType=true;
|
||||
this.form={}
|
||||
this.resetForm("form");
|
||||
this.form = {
|
||||
...data,
|
||||
categoryId:data.id,
|
||||
superAreaName: data.parentId === "-1" ? "" : this.getParentCategoryName(data.parentId)
|
||||
};
|
||||
console.log(this.form)
|
||||
console.log(this.treeOptions)
|
||||
this.open = true;
|
||||
this.title = "修改";
|
||||
},
|
||||
onMousemove(data) {
|
||||
this.isMousemoveId = data.id;
|
||||
},
|
||||
onMouseleave() {
|
||||
this.isMousemoveId = null;
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.dialogVisible = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.dialogVisible = true;
|
||||
this.title = "新增";
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.dialogVisible = true;
|
||||
this.title = "修改";
|
||||
// 在显示对话框后,可以通过 $refs 访问子组件方法设置表单数据
|
||||
this.$nextTick(() => {
|
||||
// 假设子组件提供了 setFormData 方法
|
||||
this.$refs.materialDialog.setFormData(row);
|
||||
});
|
||||
},
|
||||
|
||||
/** 处理对话框提交 */
|
||||
handleDialogSubmit(formData) {
|
||||
if (this.title === "新增") {
|
||||
addMaterialApi(formData).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
});
|
||||
} else {
|
||||
updateMaterialApi(formData).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMaterialApi({"materialId":row.materialId});
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
|
||||
|
||||
|
||||
getParentName(list, id) {
|
||||
try {
|
||||
list.forEach((e) => {
|
||||
if (e.id == id) {
|
||||
this.form.label = e.label;
|
||||
throw new Error();
|
||||
} else {
|
||||
if (e.children && e.children.length > 0) {
|
||||
this.getParentName(e.children, id);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {}
|
||||
},
|
||||
|
||||
/** 表单提交 */
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
updateMaterialApi(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addMaterialApi(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 获取父节点的类别名称
|
||||
getParentCategoryName(parentId) {
|
||||
const findNode = (nodes) => {
|
||||
|
|
@ -584,18 +512,200 @@ export default {
|
|||
};
|
||||
return findNode(this.treeOptions);
|
||||
},
|
||||
|
||||
handleTreeChange(e){
|
||||
console.log(e)
|
||||
/* 树节点删除 */
|
||||
removeTreeNode(data) {
|
||||
console.log(data, "删除时的数据源--");
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMaterialTypeApi({"categoryId":data.id});
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
this.getTreeData();
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
|
||||
//区域树
|
||||
getAreaTreeData() {
|
||||
systemAreaTreeApi({}).then((response) => {
|
||||
this.treeAreaOptions = response;
|
||||
console.log(this.treeAreaOptions)
|
||||
onMousemove(data) {
|
||||
this.isMousemoveId = data.id;
|
||||
},
|
||||
onMouseleave() {
|
||||
this.isMousemoveId = null;
|
||||
},
|
||||
/** 操作左侧树-表单提交 */
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
updateMaterialTypeApi(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getTreeData();
|
||||
});
|
||||
} else {
|
||||
console.log(this.form)
|
||||
addMaterialTypeApi(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getTreeData();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.pageSize = 10;
|
||||
// this.$refs.typeTree.setCheckedNodes([]);
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
console.log(this.$refs.typeTree.getCheckedKeys())
|
||||
this.loading = true;
|
||||
let params= {
|
||||
"size": this.queryParams.pageSize,
|
||||
"current": this.queryParams.pageNum,
|
||||
"areaId": this.queryParams.areaId,
|
||||
"materialName": this.queryParams.materialName,
|
||||
"barCode": this.queryParams.barCode,
|
||||
"materialCode": this.queryParams.materialCode,
|
||||
"materialType": this.queryParams.materialType,//类型(1原料2商品)
|
||||
"categoryIdList": this.$refs.typeTree.getCheckedKeys(),
|
||||
}
|
||||
getMaterialListApi(params).then((response) => {
|
||||
this.tableList = response.data.records;
|
||||
this.total = Number(response.data.total);
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
//新增修改弹窗-区域树
|
||||
getAreaTreeData() {
|
||||
systemAreaTreeApi({}).then((response) => {
|
||||
this.treeAreaOptions = response;
|
||||
});
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.title = "新增";
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.title = "修改";
|
||||
this.dialogVisible = true;
|
||||
// 在显示对话框后,可以通过 $refs 访问子组件方法设置表单数据
|
||||
this.$nextTick(() => {
|
||||
// 假设子组件提供了 setFormData 方法
|
||||
this.$refs.materialDialog.setFormData(row);
|
||||
});
|
||||
},
|
||||
|
||||
/** 处理对话框提交 */
|
||||
handleDialogSubmit(formData) {
|
||||
if (this.title === "新增") {
|
||||
addMaterialApi(formData).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
updateMaterialApi(formData).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return removeMaterialApi({"materialId":row.materialId});
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
handleSelectionChange(selection){
|
||||
this.batchIds = []
|
||||
this.batchIds = selection.map((item) => item.materialId)
|
||||
this.editForm.categoryNames = "";
|
||||
this.editForm.categoryNames = selection.map((item) => item.materialName);
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 批量删除
|
||||
handleBatchDel(){
|
||||
console.log(this.batchIds)
|
||||
batchRemoveMaterialApi(this.batchIds).then(response => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
//批量修改
|
||||
handleBatchEdit(){
|
||||
this.editForm.categroyId=null
|
||||
this.openEdit=true;
|
||||
},
|
||||
handleSubmitEdit(){
|
||||
let param = {
|
||||
materialIdList:this.batchIds,
|
||||
categroyId:this.editForm.categroyId
|
||||
}
|
||||
batchUpdateMaterialApi(param).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.openEdit=false
|
||||
this.$refs.multipleTable.clearSelection()
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
|
||||
//批量导入
|
||||
// /api/v1/menumaterial/batch/import/material
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
this.upload.isUploading = true
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.isUploading = false
|
||||
this.$refs.upload.clearFiles()
|
||||
this.$modal.msgSuccess("后台导入中...");
|
||||
this.getList()
|
||||
},
|
||||
|
||||
|
||||
// getParentName(list, id) {
|
||||
// try {
|
||||
// list.forEach((e) => {
|
||||
// if (e.id == id) {
|
||||
// this.form.label = e.label;
|
||||
// throw new Error();
|
||||
// } else {
|
||||
// if (e.children && e.children.length > 0) {
|
||||
// this.getParentName(e.children, id);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } catch (error) {}
|
||||
// },
|
||||
|
||||
|
||||
},
|
||||
};
|
||||
|
|
@ -615,35 +725,35 @@ export default {
|
|||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
::v-deep .el-tree .el-tree-node__expand-icon.expanded {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
::v-deep .el-tree .el-icon-caret-right:before {
|
||||
content: "\e783";
|
||||
font-size: 16px;
|
||||
}
|
||||
::v-deep
|
||||
.el-tree
|
||||
.el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
|
||||
content: "\e781";
|
||||
font-size: 16px;
|
||||
color: #1890ff;
|
||||
}
|
||||
// ::v-deep .el-tree .el-tree-node__expand-icon.expanded {
|
||||
// -webkit-transform: rotate(0deg);
|
||||
// transform: rotate(0deg);
|
||||
// }
|
||||
// ::v-deep .el-tree .el-icon-caret-right:before {
|
||||
// content: "\e783";
|
||||
// font-size: 16px;
|
||||
// }
|
||||
// ::v-deep
|
||||
// .el-tree
|
||||
// .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
|
||||
// content: "\e781";
|
||||
// font-size: 16px;
|
||||
// color: #1890ff;
|
||||
// }
|
||||
|
||||
::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
|
||||
color: #1890ff !important;
|
||||
}
|
||||
::v-deep .el-tree-node__expand-icon.is-leaf {
|
||||
color: transparent !important;
|
||||
}
|
||||
// ::v-deep .el-tree-node__content > .el-tree-node__expand-icon {
|
||||
// color: #1890ff !important;
|
||||
// }
|
||||
// ::v-deep .el-tree-node__expand-icon.is-leaf {
|
||||
// color: transparent !important;
|
||||
// }
|
||||
|
||||
::v-deep
|
||||
.el-tree--highlight-current
|
||||
.el-tree-node.is-current
|
||||
> .el-tree-node__content {
|
||||
background-color: #8decf1;
|
||||
}
|
||||
// ::v-deep
|
||||
// .el-tree--highlight-current
|
||||
// .el-tree-node.is-current
|
||||
// > .el-tree-node__content {
|
||||
// background-color: #8decf1;
|
||||
// }
|
||||
|
||||
::v-deep .el-dialog .material-dialog {
|
||||
// 表单标签文字样式
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
|
||||
<el-form-item label="营养信息类别" prop="status" >
|
||||
<el-form-item label="营养信息类别" prop="type" >
|
||||
<el-cascader
|
||||
v-model="selectedOptions"
|
||||
v-model="typeSelected"
|
||||
:options="cascaderOptions"
|
||||
@change="handleChange"
|
||||
></el-cascader>
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
<!-- 添加或修改岗位对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="190px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="180px" label-position="left">
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
|
|
@ -91,10 +91,6 @@
|
|||
<el-cascader
|
||||
v-model="form.nutritionCategory"
|
||||
:options="cascaderOptions"
|
||||
:props="{
|
||||
checkStrictly: false,
|
||||
emitPath: true
|
||||
}"
|
||||
placeholder="请选择营养信息类别"
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
|
|
@ -124,7 +120,9 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<div style="font-size: 18px;font-weight: bold;margin-bottom: 20px;">
|
||||
营养信息
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="加工时间(min)">
|
||||
|
|
@ -484,13 +482,14 @@ export default {
|
|||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
nutritionCode: undefined,
|
||||
nutritionName: undefined,
|
||||
status: undefined,
|
||||
type: undefined,
|
||||
bigType: undefined,
|
||||
littleType: undefined
|
||||
},
|
||||
|
|
@ -539,10 +538,9 @@ export default {
|
|||
{ required: true, message: "食材编码不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
|
||||
selectedOptions: [], // 级联选择器的选中值
|
||||
cascaderOptions: [] // 级联选择器的选项
|
||||
|
||||
typeSelected: [], // 级联选择器的选中值
|
||||
typeTreeData:[],//类别接口返回数据(未处理)
|
||||
cascaderOptions: [] // 级联选择器的选项(已处理)
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -558,34 +556,28 @@ export default {
|
|||
*/
|
||||
getFoodType() {
|
||||
typeList().then(response => {
|
||||
this.queryParams.status = response.data;
|
||||
this.updateCascaderOptions(); // 在获取数据后更新级联选择器选项
|
||||
this.typeTreeData = response.data;
|
||||
this.cascaderOptions = this.cascaderOptionsMethod();
|
||||
console.log(this.cascaderOptions)
|
||||
// this.updateCascaderOptions(); // 在获取数据后更新级联选择器选项
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch food types:", error);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新级联选择器选项
|
||||
* @returns {void}
|
||||
*/
|
||||
updateCascaderOptions() {
|
||||
this.cascaderOptions = this.cascaderOptionsMethod();
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* 生成级联选择器的选项数据
|
||||
* @returns {Array<{value: string, label: string, children: Array<{value: string, label: string}>}>}
|
||||
*/
|
||||
cascaderOptionsMethod() {
|
||||
if (!this.queryParams.status) {
|
||||
if (this.typeTreeData.length==0) {
|
||||
return [];
|
||||
}
|
||||
return this.queryParams.status.map(item => ({
|
||||
return this.typeTreeData.map(item => ({
|
||||
value: item.bigType,
|
||||
label: item.bigType,
|
||||
children: item.littleTypeList.map(subItem => ({
|
||||
value: subItem,
|
||||
value: '#'+subItem,//父子类别value一致时选中识别不出来,加个#号区分
|
||||
label: subItem
|
||||
}))
|
||||
}));
|
||||
|
|
@ -596,9 +588,10 @@ export default {
|
|||
* @param {Array<string>} value - 选中的值数组
|
||||
*/
|
||||
handleChange(value) {
|
||||
console.log(value)
|
||||
if (value && value.length >= 2) {
|
||||
this.queryParams.bigType = value[0];
|
||||
this.queryParams.littleType = value[1];
|
||||
this.queryParams.littleType = value[1].split("#")[1];
|
||||
} else {
|
||||
this.queryParams.bigType = undefined;
|
||||
this.queryParams.littleType = undefined;
|
||||
|
|
@ -667,7 +660,7 @@ export default {
|
|||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.selectedOptions = []; // 清空级联选择器的选中值
|
||||
this.typeSelected = []; // 清空级联选择器的选中值
|
||||
this.queryParams.bigType = undefined;
|
||||
this.queryParams.littleType = undefined;
|
||||
this.handleQuery();
|
||||
|
|
@ -703,7 +696,7 @@ export default {
|
|||
// 处理营养信息类别,转换为后端需要的格式
|
||||
if (formData.nutritionCategory && formData.nutritionCategory.length >= 2) {
|
||||
formData.bigType = formData.nutritionCategory[0];
|
||||
formData.littleType = formData.nutritionCategory[1];
|
||||
formData.littleType = formData.nutritionCategory[1].split("#")[1];
|
||||
}
|
||||
delete formData.nutritionCategory; // 删除多余的字段
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue