From 03a05815d7ea5612206b6cfe5d6537b4d4cedc0a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 15 九月 2026 11:41:32 +0800
Subject: [PATCH] 天津潜宇塑胶app 1.添加采购需求、库存盘点、计件单价配置、产量统计、材料消耗核算、成本核算分析页面
---
src/pages/qualityManagement/processInspection/index.vue | 316 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 299 insertions(+), 17 deletions(-)
diff --git a/src/pages/qualityManagement/processInspection/index.vue b/src/pages/qualityManagement/processInspection/index.vue
index 40358ef..8a58c07 100644
--- a/src/pages/qualityManagement/processInspection/index.vue
+++ b/src/pages/qualityManagement/processInspection/index.vue
@@ -26,6 +26,17 @@
color="#999"></up-icon>
</view>
</view>
+ <!-- 妫�楠岀姸鎬佺瓫閫� -->
+ <view class="filter-row">
+ <view class="filter-item"
+ @click="showStateSheet = true">
+ <text class="filter-label">妫�楠岀姸鎬�</text>
+ <text class="filter-value">{{ stateFilterLabel }}</text>
+ <up-icon name="arrow-down"
+ size="14"
+ color="#999"></up-icon>
+ </view>
+ </view>
<!-- 鏃ユ湡閫夋嫨 -->
<!-- <view class="date-range"
v-if="searchForm.entryDate">
@@ -85,7 +96,7 @@
<u-tag :type="getStateTagType(item.inspectState)"
size="mini"
class="status-tag">
- {{ item.inspectState ? '宸叉彁浜�' : '鏈彁浜�' }}
+ {{ item.inspectState ? '宸叉彁浜�' : '寰呮彁浜�' }}
</u-tag>
</view>
</view>
@@ -114,6 +125,18 @@
<view class="detail-row">
<text class="detail-label">妫�娴嬪崟浣�</text>
<text class="detail-value">{{ item.checkCompany || '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">鍚堟牸鏁伴噺</text>
+ <text class="detail-value">{{ item.qualifiedQuantity != null ? item.qualifiedQuantity : '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">涓嶅悎鏍兼暟閲�</text>
+ <text class="detail-value">{{ item.unqualifiedQuantity != null ? item.unqualifiedQuantity : '-' }}</text>
+ </view>
+ <view class="detail-row">
+ <text class="detail-label">妫�楠岀粨璁�</text>
+ <text class="detail-value">{{ item.checkResult || '-' }}</text>
</view>
</view>
<!-- 鎿嶄綔鎸夐挳 -->
@@ -152,6 +175,15 @@
:disabled="item.inspectState || item.checkName !== ''"
@click.stop="assignInspector(item)">
鍒嗛厤妫�楠屽憳
+ </u-button>
+ </view>
+ <view class="action-buttons">
+ <u-button type="error"
+ size="small"
+ class="action-btn"
+ :disabled="!(Number(item.unqualifiedQuantity) > 0)"
+ @click.stop="openUnqualified(item)">
+ 涓嶅悎鏍煎鐞�
</u-button>
</view>
</view>
@@ -223,6 +255,56 @@
:actions="userSheetOptions"
@select="selectInspector"
title="閫夋嫨妫�楠屽憳" />
+ <!-- 妫�楠岀姸鎬佺瓫閫� -->
+ <up-action-sheet :show="showStateSheet"
+ :actions="stateSheetOptions"
+ @select="selectState"
+ @close="showStateSheet = false"
+ title="閫夋嫨妫�楠岀姸鎬�" />
+ <!-- 涓嶅悎鏍煎鐞嗗脊绐� -->
+ <up-popup v-model:show="showUnqualifiedPopup"
+ mode="bottom"
+ round>
+ <view class="unqualified-dialog">
+ <view class="dialog-header">
+ <text class="dialog-title">涓嶅悎鏍煎鐞�</text>
+ <up-icon name="close"
+ size="20"
+ color="#999"
+ @click="showUnqualifiedPopup = false"></up-icon>
+ </view>
+ <view class="dialog-content">
+ <view v-if="unqualifiedLoading"
+ class="unqualified-empty">鍔犺浇涓�...</view>
+ <view v-else-if="unqualifiedList.length === 0"
+ class="unqualified-empty">鏆傛棤寰呭鐞嗕笉鍚堟牸璁板綍</view>
+ <view v-for="(row, idx) in unqualifiedList"
+ :key="idx"
+ class="unqualified-item">
+ <view class="unqualified-info">
+ <text class="unqualified-label">涓嶅悎鏍肩幇璞�</text>
+ <text class="unqualified-value">{{ row.defectivePhenomena || '-' }}</text>
+ </view>
+ <view class="unqualified-info">
+ <text class="unqualified-label">鏁伴噺</text>
+ <text class="unqualified-value">{{ row.quantity != null ? row.quantity : '-' }}</text>
+ </view>
+ <u-button type="primary"
+ size="small"
+ class="unqualified-btn"
+ @click="openDealSheet(row)">
+ 澶勭悊
+ </u-button>
+ </view>
+ </view>
+ </view>
+ </up-popup>
+ <!-- 澶勭悊缁撴灉閫夋嫨 -->
+ <up-action-sheet :show="showDealSheet"
+ :actions="dealSheetOptions"
+ @select="selectDeal"
+ @close="showDealSheet = false"
+ title="閫夋嫨澶勭悊缁撴灉" />
</view>
</template>
@@ -235,8 +317,13 @@
submitQualityInspect,
qualityInspectUpdate,
qualityInspectListPage,
+ qualityUnqualifiedListPage,
+ qualityUnqualifiedDeal,
} from "@/api/qualityManagement/materialInspection.js";
import { userListNoPage } from "@/api/system/user.js";
+
+ // 杩囩▼妫�楠� inspectType=1
+ const currentInspectType = 1;
// 鏄剧ず鎻愮ず淇℃伅
const showToast = message => {
@@ -294,6 +381,121 @@
value: item.nickName,
}));
});
+
+ // 妫�楠岀姸鎬佺瓫閫�
+ const showStateSheet = ref(false);
+ const stateFilter = ref("");
+ const stateSheetOptions = [
+ { name: "鍏ㄩ儴", value: "" },
+ { name: "寰呮彁浜�", value: 0 },
+ { name: "宸叉彁浜�", value: 1 },
+ ];
+ const stateFilterLabel = computed(() => {
+ const hit = stateSheetOptions.find(o => o.value === stateFilter.value);
+ return hit ? hit.name : "鍏ㄩ儴";
+ });
+ const selectState = e => {
+ stateFilter.value = e.value;
+ showStateSheet.value = false;
+ getList();
+ };
+
+ // 涓嶅悎鏍煎鐞嗙浉鍏�
+ const showUnqualifiedPopup = ref(false);
+ const unqualifiedLoading = ref(false);
+ const unqualifiedList = ref([]);
+ const currentInspectRow = ref(null);
+ const showDealSheet = ref(false);
+ const currentUnqualifiedRow = ref(null);
+ // 杩囩▼/鎴愬搧绫绘敮鎸� 杩斾慨/杩斿伐/鎶ュ簾/璁╂鏀捐
+ const dealSheetOptions = computed(() => {
+ return ["杩斾慨", "杩斿伐", "鎶ュ簾", "璁╂鏀捐"].map(name => ({
+ name,
+ value: name,
+ }));
+ });
+
+ // 鎵撳紑涓嶅悎鏍煎鐞嗗脊绐楋細鎸夋楠屽崟id鎷夊彇寰呭鐞嗕笉鍚堟牸璁板綍
+ const openUnqualified = async item => {
+ currentInspectRow.value = item;
+ showUnqualifiedPopup.value = true;
+ unqualifiedLoading.value = true;
+ unqualifiedList.value = [];
+ try {
+ const res = await qualityUnqualifiedListPage({
+ inspectType: currentInspectType,
+ inspectState: 0,
+ inspectId: item.id,
+ current: -1,
+ size: -1,
+ });
+ let records = res.data?.records || res.data || [];
+ // 鑻ュ悗绔湭鎸夋楠屽崟杩囨护锛屽墠绔厹搴曟寜妫�楠屽崟id杩囨护
+ const hasInspectRef = records.some(
+ r => r.inspectId != null || r.qualityInspectId != null
+ );
+ if (hasInspectRef) {
+ records = records.filter(
+ r => (r.inspectId ?? r.qualityInspectId) == item.id
+ );
+ }
+ // 鍙繚鐣欏緟澶勭悊璁板綍
+ unqualifiedList.value = records.filter(
+ r => Number(r.inspectState) !== 1
+ );
+ } catch (error) {
+ // request.ts 宸茬粺涓� toast 鍚庣 msg锛岃繖閲屽彧璁板綍
+ console.error("鑾峰彇涓嶅悎鏍艰褰曞け璐�:", error);
+ unqualifiedList.value = [];
+ } finally {
+ unqualifiedLoading.value = false;
+ }
+ };
+
+ // 鎵撳紑澶勭悊缁撴灉閫夋嫨
+ const openDealSheet = row => {
+ currentUnqualifiedRow.value = row;
+ showDealSheet.value = true;
+ };
+
+ // 閫夋嫨澶勭悊缁撴灉
+ const selectDeal = e => {
+ showDealSheet.value = false;
+ if (!currentUnqualifiedRow.value) return;
+ const result = e.value;
+ // 杩斾慨/杩斿伐浼氳嚜鍔ㄥ垱寤鸿繑宸ョ敓浜ц鍗曪紝鍏堜簩娆$‘璁�
+ if (result === "杩斾慨" || result === "杩斿伐") {
+ uni.showModal({
+ title: "鎻愮ず",
+ content: "灏嗚嚜鍔ㄥ垱寤鸿繑宸ョ敓浜ц鍗曪紙FG鍗曞彿锛夛紝鏄惁缁х画锛�",
+ success: res => {
+ if (res.confirm) {
+ doDeal(currentUnqualifiedRow.value, result);
+ }
+ },
+ });
+ return;
+ }
+ doDeal(currentUnqualifiedRow.value, result);
+ };
+
+ // 鎻愪氦涓嶅悎鏍煎鐞�
+ const doDeal = async (row, dealResult) => {
+ try {
+ await qualityUnqualifiedDeal({ id: row.id, dealResult });
+ showToast("澶勭悊鎴愬姛");
+ if (currentInspectRow.value) {
+ await openUnqualified(currentInspectRow.value);
+ }
+ if (unqualifiedList.value.length === 0) {
+ showUnqualifiedPopup.value = false;
+ }
+ getList();
+ } catch (error) {
+ // request.ts 宸茬粺涓� toast 鍚庣 msg锛岃繖閲屽彧璁板綍
+ console.error("涓嶅悎鏍煎鐞嗗け璐�:", error);
+ }
+ };
// 杩斿洖涓婁竴椤�
const goBack = () => {
@@ -371,7 +573,9 @@
tableLoading.value = true;
const params = { ...searchForm.value, ...page.value };
params.entryDate = undefined;
- qualityInspectListPage({ ...params, inspectType: 1 })
+ params.inspectState =
+ stateFilter.value === "" ? undefined : stateFilter.value;
+ qualityInspectListPage({ ...params, inspectType: currentInspectType })
.then(res => {
tableLoading.value = false;
inspectionList.value = res.data.records || [];
@@ -429,25 +633,31 @@
};
// 鎻愪氦妫�楠�
- const submitInspection = async item => {
+ const submitInspection = item => {
if (!item) {
showToast("鍙傛暟閿欒");
return;
}
- try {
- const res = await submitQualityInspect({ id: item.id });
- if (res.code === 200) {
- showToast("鎻愪氦鎴愬姛");
- setTimeout(() => {
- getList();
- }, 1000);
- } else {
- showToast("鎻愪氦澶辫触锛�" + (res.msg || "鏈煡閿欒"));
- }
- } catch (error) {
- console.error("鎻愪氦澶辫触:", error);
- showToast("鎻愪氦澶辫触锛岃閲嶈瘯");
- }
+ uni.showModal({
+ title: "鎻愮ず",
+ content: "鎻愪氦鍚庡皢鐢熸垚涓嶅悎鏍煎鐞嗗崟涓斾笉鍙慨鏀癸紝鏄惁缁х画锛�",
+ success: async res => {
+ if (!res.confirm) return;
+ try {
+ await submitQualityInspect({ id: item.id });
+ // 杩囩▼妫�鎻愪氦涓嶄骇鐢熷叆搴撹褰�
+ showToast(
+ "鎻愪氦鎴愬姛锛屼笉鍚堟牸閮ㄥ垎宸茬敓鎴愬鐞嗗崟锛堣繃绋嬫楠屼笉浜х敓鍏ュ簱璁板綍锛�"
+ );
+ setTimeout(() => {
+ getList();
+ }, 1500);
+ } catch (error) {
+ // request.ts 宸茬粺涓� toast 鍚庣 msg锛岃繖閲屽彧璁板綍
+ console.error("鎻愪氦澶辫触:", error);
+ }
+ },
+ });
};
// 鍒嗛厤妫�楠屽憳
@@ -550,6 +760,78 @@
padding: 5px;
}
+ // 妫�楠岀姸鎬佺瓫閫�
+ .filter-row {
+ display: flex;
+ align-items: center;
+ margin-top: 10px;
+ }
+
+ .filter-item {
+ display: flex;
+ align-items: center;
+ padding: 4px 10px;
+ background: #f2f3f5;
+ border-radius: 12px;
+ }
+
+ .filter-label {
+ font-size: 12px;
+ color: #666;
+ margin-right: 4px;
+ }
+
+ .filter-value {
+ font-size: 12px;
+ color: #2979ff;
+ margin-right: 4px;
+ }
+
+ // 涓嶅悎鏍煎鐞嗗脊绐�
+ .unqualified-dialog {
+ background: #ffffff;
+ border-radius: 16px 16px 0 0;
+ padding: 20px;
+ max-height: 70vh;
+ overflow-y: auto;
+ }
+
+ .unqualified-empty {
+ padding: 30px 0;
+ text-align: center;
+ font-size: 13px;
+ color: #999;
+ }
+
+ .unqualified-item {
+ display: flex;
+ align-items: center;
+ padding: 12px 0;
+ border-bottom: 1px solid #f0f0f0;
+ }
+
+ .unqualified-info {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ margin-right: 10px;
+ }
+
+ .unqualified-label {
+ font-size: 12px;
+ color: #999;
+ }
+
+ .unqualified-value {
+ font-size: 13px;
+ color: #333;
+ margin-top: 2px;
+ }
+
+ .unqualified-btn {
+ width: 70px;
+ }
+
// 缁熻鍗$墖
.stats-cards {
display: flex;
--
Gitblit v1.9.3