添加表单校验再进行评分

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

View File

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