From 5d9e9f4827521b7a14ed720f77fad33ab0426585 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期五, 18 九月 2026 15:25:42 +0800
Subject: [PATCH] refactor(生产核算): 配置弹窗「部门类型」改为「工序类型」
---
src/views/productionManagement/productionCosting/components/CostConfigDialog.vue | 96 +++++++++++++++++++++++-------------------------
1 files changed, 46 insertions(+), 50 deletions(-)
diff --git a/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue b/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue
index 51c927b..03b142e 100644
--- a/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue
+++ b/src/views/productionManagement/productionCosting/components/CostConfigDialog.vue
@@ -7,21 +7,22 @@
@close="handleClose"
>
<el-tabs v-model="activeTab">
- <!-- 閮ㄩ棬绫诲瀷閰嶇疆 -->
- <el-tab-pane label="閮ㄩ棬绫诲瀷" name="dept">
+ <!-- 宸ュ簭绫诲瀷閰嶇疆锛堟寚瀹氭煇宸ュ簭灞炰簬鎴愬搧/鐧界洅锛� -->
+ <el-tab-pane label="宸ュ簭绫诲瀷" name="process">
<div class="tab-toolbar">
- <el-button type="primary" size="small" @click="openDeptForm()">鏂板</el-button>
+ <el-button type="primary" size="small" @click="openProcessForm()">鏂板</el-button>
+ <span class="tip">鍦ㄨ繖閲屾妸宸ュ簭鎸囧畾涓恒�屾垚鍝併�嶆垨銆岀櫧鐩掋�嶏紝鏍哥畻鎹鍖哄垎</span>
</div>
- <el-table :data="deptList" border size="small" max-height="420">
- <el-table-column label="閮ㄩ棬" prop="deptName" min-width="140" />
+ <el-table :data="processList" border size="small" max-height="420">
+ <el-table-column label="宸ュ簭" prop="processName" min-width="160" />
<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>
+ <el-button link type="primary" @click="openProcessForm(row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="removeProcess(row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -30,14 +31,14 @@
<!-- 鏍囧噯鏁伴噺閰嶇疆 -->
<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-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">
+ <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" />
@@ -99,34 +100,34 @@
</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-dialog v-model="processFormVisible" :title="processForm.id ? '缂栬緫宸ュ簭绫诲瀷' : '鏂板宸ュ簭绫诲瀷'" width="440px" append-to-body>
+ <el-form :model="processForm" label-width="80px">
+ <el-form-item label="宸ュ簭" required>
+ <el-select v-model="processForm.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="deptForm.deptType" placeholder="璇烽�夋嫨绫诲瀷" style="width: 100%">
+ <el-select v-model="processForm.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-input v-model="processForm.remark" />
</el-form-item>
</el-form>
<template #footer>
- <el-button @click="deptFormVisible = false">鍙栨秷</el-button>
- <el-button type="primary" @click="submitDept">纭</el-button>
+ <el-button @click="processFormVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitProcess">纭</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-form-item label="绫诲瀷" required>
<el-select v-model="standardForm.deptType" placeholder="璇烽�夋嫨" style="width: 100%">
<el-option label="鎴愬搧閮ㄩ棬" :value="1" />
<el-option label="鐧界洅閮ㄩ棬" :value="2" />
@@ -215,10 +216,10 @@
import { ref, reactive, getCurrentInstance } from "vue";
import request from "@/utils/request";
import {
- costingDeptList,
- costingDeptAdd,
- costingDeptUpdate,
- costingDeptDel,
+ costingProcessList,
+ costingProcessAdd,
+ costingProcessUpdate,
+ costingProcessDel,
costingStandardList,
costingStandardAdd,
costingStandardUpdate,
@@ -233,22 +234,20 @@
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 activeTab = ref("process");
- const deptList = ref([]);
+ const processList = 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 });
@@ -257,7 +256,7 @@
const deptTypeText = v => (v === 1 ? "鎴愬搧閮ㄩ棬" : v === 2 ? "鐧界洅閮ㄩ棬" : "-");
/* ---------- 鍔犺浇 ---------- */
- const loadDept = () => costingDeptList().then(res => (deptList.value = res.data || []));
+ const loadProcess = () => costingProcessList().then(res => (processList.value = res.data || []));
const loadStandard = () =>
costingStandardList({ ...standardQuery }).then(res => (standardList.value = res.data || []));
const loadFactor = () =>
@@ -271,9 +270,6 @@
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 || [];
});
@@ -282,33 +278,33 @@
const openDialog = () => {
visible.value = true;
loadOptions();
- loadDept();
+ loadProcess();
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 processFormVisible = ref(false);
+ const processForm = reactive({ id: null, processId: null, deptType: 1, remark: "" });
+ const openProcessForm = row => {
+ Object.assign(processForm, { id: null, processId: null, deptType: 1, remark: "" }, row || {});
+ processFormVisible.value = true;
};
- const submitDept = () => {
- if (!deptForm.deptId || !deptForm.deptType) return proxy.$modal.msgWarning("璇峰~鍐欓儴闂ㄤ笌绫诲瀷");
- const fn = deptForm.id ? costingDeptUpdate : costingDeptAdd;
- fn({ ...deptForm }).then(() => {
+ const submitProcess = () => {
+ if (!processForm.processId || !processForm.deptType) return proxy.$modal.msgWarning("璇烽�夋嫨宸ュ簭涓庣被鍨�");
+ const fn = processForm.id ? costingProcessUpdate : costingProcessAdd;
+ fn({ ...processForm }).then(() => {
proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
- deptFormVisible.value = false;
- loadDept();
+ processFormVisible.value = false;
+ loadProcess();
});
};
- const removeDept = row => {
- proxy.$modal.confirm("纭鍒犻櫎璇ラ厤缃悧锛�").then(() => costingDeptDel(row.id)).then(() => {
+ const removeProcess = row => {
+ proxy.$modal.confirm("纭鍒犻櫎璇ラ厤缃悧锛�").then(() => costingProcessDel(row.id)).then(() => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- loadDept();
+ loadProcess();
}).catch(() => {});
};
@@ -325,8 +321,8 @@
standardFormVisible.value = true;
};
const submitStandard = () => {
- if (!standardForm.deptType || !standardForm.processId) return proxy.$modal.msgWarning("璇峰~鍐欓儴闂ㄧ被鍨嬩笌宸ュ簭");
- if (standardForm.deptType === 2 && !standardForm.productModelId) return proxy.$modal.msgWarning("鐧界洅閮ㄩ棬蹇呴』閫夋嫨鍨嬪彿");
+ 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("淇濆瓨鎴愬姛");
--
Gitblit v1.9.3