From da8d9bc9b3080709334e17ea566654b2580ae660 Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Sun, 29 Sep 2024 08:07:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=84=E7=90=86=E7=BA=A7=E8=81=94?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/DesignForm/type.ts | 8 + src/components/DesignForm/aceDrawer.vue | 197 +++++++++++++- src/components/DesignForm/aceDrawerPage.vue | 92 +++++++ src/components/DesignForm/aceDrawerTree.vue | 254 ++++++++++++++++++ .../DesignForm/public/form/formItem.vue | 2 +- .../appPage/appPageForm/pageForm.vue | 29 +- 6 files changed, 574 insertions(+), 8 deletions(-) create mode 100644 src/components/DesignForm/aceDrawerPage.vue create mode 100644 src/components/DesignForm/aceDrawerTree.vue diff --git a/src/api/DesignForm/type.ts b/src/api/DesignForm/type.ts index bdd04e8..46bc2f0 100644 --- a/src/api/DesignForm/type.ts +++ b/src/api/DesignForm/type.ts @@ -220,3 +220,11 @@ export interface optionsInfo { label: string; value: string; } + + +//定义树形结构体 +export interface treeStruct { + value: string + label?: string + children?: treeStruct[] +} diff --git a/src/components/DesignForm/aceDrawer.vue b/src/components/DesignForm/aceDrawer.vue index e221b85..f2db0a3 100644 --- a/src/components/DesignForm/aceDrawer.vue +++ b/src/components/DesignForm/aceDrawer.vue @@ -5,10 +5,12 @@ --> diff --git a/src/components/DesignForm/aceDrawerTree.vue b/src/components/DesignForm/aceDrawerTree.vue new file mode 100644 index 0000000..eeb1fa2 --- /dev/null +++ b/src/components/DesignForm/aceDrawerTree.vue @@ -0,0 +1,254 @@ + + + + diff --git a/src/components/DesignForm/public/form/formItem.vue b/src/components/DesignForm/public/form/formItem.vue index 8410b08..fe52431 100644 --- a/src/components/DesignForm/public/form/formItem.vue +++ b/src/components/DesignForm/public/form/formItem.vue @@ -1133,7 +1133,7 @@ const uploadPic = (val:any) => { :options="options" v-model="value" /> - + {{data}} { // 生成脚本预览和导入json,都是将编辑器内容更新至state.formData + console.log("生成脚本预览和导入",editVal) + console.log("生成脚本预览和导入----->",drawer.type,"==========",drawer.callback,"==========",drawer) + console.log("生成脚本预览和导入===========>",state.value.formData) + try { if (typeof drawer.callback === 'function') { // callback const newObj = drawer.codeType === 'json'? string2json(editVal): stringToObj(editVal) drawer.callback(newObj) + console.log("1==============>",) } else { switch (drawer.type) { case 'css': @@ -561,6 +567,7 @@ const dialogConfirm = (editVal: string) => { state.value.formData.config = {} } state.value.formData.config.style = editVal + console.log("2==============>",) break case 'dict': state.value.formDict = string2json(editVal) @@ -575,17 +582,32 @@ const dialogConfirm = (editVal: string) => { state.value.formData.events = {} } state.value.formData.events[drawer.type] = stringToObj(editVal) + console.log("3==============>",) break default: state.value.formData = stringToObj(editVal) + console.log("4==============>",) } } dialogCancel() } catch (res) { // console.log(res.message) - //ElMessage.error(res.message) + ElMessage.error(res.message) } } +/** +@ 作者: 秦东 +@ 时间: 2024-09-27 16:53:30 +@ 功能: 级联选择与树 +*/ +const dialogConfirmTree = (val:treeStruct[]) => { + console.log("级联选择与树",val) + const newObj = + drawer.codeType === 'json'? string2json(val): stringToObj(val) + drawer.callback(newObj) + + console.log("级联选择与树--->",state.value.formData) +} From c9f11663f25ea3ac2e5891d7ade94dd502f21eee Mon Sep 17 00:00:00 2001 From: herenshan112 Date: Mon, 30 Sep 2024 09:34:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DesignForm/aceDrawer.vue | 94 ++++++++++++++++--- .../DesignForm/formControlPropertiNew.vue | 2 +- .../DesignForm/public/expand/cascader.vue | 47 ++++++++++ .../DesignForm/public/form/formItem.vue | 22 ++++- .../appPage/appPageForm/pageForm.vue | 27 ++++-- 5 files changed, 169 insertions(+), 23 deletions(-) create mode 100644 src/components/DesignForm/public/expand/cascader.vue diff --git a/src/components/DesignForm/aceDrawer.vue b/src/components/DesignForm/aceDrawer.vue index f2db0a3..6eb6e27 100644 --- a/src/components/DesignForm/aceDrawer.vue +++ b/src/components/DesignForm/aceDrawer.vue @@ -41,6 +41,7 @@ const visible = ref(false) const treeSelectAry = reactive([]) //树形数据 const editTitleFormRef = ref(ElForm); //编辑表单 +const editTitleInfoRef = ref(ElForm); let jibuqi = 0 //计步器计算最大值 const isTopHeader = ref(false) //是否为添加顶级树脂 const guodu = ref({}) //数据中转使用 @@ -77,6 +78,7 @@ const dialogConfirm = () => { const drawerBeforeClose = () => { emits('update:modelValue', false) emits('beforeClose') + treeSelectAry=[] } onMounted(() => {}) onUnmounted(() => { @@ -164,15 +166,24 @@ const pickIsTrue = () => { */ const dialogConfirmTree = () => { - let drawer = ({ - visible: false, - type: '', - title: '', - codeType: '', - direction: undefined, //弹出方向rtl / ltr - callback: '' - }) - + // let drawer = ({ + // visible: false, + // type: '', + // title: '', + // codeType: '', + // direction: undefined, //弹出方向rtl / ltr + // callback: '' + // }) + // let opt = new Array + // treeSelectAry.forEach((item:treeStruct) => { + // opt.push({ + // value: item.value, + // label: item.label, + // children: item.children + // }) + // }) + + // emits('confirm', treeSelectAry) emits('confirmTree', treeSelectAry) drawerBeforeClose() } @@ -203,6 +214,46 @@ const delDiGui = (tree: treeStruct[],val:treeStruct) => { } } } +const edisIsShow = ref(false) +const butLoadEdit = ref(false) +/** +@ 作者: 秦东 +@ 时间: 2024-09-29 13:29:17 +@ 功能: 编辑级联舒体 +*/ +const pickEdis = (val:treeStruct) => { + guodu.value = val + treeSelectTitle.label = val.label + edisIsShow.value = true +} +/** +@ 作者: 秦东 +@ 时间: 2024-09-29 13:33:51 +@ 功能: 关闭编辑窗体 +*/ +const pickEditClose = () => { + guodu.value = {} + treeSelectTitle.label = "" + edisIsShow.value = false + butLoadEdit.value = false + editTitleInfoRef.value.resetFields(); +} +/** +@ 作者: 秦东 +@ 时间: 2024-09-29 13:36:30 +@ 功能: 确定修改 +*/ +const pickEditIsTrue = () => { + butLoadEdit.value = true + editTitleInfoRef.value.validate((isValid: boolean) => { + if(isValid){ + guodu.value.label = treeSelectTitle.label + pickEditClose() + }else{ + butLoad.value = false + } + }) +} + + + + + + + + + + + diff --git a/src/components/DesignForm/public/form/formItem.vue b/src/components/DesignForm/public/form/formItem.vue index fe52431..e1a90e8 100644 --- a/src/components/DesignForm/public/form/formItem.vue +++ b/src/components/DesignForm/public/form/formItem.vue @@ -36,6 +36,7 @@ import UploadPage from '@/components/DesignForm/public/expand/uploadPage.vue' import UploadPageList from '@/components/DesignForm/public/expand/uploadPageList.vue' import OrgCitys from '@/components/DesignForm/public/expand/orgCitys.vue' import DatePickerPage from '@/components/DesignForm/public/expand/datePicker.vue' +import CascaderPage from '@/components/DesignForm/public/expand/cascader.vue' @@ -199,9 +200,12 @@ const currentComponent = computed(() => { if (props.data.type === 'datePicker') { props.data.control.valueFormat="x" // props.data.control.align="right" - // props.data.control.appendToBody =true + // props.data.control.appendToBody =true return markRaw(DatePickerPage) } + if(props.data.type === 'cascader'){ + return markRaw(CascaderPage) + } if (props.data.type === 'switch') { if(typeof props.data.control.activeValue === "number"){ props.data.control.activeValue=props.data.control.activeValue.toString() @@ -1133,12 +1137,24 @@ const uploadPic = (val:any) => { :options="options" v-model="value" /> - {{data}} + + + ([]) //版本内容列表 const tableKey = ref("") const versionId = ref("") //版本号 -const store = useDesignFormStore() +// const store = useDesignFormStore() +const store = useDesignFormStore() as any + +const controlData = computed(() => { + // console.log("注册自定义事件----------------->",props.formInfo) + // console.log("注册自定义事件--------1--------->",store.controlAttr) + // console.log("注册自定义事件---------3-------->",controlData.value.customRules) + return store.controlAttr +}) const drawer = reactive({ visible: false, type: '', @@ -545,7 +553,7 @@ function optionsValue3Get3(data: any,fieldName: string){ } } -// 弹窗确认 +// 弹窗确认3174.15 2924.57 3326.15 3119.33 const dialogConfirm = (editVal: string) => { // 生成脚本预览和导入json,都是将编辑器内容更新至state.formData console.log("生成脚本预览和导入",editVal) @@ -554,6 +562,7 @@ const dialogConfirm = (editVal: string) => { try { if (typeof drawer.callback === 'function') { + console.log("1======2========>",drawer.codeType,stringToObj(editVal)) // callback const newObj = drawer.codeType === 'json'? string2json(editVal): stringToObj(editVal) @@ -601,13 +610,15 @@ const dialogConfirm = (editVal: string) => { @ 功能: 级联选择与树 */ const dialogConfirmTree = (val:treeStruct[]) => { - console.log("级联选择与树",val) - const newObj = - drawer.codeType === 'json'? string2json(val): stringToObj(val) - drawer.callback(newObj) - - console.log("级联选择与树--->",state.value.formData) + // console.log("级联选择与树",val) + // const newObj = + // drawer.codeType === 'json'? string2json(val): stringToObj(val) + // drawer.callback(newObj) + controlData.value.options = val + // console.log("级联选择与树--->",controlData) } + +