From e200b8192f3c9d34645faec0013518f6b70722df Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 05 一月 2026 11:47:17 +0800
Subject: [PATCH] 海川开心: 1.销售管理、仓储物流一些字段赋默认值 2.生产报工改成可以多个报工
---
src/views/productionManagement/productionReporting/index.vue | 17 +-
src/views/inventoryManagement/issueManagement/index.vue | 4
src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue | 2
src/views/salesManagement/salesLedger/index.vue | 11 +
src/views/productionManagement/productionReporting/components/formDia.vue | 295 +++++++++++++++++++++++++++++-------------------
5 files changed, 203 insertions(+), 126 deletions(-)
diff --git a/src/views/inventoryManagement/issueManagement/index.vue b/src/views/inventoryManagement/issueManagement/index.vue
index cafba7a..b4d4b03 100644
--- a/src/views/inventoryManagement/issueManagement/index.vue
+++ b/src/views/inventoryManagement/issueManagement/index.vue
@@ -301,9 +301,9 @@
if (activeTab.value === 'production') {
defaultPersonName = '閭撹幑鑾�'
} else if (activeTab.value === 'purchase') {
- defaultPersonName = '鍚寸帀姊�'
+ defaultPersonName = '浣曠惣鍗�' // 鍘熸枡鍑哄簱榛樿鍙戞枡浜�
} else if (activeTab.value === 'manual') {
- defaultPersonName = '浣曠惣鍗�'
+ defaultPersonName = '鍚寸帀姊�' // 鏉愭枡鍑哄簱榛樿鍙戞枡浜�
}
// 鏌ユ壘瀵瑰簲鐨勭敤鎴稩D
diff --git a/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue b/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
index 77ba73e..43a7760 100644
--- a/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
+++ b/src/views/inventoryManagement/receiptManagement/components/formDiaManual.vue
@@ -164,7 +164,7 @@
id: null,
productCategory: '',
specificationModel: '',
- unit: '',
+ unit: '涓�',
supplierName: form.value.supplierName || '',
itemType: '鐗╂枡',
inboundNum: 0,
diff --git a/src/views/productionManagement/productionReporting/components/formDia.vue b/src/views/productionManagement/productionReporting/components/formDia.vue
index ecb7d81..a10c6ef 100644
--- a/src/views/productionManagement/productionReporting/components/formDia.vue
+++ b/src/views/productionManagement/productionReporting/components/formDia.vue
@@ -7,81 +7,97 @@
draggable
@close="closeDia"
>
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鎺掍骇鏁伴噺锛�" prop="schedulingNum">
- <el-input v-model="form.schedulingNum" placeholder="璇疯緭鍏�" clearable disabled/>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="寰呯敓浜ф暟閲忥細" prop="pendingNum">
- <el-input v-model="form.pendingNum" placeholder="璇疯緭鍏�" clearable disabled/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鏈鐢熶骇鏁伴噺锛�" prop="finishedNum">
- <el-input-number
- v-model="form.finishedNum"
- placeholder="璇疯緭鍏�"
- :min="0"
- :step="0.1"
- :precision="2"
- clearable
- style="width: 100%"
- @change="changeNum"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍗曚环(鍏�)锛�" prop="unitPrice">
- <el-input v-model="form.unitPrice" placeholder="璇疯緭鍏�" clearable @input="calculateTotalPrice"/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鎬讳环(鍏�)锛�" prop="totalPrice">
- <el-input v-model="form.totalPrice" placeholder="璇疯緭鍏�" clearable disabled/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鐢熶骇浜猴細" prop="schedulingUserId">
- <el-select
- v-model="form.schedulingUserId"
- placeholder="閫夋嫨浜哄憳"
- style="width: 100%;"
+ <el-form label-width="140px" label-position="top" :rules="rules" ref="formRef">
+ <el-table
+ :data="reportList"
+ border
+ style="width: 100%"
+ >
+ <el-table-column
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
+ />
+ <el-table-column label="鍚堝悓鍙�" prop="salesContractNo" width="150" />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" width="120" />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="150" />
+ <el-table-column label="鎺掍骇鏁伴噺" prop="schedulingNum" width="100">
+ <template #default="scope">
+ <span>{{ scope.row.schedulingNum }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="寰呯敓浜ф暟閲�" prop="pendingNum" width="100">
+ <template #default="scope">
+ <span>{{ scope.row.pendingNum }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鏈鐢熶骇鏁伴噺" prop="finishedNum" width="150">
+ <template #default="scope">
+ <el-input-number
+ v-model="scope.row.finishedNum"
+ placeholder="璇疯緭鍏�"
+ :min="0"
+ :step="0.1"
+ :precision="2"
+ clearable
+ style="width: 100%"
+ @change="(val) => changeNum(scope.row, val)"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="鍗曚环(鍏�)" prop="unitPrice" width="120">
+ <template #default="scope">
+ <el-input-number
+ v-model="scope.row.unitPrice"
+ placeholder="璇疯緭鍏�"
+ :min="0"
+ :step="0.01"
+ :precision="2"
+ clearable
+ style="width: 100%"
+ @change="() => calculateTotalPrice(scope.row)"
+ />
+ </template>
+ </el-table-column>
+ <el-table-column label="鎬讳环(鍏�)" prop="totalPrice" width="120">
+ <template #default="scope">
+ <span>{{ scope.row.totalPrice || '0.00' }}</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐢熶骇浜�" prop="schedulingUserId" width="150">
+ <template #default="scope">
+ <el-select
+ v-model="scope.row.schedulingUserId"
+ placeholder="閫夋嫨浜哄憳"
+ style="width: 100%;"
filterable
default-first-option
:reserve-keyword="false"
- >
- <el-option
- v-for="user in userList"
- :key="user.userId"
- :label="user.nickName"
- :value="user.userId"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鐢熶骇鏃ユ湡锛�" prop="schedulingDate">
+ >
+ <el-option
+ v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId"
+ />
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column label="鐢熶骇鏃ユ湡" prop="schedulingDate" width="150">
+ <template #default="scope">
<el-date-picker
- v-model="form.schedulingDate"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
+ v-model="scope.row.schedulingDate"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%"
/>
- </el-form-item>
- </el-col>
- </el-row>
+ </template>
+ </el-table-column>
+ </el-table>
</el-form>
<template #footer>
<div class="dialog-footer">
@@ -94,7 +110,7 @@
</template>
<script setup>
-import {ref} from "vue";
+import {ref, reactive, toRefs, getCurrentInstance} from "vue";
import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {productionReport, productionReportUpdate} from "@/api/productionManagement/productionReporting.js";
@@ -104,83 +120,128 @@
const userList = ref([])
const dialogFormVisible = ref(false);
const operationType = ref('')
+const reportList = ref([])
const data = reactive({
- form: {
- successNum: "",
- schedulingNum: "",
- pendingNum: "",
- finishedNum: "",
- schedulingUserId: "",
- schedulingDate: "",
- unitPrice: "",
- totalPrice: "",
- },
rules: {
schedulingNum: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" },],
},
});
-const { form, rules } = toRefs(data);
+const { rules } = toRefs(data);
// 鎵撳紑寮规
-const openDialog = (type, row) => {
+const openDialog = (type, rows) => {
operationType.value = type;
dialogFormVisible.value = true;
userListNoPageByTenantId().then((res) => {
userList.value = res.data;
});
- form.value = {...row}
- const total = Number(row?.schedulingNum ?? 0);
- const pendingFinish = Number(row?.pendingFinishNum ?? 0);
- const autoFill = pendingFinish > 0 ? Math.min(pendingFinish, total) : total;
- form.value.finishedNum = autoFill;
- form.value.pendingNum = Math.max(total - autoFill, 0);
- changeNum(form.value.finishedNum);
+
+ // 澶勭悊澶氭潯鏁版嵁
+ const rowsArray = Array.isArray(rows) ? rows : [rows];
+ reportList.value = rowsArray.map(row => {
+ const total = Number(row?.schedulingNum ?? 0);
+ const pendingFinish = Number(row?.pendingFinishNum ?? 0);
+ const autoFill = pendingFinish > 0 ? Math.min(pendingFinish, total) : total;
+ const unitPrice = row?.unitPrice ? Number(row.unitPrice) : 0.33;
+
+ return {
+ id: row?.id ?? null,
+ salesContractNo: row?.salesContractNo ?? '',
+ productCategory: row?.productCategory ?? '',
+ specificationModel: row?.specificationModel ?? '',
+ schedulingNum: total,
+ pendingNum: Math.max(total - autoFill, 0),
+ finishedNum: autoFill,
+ unitPrice: unitPrice,
+ totalPrice: (autoFill * unitPrice).toFixed(2),
+ schedulingUserId: row?.schedulingUserId ?? '',
+ schedulingDate: row?.schedulingDate ?? '',
+ };
+ });
}
-const changeNum = (value) => {
- if (value > form.value.schedulingNum) {
- form.value.finishedNum = form.value.schedulingNum;
+const changeNum = (row, value) => {
+ if (value > row.schedulingNum) {
+ row.finishedNum = row.schedulingNum;
proxy.$modal.msgWarning('鏈鐢熶骇鏁伴噺涓嶅彲澶т簬鎺掍骇鏁伴噺')
}
- form.value.pendingNum = form.value.schedulingNum - form.value.finishedNum;
- calculateTotalPrice();
+ row.pendingNum = row.schedulingNum - row.finishedNum;
+ calculateTotalPrice(row);
}
// 璁$畻鎬讳环
-const calculateTotalPrice = () => {
- const quantity = Number(form.value.finishedNum ?? 0);
- const unitPrice = Number(form.value.unitPrice ?? 0);
+const calculateTotalPrice = (row) => {
+ const quantity = Number(row.finishedNum ?? 0);
+ const unitPrice = Number(row.unitPrice ?? 0);
if (quantity > 0 && unitPrice > 0) {
- form.value.totalPrice = (quantity * unitPrice).toFixed(2);
+ row.totalPrice = (quantity * unitPrice).toFixed(2);
} else {
- form.value.totalPrice = '0.00';
+ row.totalPrice = '0.00';
}
}
+
// 鎻愪氦浜у搧琛ㄥ崟
const submitForm = () => {
- proxy.$refs.formRef.validate(valid => {
- if (valid) {
- form.value.staffState = 1
- if (operationType.value === "add") {
- productionReport(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
- } else {
- productionReportUpdate(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
- }
- }
- })
+ // 楠岃瘉鏁版嵁
+ for (let i = 0; i < reportList.value.length; i++) {
+ const item = reportList.value[i];
+ if (!item.finishedNum || item.finishedNum <= 0) {
+ proxy.$modal.msgError(`绗�${i + 1}琛屾湰娆$敓浜ф暟閲忛渶澶т簬0`);
+ return;
+ }
+ if (item.finishedNum > item.schedulingNum) {
+ proxy.$modal.msgError(`绗�${i + 1}琛屾湰娆$敓浜ф暟閲忎笉鍙ぇ浜庢帓浜ф暟閲廯);
+ return;
+ }
+ if (!item.schedulingUserId) {
+ proxy.$modal.msgError(`绗�${i + 1}琛岃閫夋嫨鐢熶骇浜篳);
+ return;
+ }
+ if (!item.schedulingDate) {
+ proxy.$modal.msgError(`绗�${i + 1}琛岃閫夋嫨鐢熶骇鏃ユ湡`);
+ return;
+ }
+ }
+
+ // 鏋勫缓鎻愪氦鏁版嵁鏁扮粍
+ const payloadList = reportList.value.map(item => ({
+ id: item.id,
+ finishedNum: Number(item.finishedNum),
+ unitPrice: Number(item.unitPrice || 0.33),
+ totalPrice: Number(item.totalPrice || 0),
+ schedulingUserId: item.schedulingUserId,
+ schedulingDate: item.schedulingDate,
+ }));
+
+ if (operationType.value === "add") {
+ productionReport(payloadList).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ }).catch(err => {
+ console.error('鎻愪氦澶辫触:', err);
+ })
+ } else {
+ // 缂栬緫妯″紡锛岄�愭潯鏇存柊
+ Promise.all(payloadList.map(item => productionReportUpdate(item)))
+ .then(() => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ })
+ .catch(err => {
+ console.error('鎻愪氦澶辫触:', err);
+ proxy.$modal.msgError('鎻愪氦澶辫触锛岃閲嶈瘯');
+ });
+ }
}
// 鍏抽棴寮规
const closeDia = () => {
- proxy.resetForm("formRef");
+ if (proxy.$refs.formRef) {
+ proxy.resetForm("formRef");
+ }
dialogFormVisible.value = false;
+ reportList.value = [];
emit('close')
};
defineExpose({
diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index 731946b..11769fa 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -139,7 +139,7 @@
</template>
<script setup>
-import {onMounted, ref} from "vue";
+import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
import FormDia from "@/views/productionManagement/productionReporting/components/formDia.vue";
import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
import {ElMessageBox} from "element-plus";
@@ -400,16 +400,21 @@
};
// 鎵撳紑寮规
const openForm = (type, row) => {
- if (selectedRows.value.length !== 1) {
- proxy.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�");
+ if (selectedRows.value.length === 0) {
+ proxy.$message.error("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹�");
return;
}
- if (selectedRows.value[0].pendingFinishNum == 0) {
- proxy.$message.warning("鏃犻渶鍐嶆姤宸�");
+ // 杩囨护鎺夊緟鎶ュ伐鏁伴噺涓�0鐨勬暟鎹�
+ const validRows = selectedRows.value.filter(item => item.pendingFinishNum > 0);
+ if (validRows.length === 0) {
+ proxy.$message.warning("鎵�閫夋暟鎹潎鏃犻渶鍐嶆姤宸�");
return;
+ }
+ if (validRows.length < selectedRows.value.length) {
+ proxy.$message.warning(`宸茶繃婊� ${selectedRows.value.length - validRows.length} 鏉℃棤闇�鎶ュ伐鐨勬暟鎹甡);
}
nextTick(() => {
- const rowInfo = type === 'add' ? selectedRows.value[0] : row
+ const rowInfo = type === 'add' ? validRows : (row ? [row] : [])
formDia.value?.openDialog(type, rowInfo)
})
};
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index b2e73d9..6cfbba0 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -778,6 +778,13 @@
if (type === "add") {
// 鏂板鏃惰缃綍鍏ユ棩鏈熶负褰撳ぉ
form.value.entryDate = getCurrentDate();
+ // 涓氬姟鍛橀粯璁や负璁哥孩宄帮紙浠庝笅鎷夋閫夐」涓煡鎵撅級
+ const xuHongFeng = userList.value.find(item => item.nickName === "璁哥孩宄�");
+ if (xuHongFeng) {
+ form.value.salesman = xuHongFeng.nickName;
+ }
+ // 绛捐鏃ユ湡榛樿涓哄綋澶�
+ form.value.executionDate = getCurrentDate();
} else {
currentId.value = row.id;
getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
@@ -875,6 +882,10 @@
if (type === "edit") {
productForm.value = { ...row };
productIndex.value = index;
+ } else {
+ // 鏂板鏃惰缃粯璁ゅ��
+ productForm.value.taxRate = "13"; // 绋庣巼榛樿涓�13%
+ productForm.value.invoiceType = "澧炰笓绁�"; // 鍙戠エ绫诲瀷榛樿涓哄涓撶エ
}
productFormVisible.value = true;
getProductOptions();
--
Gitblit v1.9.3