From f003a0c4be0e2c4d60f6500e7a541af0d8246fb1 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Thu, 27 Feb 2025 11:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../outsourcerEvaluation/evaluationForm.html | 65 +++++++++---------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html b/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html index 54c943b..e392bbc 100644 --- a/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html +++ b/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html @@ -216,22 +216,8 @@ delete item.dataset.edit let fileDom = ''; - // 只要有文件列表,并且文件列表数量大于0,添加文件信息 - // if (item1.fileList && item1.fileList.length > 0) { - // // 根据文件列表的索引判断将哪个文件添加到相应的列 - // fileDom = `${item1.fileList[index - 3]}`; - // } - - // console.log('fileDomfileDomfileDomfileDom', fileDom) - - // // 将fileDom添加到当前单元格 - // $(this).append(fileDom); let dataId = $(this).data('field') - - console.log(dataId) - console.log(item1[`${dataId}-file`]) - if (item1[`${dataId}-file`] && item1[`${dataId}-file`]['fileName']) { $(this).find('.layui-table-cell').append(` `) } @@ -310,33 +296,36 @@ multiple: false, done: function (res) { // 上传完毕回调 - console.log('文件上传成功'); - console.log(res); - var dataId = $(this.elem).data('id'); - var dataIndex = $(this.elem).data('index'); - tableRowList[rowIndex][`${dataId}-file`] = { - fileName: res.message, - filePath: res.obj, + if (res.res === 1) { + var dataId = $(this.elem).data('id'); + var dataIndex = $(this.elem).data('index'); + tableRowList[rowIndex][`${dataId}-file`] = { + fileName: res.message, + filePath: res.obj, + } + // 隐藏当前上传按钮 + $(`#uploadBtn${dataIndex}`).hide() + $(`#upload-success_${dataIndex}`).show() + $(`#upload-success_${dataIndex}`).prepend(`${res.message}`) + + let hasIcon = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + dataId + ']').find('.layui-icon') > 0 + + if (!hasIcon) { + tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + dataId + ']').find('.layui-table-cell').append(` `) + } + } else { + layer.msg(res.resMsg) } - // 隐藏当前上传按钮 - $(`#uploadBtn${dataIndex}`).hide() - $(`#upload-success_${dataIndex}`).show() - $(`#upload-success_${dataIndex}`).prepend(`${res.message}`) - // 插入新的 DOM 元素, - // var newDom = $(`
${res.message}
`); - // $(this.elem).parent().append(newDom); + + }, error: function () { - // 请求异常回调 - console.log('文件上传失败'); + + layer.msg('请求失败') } }) }) - // $('.uploadBtn').on('click', function (event) { - // event.stopPropagation(); // 阻止事件冒泡 - // event.preventDefault(); // 阻止默认行为 - // console.log('上传附件按钮被点击了'); - // }); + }, yes: function (index) { @@ -344,6 +333,8 @@ let formData = {}; let fields = dialogLabelInfo.map((e) => e.field) + + let isValidate = false $('#uploadForm input').each(function () { let inputValue = $(this).val(); let maxValue = $(this).data('value') @@ -356,10 +347,12 @@ if (!regex.test(parseFloat(inputValue))) { layer.msg('请输入大于等于0的正整数') + isValidate = true return false } if (parseFloat(inputValue) > maxValue) { layer.msg(`不可当前最大分值是${maxValue}`) + isValidate = true return false } @@ -369,6 +362,8 @@ formData[dataId] = inputValue * 1 // 将 data-id 作为键,输入框的值作为值 } }) + + if (isValidate) return const currentRows = tableRowList[rowIndex] Object.assign(currentRows, formData)