From 735955be17afba088e389c85ad36145656b3d750 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 12 五月 2024 23:03:00 +0800 Subject: [PATCH] 2024-05-12 --- src/utils/utils.js | 72 ++++++++++++++++++++++++++--------- 1 files changed, 53 insertions(+), 19 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 64d2720..39c4796 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2149,6 +2149,7 @@ let status = 0 let statusName = '' let detailId = '' + let sign = '' let error = '' let userid = sessionStorage.getItem('UserID') || '' let checkIds = [] @@ -2197,14 +2198,31 @@ } }) if (!error) { - line = lines[0] + lines = lines.filter(cell => { + if (cell.mkdata.seniorCondition === 'open' && !line) { + cell.mkdata.seniorbers && cell.mkdata.seniorbers.forEach(per => { + if (per.worker_id === userid) { + line = cell + } + }) + + return false + } + + return true + }) + + if (!line) { + line = lines[0] + } } } else if (!_data.hasOwnProperty(branchKey)) { error = '淇℃伅涓棤娴佺▼鎺у埗瀛楁銆�' } else { - let equalLine = null - let gtOrLtLine = [] - let unEqualLine = null + let _def_lines = [] + let _equ_lines = [] + let _unequ_lines = [] + let _or_lines = [] let branchVal = _data[branchKey] if (branchVal && typeof(branchVal) === 'string' && !isNaN(branchVal)) { @@ -2213,45 +2231,58 @@ lines.forEach(item => { if (item.mkdata.execCondition !== 'open') { - line = item + _def_lines.push(item) } else { if (item.mkdata.match === '=') { if (item.mkdata.matchVal === branchVal + '') { - equalLine = item + _equ_lines.push(item) } } else if (item.mkdata.match === '!=') { if (item.mkdata.matchVal !== branchVal + '') { - unEqualLine = item + _unequ_lines.push(item) } } else { if (item.mkdata.match === '<') { if (item.mkdata.matchVal < branchVal) { - gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) + _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) } } else if (item.mkdata.match === '>') { if (item.mkdata.matchVal > branchVal) { - gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) + _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) } } else if (item.mkdata.match === '<=') { if (item.mkdata.matchVal <= branchVal) { - gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) + _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) } } else if (item.mkdata.match === '>=') { if (item.mkdata.matchVal >= branchVal) { - gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) + _or_lines.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)}) } } } } }) - if (equalLine) { - line = equalLine - } else if (gtOrLtLine.length > 0) { - gtOrLtLine.sort((a, b) => a.dist - b.dist) - line = gtOrLtLine[0] - } else if (unEqualLine) { - line = unEqualLine + _or_lines.sort((a, b) => a.dist - b.dist) + + let _lines = [..._equ_lines, ..._or_lines, ..._unequ_lines, ..._def_lines] + + _lines = _lines.filter(cell => { + if (cell.mkdata.seniorCondition === 'open' && !line) { + cell.mkdata.seniorbers && cell.mkdata.seniorbers.forEach(per => { + if (per.worker_id === userid) { + line = cell + } + }) + + return false + } + + return true + }) + + if (!line) { + line = _lines[0] } } } @@ -2264,6 +2295,7 @@ detailId = line.id status = line.mkdata.status statusName = line.mkdata.statusName + sign = line.mkdata.seniorSign || '' target = flow.cells.filter(cell => cell.id === line.target.cell)[0] line.mkdata.members && line.mkdata.members.forEach(item => { @@ -2288,7 +2320,7 @@ if (!target) { error = '鏈煡璇㈠埌宸ヤ綔娴佺洰鏍囪妭鐐�' - } else if (checkIds.length === 0 && line.mknode !== 'startEdge' && line.mknode !== 'endEdge') { + } else if (checkIds.length === 0 && !['startEdge', 'endEdge', 'throughEdge'].includes(line.mknode)) { error = '鏈幏鍙栧埌涓嬩竴姝ュ鎵逛汉' } else if (line.approvalMethod === 'countersign' && (!node.checkIds || !node.checkIds.includes(userid))) { error = '褰撳墠鐢ㄦ埛涓嶅湪瀹℃壒浜哄垪琛ㄤ腑' @@ -2453,6 +2485,8 @@ } } + _sql = _sql.replace(/@works_flow_sign@/ig, `'${sign}'`) + _sql = _sql.replace(/@check_userids@/ig, `'${checkIds.join(',')}'`) _sql = _sql.replace(/@notice_userids@/ig, `'${noticeIds.join(',')}'`) -- Gitblit v1.8.0