From 33d9e4e1a653f0fb460826eb20bf58457045ff8e Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 04 三月 2026 16:40:33 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/views/customerService/afterSalesHandling/components/formDia.vue | 10 +
src/views/customerService/expiryAfterSales/index.vue | 72 +++++---
src/views/productionManagement/workOrder/index.vue | 106 +++++++------
src/api/customerService/index.js | 25 --
src/views/customerService/afterSalesHandling/index.vue | 199 +++++++-----------------
src/views/customerService/expiryAfterSales/components/formDia.vue | 42 +++-
src/views/productionManagement/productionProcess/New.vue | 4
7 files changed, 203 insertions(+), 255 deletions(-)
diff --git a/src/api/customerService/index.js b/src/api/customerService/index.js
index 9f458b6..560ffe6 100644
--- a/src/api/customerService/index.js
+++ b/src/api/customerService/index.js
@@ -59,27 +59,17 @@
})
}
// 鍞悗澶勭悊-闄勪欢鍒犻櫎
-export function afterSalesServiceFileDel(ids) {
+export function afterSalesServiceFileDel(id) {
return request({
- url: '/afterSalesService/file/del',
+ url: `/afterSalesService/file/del/${id}`,
method: 'delete',
- data: ids,
- })
-}
-
-// 鍞悗澶勭悊-缁翠慨璁板綍鍒楄〃
-export function afterSalesServiceRepairListPage(query) {
- return request({
- url: '/afterSalesService/repair/listPage',
- method: 'get',
- params: query,
})
}
// 涓存湡鍞悗绠$悊-鍒嗛〉鏌ヨ
export function expiryAfterSalesListPage(query) {
return request({
- url: '/expiryAfterSales/listPage',
+ url: '/afterSalesNearExpiryService/listPage',
method: 'get',
params: query,
})
@@ -88,7 +78,7 @@
// 涓存湡鍞悗绠$悊-鏂板
export function expiryAfterSalesAdd(query) {
return request({
- url: '/expiryAfterSales/add',
+ url: '/afterSalesNearExpiryService/add',
method: 'post',
data: query,
})
@@ -97,17 +87,16 @@
// 涓存湡鍞悗绠$悊-鏇存柊
export function expiryAfterSalesUpdate(query) {
return request({
- url: '/expiryAfterSales/update',
+ url: '/afterSalesNearExpiryService/update',
method: 'post',
data: query,
})
}
// 涓存湡鍞悗绠$悊-鍒犻櫎
-export function expiryAfterSalesDelete(query) {
+export function expiryAfterSalesDelete(ids) {
return request({
- url: '/expiryAfterSales/delete',
+ url: '/afterSalesNearExpiryService/delete?ids=' + ids,
method: 'delete',
- data: query,
})
}
\ No newline at end of file
diff --git a/src/views/customerService/afterSalesHandling/components/formDia.vue b/src/views/customerService/afterSalesHandling/components/formDia.vue
index daccaca..432a3ef 100644
--- a/src/views/customerService/afterSalesHandling/components/formDia.vue
+++ b/src/views/customerService/afterSalesHandling/components/formDia.vue
@@ -169,8 +169,14 @@
userList.value = res.data;
});
form.value = {...row}
- form.value.disposeUserId = userStore.id;
- form.value.disDate = getCurrentDate();
+ if (type === 'approve') {
+ if (!form.value.disposeUserId) {
+ form.value.disposeUserId = userStore.id;
+ }
+ if (!form.value.disDate) {
+ form.value.disDate = getCurrentDate();
+ }
+ }
}
// const setName = (code) => {
// const index = userList.value.findIndex(item => item.deviceModel === code);
diff --git a/src/views/customerService/afterSalesHandling/index.vue b/src/views/customerService/afterSalesHandling/index.vue
index c3a19b4..dd07ddb 100644
--- a/src/views/customerService/afterSalesHandling/index.vue
+++ b/src/views/customerService/afterSalesHandling/index.vue
@@ -55,41 +55,10 @@
:upload-method="handleFileUpload"
:delete-method="handleFileDelete"
/>
- <el-dialog
- v-model="repairDialogVisible"
- title="缁翠慨璁板綍"
- width="700px"
- destroy-on-close
- @close="repairRecordList = []"
- >
- <el-table
- :data="repairRecordList"
- border
- v-loading="repairRecordLoading"
- max-height="400"
- >
- <el-table-column type="index" label="搴忓彿" width="55" align="center" />
- <el-table-column label="缁翠慨鏃ユ湡" prop="maintenanceTime" min-width="120" show-overflow-tooltip>
- <template #default="{ row }">
- {{ row.maintenanceTime || row.repairTime || '-' }}
- </template>
- </el-table-column>
- <el-table-column label="缁翠慨浜�" prop="maintenanceName" min-width="100" show-overflow-tooltip>
- <template #default="{ row }">
- {{ row.maintenanceName || row.repairName || '-' }}
- </template>
- </el-table-column>
- <el-table-column label="缁翠慨缁撴灉" prop="maintenanceResult" min-width="180" show-overflow-tooltip />
- </el-table>
- <template #footer>
- <el-button @click="repairDialogVisible = false">鍏抽棴</el-button>
- </template>
- </el-dialog>
</div>
</template>
<script setup>
-import {Search} from "@element-plus/icons-vue";
import { onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue";
import FileListDialog from "@/components/Dialog/FileListDialog.vue";
@@ -97,12 +66,9 @@
import request from "@/utils/request";
import { getToken } from "@/utils/auth";
import {
- afterSalesServiceDelete,
afterSalesServiceListPage,
afterSalesServiceFileListPage,
- afterSalesServiceFileAdd,
afterSalesServiceFileDel,
- afterSalesServiceRepairListPage,
} from "@/api/customerService/index.js";
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance();
@@ -210,14 +176,6 @@
openFilesFormDia(row);
},
},
- // TODO 涓哄啓鎶ュ憡娣诲姞鐨�
- {
- name: "缁翠慨璁板綍",
- type: "text",
- clickFun: (row) => {
- openRepairDialog(row);
- },
- },
],
},
]);
@@ -238,32 +196,9 @@
const fileListRef = ref(null)
const fileListDialogVisible = ref(false)
const currentFileRow = ref(null)
-const repairDialogVisible = ref(false)
-const repairRecordList = ref([])
-const repairRecordLoading = ref(false)
-// 鎵撳紑缁翠慨璁板綍寮规
-const openRepairDialog = async (row) => {
- repairDialogVisible.value = true
- repairRecordLoading.value = true
- repairRecordList.value = []
- try {
- const res = await afterSalesServiceRepairListPage({
- afterSalesServiceId: row.id,
- current: 1,
- size: 100,
- })
- if (res.code === 200 && res.data?.records) {
- repairRecordList.value = res.data.records
- }
- } catch (error) {
- proxy.$modal.msgError("鑾峰彇缁翠慨璁板綍澶辫触")
- } finally {
- repairRecordLoading.value = false
- }
-}
-// 鎵撳紑闄勪欢寮规----- TODO锛氭帴鍙f槸娌℃湁瀵规帴鐨勶紝闇�瑕佹柊澧炴帴鍙o紝涓哄啓鎶ュ憡娣诲姞鐨�
+// 鎵撳紑闄勪欢寮规
const openFilesFormDia = async (row) => {
currentFileRow.value = row
try {
@@ -311,8 +246,9 @@
try {
const formData = new FormData()
formData.append("file", file)
+ formData.append("id", currentFileRow.value.id)
const uploadRes = await request({
- url: "/file/upload",
+ url: "/afterSalesService/file/upload",
method: "post",
data: formData,
headers: {
@@ -321,33 +257,23 @@
},
})
if (uploadRes.code === 200) {
- const fileData = {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛")
+ // 閲嶆柊鑾峰彇鏂囦欢鍒楄〃
+ const listRes = await afterSalesServiceFileListPage({
afterSalesServiceId: currentFileRow.value.id,
- name: uploadRes.data?.originalName || file.name,
- url: uploadRes.data?.tempPath || uploadRes.data?.url,
+ current: 1,
+ size: 100,
+ })
+ if (listRes.code === 200 && fileListRef.value) {
+ const fileList = (listRes.data?.records || []).map((item) => ({
+ name: item.fileName,
+ url: item.fileUrl,
+ id: item.id,
+ ...item,
+ }))
+ fileListRef.value.setList(fileList)
}
- const saveRes = await afterSalesServiceFileAdd(fileData)
- if (saveRes.code === 200) {
- proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛")
- const listRes = await afterSalesServiceFileListPage({
- afterSalesServiceId: currentFileRow.value.id,
- current: 1,
- size: 100,
- })
- if (listRes.code === 200 && fileListRef.value) {
- const fileList = (listRes.data?.records || []).map((item) => ({
- name: item.name || item.fileName,
- url: item.url || item.fileUrl,
- id: item.id,
- ...item,
- }))
- fileListRef.value.setList(fileList)
- }
- resolve({ name: fileData.name, url: fileData.url, id: saveRes.data?.id })
- } else {
- proxy.$modal.msgError(saveRes.msg || "鏂囦欢淇濆瓨澶辫触")
- resolve(null)
- }
+ resolve({ name: file.name, url: "", id: null })
} else {
proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触")
resolve(null)
@@ -367,31 +293,47 @@
// 鍒犻櫎闄勪欢
const handleFileDelete = async (row) => {
try {
- const res = await afterSalesServiceFileDel([row.id])
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- if (currentFileRow.value && fileListRef.value) {
- const listRes = await afterSalesServiceFileListPage({
- afterSalesServiceId: currentFileRow.value.id,
- current: 1,
- size: 100,
- })
- if (listRes.code === 200) {
- const fileList = (listRes.data?.records || []).map((item) => ({
- name: item.name || item.fileName,
- url: item.url || item.fileUrl,
- id: item.id,
- ...item,
- }))
- fileListRef.value.setList(fileList)
- }
+ // 娣诲姞纭瀵硅瘽妗�
+ const confirmResult = await ElMessageBox.confirm(
+ '纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�',
+ '鍒犻櫎纭',
+ {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
}
- } else {
- proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触")
- return false
+ )
+
+ if (confirmResult === 'confirm') {
+ const res = await afterSalesServiceFileDel(row.id)
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
+ if (currentFileRow.value && fileListRef.value) {
+ const listRes = await afterSalesServiceFileListPage({
+ afterSalesServiceId: currentFileRow.value.id,
+ current: 1,
+ size: 100,
+ })
+ if (listRes.code === 200) {
+ const fileList = (listRes.data?.records || []).map((item) => ({
+ name: item.fileName,
+ url: item.fileUrl,
+ id: item.id,
+ ...item,
+ }))
+ fileListRef.value.setList(fileList)
+ }
+ }
+ } else {
+ proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触")
+ return false
+ }
}
} catch (error) {
- proxy.$modal.msgError("鍒犻櫎澶辫触")
+ // 濡傛灉鐢ㄦ埛鍙栨秷鍒犻櫎锛屼笉鏄剧ず閿欒淇℃伅
+ if (error !== 'cancel') {
+ proxy.$modal.msgError("鍒犻櫎澶辫触")
+ }
return false
}
}
@@ -421,35 +363,6 @@
nextTick(() => {
formDia.value?.openDialog(type, row)
})
-};
-
-const handleDelete = () => {
- let ids = [];
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map((item) => item.id);
- } else {
- proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
- return;
- }
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- tableLoading.value = true;
- afterSalesServiceDelete(ids)
- .then((res) => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
- })
- .finally(() => {
- tableLoading.value = false;
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
};
// 瀵煎嚭
diff --git a/src/views/customerService/expiryAfterSales/components/formDia.vue b/src/views/customerService/expiryAfterSales/components/formDia.vue
index e8293d6..2fe603b 100644
--- a/src/views/customerService/expiryAfterSales/components/formDia.vue
+++ b/src/views/customerService/expiryAfterSales/components/formDia.vue
@@ -161,8 +161,8 @@
import {ref, computed} from "vue";
import useUserStore from "@/store/modules/user.js";
import { getCurrentDate } from "@/utils/index.js";
-// import {userListNoPageByTenantId} from "@/api/system/user.js"; // 鏆傛椂娉ㄩ噴鎺夛紝浣跨敤鍋囨暟鎹�
-// import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js"; // 鏆傛椂娉ㄩ噴鎺夛紝浣跨敤鍋囨暟鎹�
+import {userListNoPageByTenantId} from "@/api/system/user.js";
+import {expiryAfterSalesAdd, expiryAfterSalesUpdate} from "@/api/customerService/index.js";
const { proxy } = getCurrentInstance()
const emit = defineEmits(['close'])
const dialogFormVisible = ref(false);
@@ -218,14 +218,10 @@
operationType.value = type;
dialogFormVisible.value = true;
- // 妯℃嫙鑾峰彇鐢ㄦ埛鍒楄〃
- userList.value = [
- { userId: 1, nickName: "寮犱笁" },
- { userId: 2, nickName: "鏉庡洓" },
- { userId: 3, nickName: "鐜嬩簲" },
- { userId: 4, nickName: "璧靛叚" },
- { userId: 5, nickName: "瀛欏叓" }
- ];
+ // 鑾峰彇鐢ㄦ埛鍒楄〃
+ userListNoPageByTenantId().then(res => {
+ userList.value = res.data;
+ });
if (type === 'add') {
// 鏂板鏃堕噸缃〃鍗�
@@ -256,12 +252,30 @@
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
- // 妯℃嫙鎻愪氦鎿嶄綔
- setTimeout(() => {
- console.log("妯℃嫙鎻愪氦鐨勬暟鎹�:", form.value);
+ const submitData = {
+ id: form.value.id,
+ productName: form.value.productName,
+ batchNumber: form.value.batchNumber,
+ expireDate: form.value.expiryDate,
+ stockQuantity: form.value.stockQuantity,
+ customerName: form.value.customerName,
+ contactPhone: form.value.contactPhone,
+ disRes: form.value.problemDesc,
+ status: form.value.status,
+ disposeUserId: form.value.handlerId,
+ disposeNickName: userList.value.find(item => item.userId === form.value.handlerId)?.nickName,
+ disposeResult: form.value.handleResult,
+ disDate: form.value.handleDate
+ };
+
+ const apiCall = operationType.value === 'add' ? expiryAfterSalesAdd : expiryAfterSalesUpdate;
+ apiCall(submitData).then(() => {
proxy.$modal.msgSuccess(operationType.value === 'add' ? "鏂板鎴愬姛" : "鏇存柊鎴愬姛");
closeDia();
- }, 300);
+ }).catch(error => {
+ console.error('鎻愪氦鏁版嵁澶辫触:', error);
+ proxy.$modal.msgError('鎻愪氦鏁版嵁澶辫触锛岃绋嶅悗閲嶈瘯');
+ });
}
});
}
diff --git a/src/views/customerService/expiryAfterSales/index.vue b/src/views/customerService/expiryAfterSales/index.vue
index df44504..ee5395d 100644
--- a/src/views/customerService/expiryAfterSales/index.vue
+++ b/src/views/customerService/expiryAfterSales/index.vue
@@ -72,7 +72,7 @@
import {onMounted, ref} from "vue";
import FormDia from "@/views/customerService/expiryAfterSales/components/formDia.vue";
import {ElMessageBox} from "element-plus";
-// import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js"; // 鏆傛椂娉ㄩ噴鎺夛紝浣跨敤鍋囨暟鎹�
+import {expiryAfterSalesDelete, expiryAfterSalesListPage} from "@/api/customerService/index.js";
import useUserStore from "@/store/modules/user.js";
const { proxy } = getCurrentInstance();
const userStore = useUserStore()
@@ -127,7 +127,8 @@
label: "澶勭悊鐘舵��",
prop: "status",
width: "",
- slot: true,
+ dataType: "slot",
+ slot: "status",
},
{
label: "澶勭悊浜�",
@@ -142,7 +143,8 @@
{
label: "鎿嶄綔",
prop: "operation",
- slot: true,
+ dataType: "slot",
+ slot: "operation",
width: "200",
},
],
@@ -190,21 +192,39 @@
// 鑾峰彇鍒楄〃鏁版嵁
const getList = () => {
tableLoading.value = true;
- // 鍙栨秷娉ㄩ噴骞朵娇鐢ㄧ湡瀹濧PI
- // expiryAfterSalesListPage({
- // ...searchForm.value,
- // current: page.value.current,
- // size: page.value.size
- // }).then(res => {
- // tableData.value = res.data.records;
- // page.value.total = res.data.total;
- // tableLoading.value = false;
- // });
+ // 鏋勯�犳煡璇㈠弬鏁帮紝鏄犲皠鍓嶇瀛楁鍒板悗绔瓧娈�
+ const queryParams = {
+ expireDate: searchForm.value.expiryDate,
+ disDate: searchForm.value.handleDate,
+ status: searchForm.value.status,
+ current: page.value.current,
+ size: page.value.size
+ };
- // 鏆傛椂杩斿洖绌烘暟鎹�
- tableData.value = [];
- page.value.total = 0;
- tableLoading.value = false;
+ expiryAfterSalesListPage(queryParams).then(res => {
+ // 鏄犲皠鍚庣杩斿洖鏁版嵁鍒板墠绔〃鏍�
+ tableData.value = res.data.records.map(item => ({
+ id: item.id,
+ productName: item.productName,
+ batchNumber: item.batchNumber,
+ expiryDate: item.expireDate,
+ stockQuantity: item.stockQuantity,
+ customerName: item.customerName,
+ contactPhone: item.contactPhone,
+ problemDesc: item.disRes,
+ status: item.status,
+ handlerId: item.disposeUserId,
+ handlerName: item.disposeNickName,
+ handleResult: item.disposeResult,
+ handleDate: item.disDate
+ }));
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+ }).catch(error => {
+ console.error('鑾峰彇鍒楄〃鏁版嵁澶辫触:', error);
+ tableLoading.value = false;
+ proxy.$modal.msgError('鑾峰彇鏁版嵁澶辫触锛岃绋嶅悗閲嶈瘯');
+ });
};
// 鎵撳紑寮规
@@ -230,18 +250,12 @@
})
.then(() => {
tableLoading.value = true;
- // 鍙栨秷娉ㄩ噴骞朵娇鐢ㄧ湡瀹濧PI
- // expiryAfterSalesDelete(ids).then(() => {
- // proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- // getList();
- // }).finally(() => {
- // tableLoading.value = false;
- // });
-
- // 鏆傛椂妯℃嫙鍒犻櫎鎴愬姛
- tableLoading.value = false;
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- getList();
+ expiryAfterSalesDelete(ids).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ }).finally(() => {
+ tableLoading.value = false;
+ });
})
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
diff --git a/src/views/productionManagement/productionProcess/New.vue b/src/views/productionManagement/productionProcess/New.vue
index 5443e8d..001e3b1 100644
--- a/src/views/productionManagement/productionProcess/New.vue
+++ b/src/views/productionManagement/productionProcess/New.vue
@@ -26,7 +26,9 @@
<el-input v-model="formState.no" />
</el-form-item>
<el-form-item label="宸ヨ祫瀹氶" prop="salaryQuota">
- <el-input v-model="formState.salaryQuota" type="number" :step="0.001" />
+ <el-input v-model="formState.salaryQuota" type="number" :step="0.001">
+ <template #append>鍏�</template>
+ </el-input>
</el-form-item>
<el-form-item label="鏄惁璐ㄦ" prop="isQuality">
<el-switch v-model="formState.isQuality" :active-value="true" inactive-value="false"/>
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index 59457e8..162dd91 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -24,10 +24,12 @@
:page="page"
:tableLoading="tableLoading"
@pagination="pagination">
- <template #completionStatus="{ row }">
- <el-progress :percentage="toProgressPercentage(row?.completionStatus)" :color="progressColor(toProgressPercentage(row?.completionStatus))" :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
- </template>
- </PIMTable>
+ <template #completionStatus="{ row }">
+ <el-progress :percentage="toProgressPercentage(row?.completionStatus)"
+ :color="progressColor(toProgressPercentage(row?.completionStatus))"
+ :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" />
+ </template>
+ </PIMTable>
</div>
<el-dialog v-model="editDialogVisible"
title="缂栬緫鏃堕棿"
@@ -104,7 +106,6 @@
transferCardRowData.status
}}</span>
</div> -->
-
<div class="info-item">
<span class="info-label">璁″垝寮�濮嬫椂闂�</span>
<span class="info-value">{{ transferCardRowData.planStartTime }}</span>
@@ -175,7 +176,8 @@
readonly
style="width: 300px" />
</el-form-item>
- <el-form-item label="鏈鐢熶骇鏁伴噺" prop="quantity">
+ <el-form-item label="鏈鐢熶骇鏁伴噺"
+ prop="quantity">
<el-input v-model.number="reportForm.quantity"
type="number"
min="1"
@@ -184,7 +186,8 @@
placeholder="璇疯緭鍏ユ湰娆$敓浜ф暟閲�"
@input="handleQuantityInput" />
</el-form-item>
- <el-form-item label="鎶ュ簾鏁伴噺" prop="scrapQty">
+ <el-form-item label="鎶ュ簾鏁伴噺"
+ prop="scrapQty">
<el-input v-model.number="reportForm.scrapQty"
type="number"
min="0"
@@ -202,7 +205,7 @@
@change="handleUserChange">
<el-option v-for="user in userOptions"
:key="user.userId"
- :label="user.userName"
+ :label="user.nickName"
:value="user.userId" />
</el-select>
</el-form-item>
@@ -364,50 +367,46 @@
userId: "",
productMainId: null,
});
-
+
// 鏈鐢熶骇鏁伴噺楠岃瘉瑙勫垯
const validateQuantity = (rule, value, callback) => {
- if (value === null || value === undefined || value === '') {
- callback(new Error('璇疯緭鍏ユ湰娆$敓浜ф暟閲�'));
+ if (value === null || value === undefined || value === "") {
+ callback(new Error("璇疯緭鍏ユ湰娆$敓浜ф暟閲�"));
return;
}
const num = Number(value);
// 鏁存暟涓斿ぇ浜庣瓑浜�1
if (isNaN(num) || !Number.isInteger(num) || num < 1) {
- callback(new Error('鏈鐢熶骇鏁伴噺蹇呴』澶т簬绛変簬1'));
+ callback(new Error("鏈鐢熶骇鏁伴噺蹇呴』澶т簬绛変簬1"));
return;
}
callback();
};
-
+
// 鎶ュ簾鏁伴噺楠岃瘉瑙勫垯
const validateScrapQty = (rule, value, callback) => {
- if (value === null || value === undefined || value === '') {
+ if (value === null || value === undefined || value === "") {
callback();
return;
}
const num = Number(value);
// 鏁存暟涓斿ぇ浜庣瓑浜�0
if (isNaN(num) || !Number.isInteger(num) || num < 0) {
- callback(new Error('鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0'));
+ callback(new Error("鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0"));
return;
}
callback();
};
-
+
// 楠岃瘉瑙勫垯
const reportFormRules = {
- quantity: [
- { required: true, validator: validateQuantity, trigger: 'blur' }
- ],
- scrapQty: [
- { validator: validateScrapQty, trigger: 'blur' }
- ]
+ quantity: [{ required: true, validator: validateQuantity, trigger: "blur" }],
+ scrapQty: [{ validator: validateScrapQty, trigger: "blur" }],
};
-
+
// 澶勭悊鏈鐢熶骇鏁伴噺杈撳叆锛岄檺鍒跺繀椤诲ぇ浜庣瓑浜�1
- const handleQuantityInput = (value) => {
- if (value === '' || value === null || value === undefined) {
+ const handleQuantityInput = value => {
+ if (value === "" || value === null || value === undefined) {
reportForm.quantity = null;
return;
}
@@ -433,10 +432,10 @@
}
reportForm.quantity = num;
};
-
+
// 澶勭悊鎶ュ簾鏁伴噺
- const handleScrapQtyInput = (value) => {
- if (value === '' || value === null || value === undefined) {
+ const handleScrapQtyInput = value => {
+ if (value === "" || value === null || value === undefined) {
reportForm.scrapQty = null;
return;
}
@@ -532,7 +531,9 @@
// 鍒涘缓 Blob URL
const fileBlob =
- blob instanceof Blob ? blob : new Blob([blob], { type: blob.type || "application/octet-stream" });
+ blob instanceof Blob
+ ? blob
+ : new Blob([blob], { type: blob.type || "application/octet-stream" });
const url = window.URL.createObjectURL(fileBlob);
// 鍒涘缓闅愯棌 iframe锛岀敤浜庤Е鍙戞祻瑙堝櫒鎵撳嵃
@@ -596,12 +597,14 @@
const showReportDialog = row => {
currentReportRowData.value = row;
reportForm.planQuantity = row.planQuantity;
- reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
+ reportForm.quantity =
+ row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
reportForm.productProcessRouteItemId = row.productProcessRouteItemId;
reportForm.workOrderId = row.id;
reportForm.reportWork = row.reportWork;
reportForm.productMainId = row.productMainId;
- reportForm.scrapQty = row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
+ reportForm.scrapQty =
+ row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null;
nextTick(() => {
reportFormRef.value?.clearValidate();
});
@@ -610,7 +613,7 @@
.then(res => {
if (res.code === 200) {
reportForm.userId = res.data.userId;
- reportForm.userName = res.data.userName;
+ reportForm.userName = res.data.nickName;
}
})
.catch(err => {
@@ -625,31 +628,38 @@
};
const handleReport = () => {
- reportFormRef.value?.validate((valid) => {
+ reportFormRef.value?.validate(valid => {
if (!valid) {
return false;
}
-
+
if (reportForm.planQuantity <= 0) {
ElMessageBox.alert("寰呯敓浜ф暟閲忎负0锛屾棤娉曟姤宸�", "鎻愮ず", {
confirmButtonText: "纭畾",
});
return;
}
-
+
// 楠岃瘉鏈鐢熶骇鏁伴噺
- if (reportForm.quantity === null || reportForm.quantity === undefined || reportForm.quantity === '') {
+ if (
+ reportForm.quantity === null ||
+ reportForm.quantity === undefined ||
+ reportForm.quantity === ""
+ ) {
ElMessageBox.alert("璇疯緭鍏ユ湰娆$敓浜ф暟閲�", "鎻愮ず", {
confirmButtonText: "纭畾",
});
return;
}
-
+
const quantity = Number(reportForm.quantity);
- const scrapQty = reportForm.scrapQty === null || reportForm.scrapQty === undefined || reportForm.scrapQty === ''
- ? 0
- : Number(reportForm.scrapQty);
-
+ const scrapQty =
+ reportForm.scrapQty === null ||
+ reportForm.scrapQty === undefined ||
+ reportForm.scrapQty === ""
+ ? 0
+ : Number(reportForm.scrapQty);
+
// 鏈鐢熶骇鏁伴噺
if (isNaN(quantity) || !Number.isInteger(quantity) || quantity < 1) {
ElMessageBox.alert("鏈鐢熶骇鏁伴噺蹇呴』澶т簬绛変簬1", "鎻愮ず", {
@@ -657,7 +667,7 @@
});
return;
}
-
+
// 鎶ュ簾鏁伴噺蹇呴』鏄暣鏁颁笖澶т簬绛変簬0
if (isNaN(scrapQty) || !Number.isInteger(scrapQty) || scrapQty < 0) {
ElMessageBox.alert("鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0", "鎻愮ず", {
@@ -665,20 +675,20 @@
});
return;
}
-
+
if (quantity > reportForm.planQuantity) {
ElMessageBox.alert("鏈鐢熶骇鏁伴噺涓嶈兘瓒呰繃寰呯敓浜ф暟閲�", "鎻愮ず", {
confirmButtonText: "纭畾",
});
return;
}
-
+
const submitData = {
...reportForm,
quantity: quantity,
- scrapQty: scrapQty
+ scrapQty: scrapQty,
};
-
+
// console.log(submitData);
addProductMain(submitData).then(res => {
if (res.code === 200) {
@@ -708,11 +718,11 @@
};
// 鐢ㄦ埛閫夋嫨鍙樺寲鏃舵洿鏂� userName
- const handleUserChange = (userId) => {
+ const handleUserChange = userId => {
if (userId) {
const selectedUser = userOptions.value.find(user => user.userId === userId);
if (selectedUser) {
- reportForm.userName = selectedUser.userName;
+ reportForm.userName = selectedUser.nickName;
}
} else {
reportForm.userName = "";
--
Gitblit v1.9.3