From 77431c1b49946528520d92323f5ef2d383eb2136 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期五, 18 九月 2026 09:19:36 +0800
Subject: [PATCH] feat(生产核算): 生产核算页面支持成品/白盒部门产量工时折算
---
src/views/productionManagement/productionCosting/index.vue | 722 ++++++++-----------------------
src/api/productionManagement/productionCosting.js | 147 +++++
src/views/productionManagement/productionCosting/components/CostConfigDialog.vue | 414 ++++++++++++++++++
3 files changed, 735 insertions(+), 548 deletions(-)
diff --git a/src/api/productionManagement/productionCosting.js b/src/api/productionManagement/productionCosting.js
index 17ee55a..9fa2dbf 100644
--- a/src/api/productionManagement/productionCosting.js
+++ b/src/api/productionManagement/productionCosting.js
@@ -1,49 +1,154 @@
// 鐢熶骇鏍哥畻椤甸潰鎺ュ彛
import request from "@/utils/request";
-// 鍒嗛〉鏌ヨ
-export function productionAccountingListPage(query) {
+/* ===================== 鏍哥畻鏌ヨ ===================== */
+
+// 鎸夊憳宸ユ眹鎬伙紙浜ч噺銆佹湀鏃堕棿鍚堣銆佹姌鍚堝�嶆暟锛�
+export function costingSummary(query) {
return request({
- url: "/salesLedger/productionAccounting/listPage",
+ url: "/productionCosting/summary",
method: "get",
params: query,
});
}
-// 宸﹁竟琛ㄦ牸鐨勬帴鍙�
-// salesLedger/productionAccounting/page
-export function salesLedgerProductionAccountingList(query) {
+// 鏄庣粏锛堢櫧鐩掞細宸ュ簭+鍨嬪彿锛涙垚鍝侊細宸ュ簭锛�
+export function costingDetail(query) {
return request({
- url: "/productionAccount/listPage",
+ url: "/productionCosting/detail",
method: "get",
params: query,
});
}
-// 鍙宠竟琛ㄦ牸鐨勬帴鍙�
-//
-export function salesLedgerProductionAccountingListProductionDetails(query) {
+// 鏈堜唤宸ヤ綔鏃ヤ俊鎭�
+export function costingWorkday(yearMonth) {
return request({
- url: "/productionAccount/listProductionDetails",
+ url: "/productionCosting/workday",
method: "get",
- params: query,
+ params: { yearMonth },
});
}
-// 鎵归噺鏍哥畻
-export function productionAccountingBatchAccounting(data) {
+// 瀵煎嚭鏄庣粏
+export function costingExport(query) {
return request({
- url: "/productionAccount/batchAccounting",
+ url: "/productionCosting/export",
method: "post",
- data,
+ params: query,
+ responseType: "blob",
});
}
-// 鍗曚釜淇
-export function productionAccountingSingleAdjust(data) {
+/* ===================== 閮ㄩ棬绫诲瀷閰嶇疆 ===================== */
+
+export function costingDeptList() {
+ return request({ url: "/productionCosting/dept/list", method: "get" });
+}
+
+export function costingDeptAdd(data) {
+ return request({ url: "/productionCosting/dept", method: "post", data });
+}
+
+export function costingDeptUpdate(data) {
+ return request({ url: "/productionCosting/dept", method: "put", data });
+}
+
+export function costingDeptDel(id) {
+ return request({ url: "/productionCosting/dept/" + id, method: "delete" });
+}
+
+/* ===================== 鏍囧噯鏁伴噺閰嶇疆 ===================== */
+
+export function costingStandardList(query) {
return request({
- url: "/productionAccount/singleAdjust",
- method: "post",
- data,
+ url: "/productionCosting/standard/list",
+ method: "get",
+ params: query,
+ });
+}
+
+export function costingStandardAdd(data) {
+ return request({ url: "/productionCosting/standard", method: "post", data });
+}
+
+export function costingStandardUpdate(data) {
+ return request({ url: "/productionCosting/standard", method: "put", data });
+}
+
+export function costingStandardDel(id) {
+ return request({ url: "/productionCosting/standard/" + id, method: "delete" });
+}
+
+/* ===================== 鎶樼畻鐜囬厤缃� ===================== */
+
+export function costingFactorList(query) {
+ return request({
+ url: "/productionCosting/factor/list",
+ method: "get",
+ params: query,
+ });
+}
+
+export function costingFactorAdd(data) {
+ return request({ url: "/productionCosting/factor", method: "post", data });
+}
+
+export function costingFactorUpdate(data) {
+ return request({ url: "/productionCosting/factor", method: "put", data });
+}
+
+export function costingFactorDel(id) {
+ return request({ url: "/productionCosting/factor/" + id, method: "delete" });
+}
+
+/* ===================== 鏈堝害宸ヤ綔鏃ラ厤缃� ===================== */
+
+export function costingWorkdayList(query) {
+ return request({
+ url: "/productionCosting/workdayConfig/list",
+ method: "get",
+ params: query,
+ });
+}
+
+export function costingWorkdayAdd(data) {
+ return request({ url: "/productionCosting/workdayConfig", method: "post", data });
+}
+
+export function costingWorkdayUpdate(data) {
+ return request({ url: "/productionCosting/workdayConfig", method: "put", data });
+}
+
+export function costingWorkdayDel(id) {
+ return request({ url: "/productionCosting/workdayConfig/" + id, method: "delete" });
+}
+
+/* ===================== 涓嬫媺鏁版嵁婧� ===================== */
+
+// 宸ュ簭涓嬫媺
+export function costingProcessOptions(query) {
+ return request({
+ url: "/technologyOperation/listPage",
+ method: "get",
+ params: { current: 1, size: 1000, ...query },
+ });
+}
+
+// 鍨嬪彿涓嬫媺
+export function costingModelOptions(query) {
+ return request({
+ url: "/basic/product/pageModel",
+ method: "get",
+ params: { current: 1, size: 1000, ...query },
+ });
+}
+
+// 閮ㄩ棬涓嬫媺
+export function costingDeptOptions(query) {
+ return request({
+ url: "/system/dept/list",
+ method: "get",
+ params: query,
});
}
diff --git a/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue b/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue
new file mode 100644
index 0000000..51c927b
--- /dev/null
+++ b/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue
@@ -0,0 +1,414 @@
+<template>
+ <el-dialog
+ v-model="visible"
+ title="鐢熶骇鏍哥畻閰嶇疆"
+ width="900px"
+ append-to-body
+ @close="handleClose"
+ >
+ <el-tabs v-model="activeTab">
+ <!-- 閮ㄩ棬绫诲瀷閰嶇疆 -->
+ <el-tab-pane label="閮ㄩ棬绫诲瀷" name="dept">
+ <div class="tab-toolbar">
+ <el-button type="primary" size="small" @click="openDeptForm()">鏂板</el-button>
+ </div>
+ <el-table :data="deptList" border size="small" max-height="420">
+ <el-table-column label="閮ㄩ棬" prop="deptName" min-width="140" />
+ <el-table-column label="绫诲瀷" min-width="110">
+ <template #default="{ row }">{{ deptTypeText(row.deptType) }}</template>
+ </el-table-column>
+ <el-table-column label="澶囨敞" prop="remark" min-width="160" />
+ <el-table-column label="鎿嶄綔" width="140" fixed="right">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="openDeptForm(row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="removeDept(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+
+ <!-- 鏍囧噯鏁伴噺閰嶇疆 -->
+ <el-tab-pane label="鏍囧噯鏁伴噺" name="standard">
+ <div class="tab-toolbar">
+ <el-select v-model="standardQuery.deptType" placeholder="閮ㄩ棬绫诲瀷" clearable size="small" style="width: 140px" @change="loadStandard">
+ <el-option label="鎴愬搧閮ㄩ棬" :value="1" />
+ <el-option label="鐧界洅閮ㄩ棬" :value="2" />
+ </el-select>
+ <el-button type="primary" size="small" @click="openStandardForm()">鏂板</el-button>
+ </div>
+ <el-table :data="standardList" border size="small" max-height="400">
+ <el-table-column label="閮ㄩ棬绫诲瀷" min-width="100">
+ <template #default="{ row }">{{ deptTypeText(row.deptType) }}</template>
+ </el-table-column>
+ <el-table-column label="宸ュ簭" prop="processName" min-width="110" />
+ <el-table-column label="鍨嬪彿" prop="modelName" min-width="140" />
+ <el-table-column label="鏍囧噯鏁伴噺" prop="standardQuantity" min-width="100" />
+ <el-table-column label="鍗曚綅" prop="unit" min-width="80" />
+ <el-table-column label="鎿嶄綔" width="140" fixed="right">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="openStandardForm(row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="removeStandard(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+
+ <!-- 鎶樼畻鐜囬厤缃� -->
+ <el-tab-pane label="鎶樼畻鐜�" name="factor">
+ <div class="tab-toolbar">
+ <el-select v-model="factorQuery.processId" placeholder="宸ュ簭" clearable filterable size="small" style="width: 180px" @change="loadFactor">
+ <el-option v-for="p in processOptions" :key="p.id" :label="p.name" :value="p.id" />
+ </el-select>
+ <el-button type="primary" size="small" @click="openFactorForm()">鏂板</el-button>
+ </div>
+ <el-table :data="factorList" border size="small" max-height="400">
+ <el-table-column label="宸ュ簭" prop="processName" min-width="110" />
+ <el-table-column label="鍛樺伐" prop="staffName" min-width="110" />
+ <el-table-column label="灏忔彁鐞存姌绠楃巼" prop="violinFactor" min-width="110" />
+ <el-table-column label="澶ф彁鐞存姌绠楃巼" prop="violaFactor" min-width="110" />
+ <el-table-column label="璐濇柉鎶樼畻鐜�" prop="bassFactor" min-width="100" />
+ <el-table-column label="鎿嶄綔" width="140" fixed="right">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="openFactorForm(row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="removeFactor(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+
+ <!-- 鏈堝害宸ヤ綔鏃ラ厤缃� -->
+ <el-tab-pane label="鏈堝害宸ヤ綔鏃�" name="workday">
+ <div class="tab-toolbar">
+ <el-button type="primary" size="small" @click="openWorkdayForm()">鏂板</el-button>
+ <span class="tip">鏈厤缃殑鏈堜唤榛樿鎸夆�滃懆涓�~鍛ㄤ簲鈥濊绠�</span>
+ </div>
+ <el-table :data="workdayList" border size="small" max-height="400">
+ <el-table-column label="骞存湀" prop="yearMonth" min-width="110" />
+ <el-table-column label="宸ヤ綔鏃�(澶�)" prop="workDays" min-width="100" />
+ <el-table-column label="婊″嫟宸ユ椂(灏忔椂)" min-width="120">
+ <template #default="{ row }">{{ (row.workDays || 0) * 8 }}</template>
+ </el-table-column>
+ <el-table-column label="澶囨敞" prop="remark" min-width="160" />
+ <el-table-column label="鎿嶄綔" width="140" fixed="right">
+ <template #default="{ row }">
+ <el-button link type="primary" @click="openWorkdayForm(row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="removeWorkday(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
+
+ <!-- 閮ㄩ棬绫诲瀷琛ㄥ崟 -->
+ <el-dialog v-model="deptFormVisible" :title="deptForm.id ? '缂栬緫閮ㄩ棬绫诲瀷' : '鏂板閮ㄩ棬绫诲瀷'" width="420px" append-to-body>
+ <el-form :model="deptForm" label-width="90px">
+ <el-form-item label="閮ㄩ棬" required>
+ <el-select v-model="deptForm.deptId" placeholder="璇烽�夋嫨閮ㄩ棬" filterable style="width: 100%">
+ <el-option v-for="d in deptOptions" :key="d.deptId" :label="d.deptName" :value="d.deptId" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="绫诲瀷" required>
+ <el-select v-model="deptForm.deptType" placeholder="璇烽�夋嫨绫诲瀷" style="width: 100%">
+ <el-option label="鎴愬搧閮ㄩ棬" :value="1" />
+ <el-option label="鐧界洅閮ㄩ棬" :value="2" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="澶囨敞">
+ <el-input v-model="deptForm.remark" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="deptFormVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitDept">纭</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- 鏍囧噯鏁伴噺琛ㄥ崟 -->
+ <el-dialog v-model="standardFormVisible" :title="standardForm.id ? '缂栬緫鏍囧噯鏁伴噺' : '鏂板鏍囧噯鏁伴噺'" width="460px" append-to-body>
+ <el-form :model="standardForm" label-width="90px">
+ <el-form-item label="閮ㄩ棬绫诲瀷" required>
+ <el-select v-model="standardForm.deptType" placeholder="璇烽�夋嫨" style="width: 100%">
+ <el-option label="鎴愬搧閮ㄩ棬" :value="1" />
+ <el-option label="鐧界洅閮ㄩ棬" :value="2" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="宸ュ簭" required>
+ <el-select v-model="standardForm.processId" placeholder="璇烽�夋嫨宸ュ簭" filterable style="width: 100%">
+ <el-option v-for="p in processOptions" :key="p.id" :label="p.name" :value="p.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍨嬪彿" :required="standardForm.deptType === 2">
+ <el-select v-model="standardForm.productModelId" placeholder="鐧界洅蹇呭~" filterable clearable style="width: 100%">
+ <el-option v-for="m in modelOptions" :key="m.id" :label="m.model + '锛�' + (m.productName || '') + '锛�'" :value="m.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鏍囧噯鏁伴噺" required>
+ <el-input-number v-model="standardForm.standardQuantity" :min="0" :precision="4" style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="鍗曚綅">
+ <el-input v-model="standardForm.unit" />
+ </el-form-item>
+ <el-form-item label="澶囨敞">
+ <el-input v-model="standardForm.remark" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="standardFormVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitStandard">纭</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- 鎶樼畻鐜囪〃鍗� -->
+ <el-dialog v-model="factorFormVisible" :title="factorForm.id ? '缂栬緫鎶樼畻鐜�' : '鏂板鎶樼畻鐜�'" width="460px" append-to-body>
+ <el-form :model="factorForm" label-width="110px">
+ <el-form-item label="宸ュ簭" required>
+ <el-select v-model="factorForm.processId" placeholder="璇烽�夋嫨宸ュ簭" filterable style="width: 100%">
+ <el-option v-for="p in processOptions" :key="p.id" :label="p.name" :value="p.id" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鍛樺伐" required>
+ <el-select v-model="factorForm.staffId" placeholder="璇烽�夋嫨鍛樺伐" filterable style="width: 100%" @change="onStaffChange">
+ <el-option v-for="u in staffOptions" :key="u.userId" :label="u.nickName || u.userName" :value="u.userId" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="灏忔彁鐞存姌绠楃巼">
+ <el-input-number v-model="factorForm.violinFactor" :min="0" :precision="4" style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="澶ф彁鐞存姌绠楃巼">
+ <el-input-number v-model="factorForm.violaFactor" :min="0" :precision="4" style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="璐濇柉鎶樼畻鐜�">
+ <el-input-number v-model="factorForm.bassFactor" :min="0" :precision="4" style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="澶囨敞">
+ <el-input v-model="factorForm.remark" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="factorFormVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitFactor">纭</el-button>
+ </template>
+ </el-dialog>
+
+ <!-- 鏈堝害宸ヤ綔鏃ヨ〃鍗� -->
+ <el-dialog v-model="workdayFormVisible" :title="workdayForm.id ? '缂栬緫鏈堝害宸ヤ綔鏃�' : '鏂板鏈堝害宸ヤ綔鏃�'" width="420px" append-to-body>
+ <el-form :model="workdayForm" label-width="110px">
+ <el-form-item label="骞存湀" required>
+ <el-date-picker v-model="workdayForm.yearMonth" type="month" value-format="YYYY-MM" placeholder="璇烽�夋嫨骞存湀" style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="宸ヤ綔鏃�(澶�)" required>
+ <el-input-number v-model="workdayForm.workDays" :min="0" :max="31" :precision="0" style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="澶囨敞">
+ <el-input v-model="workdayForm.remark" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="workdayFormVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitWorkday">纭</el-button>
+ </template>
+ </el-dialog>
+ </el-dialog>
+</template>
+
+<script setup>
+ import { ref, reactive, getCurrentInstance } from "vue";
+ import request from "@/utils/request";
+ import {
+ costingDeptList,
+ costingDeptAdd,
+ costingDeptUpdate,
+ costingDeptDel,
+ costingStandardList,
+ costingStandardAdd,
+ costingStandardUpdate,
+ costingStandardDel,
+ costingFactorList,
+ costingFactorAdd,
+ costingFactorUpdate,
+ costingFactorDel,
+ costingWorkdayList,
+ costingWorkdayAdd,
+ costingWorkdayUpdate,
+ costingWorkdayDel,
+ costingProcessOptions,
+ costingModelOptions,
+ costingDeptOptions,
+ } from "@/api/productionManagement/productionCosting.js";
+
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
+
+ const visible = ref(false);
+ const activeTab = ref("dept");
+
+ const deptList = ref([]);
+ const standardList = ref([]);
+ const factorList = ref([]);
+ const workdayList = ref([]);
+ const processOptions = ref([]);
+ const modelOptions = ref([]);
+ const deptOptions = ref([]);
+ const staffOptions = ref([]);
+
+ const standardQuery = reactive({ deptType: undefined });
+ const factorQuery = reactive({ processId: undefined });
+
+ const deptTypeText = v => (v === 1 ? "鎴愬搧閮ㄩ棬" : v === 2 ? "鐧界洅閮ㄩ棬" : "-");
+
+ /* ---------- 鍔犺浇 ---------- */
+ const loadDept = () => costingDeptList().then(res => (deptList.value = res.data || []));
+ const loadStandard = () =>
+ costingStandardList({ ...standardQuery }).then(res => (standardList.value = res.data || []));
+ const loadFactor = () =>
+ costingFactorList({ ...factorQuery }).then(res => (factorList.value = res.data || []));
+ const loadWorkday = () => costingWorkdayList().then(res => (workdayList.value = res.data || []));
+
+ const loadOptions = () => {
+ costingProcessOptions().then(res => {
+ processOptions.value = res?.data?.records || [];
+ });
+ costingModelOptions().then(res => {
+ modelOptions.value = res?.records || [];
+ });
+ costingDeptOptions().then(res => {
+ deptOptions.value = res?.data || [];
+ });
+ request({ url: "/system/user/list", method: "get", params: { pageNum: 1, pageSize: 1000 } }).then(res => {
+ staffOptions.value = res?.rows || [];
+ });
+ };
+
+ const openDialog = () => {
+ visible.value = true;
+ loadOptions();
+ loadDept();
+ loadStandard();
+ loadFactor();
+ loadWorkday();
+ };
+ const handleClose = () => emit("close");
+
+ /* ---------- 閮ㄩ棬绫诲瀷 ---------- */
+ const deptFormVisible = ref(false);
+ const deptForm = reactive({ id: null, deptId: null, deptType: 1, remark: "" });
+ const openDeptForm = row => {
+ Object.assign(deptForm, { id: null, deptId: null, deptType: 1, remark: "" }, row || {});
+ deptFormVisible.value = true;
+ };
+ const submitDept = () => {
+ if (!deptForm.deptId || !deptForm.deptType) return proxy.$modal.msgWarning("璇峰~鍐欓儴闂ㄤ笌绫诲瀷");
+ const fn = deptForm.id ? costingDeptUpdate : costingDeptAdd;
+ fn({ ...deptForm }).then(() => {
+ proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ deptFormVisible.value = false;
+ loadDept();
+ });
+ };
+ const removeDept = row => {
+ proxy.$modal.confirm("纭鍒犻櫎璇ラ厤缃悧锛�").then(() => costingDeptDel(row.id)).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ loadDept();
+ }).catch(() => {});
+ };
+
+ /* ---------- 鏍囧噯鏁伴噺 ---------- */
+ const standardFormVisible = ref(false);
+ const standardForm = reactive({
+ id: null, deptType: 1, processId: null, productModelId: null, standardQuantity: 0, unit: "", remark: "",
+ });
+ const openStandardForm = row => {
+ Object.assign(standardForm, {
+ id: null, deptType: standardQuery.deptType || 1, processId: null, productModelId: null,
+ standardQuantity: 0, unit: "", remark: "",
+ }, row || {});
+ standardFormVisible.value = true;
+ };
+ const submitStandard = () => {
+ if (!standardForm.deptType || !standardForm.processId) return proxy.$modal.msgWarning("璇峰~鍐欓儴闂ㄧ被鍨嬩笌宸ュ簭");
+ if (standardForm.deptType === 2 && !standardForm.productModelId) return proxy.$modal.msgWarning("鐧界洅閮ㄩ棬蹇呴』閫夋嫨鍨嬪彿");
+ const fn = standardForm.id ? costingStandardUpdate : costingStandardAdd;
+ fn({ ...standardForm }).then(() => {
+ proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ standardFormVisible.value = false;
+ loadStandard();
+ });
+ };
+ const removeStandard = row => {
+ proxy.$modal.confirm("纭鍒犻櫎璇ラ厤缃悧锛�").then(() => costingStandardDel(row.id)).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ loadStandard();
+ }).catch(() => {});
+ };
+
+ /* ---------- 鎶樼畻鐜� ---------- */
+ const factorFormVisible = ref(false);
+ const factorForm = reactive({
+ id: null, processId: null, staffId: null, staffName: "", violinFactor: 1, violaFactor: 1, bassFactor: 1, remark: "",
+ });
+ const openFactorForm = row => {
+ Object.assign(factorForm, {
+ id: null, processId: factorQuery.processId || null, staffId: null, staffName: "",
+ violinFactor: 1, violaFactor: 1, bassFactor: 1, remark: "",
+ }, row || {});
+ factorFormVisible.value = true;
+ };
+ const onStaffChange = id => {
+ const u = staffOptions.value.find(s => s.userId === id);
+ factorForm.staffName = u ? u.nickName || u.userName : "";
+ };
+ const submitFactor = () => {
+ if (!factorForm.processId || !factorForm.staffId) return proxy.$modal.msgWarning("璇峰~鍐欏伐搴忎笌鍛樺伐");
+ const fn = factorForm.id ? costingFactorUpdate : costingFactorAdd;
+ fn({ ...factorForm }).then(() => {
+ proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ factorFormVisible.value = false;
+ loadFactor();
+ });
+ };
+ const removeFactor = row => {
+ proxy.$modal.confirm("纭鍒犻櫎璇ラ厤缃悧锛�").then(() => costingFactorDel(row.id)).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ loadFactor();
+ }).catch(() => {});
+ };
+
+ /* ---------- 鏈堝害宸ヤ綔鏃� ---------- */
+ const workdayFormVisible = ref(false);
+ const workdayForm = reactive({ id: null, yearMonth: "", workDays: 22, remark: "" });
+ const openWorkdayForm = row => {
+ Object.assign(workdayForm, { id: null, yearMonth: "", workDays: 22, remark: "" }, row || {});
+ workdayFormVisible.value = true;
+ };
+ const submitWorkday = () => {
+ if (!workdayForm.yearMonth) return proxy.$modal.msgWarning("璇烽�夋嫨骞存湀");
+ if (workdayForm.workDays == null) return proxy.$modal.msgWarning("璇峰~鍐欏伐浣滄棩澶╂暟");
+ const fn = workdayForm.id ? costingWorkdayUpdate : costingWorkdayAdd;
+ fn({ ...workdayForm }).then(() => {
+ proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ workdayFormVisible.value = false;
+ loadWorkday();
+ });
+ };
+ const removeWorkday = row => {
+ proxy.$modal.confirm("纭鍒犻櫎璇ラ厤缃悧锛�").then(() => costingWorkdayDel(row.id)).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ loadWorkday();
+ }).catch(() => {});
+ };
+
+ defineExpose({ openDialog });
+</script>
+
+<style scoped>
+ .tab-toolbar {
+ display: flex;
+ gap: 10px;
+ margin-bottom: 10px;
+ }
+ .tip {
+ color: #909399;
+ font-size: 12px;
+ line-height: 32px;
+ }
+</style>
diff --git a/src/views/productionManagement/productionCosting/index.vue b/src/views/productionManagement/productionCosting/index.vue
index 8330f34..d19462b 100644
--- a/src/views/productionManagement/productionCosting/index.vue
+++ b/src/views/productionManagement/productionCosting/index.vue
@@ -1,579 +1,247 @@
<template>
<div class="app-container">
- <div class="table_list">
- <el-row :gutter="16"
- class="content-row">
- <!-- 宸︿晶鍙拌处 + 椤堕儴绛涢�� -->
- <el-col :xs="24"
- :sm="24"
- :md="24"
- :lg="8"
- :xl="8"
- class="left-col">
- <div class="left-panel">
- <el-alert
- title="宸ヨ祫鏍哥畻鍙e緞锛氫粎缁熻瀹℃牳閫氳繃鐨勬姤宸ユ暟鎹��"
- type="info"
- :closable="false"
- show-icon
- />
- <div class="left-header">
- <el-form :model="searchForm"
- inline>
- <el-form-item label="鎶ュ伐浜哄憳锛�">
- <el-input v-model="searchForm.schedulingUserName"
- placeholder="璇疯緭鍏�"
- clearable
- style="width: 160px"
- @change="reloadData" />
- </el-form-item>
- <el-form-item label="宸ュ崟缂栧彿锛�">
- <el-input v-model="searchForm.workOrderNo"
- placeholder="璇疯緭鍏�"
- clearable
- style="width: 160px"
- @change="reloadData" />
- </el-form-item>
- <el-form-item prop="dateType">
- <el-radio-group v-model="searchForm.dateType"
- size="small"
- @change="handleDateTypeChange">
- <el-radio-button label="day">鏃�</el-radio-button>
- <el-radio-button label="month">鏈�</el-radio-button>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="鏃ユ湡锛�"
- prop="dateRange">
- <el-date-picker v-model="searchForm.dateRange"
- :type="searchForm.dateType === 'day' ? 'date' : 'daterange'"
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- format="YYYY-MM-DD"
- value-format="YYYY-MM-DD"
- style="width: 200px"
- @change="handleDateRangeChange" />
- </el-form-item>
- </el-form>
- </div>
- <PIMTable rowKey="id"
- :column="leftTableColumn"
- :tableData="leftTableData"
- :tableLoading="tableLoading"
- :page="page"
- @row-click="handleLeftRowClick"
- @pagination="pagination"></PIMTable>
- </div>
- </el-col>
- <!-- 鍙充晶鏄庣粏 -->
- <el-col :xs="24"
- :sm="24"
- :md="24"
- :lg="16"
- :xl="16"
- class="right-col">
- <div class="right-panel">
- <div class="right-toolbar">
- <el-button type="primary" @click="handleBatchAccounting">鎵归噺鏍哥畻</el-button>
- </div>
- <PIMTable rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :page="page1"
- :isSelection="true"
- @selection-change="handleSelectionChange"
- :tableLoading="tableLoading1"
- style="margin-right: 20px;"
- @pagination="pagination1"></PIMTable>
- </div>
- </el-col>
- </el-row>
- </div>
- <el-dialog v-model="adjustDialogVisible"
- title="鍗曚釜淇"
- width="520px">
- <el-form :model="adjustForm" label-width="120px">
- <el-form-item label="鎶ュ伐鍗曞彿">
- <el-input v-model="adjustForm.reportNo" disabled />
+ <!-- 椤堕儴绛涢�� + 淇℃伅 -->
+ <el-card shadow="never" class="filter-card">
+ <el-form :model="searchForm" inline>
+ <el-form-item label="閮ㄩ棬锛�">
+ <el-radio-group v-model="searchForm.deptType" @change="handleQuery">
+ <el-radio-button :label="1">鎴愬搧閮ㄩ棬</el-radio-button>
+ <el-radio-button :label="2">鐧界洅閮ㄩ棬</el-radio-button>
+ </el-radio-group>
</el-form-item>
- <el-form-item label="鎶ュ伐浜哄憳">
- <el-input v-model="adjustForm.schedulingUserName" disabled />
+ <el-form-item label="鏈堜唤锛�">
+ <el-date-picker
+ v-model="searchForm.yearMonth"
+ type="month"
+ value-format="YYYY-MM"
+ placeholder="璇烽�夋嫨鏈堜唤"
+ style="width: 160px"
+ @change="handleQuery"
+ />
</el-form-item>
- <el-form-item label="淇閲戦">
- <el-input-number v-model="adjustForm.wages" :min="0" :precision="2" style="width: 100%" />
+ <el-form-item label="鐢熶骇浜猴細">
+ <el-input
+ v-model="searchForm.staffName"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 160px"
+ @keyup.enter="handleQuery"
+ @clear="handleQuery"
+ />
</el-form-item>
- <el-form-item label="淇璇存槑">
- <el-input v-model="adjustForm.remark" type="textarea" :rows="3" />
+ <el-form-item>
+ <el-button type="primary" icon="Search" @click="handleQuery">鎼滅储</el-button>
+ <el-button icon="Setting" @click="openConfig">閰嶇疆</el-button>
+ <el-button icon="Download" @click="handleExport">瀵煎嚭</el-button>
</el-form-item>
</el-form>
- <template #footer>
- <el-button @click="adjustDialogVisible = false">鍙栨秷</el-button>
- <el-button type="primary" @click="confirmAdjust">纭</el-button>
- </template>
- </el-dialog>
+ <el-alert
+ :title="infoText"
+ type="info"
+ :closable="false"
+ show-icon
+ />
+ </el-card>
+
+ <el-row :gutter="16" class="content-row">
+ <!-- 宸︼細鎸夊憳宸ユ眹鎬� -->
+ <el-col :xs="24" :sm="24" :md="24" :lg="9" :xl="9">
+ <div class="panel-title">姹囨�诲彴璐︼紙{{ searchForm.deptType === 1 ? '鎴愬搧閮ㄩ棬' : '鐧界洅閮ㄩ棬' }}锛�</div>
+ <PIMTable
+ rowKey="staffId"
+ :column="summaryColumns"
+ :tableData="summaryData"
+ :tableLoading="loading"
+ :isShowPagination="false"
+ :highlightCurrentRow="true"
+ @row-click="handleSummaryRowClick"
+ />
+ </el-col>
+ <!-- 鍙筹細鏄庣粏 -->
+ <el-col :xs="24" :sm="24" :md="24" :lg="15" :xl="15">
+ <div class="panel-title">
+ 鏄庣粏{{ detailStaffName ? '锛�' + detailStaffName + '锛�' : '' }}
+ </div>
+ <PIMTable
+ rowKey="rowKey"
+ :column="detailColumns"
+ :tableData="detailData"
+ :tableLoading="loadingDetail"
+ :isShowPagination="false"
+ />
+ </el-col>
+ </el-row>
+
+ <!-- 閰嶇疆寮圭獥 -->
+ <CostConfigDialog ref="configDialog" @close="handleQuery" />
</div>
</template>
<script setup>
- import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue";
- import { ElMessageBox } from "element-plus";
- import dayjs from "dayjs";
+ import { onMounted, ref, reactive, computed, getCurrentInstance } from "vue";
+ import CostConfigDialog from "./components/CostConfigDialog.vue";
import {
- salesLedgerProductionAccountingListProductionDetails,
- salesLedgerProductionAccountingList,
- productionAccountingBatchAccounting,
- productionAccountingSingleAdjust,
+ costingSummary,
+ costingDetail,
+ costingWorkday,
} from "@/api/productionManagement/productionCosting.js";
+
const { proxy } = getCurrentInstance();
-
- const formatTag = (val, map) => {
- const item = map[String(val)];
- if (!item) return "-";
- return item.label;
- };
-
- const tableColumn = ref([
- {
- label: "鎶ュ伐鍗曞彿",
- prop: "reportNo",
- minWidth: 140,
- },
- {
- label: "鐢熶骇鏃ユ湡",
- prop: "schedulingDate",
- minWidth: 100,
- },
- {
- label: "鐢熶骇浜�",
- prop: "schedulingUserName",
- minWidth: 100,
- },
- {
- label: "瀹℃牳鐘舵��",
- prop: "auditStatus",
- minWidth: 100,
- dataType: "tag",
- formatData: val => formatTag(val, {
- 0: { label: "寰呭鏍�" },
- 1: { label: "瀹℃牳閫氳繃" },
- 2: { label: "瀹℃牳涓嶉�氳繃" },
- }),
- formatType: val => {
- const typeMap = {
- 0: "warning",
- 1: "success",
- 2: "danger",
- };
- return typeMap[String(val)] || "info";
- },
- },
- {
- label: "鎶ュ伐绫诲瀷",
- prop: "reportType",
- minWidth: 100,
- dataType: "tag",
- formatData: val => formatTag(val, {
- 0: { label: "鍚堟牸" },
- 1: { label: "杞诲井杩斿伐" },
- 2: { label: "涓ラ噸杩斿伐" },
- 3: { label: "鎶ュ簾" },
- }),
- formatType: val => {
- const typeMap = {
- 0: "success",
- 1: "warning",
- 2: "danger",
- 3: "info",
- };
- return typeMap[String(val)] || "info";
- },
- },
- {
- label: "閿�鍞悎鍚屽彿",
- prop: "salesContractNo",
- minWidth: 140,
- },
- {
- label: "浜у搧澶х被",
- prop: "productName",
- minWidth: 100,
- },
- {
- label: "浜у搧鏍囧噯鏁伴噺",
- prop: "productStandardQuantity",
- minWidth: 120,
- },
- {
- label: "瑙勬牸鍨嬪彿",
- prop: "productModelName",
- minWidth: 100,
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- minWidth: 100,
- },
- {
- label: "宸ュ簭",
- prop: "process",
- minWidth: 100,
- },
- {
- label: "鏍囧噯鏁伴噺",
- prop: "standardQuantity",
- minWidth: 100,
- },
- {
- label: "宸ュ崟缂栧彿",
- prop: "workOrderNo",
- minWidth: 140,
- },
- {
- label: "琛ヤ慨鐞嗗伐鏃�",
- prop: "repairWorkHour",
- minWidth: 120,
- },
- {
- label: "鐢熶骇鏁伴噺",
- prop: "quantity",
- minWidth: 100,
- },
- {
- label: "鎶樼畻宸ユ椂",
- prop: "convertedWorkHours",
- minWidth: 100,
- },
- ]);
-
- // 宸︿晶姹囨�诲彴璐﹀垪锛堢敓浜т汉銆佷骇閲忋�佸伐璧勩�佸悎鏍肩巼锛�
- const leftTableColumn = ref([
- {
- label: "鐢熶骇浜�",
- prop: "schedulingUserName",
- minWidth: 100,
- },
- {
- label: "浜ч噺",
- prop: "finishedNum",
- minWidth: 100,
- },
- {
- label: "鎶樼畻宸ユ椂鍚堣",
- prop: "workHours",
- minWidth: 100,
- },
- {
- label: "鍚堟牸鐜�",
- prop: "outputRate",
- minWidth: 100,
- formatData: val => {
- if (val == null || val === "") return "-";
- return parseFloat(val).toFixed(2) + "%";
- },
- },
- ]);
-
- const tableData = ref([]);
- const tableLoading = ref(false);
- const tableLoading1 = ref(false);
- const leftTableData = ref([]);
- const selectedRows = ref([]);
- const adjustDialogVisible = ref(false);
- const adjustForm = reactive({
- id: null,
- reportNo: "",
- schedulingUserName: "",
- wages: 0,
- remark: "",
- });
- // 鏃� / 鏈� 鍒囨崲锛堥粯璁ゆ寜鏃ワ級
- const page = reactive({
- current: 1,
- size: 100,
- total: 0,
- });
-
- const page1 = reactive({
- current: 1,
- size: 100,
- total: 0,
- });
const data = reactive({
searchForm: {
- schedulingUserName: "",
- workOrderNo: "",
- salesContractNo: "",
- dateType: "day",
- dateRange: dayjs().format("YYYY-MM-DD"),
- entryDate: dayjs().format("YYYY-MM-DD"),
- entryDateStart: undefined,
- entryDateEnd: undefined,
+ deptType: 1,
+ yearMonth: "",
+ staffName: "",
},
});
- const { searchForm } = toRefs(data);
+ const { searchForm } = data;
- const pagination = obj => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
- };
+ const summaryData = ref([]);
+ const detailData = ref([]);
+ const loading = ref(false);
+ const loadingDetail = ref(false);
+ const detailStaffName = ref("");
+ const workInfo = reactive({ workDays: 0, dayHours: 8, monthHours: 0 });
- const pagination1 = obj => {
- page1.current = obj.page;
- page1.size = obj.limit;
- getList1();
- };
+ const configDialog = ref();
- const handleSelectionChange = selection => {
- selectedRows.value = selection || [];
- };
+ const infoText = computed(
+ () =>
+ `褰撴湀宸ヤ綔鏃� ${workInfo.workDays} 澶� 路 姣忔棩 ${workInfo.dayHours} 灏忔椂 路 婊″嫟宸ユ椂 ${workInfo.monthHours} 灏忔椂锛堟姌鍚堝�嶆暟 = 鏈堟椂闂村悎璁� 梅 (宸ヤ綔鏃� 脳 8)锛塦
+ );
- const handleDateRangeChange = value => {
- if (value) {
- if (searchForm.value.dateType === "day") {
- searchForm.value.entryDate = value;
- } else {
- searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
- searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
- }
- } else {
- searchForm.value.entryDate = undefined;
- searchForm.value.entryDateStart = undefined;
- searchForm.value.entryDateEnd = undefined;
- }
- reloadData();
- };
+ const summaryColumns = ref([
+ { label: "鐢熶骇浜�", prop: "staffName", minWidth: 100 },
+ { label: "浜ч噺", prop: "output", minWidth: 90 },
+ { label: "鏈堟椂闂村悎璁�", prop: "monthTimeTotal", minWidth: 110 },
+ {
+ label: "鎶樺悎鍊嶆暟",
+ prop: "conversionRatio",
+ minWidth: 90,
+ formatData: v => (v == null ? "-" : Number(v).toFixed(2)),
+ },
+ ]);
- const getList = () => {
- tableLoading.value = true;
- const params = { ...searchForm.value, ...page };
-
- salesLedgerProductionAccountingList(params)
- .then(res => {
- const records = res.data.records || [];
- leftTableData.value = records;
- page.total = res.data.total || 0;
- })
- .finally(() => {
- tableLoading.value = false;
- });
- };
-
- const getList1 = () => {
- tableLoading1.value = true;
- const params = { ...page1, ...searchForm.value };
- salesLedgerProductionAccountingListProductionDetails(params)
- .then(res => {
- tableData.value = res.data.records || [];
- page1.total = res.data.total || 0;
- })
- .finally(() => {
- tableLoading1.value = false;
- });
- };
-
- // 鏋勫缓宸︿晶姹囨�诲彴璐︼紙鎸夌敓浜т汉姹囨�讳骇閲忋�佸伐璧勭瓑锛�
- const buildLeftTableData = records => {
- const map = {};
- records.forEach(item => {
- const key = item.schedulingUserName || "鏈煡";
- if (!map[key]) {
- map[key] = {
- id: key,
- schedulingUserName: key,
- finishedNum: 0,
- wages: 0,
- qualifiedRate: item.qualifiedRate ?? null,
- };
- }
- map[key].finishedNum += Number(item.finishedNum || 0);
- map[key].wages += Number(item.wages || 0);
- if (item.qualifiedRate != null) {
- map[key].qualifiedRate = item.qualifiedRate;
- }
- });
- leftTableData.value = Object.values(map);
- };
-
- // 宸︿晶鏃�/鏈堝垏鎹�
- const handleDateTypeChange = value => {
- // 杩欓噷鍙綔涓虹瓫閫夋潯浠剁殑涓�閮ㄥ垎锛岀洿鎺ラ噸鏂版煡璇㈠垪琛�
- if (value === "day") {
- searchForm.value.entryDate = dayjs().format("YYYY-MM-DD");
- searchForm.value.dateRange = searchForm.value.entryDate;
- } else {
- searchForm.value.entryDateStart = dayjs()
- .startOf("month")
- .format("YYYY-MM-DD");
- searchForm.value.entryDateEnd = dayjs().endOf("month").format("YYYY-MM-DD");
- searchForm.value.dateRange = [
- searchForm.value.entryDateStart,
- searchForm.value.entryDateEnd,
+ const detailColumns = computed(() => {
+ if (searchForm.deptType === 2) {
+ return [
+ { label: "鐢熶骇浜�", prop: "staffName", minWidth: 90 },
+ { label: "宸ュ簭", prop: "processName", minWidth: 90 },
+ { label: "浜у搧澶х被", prop: "productName", minWidth: 100 },
+ { label: "鍨嬪彿/闆朵欢", prop: "modelName", minWidth: 140 },
+ { label: "鏈堜骇閲�", prop: "quantity", minWidth: 90 },
+ { label: "鏍囧噯鏁伴噺", prop: "standardQuantity", minWidth: 90 },
+ { label: "鎶樼畻鏃堕暱", prop: "convertedHours", minWidth: 90 },
];
}
+ return [
+ { label: "鐢熶骇浜�", prop: "staffName", minWidth: 90 },
+ { label: "宸ュ簭", prop: "processName", minWidth: 80 },
+ { label: "灏忔彁鐞存暟閲�", prop: "violinQty", minWidth: 90 },
+ { label: "澶ф彁鐞存暟閲�", prop: "celloQty", minWidth: 90 },
+ { label: "璐濇柉鏁伴噺", prop: "bassQty", minWidth: 80 },
+ { label: "澶ф彁鎶樼畻鐜�", prop: "celloFactor", minWidth: 90 },
+ { label: "璐濇柉鎶樼畻鐜�", prop: "bassFactor", minWidth: 90 },
+ { label: "鏈堜骇鎶樺悎灏忔彁鐞�", prop: "foldedQuantity", minWidth: 120 },
+ { label: "鏍囧噯鏁伴噺", prop: "standardQuantity", minWidth: 90 },
+ { label: "鎶樼畻鏃堕暱", prop: "convertedHours", minWidth: 90 },
+ ];
+ });
- reloadData();
+ const defaultMonth = () => {
+ const d = new Date();
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
};
- const reloadData = () => {
- page.current = 1;
- page1.current = 1;
- getList();
- tableData.value = [];
+ const buildParams = () => ({
+ deptType: searchForm.deptType,
+ yearMonth: searchForm.yearMonth,
+ staffName: detailStaffName.value || undefined,
+ });
+
+ const fetchWorkday = () => {
+ costingWorkday(searchForm.yearMonth).then(res => {
+ const d = res.data || {};
+ workInfo.workDays = d.workDays || 0;
+ workInfo.dayHours = d.dayHours || 8;
+ workInfo.monthHours = d.monthHours || 0;
+ });
};
- // 鐐瑰嚮宸︿晶琛岋紝鍒峰彸渚ф槑缁嗭紙鎸夌敓浜т汉杩囨护锛�
- const handleLeftRowClick = row => {
- searchForm.value.schedulingUserName = row.schedulingUserName || "";
- handleQuery();
+ const getSummary = () => {
+ loading.value = true;
+ costingSummary({
+ deptType: searchForm.deptType,
+ yearMonth: searchForm.yearMonth,
+ staffName: searchForm.staffName || undefined,
+ })
+ .then(res => {
+ summaryData.value = res.data || [];
+ })
+ .finally(() => {
+ loading.value = false;
+ });
};
- // 鏌ヨ鍒楄〃
- /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const getDetail = () => {
+ loadingDetail.value = true;
+ costingDetail(buildParams())
+ .then(res => {
+ detailData.value = (res.data || []).map((item, idx) => ({
+ ...item,
+ rowKey: `${item.staffId}-${item.processId}-${item.productModelId ?? ""}-${idx}`,
+ }));
+ })
+ .finally(() => {
+ loadingDetail.value = false;
+ });
+ };
+
const handleQuery = () => {
- page1.current = 1;
- getList1();
+ detailStaffName.value = "";
+ getSummary();
+ getDetail();
+ fetchWorkday();
};
- // 瀵煎嚭
- const handleOut = () => {
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- proxy.download(
- "/productionAccount/exportSalarySlip",
- { ...searchForm.value },
- "鐢熶骇宸ヨ祫鏉�.xlsx"
- );
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
+ const handleSummaryRowClick = row => {
+ detailStaffName.value = row.staffName || "";
+ getDetail();
};
- const handleBatchAccounting = () => {
- ElMessageBox.confirm("纭畾瑕佹寜褰撳墠绛涢�夋潯浠舵墽琛屾壒閲忔牳绠楀悧锛�", "鎵归噺鏍哥畻", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- const { dateRange, ...batchPayload } = searchForm.value;
- return productionAccountingBatchAccounting(batchPayload);
- })
- .then(() => {
- proxy.$modal.msgSuccess("鎵归噺鏍哥畻鎴愬姛");
- reloadData();
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
+ const openConfig = () => {
+ configDialog.value?.openDialog();
};
- const handleSingleAdjust = () => {
- if (!selectedRows.value.length) {
- proxy.$modal.msgWarning("璇峰厛鍕鹃�変竴鏉¤褰�");
- return;
- }
- if (selectedRows.value.length > 1) {
- proxy.$modal.msgWarning("鍗曚釜淇鍙兘閫夋嫨涓�鏉¤褰�");
- return;
- }
- const row = selectedRows.value[0];
- adjustForm.id = row.id;
- adjustForm.reportNo = row.reportNo || "";
- adjustForm.schedulingUserName = row.schedulingUserName || "";
- adjustForm.wages = Number(row.wages || 0);
- adjustForm.remark = "";
- adjustDialogVisible.value = true;
- };
-
- const confirmAdjust = () => {
- const selectedRow = selectedRows.value[0];
- if (!selectedRow || !selectedRow.userId) {
- proxy.$modal.msgWarning("褰撳墠璁板綍缂哄皯鎶ュ伐浜哄憳淇℃伅锛屾棤娉曚慨姝�");
- return;
- }
- if (!adjustForm.wages && adjustForm.wages !== 0) {
- proxy.$modal.msgWarning("璇疯緭鍏ヤ慨姝i噾棰�");
- return;
- }
- productionAccountingSingleAdjust({
- productionProductMainId: adjustForm.id,
- schedulingUserId: selectedRow.userId,
- schedulingUserName: adjustForm.schedulingUserName,
- adjustAmount: adjustForm.wages,
- adjustRemark: adjustForm.remark,
- adjustUser: proxy.$store?.state?.user?.userId || undefined,
- }).then(() => {
- proxy.$modal.msgSuccess("淇鎴愬姛");
- adjustDialogVisible.value = false;
- reloadData();
- }).catch(() => {});
- };
-
- const handleRowAdjust = row => {
- selectedRows.value = [row];
- handleSingleAdjust();
+ const handleExport = () => {
+ proxy.download(
+ "/productionCosting/export",
+ {
+ deptType: searchForm.deptType,
+ yearMonth: searchForm.yearMonth,
+ staffName: detailStaffName.value || undefined,
+ },
+ "鐢熶骇鏍哥畻鏄庣粏.xlsx"
+ );
};
onMounted(() => {
- getList();
+ searchForm.yearMonth = defaultMonth();
+ handleQuery();
});
</script>
<style scoped lang="scss">
+ .filter-card {
+ margin-bottom: 12px;
+ }
.content-row {
width: 100%;
}
-
- .content-row .left-col,
- .content-row .right-col {
- margin-bottom: 16px;
- }
-
- .left-panel,
- .right-panel {
- display: flex;
- flex-direction: column;
- gap: 10px;
- min-width: 0;
- }
-
- .right-toolbar {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
- }
-
- .left-header {
- display: flex;
- align-items: center;
- gap: 12px;
- }
-
- .left-title {
- font-size: 16px;
- color: #ffffff;
- }
-
- .header-filters {
- display: flex;
- align-items: center;
- flex: 1;
- justify-content: flex-end;
- gap: 8px;
- }
-
- .search_title {
- color: #ffffff;
- }
-
- .ml10 {
- margin-left: 10px;
+ .panel-title {
+ font-weight: 600;
+ margin-bottom: 8px;
+ color: #303133;
}
</style>
--
Gitblit v1.9.3