diff --git a/src/mycomponents/form/customerFrom.vue b/src/mycomponents/form/customerFrom.vue index 2a4b2c6..eabd529 100644 --- a/src/mycomponents/form/customerFrom.vue +++ b/src/mycomponents/form/customerFrom.vue @@ -40,7 +40,8 @@ - + @@ -62,7 +63,7 @@ - + 点检状态 @@ -79,42 +80,44 @@ - - - - - {{item.putMachine[0].Name}} - - - - {{item.putMachine[1].Name}} - - + + - - + + + * {{ index + 1 }}. - + - {{ item.Content }} + 点检部位 : {{ item.Position }} + + + 点检内容 : {{ item.Content }} + + + 点检方法 : {{item.Methond}} - + + + - (单选) - + + 点检状态 + (单选) + + + v-for="(radio, index) in dataInputList" :key="index"> {{radio.name}} @@ -123,43 +126,54 @@ - - + + + + {{item.putMachine[0].Name}} + + + + {{item.putMachine[1].Name}} + + + + - - + + * {{ index + 1 }}. - + - 点检部位 : {{ item.Position }} - - - 点检内容 : {{ item.Content }} - - - 点检方法 : {{item.Methond}} + {{ item.Content }} - + - {{item.inputLow.placeholder}} - - - - {{item.inputHigh.placeholder}} - + (单选) + + + + + {{radio.name}} + + + + - + + @@ -224,7 +238,8 @@ ], testName: null, current: 0, - isRefresh: true + isRefresh: true, + isRefreshType3: true, }; @@ -232,44 +247,164 @@ }, methods: { radioChange(radio) { - console.log("radioChange") + console.log("radioChange", radio) }, radioGroupChange(item) { - console.log("radioGroupChange", item) - // for (let i = 0; i < this.dataList.length; i++) { - // if (this.dataList[i].name === item.SelectName) { - // this.current = i; - // break; + // if(item.SelectName=!""){ + // if(item.putMachine.length==2){ + // item.putMachine[0].SelectName="" + // item.putMachine[1].SelectName="" + // // this.reload3() // } + // } + console.log("radioGroupChange", item) }, inputMain(item) { - item.SelectName = item.minor.name + "~" + item.putMachine.name; - if (item.minor.name == "" && item.putMachine.name == "") { + if (item.putMachine[0].SelectName.length > 0) { item.SelectName = "" } + this.reload3() }, inputMinor(item) { - item.SelectName = item.minor.name + "~" + item.putMachine.name; - if (item.minor.name == "" && item.putMachine.name == "") { + if (item.putMachine[1].SelectName.length > 0) { item.SelectName = "" } + this.reload3() }, + submit(callBack) { + try { + for (var i = 0; i < this.formData.length; i++) { + var item = this.formData[i]; + var hintIndex = i + 1 + if (item.Type == 1) { + if (item.SelectName == "") { + var hint = hintIndex + ".点检内容 : " + item.Content; + throw new Error(hint) + } + } else if (item.Type == 2) { + //空值提示 + if (item.SelectName == "") { + var hint = hintIndex + ".点检内容 : " + item.Content; + throw new Error(hint) + } + //如果不在选择中,输入的内容。对数值进行校验 + if (!this.isExitList(item.SelectName)) { + if (!this.isWithinInterval(item.SelectName, item.putMachine[0].Limit, item + .putMachine[0] + .Floor)) { + var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName + + "】不在【" + item.putMachine[0].Limit + "】和【" + item.putMachine[0].Floor + "】之间" + throw new Error(hint) + } + } + } else if (item.Type == 3) { + if (item.SelectName == "") { + if(item.putMachine[0].SelectName==""){ + var hint = hintIndex + ".点检内容 : " + item.Content; + throw new Error(hint) + }else { + if (!this.isWithinInterval(item.putMachine[0].SelectName, item.putMachine[0].Limit, item + .putMachine[0] + .Floor)) { + var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName + + "】不在【" + item.putMachine[0].Limit + "】和【" + item.putMachine[0].Floor + "】之间" + throw new Error(hint) + } + } + + if(item.putMachine[1].SelectName==""){ + var hint = hintIndex + ".点检内容 : " + item.Content; + throw new Error(hint) + }else { + if (!this.isWithinInterval(item.putMachine[1].SelectName, item.putMachine[1].Limit, item + .putMachine[1] + .Floor)) { + var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName + + "】不在【" + item.putMachine[1].Limit + "】和【" + item.putMachine[1].Floor + "】之间" + throw new Error(hint) + } + } + + + }else {if (!this.isExitList(item.SelectName)) { + if (!this.isWithinInterval(item.putMachine[0].SelectName, item.putMachine[0].Limit, item + .putMachine[0] + .Floor)) { + var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName + + "】不在【" + item.putMachine[0].Limit + "】和【" + item.putMachine[0].Floor + "】之间" + throw new Error(hint) + } + + if (!this.isWithinInterval(item.putMachine[1].SelectName, item.putMachine[1].Limit, item + .putMachine[1] + .Floor)) { + var hint = hintIndex + ".点检内容 : " + item.Content + "输入数量【" + item.SelectName + + "】不在【" + item.putMachine[1].Limit + "】和【" + item.putMachine[1].Floor + "】之间" + throw new Error(hint) + } + }} + + + } + } + + this.formData.forEach(res => { + if (res.SelectName.includes("班")) { + var value = this.dataClassList.filter(item => item.name == res.SelectName) + if (value.length > 0) { + res.SelectValue = value[0].value + } else { + res.SelectValue = "" + } + } else { + var value = this.dataList.filter(item => item.name == res.SelectName) + if (value.length > 0) { + res.SelectValue = value[0].value + } else { + res.SelectValue = res.SelectName + } + } + }) + + callBack(this.formData) + } catch (error) { + this.showHint("", error.message) + } + + }, + + + + submitss(callBack) { var isCheckPass = true for (var i = 0; i < this.formData.length; i++) { var item = this.formData[i]; var hintIndex = i + 1 - if (item.type == "inputRange") { - if (item.inputLow.name == "") { + + if (item.Type == 1) { + if (item.SelectName == "") { + this.showHint(hintIndex + ".点检内容 : " + item.Content, item.placeholder) + isCheckPass = false; + break + } + } else if (item.Type == 2) { + + } else + + if (item.Type == 3) { + if (item.SelectName == "") { this.showHint(hintIndex + ".点检内容 : " + item.Content, item.inputLow.placeholder) isCheckPass = false; break } else { - if (!this.isWithinInterval(item.inputLow.name, item.inputLow.lower, item.inputLow.upper)) { - this.showHint(hintIndex + ".点检内容 : " + item.Content, "最低压 : 输入数量【" + item.inputLow.name + + if (!this.isWithinInterval(item.inputLow.name, item.inputLow.lower, item.inputLow + .upper)) { + this.showHint(hintIndex + ".点检内容 : " + item.Content, "最低压 : 输入数量【" + item.inputLow + .name + "】不在【" + item.inputLow.lower + "】和【" + item.inputLow.upper + "】之间") isCheckPass = false; break @@ -281,20 +416,16 @@ isCheckPass = false; break } else { - if (!this.isWithinInterval(item.inputHigh.name, item.inputHigh.lower, item.inputHigh.upper)) { - this.showHint(hintIndex + ".点检内容 : " + item.Content, "最高压 : 输入数量【" + item.inputHigh.name + + if (!this.isWithinInterval(item.inputHigh.name, item.inputHigh.lower, item.inputHigh + .upper)) { + this.showHint(hintIndex + ".点检内容 : " + item.Content, "最高压 : 输入数量【" + item.inputHigh + .name + "】不在【" + item.inputHigh.lower + "】和【" + item.inputHigh.upper + "】之间") isCheckPass = false; break } } - } else if (item.Type == 1) { - if (item.SelectName == "") { - this.showHint(hintIndex + ".点检内容 : " + item.Content, item.placeholder) - isCheckPass = false; - break - } } else if (item.Type == 2) { if (item.SelectName == "") { this.showHint(hintIndex + ".点检内容 : " + item.Content, item.placeholder) @@ -302,27 +433,29 @@ break } else { if (!this.isExitList(item.SelectName)) { - if (item.putMachine.length>0) { - for (var i = 0; i < item.putMachine.length; i++) { - var temp =item.putMachine[i] - if(item.SelectName==""){ + if (item.putMachine.length > 0) { + for (var i = 0; i < item.putMachine.length; i++) { + var temp = item.putMachine[i] + if (item.SelectName == "") { this.showHint(hintIndex + ".点检内容 : " + item.Content, temp.Name) isCheckPass = false; break } - + if (!this.isWithinInterval(item.SelectName, temp.Limit, temp.Floor)) { - this.showHint(hintIndex + ".点检内容 : " + item.Content, "输入数量【" + item.SelectName + + this.showHint(hintIndex + ".点检内容 : " + item.Content, "输入数量【" + item + .SelectName + "】不在【" + temp.Limit + "】和【" + temp.Floor + "】之间") isCheckPass = false; break } - - } - + + } + } else { if (!this.isWithinInterval(item.SelectName, item.Limit, item.Floor)) { - this.showHint(hintIndex + ".点检内容 : " + item.Content, "输入数量【" + item.SelectName + + this.showHint(hintIndex + ".点检内容 : " + item.Content, "输入数量【" + item + .SelectName + "】不在【" + item.Limit + "】和【" + item.Floor + "】之间") isCheckPass = false; break @@ -340,25 +473,25 @@ } } if (isCheckPass) { - this.formData.forEach(res=>{ - if(res.SelectName.includes("班")){ - var value =this.dataClassList.filter(item=>item.name==res.SelectName) - if(value.length>0){ - res.SelectValue =value[0].value - }else { - res.SelectValue="" + this.formData.forEach(res => { + if (res.SelectName.includes("班")) { + var value = this.dataClassList.filter(item => item.name == res.SelectName) + if (value.length > 0) { + res.SelectValue = value[0].value + } else { + res.SelectValue = "" } - }else { - var value =this.dataList.filter(item=>item.name==res.SelectName) - if(value.length>0){ - res.SelectValue =value[0].value - }else { - res.SelectValue="" + } else { + var value = this.dataList.filter(item => item.name == res.SelectName) + if (value.length > 0) { + res.SelectValue = value[0].value + } else { + res.SelectValue = "" } } }) callBack(this.formData) - + // this.$emit("submit",this.formData) console.log("通过", this.formData) } else { @@ -366,6 +499,9 @@ } }, isWithinInterval(num, lower, upper) { + var num =Number(num); + var lower =Number(lower); + var upper =Number(upper); if (!this.isNumber(num)) { return true; } @@ -383,7 +519,7 @@ // title: title, // Content: hint // }) - this.$refs.comMessage.showMessage(title, hint) + this.$refs.comMessage.showMessage("提示", hint) }, isNumber(val) { @@ -419,11 +555,19 @@ console.log("重置", this.formData) }, - - reload(){ + + reload() { this.isRefresh = false + this.isRefreshType3 = false this.$nextTick(() => { this.isRefresh = true + this.isRefreshType3 = true + }) + }, + reload3() { + this.isRefreshType3 = false + this.$nextTick(() => { + this.isRefreshType3 = true }) } diff --git a/src/pages/foam/check.vue b/src/pages/foam/check.vue index 7a8524d..93981ec 100644 --- a/src/pages/foam/check.vue +++ b/src/pages/foam/check.vue @@ -10,13 +10,13 @@ 设备名称 : {{deviceName}} - + - + 点检日期 : {{dateTime}} @@ -201,7 +201,7 @@ }, computed: {}, onLoad() { - + }, onReady() { this.openScanPopup(); @@ -209,31 +209,34 @@ methods: { getScanResult(result) { uni.showLoading({ - title:"加载中", - mask:true + title: "加载中", + mask: true }) - getDeviceInfo(result).then(res=>{ + getDeviceInfo(result).then(res => { uni.hideLoading() this.deviceCode = result; console.log(result) this.reset(); this.closeScanPopup(); - var groupSelect ={ - Type: "groupSelect", + var groupSelect = { + Type: "5", Content: "选择班组", placeholder: "请选择班组", name: '', value: "", } - this.dataList = this.formData - // res.Result; - // this.dataList.push(groupSelect) - // this.dataList.forEach(res=>{ - // res.SelectName="" - // }) - // this.deviceName=this.dataList[0].Name; + // this.dataList = this.formData + this.dataList = res.Result; + this.dataList.push(groupSelect) + this.dataList.forEach(res=>{ + res.SelectName="" + res.putMachine.forEach(item=>{ + item.SelectName="" + }) + }) + this.deviceName=this.dataList[0].Name; this.dateTime = getCurrDateTime() - }).catch(error=>{ + }).catch(error => { uni.hideLoading() this.showMessage(error) }) @@ -244,8 +247,8 @@ // this.closeScanPopup(); // this.dataList = this.formData; // this.dateTime = getCurrDateTime() - - + + }, submit() { if (this.deviceCode == "") { @@ -253,8 +256,15 @@ return } this.$refs.customerFrom.submit(data => { - var param =data - console.log("提交", JSON.stringify(data)) + data.worker ="admin"; + var commitData={ + worker:"admin", + createTime:getCurrDateTime(), + dataList:data + } + var param = commitData + + console.log("提交", JSON.stringify(param)) // foamCheckSubmit(param).then(res=>{ // uni.hideLoading() // this.showMessage("提交成功") @@ -266,12 +276,12 @@ }) }, - clearData(){ - this.deviceCode="" + clearData() { + this.deviceCode = "" this.dateTime = "", - this.deviceCode= "", - this.deviceName="", - this.reset(); + this.deviceCode = "", + this.deviceName = "", + this.reset(); }, reset() { this.$refs.customerFrom.reset()