Browse Source

优化用户组织联动填充逻辑

lwx_v27
liwenxuan 2 weeks ago
parent
commit
851f1b8139
  1. 42
      src/components/DesignForm/public/form/form.vue

42
src/components/DesignForm/public/form/form.vue

@ -28,6 +28,7 @@ import formChangeValue from "@/utils/DesignForm/formChangeValue";
import { jsonParseStringify } from "@/utils/DesignForm";
//
import { currencyFormApiSubmit } from "@/api/taskapi/management";
import { SourceType } from "@wecom/jssdk";
const props = withDefaults(
defineProps<{
@ -1775,6 +1776,12 @@ function getTree1() {
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)
@ -1797,6 +1804,7 @@ function updateLocation(currentValue: any,currentComp:any) {
}
});
let deepCopyedConnectOrgs = JSON.parse(JSON.stringify(connectOrgs))
//console.log(connectOrgs)
//console.log(selectOrgsPath)
deepCopyedConnectOrgs.forEach((element:any) => {
@ -1810,8 +1818,11 @@ function updateLocation(currentValue: any,currentComp:any) {
}
});
//console.log(element)
if(element.path==""){
/* console.log(currentValue)
console.log(currentComp)
console.log(workNumber) */
if(workNumber==""){
model.value[element.name] = undefined
}else{
@ -1819,6 +1830,7 @@ function updateLocation(currentValue: any,currentComp:any) {
}
}else{
//console.log(model.value[element.path])
model.value[element.path].forEach((x:any) => {
@ -1826,6 +1838,8 @@ function updateLocation(currentValue: any,currentComp:any) {
console.log(currentComp)
console.log(x) */
if(userPath!=""){
if(x[currentComp] == currentValue){
if(workNumber==""){
x[element.name] = undefined
@ -1834,6 +1848,21 @@ function updateLocation(currentValue: any,currentComp:any) {
}
}
}else{
if(workNumber==""){
x[element.name] = undefined
}else{
x[element.name] = mainOrg
}
}
});
@ -2174,6 +2203,7 @@ function groupExpandUserConfigs(configs) {
const asfs: any[] = [];
const rangedUsers :any= [];
const selectOrgs :any = [];
const rangedUsersPath :any= [];
const selectOrgsPath :any = [];
const tables: any[] = [];
@ -2195,6 +2225,8 @@ function getAsfs() {
if (dataList.value[i].type == "associatedForms") {
asfs.push(dataList.value[i]);
} else if(dataList.value[i].type == "expand-user"){
let pathObj = {path:"",obj: dataList.value[i].name}
rangedUsersPath.push(pathObj)
rangedUsers.push(dataList.value[i]);
} else if(dataList.value[i].type == "orgCentent"){
let pathObj = {path:"",obj: dataList.value[i].name}
@ -2216,6 +2248,8 @@ function getAsfs() {
if (element.type == "associatedForms") {
asfs.push(element);
}else if(element.type == "expand-user"){
let pathObj = {path:""+for1Name,obj:element.name}
rangedUsersPath.push(pathObj)
rangedUsers.push(element);
}else if(element.type == "orgCentent"){
let pathObj = {path:""+for1Name,obj:element.name}
@ -2234,6 +2268,8 @@ 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)
rangedUsers.push(a);
}else if(a.type == "orgCentent"){
let pathObj = {path:""+for1Name,obj:a.name}
@ -2254,6 +2290,8 @@ 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)
rangedUsers.push(a);
} else if(a.type == "orgCentent"){
let pathObj = {path:""+for1Name,obj:a.name}
@ -2272,6 +2310,8 @@ 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)
rangedUsers.push(q);
}else if(q.type == "orgCentent"){
let pathObj = {path:""+for2Name,obj:q.name}

Loading…
Cancel
Save