给多单位再增加两个副单位
This commit is contained in:
@@ -107,14 +107,14 @@
|
|||||||
{dataIndex: 'standard', title: '规格', width: 80},
|
{dataIndex: 'standard', title: '规格', width: 80},
|
||||||
{dataIndex: 'model', title: '型号', width: 80},
|
{dataIndex: 'model', title: '型号', width: 80},
|
||||||
{dataIndex: 'color', title: '颜色', width: 80},
|
{dataIndex: 'color', title: '颜色', width: 80},
|
||||||
{dataIndex: 'unit', title: '单位', width: 60},
|
{dataIndex: 'unit', title: '单位', width: 70, ellipsis:true},
|
||||||
{dataIndex: 'sku', title: '多属性', width: 80},
|
{dataIndex: 'sku', title: '多属性', width: 80},
|
||||||
{dataIndex: 'stock', title: '库存', width: 60},
|
{dataIndex: 'stock', title: '库存', width: 60},
|
||||||
{dataIndex: 'expand', title: '扩展信息', width: 80},
|
{dataIndex: 'expand', title: '扩展信息', width: 80},
|
||||||
{dataIndex: 'enableSerialNumber', title: '序列号', width: 60, align: "center",
|
{dataIndex: 'enableSerialNumber', title: '序列号', width: 60, align: "center",
|
||||||
scopedSlots: { customRender: 'customRenderEnableSerialNumber' }
|
scopedSlots: { customRender: 'customRenderEnableSerialNumber' }
|
||||||
},
|
},
|
||||||
{dataIndex: 'enableBatchNumber', title: '批号', width: 60, align: "center",
|
{dataIndex: 'enableBatchNumber', title: '批号', width: 50, align: "center",
|
||||||
scopedSlots: { customRender: 'customRenderEnableBatchNumber' }
|
scopedSlots: { customRender: 'customRenderEnableBatchNumber' }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -95,10 +95,6 @@
|
|||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</span>
|
</span>
|
||||||
<span slot="customRenderUnit" slot-scope="text, record">
|
|
||||||
{{text?text:record.unitName}}
|
|
||||||
<a-tag v-if="record.sku">SKU</a-tag>
|
|
||||||
</span>
|
|
||||||
<template slot="customRenderEnabled" slot-scope="enabled">
|
<template slot="customRenderEnabled" slot-scope="enabled">
|
||||||
<a-tag v-if="enabled" color="green">启用</a-tag>
|
<a-tag v-if="enabled" color="green">启用</a-tag>
|
||||||
<a-tag v-if="!enabled" color="orange">禁用</a-tag>
|
<a-tag v-if="!enabled" color="orange">禁用</a-tag>
|
||||||
@@ -165,8 +161,17 @@
|
|||||||
{title: '颜色', dataIndex: 'color', width: '4%'},
|
{title: '颜色', dataIndex: 'color', width: '4%'},
|
||||||
{title: '类别', dataIndex: 'categoryName', width: '6%'},
|
{title: '类别', dataIndex: 'categoryName', width: '6%'},
|
||||||
{title: '扩展信息', dataIndex: 'materialOther', width: '6%'},
|
{title: '扩展信息', dataIndex: 'materialOther', width: '6%'},
|
||||||
{title: '单位', dataIndex: 'unit', width: '6%',
|
{title: '单位', dataIndex: 'unit', width: '6%', ellipsis:true,
|
||||||
scopedSlots: { customRender: 'customRenderUnit' }
|
customRender:function (t,r,index) {
|
||||||
|
if (r) {
|
||||||
|
let name = t?t:r.unitName
|
||||||
|
if(r.sku) {
|
||||||
|
return name + '[SKU]';
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{title: '保质期', dataIndex: 'expiryNum', width: '4%'},
|
{title: '保质期', dataIndex: 'expiryNum', width: '4%'},
|
||||||
{title: '库存', dataIndex: 'stock', width: '5%'},
|
{title: '库存', dataIndex: 'stock', width: '5%'},
|
||||||
|
|||||||
@@ -590,30 +590,36 @@
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//进一步校验单位
|
//进一步校验单位
|
||||||
let manyUnitselected = ''
|
let basicUnit = '', otherUnit = '', otherUnitTwo = '', otherUnitThree = ''
|
||||||
if(formData.unitId) {
|
if(formData.unitId) {
|
||||||
for(let i=0; i<this.unitList.length; i++) {
|
let unitArr = this.unitList
|
||||||
if(this.unitList[i].id == formData.unitId) {
|
for(let i=0; i < unitArr.length; i++) {
|
||||||
manyUnitselected = this.unitList[i].name
|
if(unitArr[i].id == formData.unitId) {
|
||||||
|
basicUnit = unitArr[i].basicUnit
|
||||||
|
otherUnit = unitArr[i].otherUnit
|
||||||
|
if(unitArr[i].otherUnitTwo) {
|
||||||
|
otherUnitTwo = unitArr[i].otherUnitTwo
|
||||||
|
}
|
||||||
|
if(unitArr[i].otherUnitThree) {
|
||||||
|
otherUnitThree = unitArr[i].otherUnitThree
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let manyUnitInfo = manyUnitselected.substring(0, manyUnitselected.indexOf("("));
|
|
||||||
let unitArr = manyUnitInfo.split(",");
|
|
||||||
if(!formData.unit) {
|
if(!formData.unit) {
|
||||||
//此时为多单位
|
//此时为多单位
|
||||||
if (formData.meList.length<2){
|
if (formData.meList.length<2){
|
||||||
this.$message.warning('多单位的商品条码行数至少要有两行,请再新增一行条码信息!');
|
this.$message.warning('多单位的商品条码行数至少要有两行,请再新增一行条码信息!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(formData.meList[0].commodityUnit != unitArr[0]) {
|
if(formData.meList[0].commodityUnit != basicUnit) {
|
||||||
this.$message.warning('条码之后的单位填写有误,单位【' + formData.meList[0].commodityUnit
|
this.$message.warning('条码之后的单位填写有误,单位【' + formData.meList[0].commodityUnit
|
||||||
+ '】请修改为【' + unitArr[0] + '】!');
|
+ '】请修改为【' + basicUnit + '】!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(formData.meList[1].commodityUnit != unitArr[1]) {
|
if(formData.meList[1].commodityUnit != otherUnit) {
|
||||||
this.$message.warning('条码之后的单位填写有误,单位【' + formData.meList[1].commodityUnit
|
this.$message.warning('条码之后的单位填写有误,单位【' + formData.meList[1].commodityUnit
|
||||||
+ '】请修改为【' + unitArr[1] + '】!');
|
+ '】请修改为【' + otherUnit + '】!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -625,10 +631,10 @@
|
|||||||
+ formData.unit + '】!');
|
+ formData.unit + '】!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if(manyUnitselected) {
|
} else if(formData.unitId) {
|
||||||
if(commodityUnit != unitArr[0] && commodityUnit != unitArr[1]) {
|
if(commodityUnit != basicUnit && commodityUnit != otherUnit && commodityUnit != otherUnitTwo && commodityUnit != otherUnitThree) {
|
||||||
this.$message.warning('条码之后的单位填写有误,单位【' + commodityUnit + '】请修改为【'
|
this.$message.warning('条码之后的单位填写有误,单位【' + commodityUnit + '】请修改为【'
|
||||||
+ unitArr[0]+ '】或【' + unitArr[1]+ '】!');
|
+ basicUnit+ '】或【' + otherUnit+ '】或【' + otherUnitTwo+ '】或【' + otherUnitThree+ '】!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -810,12 +816,20 @@
|
|||||||
//修改商品明细中的价格触发计算
|
//修改商品明细中的价格触发计算
|
||||||
changeDecimalByValue(row) {
|
changeDecimalByValue(row) {
|
||||||
let unitArr = this.unitList
|
let unitArr = this.unitList
|
||||||
let basicUnit = '', otherUnit = '', ratio = 1
|
let basicUnit = '', otherUnit = '', ratio = 1, otherUnitTwo = '', ratioTwo = 1, otherUnitThree = '', ratioThree = 1
|
||||||
for (let i = 0; i < unitArr.length; i++) {
|
for (let i = 0; i < unitArr.length; i++) {
|
||||||
if(unitArr[i].id === this.form.getFieldValue('unitId')) {
|
if(unitArr[i].id === this.form.getFieldValue('unitId')) {
|
||||||
basicUnit = unitArr[i].basicUnit
|
basicUnit = unitArr[i].basicUnit
|
||||||
otherUnit = unitArr[i].otherUnit
|
otherUnit = unitArr[i].otherUnit
|
||||||
ratio = unitArr[i].ratio
|
ratio = unitArr[i].ratio
|
||||||
|
if(unitArr[i].otherUnitTwo) {
|
||||||
|
otherUnitTwo = unitArr[i].otherUnitTwo
|
||||||
|
ratioTwo = unitArr[i].ratioTwo
|
||||||
|
}
|
||||||
|
if(unitArr[i].otherUnitThree) {
|
||||||
|
otherUnitThree = unitArr[i].otherUnitThree
|
||||||
|
ratioThree = unitArr[i].ratioThree
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(row.commodityUnit === basicUnit) {
|
if(row.commodityUnit === basicUnit) {
|
||||||
@@ -829,10 +843,23 @@
|
|||||||
basicWholesaleDecimal = mInfo.wholesaleDecimal
|
basicWholesaleDecimal = mInfo.wholesaleDecimal
|
||||||
basicLowDecimal = mInfo.lowDecimal
|
basicLowDecimal = mInfo.lowDecimal
|
||||||
} else {
|
} else {
|
||||||
|
//副单位进行换算
|
||||||
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratio}
|
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratio}
|
||||||
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratio}
|
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratio}
|
||||||
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratio}
|
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratio}
|
||||||
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratio}
|
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratio}
|
||||||
|
if(otherUnitTwo && i===2) {
|
||||||
|
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratioTwo}
|
||||||
|
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratioTwo}
|
||||||
|
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratioTwo}
|
||||||
|
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratioTwo}
|
||||||
|
}
|
||||||
|
if(otherUnitThree && i===3) {
|
||||||
|
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratioThree}
|
||||||
|
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratioThree}
|
||||||
|
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratioThree}
|
||||||
|
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratioThree}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.meTable.dataSource = mArr
|
this.meTable.dataSource = mArr
|
||||||
@@ -949,12 +976,20 @@
|
|||||||
},
|
},
|
||||||
manyUnitOnChange(value) {
|
manyUnitOnChange(value) {
|
||||||
let unitArr = this.unitList
|
let unitArr = this.unitList
|
||||||
let basicUnit = '', otherUnit = '', ratio = 1
|
let basicUnit = '', otherUnit = '', ratio = 1, otherUnitTwo = '', ratioTwo = 1, otherUnitThree = '', ratioThree = 1
|
||||||
for (let i = 0; i < unitArr.length; i++) {
|
for (let i = 0; i < unitArr.length; i++) {
|
||||||
if(unitArr[i].id === value) {
|
if(unitArr[i].id === value) {
|
||||||
basicUnit = unitArr[i].basicUnit
|
basicUnit = unitArr[i].basicUnit
|
||||||
otherUnit = unitArr[i].otherUnit
|
otherUnit = unitArr[i].otherUnit
|
||||||
ratio = unitArr[i].ratio
|
ratio = unitArr[i].ratio
|
||||||
|
if(unitArr[i].otherUnitTwo) {
|
||||||
|
otherUnitTwo = unitArr[i].otherUnitTwo
|
||||||
|
ratioTwo = unitArr[i].ratioTwo
|
||||||
|
}
|
||||||
|
if(unitArr[i].otherUnitThree) {
|
||||||
|
otherUnitThree = unitArr[i].otherUnitThree
|
||||||
|
ratioThree = unitArr[i].ratioThree
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$refs.editableMeTable.getValues((error, values) => {
|
this.$refs.editableMeTable.getValues((error, values) => {
|
||||||
@@ -968,11 +1003,26 @@
|
|||||||
basicWholesaleDecimal = mInfo.wholesaleDecimal
|
basicWholesaleDecimal = mInfo.wholesaleDecimal
|
||||||
basicLowDecimal = mInfo.lowDecimal
|
basicLowDecimal = mInfo.lowDecimal
|
||||||
} else {
|
} else {
|
||||||
|
//副单位进行换算
|
||||||
mInfo.commodityUnit = otherUnit
|
mInfo.commodityUnit = otherUnit
|
||||||
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratio}
|
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratio}
|
||||||
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratio}
|
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratio}
|
||||||
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratio}
|
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratio}
|
||||||
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratio}
|
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratio}
|
||||||
|
if(otherUnitTwo && i===2) {
|
||||||
|
mInfo.commodityUnit = otherUnitTwo
|
||||||
|
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratioTwo}
|
||||||
|
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratioTwo}
|
||||||
|
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratioTwo}
|
||||||
|
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratioTwo}
|
||||||
|
}
|
||||||
|
if(otherUnitThree && i===3) {
|
||||||
|
mInfo.commodityUnit = otherUnitThree
|
||||||
|
if(basicPurchaseDecimal) { mInfo.purchaseDecimal = basicPurchaseDecimal*ratioThree}
|
||||||
|
if(basicCommodityDecimal) { mInfo.commodityDecimal = basicCommodityDecimal*ratioThree}
|
||||||
|
if(basicWholesaleDecimal) { mInfo.wholesaleDecimal = basicWholesaleDecimal*ratioThree}
|
||||||
|
if(basicLowDecimal) { mInfo.lowDecimal = basicLowDecimal*ratioThree}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.meTable.dataSource = mArr
|
this.meTable.dataSource = mArr
|
||||||
|
|||||||
@@ -98,10 +98,33 @@
|
|||||||
return parseInt(index)+1;
|
return parseInt(index)+1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ title: '计量单位', align:"center", dataIndex: 'name', width:100 },
|
{ title: '计量单位', align:"center", dataIndex: 'name', width:150 },
|
||||||
{ title: '基本单位', align:"center", dataIndex: 'basicUnit', width:100 },
|
{ title: '基本单位', align:"center", dataIndex: 'basicUnit', width:100 },
|
||||||
{ title: '副单位', align:"center", dataIndex: 'otherUnit', width:100 },
|
{ title: '副单位', align:"center", dataIndex: 'otherUnit', width:100,
|
||||||
{ title: '比例', align:"center", dataIndex: 'ratio', width:100 },
|
customRender:function (t,r,index) {
|
||||||
|
if (r) {
|
||||||
|
return r.otherUnit + '=' + r.ratio + r.basicUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ title: '副单位2', align:"center", dataIndex: 'otherUnitTwo', width:100,
|
||||||
|
customRender:function (t,r,index) {
|
||||||
|
if (r) {
|
||||||
|
if(r.otherUnitTwo) {
|
||||||
|
return r.otherUnitTwo + '=' + r.ratioTwo + r.basicUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ title: '副单位3', align:"center", dataIndex: 'otherUnitThree', width:100,
|
||||||
|
customRender:function (t,r,index) {
|
||||||
|
if (r) {
|
||||||
|
if(r.otherUnitThree) {
|
||||||
|
return r.otherUnitThree + '=' + r.ratioThree + r.basicUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-modal
|
<a-modal
|
||||||
:title="title"
|
:title="title"
|
||||||
:width="800"
|
:width="700"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirmLoading="confirmLoading"
|
:confirmLoading="confirmLoading"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@cancel="handleCancel"
|
@cancel="handleCancel"
|
||||||
cancelText="关闭"
|
cancelText="关闭"
|
||||||
wrapClassName="ant-modal-cust-warp"
|
wrapClassName="ant-modal-cust-warp"
|
||||||
style="top:25%;height: 50%;overflow-y: hidden">
|
style="top:25%; height:50%; overflow-y:hidden">
|
||||||
<template slot="footer">
|
<template slot="footer">
|
||||||
<a-button key="back" v-if="isReadOnly" @click="handleCancel">
|
<a-button key="back" v-if="isReadOnly" @click="handleCancel">
|
||||||
关闭
|
关闭
|
||||||
@@ -22,12 +22,23 @@
|
|||||||
</a-form>
|
</a-form>
|
||||||
<a-form :form="form">
|
<a-form :form="form">
|
||||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="副单位">
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="副单位">
|
||||||
<a-input placeholder="请输入副单位(大单位)" v-decorator.trim="[ 'otherUnit', validatorRules.otherUnit]" />
|
<a-input placeholder="请输入副单位(大单位)" style="width:48%" v-decorator.trim="[ 'otherUnit' ]" />
|
||||||
|
=
|
||||||
|
<a-input suffix="基本单位" placeholder="请输入比例" style="width:48%" v-decorator.trim="[ 'ratio' ]" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
<a-form :form="form">
|
<a-form :form="form">
|
||||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="比例">
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="副单位2">
|
||||||
<a-input addon-before="基本单位 : 副单位=1 :" placeholder="请输入比例" v-decorator.trim="[ 'ratio', validatorRules.ratio]" />
|
<a-input placeholder="请输入副单位2(大单位)" style="width:48%" v-decorator.trim="[ 'otherUnitTwo' ]" />
|
||||||
|
=
|
||||||
|
<a-input suffix="基本单位" placeholder="请输入比例2" style="width:48%" v-decorator.trim="[ 'ratioTwo' ]" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
<a-form :form="form">
|
||||||
|
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="副单位3">
|
||||||
|
<a-input placeholder="请输入副单位3(大单位)" style="width:48%" v-decorator.trim="[ 'otherUnitThree' ]" />
|
||||||
|
=
|
||||||
|
<a-input suffix="基本单位" placeholder="请输入比例3" style="width:48%" v-decorator.trim="[ 'ratioThree' ]" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
@@ -85,7 +96,7 @@
|
|||||||
this.model = Object.assign({}, record);
|
this.model = Object.assign({}, record);
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.form.setFieldsValue(pick(this.model,'basicUnit','otherUnit','ratio'))
|
this.form.setFieldsValue(pick(this.model,'basicUnit','otherUnit','ratio','otherUnitTwo','ratioTwo','otherUnitThree','ratioThree'))
|
||||||
autoJumpNextInput('unitModal')
|
autoJumpNextInput('unitModal')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -100,27 +111,57 @@
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
that.confirmLoading = true;
|
that.confirmLoading = true;
|
||||||
let formData = Object.assign(this.model, values);
|
let formData = Object.assign(this.model, values);
|
||||||
|
if(!formData.otherUnit) {
|
||||||
|
that.$message.warning('抱歉,副单位不能为空!');
|
||||||
|
that.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!formData.ratio) {
|
||||||
|
that.$message.warning('抱歉,此时比例不能为空!');
|
||||||
|
that.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(formData.otherUnitTwo && !formData.ratioTwo) {
|
||||||
|
that.$message.warning('抱歉,此时比例2不能为空!');
|
||||||
|
that.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(formData.otherUnitThree && !formData.ratioThree) {
|
||||||
|
that.$message.warning('抱歉,此时比例3不能为空!');
|
||||||
|
that.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(formData.basicUnit === formData.otherUnit) {
|
if(formData.basicUnit === formData.otherUnit) {
|
||||||
that.$message.warning('抱歉,基本单位与副单位不能相同!');
|
that.$message.warning('抱歉,基本单位与副单位不能相同!');
|
||||||
that.confirmLoading = false;
|
that.confirmLoading = false;
|
||||||
} else {
|
return;
|
||||||
let obj;
|
|
||||||
if(!this.model.id){
|
|
||||||
obj=addUnit(formData);
|
|
||||||
}else{
|
|
||||||
obj=editUnit(formData);
|
|
||||||
}
|
|
||||||
obj.then((res)=>{
|
|
||||||
if(res.code === 200){
|
|
||||||
that.$emit('ok');
|
|
||||||
}else{
|
|
||||||
that.$message.warning(res.data.message);
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
that.confirmLoading = false;
|
|
||||||
that.close();
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
if(formData.basicUnit === formData.otherUnitTwo) {
|
||||||
|
that.$message.warning('抱歉,基本单位与副单位2不能相同!');
|
||||||
|
that.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(formData.basicUnit === formData.otherUnitThree) {
|
||||||
|
that.$message.warning('抱歉,基本单位与副单位3不能相同!');
|
||||||
|
that.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let obj;
|
||||||
|
if(!this.model.id){
|
||||||
|
obj=addUnit(formData);
|
||||||
|
}else{
|
||||||
|
obj=editUnit(formData);
|
||||||
|
}
|
||||||
|
obj.then((res)=>{
|
||||||
|
if(res.code === 200){
|
||||||
|
that.$emit('ok');
|
||||||
|
}else{
|
||||||
|
that.$message.warning(res.data.message);
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
that.confirmLoading = false;
|
||||||
|
that.close();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user