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..6eb6e27 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/formControlPropertiNew.vue b/src/components/DesignForm/formControlPropertiNew.vue index 2d358ee..0e05b4f 100644 --- a/src/components/DesignForm/formControlPropertiNew.vue +++ b/src/components/DesignForm/formControlPropertiNew.vue @@ -1840,7 +1840,7 @@ const currentAsfChangeCount = ref(0) } } // console.log(resDataForGlxxszExceptself1) - if(getAssociatedFormsCurrentFieldTreeData.treeAttrs!=undefined){ + if(getAssociatedFormsCurrentFieldTreeData && getAssociatedFormsCurrentFieldTreeData.treeAttrs && getAssociatedFormsCurrentFieldTreeData.treeAttrs!=undefined){ associatedFormsCurrentFormFieldTreeForGlxxszExceptSelf.value = [{ id: 'rootid_'+getAssociatedFormsCurrentFieldTreeData.label, //label: '当前表单', diff --git a/src/components/DesignForm/public/expand/cascader.vue b/src/components/DesignForm/public/expand/cascader.vue new file mode 100644 index 0000000..e1d6b4c --- /dev/null +++ b/src/components/DesignForm/public/expand/cascader.vue @@ -0,0 +1,47 @@ + + + + diff --git a/src/components/DesignForm/public/form/formItem.vue b/src/components/DesignForm/public/form/formItem.vue index 8410b08..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" /> - + + + ([]) //版本内容列表 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: '', @@ -544,15 +553,21 @@ function optionsValue3Get3(data: any,fieldName: string){ } } -// 弹窗确认 +// 弹窗确认3174.15 2924.57 3326.15 3119.33 const dialogConfirm = (editVal: string) => { // 生成脚本预览和导入json,都是将编辑器内容更新至state.formData + console.log("生成脚本预览和导入",editVal) + console.log("生成脚本预览和导入----->",drawer.type,"==========",drawer.callback,"==========",drawer) + console.log("生成脚本预览和导入===========>",state.value.formData) + try { if (typeof drawer.callback === 'function') { + console.log("1======2========>",drawer.codeType,stringToObj(editVal)) // callback const newObj = drawer.codeType === 'json'? string2json(editVal): stringToObj(editVal) drawer.callback(newObj) + console.log("1==============>",) } else { switch (drawer.type) { case 'css': @@ -561,6 +576,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 +591,34 @@ 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) + controlData.value.options = val + // console.log("级联选择与树--->",controlData) +} + +