From fb8967e6400792c1eec5f6fb03d09c8b94307e1e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 12 十一月 2025 11:31:29 +0800
Subject: [PATCH] 新疆海川开心-生产派工页面逻辑修改
---
src/pages/index.vue | 56 +-
src/pages/productionManagement/productionDispatching/index.vue | 849 ++++++++++++++++++++++++++++++++++++++++++++++++----
src/api/productionManagement/productionOrder.js | 26 +
src/config.js | 4
4 files changed, 827 insertions(+), 108 deletions(-)
diff --git a/src/api/productionManagement/productionOrder.js b/src/api/productionManagement/productionOrder.js
index ab3dc06..9c1e7de 100644
--- a/src/api/productionManagement/productionOrder.js
+++ b/src/api/productionManagement/productionOrder.js
@@ -16,4 +16,30 @@
method: "post",
data: query,
});
+}
+// 鑾峰彇鐐掓満姝e湪宸ヤ綔閲忔暟鎹�
+export function schedulingList(query) {
+ return request({
+ url: "/salesLedger/scheduling/list",
+ method: "get",
+ params: query,
+ });
+}
+
+// 淇濆瓨鐐掓満璁剧疆
+export function addSpeculatTrading(data) {
+ return request({
+ url: "/salesLedger/scheduling/addSpeculatTrading",
+ method: "post",
+ data: data,
+ });
+}
+
+// 淇敼鐐掓満璁剧疆
+export function updateSpeculatTrading(data) {
+ return request({
+ url: "/salesLedger/scheduling/updateSpeculatTrading",
+ method: "post",
+ data: data,
+ });
}
\ No newline at end of file
diff --git a/src/config.js b/src/config.js
index 17274c7..ee29e3c 100644
--- a/src/config.js
+++ b/src/config.js
@@ -3,8 +3,8 @@
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
// baseUrl: 'http://localhost/prod-api',
// baseUrl: 'http://114.132.189.42:9066', // 瀹佸娑︽嘲
- baseUrl: 'http://114.132.189.42:9068', // 鏂扮枂娴峰窛寮�蹇�
- // baseUrl: 'http://192.168.1.147:9036',
+ // baseUrl: 'http://114.132.189.42:9068', // 鏂扮枂娴峰窛寮�蹇�
+ baseUrl: 'http://192.168.1.147:8080', // 鏈湴娴嬭瘯
//cloud鍚庡彴缃戝叧鍦板潃
// baseUrl: 'http://192.168.10.3:8080',
// 搴旂敤淇℃伅
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 95c217f..7a0673c 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -123,34 +123,34 @@
</view>
<!-- 鐢熶骇绠℃帶妯″潡 -->
-<!-- <view class="common-module production-module">-->
-<!-- <view class="module-header">-->
-<!-- <view class="module-title-container">-->
-<!-- <text class="module-title">鐢熶骇绠℃帶</text>-->
-<!-- </view>-->
-<!-- </view>-->
-<!-- <view class="module-content">-->
-<!-- <up-grid-->
-<!-- :border="false"-->
-<!-- col="4"-->
-<!-- >-->
-<!-- <up-grid-item-->
-<!-- v-for="(item, index) in productionItems"-->
-<!-- :key="index"-->
-<!-- @click="handleCommonItemClick(item)"-->
-<!-- >-->
-<!-- <view class="icon-container" :style="{ background: item.bgColor }">-->
-<!-- <up-icon-->
-<!-- :name="item.icon"-->
-<!-- :size="58"-->
-<!-- color="#ffffff"-->
-<!-- ></up-icon>-->
-<!-- </view>-->
-<!-- <text class="item-label">{{item.label}}</text>-->
-<!-- </up-grid-item>-->
-<!-- </up-grid>-->
-<!-- </view>-->
-<!-- </view>-->
+ <view class="common-module production-module">
+ <view class="module-header">
+ <view class="module-title-container">
+ <text class="module-title">鐢熶骇绠℃帶</text>
+ </view>
+ </view>
+ <view class="module-content">
+ <up-grid
+ :border="false"
+ col="4"
+ >
+ <up-grid-item
+ v-for="(item, index) in productionItems"
+ :key="index"
+ @click="handleCommonItemClick(item)"
+ >
+ <view class="icon-container" :style="{ background: item.bgColor }">
+ <up-icon
+ :name="item.icon"
+ :size="58"
+ color="#ffffff"
+ ></up-icon>
+ </view>
+ <text class="item-label">{{item.label}}</text>
+ </up-grid-item>
+ </up-grid>
+ </view>
+ </view>
<!-- 璁惧绠$悊妯″潡 -->
<view class="common-module equipment-module">
diff --git a/src/pages/productionManagement/productionDispatching/index.vue b/src/pages/productionManagement/productionDispatching/index.vue
index 7aea197..87c3da0 100644
--- a/src/pages/productionManagement/productionDispatching/index.vue
+++ b/src/pages/productionManagement/productionDispatching/index.vue
@@ -3,94 +3,187 @@
<!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
<PageHeader title="鐢熶骇娲惧伐" @back="goBack" />
+ <!-- 鐐掓満鐘舵�佸睍绀� -->
+ <view class="machines-section">
+ <view class="section-title">鐐掓満鐘舵��</view>
+ <view class="machines-grid">
+ <view v-for="machine in machines" :key="machine.id" class="machine-card">
+ <view class="machine-title">鐐掓満{{ machine.id }}</view>
+ <view class="machine-metrics">
+ <view class="metric-item">
+ <text class="metric-label">鎬婚噺(kg)</text>
+ <up-input
+ v-model="machineTotal[machine.key]"
+ type="number"
+ placeholder="璇疯緭鍏ユ�婚噺"
+ border="surround"
+ size="mini"
+ class="metric-input"
+ @change="updateMachineVacant(machine.key)"
+ />
+ </view>
+ <view class="metric-item">
+ <text class="metric-label">姝e湪鐢熶骇(kg)</text>
+ <text class="metric-value">{{ machineInProduction[machine.key] }}</text>
+ </view>
+ <view class="metric-item">
+ <text class="metric-label">绌轰綑閲�(kg)</text>
+ <text class="metric-value">{{ machineVacant[machine.key] }}</text>
+ </view>
+ </view>
+ </view>
+ </view>
+ <view class="save-section">
+ <up-button type="primary" @click="saveMachineTotals" size="normal" class="save-btn">淇濆瓨鐐掓満璁剧疆</up-button>
+ </view>
+ </view>
+
<!-- 鎼滅储鍖哄煙 -->
<view class="search-section">
- <view class="search-bar">
- <view class="search-input">
+ <view class="search-form">
+ <view class="search-item">
+ <text class="search-label">瀹㈡埛鍚嶇О</text>
<up-input
- class="search-text"
- placeholder="璇疯緭鍏ュ鎴峰悕绉版悳绱�"
v-model="searchForm.customerName"
+ placeholder="璇疯緭鍏ュ鎴峰悕绉�"
@change="handleQuery"
clearable
+ border="surround"
+ class="search-input"
/>
</view>
- <view class="filter-button" @click="handleQuery">
- <up-icon name="search" size="24" color="#999"></up-icon>
+ <view class="search-item">
+ <text class="search-label">椤圭洰鍚嶇О</text>
+ <up-input
+ v-model="searchForm.projectName"
+ placeholder="璇疯緭鍏ラ」鐩悕绉�"
+ @change="handleQuery"
+ clearable
+ border="surround"
+ class="search-input"
+ />
+ </view>
+ <view class="search-buttons">
+ <up-button type="primary" @click="handleQuery" size="small" class="search-btn">鎼滅储</up-button>
+ <up-button @click="handleReset" size="small" class="reset-btn">閲嶇疆</up-button>
</view>
</view>
</view>
+ <!-- 鎵归噺鎿嶄綔鍖哄煙 -->
+ <view v-if="showBatchActions" class="batch-actions-section">
+ <view class="batch-info">
+ <text class="batch-count">宸查�夋嫨 {{ selectedItems.length }} 涓」鐩�</text>
+ </view>
+ <view class="batch-buttons">
+ <up-button type="primary" size="small" @click="handleAutoDispatch" class="batch-btn">
+ <up-icon name="play-circle" size="16" color="#ffffff"></up-icon>
+ 鑷姩娲惧崟
+ </up-button>
+ <up-button type="default" size="small" @click="clearSelection" class="batch-btn">
+ <up-icon name="close-circle" size="16" color="#6c757d"></up-icon>
+ 鍙栨秷閫夋嫨
+ </up-button>
+ </view>
+ </view>
+
+ <!-- 鍏ㄩ�夋搷浣滃尯鍩� -->
+ <view v-if="tableData.length > 0" class="select-all-section">
+ <view class="select-all-checkbox" @click="toggleAllSelection">
+ <up-icon
+ :name="isAllSelected ? 'checkbox-mark' : 'circle'"
+ :color="isAllSelected ? '#409eff' : '#c0c4cc'"
+ size="18"
+ ></up-icon>
+ <text class="select-all-text">{{ isAllSelected ? '鍙栨秷鍏ㄩ��' : '鍏ㄩ��' }}</text>
+ </view>
+ <text class="select-all-hint">锛堜粎閫夋嫨寰呮帓鏁伴噺澶т簬0鐨勯」鐩級</text>
+ </view>
+
<!-- 鐢熶骇娲惧伐鍒楄〃 -->
<view class="ledger-list" v-if="tableData.length > 0">
- <view v-for="(item, index) in tableData" :key="item.id || index">
+ <view v-for="(item, index) in tableData" :key="item.id || index" class="list-item">
<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 class="item-checkbox" @click="toggleItemSelection(item)">
+ <up-icon
+ :name="selectedItems.includes(item.id) ? 'checkbox-mark' : 'circle'"
+ :color="selectedItems.includes(item.id) ? '#409eff' : '#c0c4cc'"
+ size="18"
+ ></up-icon>
+ </view>
+
+ <view class="item-content">
+ <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.salesContractNo }}</text>
</view>
- <text class="item-id">{{ item.salesContractNo }}</text>
+ <text class="entry-date">{{ item.entryDate }}</text>
</view>
- </view>
- <up-divider></up-divider>
- <view class="item-details">
- <view class="detail-row">
- <text class="detail-label">褰曞叆鏃ユ湡</text>
- <text class="detail-value">{{ item.entryDate }}</text>
+ <view class="item-details">
+ <view class="detail-row">
+ <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
+ <text class="detail-value">{{ item.customerContractNo }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瀹㈡埛鍚嶇О</text>
+ <text class="detail-value">{{ item.customerName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">椤圭洰鍚嶇О</text>
+ <text class="detail-value">{{ item.projectName }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">浜у搧澶х被</text>
+ <text class="detail-value">{{ item.productCategory }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">瑙勬牸鍨嬪彿</text>
+ <text class="detail-value">{{ item.specificationModel }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍗曚綅</text>
+ <text class="detail-value">{{ item.unit }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鎬绘暟閲�</text>
+ <text class="detail-value">{{ item.quantity }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鎺掍骇鏁伴噺</text>
+ <text class="detail-value highlight">{{ item.schedulingNum }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">寰呮帓鏁伴噺</text>
+ <text class="detail-value" :class="{ 'danger': item.pendingQuantity <= 0 }">{{ item.pendingQuantity }}</text>
+ </view>
+
+ <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+ <view class="action-buttons">
+ <up-button
+ type="primary"
+ size="small"
+ @click="handleDispatch(item)"
+ class="action-btn"
+ :disabled="item.pendingQuantity <= 0"
+ >
+ {{ item.pendingQuantity <= 0 ? '鏃犻渶娲惧伐' : '鐢熶骇娲惧伐' }}
+ </up-button>
+ </view>
</view>
- <view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚堝悓鍙�</text>
- <text class="detail-value">{{ item.customerContractNo }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瀹㈡埛鍚嶇О</text>
- <text class="detail-value">{{ item.customerName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">椤圭洰鍚嶇О</text>
- <text class="detail-value">{{ item.projectName }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">浜у搧澶х被</text>
- <text class="detail-value">{{ item.productCategory }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">瑙勬牸鍨嬪彿</text>
- <text class="detail-value">{{ item.specificationModel }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鎬绘暟閲�</text>
- <text class="detail-value">{{ item.quantity }} {{ item.unit }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">鎺掍骇鏁伴噺</text>
- <text class="detail-value highlight">{{ item.schedulingNum }}</text>
- </view>
- <view class="detail-row">
- <text class="detail-label">寰呮帓鏁伴噺</text>
- <text class="detail-value" :class="{ 'danger': item.pendingQuantity <= 0 }">{{ item.pendingQuantity }}</text>
- </view>
- </view>
-
- <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
- <view class="action-buttons">
- <up-button
- type="primary"
- size="small"
- @click="handleDispatch(item)"
- class="action-btn"
- :disabled="item.pendingQuantity <= 0"
- >
- 鐢熶骇娲惧伐
- </up-button>
</view>
</view>
</view>
</view>
+
<view v-else class="no-data">
- <text>鏆傛棤鐢熶骇娲惧伐鏁版嵁</text>
+ <up-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
+ <text class="no-data-text">鏆傛棤鐢熶骇娲惧伐鏁版嵁</text>
+ </up-empty>
</view>
<!-- 娲惧伐寮圭獥 -->
@@ -102,9 +195,10 @@
import { ref, reactive, toRefs, getCurrentInstance } from "vue";
import { onShow } from '@dcloudio/uni-app';
import dayjs from "dayjs";
-import {schedulingListPage} from "@/api/productionManagement/productionOrder.js";
+import {schedulingListPage, schedulingList, addSpeculatTrading, updateSpeculatTrading} from "@/api/productionManagement/productionOrder.js";
import PageHeader from "@/components/PageHeader.vue";
import DispatchModal from "./components/DispatchModal.vue";
+
const { proxy } = getCurrentInstance();
// 鍔犺浇鐘舵��
@@ -113,20 +207,59 @@
// 鍒楄〃鏁版嵁
const tableData = ref([]);
+// 鎵归噺閫夋嫨鐩稿叧鏁版嵁
+const selectedItems = ref([]); // 閫変腑鐨勯」鐩甀D鏁扮粍
+const isAllSelected = ref(false); // 鏄惁鍏ㄩ��
+const showBatchActions = ref(false); // 鏄惁鏄剧ず鎵归噺鎿嶄綔鍖哄煙
// 鎼滅储琛ㄥ崟鏁版嵁
const data = reactive({
searchForm: {
customerName: "",
+ projectName: "",
},
});
const { searchForm } = toRefs(data);
// 鍒嗛〉閰嶇疆
const page = reactive({
- current: -1,
- size: -1,
+ current: 1,
+ size: 100,
+ total: 0,
});
+
+// 鐐掓満鐘舵�佹暟鎹�
+const machineTotal = reactive({
+ m1: 0,
+ m2: 0,
+ m3: 0,
+ m4: 0,
+})
+
+const machineInProduction = reactive({
+ m1: 0,
+ m2: 0,
+ m3: 0,
+ m4: 0,
+})
+
+const machineVacant = reactive({
+ m1: 0,
+ m2: 0,
+ m3: 0,
+ m4: 0,
+})
+
+// 鐐掓満閰嶇疆鏁扮粍
+const machines = [
+ { id: 1, key: 'm1' },
+ { id: 2, key: 'm2' },
+ { id: 3, key: 'm3' },
+ { id: 4, key: 'm4' }
+]
+
+// 鏄惁鏈夋煡璇㈡暟鎹紙鐢ㄤ簬鍒ゆ柇鏄柊澧炶繕鏄慨鏀癸級
+const hasQueryData = ref(false);
// 娲惧伐寮圭獥寮曠敤
const dispatchModalRef = ref();
@@ -148,9 +281,51 @@
uni.navigateBack();
};
+// 閲嶇疆鎼滅储
+const handleReset = () => {
+ searchForm.value.customerName = "";
+ searchForm.value.projectName = "";
+ handleQuery();
+};
+
// 鏌ヨ鍒楄〃
const handleQuery = () => {
+ page.current = 1;
getList();
+};
+
+// 鑾峰彇鐐掓満鐢熶骇鏁版嵁
+const getMachineProductionData = () => {
+ schedulingList().then((res) => {
+ if (res.data && Array.isArray(res.data)) {
+ // 閲嶇疆鏁版嵁
+ machineInProduction.m1 = 0;
+ machineInProduction.m2 = 0;
+ machineInProduction.m3 = 0;
+ machineInProduction.m4 = 0;
+
+ // 澶勭悊鐐掓満鏁版嵁
+ res.data.forEach(item => {
+ const machineId = Number(item.id);
+ if (machineId >= 1 && machineId <= 4) {
+ const machineKey = `m${machineId}`;
+
+ if (item.workLoad !== null && item.workLoad !== undefined) {
+ machineTotal[machineKey] = Number(item.workLoad) || 0;
+ }
+
+ if (item.currentWorkLoad !== null && item.currentWorkLoad !== undefined) {
+ machineInProduction[machineKey] = Number(item.currentWorkLoad) || 0;
+ }
+
+ // 璁$畻绌轰綑閲�
+ machineVacant[machineKey] = machineTotal[machineKey] - machineInProduction[machineKey];
+ }
+ });
+ }
+ }).catch(err => {
+ console.error('鑾峰彇鐐掓満鏁版嵁澶辫触:', err);
+ });
};
// 鑾峰彇鍒楄〃鏁版嵁
@@ -158,18 +333,22 @@
loading.value = true;
showLoadingToast('鍔犺浇涓�...');
- // 鏋勯�犺姹傚弬鏁�
const params = { ...searchForm.value, ...page };
schedulingListPage(params).then((res) => {
loading.value = false;
closeToast();
- // 澶勭悊姣忔潯鏁版嵁锛屽鍔爌endingQuantity瀛楁
tableData.value = (res.data.records || []).map(item => ({
...item,
pendingQuantity: (Number(item.quantity) || 0) - (Number(item.schedulingNum) || 0)
}));
+
+ page.total = res.data.total || 0;
+
+ // 鑾峰彇鐐掓満鏁版嵁
+ getMachineProductionData();
+
}).catch(() => {
loading.value = false;
closeToast();
@@ -198,38 +377,552 @@
getList(); // 鍒锋柊鍒楄〃
};
+// 鏇存柊鐐掓満绌轰綑閲�
+const updateMachineVacant = (machineKey) => {
+ machineVacant[machineKey] = (Number(machineTotal[machineKey]) || 0) - (Number(machineInProduction[machineKey]) || 0);
+};
+
+// 鑾峰彇鐐掓満鏌ヨ鏁版嵁
+const getMachineQueryData = (machineId) => {
+ // 杩欓噷闇�瑕佹牴鎹疄闄呮儏鍐典粠鏌ヨ鏁版嵁涓幏鍙栧搴旂殑鐐掓満鏁版嵁
+ // 鏆傛椂杩斿洖涓�涓ā鎷熸暟鎹�
+ return {
+ id: machineId,
+ name: `鐐掓満${machineId}`,
+ workLoad: machineTotal[`m${machineId}`] || 0,
+ currentWorkLoad: machineInProduction[`m${machineId}`] || 0
+ };
+};
+
+// 淇濆瓨鐐掓満鎬婚噺璁剧疆
+const saveMachineTotals = () => {
+ // 鏋勯�犱繚瀛樻暟鎹暟缁勶紝浣跨敤machines鏁扮粍寰幆鏋勫缓
+ const saveData = machines.map(machine => {
+ const machineData = {
+ name: `鐐掓満${machine.id}`, // 鐐掓満鍚嶇О
+ workLoad: machineTotal[machine.key] || 0, // 鎬婚噺
+ vacant: machineVacant[machine.key] || 0 // 绌轰綑閲�
+ };
+
+ // 濡傛灉鏄慨鏀规搷浣滐紝闇�瑕佷紶閫抜d瀛楁
+ if (hasQueryData.value) {
+ // 杩欓噷闇�瑕佷粠鏌ヨ鏁版嵁涓幏鍙栧搴旂殑id
+ // 鍋囪鏌ヨ鏁版嵁涓瘡涓倰鏈烘暟鎹兘鏈塱d瀛楁
+ const queryData = getMachineQueryData(machine.id);
+ if (queryData && queryData.id) {
+ machineData.id = queryData.id;
+ }
+ }
+
+ return machineData;
+ });
+
+ console.log('淇濆瓨鐐掓満璁剧疆鏁版嵁:', saveData);
+
+ // 鏍规嵁鏄惁鏈夋煡璇㈡暟鎹喅瀹氳皟鐢ㄦ柊澧炴帴鍙h繕鏄慨鏀规帴鍙�
+ const saveApi = hasQueryData.value ? updateSpeculatTrading : addSpeculatTrading;
+ const successMessage = hasQueryData.value ? '鐐掓満璁剧疆淇敼鎴愬姛' : '鐐掓満璁剧疆鏂板鎴愬姛';
+
+ console.log(`璋冪敤鎺ュ彛: ${hasQueryData.value ? '淇敼' : '鏂板'}`);
+
+ // 璋冪敤鍚庣API淇濆瓨
+ saveApi(saveData).then(res => {
+ proxy.$message.success(successMessage);
+ console.log('淇濆瓨鎴愬姛:', res);
+
+ // 淇濆瓨鎴愬姛鍚庯紝璁剧疆hasQueryData涓簍rue锛屼笅娆′繚瀛樺皢璋冪敤淇敼鎺ュ彛
+ if (!hasQueryData.value) {
+ hasQueryData.value = true;
+ }
+ }).catch(err => {
+ proxy.$message.error('淇濆瓨澶辫触');
+ console.error('淇濆瓨澶辫触:', err);
+ });
+};
+
+// 鎵归噺閫夋嫨鐩稿叧鍑芥暟
+
+// 鍒囨崲鍗曚釜椤圭洰鐨勯�夋嫨鐘舵��
+const toggleItemSelection = (item) => {
+ const itemId = item.id;
+ const index = selectedItems.value.indexOf(itemId);
+
+ if (index > -1) {
+ // 濡傛灉宸查�変腑锛屽垯鍙栨秷閫夋嫨
+ selectedItems.value.splice(index, 1);
+ } else {
+ // 濡傛灉鏈�変腑锛屽垯娣诲姞閫夋嫨
+ selectedItems.value.push(itemId);
+ }
+
+ // 鏇存柊鍏ㄩ�夌姸鎬�
+ updateAllSelectedStatus();
+ // 鏇存柊鎵归噺鎿嶄綔鍖哄煙鏄剧ず鐘舵��
+ updateBatchActionsVisibility();
+};
+
+// 鍒囨崲鍏ㄩ�夌姸鎬�
+const toggleAllSelection = () => {
+ if (isAllSelected.value) {
+ // 鍙栨秷鍏ㄩ��
+ selectedItems.value = [];
+ } else {
+ // 鍏ㄩ��
+ selectedItems.value = tableData.value
+ .filter(item => item.pendingQuantity > 0) // 鍙�夋嫨寰呮帓鏁伴噺澶т簬0鐨勯」鐩�
+ .map(item => item.id);
+ }
+
+ isAllSelected.value = !isAllSelected.value;
+ updateBatchActionsVisibility();
+};
+
+// 鏇存柊鍏ㄩ�夌姸鎬�
+const updateAllSelectedStatus = () => {
+ const selectableItems = tableData.value.filter(item => item.pendingQuantity > 0);
+ if (selectableItems.length === 0) {
+ isAllSelected.value = false;
+ return;
+ }
+
+ isAllSelected.value = selectedItems.value.length === selectableItems.length &&
+ selectableItems.every(item => selectedItems.value.includes(item.id));
+};
+
+// 鏇存柊鎵归噺鎿嶄綔鍖哄煙鏄剧ず鐘舵��
+const updateBatchActionsVisibility = () => {
+ showBatchActions.value = selectedItems.value.length > 0;
+};
+
+// 娓呯┖閫夋嫨
+const clearSelection = () => {
+ selectedItems.value = [];
+ isAllSelected.value = false;
+ showBatchActions.value = false;
+};
+
+// 鑾峰彇閫変腑鐨勯」鐩�
+const getSelectedItems = () => {
+ return tableData.value.filter(item => selectedItems.value.includes(item.id));
+};
+
+// 鑷姩娲惧崟鍔熻兘
+const handleAutoDispatch = () => {
+ const selectedItemsList = getSelectedItems();
+
+ if (selectedItemsList.length === 0) {
+ uni.showToast({
+ title: '璇峰厛閫夋嫨瑕佹淳宸ョ殑椤圭洰',
+ icon: 'none'
+ });
+ return;
+ }
+
+ // 妫�鏌ユ槸鍚︽湁椤圭洰寰呮帓鏁伴噺涓嶈冻
+ const invalidItems = selectedItemsList.filter(item => item.pendingQuantity <= 0);
+ if (invalidItems.length > 0) {
+ uni.showToast({
+ title: `鏈�${invalidItems.length}涓」鐩棤闇�娲惧伐锛屽凡鑷姩杩囨护`,
+ icon: 'none'
+ });
+ }
+
+ // 杩囨护鎺夊緟鎺掓暟閲忎笉瓒崇殑椤圭洰
+ const validItems = selectedItemsList.filter(item => item.pendingQuantity > 0);
+
+ if (validItems.length === 0) {
+ uni.showToast({
+ title: '娌℃湁鍙淳宸ョ殑椤圭洰',
+ icon: 'none'
+ });
+ return;
+ }
+
+ uni.showModal({
+ title: '纭鑷姩娲惧崟',
+ content: `纭畾瑕佸閫変腑鐨�${validItems.length}涓」鐩繘琛岃嚜鍔ㄦ淳鍗曞悧锛焋,
+ success: (res) => {
+ if (res.confirm) {
+ executeAutoDispatch(validItems);
+ }
+ }
+ });
+};
+
+// 鎵ц鑷姩娲惧崟
+const executeAutoDispatch = (items) => {
+ showLoadingToast('鑷姩娲惧崟涓�...');
+
+ // 妯℃嫙鑷姩娲惧崟杩囩▼
+ setTimeout(() => {
+ closeToast();
+
+ // 杩欓噷搴旇璋冪敤瀹為檯鐨勮嚜鍔ㄦ淳鍗旳PI
+ // 鏆傛椂浣跨敤妯℃嫙鎴愬姛
+ uni.showToast({
+ title: `鎴愬姛涓�${items.length}涓」鐩畬鎴愯嚜鍔ㄦ淳鍗昤,
+ icon: 'success'
+ });
+
+ // 娓呯┖閫夋嫨
+ clearSelection();
+ // 鍒锋柊鍒楄〃
+ getList();
+
+ console.log('鑷姩娲惧崟椤圭洰:', items);
+ }, 1500);
+};
+
// 椤甸潰鏄剧ず鏃跺姞杞芥暟鎹�
onShow(() => {
- // 鍔犺浇鍒楄〃鏁版嵁
getList();
+ // 娓呯┖閫夋嫨鐘舵��
+ clearSelection();
});
</script>
<style scoped lang="scss">
-@import '@/styles/sales-common.scss';
-
-// 鐢熶骇娲惧伐椤甸潰鏍峰紡
.production-dispatching {
min-height: 100vh;
background: #f8f9fa;
- position: relative;
+ padding: 20rpx;
}
-// 鍒楄〃椤规牱寮�
+// 鐐掓満鐘舵�佸尯鍩�
+.machines-section {
+ margin-bottom: 30rpx;
+
+ .section-title {
+ font-size: 32rpx;
+ font-weight: 600;
+ color: #303133;
+ margin-bottom: 20rpx;
+ }
+}
+
+.machines-grid {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 20rpx;
+}
+
+.machine-card {
+ background: #ffffff;
+ border-radius: 16rpx;
+ padding: 24rpx;
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
+ border: 1rpx solid #e9ecef;
+}
+
+.machine-title {
+ font-size: 28rpx;
+ font-weight: 600;
+ color: #2c3e50;
+ text-align: center;
+ margin-bottom: 20rpx;
+ padding-bottom: 16rpx;
+ border-bottom: 2rpx solid #3498db;
+}
+
+.machine-metrics {
+ display: flex;
+ flex-direction: column;
+ gap: 16rpx;
+}
+
+.metric-item {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 8rpx 0;
+}
+
+.metric-label {
+ font-size: 24rpx;
+ color: #6c757d;
+}
+
+.metric-value {
+ font-size: 26rpx;
+ font-weight: 600;
+ color: #2c3e50;
+}
+
+// 杈撳叆妗嗘牱寮�
+.metric-input {
+ width: 120rpx;
+ text-align: right;
+}
+
+// 淇濆瓨鍖哄煙
+.save-section {
+ display: flex;
+ justify-content: center;
+ margin-top: 30rpx;
+ padding-top: 20rpx;
+ border-top: 1rpx solid #e9ecef;
+}
+
+.save-btn {
+ min-width: 200rpx;
+}
+
+// 鎼滅储鍖哄煙
+.search-section {
+ background: #ffffff;
+ border-radius: 16rpx;
+ padding: 24rpx;
+ margin-bottom: 30rpx;
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
+.search-form {
+ display: flex;
+ flex-direction: column;
+ gap: 20rpx;
+}
+
+.search-item {
+ display: flex;
+ align-items: center;
+ gap: 20rpx;
+}
+
+.search-label {
+ font-size: 26rpx;
+ color: #606266;
+ min-width: 140rpx;
+}
+
+.search-input {
+ flex: 1;
+}
+
+.search-buttons {
+ display: flex;
+ gap: 20rpx;
+ justify-content: flex-end;
+ margin-top: 10rpx;
+}
+
+.search-btn, .reset-btn {
+ min-width: 120rpx;
+}
+
+// 鍒楄〃鏍峰紡
+.ledger-list {
+ display: flex;
+ flex-direction: column;
+ gap: 24rpx;
+}
+
+.list-item {
+ background: #ffffff;
+ border-radius: 16rpx;
+ overflow: hidden;
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
+}
+
.ledger-item {
- .detail-value.highlight {
+ padding: 0;
+}
+
+.item-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 24rpx 24rpx 0 24rpx;
+}
+
+.item-left {
+ display: flex;
+ align-items: center;
+ gap: 16rpx;
+}
+
+.document-icon {
+ width: 48rpx;
+ height: 48rpx;
+ background: #409eff;
+ border-radius: 8rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.item-id {
+ font-size: 28rpx;
+ font-weight: 600;
+ color: #303133;
+}
+
+.entry-date {
+ font-size: 24rpx;
+ color: #909399;
+}
+
+.item-details {
+ padding: 24rpx;
+}
+
+.detail-row {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 12rpx 0;
+ border-bottom: 1rpx solid #f5f5f5;
+
+ &:last-child {
+ border-bottom: none;
+ }
+}
+
+.detail-label {
+ font-size: 26rpx;
+ color: #606266;
+}
+
+.detail-value {
+ font-size: 26rpx;
+ color: #303133;
+ font-weight: 500;
+
+ &.highlight {
color: #ff6b35;
font-weight: 600;
}
- .detail-value.danger {
+ &.danger {
color: #ee0a24;
font-weight: 600;
}
+}
+
+.action-buttons {
+ padding: 0 24rpx 24rpx 24rpx;
+ display: flex;
+ justify-content: flex-end;
+}
+
+.action-btn {
+ min-width: 180rpx;
+}
+
+// 绌虹姸鎬�
+.no-data {
+ padding: 100rpx 0;
+ text-align: center;
+}
+
+.no-data-text {
+ font-size: 28rpx;
+ color: #909399;
+ margin-top: 20rpx;
+}
+
+// 鎵归噺鎿嶄綔鍖哄煙鏍峰紡
+.batch-actions-section {
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+ border-radius: 16rpx;
+ padding: 24rpx;
+ margin-bottom: 24rpx;
+ box-shadow: 0 8rpx 24rpx rgba(102, 126, 234, 0.3);
+ color: #ffffff;
+}
+
+.batch-info {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+}
+
+.batch-count {
+ font-size: 28rpx;
+ font-weight: 600;
+}
+
+.batch-buttons {
+ display: flex;
+ gap: 20rpx;
+ justify-content: flex-end;
+}
+
+.batch-btn {
+ min-width: 180rpx;
+}
+
+// 鍏ㄩ�夋搷浣滃尯鍩熸牱寮�
+.select-all-section {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ background: #f8f9fa;
+ border-radius: 12rpx;
+ padding: 20rpx 24rpx;
+ margin-bottom: 20rpx;
+ border: 1rpx solid #e9ecef;
+}
+
+.select-all-checkbox {
+ display: flex;
+ align-items: center;
+ gap: 12rpx;
+ cursor: pointer;
+}
+
+.select-all-text {
+ font-size: 26rpx;
+ color: #606266;
+ font-weight: 500;
+}
+
+.select-all-hint {
+ font-size: 22rpx;
+ color: #909399;
+}
+
+// 鍒楄〃椤归�夋嫨鏍峰紡
+.ledger-item {
+ display: flex;
+ align-items: flex-start;
+ padding: 0;
+}
+
+.item-checkbox {
+ padding: 24rpx 16rpx 0 24rpx;
+ cursor: pointer;
+ display: flex;
+ align-items: center;
+ min-height: 48rpx;
+}
+
+.item-content {
+ flex: 1;
+ padding: 0;
+}
+
+// 鐐瑰嚮缂栬緫鍖哄煙鏍峰紡
+.metric-value-container {
+ cursor: pointer;
+ min-width: 120rpx;
+ text-align: right;
+ padding: 4rpx 8rpx;
+ border-radius: 4rpx;
+ transition: all 0.2s ease;
+}
+
+.metric-value-container:hover {
+ background-color: #f0f8ff;
+ border: 1rpx solid #409eff;
}
// 閫傞厤 uView 缁勪欢鏍峰紡
:deep(.up-input) {
background: transparent;
}
-</style>
+
+:deep(.up-input__content) {
+ background: #f8f9fa;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3