|
|
|
@ -67,7 +67,7 @@ const props = withDefaults( |
|
|
|
{ |
|
|
|
type: 1, // 1新增;2修改;3查看(表单模式) ;4查看; 5设计 |
|
|
|
numrun: 2, |
|
|
|
formData: () => { |
|
|
|
formDataEs: () => { |
|
|
|
return { |
|
|
|
list: [], |
|
|
|
form: {}, |
|
|
|
@ -575,7 +575,7 @@ provide(constControlChange, ({ key, value, data, tProp, type, attribute }: any) |
|
|
|
// console.log("表单组件值改变事件----------6--------->", attribute); |
|
|
|
// console.log("表单组件值改变事件----------11--------->", model.value); |
|
|
|
|
|
|
|
let fieldVal = {}; |
|
|
|
const fieldVal: any = {}; |
|
|
|
for (let i in model.value) { |
|
|
|
if (i == key) { |
|
|
|
fieldVal[i] = typeof value == "number" ? value.toString() : value; |
|
|
|
@ -682,7 +682,7 @@ let mustBeHidden: any = []; |
|
|
|
let newModelKeyArr: string[] = []; |
|
|
|
|
|
|
|
// 判断对象是否是“内容为空的纯对象” |
|
|
|
function isEmptyPlainObject(obj) { |
|
|
|
function isEmptyPlainObject(obj: {}) { |
|
|
|
// 先确认是对象类型,再检查属性数量为0 |
|
|
|
return Object.prototype.toString.call(obj) === '[object Object]' |
|
|
|
&& Object.keys(obj).length === 0; |
|
|
|
@ -927,7 +927,7 @@ function showOrHide(data: any,currentDataNameValue?:any) { |
|
|
|
const radioSelectArr2: any[] = []; |
|
|
|
|
|
|
|
|
|
|
|
const radioSelectZdtcszConfigArr = []; |
|
|
|
const radioSelectZdtcszConfigArr: any[] = []; |
|
|
|
|
|
|
|
//20240815 关联选项设置的隐藏效果嵌套在内时不生效的问题修复 liwenxuan start |
|
|
|
//console.log(props.formData.list) newModelKeyArr |
|
|
|
@ -1362,7 +1362,7 @@ console.log("设置了标题行和索引列====2===>",model.value) |
|
|
|
* @param {string} str - 待处理的原始字符串 |
|
|
|
* @returns {string} 最后一个冒号后的子串;无冒号/冒号在末尾时返回空字符串 |
|
|
|
*/ |
|
|
|
function getLastColonAfterString(str) { |
|
|
|
function getLastColonAfterString(str: string | string[]) { |
|
|
|
// 1. 输入校验:确保输入是字符串类型(处理非字符串入参) |
|
|
|
if (typeof str !== 'string') { |
|
|
|
//console.warn('输入必须为字符串类型'); |
|
|
|
@ -1395,7 +1395,7 @@ function getLastColonAfterString(str) { |
|
|
|
* @param {String|Number} columnValue - 列标识 |
|
|
|
* @returns {String|undefined} - 返回对应的单元格值,如果未找到则返回undefined |
|
|
|
*/ |
|
|
|
function getTableCellValueV3(tableData, rowValue, columnValue) { |
|
|
|
function getTableCellValueV3(tableData: { [x: string]: any; default: { [x: string]: any; }; }, rowValue: null, columnValue: null) { |
|
|
|
try { |
|
|
|
// 检查输入参数 |
|
|
|
if (!tableData || typeof tableData !== 'object' || Array.isArray(tableData)) { |
|
|
|
@ -1475,7 +1475,7 @@ function getTableCellValueV3(tableData, rowValue, columnValue) { |
|
|
|
* 增强版:自动检测tableData结构并获取值 |
|
|
|
* 支持动态结构检测 |
|
|
|
*/ |
|
|
|
function getTableCellValueEnhanced(tableData, rowValue, columnValue) { |
|
|
|
function getTableCellValueEnhanced(tableData: { [x: string]: any; default?: { [x: string]: any; } | { [x: string]: any; } | { [x: string]: any; }; }, rowValue: string | null, columnValue: string | null) { |
|
|
|
try { |
|
|
|
if (!tableData || typeof tableData !== 'object') { |
|
|
|
return undefined; |
|
|
|
@ -1530,7 +1530,7 @@ function getTableCellValueEnhanced(tableData, rowValue, columnValue) { |
|
|
|
* 检测tableData的结构 |
|
|
|
* @returns {string} - 结构类型:'standard', 'singleRow', 'singleColumn', 'mixed', 'unknown' |
|
|
|
*/ |
|
|
|
function detectTableStructure(tableData) { |
|
|
|
function detectTableStructure(tableData: { [x: string]: any; default: { [x: string]: any; }; }) { |
|
|
|
if (!tableData || typeof tableData !== 'object') { |
|
|
|
return 'unknown'; |
|
|
|
} |
|
|
|
@ -1613,14 +1613,14 @@ function detectTableStructure(tableData) { |
|
|
|
/** |
|
|
|
* 从仅一行结构中获取值 |
|
|
|
*/ |
|
|
|
function getFromSingleRowStructure(tableData, columnStr) { |
|
|
|
function getFromSingleRowStructure(tableData: { default: { [x: string]: any; }; }, columnStr: string) { |
|
|
|
return tableData.default?.[columnStr]; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 从仅一列结构中获取值 |
|
|
|
*/ |
|
|
|
function getFromSingleColumnStructure(tableData, columnStr) { |
|
|
|
function getFromSingleColumnStructure(tableData: { [x: string]: any; }, columnStr: string) { |
|
|
|
const colData = tableData[columnStr]; |
|
|
|
if (colData && typeof colData === 'object') { |
|
|
|
// 优先返回default值,如果没有则返回第一个值 |
|
|
|
@ -1632,7 +1632,7 @@ function getFromSingleColumnStructure(tableData, columnStr) { |
|
|
|
/** |
|
|
|
* 从混合结构中获取值 |
|
|
|
*/ |
|
|
|
function getFromMixedStructure(tableData, rowStr, columnStr) { |
|
|
|
function getFromMixedStructure(tableData: { [x: string]: any; default: { [x: string]: any; }; }, rowStr: string, columnStr: string) { |
|
|
|
// 尝试多种方式 |
|
|
|
|
|
|
|
// 1. 尝试标准方式 |
|
|
|
@ -1675,7 +1675,7 @@ function getFromMixedStructure(tableData, rowStr, columnStr) { |
|
|
|
/** |
|
|
|
* 统一方法,推荐使用这个 |
|
|
|
*/ |
|
|
|
function getTableCellValue(tableData, rowValue, columnValue) { |
|
|
|
function getTableCellValue(tableData: any, rowValue: string, columnValue: string) { |
|
|
|
return getTableCellValueEnhanced(tableData, rowValue, columnValue); |
|
|
|
} |
|
|
|
|
|
|
|
@ -2375,7 +2375,7 @@ function getAfterLastColon(str:string) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function modifyTreeData(treeData, idList) { |
|
|
|
function modifyTreeData(treeData: any, idList: any) { |
|
|
|
//console.log("modifyTreeDataMinimal 执行了"); |
|
|
|
let gkFlag = true |
|
|
|
const idArray = Array.isArray(idList) ? idList : [idList]; |
|
|
|
@ -2460,7 +2460,7 @@ function modifyTreeData(treeData, idList) { |
|
|
|
} |
|
|
|
|
|
|
|
// 辅助函数:查找特定条件的节点 |
|
|
|
function findTargetNode(treeData) { |
|
|
|
function findTargetNode(treeData: any) { |
|
|
|
if (!treeData) return null; |
|
|
|
|
|
|
|
const stack = Array.isArray(treeData) ? [...treeData] : [treeData]; |
|
|
|
@ -2483,11 +2483,13 @@ function findTargetNode(treeData) { |
|
|
|
} |
|
|
|
|
|
|
|
// 辅助函数:递归构建节点树 |
|
|
|
function buildNodeTree(node, keepIds, idArray, processedIds) { |
|
|
|
function buildNodeTree(node: { id: any; label: any; value: any; children: string | any[]; }, keepIds: Set<unknown>, idArray: string | any[], processedIds: Set<unknown>) { |
|
|
|
const newNode = { |
|
|
|
id: node.id, |
|
|
|
label: node.label, |
|
|
|
value: node.value |
|
|
|
value: node.value, |
|
|
|
number: node.label, |
|
|
|
children: node.children, |
|
|
|
}; |
|
|
|
|
|
|
|
// 修改目标节点的标签 |
|
|
|
@ -2516,7 +2518,7 @@ function buildNodeTree(node, keepIds, idArray, processedIds) { |
|
|
|
} |
|
|
|
|
|
|
|
// 当 idList 为空时处理树数据,使用与不为空时相同的格式化逻辑 |
|
|
|
function processTreeWithAllNodes(treeData) { |
|
|
|
function processTreeWithAllNodes(treeData: any) { |
|
|
|
if (!treeData) { |
|
|
|
return Array.isArray(treeData) ? [] : null; |
|
|
|
} |
|
|
|
@ -2548,7 +2550,7 @@ function processTreeWithAllNodes(treeData) { |
|
|
|
} |
|
|
|
|
|
|
|
// 递归格式化所有节点,保持与非空时相同的格式,并过滤没有用户的组织节点 |
|
|
|
function formatAllNodes(node, processedIds) { |
|
|
|
function formatAllNodes(node: { id: string | any[]; children: string | any[]; label: any; value: null | undefined; }, processedIds: Set<unknown>) { |
|
|
|
// 判断是否为组织节点(ID长度小于5) |
|
|
|
const isOrganization = node.id && node.id.length < 5; |
|
|
|
|
|
|
|
@ -2577,7 +2579,9 @@ function formatAllNodes(node, processedIds) { |
|
|
|
const newNode = { |
|
|
|
id: node.id, |
|
|
|
label: node.label, |
|
|
|
value: node.value |
|
|
|
value: node.value, |
|
|
|
number: node.label, |
|
|
|
children: node.children, |
|
|
|
}; |
|
|
|
|
|
|
|
// 对所有节点应用相同的标签格式化 |
|
|
|
@ -2594,12 +2598,12 @@ function formatAllNodes(node, processedIds) { |
|
|
|
return newNode; |
|
|
|
} |
|
|
|
|
|
|
|
function groupExpandUserConfigs(configs) { |
|
|
|
function groupExpandUserConfigs(configs: { control: { queryBy: string; orgRange: any; roleRange: any; }; name: any; }[]) { |
|
|
|
// 用于存储分组结果的Map |
|
|
|
// key是排序后的范围数组字符串,value是包含names和原始keys的对象 |
|
|
|
const groupMap = new Map(); |
|
|
|
|
|
|
|
configs.forEach(config => { |
|
|
|
configs.forEach((config: { control: { queryBy: string; orgRange: any; roleRange: any; }; name: any; }) => { |
|
|
|
// 根据queryBy确定使用哪个范围数组 |
|
|
|
let range, rangeType; |
|
|
|
if (config.control.queryBy === 'org') { |
|
|
|
|