From 855c0b9ec97bde46f93cfbbef600405bf9f405a0 Mon Sep 17 00:00:00 2001 From: lSun <15893999301@qq.com> Date: Fri, 18 Jul 2025 17:58:19 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../outsourcerEvaluation/evaluationForm.html | 191 +++++------------- .../summaryAudit/summaryAuditView.html | 55 ++++- 2 files changed, 105 insertions(+), 141 deletions(-) diff --git a/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html b/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html index 8469f25..c723fba 100644 --- a/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html +++ b/src/main/resources/static/pages/evaluate/outsourcerEvaluation/evaluationForm.html @@ -48,6 +48,7 @@ let headerRows; let layer, laydate, table, form; let tableLoading, tableIns; + let targetFieldPrefixForNegativeInput = ''; // 新增:用于存储“加减分项”的字段前缀 // 定义一个列表的数据源 作为提交时参数 let tableRowList = [] @@ -70,59 +71,6 @@ }); function initTable() { - // headerRows = [ - // [ - // {title: '序号', mergeType: "rowspan", num: 3, field: 'index'}, - // {title: '施工业务外包商', mergeType: "rowspan", num: 3, field: 'subName'}, - // {title: '工程名称', mergeType: "rowspan", num: 3, field: 'proName'}, - // {title: '现场组织指标', mergeType: "colspan", num: 3}, - // {title: '安全管理指标', mergeType: "colspan", num: 4}, - // {title: '得分', mergeType: "rowspan", num: 3, field: 'score'} - // ], - // [ - // {title: '入场人员达标率', mergeType: "rowspan", num: 1}, - // {title: '管理人员到岗履职率', mergeType: "rowspan", num: 1}, - // {title: '合计', field: 'total1', mergeType: "rowspan", num: 2}, - // {title: '安全违章记分', mergeType: "colspan", num: 3}, - // {title: '合计', field: 'total2', mergeType: "rowspan", num: 2} - // ], - // [ - // {title: '项目部', field: 'dept1', mergeType: "rowspan", num: 1,edit: 'text'}, - // {title: '项目部', field: 'dept2', mergeType: "rowspan", num: 1,edit: 'text'}, - // {title: '项目部', field: 'dept3', mergeType: "rowspan", num: 1,edit: 'text'}, - // {title: '事业部', field: 'dept4', mergeType: "rowspan", num: 1,edit: 'text'}, - // {title: '安全监察部', field: 'dept5', mergeType: "rowspan", num: 1,edit: 'text'} - // ] - // ]; - // - // const data = [ - // { - // "subName": '外包商A', - // "proName": '工程A', - // "total1": 90, - // "dept1": 30, - // "dept2": 30, - // "dept3": 30, - // "total2": 80, - // "dept4": 40, - // "dept5": 40, - // "score": 85 - // }, - // { - // "subName": '外包商B', - // "proName": '工程B', - // "total1": 85, - // "dept1": 25, - // "dept2": 30, - // "dept3": 30, - // "total2": 75, - // "dept4": 35, - // "dept5": 40, - // "score": 80 - // } - // ]; - // //渲染表格 - // setCols(headerRows,data); getTitle(); } @@ -138,6 +86,14 @@ tableFieldList = dialogLabelInfo tableFieldValueList = dialogLabelList + // 根据一级标题“六、加减分项”找到对应的字段前缀 + for (const col of headerRows[0]) { + if (col.title === '六、加减分项') { + targetFieldPrefixForNegativeInput = col.field; + break; + } + } + // Clear existing headers const thead = document.querySelector('#baseTable thead'); if (thead) { @@ -152,17 +108,6 @@ let dataList = rowData let href = window.location.href - // if (index === 0 && !href.includes('type=1')) { - // let dataList = rowData - // dataList.splice(6, 0, { - // field: "handle", - // mergeType: "rowspan", - // minWidth: 75, - // num: 3, - // title: "操作", - // }) - // // dataList.push() - // } dataList.forEach(cellData => { cellData.cellMinWidth = 120; cellData.align = 'center'; @@ -173,7 +118,7 @@ if (cellData.field.split('-').length === 1) { cellData.title = `${cellData.title}`; + title="计算方法" style="margin-left: 5px;">`; } } if (cellData.mergeType === "colspan") { @@ -215,9 +160,6 @@ } if (index === cols.length - 1) { - // let lastRow = tableView.find('tr').last(); // 找到最后一行 - // let lastCell = lastRow.find('td').last(); // 找到最后一个单元格 - // let div = lastCell.find('div') let div = $(this).find('div') // 创建自定义 DOM 元素 @@ -243,30 +185,28 @@ let innerHtml = '' const curRows = tableRowList[rowIndex] dialogLabelList.forEach((e, index) => { - // fileList.push('') - isFile = null if (curRows[`${dialogLabelInfo[index].field}-file`]) { isFile = curRows[`${dialogLabelInfo[index].field}-file`] } uploadDom.push('#uploadBtn' + index) innerHtml += `
-
${e.title}
- - -
${isFile ? isFile.fileName : ''}
-
` +
${e.title}
+ + +
${isFile ? isFile.fileName : ''}
+ ` }) formHtml += ` -
-
- ${innerHtml} -
-
` +
+
+ ${innerHtml} +
+
` layer.open({ @@ -301,9 +241,6 @@ 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) } @@ -329,20 +266,40 @@ $('#uploadForm input[name="numberInput"]').each(function () { let inputValue = $(this).val().trim(); let maxValue = $(this).data('value') + const currentDataId = $(this).data('id'); // 获取当前输入框的data-id - console.log('inputValueinputValueinputValue', inputValue) + let regex; + let errorMessage; + let inputTitle = ''; - const regex = /^(0|[1-9]\d*)?$/ + // 查找对应的标题 + const dialogInfoIndex = dialogLabelInfo.findIndex(info => info.field === currentDataId); + if (dialogInfoIndex !== -1) { + inputTitle = dialogLabelList[dialogInfoIndex].title; + } + + // 根据dataId是否以“加减分项”的字段前缀开头来判断 + if (currentDataId && currentDataId.startsWith(targetFieldPrefixForNegativeInput)) { + regex = /^-?(0|[1-9]\d*)?$/; // 允许负数和非负数整数 + errorMessage = `【${inputTitle}】请输入整数`; + } else { + regex = /^(0|[1-9]\d*)?$/; // 只允许非负整数 + errorMessage = `【${inputTitle}】请输入大于等于0的正整数`; + } if (!regex.test(inputValue)) { - layer.msg('请输入大于等于0的正整数') - isValidate = true - return false + layer.msg(errorMessage); + isValidate = true; + return false; } - if (inputValue > maxValue) { - layer.msg(`不可当前最大分值是${maxValue}`) - isValidate = true - return false + + // 新增:判断输入值的绝对值是否超过最大分值 + if (inputValue !== '' && !isNaN(Number(inputValue))) { + if (Math.abs(Number(inputValue)) > maxValue) { + layer.msg(`【${inputTitle}】输入值不可超过最大分值${maxValue}`); + isValidate = true; + return false; + } } @@ -359,8 +316,6 @@ const currentRows = tableRowList[rowIndex] Object.assign(currentRows, formData) - // currentRows.fileList = fileList - for (let key in formData) { let curTd = tableView.find('tr[data-index=' + rowIndex + ']').find('td[data-field=' + key + ']') @@ -399,18 +354,12 @@ var dataIndex = $(this).data('index'); var Index = $(this).data('idx'); var dataId = $(this).data('id'); - // console.log('删除图标被点击,data-index:', dataIndex); - - // fileList[dataIndex] = '' - // 执行删除操作 tableRowList[dataIndex][`${dataId}-file`] = { fileName: '', filePath: '', } - // $(this).parent().remove() $(`#upload-success_${Index}`).hide(function () { - // 当隐藏完之后,移除插入的内容 $(`#upload-success_${Index} .prepend-content`).remove(); }) $(`#uploadBtn${Index}`).show() @@ -467,43 +416,7 @@ } function getTableData() { - - - /* for (var i = 0; i < tableRowList.length; i++) { - var item = tableRowList[i]; - for (var key in item) { - if (key.indexOf("-") !== -1) { - if (item[key] === '' || item[key] === null) { - layer.msg('请对所有指标评价完成,再点击提交!'); - return; - } - } - } - }*/ - - - // //获取表格填写的数据 var tableData = table.cache.baseTable; - // //校验所有单元格是否填写 - // for (var i = 0; i < tableData.length; i++) { - // var item = tableData[i]; - // for (var key in item) { - // if (key.indexOf("-") !== -1) { - // if (item[key] === '' || item[key] === null) { - // layer.msg('请对所有指标评价完成,再点击提交!'); - // return; - // } - // } - // } - // } - // let filed = []; - // //定义一个map - // let obj = tableData[0]; - // for (let key in obj) { - // if (key.indexOf("-") !== -1) { - // filed.push(key); - // } - // } let fields = tableFieldList.map((e) => e.field) if (getUrlParam("type") == '2') { @@ -541,4 +454,4 @@ parent.search(1) parent.layer.close(index); // 再执行关闭 } - \ No newline at end of file + diff --git a/src/main/resources/static/pages/evaluate/summaryAudit/summaryAuditView.html b/src/main/resources/static/pages/evaluate/summaryAudit/summaryAuditView.html index 5c29b66..b428c7c 100644 --- a/src/main/resources/static/pages/evaluate/summaryAudit/summaryAuditView.html +++ b/src/main/resources/static/pages/evaluate/summaryAudit/summaryAuditView.html @@ -71,8 +71,14 @@ ``; } if (localStorage.getItem("AllAuditTitle") == '审核') { - btn = - ``; + + let isHide = getHide(data[i].id) + if(isHide){ + btn = ``; + }else{ + btn = ``; + } + // btn = ``; } btnGroup.append(btn); } @@ -548,6 +554,51 @@ content: url, }); } + + + function getHide(id){ + let isHide = false; + $.ajax({ + url: ctxPath + '/outsourcer/isCheckOneIsAudit', + type: 'get', + async:false, + data: { + templateId: getUrlParam('templateId'), + evaluateId: getUrlParam('evaluateId'), + deptId: id, + evaluateType: '3', + type: 'auditAll', + }, + success: function (res) { + if (res.res == '1') { + isHide = true + $.ajax({ + url: ctxPath + '/outsourcer/isCheckThreeIsAudit', + type: 'get', + async:false, + data: { + templateId: getUrlParam('templateId'), + evaluateId: getUrlParam('evaluateId'), + deptId: id, + evaluateType: '3', + type: 'auditAll', + }, + success: function (res) { + debugger + if (res.res == '1') { + isHide =false; + }else{ + isHide = true; + } + } + }) + } else { + isHide =false; + } + } + }) + return isHide; + }