From 3f541afe59b9f367f37cd6ec5c379b5c8d197b73 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Wed, 12 Jun 2024 13:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DesignForm/app/index.vue | 851 +++++++++++++++++- .../DesignForm/formControlProperties.vue | 181 ++++ .../lowcodepage/pageFlow/appTableFlow.vue | 533 +++++++++++ .../lowcodepage/runApp/runAppForm.vue | 13 +- 4 files changed, 1576 insertions(+), 2 deletions(-) create mode 100644 src/views/sysworkflow/lowcodepage/pageFlow/appTableFlow.vue diff --git a/src/components/DesignForm/app/index.vue b/src/components/DesignForm/app/index.vue index faaa24c2b..176d8172e 100644 --- a/src/components/DesignForm/app/index.vue +++ b/src/components/DesignForm/app/index.vue @@ -4,11 +4,860 @@ @ 备注: App表单列表 --> diff --git a/src/components/DesignForm/formControlProperties.vue b/src/components/DesignForm/formControlProperties.vue index 7e01b6cf3..4ca69f9e3 100644 --- a/src/components/DesignForm/formControlProperties.vue +++ b/src/components/DesignForm/formControlProperties.vue @@ -1159,6 +1159,124 @@ const controlChange = (obj: any, val: any) => { obj.path && getPropByPath(controlData.value, obj.path, newVal) } } +// 更多属性弹窗 +const openAttrDialog = (type?: string, tooltip?: string) => { + let editData = controlData.value.control + if (controlData.value.type === 'button') { + // 按钮组件编辑属性 + editData = controlData.value.config + type = 'button' + } + switch (type) { + case 'treeSelect': + editData = controlData.value.control.data + break + case 'cascader': + editData = controlData.value.options + break + case 'optionsParams': // 选项请求附加参数 + editData = controlData.value.config.beforeRequest + // params.codeType = 'json' + break + case 'optionsResult': + editData = controlData.value.config.afterResponse + break + } + const emitsParams = { + content: editData, + title: tooltip, + type: type, + direction: 'ltr', + callback: (result: any) => { + switch (type) { + case 'treeSelect': + controlData.value.control.data = result + break + case 'cascader': + controlData.value.options = result + break + case 'optionsParams': + controlData.value.config.beforeRequest = result + break + case 'optionsResult': + controlData.value.config.afterResponse = result + break + case 'button': + controlData.value.config = result + break + default: + controlData.value.control = {} + Object.assign(controlData.value.control, result) + } + } + } + emits('openDialog', emitsParams) + } + // 必填校验 + const requiredChange = (val: any) => { + if (!controlData.value.item?.rules) { + controlData.value.item.rules = [] + } + if (val) { + controlData.value.item.rules.push({ + required: true, + message: '必填项', + trigger: 'change' + }) + } else { + controlData.value.item.rules.splice(0, 1) + } + } +// 多选固定选项增加 +const addSelectOption = (type: any) => { + if (controlData.value.type === 'cascader') { + // 级联时打开弹窗口 + openAttrDialog('cascader') + } else if (controlData.value.type === 'treeSelect') { + openAttrDialog('treeSelect', '编辑组件下拉选项数据') + } else { + if (type === 'tabs') { + controlData.value.columns.push({ + label: '标签名称', + list: [] + }) + } else { + controlData.value.options.push({ + label: '', + value: '' + }) + } + } + } +// 属性设置相关结束 + // 多选固定选项删除 + const delSelectOption = (index: number, type?: string) => { + if (type === 'tabs') { + controlData.value.columns.splice(index, 1) + } else { + controlData.value.options.splice(index, 1) + } + } +// 添加校验规则 +const addRules = (tooltip: string) => { + if (!controlData.value.item?.rules) { + controlData.value.item.rules = [] + } + const params = { + content: controlData.value.item?.rules, + title: tooltip, + direction: 'ltr', + callback: (result: any) => { + Object.assign(controlData.value.item.rules, result) + } + } + emits('openDialog', params) + } +// 校验规则必填勾选设置,存在校验规则时勾选 +const checkboxRequired = computed(() => { + const val = controlData.value && controlData.value.item?.rules + return val && val.length > 0 + }) /** @ 作者: 秦东 @ 时间: 2024-05-10 13:39:12 @@ -1180,6 +1298,17 @@ const tableColumnAdd = (val: string) => { controlData.value.list.splice(0, 1) } } +// 快速添加一条校验规则 +const addRulesFast = () => { + if (!controlData.value.customRules) { + controlData.value.customRules = [] + } + controlData.value.customRules.push({ + type: 'required', + message: '必填项', + trigger: 'blur' + }) + } /** @ 作者: 秦东 @ 时间: 2024-05-10 13:40:14 @@ -1313,6 +1442,58 @@ watch(()=>store.activeKey, (val:string) => { const controlDataStyls = computed(() => { return store.controlAttr.styles }) +// 返回选项配置提示 +const getOptionPlaceholder = (type: number) => { + switch (type) { + case 1: + return '数据源接口URL,可带参数' + case 2: + return '字典key,默认为字段标识' + } + return '' + } +// 删除一条校验规则 +const delAddRules = (index: number) => { + controlData.value.customRules && + controlData.value.customRules.splice(index, 1) + } +//添加一条编码规则 +const addNumRules = () => { + if (!controlData.value.config.customRules) { + controlData.value.config.customRules = [] + } + controlData.value.config.customRules.push({ + type:'time', + rule:"YYYYMMDD" + }) + } +//删除一条编码规则 +const delNumRules = (index: number) => { + controlData.value.config.customRules && + controlData.value.config.customRules.splice(index, 1) + } +// 快速添加校验规则改变时,填写默认的校验提示信息 +const rulesSelectChange = (item: any, val: string) => { + const filter = validate.filter(item => item.type === val) + if (filter && filter.length) { + item.message = filter[0].message + } + } + const rulesSelectNumChange = (item: any, val: string) => { + // console.log("快速添加校验规则改变时",item,val) + const filter = state.numberRulesList.filter(item => item.type === val) + if (filter && filter.length) { + item.message = filter[0].msg + if(val == "time") { + item.rule = "YYYYMMDD" + }else{ + item.rule = "" + } + } + } + + +