From a175709baa7777575d054f928d4d2d029a04bd60 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 29 十二月 2025 17:41:06 +0800
Subject: [PATCH] 陕西昭德-app巡检上传修改
---
src/pages/management/index.vue | 680 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 680 insertions(+), 0 deletions(-)
diff --git a/src/pages/management/index.vue b/src/pages/management/index.vue
new file mode 100644
index 0000000..a8f4602
--- /dev/null
+++ b/src/pages/management/index.vue
@@ -0,0 +1,680 @@
+<template>
+ <view class="equipment-management">
+ <!-- 椤甸潰澶撮儴 -->
+ <PageHeader title="璁惧绠$悊" @back="goBack"/>
+
+ <!-- 鎼滅储鍖哄煙 -->
+ <view class="search-section" v-if="shouldShowSearch">
+ <view class="search-bar">
+ <view class="search-input">
+ <up-input
+ class="search-text"
+ :placeholder="searchPlaceholder"
+ v-model="queryParams.searchAll"
+ clearable
+ />
+ </view>
+ <view class="filter-button" @click="search">
+ <up-icon name="search" size="24" color="#999"></up-icon>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鏍囩椤� -->
+ <!-- <view class="tabs-section">
+ <u-tabs
+ :list="tabs"
+ :current="activeTabIndex"
+ @change="handleTabChange"
+ :scrollable="false"
+ lineWidth="30"
+ lineColor="#2979ff"
+ :activeStyle="{
+ color: '#2979ff',
+ fontWeight: 'bold'
+ }"
+ />
+ </view> -->
+
+ <!-- 鍒楄〃鍖哄煙 -->
+ <scroll-view
+ class="list-container"
+ scroll-y
+ refresher-enabled
+ :refresher-triggered="refreshing"
+ @refresherrefresh="onRefresh"
+ >
+ <!-- 鍔犺浇鐘舵�� -->
+ <view v-if="loading" class="loading-container">
+ <u-loading-icon text="鍔犺浇涓�..." />
+ </view>
+
+ <!-- 璁惧鍒楄〃 -->
+ <view v-else-if="!loading && tableData.length > 0" class="ledger-list">
+ <view v-for="(item, index) in tableData" :key="item.id || index">
+ <view class="ledger-item">
+ <view class="item-header">
+ <view class="item-left">
+ <view class="document-icon">
+ <up-icon name="file-text" size="16" color="#ffffff"></up-icon>
+ </view>
+ <text class="item-id">{{ item.equipmentNo || '鏈紪鍙�' }}</text>
+ </view>
+ </view>
+ <up-divider></up-divider>
+
+ <view class="item-details">
+ <!-- 璁惧鍒楄〃椤甸潰 -->
+ <!-- <template v-if="activeTab === 'management'"> -->
+ <view class="detail-row">
+ <text class="detail-label">璁惧鍚嶇О</text>
+ <text class="detail-value">{{ item.equipmentName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鑰楁潗</text>
+ <text class="detail-value">{{ (item.consumables !== undefined ? item.consumables : item.isConsumables) ? '鏄�' : '鍚�' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鎬绘暟閲�</text>
+ <text class="detail-value highlight">{{ item.quantity || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">宸蹭娇鐢ㄦ暟閲�</text>
+ <text class="detail-value">{{ item.usedNo || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ item.specification || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">閲囪喘鏃ユ湡</text>
+ <text class="detail-value">{{ item.purchaseDate || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">閲囪喘浠锋牸</text>
+ <text class="detail-value">{{ item.purchasePrice ? `楼${item.purchasePrice}` : '-' }}</text>
+ </view>
+ <!-- </template> -->
+
+ <!-- 璁惧棰嗙敤椤甸潰 -->
+ <!-- <template v-else-if="activeTab === 'equipmentRequisition'">
+ <view class="detail-row">
+ <text class="detail-label">棰嗙敤浜�</text>
+ <text class="detail-value">{{ item.userName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">璁惧鍚嶇О</text>
+ <text class="detail-value">{{ item.equipmentName || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">棰嗙敤鏁伴噺</text>
+ <text class="detail-value highlight">{{ item.usageQuantity || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">褰掕繕鏁伴噺</text>
+ <text class="detail-value">{{ item.returnQuantity || 0 }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浣跨敤鐘舵��</text>
+ <text class="detail-value" :style="{ color: getStatusColor(item.equipmentStatus) }">
+ {{ getStatusText(item.equipmentStatus) }}
+ </text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浣跨敤寮�濮嬫椂闂�</text>
+ <text class="detail-value">{{ item.usageStartTime || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浣跨敤缁撴潫鏃堕棿</text>
+ <text class="detail-value">{{ item.usageEndTime || '-' }}</text>
+ </view>
+ <view class="detail-row" v-if="item.remarks">
+ <text class="detail-label">澶囨敞</text>
+ <text class="detail-value">{{ item.remarks }}</text>
+ </view>
+ </template> -->
+ </view>
+
+ <!-- 鎿嶄綔鎸夐挳 - 鍙湪璁惧棰嗙敤椤甸潰鏄剧ず -->
+ <!-- <template v-if="activeTab === 'equipmentRequisition'">
+ <up-divider></up-divider>
+ <view class="action-buttons">
+ <u-button
+ type="info"
+ size="small"
+ class="action-btn"
+ @click.stop="handleView(item)"
+ >
+ 鏌ョ湅
+ </u-button>
+ <u-button
+ v-if="shouldShowReturnButton(item)"
+ type="success"
+ size="small"
+ class="action-btn"
+ :disabled="item.equipmentStatus === EQUIPMENT_STATUS.RETURNED"
+ @click.stop="handleReturn(item)"
+ >
+ 褰掕繕
+ </u-button>
+ </view>
+ </template> -->
+ </view>
+ </view>
+ </view>
+
+ <!-- 绌虹姸鎬� -->
+ <view v-else-if="!loading && tableData.length === 0" class="no-data">
+ <text>鏆傛棤{{ currentTabConfig?.label || '' }}鏁版嵁</text>
+ </view>
+ </scroll-view>
+
+ <!-- 娴姩鎿嶄綔鎸夐挳 - 璁惧棰嗙敤椤甸潰鏄剧ず棰嗙敤鎸夐挳 -->
+ <!-- <view
+ v-if="activeTab === 'equipmentRequisition'"
+ class="fab-button"
+ @tap="handleAdd"
+ >
+ <up-icon name="plus" size="24" color="#ffffff"></up-icon>
+ </view> -->
+
+ <!-- 寮圭獥缁勪欢 -->
+ <!-- <managementDialog
+ v-if="activeTab == 'management'"
+ v-model:copyForm="copyForm"
+ v-model:managementFormDialog="manaDialog"
+ :addOrEdit="addOrEdit"
+ :form="form"
+ @submit="getList"
+ /> -->
+ <!-- <EquipmentRequisition
+ v-model="equipmentRequisitionDialog"
+ :formData="form"
+ :maxQuantity="getMaxQuantity()"
+ :addOrEdit="addOrEdit"
+ :equipmentStatus="form.equipmentStatus"
+ @submit="onEquipmentRequisitionSubmit"
+ /> -->
+
+ <!-- 鏌ョ湅璇︽儏寮圭獥 -->
+ <!-- <u-popup
+ v-model="dialogTableVisible"
+ :title="dialogTableTitle"
+ mode="center"
+ :closeable="true"
+ >
+ <view class="dialog-content">
+ <u-table
+ :data="dialogTableData"
+ :columns="dialogTableColumns"
+ height="400px"
+ />
+ </view>
+ </u-popup> -->
+ </view>
+</template>
+
+<script setup>
+import { computed, onMounted, reactive, ref, nextTick, toRefs } from "vue";
+
+// uviewplus缁勪欢瀵煎叆
+import { useToast } from '@/utils/uviewplus'
+const { showToast } = useToast()
+
+// 缁勪欢瀵煎叆
+import PageHeader from "@/components/PageHeader.vue";
+// import managementDialog from "./mould/managementDialog.vue";
+// import EquipmentRequisition from "./mould/equipmentRequisitionDialog.vue";
+
+// API 鏈嶅姟瀵煎叆
+import {
+ getManagementList,
+} from "@/api/equipment/management/index.js";
+// import { getUsageRecordList, getUsageDetailList } from "@/api/equipment/requisition/index.js";
+
+// 璁惧鐘舵�佹灇涓�
+const EQUIPMENT_STATUS = {
+ USING: 1, // 浣跨敤涓�
+ PARTIAL_RETURN: 2, // 閮ㄥ垎褰掕繕
+ RETURNED: 3 // 宸插綊杩�
+};
+
+// 鑾峰彇鐘舵�佹枃鏈�
+const getStatusText = (status) => {
+ switch(status) {
+ case EQUIPMENT_STATUS.USING: return "浣跨敤涓�";
+ case EQUIPMENT_STATUS.PARTIAL_RETURN: return "閮ㄥ垎褰掕繕";
+ case EQUIPMENT_STATUS.RETURNED: return "宸插綊杩�";
+ default: return "鏈煡鐘舵��";
+ }
+};
+
+// 鑾峰彇鐘舵�侀鑹�
+const getStatusColor = (status) => {
+ switch(status) {
+ case EQUIPMENT_STATUS.USING: return '#409eff'; // 钃濊壊
+ case EQUIPMENT_STATUS.PARTIAL_RETURN: return '#e6a23c'; // 姗欒壊
+ case EQUIPMENT_STATUS.RETURNED: return '#67c23a'; // 缁胯壊
+ default: return '#909399'; // 鐏拌壊
+ }
+};
+
+// 鍝嶅簲寮忕姸鎬佺鐞� - 浣跨敤瑙f瀯鍜岄粯璁ゅ��
+const initFormState = () => ({ consumables: false });
+
+const state = reactive({
+ form: initFormState(),
+ title: "",
+ copyForm: {},
+ addOrEdit: "add",
+ loading: false,
+ activeTab: "management",
+ tableData: [],
+ // 鍒嗛〉鐘舵�侊紙淇濈暀鐢ㄤ簬API璋冪敤锛屼絾涓嶆樉绀哄垎椤电粍浠讹級
+ pageNum: 1,
+ pageSize: 20,
+ total: 0,
+ // 涓嬫媺鍒锋柊鐘舵��
+ refreshing: false,
+ // 鏌ヨ鍙傛暟
+ queryParams: {
+ searchAll: "",
+ },
+});
+
+// 浣跨敤瑙f瀯绠�鍖栬闂�
+const {
+ form,
+ title,
+ copyForm,
+ addOrEdit,
+ loading,
+ activeTab,
+ tableData,
+ pageNum,
+ pageSize,
+ total,
+ queryParams,
+ refreshing,
+} = toRefs(state);
+
+// 娣诲姞缂哄け鐨勫搷搴斿紡鍙橀噺
+const manaDialog = ref(false);
+const equipmentRequisitionDialog = ref(false);
+const usageRecordDialog = ref(false);
+const dialogTableVisible = ref(false);
+const dialogTableTitle = ref('');
+const dialogTableData = ref([]);
+const dialogTableColumns = ref([]);
+
+// 鏍囩椤甸厤缃� - 渚夸簬鍚庣画鎵╁睍
+const tabsConfig = {
+ management: {
+ label: "璁惧鍒楄〃",
+ searchPlaceholder: "璁惧缂栧彿/璁惧鍚嶇О/瑙勬牸鍨嬪彿",
+ showSearch: true,
+ api: getManagementList,
+ columns: [
+ { prop: "equipmentNo", label: "璁惧缂栧彿", minWidth: 100 },
+ { prop: "equipmentName", label: "璁惧鍚嶇О", minWidth: 100 },
+ { prop: "consumables", label: "鑰楁潗",
+ formatter: (row) => {
+ const value = row.consumables !== undefined ? row.consumables : row.isConsumables;
+ return value ? "鏄�" : "鍚�";
+ }, minWidth: 100 },
+ { prop: "quantity", label: "鎬绘暟閲�", minWidth: 100 },
+ { prop: "usedNo", label: "宸蹭娇鐢ㄦ暟閲�", minWidth: 100 },
+ { prop: "specification", label: "瑙勬牸鍨嬪彿", minWidth: 100 },
+ { prop: "purchaseDate", label: "閲囪喘鏃ユ湡", minWidth: 100 },
+ { prop: "purchasePrice", label: "閲囪喘浠锋牸", minWidth: 100 },
+ ],
+ },
+ // equipmentRequisition: {
+ // label: "璁惧棰嗙敤",
+ // searchPlaceholder: "璁惧缂栧彿/璁惧鍚嶇О/瑙勬牸鍨嬪彿",
+ // showSearch: true,
+ // api: getUsageRecordList,
+ // columns: [
+ // { prop: "userName", label: "棰嗙敤浜�", minWidth: 100 },
+ // { prop: "equipmentNo", label: "璁惧缂栧彿", minWidth: 100 },
+ // { prop: "equipmentName", label: "璁惧鍚嶇О", minWidth: 100 },
+ // { prop: "usageQuantity", label: "棰嗙敤鏁伴噺", minWidth: 100 },
+ // {prop: "returnQuantity" , label: "褰掕繕鏁伴噺", minWidth: 100,
+ // formatter: (row) => row.returnQuantity || 0
+ // },
+ // {
+ // prop: "equipmentStatus",
+ // label: "浣跨敤鐘舵��",
+ // minWidth: 100,
+ // formatter: (row) => getStatusText(row.equipmentStatus),
+ // cellStyle: (row) => ({ color: getStatusColor(row.equipmentStatus) }),
+ // },
+ // { prop: "usageStartTime", label: "浣跨敤寮�濮嬫椂闂�", minWidth: 100 },
+ // { prop: "usageEndTime", label: "浣跨敤缁撴潫鏃堕棿", minWidth: 100 },
+ // { prop: "remarks", label: "澶囨敞", minWidth: 100 },
+ // ],
+ // },
+};
+
+// 鏍囩椤垫暟鎹� - u-tabs闇�瑕乶ame浣滀负鏄剧ず鏂囨湰
+// const tabs = computed(() =>
+// Object.entries(tabsConfig).map(([name, config]) => ({
+// name: config.label, // 浣跨敤label浣滀负鏄剧ず鏂囨湰
+// value: name, // 淇濆瓨鍘熷name鍊�
+// }))
+// );
+const tabs = computed(() => [
+ {
+ name: tabsConfig.management.label,
+ value: 'management'
+ }
+]);
+
+// 褰撳墠鏍囩椤电储寮� - 浣跨敤ref鑰屼笉鏄痗omputed锛岀‘淇濆搷搴斿紡鏇存柊
+const activeTabIndex = ref(0);
+
+// 褰撳墠鏍囩椤甸厤缃�
+const currentTabConfig = computed(() => tabsConfig[activeTab.value]);
+
+// 璁$畻灞炴��
+const searchPlaceholder = computed(
+ () => currentTabConfig.value?.searchPlaceholder || "璇疯緭鍏ユ悳绱俊鎭�"
+);
+const shouldShowSearch = computed(
+ () => currentTabConfig.value?.showSearch || false
+);
+
+// 鍒ゆ柇鏄惁鏄剧ず褰掕繕鎸夐挳
+// const shouldShowReturnButton = (item) => {
+// if (activeTab.value !== 'equipmentRequisition') {
+// return false;
+// }
+// // 濡傛灉璁惧鐘舵�佹槸宸插綊杩橈紝涓嶆樉绀哄綊杩樻寜閽�
+// if (item.equipmentStatus === EQUIPMENT_STATUS.RETURNED) {
+// return false;
+// }
+// // 鍏朵粬鐘舵�侀兘鏄剧ず褰掕繕鎸夐挳锛堜娇鐢ㄤ腑銆侀儴鍒嗗綊杩樸�佹垨鑰呮病鏈夌姸鎬侊級
+// return true;
+// };
+
+// 鍔ㄦ�佽幏鍙栬嚜瀹氫箟鎸夐挳閰嶇疆锛堜繚鐣欑敤浜庡叾浠栫敤閫旓級
+// const getCustomButtons = () => {
+// const buttons = [];
+//
+// // 鍦ㄨ澶囬鐢ㄩ〉闈㈡坊鍔犲綊杩樻寜閽�
+// if (activeTab.value === 'equipmentRequisition') {
+// buttons.push({
+// name: 'return',
+// label: '褰掕繕',
+// type: 'success',
+// size: 'small',
+// link: true,
+// show: (row) => shouldShowReturnButton(row),
+// disabled: (row) => row.equipmentStatus === EQUIPMENT_STATUS.RETURNED,
+// });
+// }
+//
+// return buttons;
+// };
+
+// 澶勭悊鑷畾涔夋寜閽偣鍑讳簨浠�
+// const handleCustomButtonClick = ({ buttonName, row }) => {
+// switch (buttonName) {
+// case 'return':
+// handleReturn(row);
+// break;
+// // 鍙互鍦ㄨ繖閲屾坊鍔犳洿澶氳嚜瀹氫箟鎸夐挳鐨勫鐞嗛�昏緫
+// default:
+// console.warn(`鏈鐞嗙殑鑷畾涔夋寜閽�: ${buttonName}`);
+// }
+// };
+// const handleReturn = (row) => {
+// // 妫�鏌ヨ澶囩姸鎬�
+// if (row.equipmentStatus === EQUIPMENT_STATUS.RETURNED) {
+// showToast('璇ヨ澶囧凡褰掕繕瀹屾垚锛屾棤闇�鍐嶆褰掕繕', 'warning');
+// return;
+// }
+//
+// if (row.equipmentStatus !== EQUIPMENT_STATUS.USING && row.equipmentStatus !== EQUIPMENT_STATUS.PARTIAL_RETURN) {
+// showToast('璇ヨ澶囧綋鍓嶇姸鎬佷笉鏀寔褰掕繕鎿嶄綔', 'warning');
+// return;
+// }
+//
+// form.value = { ...row };
+// addOrEdit.value = "return"; // 璁剧疆涓哄綊杩樻ā寮�
+// title.value = `褰掕繕璁惧 - ${row.equipmentName || ''}`;
+// copyForm.value = { ...row };
+// equipmentRequisitionDialog.value = true;
+// console.log("褰掕繕璁惧锛�", row);
+// };
+// 鏍囩椤靛垏鎹㈠鐞� - u-tabs鐨凘change浜嬩欢浼犻�掔殑鏄璞� { index: number }
+const handleTabChange = (e) => {
+ const index = typeof e === 'object' && e.index !== undefined ? e.index : e;
+ console.log('handleTabChange:', e, 'index:', index, 'tabs:', tabs.value);
+ const selectedTab = tabs.value[index];
+ if (selectedTab && selectedTab.value !== activeTab.value) {
+ activeTab.value = selectedTab.value;
+ activeTabIndex.value = index;
+ resetState();
+ getList();
+ }
+};
+
+
+const resetState = () => {
+ form.value = {
+ consumables: false,
+ };
+ addOrEdit.value = "add";
+ loading.value = true;
+ tableData.value = [];
+ pageNum.value = 1;
+ pageSize.value = 20;
+ total.value = 0;
+ queryParams.value.searchAll = "";
+ refreshing.value = false;
+};
+
+const resetQuery = () => {
+ queryParams.value.searchAll = "";
+ pageNum.value = 1;
+ getList();
+};
+
+const search = () => {
+ pageNum.value = 1;
+ getList();
+};
+
+// 澶勭悊鏂板棰嗙敤
+// const handleAdd = () => {
+// console.log('handleAdd 琚皟鐢�', 'activeTab:', activeTab.value, 'activeTabIndex:', activeTabIndex.value);
+// addOrEdit.value = "add";
+// form.value = {};
+// title.value = `鏂板${currentTabConfig.value?.label || '璁惧棰嗙敤'}`;
+// copyForm.value = {};
+// console.log('鍑嗗鎵撳紑寮圭獥锛宔quipmentRequisitionDialog褰撳墠鍊�:', equipmentRequisitionDialog.value);
+// equipmentRequisitionDialog.value = true;
+// console.log('寮圭獥宸叉墦寮�锛宔quipmentRequisitionDialog鏂板��:', equipmentRequisitionDialog.value);
+// };
+
+// const handleView = async (row) => {
+// // 鍙鐞嗚澶囬鐢ㄩ〉闈㈢殑鏌ョ湅鍔熻兘
+// if (activeTab.value === 'equipmentRequisition') {
+// try {
+// dialogTableTitle.value = `${row.equipmentName || '璁惧'} - 鎿嶄綔璁板綍璇︽儏`;
+//
+// // 鏄剧ず鍔犺浇鐘舵��
+// dialogTableVisible.value = true;
+// dialogTableData.value = [];
+//
+// // 璋冪敤璇︽儏鎺ュ彛鑾峰彇鏁版嵁
+// const { data, code } = await getUsageDetailList(row.id);
+// if (code === 200 && data) {
+// // 澶勭悊鏁扮粍鏁版嵁锛岀洿鎺ユ樉绀烘搷浣滆褰曞垪琛�
+// if (Array.isArray(data)) {
+// dialogTableData.value = data;
+// dialogTableColumns.value = [
+// { prop: 'equipmentNo', label: '璁惧缂栧彿', minWidth: 100 },
+// { prop: 'equipmentName', label: '璁惧鍚嶇О', minWidth: 120 },
+// { prop: 'specification', label: '瑙勬牸鍨嬪彿', minWidth: 100 },
+// {
+// prop: 'operationType',
+// label: '鎿嶄綔绫诲瀷',
+// minWidth: 80,
+// formatter: (row) => row.operationType === 1 ? '棰嗙敤' : '褰掕繕'
+// },
+// { prop: 'quantity', label: '鎿嶄綔鏁伴噺', minWidth: 80 },
+// { prop: 'operator', label: '鎿嶄綔浜�', minWidth: 80 },
+// { prop: 'remark', label: '澶囨敞', minWidth: 150, showOverflowTooltip: true },
+// { prop: 'createTime', label: '鎿嶄綔鏃堕棿', minWidth: 150 }
+// ];
+// } else {
+// showToast('鏆傛棤鎿嶄綔璁板綍', 'warning');
+// }
+// } else {
+// showToast('鑾峰彇璇︽儏鏁版嵁澶辫触', 'error');
+// dialogTableVisible.value = false;
+// }
+//
+// } catch (error) {
+// console.error('鑾峰彇璇︽儏澶辫触:', error);
+// showToast('鑾峰彇璇︽儏鏁版嵁澶辫触', 'error');
+// dialogTableVisible.value = false;
+// }
+// }
+// };
+
+// 涓嬫媺鍒锋柊
+const onRefresh = async () => {
+ refreshing.value = true;
+ pageNum.value = 1;
+ await getList();
+ refreshing.value = false;
+};
+
+// 鑾峰彇璁惧鏈�澶у彲棰嗙敤鏁伴噺
+// const getMaxQuantity = () => {
+// if (form.value.equipmentId) {
+// const equipment = tableData.value.find(
+// (item) => item.equipmentId === form.value.equipmentId
+// );
+// return equipment ? equipment.quantity : null;
+// }
+// return null;
+// };
+
+// 璁惧棰嗙敤寮圭獥鎻愪氦澶勭悊
+// const onEquipmentRequisitionSubmit = (formData) => {
+// if (formData.equipmentStatus === EQUIPMENT_STATUS.RETURNED) {
+// showToast("璁惧宸插畬鍏ㄥ綊杩�", 'success');
+// } else if (formData.equipmentStatus === EQUIPMENT_STATUS.PARTIAL_RETURN) {
+// } else if (formData.equipmentStatus === EQUIPMENT_STATUS.USING) {
+// showToast("璁惧棰嗙敤鎴愬姛", 'success');
+// } else {
+// showToast("鎿嶄綔鎴愬姛", 'success');
+// }
+// equipmentRequisitionDialog.value = false;
+// nextTick(() => {
+// form.value = {};
+// getList();
+// });
+// };
+
+// 鏁版嵁鑾峰彇
+const getList = async () => {
+ try {
+ if (!refreshing.value) {
+ loading.value = true;
+ }
+ const apiParams = {
+ current: pageNum.value,
+ pageSize: pageSize.value,
+ searchAll: queryParams.value.searchAll,
+ };
+
+ const response = await currentTabConfig.value.api(apiParams);
+ console.log('API鍝嶅簲:', response);
+
+ // request宸ュ叿杩斿洖鐨勬槸 { code, data, msg } 缁撴瀯
+ const { data, code } = response;
+
+ if (code !== 200) {
+ showToast("鑾峰彇鏁版嵁澶辫触锛�" + (response?.msg || "鏈煡閿欒"), 'error');
+ return;
+ }
+
+ // data 鏄� { records: [...], total: 3, ... } 缁撴瀯
+ const records = data?.records || data?.rows || [];
+ console.log('瑙f瀽鍚庣殑鏁版嵁:', records);
+
+ // 鏁版嵁瀛楁鏄犲皠锛氬皢 isConsumables 鏄犲皠涓� consumables
+ const mappedRecords = records.map(item => ({
+ ...item,
+ consumables: item.isConsumables !== undefined ? item.isConsumables : item.consumables
+ }));
+
+ // 濡傛灉鏄笅鎷夊埛鏂帮紝閲嶇疆鏁版嵁锛涘惁鍒欒拷鍔犳暟鎹紙鐢ㄤ簬涓婃媺鍔犺浇鏇村锛屼絾褰撳墠涓嶅疄鐜帮級
+ if (pageNum.value === 1) {
+ tableData.value = mappedRecords;
+ } else {
+ tableData.value = [...tableData.value, ...mappedRecords];
+ }
+ total.value = data?.total || 0;
+ console.log('鏈�缁堣〃鏍兼暟鎹�:', tableData.value);
+ } catch (error) {
+ console.error('鑾峰彇鏁版嵁澶辫触:', error);
+ showToast("鑾峰彇鏁版嵁澶辫触锛岃绋嶅悗鍐嶈瘯", 'error');
+ } finally {
+ loading.value = false;
+ }
+};
+
+// 缁勪欢鎸傝浇
+onMounted(() => {
+ activeTab.value = "management";
+ activeTabIndex.value = 0;
+ // 涓嶉噸缃悳绱㈡潯浠讹紝鐩存帴鍔犺浇鏁版嵁
+ loading.value = true;
+ getList();
+});
+// 杩斿洖涓婁竴椤�
+const goBack = () => {
+ uni.navigateBack();
+};
+</script>
+
+<style scoped lang="scss">
+@import '@/styles/sales-common.scss';
+
+.equipment-management {
+ min-height: 100vh;
+ background: #f8f9fa;
+ position: relative;
+}
+
+.tabs-section {
+ background: #ffffff;
+ padding: 0 20px;
+}
+
+.list-container {
+ flex: 1;
+ height: calc(100vh - 200px);
+}
+
+.loading-container {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding: 40px;
+ color: #999;
+}
+
+.no-data {
+ padding: 40px 0;
+ text-align: center;
+ color: #999;
+ font-size: 14px;
+}
+</style>
--
Gitblit v1.9.3