Commit 0e22ab5e authored by xinzhedeai's avatar xinzhedeai

fix:检查单,选项为是则为隐患的逻辑处理;隐患数量计算与表单提交必填校验处理

parent f33ce365
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
*/ */
var VUE = null var VUE = null
// 隐患选择是的时候的编号特殊处理
const YES_YH_NO = [8, 9, 12, 22, 28, 31, 32, 33, 34, 35]
window.onload = function () { window.onload = function () {
function countSelectedNo(result) { function countSelectedNo(result) {
...@@ -30,8 +33,13 @@ window.onload = function () { ...@@ -30,8 +33,13 @@ window.onload = function () {
return result.reduce((total, category) => { return result.reduce((total, category) => {
return ( return (
total + total +
category.gqCheckItemList.filter((item) => item.itemAnswer === 2) category.gqCheckItemList.filter((item) => {
.length if(YES_YH_NO.includes(item.id)){
return item.itemAnswer === 1
}
return item.itemAnswer === 2
}).length
) )
}, 0) }, 0)
} }
...@@ -201,7 +209,7 @@ window.onload = function () { ...@@ -201,7 +209,7 @@ window.onload = function () {
// }) // })
// }, // },
extendShow(item){ // 特殊检查项综合处理方法 选择是现实表单 extendShow(item){ // 特殊检查项综合处理方法 选择是现实表单
if([8, 9, 12, 22, 28, 31, 32, 33, 34, 35].includes(item.id)){ if(YES_YH_NO.includes(item.id)){
return item.itemAnswer === 1 return item.itemAnswer === 1
} }
return item.itemAnswer === 2 return item.itemAnswer === 2
...@@ -259,9 +267,19 @@ window.onload = function () { ...@@ -259,9 +267,19 @@ window.onload = function () {
const currentPageData = this.checkData[this.checkPageIndex]; const currentPageData = this.checkData[this.checkPageIndex];
const errorRows = currentPageData.gqCheckItemList.filter((item) => { const errorRows = currentPageData.gqCheckItemList.filter((item) => {
console.log(item) console.log(item)
if(YES_YH_NO.includes(item.id)){
if (item.itemAnswer === 1) {
return !item.description || !item.photos?.length || !item.deadlineDays
}
}else{
if (item.itemAnswer === 2) { if (item.itemAnswer === 2) {
return !item.description || !item.photos?.length || !item.deadlineDays return !item.description || !item.photos?.length || !item.deadlineDays
} }
}
// if (item.itemAnswer === 2) {
// return !item.description || !item.photos?.length || !item.deadlineDays
// }
return false return false
}) })
console.log('errorRows.length', errorRows.length) console.log('errorRows.length', errorRows.length)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment