Browse Source

关联表单0.9

lwx_v8
liwenxuan 2 years ago
parent
commit
90bee0131c
  1. 6
      src/components/DesignForm/assembly/index.ts
  2. 66
      src/components/DesignForm/formControlAttr.vue

6
src/components/DesignForm/assembly/index.ts

@ -605,6 +605,12 @@ const selectOption: any = [
dataRangeConditionHtml:'',
dataRangeConditionHtmlCopy:'',
saveFlag: false,
fillRoles: [
{
leftValue:'',
rightValue:'',
}
],
},
config: {}
}

66
src/components/DesignForm/formControlAttr.vue

@ -1768,6 +1768,7 @@ const transferDataSourceOptions = [
//liwenxuan20240403 associatedForms start
import AssociatedFormsTinyace from '@/widget/associatedforms/associatedFormsTinyace.vue'
import AssociatedFormsTinyaceRange from '@/widget/associatedforms/associatedFormsTinyaceRange.vue'
import AssociatedFormsFillRole from '@/widget/associatedforms/associatedFormsFillRole.vue'
const treeDefaultProps = {
children: 'children',
@ -1823,6 +1824,29 @@ function getAsfasfFieldTree() {
const asfasfFieldTree = ref<Tree[]>()
function formidChanged(){
if(controlData.value.control.formid===''){
}else{
getAsfasfFieldTree().then(({ data }) => {
if(data.id==="cfid为空"){
//alert("cfid")
}else{
let resData = ref(data.children)
//let rootid_ = data.value.label
asfasfFieldTree.value = [{
id: 'rootid_'+data.label,
label: '关联的表单-'+data.label,
children: [...resData.value],
treeAttrs: data.treeAttrs,
}]
}
});
}
}
const associatedFormsCurrentFormFieldTree = ref<Tree[]>()
getAssociatedFormsCurrentFieldTree().then(({ data }) => {
@ -1985,6 +2009,7 @@ function associatedFormsHideDialoghandle(){
}
function associatedFormsDataRangeDialoghandle(){
getAsfasfFieldTree().then(({ data }) => {
@ -2073,20 +2098,35 @@ function handleDetermineRange(){
//
const associatedFormsFillRolesDialogFlag = ref(false)
//
function associatedFormsDataFillRolesDialoghandle(){
associatedFormsFillRolesDialogFlag.value = true
if(controlData.value.control.formid===''){
alert("请先选择要关联的表单")
}else{
associatedFormsFillRolesDialogFlag.value = true
}
}
function asfhTextCancelFillRoles(){
associatedFormsFillRolesDialogFlag.value = false
}
//
function handleDetermineFillRoles(){
associatedFormsFillRolesDialogFlag.value = false
}
watch(()=>store.activeKey, () => {
if(controlData.value.type==='associatedForms'){
setTimeout(() => {
formidChanged()
}, 800);
}
})
//liwenxuan20240403 associatedForms end
@ -2177,6 +2217,9 @@ const gainFormGroupList = () =>{
})
}
onMounted(() => {
gainFormGroupList()
})
@ -2548,7 +2591,7 @@ const loadNextPage = () => {
<el-row v-else-if="item.type === 'associatedForms_hide'">
<el-button v-if="controlData.control.hideConditionHtml===''" style="padding-top: 5px;" type="primary" link append-to-body="true" modal="true" @click="associatedFormsHideDialoghandle" >设置隐藏条件</el-button>
<div style="width:100%; cursor: pointer;" v-html="controlData.control.hideConditionHtml" @click="associatedFormsHideDialoghandle"></div>
<div style="width:100%; cursor: pointer;" @click="associatedFormsHideDialoghandle" v-html="controlData.control.hideConditionHtml"></div>
</el-row>
@ -2561,6 +2604,7 @@ const loadNextPage = () => {
check-strictly
:render-after-expand="false"
filterable
@change="formidChanged"
/>
</div>
<!-- <div v-html="controlData.control.formid"></div> -->
@ -2568,7 +2612,7 @@ const loadNextPage = () => {
<el-row v-else-if="item.type === 'associatedForms_dataRange'">
<el-button v-if="controlData.control.dataRangeConditionHtml===''" style="padding-top: 5px;" type="primary" link append-to-body="true" modal="true" @click="associatedFormsDataRangeDialoghandle" >设置数据范围</el-button>
<div style="width:100%; cursor: pointer;" v-html="controlData.control.dataRangeConditionHtml" @click="associatedFormsDataRangeDialoghandle"></div>
<div style="width:100%; cursor: pointer;" @click="associatedFormsDataRangeDialoghandle" v-html="controlData.control.dataRangeConditionHtml"></div>
</el-row>
@ -3497,15 +3541,17 @@ const loadNextPage = () => {
<el-dialog v-model="associatedFormsFillRolesDialogFlag" title="数据范围" top="150px" :close-on-click-modal="false" :show-close="false" style="margin-top:70px ;min-height: 500px" width="50%" >
<el-dialog v-model="associatedFormsFillRolesDialogFlag" title="数据填充规则" top="150px" :close-on-click-modal="false" :show-close="false" style="margin-top:70px ;min-height: 500px" width="50%" >
<template v-if="controlData.type=='associatedForms'">
<el-divider />
<div><span style="color: grey;">当选择具体数据后将按如下规则给当前表单字段填充数据 </span></div>
<el-button type="primary" link append-to-body="true" modal="true" @click="addFillRole" style="font-size: large;margin-top: 3px;" > 添加规则</el-button>
<el-divider style="margin-top: 0px;" />
<div style="margin-top: -10px;"><span style="color: grey;">当选择具体数据后将按如下规则给当前表单字段填充数据 </span></div>
<el-button style="font-size: large;margin-top: 3px;" type="primary" link append-to-body="true" modal="true" @click="addFillRole"> 添加规则</el-button>
<el-divider />
<div style="height:300px;border:1px solid white">
<template v-for="(item, index) in controlData.control.fillRoles" :key="index">
<AssociatedFormsFillRole v-model:left-value="controlData.control.fillRoles[index].leftValue" v-model:right-value="controlData.control.fillRoles[index].rightValue" :left-tree-source = "asfasfFieldTree[0].children" :right-tree-source = "associatedFormsCurrentFormFieldTree[0].children" ></AssociatedFormsFillRole>
</template>
</div>
</template>
<template #footer>

Loading…
Cancel
Save