Browse Source

关联表单v0.4

lwx_v8
liwenxuan 2 years ago
parent
commit
3b4003f5c8
  1. 77
      src/components/DesignForm/formControlAttr.vue
  2. 91
      src/widget/associatedforms/associatedFormsTinyace.vue

77
src/components/DesignForm/formControlAttr.vue

@ -1741,10 +1741,9 @@ const transferDataSourceOptions = [
//liwenxuan20240403 associatedForms start //liwenxuan20240403 associatedForms start
import AssociatedFormsTinyace from '@/widget/associatedforms/associatedFormsTinyace.vue'
const associatedFormsHideDialogFlag = ref(false) const treeDefaultProps = {
const defaultProps = {
children: 'children', children: 'children',
label: 'label', label: 'label',
} }
@ -1754,7 +1753,7 @@ function getAssociatedFormsCurrentFieldTree() {
url: '/javasys/lowCode/AssociatedForms/getFieldTree', url: '/javasys/lowCode/AssociatedForms/getFieldTree',
method: 'post', method: 'post',
data: { data: {
cfid:'1' cfid:'13'
}, },
}); });
} }
@ -1802,14 +1801,24 @@ function handleFieldTreeCollapse(){
function handleFieldTreeNodeclick(){ function handleFieldTreeNodeclick(){
} }
//AssociatedFormsTinyace
let aft = ref();
function handleFieldTreeContextmenu(MouseEvent:any, object:any, Node:any, element:any){ function handleFieldTreeContextmenu(MouseEvent:any, object:any, Node:any, element:any){
//console.log(MouseEvent) //console.log(MouseEvent)
console.log(object)
//console.log(Node) //console.log(Node)
//console.log(element) //console.log(element)
aft.value.addIcon(object)
} }
import { ElTree } from 'element-plus' import { ElTree } from 'element-plus'
const fieldTreeFilterText = ref('') const fieldTreeFilterText = ref('')
const fieldTreeRef = ref<InstanceType<typeof ElTree>>() const fieldTreeRef = ref<InstanceType<typeof ElTree>>()
@ -1821,6 +1830,50 @@ const filterNode = (value: string, associatedFormsCurrentFormFieldTree: Tree) =>
if (!value) return true if (!value) return true
return associatedFormsCurrentFormFieldTree.label.includes(value) return associatedFormsCurrentFormFieldTree.label.includes(value)
} }
//flag
const associatedFormsHideDialogFlag = ref(false)
//
let associatedFormsHideDialogText = ref('雾峦青雨')
//
let associatedFormsHideDialogTextCopy = ref('')
//
function associatedFormsHideDialoghandle(){
associatedFormsHideDialogFlag.value = true
associatedFormsHideDialogTextCopy.value = associatedFormsHideDialogText.value
}
//asf
function asfhTextCancel(){
associatedFormsHideDialogFlag.value = false
associatedFormsHideDialogText.value = associatedFormsHideDialogTextCopy.value
//copy
aft.value.handelCancel(associatedFormsHideDialogTextCopy)
}
//text
function aftTextChanged(str:any){
console.log(str)
associatedFormsHideDialogText.value = str.value
}
//associatedFormsHideDialogFlag true init tinymce
watch(associatedFormsHideDialogFlag, (val) => {
if(associatedFormsHideDialogFlag.value===true){
setTimeout(() => {
aft.value.tinymceReInit()
}, 200);
}
})
//liwenxuan20240403 associatedForms end
@ -2277,7 +2330,7 @@ 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="associatedFormsHideDialogFlag = true" >设置隐藏条件</el-button> <el-button type="primary" append-to-body="true" modal="true" @click="associatedFormsHideDialoghandle" >设置隐藏条件</el-button>
</el-row> </el-row>
@ -2983,6 +3036,8 @@ const loadNextPage = () => {
<!-- 关联表单设置弹窗 liwenxuan 20240402 start --> <!-- 关联表单设置弹窗 liwenxuan 20240402 start -->
<el-dialog v-model="associatedFormsHideDialogFlag" title="隐藏条件" top="150px" style="margin-top:70px ;min-height: 500px" width="50%"> <el-dialog v-model="associatedFormsHideDialogFlag" title="隐藏条件" top="150px" style="margin-top:70px ;min-height: 500px" width="50%">
<template v-if="controlData.type=='associatedForms'"> <template v-if="controlData.type=='associatedForms'">
@ -3001,7 +3056,7 @@ const loadNextPage = () => {
<el-tree <el-tree
ref="fieldTreeRef" ref="fieldTreeRef"
:data="associatedFormsCurrentFormFieldTree" :data="associatedFormsCurrentFormFieldTree"
:props="defaultProps" :props="treeDefaultProps"
:filter-node-method="filterNode" :filter-node-method="filterNode"
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;" style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
@node-expand="handleFieldTreeExpand" @node-expand="handleFieldTreeExpand"
@ -3014,13 +3069,15 @@ const loadNextPage = () => {
<el-tree <el-tree
style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;" style="max-width: 600px; border: 1px solid gainsboro; margin: 3px;"
:data="orgAndManTree" :data="orgAndManTree"
:props="defaultProps" :props="treeDefaultProps"
/> />
</el-aside> </el-aside>
<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> <div id="associatedFormsHideEditArea" style="border: 1px solid gainsboro; height: 63%; border-bottom: 0px;">
<AssociatedFormsTinyace @textChange = "aftTextChanged" ref="aft" :aftText="associatedFormsHideDialogText" ></AssociatedFormsTinyace>
</div>
<div style="border: 1px solid gainsboro; height: 30%;"></div> <div style="border: 1px solid gainsboro; height: 30%;"></div>
</el-main> </el-main>
</el-container> </el-container>
@ -3028,7 +3085,7 @@ const loadNextPage = () => {
</template> </template>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<!-- <el-button @click="associatedFormsHideDialogFlag = false">取消</el-button> --> <el-button @click="asfhTextCancel">取消</el-button>
<el-button type="primary" @click="associatedFormsHideDialogFlag = false"> <el-button type="primary" @click="associatedFormsHideDialogFlag = false">
确定 确定
</el-button> </el-button>

91
src/widget/associatedforms/associatedFormsTinyace.vue

@ -0,0 +1,91 @@
<script lang='ts' setup>
import { ref, onMounted } from "vue";
import tinymce from "tinymce/tinymce";
import "tinymce/models/dom"; // tinymce 6.0.0
import "tinymce/themes/silver/theme";
import Editor from "@tinymce/tinymce-vue"; //
import { v4 as uuidv4 } from "uuid";
let onlyNumber = uuidv4().replaceAll('-','').toString(); //
//onlyNumber = "#"+onlyNumber
/**
* 初始富文本组件
*/
const tinymceInit = {
selector: "#tinymce",
language_url: "/tinymce/langs/zh-Hans.js", // public
language: "zh-Hans", // zh-Hans.js
skin_url: "/tinymce/skins/ui/oxide", //
height: 260, //
statusbar:false,
toolbar:false,
branding: false, //Powered by TinyMCE
menubar: false, //
forced_root_block:'',
newline_behavior:"",
content_css: "/tinymce/skins/content/default/content.css", //csscsscss
}
const props = defineProps({
aftText:{
type: String,
default(){
return {}
}
},
})
let $emit = defineEmits(["textChange"]);
const tinymceHtml = ref("")
tinymceHtml.value = props.aftText
onMounted(() => {
tinymce.init({}); //
});
const addIcon = (currentObject) =>{
console.log(currentObject)
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>`);
$emit('textChange',tinymceHtml);
}
const handelCancel = (associatedFormsHideDialogTextCopy) =>{
console.log(associatedFormsHideDialogTextCopy)
tinymceHtml.value = associatedFormsHideDialogTextCopy
}
const tinymceReInit = ()=>{
//tinymce.init({}); //
console.log(tinymce.get("tinymce"))
tinymce.get("tinymce").setContent('<p>213342</p>')
}
defineExpose({
tinymceHtml,
addIcon,
handelCancel,
tinymceReInit,
})
</script>
<template>
<editor id="tinymce" v-model="tinymceHtml" :init="tinymceInit" ></editor>
</template>
<style lang='scss' scoped>
</style>
Loading…
Cancel
Save