From 5384750e59bbb27c54e090100429c48eaba46df0 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 20 十一月 2025 10:15:20 +0800
Subject: [PATCH] fix: 完成拉丝自检、原材料自检优化
---
.env.development | 2
src/pages/production/wire/report/wire.vue | 49 +
src/pages.json | 2
src/api/product/wire.ts | 6
src/api/product/manage.ts | 36 +
src/pages/production/wire/selfInspect/index.vue | 677 +++++++++++++++++++++++--
src/pages/production/wire/report/rawMaterial.vue | 222 ++++++-
src/api/product/attachment.ts | 22
src/pages/production/wire/report/reportManage.vue | 59 ++
src/pages/production/wire/selfInspect/form.vue | 381 ++++++++++++--
src/pages/production/wire/attachment/index.vue | 92 ---
11 files changed, 1,256 insertions(+), 292 deletions(-)
diff --git a/.env.development b/.env.development
index ebd9627..f4aacbb 100644
--- a/.env.development
+++ b/.env.development
@@ -14,6 +14,6 @@
# API 鏈嶅姟鍣ㄧ殑 URL
#VITE_APP_API_URL = 'http://114.132.189.42:7002/mes'
-VITE_APP_API_URL = 'http://114.132.10.119:7002/mes'
+VITE_APP_API_URL = 'http://192.168.10.119:7002/mes'
# VITE_APP_API_URL = 'http://192.168.100.131:7002/mes' #
diff --git a/src/api/product/attachment.ts b/src/api/product/attachment.ts
index 56ce2c1..f745ec9 100644
--- a/src/api/product/attachment.ts
+++ b/src/api/product/attachment.ts
@@ -13,6 +13,7 @@
// 涓婁紶鍗曚釜闄勪欢鏂囦欢
uploadSingleFile(filePath: string) {
return new Promise<BaseResult<any>>((resolve, reject) => {
+ console.log("寮�濮嬩笂浼犳枃浠�:", filePath);
uni.uploadFile({
url: `${baseApi}/app/addAttachmentFiles`,
filePath: filePath,
@@ -21,35 +22,44 @@
Authorization: getToken() ? `Bearer ${getToken()}` : "",
},
success: (uploadRes) => {
+ console.log("涓婁紶鍝嶅簲:", uploadRes);
try {
const result = JSON.parse(uploadRes.data) as BaseResult<any>;
+ console.log("瑙f瀽鍚庣殑缁撴灉:", result);
// 涓氬姟鐘舵�佺爜 00000 琛ㄧず鎴愬姛
if (result.code === ResultCodeEnum.SUCCESS) {
resolve(result);
} else {
// 鍏朵粬涓氬姟澶勭悊澶辫触
+ const errorMsg = result.msg || "鏂囦欢涓婁紶澶辫触";
+ console.error("涓婁紶澶辫触:", errorMsg, result);
uni.showToast({
- title: result.msg || "鏂囦欢涓婁紶澶辫触",
+ title: errorMsg,
icon: "none",
});
reject({
- message: result.msg || "涓氬姟澶勭悊澶辫触",
+ message: errorMsg,
code: result.code,
});
}
} catch (e) {
- reject(e);
+ console.error("瑙f瀽涓婁紶鍝嶅簲澶辫触:", e, uploadRes.data);
+ reject({
+ message: "瑙f瀽涓婁紶鍝嶅簲澶辫触",
+ error: e,
+ });
}
},
fail: (error) => {
- console.log("upload fail error", error);
+ console.error("涓婁紶璇锋眰澶辫触:", error);
+ const errorMsg = error.errMsg || "鏂囦欢涓婁紶璇锋眰澶辫触";
uni.showToast({
- title: "鏂囦欢涓婁紶璇锋眰澶辫触",
+ title: errorMsg,
icon: "none",
duration: 2000,
});
reject({
- message: "鏂囦欢涓婁紶璇锋眰澶辫触",
+ message: errorMsg,
error,
});
},
diff --git a/src/api/product/manage.ts b/src/api/product/manage.ts
index 34dd68a..e0a6c5b 100644
--- a/src/api/product/manage.ts
+++ b/src/api/product/manage.ts
@@ -29,11 +29,37 @@
},
// 鏌ヨ鑷淇℃伅
- getSelfInspection(params: any) {
- return request<BaseResult<any>>({
- url: "/app/getSelfInspection",
- method: "GET",
- data: params,
+ getSelfInspection(data: any) {
+ return request<BaseResult<any[]>>({
+ url: "/wireInspection/getDrawInspectInfoListByGetDrawInspect",
+ method: "POST",
+ data: data,
+ });
+ },
+
+ // 鏂板鑷
+ addSelfInspection(data: any) {
+ return request<BaseResult<any[]>>({
+ url: "/wireInspection/saveDrawInspectionRecord",
+ method: "POST",
+ data: data,
+ });
+ },
+
+ // 鍒犻櫎鑷
+ deleteSelfInspection(ids: string | number) {
+ return request<BaseResult<any[]>>({
+ url: `/wireInspection/deleteDrawWireInspectionRecord/${ids}`,
+ method: "POST",
+ });
+ },
+
+ // 鑾峰彇鑷鏍峰紡鏁版嵁
+ getDrawInspectStyleByGetDrawInspect(data: any) {
+ return request<BaseResult<any[]>>({
+ url: "/wireInspection/getDrawInspectStyleByGetDrawInspect",
+ method: "POST",
+ data: data,
});
},
diff --git a/src/api/product/wire.ts b/src/api/product/wire.ts
index d8e0fd7..dc28255 100644
--- a/src/api/product/wire.ts
+++ b/src/api/product/wire.ts
@@ -32,7 +32,7 @@
// 鏂板鏉嗗寘
addRodBagTree(data: any) {
return request<BaseResult<any>>({
- url: "/app/addRodBagTree",
+ url: "/wireOutput/addRodBagTree",
method: "POST",
data: data,
});
@@ -41,8 +41,8 @@
// 鍒犻櫎鏉嗗寘
deleteRodBagTree(data: any) {
return request<BaseResult<any>>({
- url: "/app/deleteRodBagTree",
- method: "DELETE",
+ url: "/wireOutput/deleteRodBagTree",
+ method: "POST",
data: data,
});
},
diff --git a/src/pages.json b/src/pages.json
index 7634307..578abcb 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -196,7 +196,7 @@
{
"path": "pages/production/wire/selfInspect/index",
"style": {
- "navigationBarTitleText": "鎷変笣鑷"
+ "navigationBarTitleText": "鑷绠$悊"
}
},
{
diff --git a/src/pages/production/wire/attachment/index.vue b/src/pages/production/wire/attachment/index.vue
index d6394e8..f601172 100644
--- a/src/pages/production/wire/attachment/index.vue
+++ b/src/pages/production/wire/attachment/index.vue
@@ -36,23 +36,6 @@
</view>
</template>
- <!-- 瑙嗛棰勮 -->
- <template v-else-if="isVideoType(item.url)">
- <video
- v-if="!item.loadError"
- :src="getFullUrl(item.url)"
- class="media-preview"
- :controls="false"
- :show-center-play-btn="false"
- @error="onVideoError(item)"
- />
- <!-- 瑙嗛鍔犺浇澶辫触鏄剧ず榛樿鍥炬爣 -->
- <view v-else class="file-icon-wrapper">
- <wd-icon name="video" size="48px" color="#ccc" />
- <text class="file-name error-text">鍔犺浇澶辫触</text>
- </view>
- </template>
-
<!-- 鍏朵粬鏂囦欢绫诲瀷鏄剧ず鍥炬爣 -->
<view v-else class="file-icon-wrapper">
<wd-icon name="file-outline" size="48px" color="#999" />
@@ -91,7 +74,7 @@
const detailData = ref<any>({});
-// 鑾峰彇瀹屾暣鐨勫浘鐗�/瑙嗛 URL
+// 鑾峰彇瀹屾暣鐨勫浘鐗� URL
const getFullUrl = (url: string) => {
if (!url) return "";
// 濡傛灉宸茬粡鏄畬鏁寸殑 URL锛坔ttp 鎴� https 寮�澶达級锛岀洿鎺ヨ繑鍥�
@@ -118,12 +101,6 @@
return ["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(extension);
};
-// 鍒ゆ柇鏄惁涓鸿棰戠被鍨�
-const isVideoType = (urlOrFileName: string) => {
- const extension = getExtension(urlOrFileName);
- return ["mp4", "mov", "avi", "wmv", "flv", "mkv", "webm"].includes(extension);
-};
-
// 鍥剧墖鍔犺浇鎴愬姛
const onImageLoad = (item: any) => {
item.loadError = false;
@@ -132,12 +109,6 @@
// 鍥剧墖鍔犺浇澶辫触
const onImageError = (item: any) => {
console.error("鍥剧墖鍔犺浇澶辫触:", item.url);
- item.loadError = true;
-};
-
-// 瑙嗛鍔犺浇澶辫触
-const onVideoError = (item: any) => {
- console.error("瑙嗛鍔犺浇澶辫触:", item.url);
item.loadError = true;
};
@@ -178,20 +149,14 @@
const addAttachment = () => {
// 鏄剧ず閫夋嫨鏂囦欢绫诲瀷鐨勫脊绐�
uni.showActionSheet({
- itemList: ["閫夋嫨鍥剧墖", "閫夋嫨瑙嗛", "鎷嶇収", "褰曞儚"],
+ itemList: ["閫夋嫨鍥剧墖", "鎷嶇収"],
success: (res) => {
switch (res.tapIndex) {
case 0: // 閫夋嫨鍥剧墖
chooseImages();
break;
- case 1: // 閫夋嫨瑙嗛
- chooseVideos();
- break;
- case 2: // 鎷嶇収
+ case 1: // 鎷嶇収
takePhoto();
- break;
- case 3: // 褰曞儚
- recordVideo();
break;
}
},
@@ -219,22 +184,6 @@
});
};
-// 閫夋嫨瑙嗛
-const chooseVideos = () => {
- uni.chooseVideo({
- sourceType: ["album"],
- maxDuration: 60,
- camera: "back",
- success: async (res) => {
- await handleFileUpload([res.tempFilePath]);
- },
- fail: (error) => {
- console.error("閫夋嫨瑙嗛澶辫触:", error);
- toast.show("閫夋嫨瑙嗛澶辫触");
- },
- });
-};
-
// 鎷嶇収
const takePhoto = () => {
uni.chooseImage({
@@ -248,22 +197,6 @@
fail: (error) => {
console.error("鎷嶇収澶辫触:", error);
toast.show("鎷嶇収澶辫触");
- },
- });
-};
-
-// 褰曞儚
-const recordVideo = () => {
- uni.chooseVideo({
- sourceType: ["camera"],
- maxDuration: 60,
- camera: "back",
- success: async (res) => {
- await handleFileUpload([res.tempFilePath]);
- },
- fail: (error) => {
- console.error("褰曞儚澶辫触:", error);
- toast.show("褰曞儚澶辫触");
},
});
};
@@ -382,14 +315,6 @@
case "bmp":
case "webp":
return "image";
- case "mp4":
- case "mov":
- case "avi":
- case "wmv":
- case "flv":
- case "mkv":
- case "webm":
- return "video";
case "pdf":
return "pdf";
case "doc":
@@ -516,14 +441,3 @@
}
}
</style>
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/pages/production/wire/report/rawMaterial.vue b/src/pages/production/wire/report/rawMaterial.vue
index e75d424..96f67e6 100644
--- a/src/pages/production/wire/report/rawMaterial.vue
+++ b/src/pages/production/wire/report/rawMaterial.vue
@@ -30,6 +30,7 @@
v-model="materialData.conductivity"
range-key="label"
placeholder="璇疯緭鍏�"
+ type="number"
></wd-input>
</wd-form-item>
<wd-form-item label="鎶楁媺寮哄害(Mpa)" prop="tensileStrength" required>
@@ -37,6 +38,7 @@
v-model="materialData.tensileStrength"
range-key="label"
placeholder="璇疯緭鍏�"
+ type="number"
></wd-input>
</wd-form-item>
<wd-form-item label="鐢甸樆鐜�(n惟路m)" prop="resistivity" required>
@@ -44,6 +46,7 @@
v-model="materialData.resistivity"
range-key="label"
placeholder="璇疯緭鍏�"
+ type="number"
></wd-input>
</wd-form-item>
<wd-form-item label="浼搁暱鐜�(%)" prop="elongationRate" required>
@@ -51,15 +54,25 @@
v-model="materialData.elongationRate"
range-key="label"
placeholder="璇疯緭鍏�"
+ type="number"
></wd-input>
</wd-form-item>
<wd-form-item label="澶栬璐ㄩ噺" prop="appearanceQuality" required>
- <wd-select-picker
- v-model="materialData.appearanceQuality"
- range-key="label"
- :columns="drawing_appearanceQuality"
- placeholder="璇烽�夋嫨"
- ></wd-select-picker>
+ <view class="checkbox-group">
+ <wd-checkbox
+ v-for="option in drawing_appearanceQuality"
+ :key="option.value"
+ :modelValue="
+ Array.isArray(materialData.appearanceQuality)
+ ? materialData.appearanceQuality.includes(String(option.value))
+ : false
+ "
+ shape="square"
+ @change="(val) => handleAppearanceQualityCheckbox(String(option.value), val)"
+ >
+ {{ option.label }}
+ </wd-checkbox>
+ </view>
</wd-form-item>
</wd-form>
</view>
@@ -73,7 +86,7 @@
</template>
<script setup lang="ts">
-import { ref, onMounted } from "vue";
+import { ref, onMounted, watch, nextTick } from "vue";
import { useToast } from "wot-design-uni";
import ManageApi from "@/api/product/manage";
@@ -131,9 +144,104 @@
const activeTab = ref("reel"); // 涓巘ab鐨刵ame淇濇寔涓�鑷�
const toast = useToast();
+// 瀛樺偍鍓嶄竴涓瑙傝川閲忓�硷紝鐢ㄤ簬姣旇緝鍙樺寲
+const previousAppearanceQuality = ref<string[]>([]);
+
+// 澶勭悊澶栬璐ㄩ噺涓嬫媺妗嗙殑浜掓枼閫夋嫨閫昏緫
+const handleAppearanceQualityChange = (
+ selectedValues: string[],
+ allOptions: Array<{ label: string; value: string | number }>
+): string[] => {
+ // 濡傛灉娌℃湁閫夐」鏁版嵁锛岀洿鎺ヨ繑鍥�
+ if (!allOptions || allOptions.length === 0) {
+ return selectedValues;
+ }
+
+ // 鑾峰彇涔嬪墠鐨勫��
+ const previousValues = previousAppearanceQuality.value || [];
+
+ // 鏌ユ壘"鏃犲瑙傞棶棰�"閫夐」鐨勫��
+ const noIssueOption = allOptions.find(
+ (item) => item.label === "鏃犲瑙傞棶棰�" || item.value === "鏃犲瑙傞棶棰�"
+ );
+
+ if (!noIssueOption) {
+ // 濡傛灉瀛楀吀涓病鏈�"鏃犲瑙傞棶棰�"閫夐」锛岀洿鎺ヨ繑鍥�
+ return selectedValues;
+ }
+
+ const noIssueValue = String(noIssueOption.value);
+
+ // 妫�鏌ュ綋鍓嶉�変腑鍊间腑鏄惁鍖呭惈"鏃犲瑙傞棶棰�"
+ const hasNoIssue = selectedValues.includes(noIssueValue);
+
+ // 妫�鏌ヤ箣鍓嶆槸鍚﹀寘鍚�"鏃犲瑙傞棶棰�"
+ const hadNoIssue = previousValues.includes(noIssueValue);
+
+ // 鍒ゆ柇鏄惁鏂伴�夋嫨浜�"鏃犲瑙傞棶棰�"锛堜箣鍓嶆病鏈夛紝鐜板湪鏈夛級
+ const isNewlySelectedNoIssue = !hadNoIssue && hasNoIssue;
+
+ // 鍒ゆ柇鏄惁绉婚櫎浜�"鏃犲瑙傞棶棰�"锛堜箣鍓嶆湁锛岀幇鍦ㄦ病鏈夛級
+ const isRemovedNoIssue = hadNoIssue && !hasNoIssue;
+
+ // 鍒ゆ柇鏄惁鍦�"鏃犲瑙傞棶棰�"宸查�変腑鐨勬儏鍐典笅閫夋嫨浜嗗叾浠栭�夐」
+ const isSelectingOtherWithNoIssue =
+ hadNoIssue && hasNoIssue && selectedValues.length > previousValues.length;
+
+ let result: string[];
+
+ if (isNewlySelectedNoIssue) {
+ // 濡傛灉鏂伴�夋嫨浜�"鏃犲瑙傞棶棰�"锛屽垯鍙繚鐣�"鏃犲瑙傞棶棰�"
+ result = [noIssueValue];
+ } else if (isSelectingOtherWithNoIssue) {
+ // 濡傛灉"鏃犲瑙傞棶棰�"宸茬粡琚�変腑锛屼笖鏂伴�夋嫨浜嗗叾浠栭�夐」锛屽垯绉婚櫎"鏃犲瑙傞棶棰�"
+ result = selectedValues.filter((val) => val !== noIssueValue);
+ } else if (isRemovedNoIssue) {
+ // 濡傛灉绉婚櫎浜�"鏃犲瑙傞棶棰�"锛岀洿鎺ヨ繑鍥烇紙宸茬粡鏄叾浠栭�夐」浜嗭級
+ result = selectedValues;
+ } else {
+ result = selectedValues;
+ }
+
+ // 淇濆瓨褰撳墠鍊间綔涓轰笅涓�娆$殑鍓嶄竴涓��
+ previousAppearanceQuality.value = result;
+ return result;
+};
+
+// 澶勭悊澶嶉�夋鐨刢hange浜嬩欢
+const handleAppearanceQualityCheckbox = (optionValue: string, checked: boolean) => {
+ const currentValues = Array.isArray(materialData.value.appearanceQuality)
+ ? materialData.value.appearanceQuality
+ : [];
+
+ let newValues: string[];
+ if (checked) {
+ // 閫変腑
+ newValues = [...currentValues, optionValue];
+ } else {
+ // 鍙栨秷閫変腑
+ newValues = currentValues.filter((v) => v !== optionValue);
+ }
+
+ // 搴旂敤浜掓枼閫昏緫
+ const result = handleAppearanceQualityChange(
+ newValues,
+ drawing_appearanceQuality.value as Array<{ label: string; value: string | number }>
+ );
+
+ // 鏇存柊鍊�
+ materialData.value.appearanceQuality = result;
+};
+
// 鏈湴鍝嶅簲寮忔暟鎹紝鐢ㄤ簬瀛樺偍鐢ㄦ埛杈撳叆
const materialData = ref<Record<string, any>>({});
const initializeData = () => {
+ // 鏌ユ壘"鏃犲瑙傞棶棰�"鐨勫��
+ const noIssueOption = drawing_appearanceQuality.value.find(
+ (item) => item.label === "鏃犲瑙傞棶棰�" || item.value === "鏃犲瑙傞棶棰�"
+ );
+ const defaultAppearanceQuality = noIssueOption ? [String(noIssueOption.value)] : [];
+
// 鍒濆鍖栧師鏉愭枡鏁版嵁
materialData.value = {
model: "",
@@ -142,8 +250,11 @@
tensileStrength: "",
resistivity: "",
elongationRate: "",
- appearanceQuality: "",
+ appearanceQuality: defaultAppearanceQuality,
};
+
+ // 鍒濆鍖栧墠涓�涓��
+ previousAppearanceQuality.value = defaultAppearanceQuality;
};
// 鍒濆鍖栨暟鎹�
@@ -152,7 +263,32 @@
// 鍦ㄧ粍浠舵寕杞芥椂寮傛鍔犺浇鏁版嵁瀛楀吀
onMounted(async () => {
await loadDictData();
+ // 瀛楀吀鏁版嵁鍔犺浇瀹屾垚鍚庯紝閲嶆柊鍒濆鍖栨暟鎹紝纭繚榛樿鍊艰兘姝g‘鍖归厤
+ initializeData();
});
+
+// 鐩戝惉澶栬璐ㄩ噺鍙樺寲锛屽簲鐢ㄤ簰鏂ラ�昏緫
+watch(
+ () => materialData.value.appearanceQuality,
+ (newValue, oldValue) => {
+ const normalizedNewValue = Array.isArray(newValue) ? newValue : [];
+ const normalizedOldValue = Array.isArray(oldValue) ? oldValue : [];
+
+ // 搴旂敤浜掓枼閫昏緫
+ const result = handleAppearanceQualityChange(
+ normalizedNewValue,
+ drawing_appearanceQuality.value as Array<{ label: string; value: string | number }>
+ );
+
+ // 濡傛灉鍊艰淇敼浜嗭紝寮傛鏇存柊锛岄伩鍏嶅湪鐩戝惉涓悓姝ヤ慨鏀�
+ if (JSON.stringify(result) !== JSON.stringify(normalizedNewValue)) {
+ nextTick(() => {
+ materialData.value.appearanceQuality = result;
+ });
+ }
+ },
+ { deep: true }
+);
// 鐩戝惉props鍙樺寲锛屾洿鏂版湰鍦版暟鎹�
@@ -166,6 +302,30 @@
};
const handleSubmit = async () => {
+ // 琛ㄥ崟楠岃瘉
+ if (
+ !materialData.value.model ||
+ materialData.value.model === "" ||
+ !materialData.value.spec ||
+ materialData.value.spec === "" ||
+ !materialData.value.conductivity ||
+ materialData.value.conductivity === "" ||
+ !materialData.value.tensileStrength ||
+ materialData.value.tensileStrength === "" ||
+ !materialData.value.resistivity ||
+ materialData.value.resistivity === "" ||
+ !materialData.value.elongationRate ||
+ materialData.value.elongationRate === "" ||
+ !materialData.value.appearanceQuality ||
+ (Array.isArray(materialData.value.appearanceQuality) &&
+ materialData.value.appearanceQuality.length === 0) ||
+ (!Array.isArray(materialData.value.appearanceQuality) &&
+ materialData.value.appearanceQuality === "")
+ ) {
+ toast.error("璇峰~鍐欏畬鏁寸殑蹇呭~椤�");
+ return false;
+ }
+
try {
// 璋冪敤API鎻愪氦鏁版嵁
await ManageApi.addWireRawMaterialInspect({
@@ -273,47 +433,13 @@
width: 100%;
}
-// 缇庡寲閫夋嫨鍣ㄦ牱寮� - 澧炲姞鏉冮噸纭繚鏍峰紡鐢熸晥
-:deep(.wd-select-picker) {
- & .wd-select-picker__option {
- text-align: center !important;
- padding: 12px 0 !important;
- font-size: 16px !important;
- }
-
- & .wd-select-picker__confirm {
- border-radius: 8px !important;
- background-color: #409eff !important;
- color: white !important;
- font-weight: 500 !important;
- }
-
- & .wd-select-picker__header {
- padding: 10px 0 !important;
- border-bottom: 1px solid #e6e6e6 !important;
- }
-
- & .wd-select-picker__title {
- font-size: 16px !important;
- font-weight: 500 !important;
- }
+.checkbox-group {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px;
}
-// 纭繚閫夋嫨鍣ㄥ唴閮ㄩ�夐」灞呬腑 - 鏇撮�氱敤鐨勯�夋嫨鍣�
-:deep(.wd-select-picker__content) {
- .wd-select-picker__option {
- text-align: center !important;
- padding: 12px 0 !important;
- font-size: 16px !important;
- }
-}
-
-// 鐩存帴閽堝閫夐」鍏冪礌鐨勯�夋嫨鍣�
-:deep([class*="select-picker"].wd-popup) {
- .wd-select-picker__option {
- text-align: center !important;
- padding: 12px 0 !important;
- font-size: 16px !important;
- }
+:deep(.wd-checkbox) {
+ margin-right: 0;
}
</style>
diff --git a/src/pages/production/wire/report/reportManage.vue b/src/pages/production/wire/report/reportManage.vue
index 9a39001..c7e13b1 100644
--- a/src/pages/production/wire/report/reportManage.vue
+++ b/src/pages/production/wire/report/reportManage.vue
@@ -1,7 +1,7 @@
<template>
<view class="report-manage-page">
- <view class="pt-2">
- <wd-card class="card_bg">
+ <view class="pt-2 fixed-header-card">
+ <wd-card class="card_bg header-card">
<template #title>
<view class="flex justify-between w-full">
<text class="font-medium text-[#252525]">鎶ュ伐绠$悊</text>
@@ -195,7 +195,9 @@
</wd-row>
<template #footer>
<view class="flex gap-2">
- <wd-button plain size="small" @click="toAttachment(child)">闄勪欢</wd-button>
+ <wd-button plain size="small" @click="toAttachment(child)" style="margin-right: 10px">
+ 闄勪欢
+ </wd-button>
<wd-button plain type="error" size="small" @click="handleDeleteSingle(child)">
鍒犻櫎
</wd-button>
@@ -242,7 +244,7 @@
</wd-cell-group>
</view>
<view class="dialog-footer">
- <wd-button plain @click="closeAddDialog">鍙栨秷</wd-button>
+ <wd-button plain @click="closeAddDialog" style="margin-right: 10px">鍙栨秷</wd-button>
<wd-button type="primary" class="ml-2" @click="handleSaveNewChild">淇濆瓨</wd-button>
</view>
</view>
@@ -578,12 +580,27 @@
.report-manage-page {
min-height: 100vh;
background: #f3f9f8;
- padding-bottom: 20px;
+ padding: 0 4px 20px 4px;
}
.card_bg {
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.05);
padding-bottom: 10px;
+}
+
+.fixed-header-card {
+ position: sticky;
+ top: 0;
+ z-index: 100;
+ background: #f3f9f8;
+ padding: 8px 0;
+}
+
+.header-card {
+ border: none;
+ margin: 0;
+ border-radius: 0;
+ box-shadow: none;
}
.icon_box {
@@ -649,7 +666,37 @@
}
.page-content {
- padding: 12px;
+ padding: 12px 4px;
margin-top: 12px;
}
+
+// 寮规 z-index 闇�瑕侀珮浜庡浐瀹氬ご閮ㄥ崱鐗�
+:deep(.yl-popup) {
+ z-index: 400 !important;
+}
+
+// 寮规閬僵灞� z-index 涔熼渶瑕侀珮浜庡浐瀹氬ご閮ㄥ崱鐗囷紙浣跨敤鏇撮珮鐨勫�肩‘淇濆湪鍥哄畾澶撮儴涔嬩笂锛�
+:deep(.wd-popup__mask),
+:deep(.wd-popup-mask),
+:deep([class*="popup"][class*="mask"]),
+:deep(.wd-overlay),
+:deep([class*="overlay"]) {
+ z-index: 300 !important;
+}
+.wd-card {
+ margin-left: 5px;
+ margin-right: 5px;
+ margin-top: 0px;
+}
+</style>
+
+<style lang="scss">
+// 鍏ㄥ眬鏍峰紡锛氱‘淇濆脊妗嗛伄缃╁眰 z-index 楂樹簬鍥哄畾澶撮儴鍗$墖
+.wd-popup__mask,
+.wd-popup-mask,
+[class*="popup"][class*="mask"],
+.wd-overlay,
+[class*="overlay"] {
+ z-index: 300 !important;
+}
</style>
diff --git a/src/pages/production/wire/report/wire.vue b/src/pages/production/wire/report/wire.vue
index e391316..fd3935b 100644
--- a/src/pages/production/wire/report/wire.vue
+++ b/src/pages/production/wire/report/wire.vue
@@ -116,10 +116,17 @@
</view>
<template #footer>
- <view class="flex justify-start">
- <wd-button plain size="small" type="primary" @click="openChildDialog(item)">
+ <view class="flex justify-start gap-2">
+ <wd-button
+ plain
+ size="small"
+ type="primary"
+ @click="openChildDialog(item)"
+ style="margin-right: 10px"
+ >
鎶ュ伐绠$悊
</wd-button>
+ <wd-button plain size="small" @click="() => toSelfInspect(item)">鑷</wd-button>
</view>
</template>
</wd-card>
@@ -151,13 +158,14 @@
label="鏉嗗寘鍙�"
label-width="100px"
placeholder="璇疯緭鍏ユ潌鍖呭彿"
+ type="number"
/>
<wd-input
v-model="newParentData.poleWeight"
label="鏉嗛噸(kg)"
label-width="100px"
- type="number"
placeholder="璇疯緭鍏ユ潌閲�"
+ type="number"
/>
<wd-picker
v-model="newParentData.supplier"
@@ -169,7 +177,7 @@
</wd-cell-group>
</view>
<view class="dialog-footer">
- <wd-button plain @click="closeParentDialog">鍙栨秷</wd-button>
+ <wd-button plain @click="closeParentDialog" style="margin-right: 10px">鍙栨秷</wd-button>
<wd-button type="primary" class="ml-2" @click="handleSaveNewParent">淇濆瓨</wd-button>
</view>
</view>
@@ -490,6 +498,13 @@
drawFormRef.visible = false;
};
+// 璺宠浆鍒拌嚜妫�椤甸潰
+const toSelfInspect = (row: any) => {
+ uni.navigateTo({
+ url: `/pages/production/wire/selfInspect/index?wireId=${paramsId.value}&poleModel=${row.poleModel || ""}&poleNumber=${row.poleNumber || ""}`,
+ });
+};
+
onLoad(async (options: any) => {
paramsId.value = options.id;
await getDetailData(options.id);
@@ -501,7 +516,7 @@
<style lang="scss" scoped>
.list {
min-height: calc(100vh - 30px);
- padding: 12px;
+ padding: 12px 4px;
background: #f3f9f8;
:deep() {
@@ -543,6 +558,30 @@
border-radius: 12px 12px 0 0;
}
+.dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px;
+ border-bottom: 1px solid #e6e6e6;
+ position: sticky;
+ top: 0;
+ background: #fff;
+ z-index: 10;
+}
+
+.dialog-title {
+ font-size: 16px;
+ color: #333;
+ font-weight: 500;
+}
+
+.close-icon {
+ font-size: 20px;
+ color: #999;
+ padding: 4px;
+}
+
.dialog-content {
flex: 1;
overflow-y: auto;
diff --git a/src/pages/production/wire/selfInspect/form.vue b/src/pages/production/wire/selfInspect/form.vue
index 6402db7..cafa99a 100644
--- a/src/pages/production/wire/selfInspect/form.vue
+++ b/src/pages/production/wire/selfInspect/form.vue
@@ -1,66 +1,333 @@
<template>
- <wd-form ref="form" :model="model" class="relative form_box">
- <wd-cell-group :border="true">
- <wd-input
- v-model="model.selfInspectName"
- label="鑷鍚嶇О"
- label-width="100px"
- prop="selfInspectName"
- clearable
- placeholder="璇疯緭鍏ヨ嚜妫�鍚嶇О"
- />
- <wd-input
- v-model="model.unit"
- label="鍗曚綅"
- label-width="100px"
- prop="unit"
- clearable
- placeholder="璇疯緭鍏ュ崟浣�"
- />
- <wd-input
- v-model="model.standard"
- label="鏍囧噯鍊�"
- label-width="100px"
- prop="standard"
- clearable
- placeholder="璇疯緭鍏ユ爣鍑嗗��"
- />
- <wd-input
- v-model="model.selfInspectValue"
- label="鑷鍊�"
- label-width="100px"
- prop="selfInspectValue"
- clearable
- placeholder="璇疯緭鍏ヨ嚜妫�鍊�"
- />
- <wd-input
- v-model="model.selfInspectResult"
- label="鑷缁撴灉"
- label-width="100px"
- prop="selfInspectResult"
- clearable
- placeholder="璇疯緭鍏ヨ嚜妫�缁撴灉"
- />
- </wd-cell-group>
- </wd-form>
+ <view class="form-container">
+ <view class="dialog-header">
+ <text class="dialog-title">{{ isEdit ? "缂栬緫鑷" : "鏂板鑷" }}</text>
+ <wd-icon name="close" class="close-icon" @click="handleClose"></wd-icon>
+ </view>
+ <view class="dialog-content">
+ <wd-form ref="formRef" :model="formData">
+ <!-- 鍩烘湰淇℃伅 -->
+ <view class="section-title">鍩烘湰淇℃伅</view>
+ <wd-cell-group border>
+ <wd-input
+ v-model="formData.fixedInfo.firstNo"
+ label="棣栨鍗曞彿"
+ label-width="120px"
+ placeholder="璇疯緭鍏ラ妫�鍗曞彿"
+ />
+ <wd-input
+ v-model="formData.fixedInfo.lastSlot"
+ label="瀹氬緞妯″叿"
+ label-width="120px"
+ placeholder="璇疯緭鍏ュ畾寰勬ā鍏�"
+ />
+ </wd-cell-group>
+
+ <!-- 鍗曚笣鐩村緞 -->
+ <view class="section-title">鍗曚笣鐩村緞(mm)</view>
+ <wd-cell-group border>
+ <wd-cell title="鏈�澶у��" label-width="120px">
+ <wd-input-number
+ v-model="formData.inspectionResult.maxDia"
+ :min="0"
+ :precision="3"
+ :step="0.01"
+ placeholder="璇疯緭鍏ユ渶澶у��"
+ :max="
+ formData.inspectionResult.minDia !== null &&
+ formData.inspectionResult.minDia !== undefined
+ ? undefined
+ : 999999
+ "
+ />
+ </wd-cell>
+ <wd-cell title="鏈�灏忓��" label-width="120px">
+ <wd-input-number
+ v-model="formData.inspectionResult.minDia"
+ :min="0"
+ :precision="3"
+ :step="0.01"
+ placeholder="璇疯緭鍏ユ渶灏忓��"
+ :max="
+ formData.inspectionResult.maxDia !== null &&
+ formData.inspectionResult.maxDia !== undefined
+ ? formData.inspectionResult.maxDia
+ : 999999
+ "
+ />
+ </wd-cell>
+ </wd-cell-group>
+
+ <!-- 澶栬 -->
+ <view class="section-title">澶栬</view>
+ <wd-cell-group border>
+ <wd-cell title="澶栬璐ㄩ噺" label-width="120px">
+ <view class="checkbox-group">
+ <wd-checkbox
+ v-for="option in appearanceOptions"
+ :key="option.value"
+ :modelValue="
+ Array.isArray(formData.inspectionResult.appearance)
+ ? formData.inspectionResult.appearance.includes(String(option.value))
+ : false
+ "
+ shape="square"
+ @change="(val) => handleAppearanceChange(String(option.value), val)"
+ >
+ {{ option.label }}
+ </wd-checkbox>
+ </view>
+ </wd-cell>
+ </wd-cell-group>
+
+ <!-- 鎴愮洏璐ㄩ噺 -->
+ <view class="section-title">鎴愮洏璐ㄩ噺</view>
+ <wd-cell-group border>
+ <wd-cell title="鍗风粫绱у瘑" label-width="120px">
+ <wd-radio-group v-model="formData.inspectionResult.windingTightness" size="small">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
+ </wd-cell>
+ <wd-cell title="鎺掑垪鏁撮綈" label-width="120px">
+ <wd-radio-group v-model="formData.inspectionResult.arrangementNeatness" size="small">
+ <wd-radio value="鏄�">鏄�</wd-radio>
+ <wd-radio value="鍚�">鍚�</wd-radio>
+ </wd-radio-group>
+ </wd-cell>
+ <wd-cell title="澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�(mm)" label-width="200px">
+ <wd-input-number
+ v-model="formData.inspectionResult.aluminumWireDistance"
+ :min="0"
+ :precision="0"
+ placeholder="璇疯緭鍏ヨ窛绂�"
+ :class="{ 'text-danger': formData.inspectionResult.aluminumWireDistance < 25 }"
+ />
+ </wd-cell>
+ </wd-cell-group>
+
+ <!-- 鍏朵粬淇℃伅 -->
+ <view class="section-title">鍏朵粬淇℃伅</view>
+ <wd-cell-group border>
+ <wd-cell title="鎴愬搧妯″悗鎺ュご鎯呭喌" label-width="120px">
+ <wd-radio-group v-model="formData.inspectionResult.jointCondition" size="small">
+ <wd-radio value="鏈�">鏈�</wd-radio>
+ <wd-radio value="鏃�">鏃�</wd-radio>
+ </wd-radio-group>
+ </wd-cell>
+ <wd-cell title="缁撹" label-width="120px">
+ <wd-radio-group v-model="formData.inspectionResult.conclusion" size="small">
+ <wd-radio value="鍚堟牸">鍚堟牸</wd-radio>
+ <wd-radio value="涓嶅悎鏍�">涓嶅悎鏍�</wd-radio>
+ </wd-radio-group>
+ </wd-cell>
+ </wd-cell-group>
+ </wd-form>
+ </view>
+ <view class="dialog-footer">
+ <wd-button plain @click="handleClose" style="margin-right: 10px">鍙栨秷</wd-button>
+ <wd-button type="primary" class="ml-2" @click="handleSubmit">淇濆瓨</wd-button>
+ </view>
+ </view>
</template>
<script setup lang="ts">
-import useFormData from "@/hooks/useFormData";
-const { form: model } = useFormData({
- selfInspectName: undefined, // 鑷鍚嶇О
- unit: undefined, // 鍗曚綅
- standard: undefined, // 鏍囧噯鍊�
- selfInspectValue: undefined, // 鑷鍊�
- selfInspectResult: undefined, // 鑷鍊�
-});
+import { ref, watch, computed } from "vue";
+import { dayjs } from "wot-design-uni";
+
+const props = defineProps<{
+ visible: boolean;
+ formData: any;
+ appearanceOptions: Array<{ label: string; value: string | number }>;
+ previousAppearanceValue?: string[];
+}>();
+
+const emit = defineEmits<{
+ (e: "update:visible", value: boolean): void;
+ (e: "submit", data: any): void;
+ (e: "close"): void;
+}>();
+
+const formRef = ref();
+const isEdit = computed(() => !!props.formData?.id && !props.formData?.isNew);
+
+// 瀛樺偍鍓嶄竴涓瑙傝川閲忓��
+const previousAppearanceValue = ref<string[]>(props.previousAppearanceValue || []);
+
+// 澶勭悊澶栬璐ㄩ噺浜掓枼閫昏緫
+const handleAppearanceQualityChange = (
+ selectedValues: string[],
+ previousValues: string[],
+ allOptions: Array<{ label: string; value: string | number }>
+): string[] => {
+ if (!allOptions || allOptions.length === 0) {
+ return selectedValues;
+ }
+
+ const noIssueOption = allOptions.find(
+ (item) => item.label === "鏃犲瑙傞棶棰�" || item.value === "鏃犲瑙傞棶棰�"
+ );
+
+ if (!noIssueOption) {
+ return selectedValues;
+ }
+
+ const noIssueValue = String(noIssueOption.value);
+ const hasNoIssue = selectedValues.includes(noIssueValue);
+ const hadNoIssue = previousValues.includes(noIssueValue);
+ const isNewlySelectedNoIssue = !hadNoIssue && hasNoIssue;
+ const isSelectingOtherWithNoIssue =
+ hadNoIssue && hasNoIssue && selectedValues.length > previousValues.length;
+
+ let result: string[];
+ if (isNewlySelectedNoIssue) {
+ result = [noIssueValue];
+ } else if (isSelectingOtherWithNoIssue) {
+ result = selectedValues.filter((val) => val !== noIssueValue);
+ } else {
+ result = selectedValues;
+ }
+
+ return result;
+};
+
+// 澶勭悊澶栬閫夋嫨鍙樺寲
+const handleAppearanceChange = (optionValue: string, checked: boolean) => {
+ const currentValues = Array.isArray(props.formData.inspectionResult.appearance)
+ ? props.formData.inspectionResult.appearance
+ : [];
+
+ let newValues: string[];
+ if (checked) {
+ newValues = [...currentValues, optionValue];
+ } else {
+ newValues = currentValues.filter((v: string) => v !== optionValue);
+ }
+
+ const processedValues = handleAppearanceQualityChange(
+ newValues,
+ previousAppearanceValue.value,
+ props.appearanceOptions
+ );
+
+ props.formData.inspectionResult.appearance = JSON.parse(JSON.stringify(processedValues));
+ previousAppearanceValue.value = JSON.parse(JSON.stringify(processedValues));
+};
+
+const handleClose = () => {
+ emit("update:visible", false);
+ emit("close");
+};
+
+const handleSubmit = () => {
+ // 楠岃瘉鍗曚笣鐩村緞锛氭渶澶у�煎簲璇ュぇ浜庢垨绛変簬鏈�灏忓��
+ const maxDia = props.formData.inspectionResult.maxDia;
+ const minDia = props.formData.inspectionResult.minDia;
+
+ if (maxDia !== null && minDia !== null && maxDia < minDia) {
+ uni.showToast({
+ title: "鍗曚笣鐩村緞鏈�澶у�间笉鑳藉皬浜庢渶灏忓��",
+ icon: "none",
+ });
+ return;
+ }
+
+ // 楠岃瘉澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�
+ const aluminumWireDistance = props.formData.inspectionResult.aluminumWireDistance;
+ if (aluminumWireDistance < 25) {
+ uni.showToast({
+ title: "澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂讳笉鑳戒綆浜�25mm",
+ icon: "none",
+ });
+ return;
+ }
+
+ emit("submit", props.formData);
+};
+
+// 鐩戝惉 visible 鍙樺寲锛屽垵濮嬪寲 previousAppearanceValue
+watch(
+ () => props.visible,
+ (newVal) => {
+ if (newVal && props.formData?.inspectionResult?.appearance) {
+ previousAppearanceValue.value = JSON.parse(
+ JSON.stringify(props.formData.inspectionResult.appearance || [])
+ );
+ }
+ }
+);
</script>
+
<style lang="scss" scoped>
-.form_box {
+.form-container {
+ max-height: 80vh;
+ display: flex;
+ flex-direction: column;
+ background: #fff;
+ border-radius: 12px 12px 0 0;
}
-.submit_btn {
- position: absolute;
- bottom: 0;
- width: 100%;
+
+.dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px;
+ border-bottom: 1px solid #e6e6e6;
+ position: sticky;
+ top: 0;
+ background: #fff;
+ z-index: 10;
+}
+
+.dialog-title {
+ font-size: 16px;
+ color: #333;
+ font-weight: 500;
+}
+
+.close-icon {
+ font-size: 20px;
+ color: #999;
+ padding: 4px;
+}
+
+.dialog-content {
+ flex: 1;
+ overflow-y: auto;
+ padding: 16px;
+}
+
+.section-title {
+ font-size: 14px;
+ font-weight: 700;
+ color: #252525;
+ margin: 16px 0 8px 0;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #e6e6e6;
+}
+
+.checkbox-group {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px;
+}
+
+:deep(.wd-checkbox) {
+ margin-right: 0;
+}
+
+.dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ padding: 16px;
+ border-top: 1px solid #e6e6e6;
+ gap: 8px;
+}
+
+.text-danger {
+ :deep(.wd-input-number__input) {
+ color: #f56c6c;
+ border-color: #f56c6c;
+ }
}
</style>
diff --git a/src/pages/production/wire/selfInspect/index.vue b/src/pages/production/wire/selfInspect/index.vue
index 37f3733..fcb49a0 100644
--- a/src/pages/production/wire/selfInspect/index.vue
+++ b/src/pages/production/wire/selfInspect/index.vue
@@ -1,103 +1,571 @@
<template>
<view class="list">
- <z-paging ref="pagingRef" v-model="cardList" :fixed="false" @query="getList">
- <template #top>
- <CardTitle title="鎷変笣鑷" :hideAction="false" />
+ <CardTitle title="鑷绠$悊" :hideAction="false" :full="false">
+ <template #action>
+ <wd-button
+ icon="file-add"
+ :round="false"
+ size="small"
+ custom-class="add_btn"
+ @click="handleOpenAddDialog"
+ >
+ 鏂板鑷
+ </wd-button>
</template>
- <wd-card v-for="(item, index) in cardList" :key="index" type="rectangle" custom-class="round">
+ </CardTitle>
+
+ <!-- 鑷鍒楄〃锛堝崱鐗囨牱寮忥級 -->
+ <view class="inspection-list">
+ <wd-card
+ v-for="(item, index) in dataList"
+ :key="item.id || index"
+ class="card_bg"
+ style="margin-bottom: 12px"
+ >
<template #title>
- <view class="flex justify-between">
- <view>
- <wd-icon name="a-rootlist" color="#0D867F"></wd-icon>
- <text class="text-[#252525] ml-2 font-medium">{{ item.inspectionProject }}</text>
+ <view class="flex justify-between w-full">
+ <view class="flex items-center">
+ <wd-icon name="file" color="#0D867F" size="20px"></wd-icon>
+ <text class="font-medium text-[#252525] ml-2">鑷璁板綍 #{{ index + 1 }}</text>
</view>
- <view class="text-[#A8A8A8]" @click="toEdit">缂栬緫</view>
+ <view class="flex gap-2">
+ <wd-button
+ plain
+ type="primary"
+ size="small"
+ @click="handleEdit(item)"
+ style="margin-right: 10px"
+ >
+ 缂栬緫
+ </wd-button>
+ <wd-button plain type="error" size="small" @click="handleDelete(item)">
+ 鍒犻櫎
+ </wd-button>
+ </view>
</view>
</template>
- <ProductionCard :data="cardAttr" :value="item" color="#0D867F" />
+
+ <view class="card-content">
+ <!-- 鍩烘湰淇℃伅 -->
+ <view class="info-section">
+ <view class="section-header">
+ <wd-icon name="info" color="#0D867F" size="16px"></wd-icon>
+ <text class="section-title">鍩烘湰淇℃伅</text>
+ </view>
+ <view class="info-grid">
+ <view class="info-item">
+ <text class="info-label">鑷鏃堕棿:</text>
+ <text class="info-value">{{ item.fixedInfo?.recordDate || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鏈哄彴:</text>
+ <text class="info-value">{{ item.fixedInfo?.deviceModel || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鐝粍:</text>
+ <text class="info-value">{{ item.fixedInfo?.teamName || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">棣栨鍗曞彿:</text>
+ <text class="info-value">{{ item.fixedInfo?.firstNo || "-" }}</text>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍘熸潗鏂欎俊鎭� -->
+ <view class="info-section">
+ <view class="section-header">
+ <wd-icon name="folder" color="#0D867F" size="16px"></wd-icon>
+ <text class="section-title">鍘熸潗鏂欎俊鎭�</text>
+ </view>
+ <view class="info-grid">
+ <view class="info-item">
+ <text class="info-label">鍨嬪彿:</text>
+ <text class="info-value">{{ item.fixedInfo?.poleModel || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鎵规:</text>
+ <text class="info-value">{{ item.fixedInfo?.poleNumber || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鐢熶骇杞存暟:</text>
+ <text class="info-value">{{ item.fixedInfo?.outputNumber || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">瀹氬緞妯″叿:</text>
+ <text class="info-value">{{ item.fixedInfo?.lastSlot || "-" }}</text>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍗曚笣鐩村緞 -->
+ <view class="info-section">
+ <view class="section-header">
+ <wd-icon name="setting" color="#0D867F" size="16px"></wd-icon>
+ <text class="section-title">鍗曚笣鐩村緞(mm)</text>
+ </view>
+ <view class="info-grid">
+ <view class="info-item">
+ <text class="info-label">瑙勬牸鍨嬪彿:</text>
+ <text class="info-value">{{ item.fixedInfo?.model || "-" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鏈�澶у��:</text>
+ <text class="info-value">
+ {{
+ item.inspectionResult?.maxDia !== null &&
+ item.inspectionResult?.maxDia !== undefined
+ ? item.inspectionResult.maxDia
+ : "-"
+ }}
+ </text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鏈�灏忓��:</text>
+ <text class="info-value">
+ {{
+ item.inspectionResult?.minDia !== null &&
+ item.inspectionResult?.minDia !== undefined
+ ? item.inspectionResult.minDia
+ : "-"
+ }}
+ </text>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鎴愮洏璐ㄩ噺 -->
+ <view class="info-section">
+ <view class="section-header">
+ <wd-icon name="check" color="#0D867F" size="16px"></wd-icon>
+ <text class="section-title">鎴愮洏璐ㄩ噺</text>
+ </view>
+ <view class="info-grid">
+ <view class="info-item">
+ <text class="info-label">鍗风粫绱у瘑:</text>
+ <text class="info-value">
+ {{ item.inspectionResult?.windingTightness || "鏄�" }}
+ </text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鎺掑垪鏁撮綈:</text>
+ <text class="info-value">
+ {{ item.inspectionResult?.arrangementNeatness || "鏄�" }}
+ </text>
+ </view>
+ <view class="info-item-full">
+ <text class="info-label">澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂�(mm):</text>
+ <text
+ class="info-value"
+ :style="{
+ color: item.inspectionResult?.aluminumWireDistance < 25 ? '#f56c6c' : '',
+ }"
+ >
+ {{ item.inspectionResult?.aluminumWireDistance || "-" }}
+ </text>
+ </view>
+ </view>
+ </view>
+
+ <!-- 鍏朵粬淇℃伅 -->
+ <view class="info-section">
+ <view class="section-header">
+ <wd-icon name="more" color="#0D867F" size="16px"></wd-icon>
+ <text class="section-title">鍏朵粬淇℃伅</text>
+ </view>
+ <view class="info-grid">
+ <view class="info-item-full">
+ <text class="info-label">澶栬璐ㄩ噺:</text>
+ <text class="info-value">
+ {{ getAppearanceLabel(item.inspectionResult?.appearance) }}
+ </text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鎴愬搧妯″悗鎺ュご鎯呭喌:</text>
+ <text class="info-value">{{ item.inspectionResult?.jointCondition || "鏃�" }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">缁撹:</text>
+ <text
+ class="info-value"
+ :style="{
+ color: item.inspectionResult?.conclusion === '鍚堟牸' ? '#67c23a' : '#f56c6c',
+ fontWeight: '500',
+ }"
+ >
+ {{ item.inspectionResult?.conclusion || "鍚堟牸" }}
+ </text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">璁板綍浜�:</text>
+ <text class="info-value">{{ item.fixedInfo?.createUserName || "-" }}</text>
+ </view>
+ </view>
+ </view>
+ </view>
</wd-card>
- </z-paging>
- <wd-popup v-model="dialog.visible" position="bottom" custom-class="yl-popup">
- <view class="action px-3">
- <wd-button type="text" @click="cancel">鍙栨秷</wd-button>
- <wd-button type="text" @click="submit">纭畾</wd-button>
- </view>
- <SelfInspectForm />
+ </view>
+
+ <!-- 鏂板/缂栬緫寮规 -->
+ <wd-popup v-model="dialogVisible" position="bottom" custom-class="yl-popup">
+ <SelfInspectForm
+ :visible="dialogVisible"
+ :form-data="currentFormData"
+ :appearance-options="appearanceOptions"
+ :previous-appearance-value="previousAppearanceValueMap.get(currentFormData?.id || '')"
+ @update:visible="dialogVisible = $event"
+ @submit="handleFormSubmit"
+ @close="handleCloseDialog"
+ />
</wd-popup>
+
<wd-toast />
</view>
</template>
<script setup lang="ts">
import CardTitle from "@/components/card-title/index.vue";
-import ProductionCard from "../../components/ProductionCard.vue";
-import { useToast } from "wot-design-uni";
-import SelfInspectForm from "./form.vue";
+import { useToast, dayjs } from "wot-design-uni";
+import { onLoad } from "@dcloudio/uni-app";
+import { ref } from "vue";
import ManageApi from "@/api/product/manage";
+import SelfInspectForm from "./form.vue";
-const pagingRef = ref();
-const paramsId = ref();
const toast = useToast();
-const dialog = reactive({
- visible: false,
-});
-const cardAttr = ref<any[]>([
- {
- label: "鍗曚綅",
- prop: "inspectionUnit",
- },
- {
- label: "鏍囧噯鍊�",
- prop: "standardValue",
- },
- {
- label: "鑷鍊�",
- prop: "inspectionItem",
- },
- {
- label: "鑷缁撴灉",
- prop: "inspectionResult",
- color: "#FF1E1E",
- },
-]);
-const cardList = ref<any[]>([]);
+const wireId = ref<string>("");
+const poleModel = ref<string>("");
+const poleNumber = ref<string>("");
-// const addReport = () => {
-// dialog.visible = true;
-// };
+// 鏁版嵁鍒楄〃
+const dataList = ref<any[]>([]);
+const loading = ref(false);
-const toEdit = () => {
- uni.navigateTo({
- url: "/pages/production/wire/selfInspect/edit",
- });
-};
-const submit = () => {
- toast.show("鎻愪氦");
- dialog.visible = false;
+// 澶栬閫夐」
+const appearanceOptions = ref<Array<{ label: string; value: string | number }>>([]);
+
+// 瀛樺偍姣忚澶栬璐ㄩ噺鐨勪箣鍓嶇殑鍊�
+const previousAppearanceValueMap = ref<Map<string, string[]>>(new Map());
+
+// 寮规鐩稿叧
+const dialogVisible = ref(false);
+const currentFormData = ref<any>(null);
+
+// 鍔犺浇澶栬瀛楀吀鏁版嵁
+const loadAppearanceDict = async () => {
+ try {
+ const qualityRes = await ManageApi.dictAPI("draw_appearance_quality");
+ if (qualityRes.data && Array.isArray(qualityRes.data)) {
+ appearanceOptions.value = qualityRes.data.map((item: any) => ({
+ label: item.dictLabel || "",
+ value: item.dictValue || "",
+ }));
+ }
+ } catch (error) {
+ console.error("鍔犺浇澶栬瀛楀吀澶辫触:", error);
+ }
};
-const cancel = () => {
- toast.show("鍙栨秷");
- dialog.visible = false;
+// 鑾峰彇澶栬鏍囩
+const getAppearanceLabel = (value: string | string[]) => {
+ if (Array.isArray(value) && value.length > 0) {
+ const labels = value.map((v) => {
+ const option = appearanceOptions.value.find((item) => item.value === v);
+ return option ? option.label : v;
+ });
+ return labels.join(", ");
+ }
+ if (typeof value === "string" && value) {
+ const option = appearanceOptions.value.find((item) => item.value === value);
+ return option ? option.label : value;
+ }
+ return "鏃�";
};
-const getList = async () => {
- const { data } = await ManageApi.getSelfInspection({
- outPutId: paramsId.value,
- type: "鎷変笣",
- });
- pagingRef.value.complete(data);
+// 鑾峰彇鏁版嵁
+const getData = async () => {
+ if (!wireId.value) return;
+
+ loading.value = true;
+ try {
+ const { code, data } = await ManageApi.getSelfInspection({
+ wireId: wireId.value,
+ poleModel: poleModel.value,
+ poleNumber: poleNumber.value,
+ });
+
+ if (code === 200) {
+ dataList.value = data || [];
+ // 鍒濆鍖栨瘡琛岀殑 previousAppearanceValue
+ dataList.value.forEach((item) => {
+ if (item.id) {
+ previousAppearanceValueMap.value.set(
+ item.id,
+ JSON.parse(JSON.stringify(item.inspectionResult?.appearance || []))
+ );
+ }
+ });
+ }
+ } catch (error) {
+ console.error("鑾峰彇鑷鏁版嵁澶辫触:", error);
+ toast.error("鑾峰彇鑷鏁版嵁澶辫触");
+ } finally {
+ loading.value = false;
+ }
};
-onLoad((options: any) => {
- paramsId.value = options.id;
+// 瀛樺偍浠庢帴鍙h幏鍙栫殑鍘熷鏁版嵁锛堢敤浜庝繚瀛樻椂琛ュ厖缂哄け瀛楁锛�
+const originalApiData = ref<any>(null);
+
+// 鎵撳紑鏂板寮规
+const handleOpenAddDialog = async () => {
+ const newItem = {
+ id: `temp_${Date.now()}`,
+ fixedInfo: {
+ firstNo: "",
+ recordDate: dayjs().format("YYYY-MM-DD"),
+ deviceModel: "",
+ teamName: "",
+ workShift: "",
+ poleModel: poleModel.value || "",
+ poleNumber: poleNumber.value || "",
+ outputNumber: "",
+ lastSlot: "",
+ model: "",
+ createUserName: "",
+ id: null,
+ teamId: null,
+ wireId: wireId.value ? Number(wireId.value) : null,
+ },
+ inspectionResult: {
+ maxDia: null,
+ minDia: null,
+ appearance: ["鏃犲瑙傞棶棰�"],
+ windingTightness: "鏄�",
+ arrangementNeatness: "鏄�",
+ aluminumWireDistance: 25,
+ jointCondition: "鏃�",
+ conclusion: "鍚堟牸",
+ dia: null,
+ twistedLayer: null,
+ wireId: wireId.value ? String(wireId.value) : null,
+ },
+ isEditing: true,
+ isNew: true,
+ };
+
+ // 璋冪敤API鑾峰彇榛樿鏁版嵁
+ try {
+ const { code, data } = await ManageApi.getDrawInspectStyleByGetDrawInspect({
+ wireId: wireId.value,
+ poleModel: poleModel.value,
+ poleNumber: poleNumber.value,
+ });
+
+ if (code === 200 && data) {
+ // 淇濆瓨鍘熷鎺ュ彛鏁版嵁锛岀敤浜庢彁浜ゆ椂琛ュ厖缂哄け瀛楁
+ originalApiData.value = JSON.parse(JSON.stringify(data));
+
+ if (data.fixedInfo) {
+ const clonedFixedInfo = JSON.parse(JSON.stringify(data.fixedInfo));
+ // 鍚堝苟鏁版嵁锛屼繚鐣欒〃鍗曚腑宸叉湁鐨勫�硷紝琛ュ厖鎺ュ彛杩斿洖鐨勫��
+ Object.assign(newItem.fixedInfo, clonedFixedInfo, {
+ // 纭繚杩欎簺瀛楁浠庢帴鍙f暟鎹腑鑾峰彇
+ id: clonedFixedInfo.id || null,
+ teamId: clonedFixedInfo.teamId || null,
+ wireId: clonedFixedInfo.wireId || (wireId.value ? Number(wireId.value) : null),
+ });
+ }
+ if (data.drawWireInfo) {
+ const clonedDrawWireInfo = JSON.parse(JSON.stringify(data.drawWireInfo));
+ // 鍚堝苟鏁版嵁锛屼繚鐣欒〃鍗曚腑宸叉湁鐨勫�硷紝琛ュ厖鎺ュ彛杩斿洖鐨勫��
+ Object.assign(newItem.inspectionResult, clonedDrawWireInfo, {
+ // 纭繚杩欎簺瀛楁浠庢帴鍙f暟鎹腑鑾峰彇
+ dia: clonedDrawWireInfo.dia || null,
+ twistedLayer: clonedDrawWireInfo.twistedLayer || null,
+ wireId: clonedDrawWireInfo.wireId || (wireId.value ? String(wireId.value) : null),
+ });
+ }
+ }
+ } catch (error) {
+ console.error("鑾峰彇榛樿鏁版嵁澶辫触:", error);
+ }
+
+ currentFormData.value = JSON.parse(JSON.stringify(newItem));
+ previousAppearanceValueMap.value.set(
+ currentFormData.value.id,
+ JSON.parse(JSON.stringify(currentFormData.value.inspectionResult.appearance || []))
+ );
+ dialogVisible.value = true;
+};
+
+// 缂栬緫鑷
+const handleEdit = async (row: any) => {
+ // 缂栬緫鏃朵篃闇�瑕佽幏鍙栨帴鍙f暟鎹紝纭繚鏈夋墍鏈夊繀瑕佸瓧娈�
+ try {
+ const { code, data } = await ManageApi.getDrawInspectStyleByGetDrawInspect({
+ wireId: wireId.value,
+ poleModel: poleModel.value,
+ poleNumber: poleNumber.value,
+ });
+
+ if (code === 200 && data) {
+ originalApiData.value = JSON.parse(JSON.stringify(data));
+ }
+ } catch (error) {
+ console.error("鑾峰彇榛樿鏁版嵁澶辫触:", error);
+ }
+
+ currentFormData.value = JSON.parse(JSON.stringify(row));
+ previousAppearanceValueMap.value.set(
+ row.id,
+ JSON.parse(JSON.stringify(row.inspectionResult.appearance || []))
+ );
+ dialogVisible.value = true;
+};
+
+// 琛ㄥ崟鎻愪氦
+const handleFormSubmit = async (formData: any) => {
+ const aluminumWireDistance = formData.inspectionResult.aluminumWireDistance;
+ if (aluminumWireDistance < 25) {
+ toast.error("澶栧眰閾濈嚎绂讳晶鏉胯竟缂樿窛绂讳笉鑳戒綆浜�25mm");
+ return;
+ }
+
+ // 鏋勫缓鎻愪氦鏁版嵁锛岀‘淇濆寘鍚墍鏈夊繀瑕佸瓧娈�
+ const saveData: any = {
+ fixedInfo: JSON.parse(JSON.stringify(formData.fixedInfo)),
+ inspectionResult: JSON.parse(JSON.stringify(formData.inspectionResult)),
+ wireId: wireId.value,
+ };
+
+ // 缂栬緫鏃讹紝纭繚 fixedInfo.id 琚纭紶閫�
+ // 浼樺厛浣跨敤 formData 涓殑 id锛堢紪杈戞椂搴旇瀛樺湪锛�
+ if (formData.fixedInfo?.id !== null && formData.fixedInfo?.id !== undefined) {
+ saveData.fixedInfo.id = formData.fixedInfo.id;
+ } else if (!formData.isNew) {
+ // 濡傛灉涓嶆槸鏂板锛屽皾璇曚粠鏁版嵁鍒楄〃涓煡鎵� id
+ const existingItem = dataList.value.find((item) => item.id === formData.id);
+ if (existingItem?.fixedInfo?.id) {
+ saveData.fixedInfo.id = existingItem.fixedInfo.id;
+ }
+ }
+
+ // 濡傛灉鏄粠鎺ュ彛鑾峰彇鐨勬暟鎹紝琛ュ厖琛ㄥ崟涓病鏈夌殑瀛楁
+ if (originalApiData.value) {
+ // 琛ュ厖 fixedInfo 涓己澶辩殑瀛楁
+ if (originalApiData.value.fixedInfo) {
+ const apiFixedInfo = originalApiData.value.fixedInfo;
+ // 纭繚杩欎簺瀛楁瀛樺湪锛堝鏋滆〃鍗曚腑娌℃湁锛屼娇鐢ㄦ帴鍙h繑鍥炵殑鍊硷級
+ // 鍙湁鍦� saveData.fixedInfo.id 涓嶅瓨鍦ㄦ椂鎵嶄娇鐢ㄦ帴鍙h繑鍥炵殑 id
+ if (apiFixedInfo.id !== undefined && !saveData.fixedInfo.id) {
+ saveData.fixedInfo.id = apiFixedInfo.id;
+ }
+ if (apiFixedInfo.teamId !== undefined) {
+ saveData.fixedInfo.teamId = apiFixedInfo.teamId;
+ }
+ if (apiFixedInfo.wireId !== undefined) {
+ saveData.fixedInfo.wireId = apiFixedInfo.wireId;
+ }
+ // 琛ュ厖鍏朵粬鍙兘缂哄け鐨勫瓧娈�
+ if (apiFixedInfo.recordDate && !saveData.fixedInfo.recordDate) {
+ saveData.fixedInfo.recordDate = apiFixedInfo.recordDate;
+ }
+ }
+
+ // 琛ュ厖 inspectionResult 涓己澶辩殑瀛楁
+ if (originalApiData.value.drawWireInfo) {
+ const apiInspectionResult = originalApiData.value.drawWireInfo;
+ // 纭繚杩欎簺瀛楁瀛樺湪锛堝鏋滆〃鍗曚腑娌℃湁锛屼娇鐢ㄦ帴鍙h繑鍥炵殑鍊硷級
+ if (apiInspectionResult.dia !== undefined) {
+ saveData.inspectionResult.dia = apiInspectionResult.dia;
+ }
+ if (apiInspectionResult.twistedLayer !== undefined) {
+ saveData.inspectionResult.twistedLayer = apiInspectionResult.twistedLayer;
+ }
+ if (apiInspectionResult.wireId !== undefined) {
+ saveData.inspectionResult.wireId = apiInspectionResult.wireId;
+ }
+ }
+ }
+
+ // 纭繚 wireId 瀛楁瀛樺湪
+ if (!saveData.fixedInfo.wireId && wireId.value) {
+ saveData.fixedInfo.wireId = Number(wireId.value);
+ }
+ if (!saveData.inspectionResult.wireId && wireId.value) {
+ saveData.inspectionResult.wireId = String(wireId.value);
+ }
+
+ try {
+ const { code, data } = await ManageApi.addSelfInspection(saveData);
+
+ if (code === 200) {
+ toast.success("淇濆瓨鎴愬姛");
+ dialogVisible.value = false;
+ originalApiData.value = null; // 娓呯┖鍘熷鏁版嵁
+ previousAppearanceValueMap.value.delete(formData.id);
+ await getData();
+ } else {
+ toast.error(data || "淇濆瓨澶辫触");
+ }
+ } catch (error) {
+ console.error("淇濆瓨澶辫触:", error);
+ toast.error("淇濆瓨澶辫触");
+ }
+};
+
+// 鍏抽棴寮规
+const handleCloseDialog = () => {
+ dialogVisible.value = false;
+ currentFormData.value = null;
+ originalApiData.value = null; // 娓呯┖鍘熷鏁版嵁
+};
+
+// 鍒犻櫎鑷
+const handleDelete = async (row: any) => {
+ try {
+ const res = await uni.showModal({
+ title: "鎻愮ず",
+ content: "纭畾鍒犻櫎璇ヨ嚜妫�璁板綍鍚楋紵",
+ });
+
+ if (res.confirm) {
+ if (row.fixedInfo?.id && !row.isNew) {
+ const { code } = await ManageApi.deleteSelfInspection(row.fixedInfo.id);
+
+ if (code === 200) {
+ toast.success("鍒犻櫎鎴愬姛");
+ await getData();
+ } else {
+ toast.error("鍒犻櫎澶辫触");
+ }
+ } else {
+ const index = dataList.value.findIndex((item) => item.id === row.id);
+ if (index !== -1) {
+ dataList.value.splice(index, 1);
+ toast.success("鍒犻櫎鎴愬姛");
+ }
+ }
+ }
+ } catch (error) {
+ console.error("鍒犻櫎鑷澶辫触:", error);
+ toast.error("鍒犻櫎澶辫触");
+ }
+};
+
+onLoad(async (options: any) => {
+ wireId.value = options.wireId || "";
+ poleModel.value = options.poleModel || "";
+ poleNumber.value = options.poleNumber || "";
+ await loadAppearanceDict();
+ await getData();
});
</script>
<style lang="scss" scoped>
.list {
- height: calc(100vh - 30px);
- padding: 12px;
+ min-height: calc(100vh - 30px);
+ padding: 12px 4px;
background: #f3f9f8;
:deep() {
@@ -107,8 +575,75 @@
}
}
-.action {
+.inspection-list {
+ margin-top: 12px;
+}
+
+.card_bg {
+ box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.05);
+ padding-bottom: 10px;
+ border-radius: 8px;
+ overflow: hidden;
+}
+
+.card-content {
+ padding: 0 4px;
+}
+
+.info-section {
+ margin-bottom: 16px;
+
+ &:last-child {
+ margin-bottom: 0;
+ }
+}
+
+.section-header {
display: flex;
- justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid #e6e6e6;
+}
+
+.section-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: #252525;
+ margin-left: 6px;
+}
+
+.info-grid {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 12px 16px;
+}
+
+.info-item {
+ display: flex;
+ align-items: flex-start;
+ min-height: 24px;
+}
+
+.info-item-full {
+ display: flex;
+ align-items: flex-start;
+ min-height: 24px;
+ grid-column: 1 / -1;
+}
+
+.info-label {
+ font-size: 13px;
+ color: #646874;
+ margin-right: 8px;
+ white-space: nowrap;
+ flex-shrink: 0;
+}
+
+.info-value {
+ font-size: 13px;
+ color: #252525;
+ flex: 1;
+ word-break: break-all;
}
</style>
--
Gitblit v1.9.3