From d3c4dc9d9085e53aaa17f93f430150bdc93d97b5 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 29 十一月 2024 16:21:43 +0800 Subject: [PATCH] 无用代码 --- src/components/chat/chatComponents/summaryCom/components/recordSetTable/infoDetail/InfoDetail.vue | 39 +++++++++++++++++++++++++++++++-------- 1 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/infoDetail/InfoDetail.vue b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/infoDetail/InfoDetail.vue index a9ac2ba..f520353 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSetTable/infoDetail/InfoDetail.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSetTable/infoDetail/InfoDetail.vue @@ -7,10 +7,9 @@ :showFooter="false" @dlgClosed="closeDialog" :closeOnClickModal="true" - > - <el-form :model="item" ref="dialogFormRef" :rules="dialogFormRules" label-width="76"> - <el-form-item :label="colList[key]?.label" prop="key" v-for="key in Object.keys(item)"> + <el-form :model="item" ref="dialogFormRef" :rules="dialogFormRules" :label-width="labelWidth"> + <el-form-item :label="colList[key]?.label" :prop="key" v-for="key in Object.keys(colList)"> <el-input readonly :modelValue="item[key]"></el-input> </el-form-item> </el-form> @@ -22,13 +21,13 @@ import type { FormInstance, FormRules } from 'element-plus'; -import { computed, ref, watch } from 'vue'; +import { computed, onMounted, ref } from 'vue'; +import { getTextWidth } from '/@/utils/util'; - -const props = defineProps(['item','colList']); +const props = defineProps(['item', 'colList','title']); //#region ====================== 澧炲姞銆佷慨鏀硅褰曟搷浣�, dialog init====================== const dialogTitle = computed(() => { - return `璁板綍璇︽儏`; + return props.title ?? `璁板綍璇︽儏`; }); const dialogIsShow = defineModel({ @@ -41,13 +40,37 @@ // prompt: [{ required: true, message: '璇疯緭鍏ユ彁绀鸿瘝', trigger: 'blur' }], }); - //#endregion const closeDialog = () => { dialogIsShow.value = false; }; +const measureWidthOffset = 12; +const labelWidth = ref(undefined); +const getMaxLabelWidth = () =>{ + let maxLen = 0; + let maxStr = ''; + Object.values(props.colList ).map(item=>{ + const label = (item as any).label as string; + + const currentLen = label.gblen(); + if(currentLen> maxLen){ + maxLen = currentLen + maxStr = label; + } + }) + + + const maxWidth = getTextWidth(maxStr,{ + size: '14px', + })+measureWidthOffset; + labelWidth.value = maxWidth; +} + +onMounted(() => { + getMaxLabelWidth(); +}); </script> <style scoped lang="scss"></style> -- Gitblit v1.9.3