From 70e08980b2fcf49dc0505984cc310ce9850c761b Mon Sep 17 00:00:00 2001 From: zhang_12370 <z2864490065@outlook.com> Date: 星期四, 10 七月 2025 18:16:16 +0800 Subject: [PATCH] 首页模块 销售数据 月度对比 --- src/views/equipment/management/index.vue | 643 ++++++++++++++++++---------------------------------------- 1 files changed, 201 insertions(+), 442 deletions(-) diff --git a/src/views/equipment/management/index.vue b/src/views/equipment/management/index.vue index 3481d2f..5c29464 100644 --- a/src/views/equipment/management/index.vue +++ b/src/views/equipment/management/index.vue @@ -36,13 +36,6 @@ <el-button :icon="Delete" type="danger" @click="handleDelete" >鍒犻櫎</el-button > - <!-- <el-button - v-show="canExport" - :icon="Download" - type="info" - @click="handleExport" - >瀵煎嚭</el-button - > --> </el-row> <!-- 琛ㄦ牸缁勪欢 --> <div> @@ -61,7 +54,7 @@ > <!-- 瀛楁鍚嶇О鍒楃殑鑷畾涔夋彃妲� - 鏄剧ず涓烘爣绛� --> <template - v-if="tabName === 'coalQualityMaintenance'" + v-if="activeTab === 'coalQualityMaintenance'" #fieldIds="{ row }" > <template @@ -76,12 +69,10 @@ style="margin-right: 4px; margin-bottom: 2px" type="primary" > - {{ getFieldDisplayName(field.trim()) }} </el-tag> </template> <template v-else> <el-tag size="small" type="primary"> - {{ getFieldDisplayName(row.fieldIds) || "--" }} </el-tag> </template> </template> @@ -96,465 +87,279 @@ @pagination="handPagination" /> <managementDialog - + v-if="activeTab == 'management'" + v-model:copyForm="copyForm" + v-model:managementFormDialog="manaDialog" + :addOrEdit="addOrEdit" + :form="form" + @submit="getList" ></managementDialog> + <EquipmentRequisition + v-if="activeTab == 'equipmentRequisition'" + v-model="equipmentRequisitionDialog" + :formData="form" + :maxQuantity="getMaxQuantity()" + @submit="onEquipmentRequisitionSubmit" + /> + <UsageRecord + v-if="activeTab == 'usageRecord'" + v-model:copyForm="copyForm" + v-model:usageRecordDialog="usageRecordDialog" + :addOrEdit="addOrEdit" + :form="form" + @submit="getList" + /> </el-card> </div> </template> <script setup> -import { - computed, - getCurrentInstance, - onMounted, - reactive, - ref, - nextTick, -} from "vue"; -import { ElMessage, ElMessageBox } from "element-plus"; -import { Delete, Download, Plus } from "@element-plus/icons-vue"; +import { computed, onMounted, reactive, ref } from "vue"; +import { ElMessage } from "element-plus"; +import { Delete, Plus } from "@element-plus/icons-vue"; -// ===== 缁勪欢瀵煎叆 ===== +// 缁勪欢瀵煎叆 import DataTable from "@/components/Table/ETable.vue"; import Pagination from "@/components/Pagination"; import managementDialog from "./mould/managementDialog.vue"; -// ===== API 鏈嶅姟瀵煎叆 ===== -import { delSupply, getSupply } from "@/api/basicInformation/supplier.js"; -import { useDelete } from "@/hooks/useDelete.js"; -import { testUserList } from "@/api/tool/publicInterface.js"; -const { proxy } = getCurrentInstance(); +import EquipmentRequisition from "./mould/equipmentRequisitionDialog.vue"; +import UsageRecord from "./mould/usageRecord.vue"; -// ===== 鍝嶅簲寮忕姸鎬佺鐞� ===== -const dialogFormVisible = ref(false); +// API 鏈嶅姟瀵煎叆 +import { useDelete } from "@/hooks/useDelete.js"; +import { getManagementList, delEquipment } from "@/api/equipment/management/index.js"; +import { getUsageRecordList } from "@/api/equipment/requisition/index.js"; + +// 鍝嶅簲寮忕姸鎬佺鐞� const form = ref({}); const title = ref(""); const copyForm = ref({}); const addOrEdit = ref("add"); - -// 鏁版嵁缂撳瓨鏄犲皠 -const userList = ref([]); -const userMap = ref({}); // 鐢ㄦ埛ID -> 鐢ㄦ埛鍚嶆槧灏勮〃 -const addressMap = ref({}); // 鍦板潃ID -> 鍦板潃淇℃伅鏄犲皠琛� -const coalFieldList = ref([]); // 鐓よ川瀛楁鍒楄〃 - -// 椤甸潰鐘舵�佹帶鍒� -const tabName = ref("management"); +const manaDialog = ref(false); +const equipmentRequisitionDialog = ref(false); +const usageRecordDialog = ref(false); const loading = ref(false); const activeTab = ref("management"); +const selectedRows = ref([]); +const tableData = ref([]); -// 鍒嗛〉鐘舵�佺鐞� +// 鍒嗛〉鐘舵�� const pageNum = ref(1); const pageSizes = ref(10); const total = ref(0); -// 琛ㄦ牸鐘舵�佺鐞� -const selectedRows = ref([]); -const tableData = ref([]); -const columns = ref(); - // 鏌ヨ鍙傛暟 -const queryParams = reactive({}); - -// 鍦板潃閫夋嫨鏁版嵁 -const addressSelectOptions = ref([]); - -// ===== 閰嶇疆甯搁噺 ===== - -// 鏍囩椤甸厤缃� -const tabs = reactive([ - { name: "management", label: "渚涘簲鍟嗕俊鎭�" }, - { name: "customer", label: "瀹㈡埛淇℃伅" }, -]); - -// ===== 宸ュ叿鍑芥暟 ===== - - -/** - * 鏋勫缓鍦板潃鏄犲皠琛� - * @param {Array} areaData - 鍦板潃鏁版嵁 - * @description 閫掑綊鏋勫缓鍦板潃鏄犲皠琛紝鏀寔澶氱骇鍦板潃鏌ユ壘 - */ -const buildAddressMap = (areaData) => { - const buildMap = (list, pathList = []) => { - list.forEach((item) => { - const currentPath = [...pathList, item.label]; - addressMap.value[item.id] = { - name: item.label, - fullPath: currentPath.join(" / "), - }; - if (item.children && item.children.length > 0) { - buildMap(item.children, currentPath); - } - }); - }; - buildMap(areaData); -}; - -/** - * 鏍煎紡鍖栧湴鍧�鏁扮粍涓烘樉绀哄瓧绗︿覆 - * @param {Array} addressIds - 鍦板潃ID鏁扮粍 - * @returns {string} 鏍煎紡鍖栧悗鐨勫湴鍧�瀛楃涓� - * @description 灏嗗湴鍧�ID鏁扮粍杞崲涓哄彲璇荤殑鍦板潃瀛楃涓� - */ -const formatAddressArray = (addressIds) => { - if ( - !addressMap.value || - Object.keys(addressMap.value).length === 0 || - !addressIds || - !Array.isArray(addressIds) || - addressIds.length === 0 || - addressIds.every((id) => !id) - ) { - return "--"; - } - - const addressNames = addressIds.map( - (id) => addressMap.value[id]?.name || "--" - ); - - if (addressNames.every((name) => name === "--")) { - return "--"; - } - - return addressNames.filter((name) => name !== "--").join(" / "); -}; - -/** - * 鑾峰彇鐢ㄦ埛鍒楄〃鏁版嵁骞舵瀯寤烘槧灏勮〃 - * @description 鑾峰彇鐢ㄦ埛鏁版嵁骞舵瀯寤篒D鍒扮敤鎴峰悕鐨勬槧灏勫叧绯� - */ -const getUserList = async () => { - try { - const res = await testUserList(); - console.log("鑾峰彇鐢ㄦ埛鍒楄〃鏁版嵁:", res); - console.log("userMap:", userMap.value); - if (res && res.data) { - userList.value = res.data; - userList.value.forEach((user) => { - userMap.value[user.userId] = user.nickName; - }); - } - } catch (error) { - console.error("鑾峰彇鐢ㄦ埛鍒楄〃澶辫触:", error); - } -}; - -/** - * 鏍规嵁瀛楁ID鑾峰彇瀛楁鏄剧ず鍚嶇О - * @param {string|number} fieldId - 瀛楁ID - * @returns {string} 瀛楁鏄剧ず鍚嶇О - * @description 閫氳繃瀛楁ID鍖归厤瀵瑰簲鐨勫瓧娈靛悕绉� - */ -const getFieldDisplayName = (fieldId) => { - if (!fieldId) return "--"; - - const numId = parseInt(fieldId); - const matchedField = coalFieldList.value.find((item) => item.id === numId); - - return matchedField ? matchedField.fieldName : numId; -}; - -/** - * 褰撳墠鏍囩椤垫槸鍚︽敮鎸佸鍑哄姛鑳� - */ -const canExport = computed(() => { - return ["management"].includes(tabName.value); +const queryParams = reactive({ + searchAll: "" }); -/** - * 鎼滅储妗嗗崰浣嶇鏂囨湰 - */ -const searchPlaceholder = computed(() => { - const placeholderMap = { - management: "渚涘簲鍟�/缁熶竴璇嗗埆鐮�/璇︾粏鍦板潃", - }; - return placeholderMap[tabName.value] || "璇疯緭鍏ユ悳绱俊鎭�"; -}); +// 鏍囩椤甸厤缃� - 渚夸簬鍚庣画鎵╁睍 +const tabsConfig = { + management: { + label: "璁惧鍒楄〃", + searchPlaceholder: "璁惧缂栧彿/璁惧鍚嶇О/瑙勬牸鍨嬪彿", + showSearch: true, + api: getManagementList, + deleteApi: delEquipment, + columns: [ + { prop: "equipmentNo", label: "璁惧缂栧彿", minWidth: 100 }, + { prop: "equipmentName", label: "璁惧鍚嶇О", minWidth: 100 }, + { prop: "quantity", label: "鏁伴噺", minWidth: 100 }, + { prop: "specification", label: "瑙勬牸鍨嬪彿", minWidth: 100 }, + { + prop: "usageStatus", + label: "浣跨敤鐘舵��", + minWidth: 100, + formatter: (row) => row.usageStatus == 1 ? "鍚敤" : "绂佺敤" + }, + { prop: "purchaseDate", label: "閲囪喘鏃ユ湡", minWidth: 100 }, + { prop: "purchasePrice", label: "閲囪喘浠锋牸", minWidth: 100 }, + ] + }, + equipmentRequisition:{ + label: "璁惧棰嗙敤", + searchPlaceholder: "璁惧缂栧彿/璁惧鍚嶇О/瑙勬牸鍨嬪彿", + showSearch: true, + api: getUsageRecordList, + deleteApi: null, + columns: [ + { prop: "userId", label: "棰嗙敤浜�", minWidth: 100 }, + { prop: "equipmentId", label: "璁惧ID", minWidth: 100 }, + { prop: "usageQuantity", label: "棰嗙敤鏁伴噺", minWidth: 100 }, + { + prop: "equipmentStatus", + label: "浣跨敤鐘舵��", + minWidth: 100, + formatter: (row) => row.usageStatus == 1 ? "鍚敤" : "绂佺敤" + }, + { prop: "usageStartTime", label: "浣跨敤寮�濮嬫椂闂�", minWidth: 100 }, + { prop: "usageEndTime", label: "浣跨敤缁撴潫鏃堕棿", minWidth: 100 }, + { prop: "remarks", label: "澶囨敞", minWidth: 100 }, + ] + }, + usageRecord:{ + label: "棰嗙敤璁板綍", + searchPlaceholder: "璁惧缂栧彿/璁惧鍚嶇О/瑙勬牸鍨嬪彿", + showSearch: true, + api: getManagementList, + deleteApi: delEquipment, + columns: [ + { prop: "equipmentId", label: "璁惧缂栧彿", minWidth: 100 }, + { prop: "equipmentName", label: "璁惧鍚嶇О", minWidth: 100 }, + { prop: "quantity", label: "鏁伴噺", minWidth: 100 }, + { prop: "specification", label: "瑙勬牸鍨嬪彿", minWidth: 100 }, + { + prop: "usageStatus", + label: "浣跨敤鐘舵��", + minWidth: 100, + formatter: (row) => row.usageStatus == 1 ? "鍚敤" : "绂佺敤" + }, + { prop: "purchaseDate", label: "閲囪喘鏃ユ湡", minWidth: 100 }, + { prop: "purchasePrice", label: "閲囪喘浠锋牸", minWidth: 100 }, + ] + }, -/** - * 鏄惁鏄剧ず鎼滅储妗� - */ -const shouldShowSearch = computed(() => { - return [ - "management", - ].includes(tabName.value); -}); + // 鍚庣画鍙互鍦ㄨ繖閲屾坊鍔犳柊鐨勬爣绛鹃〉閰嶇疆 +}; -/** - * 褰撳墠閫変腑琛屾暟閲� - */ +// 鏍囩椤垫暟鎹� +const tabs = reactive( + Object.entries(tabsConfig).map(([name, config]) => ({ + name, + label: config.label + })) +); + +// 褰撳墠鏍囩椤甸厤缃� +const currentTabConfig = computed(() => tabsConfig[activeTab.value]); + +// 璁$畻灞炴�� +const searchPlaceholder = computed(() => currentTabConfig.value?.searchPlaceholder || "璇疯緭鍏ユ悳绱俊鎭�"); +const shouldShowSearch = computed(() => currentTabConfig.value?.showSearch || false); +const columns = computed(() => currentTabConfig.value?.columns || []); const selectedCount = computed(() => selectedRows.value.length); -// ===== 琛ㄦ牸鍒楅厤缃� ===== - -/** - * 渚涘簲鍟嗚〃鏍煎垪閰嶇疆 - */ -const management = ref([ - { prop: "equipmentId", label: "璁惧缂栧彿", minWidth: 100 }, - { prop: "equipmentName", label: "璁惧鍚嶇О", minWidth: 100 }, - { prop: "quantity", label: "鏁伴噺", minWidth: 100 }, - { prop: "specification", label: "瑙勬牸鍨嬪彿", minWidth: 100 }, - { prop: "usageStatus", label: "浣跨敤鐘舵��", minWidth: 100 }, - { prop: "usingDepartment", label: "浣跨敤閮ㄩ棬", minWidth: 100 }, - { prop: "userId", label: "浣跨敤浜�", minWidth: 100 }, - { prop: "purchaseDate", label: "閲囪喘鏃ユ湡", minWidth: 100 }, - { prop: "purchasePrice", label: "閲囪喘浠锋牸", minWidth: 100 }, -]); - - -// ===== 浜嬩欢澶勭悊鍑芥暟 ===== - -/** - * 鏍囩椤靛垏鎹簨浠跺鐞� - * @param {Object} tab - 鏍囩椤靛璞� - * @description 澶勭悊鏍囩椤靛垏鎹紝閲嶇疆琛ㄥ崟鍜岀姸鎬侊紝鍔犺浇瀵瑰簲鏁版嵁 - */ +// 浜嬩欢澶勭悊鍑芥暟 const handleTabClick = (tab) => { - // 閲嶇疆琛ㄥ崟鍜岀姸鎬� + activeTab.value = tab.props.name; + resetState(); + getList(); +}; + +const resetState = () => { form.value = {}; addOrEdit.value = "add"; loading.value = true; - tabName.value = tab.props.name; tableData.value = []; pageNum.value = 1; pageSizes.value = 10; total.value = 0; queryParams.searchAll = ""; - // 鏍规嵁鏍囩椤电被鍨嬭缃搴旂殑鍒楅厤缃� - const tabConfig = { - management: () => { - columns.value = management.value; - getList(); - }, - }; - - // 鎵ц瀵瑰簲鐨勯厤缃嚱鏁� - const configFn = tabConfig[tabName.value]; - if (configFn) { - configFn(); - } }; -/** - * 閲嶇疆鏌ヨ鏉′欢 - * @description 閲嶇疆鏌ヨ鍙傛暟骞堕噸鏂板姞杞芥暟鎹� - */ const resetQuery = () => { - Object.keys(queryParams).forEach((key) => { - if (key !== "pageNum" && key !== "pageSizes") { - queryParams[key] = ""; - } - }); + queryParams.searchAll = ""; + pageNum.value = 1; getList(); }; -/** - * 鎼滅储鍔熻兘 - * @description 閲嶇疆椤电爜骞舵墽琛屾悳绱� - */ const search = () => { pageNum.value = 1; getList(); }; -/** - * 鏂板鎸夐挳鐐瑰嚮澶勭悊 - */ const handleAdd = () => { addOrEdit.value = "add"; - handleAddEdit(tabName.value); -}; - -/** - * 鏂板/缂栬緫寮圭獥澶勭悊 - * @param {string} currentTabName - 褰撳墠鏍囩椤靛悕绉� - * @description 鏍规嵁鏍囩椤电被鍨嬭缃脊绐楁爣棰樺苟鎵撳紑寮圭獥 - */ -const handleAddEdit = (currentTabName) => { - const actionText = - addOrEdit.value === "add" - ? "鏂板" - : addOrEdit.value === "edit" - ? "缂栬緫" - : "鏌ョ湅"; - - const tabTitleMap = { - supplier: "渚涘簲鍟嗕俊鎭�", - customer: "瀹㈡埛淇℃伅", - }; - - title.value = `${actionText}${tabTitleMap[currentTabName] || ""}`; - openDialog(); -}; - -/** - * 鎵撳紑寮圭獥 - * @description 鏍规嵁缂栬緫鐘舵�佸喅瀹氭槸鍚﹀鍒惰〃鍗曟暟鎹� - */ -const openDialog = () => { - if (addOrEdit.value === "edit" || addOrEdit.value === "viewRow") { - copyForm.value = JSON.parse(JSON.stringify(form.value)); + form.value = {}; + title.value = `鏂板${currentTabConfig.value.label}`; + // 閫氱敤鐨� + copyForm.value = {}; + if (activeTab.value === "equipmentRequisition") { + equipmentRequisitionDialog.value = true; + } else if (activeTab.value === "usageRecord") { + usageRecordDialog.value = true; } else { - form.value = {}; + manaDialog.value = true; } - dialogFormVisible.value = true; }; -/** - * 鍒嗛〉澶勭悊 - * @param {Object} val - 鍒嗛〉鍙傛暟瀵硅薄 - */ +const handleEdit = (row) => { + form.value = { ...row }; + addOrEdit.value = "edit"; + title.value = `缂栬緫${currentTabConfig.value.label}`; + copyForm.value = { ...row }; + if (activeTab.value === "equipmentRequisition") { + equipmentRequisitionDialog.value = true; + } else if (activeTab.value === "usageRecord") { + usageRecordDialog.value = true; + } else { + manaDialog.value = true; + } +}; + +const handleView = (row) => { + form.value = { ...row }; + addOrEdit.value = "viewRow"; + title.value = `鏌ョ湅${currentTabConfig.value.label}`; + copyForm.value = { ...row }; + if (activeTab.value === "equipmentRequisition") { + equipmentRequisitionDialog.value = true; + } else if (activeTab.value === "usageRecord") { + usageRecordDialog.value = true; + } else { + manaDialog.value = true; + } +}; + const handPagination = (val) => { pageNum.value = val.page; pageSizes.value = val.limit; getList(); }; -/** - * 琛ㄥ崟鎻愪氦澶勭悊 - * @param {Object} val - 鎻愪氦缁撴灉瀵硅薄 - */ -const handleSubmit = async (val) => { - if (val.result.code !== 200) { - ElMessage.error("鎿嶄綔澶辫触锛�" + val.result.msg); - return; - } - ElMessage.success(val.title + val.result.msg); - dialogFormVisible.value = false; - getList(); -}; - -/** - * 寮圭獥鏄剧ず鐘舵�佸鐞� - * @param {boolean} value - 鏄剧ず鐘舵�� - */ -const handleDialogFormVisible = (value) => { - dialogFormVisible.value = value; -}; - -/** - * 琛ㄦ牸琛岄�夋嫨澶勭悊 - * @param {Array} selection - 閫変腑鐨勮鏁版嵁 - */ const handleSelectionChange = (selection) => { selectedRows.value = selection; }; -/** - * 缂栬緫鎸夐挳鐐瑰嚮澶勭悊 - * @param {Object} row - 琛屾暟鎹� - * @description 澶勭悊缂栬緫鎿嶄綔锛屾瀯寤哄湴鍧�鏁扮粍骞舵墦寮�缂栬緫寮圭獥 - */ -const handleEdit = (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 = "edit"; - handleAddEdit(tabName.value); -}; -/** - * 鎵归噺鍒犻櫎澶勭悊 - * @description 鎵归噺鍒犻櫎閫変腑鐨勮褰� - */ - const deleteApiMap = { - management: delSupply, - }; -const {handleDeleteBatch :handleDelete} = useDelete({ - deleteApi: () => deleteApiMap[tabName.value], +// 鍒犻櫎澶勭悊 +const { handleDeleteBatch: handleDelete } = useDelete({ + deleteApi: () => currentTabConfig.value.deleteApi, selectedRows: selectedRows, - getList: () => getList, + getList: () => getList(), tableData: tableData, total: total, confirmText: "纭鍒犻櫎閫変腑鐨勬暟鎹悧锛�", successText: "鍒犻櫎鎴愬姛", -}) +}); -/** - * 鍏抽棴寮圭獥澶勭悊 - */ -const handleBeforeClose = () => { - dialogFormVisible.value = false; - form.value = {}; +// 鑾峰彇璁惧鏈�澶у彲棰嗙敤鏁伴噺 +const getMaxQuantity = () => { + if (form.value.equipmentId) { + const equipment = tableData.value.find(item => item.equipmentId === form.value.equipmentId); + return equipment ? equipment.quantity : null; + } + return null; }; -/** - * 瀵煎嚭鏁版嵁 - * @param {string} api - 瀵煎嚭鎺ュ彛璺緞 - * @param {string} name - 瀵煎嚭鏂囦欢鍚嶅墠缂� - */ -const exportData = (api, name) => { - proxy.download( - api, - { ...queryParams }, - `${name}${new Date().getTime()}.xlsx` - ); - ElMessage.success("瀵煎嚭鏁版嵁锛�" + name); -}; -// ===== 鏁版嵁鑾峰彇鍑芥暟 ===== - -/** - * 鏍规嵁褰撳墠鏍囩椤甸�夋嫨瀵瑰簲鐨凙PI鎺ュ彛 - * @returns {Promise} API璋冪敤Promise - * @description 缁熶竴鐨勬帴鍙i�夋嫨鍑芥暟锛屾牴鎹爣绛鹃〉绫诲瀷璋冪敤瀵瑰簲鐨凙PI - */ -const selectInterface = () => { - const apiParams = { - current: pageNum.value, - pageSize: pageSizes.value, - searchAll: queryParams.searchAll, - }; - - const apiMap = { - management: () => getSupply(apiParams), - customer: () => getCustomerList(apiParams), - coal: () => getCoalInfo(apiParams), - coalQualityMaintenance: () => getCoalPlanList(apiParams), - coalMeiZhiZiDuanWeiHu: () => coalField(apiParams), - }; - - const apiFunction = apiMap[tabName.value]; - return apiFunction - ? apiFunction() - : Promise.reject(new Error("鏈壘鍒板搴旂殑API鎺ュ彛")); +// 璁惧棰嗙敤寮圭獥鎻愪氦澶勭悊 +const onEquipmentRequisitionSubmit = (formData) => { + ElMessage.success('璁惧棰嗙敤鎴愬姛'); + equipmentRequisitionDialog.value = false; + getList(); }; -/** - * 鑾峰彇鍒楄〃鏁版嵁 - * @description 缁熶竴鐨勬暟鎹幏鍙栧嚱鏁帮紝澶勭悊鍔犺浇鐘舵�佸拰閿欒澶勭悊 - */ +// 鏁版嵁鑾峰彇 const getList = async () => { try { loading.value = true; - const { data, code } = await selectInterface(); + const apiParams = { + current: pageNum.value, + pageSize: pageSizes.value, + searchAll: queryParams.searchAll, + }; + + const { data, code } = await currentTabConfig.value.api(apiParams); if (code !== 200) { ElMessage.error("鑾峰彇鏁版嵁澶辫触锛�" + (data?.msg || "鏈煡閿欒")); @@ -564,63 +369,15 @@ tableData.value = data.records || []; total.value = data.total || 0; } catch (error) { - console.error("鑾峰彇鍒楄〃鏁版嵁澶辫触:", error); ElMessage.error("鑾峰彇鏁版嵁澶辫触锛岃绋嶅悗鍐嶈瘯"); } finally { loading.value = false; } }; -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); -}; - - -// ===== 鐢熷懡鍛ㄦ湡閽╁瓙 ===== - -/** - * 缁勪欢鎸傝浇鍚庣殑鍒濆鍖栨搷浣� - */ -onMounted(async () => { - try { - // 骞惰鎵ц鍒濆鍖栨搷浣� - await Promise.all([ - handleTabClick({ props: { name: "management" } }), - getUserList(), - ]); - } catch (error) { - console.error("缁勪欢鍒濆鍖栧け璐�:", error); - ElMessage.error("椤甸潰鍒濆鍖栧け璐ワ紝璇峰埛鏂伴噸璇�"); - } +// 缁勪欢鎸傝浇 +onMounted(() => { + handleTabClick({ props: { name: "management" } }); }); </script> @@ -644,7 +401,9 @@ flex-wrap: wrap; gap: 10px; } - +.app-container{ + padding: 18px !important; +} /* 鍝嶅簲寮忚〃鏍� */ @media screen and (max-width: 768px) { .table-toolbar { -- Gitblit v1.9.3