| | |
| | | isShowTable: false, |
| | | tableData: [],//返回的检验项目 |
| | | jymxData: [],//展示的检验项目 |
| | | |
| | | remarks:'',//不合格描述 |
| | | okNum:'',//合格数 |
| | | ngNum: '',//不合格数 |
| | | ttrre: false, |
| | | show: false, |
| | | show: false,//明细面板 |
| | | tableMxData: [], |
| | | tabActive: 0, |
| | | inputValue: '',//特征值输入 |
| | | resultValue: '',//检验结果录入 |
| | | showButton: false,//右上角菜单触发 |
| | | okValue: '', |
| | | ngValue: '' |
| | | okValue: '',//OK-数量 |
| | | ngValue: '',//NG-数量 |
| | | showDialog: false,//不良表述输入框 |
| | | //图片上传框 |
| | | fileList: [ |
| | | //{ |
| | | // url: 'https://img01.yzcdn.cn/vant/leaf.jpg', |
| | | // status: 'uploading', |
| | | // message: '上传中...', |
| | | //}, |
| | | //{ |
| | | // url: 'https://img01.yzcdn.cn/vant/tree.jpg', |
| | | // status: 'failed', |
| | | // message: '上传失败', |
| | | //}, |
| | | ], |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | this.init(); |
| | | }, |
| | | methods: { |
| | | // 输入过滤 |
| | | handleNumberInput1(value) { |
| | | // 去除非数字并确保首位不为0(除非是单独的0) |
| | | this.okValue = value.replace(/[^\d]/g, '') // 去除非数字字符 |
| | | .replace(/^0+(?!$)/, ''); // 去除开头的0,除非整个字符串是0 |
| | | }, |
| | | handleNumberInput2(value) { |
| | | // 去除非数字并确保首位不为0(除非是单独的0) |
| | | this.ngValue = value.replace(/[^\d]/g, '') // 去除非数字字符 |
| | | .replace(/^0+(?!$)/, ''); // 去除开头的0,除非整个字符串是0 |
| | | }, |
| | | handleNumberInput3(value) { |
| | | this.inputValue = value.replace(/[^\d.]/g, '') // 1. 去除非数字和小数点 |
| | | .replace(/(\..*)\./g, '$1') // 2. 禁止多个小数点 |
| | | .replace(/^\./g, ''); |
| | | }, |
| | | |
| | | togglePopup(index) { |
| | | // 切换指定索引的 popup 状态 |
| | | var that = this; |
| | |
| | | }, true, 1).then(function (res1) { |
| | | if (res1.rtnCode == 1) { |
| | | that.tableMxData = res1.rtnData; |
| | | // 统计合格数和不合格数 |
| | | const list = res1.rtnData?.list || []; // 确保 list 是数组,避免 undefined 错误 |
| | | const okNum = list.filter(item => item.fstand === '√').length; |
| | | const ngNum = list.length - okNum; |
| | | |
| | | // 将结果保存到指定变量(如 that 的成员属性) |
| | | that.okNum = okNum; |
| | | that.ngNum = ngNum; |
| | | |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | |
| | | |
| | | }, |
| | | |
| | | handleTabClick() { |
| | | console.log(this.tabActive) |
| | | this.togglePopup(this.tabActive) |
| | | getInputOK() { |
| | | var that = this; |
| | | var jys = that.tableData[that.tabActive].checkQyt;//检验项目的检验数 |
| | | |
| | | if (!that.okValue) { |
| | | this.$toast.fail("OK数不能为空"); |
| | | that.isLoading = false; |
| | | return; |
| | | } |
| | | |
| | | if (jys < that.okValue) { |
| | | that.$toast.fail("录入数量不能大于检验数!"); |
| | | that.okValue = null; |
| | | //that.$refs.okValue.focus(); |
| | | return; |
| | | } |
| | | // 切换指定索引的 popup 状态 |
| | | var resultValue = "OK-" + this.okValue; |
| | | this.getInput(resultValue); |
| | | that.okValue = null; |
| | | }, |
| | | getInputNG() { |
| | | var that = this; |
| | | var jys = that.tableData[that.tabActive].checkQyt;//检验项目的检验数 |
| | | |
| | | if (!that.ngValue) { |
| | | this.$toast.fail("NG数不能为空"); |
| | | that.isLoading = false; |
| | | return; |
| | | } |
| | | if (jys < that.ngValue) { |
| | | that.$toast.fail("录入数量不能大于检验数!"); |
| | | that.ngValue = null; |
| | | //that.$refs.ngValue.focus(); |
| | | return; |
| | | } |
| | | // 切换指定索引的 popup 状态 |
| | | var resultValue = "NG-" + this.ngValue; |
| | | this.getInput(resultValue); |
| | | that.ngValue = null; |
| | | }, |
| | | |
| | | getInput(resultValue) { |
| | | // 切换指定索引的 popup 状态 |
| | | var that = this; |
| | | var guid1 = that.formData.guid;//主表id |
| | | var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid |
| | | that.isLoading = true; |
| | | console.log(that.formData); |
| | | var input = resultValue;//拼接检验值 |
| | | that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EdtModel12', { |
| | | inOrderGuid1: guid1, |
| | | inOrderGuid5: mxguid, |
| | | inP1: input,//或者0k-19,或者ng-19 |
| | | }, true, 1).then(function (res1) { |
| | | if (res1.rtnCode == 1) { |
| | | that.$notify({ |
| | | type: 'success', message: res1.rtnMsg |
| | | }); |
| | | that.refreshJYItem();//刷新检验项目 |
| | | //that.tableData = null; |
| | | //that.$refs.inputValue.focus(); |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | that.isLoading = false; |
| | | }).catch(function (error) { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.isLoading = false; |
| | | }); |
| | | }, |
| | | |
| | | getInputTZZ() { |
| | | // 切换指定索引的 popup 状态 |
| | | var that = this; |
| | | |
| | | if (!that.inputValue) { |
| | | this.$toast.fail("特征值不能为空"); |
| | | that.isLoading = false; |
| | | return; |
| | | } |
| | | |
| | | var mxguid = that.tableData[that.tabActive].guid;//检验项目的guid |
| | | var input = that.inputValue; |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditYangLi', { |
| | | dt05Guid: mxguid, |
| | | fSeq : "pda", |
| | | fVal : input, |
| | | }, true, 1).then(function (res1) { |
| | | if (res1.rtnData.outSum == 1) { |
| | | that.$notify({ |
| | | type: 'success', message: res1.rtnMsg |
| | | }); |
| | | that.okValue = null; |
| | | that.refreshJYItem();//刷新检验项目 |
| | | //that.handleTabClick();//刷新检验明细面板 |
| | | //that.$refs.inputValue.focus(); |
| | | that.inputValue = null; |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | that.inputValue = null; |
| | | } |
| | | that.isLoading = false; |
| | | }).catch(function (error) { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.inputValue = null; |
| | | that.isLoading = false; |
| | | }); |
| | | }, |
| | | |
| | | handleTabClick() { |
| | | console.log(this.tabActive) |
| | | this.togglePopup(this.tabActive); |
| | | }, |
| | | //检验明细刷新 |
| | | refreshJYItem() { |
| | | const that = this; |
| | | return that.AxiosHttp("post", 'LLJ/getJYItem', { |
| | | releaseNo: that.formData.releaseNo |
| | | }, false).then(res1 => { |
| | | const tableData = res1.data.tbBillList || []; |
| | | that.tableData = tableData; |
| | | that.handleTabClick();//刷新检验明细面板 |
| | | }).catch(error => { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | console.error('Refresh error:', error); |
| | | }); |
| | | }, |
| | | |
| | | //主页面加载 |
| | | init() { |
| | | |
| | | //alert(this.Request("id")); |
| | | var that = this; |
| | | that.showButton = false; |
| | |
| | | let data = res.data.tbBillList[0]; |
| | | if (data) { |
| | | that.formData = data; |
| | | |
| | | that.remarks = that.formData.remarks; |
| | | that.AxiosHttp("post", 'LLJ/getJYItem', { |
| | | //id: that.formData.guid, |
| | | releaseNo: that.formData.releaseNo |
| | |
| | | } |
| | | }); |
| | | that.tableData = tableData; |
| | | that.GetImageFileByGid(); |
| | | //if (that.tableData.length === 0) { |
| | | // that.isShowTable = true; |
| | | //} |
| | |
| | | }, |
| | | submit() { |
| | | var that = this; |
| | | |
| | | //if (that.formdata.remarks == undefined && that.formdata.fcheckresu == "不合格") { |
| | | // that.$toast.fail("检验结果为不合格时,需要填写不合格描述!"); |
| | | // return; |
| | | //} |
| | | |
| | | |
| | | |
| | | that.ttrre = true; |
| | | |
| | | //that.AxiosHttp("post", 'LLJ/IqcQaSubmit', { |
| | | // userNo: this.userInfo.loginAccount, |
| | | // releaseNo: this.formData.releaseNo |
| | | //}, false).then(function (res1) { |
| | | // if (res1.status == 1) { |
| | | // that.$toast.fail(res1.message); |
| | | // } else { |
| | | // that.$notify({ type: 'success', message: '提交成功' }); |
| | | // that.init(); |
| | | // } |
| | | // that.ttrre = false |
| | | //}).catch(function (error) { |
| | | // that.$toast.fail("网络错误,请重试!"); |
| | | // that.ttrre = false |
| | | // console.log(error); |
| | | //}); |
| | | that.AxiosHttp("post", 'MesQaItemsDetect01Manager/EditModelSubmit', { |
| | | guid: that.formData.guid |
| | | }, true, 1).then(function (res1) { |
| | | if (res1.rtnCode == 1) { |
| | | if (res1.rtnData.outSum == 1) { |
| | | that.$notify({ type: 'success', message: '提交成功' }); |
| | | that.init(); |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | that.$toast.fail(res1.rtnData.outMsg); |
| | | } |
| | | that.ttrre = false |
| | | }).catch(function (error) { |
| | |
| | | }); |
| | | }, |
| | | removeXJ() { |
| | | const that = this; |
| | | // 添加确认弹窗 |
| | | that.$dialog.confirm({ |
| | | message: '确认要重新加载检验项目吗?', |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消' |
| | | }).then(() => { // 确认回调 |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'MesQaItemsDetect01Manager/ReloadModel5', { |
| | | guid: that.formData.guid |
| | | }, true, 1).then(res1 => { |
| | | if (res1.rtnCode == 1) { |
| | | that.$notify({ type: 'success', message: '重新加载成功' }); |
| | | that.init(); |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | that.isLoading = false; |
| | | }).catch(error => { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.isLoading = false; |
| | | }); |
| | | |
| | | var that = this; |
| | | |
| | | |
| | | that.AxiosHttp("post", 'MesQaItemsDetect01Manager/ReloadModel5', { |
| | | guid: that.formData.guid |
| | | }, true, 1).then(function (res1) { |
| | | if (res1.rtnCode == 1) { |
| | | that.$notify({ type: 'success', message: '重新加载成功' }); |
| | | that.init(); |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | }).catch(function (error) { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | console.log(error); |
| | | }).catch(() => { // 取消回调 |
| | | that.$toast('已取消操作'); |
| | | }); |
| | | |
| | | }, |
| | | GetBack1() { |
| | | window.history.back(); |
| | |
| | | onClickRight() { |
| | | |
| | | }, |
| | | updateRemarks(guid) { |
| | | this.showDialog= true |
| | | }, |
| | | deleteDetail13(guid13) { |
| | | const that = this; |
| | | |
| | | // 添加确认弹窗 |
| | | that.$dialog.confirm({ |
| | | message: '确认要删除该样本值记录吗?', |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消' |
| | | }).then(() => { // 确认回调 |
| | | that.isLoading = true; |
| | | that.AxiosHttp("post", 'Llj/deleteDetail13', { |
| | | id13: guid13 |
| | | }, true, 0).then(res1 => { |
| | | if (res1.status == 0) { |
| | | that.$notify({ type: 'success', message: '删除成功' }); |
| | | that.refreshJYItem();//刷新检验项目 |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | that.isLoading = false; |
| | | }).catch(error => { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.isLoading = false; |
| | | }); |
| | | |
| | | }).catch(() => { // 取消回调 |
| | | that.$toast('已取消操作'); |
| | | that.isLoading = false; |
| | | }); |
| | | }, |
| | | remarksConfirm() { |
| | | const that = this; |
| | | that.isLoading = true; |
| | | var guid = that.formData.guid; |
| | | that.AxiosHttp("post", 'Llj/updateRemarks', { |
| | | gid: guid, |
| | | Remarks: that.remarks |
| | | }, true, 0).then(res1 => { |
| | | if (res1.status == 0) { |
| | | that.$notify({ type: 'success', message: '输入成功' }); |
| | | that.init();//刷新检验项目 |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | that.isLoading = false; |
| | | }).catch(error => { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | that.isLoading = false; |
| | | }); |
| | | }, |
| | | |
| | | async afterRead(file) { |
| | | try { |
| | | //alert(APIURL_IMAGE); |
| | | // 1. 显示上传中状态 |
| | | file.status = 'uploading'; |
| | | file.message = '上传中...'; |
| | | |
| | | // 2. 创建 FormData(关键:字段名必须和后端参数名一致) |
| | | const formData = new FormData(); |
| | | |
| | | // 3. 构造文件名(根据后端要求用 ~ 分割) |
| | | // 假设需要 parentGuid,这里从组件数据获取 |
| | | const parentGuid = this.formData.guid; // 根据你的实际数据源调整 |
| | | const customFileName = `${parentGuid}~${file.file.name}`; |
| | | |
| | | // 4. 添加文件(第二个参数必须使用 new File 包装) |
| | | formData.append('file', new File([file.file], customFileName, { |
| | | type: file.file.type |
| | | })); |
| | | |
| | | // 5. 调用统一封装的 Axios 方法 |
| | | const res = await this.AxiosHttp( |
| | | 'post', |
| | | 'MesFile/UploadFile', // 根据实际接口路径调整 |
| | | formData, |
| | | true, // 显示加载状态 |
| | | 1 // 超时时间 |
| | | ); |
| | | |
| | | // 6. 处理响应 |
| | | if (res.rtnCode === 1) { |
| | | file.status = 'done'; |
| | | file.message = '上传成功'; |
| | | file.urlPath = res.rtnData.urlPath; // 保存返回的文件路径 |
| | | file.id = res.rtnData.id; // 保存返回的文件id |
| | | |
| | | // 可选:上传成功后刷新文件列表 |
| | | // await this.loadFileList(); |
| | | } else { |
| | | file.status = 'failed'; |
| | | file.message = res.rtnMsg || '上传失败'; |
| | | this.$toast.fail(res.rtnMsg); |
| | | } |
| | | |
| | | } catch (error) { |
| | | // 7. 异常处理 |
| | | file.status = 'failed'; |
| | | file.message = '上传异常'; |
| | | this.$toast.fail('网络错误,请重试'); |
| | | console.error('上传错误:', error); |
| | | } finally { |
| | | // 8. 强制更新视图(Vant 3+ 可能需要) |
| | | this.$nextTick(); |
| | | } |
| | | }, |
| | | //获取图片信息 |
| | | GetImageFileByGid() { |
| | | const that = this; |
| | | that.AxiosHttp("post", 'MesImage/getImage', { |
| | | parentId: that.formData.guid, |
| | | }, true, 0).then(res1 => { |
| | | if (res1.status === 0) { |
| | | // 关键转换:将后端数据转换为 van-uploader 需要的格式 |
| | | that.fileList = res1.data.tbBillList.map(item => ({ |
| | | url: `${APIURL_IMAGE}/${item.urlPath}`, // 拼接完整访问路径 |
| | | status: 'done', // 标记为已上传成功 |
| | | name: item.fileTitle, // 可选显示文件名 |
| | | message: '已上传', // 可选状态文字 |
| | | // 保留原始数据(按需) |
| | | id: item.guid |
| | | })); |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | }).catch(error => { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | }); |
| | | }, |
| | | handleDelete(file, { index }) { |
| | | var that = this; |
| | | that.$dialog.confirm({ |
| | | title: '确认删除', |
| | | message: '确定要删除这张图片吗?' |
| | | }).then(() => { |
| | | // 确认删除逻辑 |
| | | console.log(file); |
| | | that.AxiosHttp("post", 'MesImage/deleteImage', { |
| | | id: file.id, |
| | | }, true, 0).then(res1 => { |
| | | if (res1.status === 0) { |
| | | that.$notify({ type: 'success', message: '删除成功' }); |
| | | that.init();//刷新检验项目 |
| | | } else { |
| | | that.$toast.fail(res1.rtnMsg); |
| | | } |
| | | }).catch(error => { |
| | | that.$toast.fail("网络错误,请重试!"); |
| | | }); |
| | | |
| | | }).catch(() => { |
| | | // 取消操作 |
| | | }) |
| | | }, |
| | | } |
| | | }) |