原料管理接口对接
This commit is contained in:
parent
e098b0c988
commit
0dad103565
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
||||||
// 原料类别树
|
// 原料类别树
|
||||||
export function systemMaterialTreeApi(data) {
|
export function systemMaterialTreeApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material_category/getTree',
|
url: '/smart-canteen/cook_material_type/getTree',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -14,7 +14,7 @@ export function systemMaterialTreeApi(data) {
|
||||||
// 新增原料类别
|
// 新增原料类别
|
||||||
export function addMaterialTypeApi(data) {
|
export function addMaterialTypeApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material_category/add',
|
url: '/smart-canteen/cook_material_type/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -25,7 +25,7 @@ export function addMaterialTypeApi(data) {
|
||||||
//修改原料类别
|
//修改原料类别
|
||||||
export function updateMaterialTypeApi(data) {
|
export function updateMaterialTypeApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material_category/edit',
|
url: '/smart-canteen/cook_material_type/edit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -36,19 +36,18 @@ export function updateMaterialTypeApi(data) {
|
||||||
//删除原料类别
|
//删除原料类别
|
||||||
export function removeMaterialTypeApi(data) {
|
export function removeMaterialTypeApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material_category/del',
|
url: '/smart-canteen/cook_material_type/del/'+data.id,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
},
|
}
|
||||||
data: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询原料列表
|
// 查询原料列表
|
||||||
export function getMaterialListApi(data) {
|
export function getMaterialListApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material/list',
|
url: '/smart-canteen/cook_material/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -60,7 +59,7 @@ export function getMaterialListApi(data) {
|
||||||
// 新增原料
|
// 新增原料
|
||||||
export function addMaterialApi(data) {
|
export function addMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material/addMessage',
|
url: '/smart-canteen/cook_material/add',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -72,7 +71,7 @@ export function addMaterialApi(data) {
|
||||||
// 编辑原料
|
// 编辑原料
|
||||||
export function updateMaterialApi(data) {
|
export function updateMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material/edit',
|
url: '/smart-canteen/cook_material/edit',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
|
|
@ -84,14 +83,18 @@ export function updateMaterialApi(data) {
|
||||||
// 删除原料
|
// 删除原料
|
||||||
export function removeMaterialApi(data) {
|
export function removeMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material/del',
|
url: '/smart-canteen/cook_material/del/'+data.materialId,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
},
|
}
|
||||||
data: data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除原料
|
// 批量删除原料
|
||||||
export function batchRemoveMaterialApi(data) {
|
export function batchRemoveMaterialApi(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
@ -118,12 +121,12 @@ export function batchUpdateMaterialApi(data) {
|
||||||
//{current: 1, size: -1, ifListUse: 1, areaId: '421488254718578688'}
|
//{current: 1, size: -1, ifListUse: 1, areaId: '421488254718578688'}
|
||||||
export function getDrpUnitListApi(data) {
|
export function getDrpUnitListApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/smart-canteen/menu_material/getDrpUnit',
|
url: '/smart-canteen/supply_product_unit/list',
|
||||||
method: 'post',
|
method: 'get',
|
||||||
headers: {
|
headers: {
|
||||||
"merchant-id":"378915229716713472",
|
"merchant-id":"378915229716713472",
|
||||||
},
|
},
|
||||||
data: data
|
params: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ export function delNutrition(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 查询详细数据
|
// 查询详细数据
|
||||||
export function getNutritionInfo(data) {
|
export function getNutritionInfo(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
@ -79,23 +78,6 @@ export function getNutritionInfo(data) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取所有营养信息
|
// 获取所有营养信息
|
||||||
export function nutritionAllListApi(data) {
|
export function nutritionAllListApi(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,16 @@
|
||||||
<el-tab-pane label="基础信息" name="basic">
|
<el-tab-pane label="基础信息" name="basic">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
<el-row>
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="原料编号" prop="materialCode">
|
||||||
|
<el-input
|
||||||
|
v-model="form.materialCode"
|
||||||
|
placeholder="请输入原料编号"
|
||||||
|
maxlength="40"
|
||||||
|
show-word-limit
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="原料名称" prop="materialName">
|
<el-form-item label="原料名称" prop="materialName">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -24,8 +34,8 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="原料类别" prop="categoryId">
|
<el-form-item label="原料类别" prop="materialTypeId">
|
||||||
<el-cascader v-model="form.categoryId"
|
<el-cascader v-model="form.materialTypeId"
|
||||||
:options="treeTypeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
:options="treeTypeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
|
||||||
:props="{
|
:props="{
|
||||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||||
|
|
@ -47,14 +57,14 @@
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="计量类型" prop="salesMode" >
|
<el-form-item label="计量类型" prop="salesMode" >
|
||||||
<el-select v-model="form.salesMode" placeholder="请选择计量类型" style="width: 100%" @change="getDrpUnitList">
|
<el-select v-model="form.salesMode" placeholder="请选择计量类型" style="width: 100%" @change="getDrpUnitList">
|
||||||
<el-option label="按份" value="1" />
|
<el-option label="按份" value="1" />
|
||||||
<el-option label="称重" value="2" />
|
<el-option label="称重" value="2" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col> -->
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="原料单位" prop="unitId">
|
<el-form-item label="原料单位" prop="unitId">
|
||||||
<el-select v-model="form.unitId" placeholder="请选择原料单位" style="width: 100%">
|
<el-select v-model="form.unitId" placeholder="请选择原料单位" style="width: 100%">
|
||||||
|
|
@ -89,14 +99,14 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col> -->
|
</el-col> -->
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="营养信息类别" prop="nutritionType">
|
<el-form-item label="营养信息类别" prop="nutritionTypeId">
|
||||||
<el-cascader
|
<el-cascader
|
||||||
v-model="form.nutritionType"
|
v-model="form.nutritionTypeId"
|
||||||
:options="cascaderOptions"
|
:options="cascaderOptions"
|
||||||
:props="{
|
:props="{
|
||||||
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id
|
||||||
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
|
||||||
value:'value',label:'label'
|
value:'id',label:'label'
|
||||||
}"
|
}"
|
||||||
placeholder="请选择营养信息类别"
|
placeholder="请选择营养信息类别"
|
||||||
clearable style="width: 100%;"
|
clearable style="width: 100%;"
|
||||||
|
|
@ -105,61 +115,16 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="营养信息" prop="categoryId">
|
<el-form-item label="营养信息" prop="nutritionId">
|
||||||
<el-select v-model="form.categoryId" placeholder="请选择营养信息" style="width: 100%" clearable @change="chosenNutrition">
|
<el-select v-model="form.nutritionId" placeholder="请选择营养信息" style="width: 100%" clearable @change="chosenNutrition">
|
||||||
<el-option v-for="item in this.nutritionOptions"
|
<el-option v-for="item in this.nutritionOptions"
|
||||||
:key="item.categoryId"
|
:key="item.nutritionId"
|
||||||
:label="item.categoryName"
|
:label="item.nutritionName"
|
||||||
:value="item.categoryId"
|
:value="item.nutritionId"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="12">
|
|
||||||
<el-form-item label="保质期">
|
|
||||||
<el-select v-model="form.shelfLifeType" style="width: 80px; margin-left: 10px">
|
|
||||||
<el-option label="按年" value="1" />
|
|
||||||
<el-option label="按月" value="2" />
|
|
||||||
<el-option label="按日" value="3" />
|
|
||||||
</el-select>
|
|
||||||
<el-input v-model="form.shelfLifeDays" placeholder="请输入" style="width: 120px;margin-right: 10px;" @input="(v)=>(form.shelfLifeDays=v.replace(/[^\d]/g,''))"/>
|
|
||||||
<span v-if="form.shelfLifeType==1">年</span>
|
|
||||||
<span v-if="form.shelfLifeType==2">月</span>
|
|
||||||
<span v-if="form.shelfLifeType==3">日</span>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="采购上限价格" prop="purPriceCeiling">
|
|
||||||
<el-input
|
|
||||||
v-model="form.purPriceCeiling"
|
|
||||||
placeholder="请输入采购上限价格"
|
|
||||||
@input="handleNumericInput('purPriceCeiling', $event)"
|
|
||||||
@blur="formatNumericValue('purPriceCeiling')"
|
|
||||||
>
|
|
||||||
<template slot="append">元</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="原料规格" prop="size">
|
|
||||||
<el-input v-model="form.size" placeholder="请输入原料规格" maxlength="20">
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="原料税率" prop="taxRate">
|
|
||||||
<el-select v-model="form.taxRate" placeholder="请选择原料税率" style="width: 100%">
|
|
||||||
<el-option label="0%" :value="0" />
|
|
||||||
<el-option label="1%" :value="1" />
|
|
||||||
<el-option label="2%" :value="2" />
|
|
||||||
<el-option label="3%" :value="3" />
|
|
||||||
<el-option label="5%" :value="5" />
|
|
||||||
<el-option label="6%" :value="6" />
|
|
||||||
<el-option label="9%" :value="9" />
|
|
||||||
<el-option label="13%" :value="13"/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col> -->
|
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<h3>营养信息</h3>
|
<h3>营养信息</h3>
|
||||||
<el-row class="nutrition-info">
|
<el-row class="nutrition-info">
|
||||||
|
|
@ -202,27 +167,11 @@
|
||||||
<el-table-column label="硒(μg/100g)" prop="selenium" align="center" width="140"></el-table-column>
|
<el-table-column label="硒(μg/100g)" prop="selenium" align="center" width="140"></el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="12" v-for="(item, index) in nutritionFields" :key="index">
|
|
||||||
<el-form-item :label="item.label" :prop="'menuMaterialNutritionDTO.' + item.prop">
|
|
||||||
<el-input
|
|
||||||
v-model="form.menuMaterialNutritionDTO[item.prop]"
|
|
||||||
:placeholder="'请输入' + item.label" disabled
|
|
||||||
@input="handleNumericInput('menuMaterialNutritionDTO.' + item.prop, $event)"
|
|
||||||
@blur="formatNumericValue('menuMaterialNutritionDTO.' + item.prop)"
|
|
||||||
>
|
|
||||||
<template slot="append">{{item.unit}}</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col> -->
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<!-- <el-tab-pane label="原料识别注册图" name="image">
|
|
||||||
这里添加图片上传组件
|
|
||||||
</el-tab-pane> -->
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
@ -254,12 +203,9 @@ export default {
|
||||||
treeAreaOptions:[],//区域树
|
treeAreaOptions:[],//区域树
|
||||||
treeTypeOptions:[],//类型树
|
treeTypeOptions:[],//类型树
|
||||||
unitOptions:[],//单位下拉
|
unitOptions:[],//单位下拉
|
||||||
|
|
||||||
nutritionTypeTreeData:[],//类别接口返回数据(未处理)
|
nutritionTypeTreeData:[],//类别接口返回数据(未处理)
|
||||||
cascaderOptions: [], // 级联选择器的选项(已处理)
|
cascaderOptions: [], // 级联选择器的选项(已处理)
|
||||||
nutritionOptions:[],
|
nutritionOptions:[],
|
||||||
bigType:"",
|
|
||||||
littleType:"",
|
|
||||||
menuMaterialNutritionDTO:{
|
menuMaterialNutritionDTO:{
|
||||||
processingTime: '0',//加工时间(min)
|
processingTime: '0',//加工时间(min)
|
||||||
edible: '0',//可食部分(g/100g)
|
edible: '0',//可食部分(g/100g)
|
||||||
|
|
@ -292,29 +238,16 @@ export default {
|
||||||
iodine: '0'
|
iodine: '0'
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
|
materialCode: '',//原料名称
|
||||||
materialName: '',//原料名称
|
materialName: '',//原料名称
|
||||||
areaId: null,//所属区域
|
areaId: null,//所属区域
|
||||||
categoryId: null,//原料类别
|
materialTypeId: null,//原料类别
|
||||||
materialType: 1,
|
salesMode: '1',//计量类型
|
||||||
salesMode: '2',//计量类型
|
|
||||||
unitId: '',//原料单位
|
unitId: '',//原料单位
|
||||||
unitPrice: '',//原料进价(元)
|
unitPrice: '',//原料进价(元)
|
||||||
barCode: '',//条码
|
barCode: '',//条码
|
||||||
nutritionType:null,//营养信息类型
|
nutritionTypeId:null,//营养信息类型
|
||||||
categoryId:null,//营养信息
|
nutritionId:null,//营养信息
|
||||||
shelfLifeType:"1",//保质期类型
|
|
||||||
shelfLifeDays:"",//保质期
|
|
||||||
purPriceCeiling:'',//采购上限价格
|
|
||||||
size:'',//原料规格
|
|
||||||
taxRate:'',//原料税率
|
|
||||||
// safeConfigDTO:{
|
|
||||||
// ifNeedDetect: '2',//是否检测(1是2否)
|
|
||||||
// detectInstitution:'1',//检测机构(1自检,2供应商检,3自检或供应商检,4自检且供应商检)
|
|
||||||
// detectItem:"1",//
|
|
||||||
// },
|
|
||||||
// qualificationCert: '',
|
|
||||||
// firstProcessList: [''],
|
|
||||||
// cutProcessList: [''],
|
|
||||||
//营养信息
|
//营养信息
|
||||||
menuMaterialNutritionDTO: {}
|
menuMaterialNutritionDTO: {}
|
||||||
},
|
},
|
||||||
|
|
@ -354,7 +287,7 @@ export default {
|
||||||
rules: {
|
rules: {
|
||||||
materialName: [{ required: true, message: '请输入原料名称', trigger: 'blur' }],
|
materialName: [{ required: true, message: '请输入原料名称', trigger: 'blur' }],
|
||||||
areaId: [{ required: true, message: '请选择所属区域', trigger: 'change' }],
|
areaId: [{ required: true, message: '请选择所属区域', trigger: 'change' }],
|
||||||
categoryId: [{ required: true, message: '请选择原料类别', trigger: 'change' }],
|
materialTypeId: [{ required: true, message: '请选择原料类别', trigger: 'change' }],
|
||||||
salesMode: [{ required: true, message: '请选择计量类型', trigger: 'change' }],
|
salesMode: [{ required: true, message: '请选择计量类型', trigger: 'change' }],
|
||||||
// unitId: [{ required: true, message: '请选择原料单位', trigger: 'change' }]
|
// unitId: [{ required: true, message: '请选择原料单位', trigger: 'change' }]
|
||||||
},
|
},
|
||||||
|
|
@ -399,29 +332,25 @@ export default {
|
||||||
this.getAreaTreeData();//获取区域树
|
this.getAreaTreeData();//获取区域树
|
||||||
this.getTypeTreeData();//获取原料类别树
|
this.getTypeTreeData();//获取原料类别树
|
||||||
this.getDrpUnitList();//获取单位类型下拉
|
this.getDrpUnitList();//获取单位类型下拉
|
||||||
this.getNutritionType()//获取营养信息类别树
|
this.getNutritionTypeList()//获取营养信息类别树
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//区域树
|
//区域树
|
||||||
getAreaTreeData() {
|
getAreaTreeData() {
|
||||||
systemAreaTreeApi({}).then((response) => {
|
systemAreaTreeApi({}).then((response) => {
|
||||||
this.treeAreaOptions = response.data;
|
this.treeAreaOptions = response.data;
|
||||||
console.log(this.treeAreaOptions)
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//基础设置-选择区域
|
//基础设置-选择区域
|
||||||
handleAreaChange(val){
|
handleAreaChange(val){
|
||||||
console.log(this.form)
|
// this.form.categoryId=null
|
||||||
this.form.categoryId=null
|
// this.getTypeTreeData()
|
||||||
this.getTypeTreeData()
|
// this.getDrpUnitList()
|
||||||
this.getDrpUnitList()
|
|
||||||
},
|
},
|
||||||
//类型树
|
//类型树
|
||||||
getTypeTreeData() {
|
getTypeTreeData() {
|
||||||
let param = {
|
let param = {
|
||||||
categoryType:1,
|
// areaId:this.form.areaId
|
||||||
ifAdd: 1,
|
|
||||||
areaId:this.form.areaId
|
|
||||||
}
|
}
|
||||||
systemMaterialTreeApi(param).then((response) => {
|
systemMaterialTreeApi(param).then((response) => {
|
||||||
this.treeTypeOptions = response.data;
|
this.treeTypeOptions = response.data;
|
||||||
|
|
@ -430,90 +359,62 @@ export default {
|
||||||
//单位类型拉下选
|
//单位类型拉下选
|
||||||
getDrpUnitList() {
|
getDrpUnitList() {
|
||||||
let param = {
|
let param = {
|
||||||
weighType:this.form.salesMode,
|
"weighType":this.form.salesMode,
|
||||||
// areaId: this.form.areaId||""
|
"pageNum": 1,
|
||||||
// ifListUse: 1,
|
"pageSize": 100
|
||||||
// current: 1,
|
|
||||||
// size: -1
|
|
||||||
}
|
}
|
||||||
this.form.unitId=null
|
this.form.unitId=null
|
||||||
getDrpUnitListApi(param).then((response) => {
|
getDrpUnitListApi(param).then((response) => {
|
||||||
this.unitOptions = response.data;
|
this.unitOptions = response.rows;
|
||||||
// if(response.data.records.length>0){
|
|
||||||
// response.data.records.forEach(item => {
|
|
||||||
// if(item.weighType==this.form.salesMode){
|
|
||||||
// this.unitOptions.push(item)
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//获取营养类别
|
//获取营养信息类别
|
||||||
getNutritionType() {
|
getNutritionTypeList() {
|
||||||
nutritionTypeListApi().then(response => {
|
nutritionTypeListApi().then(response => {
|
||||||
this.nutritionTypeTreeData = response.data;
|
this.typeTreeData = response.data;
|
||||||
this.cascaderOptions = this.cascaderOptionsMethod();
|
this.cascaderOptions = this.cascaderOptionsMethod();
|
||||||
console.log(this.cascaderOptions)
|
|
||||||
// this.updateCascaderOptions(); // 在获取数据后更新级联选择器选项
|
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error("Failed to fetch food types:", error);
|
console.error("Failed to fetch food types:", error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//生成级联选择器的选项数据
|
//生成级联选择器的选项数据
|
||||||
cascaderOptionsMethod() {
|
cascaderOptionsMethod() {
|
||||||
if (this.nutritionTypeTreeData.length==0) {
|
if (this.typeTreeData.length==0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return this.nutritionTypeTreeData.map(item => ({
|
return this.typeTreeData.map(item => ({
|
||||||
value: item.id,
|
id: item.id,
|
||||||
label: item.bigType,
|
label: item.name,
|
||||||
parentId:0,
|
parentId:0,
|
||||||
level:1,
|
level:0,
|
||||||
children: item.littleTypeList.map(subItem => ({
|
children: item.littleTypeList.map(subItem => ({
|
||||||
value: subItem.id,//父子类别value一致时选中识别不出来,加个#号区分
|
id: subItem.id,//父子类别value一致时选中识别不出来,加个#号区分
|
||||||
label: subItem.bigType,
|
label: subItem.name,
|
||||||
bigType: item.bigType,
|
bigType: item.name,
|
||||||
parentId:item.id,
|
parentId:item.id,
|
||||||
level:2
|
level:1
|
||||||
}))
|
}))
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// 获取父节点的类别名称
|
|
||||||
getParentCategoryName(Id) {
|
|
||||||
const findNode = (nodes) => {
|
|
||||||
for (let node of nodes) {
|
|
||||||
if (node.value == Id) {
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
if (node.children) {
|
|
||||||
const result = findNode(node.children);
|
|
||||||
if (result) return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
};
|
|
||||||
return findNode(this.cascaderOptions);
|
|
||||||
},
|
|
||||||
//选中营养信息类别
|
//选中营养信息类别
|
||||||
handleNutritionChange(value) {
|
handleNutritionChange(value) {
|
||||||
console.log("选中营养信息类别",value)
|
console.log("选中营养信息类别",value)
|
||||||
// this.nutritionAllList()
|
this.nutritionAllList(value)
|
||||||
|
|
||||||
},
|
},
|
||||||
//获取营养信息下拉
|
//获取营养信息下拉
|
||||||
nutritionAllList(){
|
nutritionAllList(value){
|
||||||
let param = {
|
let param = {
|
||||||
|
categoryId:value
|
||||||
}
|
}
|
||||||
nutritionAllListApi(param).then((response) => {
|
nutritionAllListApi(param).then((response) => {
|
||||||
this.$set(this.form,"categoryId",null)
|
this.$set(this.form,"nutritionId",null)
|
||||||
this.nutritionOptions = response.data;
|
this.nutritionOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//选中营养信息
|
//选中营养信息
|
||||||
chosenNutrition(){
|
chosenNutrition(){
|
||||||
console.log("选中营养信息",this.form.categoryId)
|
console.log("选中营养信息",this.form.nutritionId)
|
||||||
getNutritionInfo({categoryId: this.form.categoryId}).then((response) => {
|
getNutritionInfo({nutritionId: this.form.nutritionId}).then((response) => {
|
||||||
if(response.data){
|
if(response.data){
|
||||||
this.form.menuMaterialNutritionDTO = response.data
|
this.form.menuMaterialNutritionDTO = response.data
|
||||||
this.formTable = [this.form.menuMaterialNutritionDTO]
|
this.formTable = [this.form.menuMaterialNutritionDTO]
|
||||||
|
|
@ -523,9 +424,6 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handleNumericInput(field, event) {
|
handleNumericInput(field, event) {
|
||||||
// const value = event.target.value;
|
// const value = event.target.value;
|
||||||
const value = event;
|
const value = event;
|
||||||
|
|
@ -551,7 +449,6 @@ export default {
|
||||||
this.form[field] = newValue;
|
this.form[field] = newValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
formatNumericValue(field) {
|
formatNumericValue(field) {
|
||||||
let value;
|
let value;
|
||||||
if (field.includes('.')) {
|
if (field.includes('.')) {
|
||||||
|
|
@ -593,50 +490,27 @@ export default {
|
||||||
|
|
||||||
setFormData(row){
|
setFormData(row){
|
||||||
console.log(row)
|
console.log(row)
|
||||||
|
// this.getTypeTreeData()
|
||||||
|
// this.getDrpUnitList()
|
||||||
this.$set(this.form,"areaId",row.areaId)
|
this.$set(this.form,"areaId",row.areaId)
|
||||||
this.getTypeTreeData()
|
|
||||||
this.getDrpUnitList()
|
|
||||||
this.$set(this.form,"id",row.id)
|
|
||||||
this.$set(this.form,"areaName",row.areaName)
|
this.$set(this.form,"areaName",row.areaName)
|
||||||
this.$set(this.form,"categoryId",row.categoryId)
|
this.$set(this.form,"materialTypeId",row.materialTypeId)
|
||||||
this.$set(this.form,"categoryName",row.categoryName)
|
this.$set(this.form,"materialTypeName",row.materialTypeName)
|
||||||
this.$set(this.form,"materialCode",row.materialCode)
|
this.$set(this.form,"materialCode",row.materialCode)
|
||||||
this.$set(this.form,"materialId",row.materialId)
|
this.$set(this.form,"materialId",row.materialId)
|
||||||
this.$set(this.form,"materialName",row.materialName)
|
this.$set(this.form,"materialName",row.materialName)
|
||||||
this.$set(this.form,"materialType",row.materialType)
|
|
||||||
this.$set(this.form,"salesMode",row.salesMode+'')
|
this.$set(this.form,"salesMode",row.salesMode+'')
|
||||||
|
this.getDrpUnitList()
|
||||||
this.$set(this.form,"unitId",row.unitId)
|
this.$set(this.form,"unitId",row.unitId)
|
||||||
this.$set(this.form,"unitPrice",Number((row.unitPrice/100).toFixed(2)))
|
this.$set(this.form,"unitPrice",Number((row.unitPrice/100).toFixed(2)))
|
||||||
this.$set(this.form,"barCode",row.barCode)
|
this.$set(this.form,"barCode",row.barCode)
|
||||||
|
if(row.nutritionTypeId){
|
||||||
if(row.shelfLifeType){
|
this.$set(this.form,"nutritionTypeId",Number(row.nutritionTypeId))
|
||||||
this.$set(this.form,"shelfLifeType",row.shelfLifeType+"")
|
this.nutritionAllList(this.form.nutritionTypeId)
|
||||||
}else{
|
|
||||||
this.$set(this.form,"shelfLifeType","1")
|
|
||||||
}
|
|
||||||
this.$set(this.form,"shelfLifeDays",row.shelfLifeDays)
|
|
||||||
this.$set(this.form,"purPriceCeiling",Number((row.purPriceCeiling/100).toFixed(2)))
|
|
||||||
this.$set(this.form,"size",row.size)
|
|
||||||
this.$set(this.form,"taxRate",row.taxRate)
|
|
||||||
|
|
||||||
// this.$set(this.form.safeConfigDTO,"ifNeedDetect",row.safeConfigDTO.ifNeedDetect+'')
|
|
||||||
// this.$set(this.form.safeConfigDTO,"detectInstitution",row.safeConfigDTO.detectInstitution+'')
|
|
||||||
// this.$set(this.form.safeConfigDTO,"detectItem",row.safeConfigDTO.detectItem+'')
|
|
||||||
|
|
||||||
// this.$set(this.form,"qualificationCert","")
|
|
||||||
// this.$set(this.form,"firstProcessList",row.firstProcessList)
|
|
||||||
// this.$set(this.form,"cutProcessList",row.cutProcessList)
|
|
||||||
|
|
||||||
if(row.nutritionType){
|
|
||||||
this.$set(this.form,"nutritionType",Number(row.nutritionType))
|
|
||||||
let obj = this.getParentCategoryName(row.nutritionType)
|
|
||||||
this.bigType = obj.bigType
|
|
||||||
this.littleType = obj.label
|
|
||||||
this.nutritionAllList()
|
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.$set(this.form,"categoryId",row.categoryId)
|
this.$set(this.form,"nutritionId",row.nutritionId)
|
||||||
if(this.form.categoryId){
|
if(this.form.nutritionId){
|
||||||
getNutritionInfo({categoryId: this.form.categoryId}).then((response) => {
|
getNutritionInfo({nutritionId: this.form.nutritionId}).then((response) => {
|
||||||
if(response.data){
|
if(response.data){
|
||||||
this.form.menuMaterialNutritionDTO = response.data
|
this.form.menuMaterialNutritionDTO = response.data
|
||||||
this.formTable = [this.form.menuMaterialNutritionDTO]
|
this.formTable = [this.form.menuMaterialNutritionDTO]
|
||||||
|
|
@ -649,63 +523,44 @@ export default {
|
||||||
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
||||||
this.formTable = [this.menuMaterialNutritionDTO]
|
this.formTable = [this.menuMaterialNutritionDTO]
|
||||||
}
|
}
|
||||||
},800)
|
},600)
|
||||||
}else{
|
}else{
|
||||||
this.$set(this.form,"nutritionType",null)
|
this.$set(this.form,"nutritionType",null)
|
||||||
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
this.form.menuMaterialNutritionDTO = this.menuMaterialNutritionDTO
|
||||||
this.formTable = [this.menuMaterialNutritionDTO]
|
this.formTable = [this.menuMaterialNutritionDTO]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.form.unitPrice = Number(this.form.unitPrice)*100
|
this.form.unitPrice = Number(this.form.unitPrice)*100
|
||||||
this.form.purPriceCeiling = Number(this.form.purPriceCeiling)*100
|
|
||||||
this.$emit('submit', this.form);
|
this.$emit('submit', this.form);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.$emit('update:visible', false);
|
this.$emit('update:visible', false);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.reset();
|
this.reset();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$emit('update:visible', false);
|
this.$emit('update:visible', false);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.reset();
|
this.reset();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
materialName: '',//原料名称
|
materialName: '',//原料名称
|
||||||
areaId: null,//所属区域
|
areaId: null,//所属区域
|
||||||
categoryId: null,//原料类别
|
materialTypeId: null,//原料类别
|
||||||
materialType: 1,
|
salesMode: '1',//计量类型
|
||||||
salesMode: '2',//计量类型
|
|
||||||
unitId: '',//原料单位
|
unitId: '',//原料单位
|
||||||
unitPrice: '',//原料进价(元)
|
unitPrice: '',//原料进价(元)
|
||||||
barCode: '',//条码
|
barCode: '',//条码
|
||||||
nutritionType:null,//营养信息类型
|
nutritionType:null,//营养信息类型
|
||||||
categoryId:null,//营养信息
|
nutritionId:null,//营养信息
|
||||||
shelfLifeType:"1",//保质期类型
|
|
||||||
shelfLifeDays:"",//保质期
|
|
||||||
purPriceCeiling:'',//采购上限价格
|
|
||||||
size:'',//原料规格
|
|
||||||
taxRate:'',//原料税率
|
|
||||||
// safeConfigDTO:{
|
|
||||||
// ifNeedDetect: '2',//是否检测(1是2否)
|
|
||||||
// detectInstitution:'1',//检测机构(1自检,2供应商检,3自检或供应商检,4自检且供应商检)
|
|
||||||
// detectItem:"1",//
|
|
||||||
// },
|
|
||||||
// qualificationCert: '',
|
|
||||||
// firstProcessList: [''],
|
|
||||||
// cutProcessList: [''],
|
|
||||||
//营养信息
|
//营养信息
|
||||||
menuMaterialNutritionDTO: this.menuMaterialNutritionDTO
|
menuMaterialNutritionDTO: this.menuMaterialNutritionDTO
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
size="mini"
|
size="mini"
|
||||||
icon="el-icon-plus" v-if="data.level<2"
|
icon="el-icon-plus" v-if="data.level<1"
|
||||||
@click.stop="() => appendTreeNode(data)"
|
@click.stop="() => appendTreeNode(data)"
|
||||||
>
|
>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
style="color: #f56c6c"
|
style="color: #f56c6c"
|
||||||
v-if="data.parentId != '-1'"
|
v-if="data.parentId != '0'"
|
||||||
@click.stop="() => removeTreeNode(data)"
|
@click.stop="() => removeTreeNode(data)"
|
||||||
>
|
>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -98,15 +98,6 @@
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="条码" prop="barCode">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.barCode"
|
|
||||||
placeholder="请输入条码"
|
|
||||||
clearable maxlength="30"
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label="原料编码" prop="materialCode">
|
<el-form-item label="原料编码" prop="materialCode">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.materialCode"
|
v-model="queryParams.materialCode"
|
||||||
|
|
@ -141,7 +132,7 @@
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
plain
|
plain
|
||||||
|
|
@ -149,7 +140,7 @@
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleBatchDel"
|
@click="handleBatchDel"
|
||||||
>批量删除</el-button>
|
>批量删除</el-button>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
|
@ -198,7 +189,7 @@
|
||||||
</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="categoryName" prop="categoryName" :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"/>
|
||||||
|
|
@ -266,44 +257,17 @@
|
||||||
}" 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="categoryName">
|
<el-form-item label="原料类别" prop="materialTypeName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.categoryName"
|
v-model="form.materialTypeName"
|
||||||
placeholder="请输入原料类别"
|
placeholder="请输入原料类别"
|
||||||
maxlength="30"
|
maxlength="30"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- <el-row v-if="isEditType">
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="原类别父节点" prop="superAreaName">
|
|
||||||
<el-input
|
|
||||||
v-model="form.superAreaName"
|
|
||||||
disabled
|
|
||||||
placeholder="原类别父节点"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<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>
|
</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>
|
||||||
|
|
@ -311,18 +275,19 @@
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
<!-- 批量修改原料类别对话框 -->
|
<!-- 批量修改原料类别对话框 -->
|
||||||
<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="categoryNames">
|
<el-form-item label="原料名称" prop="materialTypeName">
|
||||||
<el-input v-model="editForm.categoryNames" 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"
|
||||||
|
|
@ -335,7 +300,7 @@
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
</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="handleSubmitEdit">确 定</el-button>
|
<el-button type="primary" @click="handleSubmitEdit">确 定</el-button>
|
||||||
|
|
@ -391,9 +356,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
areaId:null,
|
areaId:null,
|
||||||
materialName:"",
|
materialName:"",
|
||||||
barCode:"",
|
|
||||||
materialCode:"",
|
materialCode:"",
|
||||||
materialType:1, //类型(1原料2商品)
|
|
||||||
categoryIdList:[]
|
categoryIdList:[]
|
||||||
},
|
},
|
||||||
// 总条数
|
// 总条数
|
||||||
|
|
@ -407,14 +370,13 @@ export default {
|
||||||
title: "",
|
title: "",
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {
|
||||||
categoryName: "",
|
materialTypeName: "",
|
||||||
parentId: "",
|
parentId: "",
|
||||||
categoryType: "",
|
goodsType: "",
|
||||||
superAreaName: "",
|
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
categoryName: [
|
materialTypeName: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: "类别名称不能为空",
|
message: "类别名称不能为空",
|
||||||
|
|
@ -427,8 +389,8 @@ export default {
|
||||||
batchIds:[],
|
batchIds:[],
|
||||||
openEdit:false,
|
openEdit:false,
|
||||||
editForm:{
|
editForm:{
|
||||||
categoryNames:"",
|
materialTypeName:"",
|
||||||
categroyId:null
|
materialTypeId:null
|
||||||
},
|
},
|
||||||
editRules: {
|
editRules: {
|
||||||
categroyId: [
|
categroyId: [
|
||||||
|
|
@ -472,7 +434,6 @@ export default {
|
||||||
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)
|
||||||
this.queryParams.materialType=this.treeOptions[0].categoryType;
|
|
||||||
if(this.treeOptions && this.treeOptions.length > 0){
|
if(this.treeOptions && this.treeOptions.length > 0){
|
||||||
this.getList();
|
this.getList();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -502,7 +463,7 @@ export default {
|
||||||
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,"categoryType",data.categoryType)
|
this.$set(this.form,"goodsType",data.categoryType)
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "新增";
|
this.title = "新增";
|
||||||
},
|
},
|
||||||
|
|
@ -513,37 +474,20 @@ export default {
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
this.form = {
|
this.form = {
|
||||||
...data,
|
...data,
|
||||||
// categoryId:data.id,
|
|
||||||
// superAreaName: data.parentId === "-1" ? "" : this.getParentCategoryName(data.parentId)
|
|
||||||
};
|
};
|
||||||
console.log(this.form)
|
this.$set(this.form,"materialTypeId",data.id)
|
||||||
console.log(this.treeOptions)
|
this.$set(this.form,"materialTypeName",data.categoryName)
|
||||||
|
this.$set(this.form,"goodsType",data.categoryType)
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改";
|
this.title = "修改";
|
||||||
},
|
},
|
||||||
// 获取父节点的类别名称
|
|
||||||
getParentCategoryName(parentId) {
|
|
||||||
const findNode = (nodes) => {
|
|
||||||
for (let node of nodes) {
|
|
||||||
if (node.id === parentId) {
|
|
||||||
return node.categoryName;
|
|
||||||
}
|
|
||||||
if (node.children) {
|
|
||||||
const result = findNode(node.children);
|
|
||||||
if (result) return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
};
|
|
||||||
return findNode(this.treeOptions);
|
|
||||||
},
|
|
||||||
/* 树节点删除 */
|
/* 树节点删除 */
|
||||||
removeTreeNode(data) {
|
removeTreeNode(data) {
|
||||||
console.log(data, "删除时的数据源--");
|
console.log(data, "删除时的数据源--");
|
||||||
this.$modal
|
this.$modal
|
||||||
.confirm("是否确认删除数据项?")
|
.confirm("是否确认删除数据项?")
|
||||||
.then(function () {
|
.then(function () {
|
||||||
return removeMaterialTypeApi({"ids":[data.id]});
|
return removeMaterialTypeApi({"id":data.id});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
|
@ -562,14 +506,13 @@ export default {
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != undefined) {
|
if (this.form.materialTypeId != undefined) {
|
||||||
updateMaterialTypeApi(this.form).then(response => {
|
updateMaterialTypeApi(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getTreeData();
|
this.getTreeData();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(this.form)
|
|
||||||
addMaterialTypeApi(this.form).then(response => {
|
addMaterialTypeApi(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
|
@ -602,10 +545,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,
|
||||||
"barCode": this.queryParams.barCode,
|
|
||||||
"materialCode": this.queryParams.materialCode,
|
"materialCode": this.queryParams.materialCode,
|
||||||
"materialType": this.queryParams.materialType,//类型(1原料2商品)
|
"materialTypeIds": this.$refs.typeTree.getCheckedKeys(),
|
||||||
"categoryIdList": this.$refs.typeTree.getCheckedKeys(),
|
|
||||||
}
|
}
|
||||||
getMaterialListApi(params).then((response) => {
|
getMaterialListApi(params).then((response) => {
|
||||||
this.tableList = response.rows;
|
this.tableList = response.rows;
|
||||||
|
|
@ -658,7 +599,7 @@ export default {
|
||||||
this.$modal
|
this.$modal
|
||||||
.confirm("是否确认删除数据项?")
|
.confirm("是否确认删除数据项?")
|
||||||
.then(function () {
|
.then(function () {
|
||||||
return removeMaterialApi({"ids":[row.id]});
|
return removeMaterialApi({"materialId":row.materialId});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue