| | |
| | | @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> |
| | |
| | | <!-- 标准数量配置 --> |
| | | <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" /> |
| | |
| | | </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" /> |
| | |
| | | import { ref, reactive, getCurrentInstance } from "vue"; |
| | | import request from "@/utils/request"; |
| | | import { |
| | | costingDeptList, |
| | | costingDeptAdd, |
| | | costingDeptUpdate, |
| | | costingDeptDel, |
| | | costingProcessList, |
| | | costingProcessAdd, |
| | | costingProcessUpdate, |
| | | costingProcessDel, |
| | | costingStandardList, |
| | | costingStandardAdd, |
| | | costingStandardUpdate, |
| | |
| | | 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 }); |
| | |
| | | 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 = () => |
| | |
| | | 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(); |
| | | 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(() => {}); |
| | | }; |
| | | |
| | |
| | | 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("保存成功"); |