From 9a7fd64a5af9d441ef9b92a3d3c8b3b8bc1cd8e2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 08 二月 2025 12:22:21 +0800 Subject: [PATCH] 2025-02-08 --- src/tabviews/zshare/mutilform/index.jsx | 198 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 171 insertions(+), 27 deletions(-) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index d92f54b7..4d4591f 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -4,6 +4,7 @@ import { Form, Row, Col, notification, Tooltip, Rate } from 'antd' import { QuestionCircleOutlined, StarFilled } from '@ant-design/icons' import moment from 'moment' +import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -140,6 +141,8 @@ } else if (item.type === 'datetime') { item.type = 'date' item.precision = 'second' + } else if (item.type === 'fileupload') { + item.fieldlength = item.fieldlength || 512 } if (!item.field || !['text', 'number', 'switch', 'check', 'rate', 'select', 'popSelect', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color', 'vercode'].includes(item.type)) return false @@ -170,6 +173,7 @@ } else if (item.type === 'linkMain') { readin = false item.readin = false + item.$verify = item.verifyVal === 'true' } else if (item.type === 'number') { item.decimal = item.decimal || 0 item.fieldlength = item.decimal @@ -283,6 +287,17 @@ } else { item.showValue = '' } + if (window.backend && action.uuid) { + item.formSqlId = md5(action.uuid.replace(/_pop$/, '') + item.uuid) + } + } else if (item.type === 'brafteditor') { + if (window.backend && newval && /<\/span>/.test(newval) && item.encryption === 'true') { + try { + newval = window.btoa(window.encodeURIComponent(newval)) + } catch (e) { + newval = '' + } + } } if (newval !== '$empty') { @@ -386,7 +401,7 @@ }) } else if (item.regular === 'phone') { item.rules.push({ - pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, + pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\s?\d{4}\s?\d{4}$/, message: item.regularText || dict['phone_error'] || '璇锋纭緭鍏ユ墜鏈哄彿' }) } else if (item.regular === 'email') { @@ -771,7 +786,7 @@ resetFocus = (id, field) => { const { action } = this.props - if (id !== action.uuid) return + if (id !== action.uuid.replace(/_pop$/, '')) return let focusId = '' @@ -840,7 +855,9 @@ } getFormData = (deForms) => { - if (deForms.length === 1) { + if (window.backend && window.GLOB.CacheData.has('sql_' + md5(this.props.action.uuid.replace(/_pop$/, '') + deForms[0].uuid))) { + this.improveBackActionForm(deForms) + } else if (deForms.length === 1) { this.improveSimpleActionForm(deForms) } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { this.improveSimpleActionForm(deForms) @@ -849,6 +866,117 @@ } } + /** + * @description 鑾峰彇涓嬫媺琛ㄥ崟閫夐」淇℃伅 + */ + improveBackActionForm = (deForms) => { + const { BID, action } = this.props + + let sysvals = { + mk_departmentcode: sessionStorage.getItem('departmentcode') || '', + mk_organization: sessionStorage.getItem('organization') || '', + mk_user_type: sessionStorage.getItem('mk_user_type') || '', + id: this.state.ID || '', + bid: BID || '', + datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' + } + if (window.GLOB.externalDatabase !== null) { + sysvals.db = window.GLOB.externalDatabase + } + + let deffers = [] + let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� + let localItems = [] // 鏈湴鏁版嵁 + let cache = action.setting.cache !== 'false' && !action.$cache + let skip = false + + deForms.forEach(item => { + let ex = window.GLOB.CacheData.get('sql_' + md5(action.uuid.replace(/_pop$/, '') + item.uuid)) + + if (!ex) { + notification.warning({ + top: 92, + message: '琛ㄥ崟锛�' + item.label + '锛夋棤鍙墽琛岃剼鏈��', + duration: 5 + }) + return + } + + let exps = [] + ex.reps.forEach(n => { + let key = n.toLowerCase() + if (sysvals.hasOwnProperty(key)) { + exps.push({ + key: n, + value: sysvals[key] + }) + } + }) + + let cell = { + id: ex.id, + menuname: item.label + '锛堣〃鍗曪級', + exps: exps, + md5_id: '' + } + + if (item.database === 'sso' && window.GLOB.mainSystemApi) { + mainItems.push(cell) + } else { + localItems.push(cell) + } + }) + + if (localItems.length) { + deffers.push({ + $backend: true, + $type: 's_Get_SelectedList', + data: localItems + }) + } + + if (mainItems.length) { + deffers.push({ + $backend: true, + $type: 's_Get_SelectedList', + data: mainItems, + rduri: window.GLOB.mainSystemApi + }) + } + + if (!deffers.length) return + + deffers = deffers.map(item => { + return new Promise(resolve => { + Api.getSystemCacheConfig(item, cache).then(res => { + if (!res.status) { + if (res.ErrCode !== '-2') { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + skip = true + } + resolve(res) + }) + }) + }) + + Promise.all(deffers).then(response => { + let result = {...response[0], ...(response[1] || {})} + + delete result.ErrCode + delete result.ErrMesg + delete result.message + delete result.status + + this.resetFormList(result, skip) + }) + } /** * @description 鑾峰彇涓嬫媺琛ㄥ崟閫夐」淇℃伅 */ @@ -922,11 +1050,13 @@ new Promise(resolve => { Api.getSystemCacheConfig(param, cache).then(res => { if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + if (res.ErrCode !== '-2') { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } skip = true } resolve(res) @@ -964,11 +1094,13 @@ new Promise(resolve => { Api.getSystemCacheConfig(mainparam, cache).then(res => { if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + if (res.ErrCode !== '-2') { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } skip = true } resolve(res) @@ -1034,11 +1166,13 @@ setTimeout(() => { Api.getSystemCacheConfig(param, cache).then(res => { if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + if (res.ErrCode !== '-2') { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } skip = true } resolve(res) @@ -1401,6 +1535,11 @@ key: item.field, isconst: item.constant === 'true' } + + if (item.$verify) { + _item.$verify = true + _item.label = item.label + } _item.value = record[item.field] !== undefined ? record[item.field] : '' @@ -1412,7 +1551,7 @@ } else if (['text', 'textarea', 'linkMain'].includes(item.type)) { _item.value = _item.value + '' _item.value = _item.value.replace(/\t+|\v+/g, '') // 鍘婚櫎鍒惰〃绗� - + if (item.interception !== 'false') { // 鍘婚櫎棣栧熬绌烘牸 if (item.interception === 'func') { try { @@ -1442,14 +1581,19 @@ _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') } } - if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 鐗规畩瀛楁鏇挎崲 - _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) - } - if (item.type === 'text' && item.lenControl && item.lenControl !== 'limit') { - if (item.lenControl === 'left') { - _item.value = _item.value.substr(0, item.fieldlength) - } else { - _item.value = _item.value.slice(-item.fieldlength) + if (item.type === 'text') { + if (/@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 鐗规畩瀛楁鏇挎崲 + _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) + } + if (item.lenControl && item.lenControl !== 'limit') { + if (item.lenControl === 'left') { + _item.value = _item.value.substr(0, item.fieldlength) + } else { + _item.value = _item.value.slice(-item.fieldlength) + } + } + if (item.regular === 'phone') { + _item.value = _item.value.replace(/\s+/g, '') } } } else if (item.type === 'datemonth') { -- Gitblit v1.8.0