|
|
@@ -79,6 +79,7 @@
|
|
|
<SelectPop v-model="formData.subUnitId" :multiple="false"
|
|
|
:options="unitList.filter(it=>it.unitId != formData.unitId)"
|
|
|
:disabled="formData.unitId?!formData.flgSubUnit:true"
|
|
|
+ @on-select-label="unitChange"
|
|
|
labelKey="unitName"
|
|
|
valueKey="unitId">
|
|
|
</SelectPop>
|
|
|
@@ -88,10 +89,16 @@
|
|
|
v-if="showSubUnit">
|
|
|
<InputNumberPop ref="conversionFactor"
|
|
|
v-model="formData.conversionFactor"
|
|
|
+ @on-change="packageChange"
|
|
|
:disabled="formData.unitId?!formData.flgSubUnit:true"
|
|
|
:digits="this.digits"
|
|
|
/>
|
|
|
</DkFormItem>
|
|
|
+ <!--计算公式-->
|
|
|
+ <DkFormItem prop="calculationFormula" v-if="showSubUnit" :span="12">
|
|
|
+ <InputPop ref="calculationFormula" v-model="formData.calculationFormula"
|
|
|
+ :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
</DkForm>
|
|
|
</DkPanel>
|
|
|
<!-- 价格信息-->
|
|
|
@@ -159,10 +166,16 @@
|
|
|
<DkFormItem prop="intoQty" :label="$t('openingIvtQty')" :required="true" data-type="number">
|
|
|
<InputNumberPop ref="intoQty"
|
|
|
v-model="formData.intoQty"
|
|
|
+ @on-change="intoQtyChange"
|
|
|
:disabled="formData.unitId?!formData.flgSubUnit:true"
|
|
|
:digits="this.digits"
|
|
|
/>
|
|
|
</DkFormItem>
|
|
|
+ <!--包装数量-->
|
|
|
+ <DkFormItem prop="packageBox" v-if="showSubUnit" :required="true">
|
|
|
+ <InputPop ref="packageBox" v-model="formData.packageBox"
|
|
|
+ :disabled="true"/>
|
|
|
+ </DkFormItem>
|
|
|
<!--期初成本价-->
|
|
|
<DkFormItem prop="priceInto" :label="$t('openingIvtAmt')" :required="true" data-type="number">
|
|
|
<InputNumberPop ref="priceInto" v-model="formData.priceInto"/>
|
|
|
@@ -200,6 +213,7 @@ export default {
|
|
|
categoryList: [],
|
|
|
seriesList: [],
|
|
|
unitList: [],
|
|
|
+ originalUnitList:[],
|
|
|
formData: {
|
|
|
skuCode: null,
|
|
|
skuModel: null,
|
|
|
@@ -226,6 +240,8 @@ export default {
|
|
|
priceLimited: 0, //销售售价
|
|
|
priceOther: 0, //其他价
|
|
|
remarks: null,
|
|
|
+ calculationFormula:null,
|
|
|
+ packageBox:null,
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
@@ -251,14 +267,108 @@ export default {
|
|
|
* @date : 2024/5/27 10:46
|
|
|
*/
|
|
|
unitClear(row) {
|
|
|
+ // if (row) {
|
|
|
+ // this.digits = row['decimalPlaces']
|
|
|
+ // }
|
|
|
+ this.formData.subUnitId = null
|
|
|
+ this.formData.conversionFactor = null
|
|
|
+ this.formData.intoQty = null
|
|
|
+ this.formData.packageBox = null
|
|
|
+ if (this.formData.subUnitId && this.formData.conversionFactor && this.formData.unitId){
|
|
|
+ let unitName = null
|
|
|
+ let subUnitName = null
|
|
|
+ let units = this.originalUnitList.filter(it=>it.unitId == this.formData.unitId)
|
|
|
+ if (units && units.length > 0){
|
|
|
+ unitName = units[0].unitName;
|
|
|
+ }
|
|
|
+ let subUnits = this.originalUnitList.filter(it=>it.unitId == this.formData.subUnitId)
|
|
|
+ if (subUnits && subUnits.length > 0){
|
|
|
+ subUnitName = subUnits[0].unitName;
|
|
|
+ }
|
|
|
+ this.formData.calculationFormula = this.formData.conversionFactor + unitName + "=1" + subUnitName
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.calculationFormula = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 包装单位改变事件
|
|
|
+ * @author : 姜宁
|
|
|
+ * @date : 2024/7/30 16:22
|
|
|
+ */
|
|
|
+ unitChange(row) {
|
|
|
if (row) {
|
|
|
this.digits = row['decimalPlaces']
|
|
|
}
|
|
|
- this.formData.subUnitId = null
|
|
|
this.formData.conversionFactor = null
|
|
|
this.formData.intoQty = null
|
|
|
+ this.formData.packageBox = null
|
|
|
+ if (this.formData.subUnitId && this.formData.conversionFactor && this.formData.unitId){
|
|
|
+ let unitName = null
|
|
|
+ let subUnitName = null
|
|
|
+ let units = this.originalUnitList.filter(it=>it.unitId == this.formData.unitId)
|
|
|
+ if (units && units.length > 0){
|
|
|
+ unitName = units[0].unitName;
|
|
|
+ }
|
|
|
+ let subUnits = this.originalUnitList.filter(it=>it.unitId == this.formData.subUnitId)
|
|
|
+ if (subUnits && subUnits.length > 0){
|
|
|
+ subUnitName = subUnits[0].unitName;
|
|
|
+ }
|
|
|
+ this.formData.calculationFormula = this.formData.conversionFactor + unitName + "=1" + subUnitName
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.calculationFormula = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 包装改变事件
|
|
|
+ * @author : 姜宁
|
|
|
+ * @date : 2024/7/30 17:24
|
|
|
+ */
|
|
|
+ packageChange(row) {
|
|
|
+ this.formData.packageBox = null
|
|
|
+ if (this.formData.subUnitId && this.formData.conversionFactor && this.formData.unitId){
|
|
|
+ let unitName = null
|
|
|
+ let subUnitName = null
|
|
|
+ let units = this.originalUnitList.filter(it=>it.unitId == this.formData.unitId)
|
|
|
+ if (units && units.length > 0){
|
|
|
+ unitName = units[0].unitName;
|
|
|
+ }
|
|
|
+ let subUnits = this.originalUnitList.filter(it=>it.unitId == this.formData.subUnitId)
|
|
|
+ if (subUnits && subUnits.length > 0){
|
|
|
+ subUnitName = subUnits[0].unitName;
|
|
|
+ }
|
|
|
+ this.formData.calculationFormula = this.formData.conversionFactor + unitName + "=1" + subUnitName
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.formData.calculationFormula = null
|
|
|
+ }
|
|
|
},
|
|
|
+ /**
|
|
|
+ * @desc : 期初数量改变事件
|
|
|
+ * @author : 姜宁
|
|
|
+ * @date : 2024/7/31 10:24
|
|
|
+ */
|
|
|
+ intoQtyChange(){
|
|
|
+ if (this.formData.subUnitId && this.formData.conversionFactor && this.formData.unitId && this.formData.intoQty){
|
|
|
+ let unitName = null
|
|
|
+ let subUnitName = null
|
|
|
+ let units = this.originalUnitList.filter(it=>it.unitId == this.formData.unitId)
|
|
|
+ if (units && units.length > 0){
|
|
|
+ unitName = units[0].unitName;
|
|
|
+ }
|
|
|
+ let subUnits = this.originalUnitList.filter(it=>it.unitId == this.formData.subUnitId)
|
|
|
+ if (subUnits && subUnits.length > 0){
|
|
|
+ subUnitName = subUnits[0].unitName;
|
|
|
+ }
|
|
|
+ let box = Math.floor(this.formData.intoQty/this.formData.conversionFactor);
|
|
|
+ let piece = this.formData.intoQty%this.formData.conversionFactor;
|
|
|
+ this.formData.packageBox = box + subUnitName + piece + unitName;
|
|
|
|
|
|
+ }else{
|
|
|
+ this.formData.packageBox = null
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* @desc : 数据校验
|
|
|
* @author : 常皓宁
|
|
|
@@ -355,7 +465,8 @@ export default {
|
|
|
getGoodsUnit() {
|
|
|
this.excute(this.$service.unitService, this.$service.unitService.selectByCond, {}).then(res => {
|
|
|
if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
- this.unitList = res.data.list;
|
|
|
+ this.unitList = res.data.list.copy();
|
|
|
+ this.originalUnitList = res.data.list.copy();
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -378,6 +489,16 @@ export default {
|
|
|
setValuesByEdit(data) {
|
|
|
if (data) {
|
|
|
this.formData = data;
|
|
|
+ if (this.formData.subUnitId && this.formData.conversionFactor && this.formData.unitId){
|
|
|
+ //计算公式
|
|
|
+ this.formData.calculationFormula = this.formData.conversionFactor + data.unitName + "=1" + data.subUnitName
|
|
|
+ //包装数量
|
|
|
+ if (this.formData.intoQty){
|
|
|
+ let box = Math.floor(this.formData.intoQty/this.formData.conversionFactor);
|
|
|
+ let piece = this.formData.intoQty%this.formData.conversionFactor;
|
|
|
+ this.formData.packageBox = box + data.subUnitName + piece + data.unitName;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -436,7 +557,6 @@ export default {
|
|
|
* @date : 2024/4/8 16:30
|
|
|
*/
|
|
|
saveData() {
|
|
|
- console.log('this.params', this.params)
|
|
|
if (this.type === this.$config.formMode.add) {
|
|
|
return this.excute(this.$service.goodsService, this.$service.goodsService.insert, this.params);
|
|
|
} else if (this.type === this.$config.formMode.edit) {
|