Browse Source

Merge branch 'lwx_v8'

yjf_v2
超级管理员 1 year ago
parent
commit
7c1ae5cc92
  1. 132
      src/components/DesignForm/formControlPropertiNew.vue
  2. 77
      src/components/DesignForm/public/form/formGroup.vue
  3. 1
      src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue

132
src/components/DesignForm/formControlPropertiNew.vue

@ -1763,12 +1763,16 @@ const transferDialogTableVisible = ref(false)
//
const showImagePreview = ref(false)
const currentAsfChangeCount = ref(0)
//imgId
let currentUploadImgid = "";
//,imgiddesignForm.activeKey,,controlData.value.type=='lowcodeCarsusel',imgid=''uuid
watch(()=>store.activeKey, (newVal) => {
//
if(controlData.value.type==='lowcodeCarsusel'){
const carsuselConfigData:CarsuselConfig[] = controlData.value.control.carsuselConfigArr
@ -1781,6 +1785,8 @@ const showImagePreview = ref(false)
}
});
}else if(controlData.value.type==='associatedForms'){
currentAsfChangeCount.value = 0
//alert(1)
/* if(controlData.value.item.label){
}else{
@ -2664,8 +2670,30 @@ function selectedOrDelChildRole(){
}
}
//
//
function childRoleRightChanged(){
let selectedArr: any[] = []
let otherMasterSelectedArr: any[] = []
let otherChildSelectedArr: any[] = []
asfsExpectCurrent.forEach(function(item: any) {
let master = item.control.fillRoles.master
let child = item.control.fillRoles.child
/* console.log(master)
console.log(child) */
master.forEach(function(item: any) {
if(item.rightValue!=""){
otherMasterSelectedArr.push(item)
}
});
child.forEach(function(item: any) {
item.childRoles.forEach((element: any) => {
if(element.rightValue!=""){
otherChildSelectedArr.push(element)
}
});
});
});
let masterSelectedArr: any[] = []
controlData.value.control?.fillRoles?.master.forEach(function(item: any) {
if(item.rightValue!=""){
@ -2680,12 +2708,20 @@ function childRoleRightChanged(){
}
});
});
let selectedArr: any[] = []
/* 1.index
2.得到所有index在当前子表填充规则块之前的子表填充规则块
3.得到2中所有right,凡是出现过的子表,就把这些子表的所有选项全部置为不可选 */
//console.log(asfs)
selectedArr.push(...otherMasterSelectedArr)
selectedArr.push(...otherChildSelectedArr)
selectedArr.push(...masterSelectedArr)
selectedArr.push(...childSelectedArr)
// start
if(associatedFormsCurrentFormFieldTree1.value){
associatedFormsCurrentFormFieldTree1.value[0].children?.forEach(function(item: any){
associatedFormsCurrentFormFieldTree1.value[0].children?.forEach(function(item: any){
if(item.type=="table"){
item.children.forEach((element: any) => {
element.disabled = false
@ -2697,7 +2733,7 @@ function childRoleRightChanged(){
})
}
if(associatedFormsCurrentFormFieldTree1.value){
associatedFormsCurrentFormFieldTree1.value[0].children?.forEach(function(item: any){
associatedFormsCurrentFormFieldTree1.value[0].children?.forEach(function(item: any){
if(item.type=="table"){
item.children.forEach((element: any) => {
selectedArr.forEach((j:any) => {
@ -3090,11 +3126,98 @@ const gainFormGroupList = () =>{
loadingmore.value = false;
})
}
let asfs: any[] = []
let asfsExpectCurrent: any[] = []
watch(()=>props.formList,(dataList:any)=>{
//console.log(dataList)
if(dataList&&Array.isArray(dataList)&&dataList.length>0&&controlData.value.type=="associatedForms"&&currentAsfChangeCount.value==0){
//console.log(1)
asfsExpectCurrent = []
asfs = []
currentAsfChangeCount.value = 1
for(let i = 0;i<dataList.length;i++){
if(dataList[i].type=="associatedForms"){
asfs.push(dataList[i])
}else if(dataList[i].type=="card"||dataList[i].type=="flex"||dataList[i].type=="div"||dataList[i].type=="table"){
dataList[i].list.forEach((element:any) => {
if(element.type=="associatedForms"){
asfs.push(element)
}
});
}else if(dataList[i].type=="grid"){
let columns = JSON.parse(JSON.stringify(dataList[i].columns));
//console.log(columns)
if(columns.length>0){
for(let z = 0;z<columns.length;z++){
for(let x = 0; x<columns[z].list.length;x++){
let a = JSON.parse(JSON.stringify(columns[z].list[x]));
//console.log(a)
if(a.type=="associatedForms"){
asfs.push(a)
}
}
}
}
}else if(dataList[i].type=="tabs"){//tabsflextable
let columns = JSON.parse(JSON.stringify(dataList[i].columns));
if(columns.length>0){
for(let z = 0;z<columns.length;z++){
for(let x = 0; x<columns[z].list.length;x++){
let a = JSON.parse(JSON.stringify(columns[z].list[x]));
//console.log(a)
if(a.type=="associatedForms"){
asfs.push(a)
}else if(a.type=="flex"||a.type=="table"){
if(a.list.length>0){
for(let m = 0;m<a.list.length;m++){
let q = JSON.parse(JSON.stringify(a.list[m]))
//console.log(q)
if(q.type=="associatedForms"){
asfs.push(q)
}
}
}
}
}
}
}
}
}
if(asfs.length>0){
asfsExpectCurrent = asfs.filter((item:any)=>{
return item.name!=controlData.value.name
})
/* if(asfsExpectCurrent.length>0){
console.log(asfsExpectCurrent)
} */
}
}
},{
deep:true
})
onMounted(() => {
//console.log("------------------->",props.formData,props.formList)
gainFormGroupList()
})
/**
@ -3301,6 +3424,7 @@ const radioChangeSet = (val:any) => {
}
</script>
<template>
<div class="sidebar-tools">
<el-tabs v-model="state.tabsName">
<el-tab-pane label="字段配置" name="first">

77
src/components/DesignForm/public/form/formGroup.vue

@ -373,6 +373,7 @@ onUnmounted(() => {
store.setControlAttr({})
})
const asfs: any[] = []
const tables: any[] = []
onMounted(()=>{
// console.log('',props.nodeKey,"---------------->",props.purview)
// console.log('formGroup onMounted',props.data,dataList.value,props.tableinfo)
@ -385,6 +386,10 @@ onMounted(()=>{
if(dataList.value[i].type=="associatedForms"){
asfs.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"){
@ -416,6 +421,11 @@ onMounted(()=>{
if(a.type=="associatedForms"){
asfs.push(a)
}else if(a.type=="flex"||a.type=="table"){
if(a.type=="table"){
tables.push(dataList.value[i])
}
if(a.list.length>0){
for(let m = 0;m<a.list.length;m++){
let q = JSON.parse(JSON.stringify(a.list[m]))
@ -434,6 +444,9 @@ onMounted(()=>{
/* if(asfs.length>0){
//console.log(asfs)
} */
/* if(tables.length>0){
console.log(tables)
} */
}
},500)
})
@ -488,7 +501,33 @@ function asfValueChanged(val:any){
}
//console.log(fillFieldsChild)
getAsfTableFill(val.asfFormId,val.glbbddbd,val.currentVal,fillFieldsChild).then(({ data }) => {
console.log(data)
//console.log(data)
data.forEach((dataElement:any) => {
tables.forEach((tableItem: any) => {
if(dataElement.tableName==tableItem.name){
//console.log(formProps.value.model)
//console.log(tableItem)
//console.log(dataElement)
let tableName = dataElement.tableName
//console.log(tableName)
if(tableItem.list.length>0){
let tableRowArray: { type: any; name: any }[] = []
tableItem.list.forEach((listItem:any) => {
//console.log(listItem)
tableRowArray.push({
type:listItem.type,
name:listItem.name
})
});
//console.log(tableRowArray)
const result = generateXResult(dataElement, tableRowArray);
//console.log(result);
formProps.value.model[tableName] = result
}
}
});
});
});
}
@ -499,10 +538,13 @@ function asfValueChanged(val:any){
if(val.options[0].fillRolesFieldsMap){
val.options.forEach((item:any)=>{
if(item.fillRolesFieldsMap.value == val.currentVal){
//console.log(item.fillRolesFieldsMap)
if(masterFillRoleFieldsArray1.length>0){
masterFillRoleFieldsArray1.forEach((item1:any)=>{
//console.log(item.fillRolesFieldsMap)
//console.log(item1)
let x = convertObjectToArray(getNewObject(item.fillRolesFieldsMap,item1))
//console.log(x)
let strOrNumber = convertToStringOrNumber(x[1])
let strOrNumberOrArray
if(isString(strOrNumber)&&strOrNumber.includes("[")){
@ -530,6 +572,37 @@ function asfValueChanged(val:any){
}
}
}
interface DetailObject {
[key: string]: any
}
interface TableRow {
type: string;
name: string;
}
function generateXResult(dataElement: { tableDetail: DetailObject[] }, tableRowArray: TableRow[]): DetailObject[] {
const xResult: DetailObject[] = [];
const propertyNames = tableRowArray.map(item => item.name);
for (const detail of dataElement.tableDetail) {
const obj: DetailObject = {};
propertyNames.forEach(name => {
let strOrNumber = convertToStringOrNumber(detail[name])
let strOrNumberOrArray
if(isString(strOrNumber)&&strOrNumber.includes("[")){
strOrNumberOrArray = convertIfValidNumberArray(strOrNumber)
}
if(strOrNumberOrArray){
obj[name] = strOrNumberOrArray
}else{
obj[name] = strOrNumber
}
});
xResult.push(obj);
}
return xResult;
}
function getAsfTableFill(asfFormId:any,glbbddbd:any,currentVal:any,fillFieldsChild:any){
/* console.log(asfFormId)
console.log(glbbddbd)

1
src/views/sysworkflow/lowcodepage/appPage/appPageForm/pageForm.vue

@ -619,6 +619,7 @@ const dialogConfirm = (editVal: string) => {
</div>
</el-main>
<el-aside class="asideBox">
<formControlPropertiNew
ref="formControlAttrEl"
v-model:formOtherData="state.formOtherData"

Loading…
Cancel
Save