添加表单校验再进行评分

This commit is contained in:
熊丽君
2021-11-03 17:03:41 +08:00
parent 67b668514c
commit 375966032e

View File

@ -425,6 +425,13 @@
</section>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="hidenDialog">重新评估</el-button>
<router-link
to="/customerService"
target="_blank"
style="margin-left:10px"
>
<el-button @click="hidenDialog">联系我们</el-button>
</router-link>
</span>
</el-dialog>
</div>
@ -471,7 +478,7 @@ const dataList = [
export default {
data() {
return {
dialogVisible: false,
dialogVisible: true,
myYear: new Date().getFullYear(), // 当前年份
strShow: 0,
str: '',
@ -652,6 +659,10 @@ export default {
},
// 提交
submitFormA(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
this.$refs['formB'].validate(flag => {
if (flag) {
if (!this.formA.hasIntellectualProperty) {
this.formA.badSeason.push('没有知识产权;');
}
@ -699,7 +710,8 @@ export default {
}
if (this.formA.scienceEmployee || this.formA.totalEmployee) {
if (
(this.formA.scienceEmployee / this.formA.totalEmployee) * 100 <
(this.formA.scienceEmployee / this.formA.totalEmployee) *
100 <
10
) {
this.formA.badSeason.push(
@ -797,7 +809,9 @@ export default {
assetsRate = 0;
} else {
assetsRate =
(this.tableData[1].net_assets / this.tableData[0].net_assets - 1) *
(this.tableData[1].net_assets /
this.tableData[0].net_assets -
1) *
100;
}
const status2 = this.tableData.map(item => {
@ -811,7 +825,8 @@ export default {
salesRate = 0;
} else {
salesRate =
(this.tableData[1].sale_income / this.tableData[0].sale_income -
(this.tableData[1].sale_income /
this.tableData[0].sale_income -
1) *
100;
}
@ -825,20 +840,25 @@ export default {
});
if (status.toString() == [true, true, true].toString()) {
assetsRate =
((this.tableData[1].net_assets / this.tableData[0].net_assets +
this.tableData[2].net_assets / this.tableData[1].net_assets) /
((this.tableData[1].net_assets /
this.tableData[0].net_assets +
this.tableData[2].net_assets /
this.tableData[1].net_assets) /
2 -
1) *
100;
} else if (status.toString() == [false, true, true].toString()) {
} else if (
status.toString() == [false, true, true].toString()
) {
assetsRate =
(this.tableData[2].net_assets / this.tableData[1].net_assets - 1) *
(this.tableData[2].net_assets /
this.tableData[1].net_assets -
1) *
100;
} else {
assetsRate = 0;
}
const status2 = this.tableData.map(item => {
console.log('map', assetsRate);
if (item.sale_income <= 0 || assetsRate <= 0) {
return false;
} else {
@ -847,14 +867,19 @@ export default {
});
if (status2.toString() == [true, true, true].toString()) {
salesRate =
((this.tableData[1].sale_income / this.tableData[0].sale_income +
this.tableData[2].sale_income / this.tableData[1].sale_income) /
((this.tableData[1].sale_income /
this.tableData[0].sale_income +
this.tableData[2].sale_income /
this.tableData[1].sale_income) /
2 -
1) *
100;
} else if (status2.toString() == [false, true, true].toString()) {
} else if (
status2.toString() == [false, true, true].toString()
) {
salesRate =
(this.tableData[2].sale_income / this.tableData[1].sale_income -
(this.tableData[2].sale_income /
this.tableData[1].sale_income -
1) *
100;
} else {
@ -895,19 +920,11 @@ export default {
this.formA.score += 2;
this.fourTwoAdd += 2;
}
this.dialogVisible = true;
this.$refs[formName].validate(valid => {
if (valid) {
this.$refs['formB'].validate(flag => {
if (flag) {
console.log(this.formA);
console.log(this.tableData);
this.dialogVisible = true;
}
});
} else {
console.log('error submit!!');
this.msgError('请输入必填项');
return false;
}
});