Browse Source

隐藏关联表单控件优化

lwx_v8
liwenxuan 2 years ago
parent
commit
e9ce3940e7
  1. 2
      src/components/DesignForm/assembly/index.ts
  2. 31
      src/components/DesignForm/formControlAttr.vue
  3. 5
      src/widget/associatedforms/associatedFormsTinyace.vue

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

@ -599,6 +599,8 @@ const selectOption: any = [
iconFont: 'fa-wpforms', iconFont: 'fa-wpforms',
control: { control: {
modelValue: '', modelValue: '',
hideConditionHtml:'',
hideConditionHtmlCopy:'',
}, },
config: {} config: {}
} }

31
src/components/DesignForm/formControlAttr.vue

@ -1780,7 +1780,8 @@ getAssociatedFormsCurrentFieldTree().then(({ data }) => {
associatedFormsCurrentFormFieldTree.value = [{ associatedFormsCurrentFormFieldTree.value = [{
id: 'rootid_'+data.label, id: 'rootid_'+data.label,
label: '当前表单', label: '当前表单',
children: [...resData.value] children: [...resData.value],
treeAttrs: data.treeAttrs,
}] }]
}); });
@ -1823,7 +1824,7 @@ function handleFieldTreeNodeclick(){
} }
function handleFieldTreeContextmenu(MouseEvent:any, object:any, Node:any, element:any){ function handleFieldTreeContextmenu(MouseEvent:any, object:any, Node:any, element:any){
aft.value.addIcon(object) aft.value.addIcon_field(object)
} }
//org //org
const orgTreeSearchFlag = ref(false) const orgTreeSearchFlag = ref(false)
@ -1889,27 +1890,33 @@ const filterNode = (value: string, associatedFormsCurrentFormFieldTree: Tree) =>
} }
//flag //flag
const associatedFormsHideDialogFlag = ref(false) const associatedFormsHideDialogFlag = ref(false)
// //
let associatedFormsHideDialogText = ref('')//textarea //let associatedFormsHideDialogText = ref('')//textarea
// //
let associatedFormsHideDialogTextCopy = ref('') //let associatedFormsHideDialogTextCopy = ref('')
// //
function associatedFormsHideDialoghandle(){ function associatedFormsHideDialoghandle(){
associatedFormsHideDialogFlag.value = true associatedFormsHideDialogFlag.value = true
associatedFormsHideDialogTextCopy.value = associatedFormsHideDialogText.value controlData.value.control.hideConditionHtmlCopy = controlData.value.control.hideConditionHtml
} }
//text //text
function aftTextChanged(str:string){ function aftTextChanged(str:string){
associatedFormsHideDialogText.value = str controlData.value.control.hideConditionHtml = str
} }
//asf //asf
function asfhTextCancel(){ function asfhTextCancel(){
determine.value = false determine.value = false
associatedFormsHideDialogFlag.value = false associatedFormsHideDialogFlag.value = false
associatedFormsHideDialogText.value = associatedFormsHideDialogTextCopy.value controlData.value.control.hideConditionHtml = controlData.value.control.hideConditionHtmlCopy
//copy //copy
aft.value.handelCancel(associatedFormsHideDialogTextCopy.value) aft.value.handelCancel(controlData.value.control.hideConditionHtmlCopy)
} }
//true //true
let determine = ref(true) let determine = ref(true)
@ -1925,7 +1932,7 @@ watch(associatedFormsHideDialogFlag, (val) => {
function handleDetermine(){ function handleDetermine(){
associatedFormsHideDialogFlag.value = false associatedFormsHideDialogFlag.value = false
determine.value = true determine.value = true
associatedFormsHideDialogTextCopy.value = associatedFormsHideDialogText.value controlData.value.control.hideConditionHtmlCopy = controlData.value.control.hideConditionHtml
} }
@ -2392,8 +2399,8 @@ const loadNextPage = () => {
</el-row> </el-row>
<el-row v-else-if="item.type === 'associatedForms_hide'"> <el-row v-else-if="item.type === 'associatedForms_hide'">
<el-button type="primary" 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>
</el-row> </el-row>
<el-input <el-input
@ -3166,7 +3173,7 @@ const loadNextPage = () => {
<el-main style="border: 1px solid gainsboro; padding: 3px;" class="associatedFormsHideDialogMain"> <el-main style="border: 1px solid gainsboro; padding: 3px;" class="associatedFormsHideDialogMain">
<div style="border: 1px solid gainsboro; height: 7%; border-bottom: 0px; padding-top: 3px; padding-left: 5px; background-color: #E6F3FE;">当满足以下条件时此控件隐藏</div> <div style="border: 1px solid gainsboro; height: 7%; border-bottom: 0px; padding-top: 3px; padding-left: 5px; background-color: #E6F3FE;">当满足以下条件时此控件隐藏</div>
<div id="associatedFormsHideEditArea" style="border: 1px solid gainsboro; height: 63%; border-bottom: 0px;"> <div id="associatedFormsHideEditArea" style="border: 1px solid gainsboro; height: 63%; border-bottom: 0px;">
<AssociatedFormsTinyace ref="aft" :aft-text="associatedFormsHideDialogText" :aft-text-copy = "associatedFormsHideDialogTextCopy" @text-change = "aftTextChanged"></AssociatedFormsTinyace> <AssociatedFormsTinyace ref="aft" :aft-text="controlData.control.hideConditionHtml" :aft-text-copy = "controlData.control.hideConditionHtmlCopy" @text-change = "aftTextChanged"></AssociatedFormsTinyace>
<!-- <div style="border: 1px solid #4189EF;width:90px;height:26px;border-radius: 3px;padding:2px;text-align: center;cursor:pointer;float: right;margin-top: -32px;margin-right: 5px;z-index:99999999;position: relative;"> <!-- <div style="border: 1px solid #4189EF;width:90px;height:26px;border-radius: 3px;padding:2px;text-align: center;cursor:pointer;float: right;margin-top: -32px;margin-right: 5px;z-index:99999999;position: relative;">
<span style="color: #4189EF;font:6px;margin-right: 5px;">fx</span>插入函数 <span style="color: #4189EF;font:6px;margin-right: 5px;">fx</span>插入函数
</div> --> </div> -->

5
src/widget/associatedforms/associatedFormsTinyace.vue

@ -62,7 +62,9 @@ watch(()=>tinymceHtml.value, (val:any) => {
const addIcon = (currentObject:any) =>{ const addIcon = (currentObject:any) =>{
tinymce.activeEditor?.execCommand('mceInsertContent', false, `<span style="margin:3px;background-color: #4189EF;border-radius: 5px; padding:3px" contenteditable="false" data-keyid= "${currentObject.id}" >${currentObject.label}</span>`); tinymce.activeEditor?.execCommand('mceInsertContent', false, `<span style="margin:3px;background-color: #4189EF;border-radius: 5px; padding:3px" contenteditable="false" data-keyid= "${currentObject.id}" >${currentObject.label}</span>`);
} }
const addIcon_field = (currentObject:any) =>{
tinymce.activeEditor?.execCommand('mceInsertContent', false, `<span style="margin:3px;background-color: #4189EF;border-radius: 5px; padding:3px" contenteditable="false" data-keyid= "${currentObject.id}" >${currentObject.treeAttrs.show}</span>`);
}
const addIcon_org = (currentObject:any) =>{ const addIcon_org = (currentObject:any) =>{
let id = "orgOrPerson:"+currentObject.id let id = "orgOrPerson:"+currentObject.id
tinymce.activeEditor?.execCommand('mceInsertContent', false, `<span style="margin:3px;background-color: #4189EF;border-radius: 5px; padding:3px" contenteditable="false" data-keyid= "${id}" >${currentObject.label}</span>`); tinymce.activeEditor?.execCommand('mceInsertContent', false, `<span style="margin:3px;background-color: #4189EF;border-radius: 5px; padding:3px" contenteditable="false" data-keyid= "${id}" >${currentObject.label}</span>`);
@ -80,6 +82,7 @@ defineExpose({
tinymceHtml, tinymceHtml,
addIcon, addIcon,
addIcon_org, addIcon_org,
addIcon_field,
handelCancel, handelCancel,
tinymceReInit, tinymceReInit,
}) })

Loading…
Cancel
Save