|
|
|
@ -12,7 +12,7 @@ import { appendOrRemoveStyle, constControlChange, constFormBtnEvent, constFormPr |
|
|
|
|
|
|
|
import { currencyFormApiSubmit, createAppTask, saveDraftAgain } from '@/api/lowCode/taskapi/management' |
|
|
|
import formatResult from '@/utils/lowCode/formatResult' |
|
|
|
import { useAttrs,computed, onMounted, nextTick,ref,watch,onBeforeMount} from 'vue' |
|
|
|
import { useAttrs,computed, onMounted, nextTick,ref,watch,onBeforeMount,provide} from 'vue' |
|
|
|
|
|
|
|
const props = withDefaults( |
|
|
|
defineProps<{ |
|
|
|
@ -2239,6 +2239,9 @@ function groupExpandUserConfigs(configs) { |
|
|
|
|
|
|
|
const rangedUserTrees1= ref([]); |
|
|
|
const rangedUserTrees :any= []; |
|
|
|
const selectOrgs :any = []; |
|
|
|
const rangedUsersPath :any= []; |
|
|
|
const selectOrgsPath :any = []; |
|
|
|
|
|
|
|
function getAsfs() { |
|
|
|
/* setTimeout(() => { */ |
|
|
|
@ -2248,27 +2251,43 @@ function getAsfs() { |
|
|
|
dataList.value = props.formData.list; |
|
|
|
|
|
|
|
if (dataList && Array.isArray(dataList.value) && dataList.value.length > 0) { |
|
|
|
|
|
|
|
for (let i = 0; i < dataList.value.length; i++) { |
|
|
|
//console.log(dataList.value[i]) |
|
|
|
let for1Name = dataList.value[i].name |
|
|
|
|
|
|
|
if (dataList.value[i].type == "associatedForms") { |
|
|
|
asfs.push(dataList.value[i]); |
|
|
|
} else if(dataList.value[i].type == "expand-user"){ |
|
|
|
rangedUserTrees.push(dataList.value[i]) |
|
|
|
let pathObj = {path:"",obj: dataList.value[i].name} |
|
|
|
rangedUsersPath.push(pathObj) |
|
|
|
rangedUserTrees.push(dataList.value[i]); |
|
|
|
} else if(dataList.value[i].type == "orgCentent"){ |
|
|
|
let pathObj = {path:"",obj: dataList.value[i].name} |
|
|
|
selectOrgsPath.push(pathObj) |
|
|
|
selectOrgs.push(dataList.value[i]); |
|
|
|
}else if ( |
|
|
|
dataList.value[i].type == "card" || |
|
|
|
dataList.value[i].type == "flex" || |
|
|
|
dataList.value[i].type == "div" || |
|
|
|
dataList.value[i].type == "table" |
|
|
|
) { |
|
|
|
|
|
|
|
if (dataList.value[i].type == "table") { |
|
|
|
tables.push(dataList.value[i]); |
|
|
|
} |
|
|
|
|
|
|
|
dataList.value[i].list.forEach((element: any) => { |
|
|
|
|
|
|
|
if (element.type == "associatedForms") { |
|
|
|
asfs.push(element); |
|
|
|
}else if(element.type == "expand-user"){ |
|
|
|
rangedUserTrees.push(element) |
|
|
|
let pathObj = {path:""+for1Name,obj:element.name} |
|
|
|
rangedUsersPath.push(pathObj) |
|
|
|
rangedUserTrees.push(element); |
|
|
|
}else if(element.type == "orgCentent"){ |
|
|
|
let pathObj = {path:""+for1Name,obj:element.name} |
|
|
|
selectOrgsPath.push(pathObj) |
|
|
|
selectOrgs.push(element); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else if (dataList.value[i].type == "grid") { |
|
|
|
@ -2282,7 +2301,13 @@ function getAsfs() { |
|
|
|
if (a.type == "associatedForms") { |
|
|
|
asfs.push(a); |
|
|
|
}else if(a.type == "expand-user"){ |
|
|
|
let pathObj = {path:""+for1Name,obj:a.name} |
|
|
|
rangedUsersPath.push(pathObj) |
|
|
|
rangedUserTrees.push(a); |
|
|
|
}else if(a.type == "orgCentent"){ |
|
|
|
let pathObj = {path:""+for1Name,obj:a.name} |
|
|
|
selectOrgsPath.push(pathObj) |
|
|
|
selectOrgs.push(a); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2298,8 +2323,15 @@ function getAsfs() { |
|
|
|
if (a.type == "associatedForms") { |
|
|
|
asfs.push(a); |
|
|
|
} else if(a.type == "expand-user"){ |
|
|
|
let pathObj = {path:""+for1Name,obj:a.name} |
|
|
|
rangedUsersPath.push(pathObj) |
|
|
|
rangedUserTrees.push(a); |
|
|
|
} else if(a.type == "orgCentent"){ |
|
|
|
let pathObj = {path:""+for1Name,obj:a.name} |
|
|
|
selectOrgsPath.push(pathObj) |
|
|
|
selectOrgs.push(a); |
|
|
|
}else if (a.type == "flex" || a.type == "table") { |
|
|
|
let for2Name = a.name |
|
|
|
if (a.type == "table") { |
|
|
|
tables.push(dataList.value[i]); |
|
|
|
} |
|
|
|
@ -2311,7 +2343,13 @@ function getAsfs() { |
|
|
|
if (q.type == "associatedForms") { |
|
|
|
asfs.push(q); |
|
|
|
}else if(q.type == "expand-user"){ |
|
|
|
let pathObj = {path:""+for2Name,obj:q.name} |
|
|
|
rangedUsersPath.push(pathObj) |
|
|
|
rangedUserTrees.push(q); |
|
|
|
}else if(q.type == "orgCentent"){ |
|
|
|
let pathObj = {path:""+for2Name,obj:q.name} |
|
|
|
selectOrgsPath.push(pathObj) |
|
|
|
selectOrgs.push(q); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -2407,6 +2445,165 @@ function getAsfs() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//实现选择用户选择时,自动填充选择组织 liwenxuan 2025-11-11 start |
|
|
|
|
|
|
|
const location = ref('North Pole') |
|
|
|
|
|
|
|
function updateLocation(currentValue: any,currentComp:any) { |
|
|
|
let userPath = "" |
|
|
|
rangedUsersPath.forEach((element: any) => { |
|
|
|
if(element.obj==currentComp){ |
|
|
|
userPath = element.path |
|
|
|
} |
|
|
|
}); |
|
|
|
location.value = currentValue+currentComp |
|
|
|
let deepCopyedCurrentValue:string = JSON.stringify(toRaw(currentValue)) |
|
|
|
let workNumber = getParenthesesContent(deepCopyedCurrentValue) |
|
|
|
//console.log(workNumber) |
|
|
|
let mainOrg = 309 |
|
|
|
getMainOrgByWorkNumber({workNumber:workNumber}).then(({ data }) => { |
|
|
|
//console.log(data) |
|
|
|
mainOrg = data*1 |
|
|
|
|
|
|
|
}).finally(()=>{ |
|
|
|
|
|
|
|
//找到关联此 user 组件的所有 org 组件 |
|
|
|
let connectOrgs: any[] = [] |
|
|
|
selectOrgs.forEach((element:any) => { |
|
|
|
if(element.control.connectUserComponent){ |
|
|
|
let realCurrentCompName = getAfterLastColon(element.control.connectUserComponent) |
|
|
|
if(currentComp == realCurrentCompName){ |
|
|
|
connectOrgs.push(element) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
let deepCopyedConnectOrgs = JSON.parse(JSON.stringify(connectOrgs)) |
|
|
|
//console.log(connectOrgs) |
|
|
|
//console.log(selectOrgsPath) |
|
|
|
|
|
|
|
deepCopyedConnectOrgs.forEach((element:any) => { |
|
|
|
selectOrgsPath.forEach((item: any) => { |
|
|
|
if(item.obj==element.name){ |
|
|
|
if(item.path==undefined || item.path=="" || item.path=="undefined"){ |
|
|
|
element.path = "" |
|
|
|
}else{ |
|
|
|
element.path = item.path |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
//console.log(element) |
|
|
|
if(element.path==""){ |
|
|
|
/* console.log(currentValue) |
|
|
|
console.log(currentComp) |
|
|
|
console.log(workNumber) */ |
|
|
|
if(workNumber==""){ |
|
|
|
model.value[element.name] = undefined |
|
|
|
}else{ |
|
|
|
model.value[element.name] = mainOrg |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
//console.log(model.value[element.path]) |
|
|
|
|
|
|
|
|
|
|
|
model.value[element.path].forEach((x:any) => { |
|
|
|
/* console.log(currentValue) |
|
|
|
console.log(currentComp) |
|
|
|
console.log(x) */ |
|
|
|
|
|
|
|
|
|
|
|
if(userPath!=""){ |
|
|
|
if(x[currentComp] == currentValue){ |
|
|
|
if(workNumber==""){ |
|
|
|
x[element.name] = undefined |
|
|
|
}else{ |
|
|
|
x[element.name] = mainOrg |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
if(workNumber==""){ |
|
|
|
x[element.name] = undefined |
|
|
|
}else{ |
|
|
|
x[element.name] = mainOrg |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
//console.log(deepCopyedConnectOrgs) |
|
|
|
//console.log(model.value) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function getMainOrgByWorkNumber(obj: { workNumber: string}) { |
|
|
|
return request({ |
|
|
|
url: "/javasys/lowCode/manCont/getMainOrgByWorkNumber", |
|
|
|
method: "post", |
|
|
|
data: obj, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function getParenthesesContent(str:string) { |
|
|
|
//console.log(str) |
|
|
|
const match = str.match(/\((.*?)\)/); |
|
|
|
return match ? match[1] : ''; |
|
|
|
} |
|
|
|
|
|
|
|
provide('location', { |
|
|
|
location, |
|
|
|
updateLocation |
|
|
|
}) |
|
|
|
|
|
|
|
/** |
|
|
|
* 提取字符串中最后一个英文冒号后的内容,无冒号则返回原字符串 |
|
|
|
* @param {string} str - 输入的字符串 |
|
|
|
* @returns {string} 最后一个冒号后的内容或原字符串 |
|
|
|
*/ |
|
|
|
function getAfterLastColon(str:string) { |
|
|
|
// 首先验证入参类型,确保是字符串(避免非字符串类型导致方法出错) |
|
|
|
if (typeof str !== 'string') { |
|
|
|
//console.warn('入参必须是字符串类型,当前已自动转为字符串'); |
|
|
|
str = String(str); // 非字符串类型自动转为字符串 |
|
|
|
} |
|
|
|
|
|
|
|
// 查找最后一个英文冒号的索引位置 |
|
|
|
const lastColonIndex = str.lastIndexOf(':'); |
|
|
|
|
|
|
|
// 若未找到冒号(索引为 -1),或冒号在字符串最后一位(后面无内容),返回原字符串 |
|
|
|
if (lastColonIndex === -1 || lastColonIndex === str.length - 1) { |
|
|
|
return str; |
|
|
|
} |
|
|
|
|
|
|
|
// 截取最后一个冒号后面的字符(索引+1 开始到字符串结尾) |
|
|
|
return str.slice(lastColonIndex + 1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//实现选择用户选择时,自动填充选择组织 liwenxuan 2025-11-11 end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ |
|
|
|
setOptions, |
|
|
|
setValue, |
|
|
|
|