From 78d55ef7516e18446a742cf706750b8d8cfa55e6 Mon Sep 17 00:00:00 2001 From: zmj <1493694146@qq.com> Date: Tue, 28 May 2024 18:04:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E8=BF=91=E7=9A=84=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=96=B0=E7=9A=84=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=20`extend`=20=E5=88=B0=20`props`=EF=BC=8C=E5=B9=B6=E5=9C=A8=20?= =?UTF-8?q?`setKey`=20=E6=96=B9=E6=B3=95=E4=B8=AD=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=E5=A4=84=E7=90=86=E3=80=82=E6=AD=A4=E5=A4=96=EF=BC=8C?= =?UTF-8?q?=E8=BF=98=E5=9C=A8=20`oa=5FInitiate`=20=E7=9A=84=20`detail.vue`?= =?UTF-8?q?=20=E5=92=8C=20`edit.vue`=20=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BA=86=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=20`oa=5FInitiate`=20=E7=9A=84=20`in?= =?UTF-8?q?dex.vue`=20=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit message: 添加 `extend` 属性并更新相关页面 --- src/components/generateForm/index.vue | 23 +++++++++++++++++------ src/views/oa_Initiate/detail.vue | 3 ++- src/views/oa_Initiate/edit.vue | 10 +++++++++- src/views/oa_Initiate/index.vue | 11 +++++++---- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/components/generateForm/index.vue b/src/components/generateForm/index.vue index f697b06..c4fc059 100644 --- a/src/components/generateForm/index.vue +++ b/src/components/generateForm/index.vue @@ -58,6 +58,9 @@ const props = defineProps({ }, type: { type: Number, + }, + extend: { + type: Object, } }) @@ -93,13 +96,21 @@ const selectChange = (lab) => { } const setKey = () => { - props.config.forEach(item => { - props.formData[item.value] = { - label: item.label, - value: "", - text: "" + if (Object.keys(props.extend).length) { + for (let key in props.extend) { + props.formData[key] = props.extend[key] } - }) + } + else { + props.config.forEach(item => { + props.formData[item.value] = { + label: item.label, + value: "", + text: "" + } + }) + } } setKey() + \ No newline at end of file diff --git a/src/views/oa_Initiate/detail.vue b/src/views/oa_Initiate/detail.vue index fc9929e..3b95728 100644 --- a/src/views/oa_Initiate/detail.vue +++ b/src/views/oa_Initiate/detail.vue @@ -55,7 +55,8 @@ - + diff --git a/src/views/oa_Initiate/edit.vue b/src/views/oa_Initiate/edit.vue index b971107..c1917ab 100644 --- a/src/views/oa_Initiate/edit.vue +++ b/src/views/oa_Initiate/edit.vue @@ -5,7 +5,8 @@ - + + @@ -32,6 +33,7 @@ const formRef = shallowRef(); const popupRef = shallowRef>(); const mode = ref("add"); const showDialog = ref(false) +const extend = ref({}) // 弹窗标题 const popupTitle = computed(() => { @@ -63,6 +65,11 @@ const setFormData = async (data: Record) => { formData.id = data.id; }; +// 获取详情 +const setExtend = async (data: Record) => { + extend.value = data +}; + // 提交按钮 @@ -88,5 +95,6 @@ const handleClose = () => { defineExpose({ open, setFormData, + setExtend }); \ No newline at end of file diff --git a/src/views/oa_Initiate/index.vue b/src/views/oa_Initiate/index.vue index 15677c3..a9294c3 100644 --- a/src/views/oa_Initiate/index.vue +++ b/src/views/oa_Initiate/index.vue @@ -22,7 +22,8 @@ - + + @@ -86,13 +87,16 @@ const queryParams = reactive({ // 编辑 -const handleEdit = async (id: any, cate = '') => { +const handleEdit = async (id: any, cate = '', extend = '') => { type.value = cate let res = await apiOaFlowTypeDetail({ id }) showEdit.value = true await nextTick() editRef.value?.open('edit') editRef.value?.setFormData(res) + if (Object.keys(extend).length) { + editRef.value?.setExtend(extend) + } } const handDetail = async (id: any, data = {}) => { @@ -105,9 +109,8 @@ const handDetail = async (id: any, data = {}) => { const reEdit = async (data) => { showDetail.value = false - console.log(data) await nextTick() - handleEdit(data?.flow_info?.flow_cate) + handleEdit(data?.flow_info?.flow_cate, '', data.extends) } // 删除