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:'', dataRangeConditionHtml:'',
dataRangeConditionHtmlCopy:'', dataRangeConditionHtmlCopy:'',
saveFlag: false, saveFlag: false,
fillRoles: [
{
leftValue:'',
rightValue:'',
}
],
}, },
config: {} config: {}
} }

66
src/components/DesignForm/formControlAttr.vue

@ -1768,6 +1768,7 @@ const transferDataSourceOptions = [
//liwenxuan20240403 associatedForms start //liwenxuan20240403 associatedForms start
import AssociatedFormsTinyace from '@/widget/associatedforms/associatedFormsTinyace.vue' import AssociatedFormsTinyace from '@/widget/associatedforms/associatedFormsTinyace.vue'
import AssociatedFormsTinyaceRange from '@/widget/associatedforms/associatedFormsTinyaceRange.vue' import AssociatedFormsTinyaceRange from '@/widget/associatedforms/associatedFormsTinyaceRange.vue'
import AssociatedFormsFillRole from '@/widget/associatedforms/associatedFormsFillRole.vue'
const treeDefaultProps = { const treeDefaultProps = {
children: 'children', children: 'children',
@ -1823,6 +1824,29 @@ function getAsfasfFieldTree() {
const asfasfFieldTree = ref<Tree[]>() 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[]>() const associatedFormsCurrentFormFieldTree = ref<Tree[]>()
getAssociatedFormsCurrentFieldTree().then(({ data }) => { getAssociatedFormsCurrentFieldTree().then(({ data }) => {
@ -1985,6 +2009,7 @@ function associatedFormsHideDialoghandle(){
} }
function associatedFormsDataRangeDialoghandle(){ function associatedFormsDataRangeDialoghandle(){
getAsfasfFieldTree().then(({ data }) => { getAsfasfFieldTree().then(({ data }) => {
@ -2073,20 +2098,35 @@ function handleDetermineRange(){
// //
const associatedFormsFillRolesDialogFlag = ref(false) const associatedFormsFillRolesDialogFlag = ref(false)
//
function associatedFormsDataFillRolesDialoghandle(){ function associatedFormsDataFillRolesDialoghandle(){
associatedFormsFillRolesDialogFlag.value = true if(controlData.value.control.formid===''){
alert("请先选择要关联的表单")
}else{
associatedFormsFillRolesDialogFlag.value = true
}
} }
function asfhTextCancelFillRoles(){ function asfhTextCancelFillRoles(){
associatedFormsFillRolesDialogFlag.value = false associatedFormsFillRolesDialogFlag.value = false
} }
//
function handleDetermineFillRoles(){ function handleDetermineFillRoles(){
associatedFormsFillRolesDialogFlag.value = false associatedFormsFillRolesDialogFlag.value = false
} }
watch(()=>store.activeKey, () => {
if(controlData.value.type==='associatedForms'){
setTimeout(() => {
formidChanged()
}, 800);
}
})
//liwenxuan20240403 associatedForms end //liwenxuan20240403 associatedForms end
@ -2177,6 +2217,9 @@ const gainFormGroupList = () =>{
}) })
} }
onMounted(() => { onMounted(() => {
gainFormGroupList() gainFormGroupList()
}) })
@ -2548,7 +2591,7 @@ const loadNextPage = () => {
<el-row v-else-if="item.type === 'associatedForms_hide'"> <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> <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> </el-row>
@ -2561,6 +2604,7 @@ const loadNextPage = () => {
check-strictly check-strictly
:render-after-expand="false" :render-after-expand="false"
filterable filterable
@change="formidChanged"
/> />
</div> </div>
<!-- <div v-html="controlData.control.formid"></div> --> <!-- <div v-html="controlData.control.formid"></div> -->
@ -2568,7 +2612,7 @@ const loadNextPage = () => {
<el-row v-else-if="item.type === 'associatedForms_dataRange'"> <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> <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> </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'"> <template v-if="controlData.type=='associatedForms'">
<el-divider /> <el-divider style="margin-top: 0px;" />
<div><span style="color: grey;">当选择具体数据后将按如下规则给当前表单字段填充数据 </span></div> <div style="margin-top: -10px;"><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-button style="font-size: large;margin-top: 3px;" type="primary" link append-to-body="true" modal="true" @click="addFillRole"> 添加规则</el-button>
<el-divider /> <el-divider />
<div style="height:300px;border:1px solid white"> <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> </div>
</template> </template>
<template #footer> <template #footer>

Loading…
Cancel
Save