From bfeab594dd20eaf58c7a36105d2dd41ea0edfd0c Mon Sep 17 00:00:00 2001
From: liwenxuan <1298531568@qq.com>
Date: Tue, 9 Jul 2024 10:14:03 +0800
Subject: [PATCH] =?UTF-8?q?1.=E6=95=B0=E6=8D=AE=E6=A0=87=E9=A2=98=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=202.=E5=85=B3=E8=81=94=E8=A1=A8=E5=8D=95=E7=9A=84?=
=?UTF-8?q?=E9=9A=90=E8=97=8F=E6=9D=A1=E4=BB=B6=E5=92=8C=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E8=8C=83=E5=9B=B4=E6=9D=A1=E4=BB=B6=E7=BC=96=E8=BE=91=E6=A0=A1?=
=?UTF-8?q?=E9=AA=8C=E6=8F=90=E9=86=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/DesignForm/types.ts | 3 +-
src/components/DesignForm/formControlAttr.vue | 15 ++
.../DesignForm/formControlPropertiNew.vue | 14 ++
.../appPage/appPageForm/openAppFormPage.vue | 4 +-
.../lowcodepage/appPage/createAppFormPage.vue | 3 +-
.../associatedforms/associatedForms.vue | 49 ++++++-
.../associatedFormsTinyace.vue | 134 +++++++++++++++++-
.../associatedFormsTinyaceRange.vue | 125 +++++++++++++++-
8 files changed, 330 insertions(+), 17 deletions(-)
diff --git a/src/api/DesignForm/types.ts b/src/api/DesignForm/types.ts
index d39963610..32d431dfd 100644
--- a/src/api/DesignForm/types.ts
+++ b/src/api/DesignForm/types.ts
@@ -103,7 +103,8 @@ export interface formData{
form: {
size: any;
name:any,
- formName:any
+ formName:any,
+ dataTitle:any
};
config: any;
events?:any;
diff --git a/src/components/DesignForm/formControlAttr.vue b/src/components/DesignForm/formControlAttr.vue
index dd938747d..c87dc3524 100644
--- a/src/components/DesignForm/formControlAttr.vue
+++ b/src/components/DesignForm/formControlAttr.vue
@@ -3457,6 +3457,21 @@ const disabledIstrue = (val:string) => {
+
+
+
+ 数据标题
+
+
+
接口数据事件
diff --git a/src/components/DesignForm/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue
index 9fcec388a..261dbfe88 100644
--- a/src/components/DesignForm/formControlPropertiNew.vue
+++ b/src/components/DesignForm/formControlPropertiNew.vue
@@ -3491,6 +3491,20 @@ const disabledIstrue = (val:string) => {
+
+
+ 数据标题
+
+
+
接口数据事件
diff --git a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue
index 8e7be6a2e..f6bd7d618 100644
--- a/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue
+++ b/src/views/sysworkflow/lowcodepage/appPage/appPageForm/openAppFormPage.vue
@@ -170,7 +170,7 @@ const gainAppFormPageInit = () =>{
if(stateData.tableData.columns.length>0){
for(let i = 0;i{
stateData.tableData.columns[i].options = data
if(stateData.searchData.length>0){
for(let j = 0;j({
form: {
size: 'default',
name:'',
- formName: formConfigCont.formName
+ formName: formConfigCont.formName,
+ dataTitle: []
},
config: {
groupKey:props.groupKey
diff --git a/src/widget/associatedforms/associatedForms.vue b/src/widget/associatedforms/associatedForms.vue
index 11638e47d..a993a2de6 100644
--- a/src/widget/associatedforms/associatedForms.vue
+++ b/src/widget/associatedforms/associatedForms.vue
@@ -1,15 +1,52 @@
-
-
+
+
+
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/widget/associatedforms/associatedFormsTinyace.vue b/src/widget/associatedforms/associatedFormsTinyace.vue
index 40764b91f..4815b4aa6 100644
--- a/src/widget/associatedforms/associatedFormsTinyace.vue
+++ b/src/widget/associatedforms/associatedFormsTinyace.vue
@@ -6,6 +6,7 @@ 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";
+import { ElMessage } from 'element-plus'
let onlyNumber = uuidv4().replaceAll('-','').toString(); //获取唯一编码
@@ -46,17 +47,131 @@ let $emit = defineEmits(["textChange"]);
const tinymceHtml = ref("")
tinymceHtml.value = props.aftText
-
+const tinymceBox = ref(null)
onMounted(() => {
tinymce.init({}); // 初始化富文本
});
watch(()=>tinymceHtml.value, (val:any) => {
- $emit('textChange',val);
-},
+ $emit('textChange',val);
+ nextTick(()=>{
+ let formulaOne = [];
+ let formulaTwo = [];
+ tinymceBox.value.childNodes.forEach(element => {
+
+ element.childNodes.forEach(child => {
+ formulaOne.push(child.innerText?child.innerText:child.data)
+ if(child.dataset&&child.dataset.keyid){
+ formulaTwo.push(child.dataset.keyid)
+ }else{
+ formulaTwo.push(child.innerText?child.innerText:child.data)
+ }
+ })
+ });
+ let suanShitwo = formulaTwo.join('').replace(/\s+/g, "");
+ let gongShi ={
+ formulaHtml:tinymceBox.value.innerHTML,
+ mathsString:tinymceBox.value.innerText,
+ mathsFormula:suanShitwo,
+ }
+
+
+ if(containsNewline(gongShi.mathsString)){
+ errorCondition("条件不允许换行")
+ }else if(!gongShi.formulaHtml.startsWith("
")){
+ errorCondition("条件不能以蓝色块结尾")
+ }else if(countSpanTags(gongShi.formulaHtml)>1){
+ errorCondition("不允许出现多个蓝色块")
+ }else if(!containsSingleComparator(gongShi.mathsFormula)){
+ errorCondition("不存在有效符号")
+ }else if(checkEnding(gongShi.mathsFormula)){
+ errorCondition("不能以符号为结尾")
+ }else{
+ succCondition()
+ }
+ })
+
+ },
{ deep: true }
)
+function checkEnding(str: string) {
+ const symbols = ['==', '>=', '>', '<=', '<', '!=', '='];
+ const trimmedStr = str.trim();
+ for (let symbol of symbols) {
+ if (trimmedStr.endsWith(symbol)) {
+ return true;
+ }
+ }
+ return false;
+}
+function containsSingleComparator(str: string) {
+ // 定义需要检查的运算符
+ const comparators = ['==', '>=', '>', '<=', '<', '!='];
+ let found = false; // 用于标记是否找到运算符
+ let i = 0; // 字符串索引
+
+ while (i < str.length - 1) { // 至少需要两个字符来形成运算符
+ // 遍历每个可能的运算符
+ for (const comparator of comparators) {
+ if (str.substr(i, comparator.length) === comparator) {
+ // 如果找到了一个运算符
+ if (found) {
+ // 如果已经找到了一个运算符,则返回false
+ return false;
+ }
+ found = true; // 标记为已找到
+ // 跳过当前找到的运算符的剩余部分,避免重复检查
+ i += comparator.length - 1;
+ break; // 跳出内层循环
+ }
+ }
+ i++; // 继续检查下一个字符
+ }
+
+ // 检查是否只找到了一个运算符
+ return found;
+}
+
+function containsComparator(str: string) {
+ if(str.includes("==")||str.includes("!=")||str.includes(">")||str.includes(">=")||str.includes("<")||str.includes("<=")){
+ return true
+ }else{
+ return false
+ }
+}
+const containsNewline = (str: string) => {
+ //console.log("Testing string:", str); // 查看传递给函数的实际字符串
+ return /\n/.test(str);
+};
+const countSpanTags = (str: string) => {
+ // 使用正则表达式匹配所有出现的(不考虑闭合标签或属性)
+ const matches = str.match(/]*>/gi);
+ // 如果matches是null,表示没有找到匹配项,返回0
+ // 否则,返回匹配项数组的长度
+ return matches ? matches.length : 0;
+};
+function succCondition(){
+ ElMessage.closeAll()
+ ElMessage({
+ showClose: true,
+ message: '条件格式校验通过',
+ type: 'success',
+ duration:3500,
+ })
+}
+
+function errorCondition(str:string){
+ ElMessage.closeAll()
+ ElMessage({
+ showClose: true,
+ message: '条件格式错误 : '+str+' , 正确条件格式如 : 年龄==10',
+ type: 'error',
+ duration:3500,
+ })
+}
const addIcon = (currentObject:any) =>{
@@ -83,6 +198,7 @@ const focusEditor = ()=>{
}
+
defineExpose({
tinymceHtml,
addIcon,
@@ -96,12 +212,20 @@ defineExpose({
-
+
+
diff --git a/src/widget/associatedforms/associatedFormsTinyaceRange.vue b/src/widget/associatedforms/associatedFormsTinyaceRange.vue
index dd4f02abe..a37af4251 100644
--- a/src/widget/associatedforms/associatedFormsTinyaceRange.vue
+++ b/src/widget/associatedforms/associatedFormsTinyaceRange.vue
@@ -46,7 +46,7 @@ let $emit = defineEmits(["textChange"]);
const tinymceHtml = ref("")
tinymceHtml.value = props.aftText
-
+const tinymceBox = ref(null)
onMounted(() => {
@@ -54,9 +54,122 @@ onMounted(() => {
});
watch(()=>tinymceHtml.value, (val:any) => {
$emit('textChange',val);
+ nextTick(()=>{
+ let formulaOne = [];
+ let formulaTwo = [];
+ tinymceBox.value.childNodes.forEach(element => {
+
+ element.childNodes.forEach(child => {
+ formulaOne.push(child.innerText?child.innerText:child.data)
+ if(child.dataset&&child.dataset.keyid){
+ formulaTwo.push(child.dataset.keyid)
+ }else{
+ formulaTwo.push(child.innerText?child.innerText:child.data)
+ }
+ })
+ });
+ let suanShitwo = formulaTwo.join('').replace(/\s+/g, "");
+ let gongShi ={
+ formulaHtml:tinymceBox.value.innerHTML,
+ mathsString:tinymceBox.value.innerText,
+ mathsFormula:suanShitwo,
+ }
+
+
+ if(containsNewline(gongShi.mathsString)){
+ errorCondition("条件不允许换行")
+ }else if(!gongShi.formulaHtml.startsWith("
")){
+ errorCondition("条件不能以蓝色块结尾")
+ }else if(countSpanTags(gongShi.formulaHtml)>1){
+ errorCondition("不允许出现多个蓝色块")
+ }else if(!containsSingleComparator(gongShi.mathsFormula)){
+ errorCondition("不存在有效符号")
+ }else if(checkEnding(gongShi.mathsFormula)){
+ errorCondition("不能以符号为结尾")
+ }else{
+ succCondition()
+ }
+ })
+
},
{ deep: true }
)
+function containsSingleComparator(str: string) {
+ // 定义需要检查的运算符
+ const comparators = ['==', '>=', '>', '<=', '<', '!='];
+ let found = false; // 用于标记是否找到运算符
+ let i = 0; // 字符串索引
+
+ while (i < str.length - 1) { // 至少需要两个字符来形成运算符
+ // 遍历每个可能的运算符
+ for (const comparator of comparators) {
+ if (str.substr(i, comparator.length) === comparator) {
+ // 如果找到了一个运算符
+ if (found) {
+ // 如果已经找到了一个运算符,则返回false
+ return false;
+ }
+ found = true; // 标记为已找到
+ // 跳过当前找到的运算符的剩余部分,避免重复检查
+ i += comparator.length - 1;
+ break; // 跳出内层循环
+ }
+ }
+ i++; // 继续检查下一个字符
+ }
+
+ // 检查是否只找到了一个运算符
+ return found;
+}
+function checkEnding(str: string) {
+ const symbols = ['==', '>=', '>', '<=', '<', '!=', '='];
+ const trimmedStr = str.trim();
+ for (let symbol of symbols) {
+ if (trimmedStr.endsWith(symbol)) {
+ return true;
+ }
+ }
+ return false;
+}
+function containsComparator(str: string) {
+ if(str.includes("==")||str.includes("!=")||str.includes(">")||str.includes(">=")||str.includes("<")||str.includes("<=")){
+ return true
+ }else{
+ return false
+ }
+}
+const containsNewline = (str: string) => {
+ //console.log("Testing string:", str); // 查看传递给函数的实际字符串
+ return /\n/.test(str);
+};
+const countSpanTags = (str: string) => {
+ // 使用正则表达式匹配所有出现的(不考虑闭合标签或属性)
+ const matches = str.match(/]*>/gi);
+ // 如果matches是null,表示没有找到匹配项,返回0
+ // 否则,返回匹配项数组的长度
+ return matches ? matches.length : 0;
+};
+function errorCondition(str:string){
+ ElMessage.closeAll()
+ ElMessage({
+ showClose: true,
+ //message: '条件格式错误 : '+str+' , 正确条件格式如 : 年龄==10',
+ message: str,
+ type: 'error',
+ duration:3500,
+ })
+}
+function succCondition(){
+ ElMessage.closeAll()
+ ElMessage({
+ showClose: true,
+ message: '条件格式校验通过',
+ type: 'success',
+ duration:3500,
+ })
+}
const addIcon = (currentObject:any) =>{
@@ -99,10 +212,18 @@ defineExpose({
+