修改通俗计量方式

This commit is contained in:
huangdeliang 2021-02-03 17:28:45 +08:00
parent 2e3f53f2ea
commit a9cde613d9
3 changed files with 29 additions and 67 deletions

View File

@ -1,5 +1,6 @@
package com.stdiet.custom.domain; package com.stdiet.custom.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -11,6 +12,7 @@ import java.math.BigDecimal;
* @author wonder * @author wonder
* @date 2020-12-28 * @date 2020-12-28
*/ */
@Data
public class SysDishesIngredient extends SysIngredient { public class SysDishesIngredient extends SysIngredient {
private Long ingredientId; private Long ingredientId;
@ -21,68 +23,10 @@ public class SysDishesIngredient extends SysIngredient {
private BigDecimal cusWeight; private BigDecimal cusWeight;
private Integer cusWei;
private BigDecimal weight; private BigDecimal weight;
private String remark; private String remark;
@Override
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String getRemark() {
return remark;
}
public Long getIngredientId() {
return ingredientId;
}
public void setIngredientId(Long ingredientId) {
this.ingredientId = ingredientId;
}
public Long getDishesId() {
return dishesId;
}
public void setDishesId(Long dishesId) {
this.dishesId = dishesId;
}
public BigDecimal getWeight() {
return weight;
}
public void setWeight(BigDecimal weight) {
this.weight = weight;
}
public BigDecimal getCusWeight() {
return cusWeight;
}
public void setCusWeight(BigDecimal cusWeight) {
this.cusWeight = cusWeight;
}
public Long getCusUnit() {
return cusUnit;
}
public void setCusUnit(Long cusUnit) {
this.cusUnit = cusUnit;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("ingredientId", getIngredientId())
.append("dishesId", getDishesId())
.append("weight", getWeight())
.append("cusWeight", getCusWeight())
.append("cusUnit", getCusUnit())
.toString();
}
} }

View File

@ -28,6 +28,7 @@
<result property="rec" column="rec" /> <result property="rec" column="rec" />
<result property="notRec" column="not_rec" /> <result property="notRec" column="not_rec" />
<result property="cusWeight" column="cus_weight" /> <result property="cusWeight" column="cus_weight" />
<result property="cusWei" column="cus_wei" />
<result property="cusUnit" column="cus_unit" /> <result property="cusUnit" column="cus_unit" />
<result property="weight" column="weight" /> <result property="weight" column="weight" />
</resultMap> </resultMap>
@ -48,7 +49,7 @@
<sql id="selectSysIngreditentsByIdVo"> <sql id="selectSysIngreditentsByIdVo">
SELECT * FROM( SELECT * FROM(
SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_unit, remark SELECT ingredient_id AS id, ingredient_weight AS weight, cus_weight, cus_wei, cus_unit, remark
FROM sys_dishes_ingredient FROM sys_dishes_ingredient
WHERE dishes_id = #{id} WHERE dishes_id = #{id}
) dishes ) dishes
@ -148,9 +149,9 @@
</delete> </delete>
<insert id="bashInsertDishesIngredent"> <insert id="bashInsertDishesIngredent">
insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_weight, remark) values insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_wei, remark) values
<foreach collection="list" separator="," item="item" index="index"> <foreach collection="list" separator="," item="item" index="index">
(#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWeight}, #{item.remark}) (#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWei}, #{item.remark})
</foreach> </foreach>
</insert> </insert>

View File

@ -251,13 +251,21 @@
<el-table-column label="通俗计量"> <el-table-column label="通俗计量">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="cus-unit"> <span class="cus-unit">
<el-input-number <!-- <el-input-number
v-model="scope.row.cusWeight" v-model="scope.row.cusWeight"
size="mini" size="mini"
controls-position="right" controls-position="right"
step="0.5" step="0.5"
:min="0.5" :min="0.5"
/> /> -->
<el-select size="mini" v-model="scope.row.cusWei">
<el-option
v-for="dict in cusWeightOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
<el-select size="mini" v-model="scope.row.cusUnit"> <el-select size="mini" v-model="scope.row.cusUnit">
<el-option <el-option
v-for="dict in cusUnitOptions" v-for="dict in cusUnitOptions"
@ -414,6 +422,8 @@ export default {
typeOptions: [], typeOptions: [],
// //
cusUnitOptions: [], cusUnitOptions: [],
//
cusWeightOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -437,6 +447,9 @@ export default {
}); });
this.getDicts("cus_cus_unit").then((response) => { this.getDicts("cus_cus_unit").then((response) => {
this.cusUnitOptions = response.data; this.cusUnitOptions = response.data;
});
this.getDicts("cus_cus_weight").then((response) => {
this.cusWeightOptions = response.data;
}); });
this.getDicts("cus_review_status").then((response) => { this.getDicts("cus_review_status").then((response) => {
this.reviewStatusOptions = response.data; this.reviewStatusOptions = response.data;
@ -488,6 +501,9 @@ export default {
cusUnitFormat(row, column) { cusUnitFormat(row, column) {
return this.selectDictLabel(this.cusUnitOptions, row.type); return this.selectDictLabel(this.cusUnitOptions, row.type);
}, },
cusWeightFormat(row, column) {
return this.selectDictLabel(this.cusWeightOptions, row.cusWei);
},
// //
reviewStatusFormat(row, column) { reviewStatusFormat(row, column) {
return this.selectDictLabel(this.reviewStatusOptions, row.area); return this.selectDictLabel(this.reviewStatusOptions, row.area);
@ -670,7 +686,7 @@ export default {
newTableData.push({ newTableData.push({
...tmpTableObj, ...tmpTableObj,
weight: 100, weight: 100,
cusWeight: 1, cusWei: 1,
cusUnit: 1, cusUnit: 1,
}); });
} }
@ -784,7 +800,8 @@ export default {
.cus-unit .el-select .el-input__inner { .cus-unit .el-select .el-input__inner {
padding: 0 4px; padding: 0 4px;
border: unset; /* border: unset; */
text-align: center;
} }
.weight { .weight {