var vm = new Vue({ el: '#app', data: function () { return { isLoading: false, userInfo: { "loginGuid": '', "loginAccount": '', }, formData: {}, isNumber: false, checkItem: "", id: 0, gid: 0, itemInId: 0, billNo: "", showPopup: false, editData: {}, tableData: [], isShowImg: false, base64Image: "", remarks: "", remarksPopup: false, fcheckResu: null, fsubmit:1 } }, mounted() { var that = this; this.userInfo = { loginGuid: this.GetLoginInfor().loginGuid, loginAccount: this.GetLoginInfor().loginAccount, }; this.id = this.Request("id"); this.gid = this.Request("gid"); this.fsubmit = this.Request("fsubmit"); this.refreshResult(); }, methods: { refreshResult() { var that = this; that.AxiosHttp("post", 'LLJ/getXjDetail02ById', { id: this.id }, false) .then(function (res) { that.formData = res.data.tbBillList.itemXj01; that.tableData = res.data.tbBillList.itemXj02s; //if (this.formData.imageData) { // this.isShowImg = true; // this.base64Image = 'data:image/jpeg;base64,' + this.formData.imageData; //} //fupAllow fdownAllow standardValue if (that.formData.fupAllow && that.formData.fdownAllow && that.formData.fstand) { that.isNumber = true; } }) .catch(function (error) { that.$toast.fail("网络错误,请重试!"); console.log(error); }); }, submit() { let count = this.formData.checkQyt; let fstand = "√"; //有最大值和最小值就根据是否符合标准值更新判定结果,没有最大值和最小值就根据是否通过检验判定结果 if (this.formData.fupAllow && this.formData.fdownAllow) { if (!this.formData.fcheckResu) { this.$toast.fail("请输入检验值"); return; } let max = Number(this.formData.fupAllow); let min = Number(this.formData.fdownAllow); if (this.formData.fcheckResu >= min && this.formData.fcheckResu <= max) { fstand = "√" } else { fstand = "×"; } count = 1; } else { if (!this.formData.fcheckResu) { this.formData.fcheckResu = 1 } if (this.formData.fcheckResu == 0 || this.formData.fcheckResu == 1) { this.formData.isPass = this.formData.fcheckResu } else { this.$toast.fail("无标准值时,检验结果只能为0或1!"); return; } count = count - this.tableData.length; } this.formData.updater = this.userInfo.loginAccount; var that = this; that.AxiosHttp("post", 'LLJ/SetQSItemDetail', { parentGuid: that.id, grandpaGuid: that.gid, fstand: fstand, fcheckItem: that.formData.fcheckItem, fcheckResu: that.formData.fcheckResu, lastupdateBy: that.formData.updater, count: count }, false) .then(function (res) { that.formData.fcheckResu = null; that.$notify({ type: 'success', message: '保存成功' }); that.refreshResult(); }) .catch(function (error) { that.$toast.fail("网络错误,请重试!"); console.log(error); }); }, toDetail(item) { this.showPopup = !this.showPopup; this.editData = item; }, editResult(fcheckResu) { if (fcheckResu == 'OK') { return "改为不合格"; } else { return "改为合格"; } }, numberEdit(item) { let fstand = "√"; let fcheckResu = "OK"; if (item.fcheckResu == 'OK') { fstand = "×"; fcheckResu = "NG"; } var that = this; that.AxiosHttp("post", 'LLJ/UpdateQSItemDetail', { guid: item.guid, parentGuid: item.parentGuid, grandpaGuid: item.grandpaGuid, fstand: fstand, fcheckResu: fcheckResu, lastupdateBy: that.userInfo.loginAccount, }, false) .then(function (res) { that.$notify({ type: 'success', message: '修改成功' }); that.refreshResult(); }) .catch(function (error) { that.$toast.fail("网络错误,请重试!"); console.log(error); }); }, eidt() { if (!this.editData.fcheckResu) { this.$toast.fail("请输入检验结果"); } if (this.formData.fcheckResu == this.editData.fcheckResu) { this.$notify({ type: 'success', message: '修改成功' }); return; } let fstand = "√"; if (this.formData.fupAllow && this.formData.fdownAllow) { if (!this.editData.fcheckResu) { this.$toast.fail("请输入检验值"); return; } let max = Number(this.formData.fupAllow); let min = Number(this.formData.fdownAllow); if (this.editData.fcheckResu >= min && this.editData.fcheckResu <= max) { this.editData.isPass = 1 } else { this.editData.isPass = 0 fstand = "×"; } } else { if (!this.editData.fcheckResu) { this.editData.fcheckResu = 1 } if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) { if (this.editData.fcheckResu == 0) { fstand = "×"; } } else { this.$toast.fail("无标准值时,检验结果只能为0或1!"); return; } } this.editData.updater = this.userInfo.loginAccount; var that = this; that.AxiosHttp("post", 'LLJ/UpdateQSItemDetail', { guid: that.editData.guid, parentGuid: that.editData.parentGuid, grandpaGuid: that.editData.grandpaGuid, fstand: fstand, fcheckResu: that.editData.fcheckResu, lastupdateBy: that.userInfo.loginAccount, }, false) .then(function (res) { if (res.status == 0) { that.$notify({ type: 'success', message: '修改成功' }); that.showPopup = false; that.refreshResult(); } else { that.$toast.fail(res.message); that.editData.fcheckResu = that.fcheckResu; } }) .catch(function (error) { that.$toast.fail("网络错误,请重试!"); console.log(error); }); }, GoBack1() { window.history.back(); } } })