From 0ce559e6195a189ccc777b0fa439906bffb12b55 Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期三, 25 六月 2025 17:58:31 +0800 Subject: [PATCH] 多页面添加查看功能 --- src/views/basicInformation/index.vue | 162 ++++++++++++----------------------------------------- 1 files changed, 37 insertions(+), 125 deletions(-) diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue index caf93be..7e36228 100644 --- a/src/views/basicInformation/index.vue +++ b/src/views/basicInformation/index.vue @@ -56,11 +56,9 @@ @edit="handleEdit" @viewRow="handleView" @selection-change="handleSelectionChange" - :showOperations="true" - :showIndex="true" - :showPagination="false" :operations="['edit', 'viewRow']" :operationsWidth="200" + :show-overflow-tooltip="false" > <!-- 瀛楁鍚嶇О鍒楃殑鑷畾涔夋彃妲� - 鏄剧ず涓烘爣绛� --> <template @@ -146,21 +144,6 @@ :title="title" @submit="handleSubmit" /> - <Descriptions - v-model:descriptionsVisible="showDialog" - title="渚涘簲鍟嗚鎯�" - :formData="supplierData" - :fieldLabels="supplierFieldLabels" - :column="2" - :isViewOnly="false" - :border="true" - :showOperations="true" - descriptionsTitle="鍩烘湰淇℃伅" - :fieldConfig="fieldConfig" - :excludeFields="excludeFields" - @edit="descriptionsHandleEdit" - @close="handleClose" - /> </el-card> </div> </template> @@ -206,74 +189,18 @@ } from "@/api/basicInformation/coalQualityMaintenance"; const { proxy } = getCurrentInstance(); -import router from "@/router"; // ===== 鍝嶅簲寮忕姸鎬佺鐞� ===== // 寮圭獥鎺у埗鐘舵�� -const showDialog = ref(false) -const supplierFieldLabels = { - supplierName: '渚涘簲鍟嗗悕绉�', - taxpayerId: '缁熶竴绀句細淇$敤浠g爜', -} -// 鏁版嵁瀵硅薄 -const supplierData = ref({ - supplierName: "娴嬭瘯渚涘簲鍟�", - taxpayerId: "91320000MA1N2P3Q4R", - contactPerson: "寮犱笁", - contactPhone: "13800138000", - bankAccount: "6222024200019999999", - bankName: "涓浗宸ュ晢閾惰", - businessAddress: "姹熻嫃鐪佽嫃宸炲競宸ヤ笟鍥尯鏄熸箹琛�328鍙�", - contactAddress: "姹熻嫃鐪佽嫃宸炲競濮戣嫃鍖鸿鍓嶈100鍙�", - createTime: "2024-01-15T10:30:00", - updateTime: "2024-06-25T14:20:00", - id: 123, -}) -// 瀛楁閰嶇疆 -const fieldConfig = ref({ - supplierName: { - label: '渚涘簲鍟嗗悕绉�', - span: 2 // 璺�2鍒楁樉绀� - }, - taxpayerId: { - label: '缁熶竴绀句細淇$敤浠g爜' - }, - contactPhone: { - label: '鑱旂郴鐢佃瘽', - formatter: (value) => value || '鏆傛棤鑱旂郴鏂瑰紡' - }, - createTime: { - label: '鍒涘缓鏃堕棿', - formatter: (value) => new Date(value).toLocaleDateString('zh-CN') - }, - businessAddress: { - label: '璇︾粏缁忚惀鍦板潃', - span: 2 - }, - contactAddress: { - label: '璇︾粏鑱旂郴鍦板潃', - span: 2 - } -}) -// 鎺掗櫎涓嶆樉绀虹殑瀛楁 -const excludeFields = ref(["id", "updateTime", "deleted"]); +const showDialog = ref(false); +const currentViewData = ref({}); // 褰撳墠鏌ョ湅鐨勬暟鎹� -// 浜嬩欢澶勭悊 -const descriptionsHandleEdit = (data) => { - console.log("缂栬緫鏁版嵁:", data); - // 璺宠浆鍒扮紪杈戦〉闈㈡垨鎵撳紑缂栬緫寮圭獥 -}; - -const handleClose = () => { - console.log("寮圭獥鍏抽棴"); -}; const dialogFormVisible = ref(false); const form = ref({}); const title = ref(""); const copyForm = ref({}); const addOrEdit = ref("add"); -const descriptionsVisible = ref(false); // 鏁版嵁缂撳瓨鏄犲皠 const userList = ref([]); @@ -430,8 +357,6 @@ return matchedField ? matchedField.fieldName : numId; }; -// ===== 璁$畻灞炴�� ===== - /** * 褰撳墠鏍囩椤垫槸鍚︽敮鎸佸鍑哄姛鑳� */ @@ -470,11 +395,6 @@ * 褰撳墠閫変腑琛屾暟閲� */ const selectedCount = computed(() => selectedRows.value.length); - -/** - * 鏄惁鏈夐�変腑鐨勮 - */ -const hasSelectedRows = computed(() => selectedCount.value > 0); // ===== 琛ㄦ牸鍒楅厤缃� ===== @@ -796,48 +716,6 @@ handleAddEdit(tabName.value); }; -/** - * 鏌ョ湅鎸夐挳鐐瑰嚮澶勭悊 - * @param {Object} row - 琛屾暟鎹� - * @description 澶勭悊鏌ョ湅鎿嶄綔锛屾瀯寤哄湴鍧�鏁扮粍骞舵墦寮�鏌ョ湅寮圭獥 - */ -const handleView = (row) => { - console.log("鏌ョ湅琛屾暟鎹�:", row); - // 鎷垮埌鎵�鏈夌殑keys - const keys = Object.keys(row); - console.log("鎵�鏈塳eys:", keys); - showDialog.value = true; - // form.value = JSON.parse(JSON.stringify(row)); - // console.log("鏌ョ湅琛屾暟鎹�:", form.value); - // // 鏋勫缓渚涘簲鍟嗕笟鍔″湴鍧�鏁扮粍 - // if (form.value.bprovinceId && form.value.bdistrictId && form.value.bcityId) { - // form.value.bids = [row.bprovinceId, row.bcityId, row.bdistrictId]; - // } - // // 鏋勫缓渚涘簲鍟嗚仈绯诲湴鍧�鏁扮粍 - // if (form.value.cprovinceId && form.value.cdistrictId && form.value.ccityId) { - // form.value.cids = [row.cprovinceId, row.ccityId, row.cdistrictId]; - // } - // // 鏋勫缓瀹㈡埛涓氬姟鍦板潃鏁扮粍 - // if ( - // form.value.businessCityId && - // form.value.businessDistrictId && - // form.value.businessProvinceId - // ) { - // form.value.bids = [ - // row.businessProvinceId, - // row.businessCityId, - // row.businessDistrictId, - // ]; - // } - - // // 鏋勫缓瀹㈡埛鑱旂郴鍦板潃鏁扮粍 - // if (form.value.cityId && form.value.districtId && form.value.provinceId) { - // form.value.cids = [row.provinceId, row.cityId, row.districtId]; - // } - - // addOrEdit.value = "viewRow"; - // handleAddEdit(tabName.value); -}; /** * 鎵归噺鍒犻櫎澶勭悊 @@ -985,6 +863,40 @@ } }; +const handleView = (row) => { + form.value = JSON.parse(JSON.stringify(row)); + // 鏋勫缓渚涘簲鍟嗕笟鍔″湴鍧�鏁扮粍 + if (form.value.bprovinceId && form.value.bdistrictId && form.value.bcityId) { + form.value.bids = [row.bprovinceId, row.bcityId, row.bdistrictId]; + } + + // 鏋勫缓渚涘簲鍟嗚仈绯诲湴鍧�鏁扮粍 + if (form.value.cprovinceId && form.value.cdistrictId && form.value.ccityId) { + form.value.cids = [row.cprovinceId, row.ccityId, row.cdistrictId]; + } + + // 鏋勫缓瀹㈡埛涓氬姟鍦板潃鏁扮粍 + if ( + form.value.businessCityId && + form.value.businessDistrictId && + form.value.businessProvinceId + ) { + form.value.bids = [ + row.businessProvinceId, + row.businessCityId, + row.businessDistrictId, + ]; + } + + // 鏋勫缓瀹㈡埛鑱旂郴鍦板潃鏁扮粍 + if (form.value.cityId && form.value.districtId && form.value.provinceId) { + form.value.cids = [row.provinceId, row.cityId, row.districtId]; + } + addOrEdit.value = "viewRow"; + handleAddEdit(tabName.value); +}; + + // ===== 鐢熷懡鍛ㄦ湡閽╁瓙 ===== /** -- Gitblit v1.9.3