| | |
| | | prop: 'productNo', |
| | | }, |
| | | { |
| | | label: '产品型号', |
| | | label: '投入产品型号', |
| | | prop: 'model', |
| | | }, |
| | | { |
| | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" |
| | | width="60"> |
| | | > |
| | | <template #default="scope"> |
| | | <el-button link |
| | | type="primary" |
| | |
| | | <input-modal v-if="isShowInput" |
| | | v-model:visible="isShowInput" |
| | | :production-product-main-id="isShowingId" /> |
| | | <output-modal v-if="isShowOutput" |
| | | v-model:visible="isShowOutput" |
| | | :production-product-main-id="isShowingId" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { productionProductMainListPage } from "@/api/productionManagement/productionProductMain.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import InputModal from "@/views/productionManagement/productionReporting/Input.vue"; |
| | | import OutputModal from "@/views/productionManagement/productionReporting/Output.vue"; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "报工状态", |
| | | prop: "status", |
| | | dataType: "tag", |
| | | formatData: params => { |
| | | if (params == 3) { |
| | | return "已报工"; |
| | | } else if (params == 1) { |
| | | return "待生产"; |
| | | } else { |
| | | return "生产中"; |
| | | } |
| | | }, |
| | | formatType: params => { |
| | | if (params == 3) { |
| | | return "success"; |
| | | } else if (params == 1) { |
| | | return "primary"; |
| | | } else { |
| | | return "warning"; |
| | | } |
| | | }, |
| | | label: "销售合同号", |
| | | prop: "salesContractNo", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "工单状态", |
| | | prop: "workOrderStatus", |
| | | dataType: "tag", |
| | | formatData: params => { |
| | | switch (params) { |
| | | case "1": |
| | | return "待确认"; |
| | | case "2": |
| | | return "待生产"; |
| | | case "3": |
| | | return "生产中"; |
| | | case "4": |
| | | return "已生产"; |
| | | default: |
| | | return ""; |
| | | } |
| | | }, |
| | | formatType: params => { |
| | | switch (params) { |
| | | case "1": |
| | | return "primary"; |
| | | case "2": |
| | | return "info"; |
| | | case "3": |
| | | return "warning"; |
| | | case "4": |
| | | return "success"; |
| | | default: |
| | | return ""; |
| | | } |
| | | }, |
| | | label: "产品名称", |
| | | prop: "productName", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "生产时间", |
| | | label: "产品规格型号", |
| | | prop: "productModelName", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "产出数量", |
| | | prop: "quantity", |
| | | width: 120, |
| | | }, |
| | | // { |
| | | // label: "报废数量", |
| | | // prop: "scrapQuantity", |
| | | // width: 120, |
| | | // }, |
| | | { |
| | | label: "单位", |
| | | prop: "unit", |
| | | width: 120, |
| | | }, |
| | | |
| | | { |
| | | label: "创建时间", |
| | | prop: "createTime", |
| | | width: 120, |
| | | formatData: params => { |
| | | const date = new Date(params); |
| | | return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart( |
| | | 2, |
| | | "0" |
| | | )}-${String(date.getDate()).padStart(2, "0")}`; |
| | | }, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "操作", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 230, |
| | | operation: [ |
| | | { |
| | | name: "查看投入", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showInput(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "查看产出", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showOutput(row); |
| | | }, |
| | | }, |
| | | { |
| | |
| | | const isShowingId = ref(0); |
| | | const showInput = row => { |
| | | isShowInput.value = true; |
| | | isShowingId.value = row.id; |
| | | }; |
| | | |
| | | // 打开产出模态框 |
| | | const isShowOutput = ref(false); |
| | | const showOutput = row => { |
| | | isShowOutput.value = true; |
| | | isShowingId.value = row.id; |
| | | }; |
| | | |
| | |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"></PIMTable> |
| | | @pagination="pagination"> |
| | | <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="编辑时间" |
| | |
| | | <span class="info-label">产品规格</span> |
| | | <span class="info-value">{{ transferCardRowData.model }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <!-- <div class="info-item"> |
| | | <span class="info-label">工单状态</span> |
| | | <span class="info-value">{{ |
| | | transferCardRowData.status === 1 ? '待确认' : |
| | |
| | | transferCardRowData.status === 4 ? '已生产' : |
| | | transferCardRowData.status |
| | | }}</span> |
| | | </div> |
| | | </div> --> |
| | | |
| | | <div class="info-item"> |
| | | <span class="info-label">计划开始时间</span> |
| | | <span class="info-value">{{ transferCardRowData.planStartTime }}</span> |
| | |
| | | </div> |
| | | <div class="info-group"> |
| | | <div class="info-item"> |
| | | <span class="info-label"> </span> |
| | | <span class="info-value"> </span> |
| | | <span class="info-label">需求数量</span> |
| | | <span class="info-value">{{ transferCardRowData.planQuantity }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">计划数量</span> |
| | | <span class="info-value">{{ transferCardRowData.planQuantity }}</span> |
| | | <span class="info-label">完成数量</span> |
| | | <span class="info-value">{{ transferCardRowData.completeQuantity }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="info-label">良品数量</span> |
| | |
| | | placeholder="请输入本次生产数量" /> |
| | | </el-form-item> |
| | | <el-form-item label="班组信息"> |
| | | <el-input v-model="reportForm.userName" |
| | | <el-select v-model="reportForm.userId" |
| | | style="width: 300px" |
| | | readonly |
| | | placeholder="请输入班组信息" /> |
| | | placeholder="请选择班组信息" |
| | | clearable |
| | | filterable |
| | | @change="handleUserChange"> |
| | | <el-option v-for="user in userOptions" |
| | | :key="user.userId" |
| | | :label="user.userName" |
| | | :value="user.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | updateProductWorkOrder, |
| | | addProductMain, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { getUserProfile } from "@/api/system/user.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | const { proxy } = getCurrentInstance(); |
| | |
| | | prop: "processName", |
| | | }, |
| | | { |
| | | label: "待生产数量", |
| | | label: "需求数量", |
| | | prop: "planQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计划生产数量", |
| | | prop: "quantity", |
| | | label: "完成数量", |
| | | prop: "completeQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "完成进度", |
| | | prop: "completionStatus", |
| | | dataType: "slot", |
| | | slot: "completionStatus", |
| | | width: "140", |
| | | }, |
| | | { |
| | |
| | | const transferCardQrUrl = ref(""); |
| | | const transferCardRowData = ref(null); |
| | | const reportDialogVisible = ref(false); |
| | | const userOptions = ref([]); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | quantity: 0, |
| | |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |
| | | if (n <= 0) return 0; |
| | | if (n >= 100) return 100; |
| | | return Math.round(n); |
| | | }; |
| | | const progressColor = percentage => { |
| | | const p = toProgressPercentage(percentage); |
| | | if (p < 30) return "#f56c6c"; |
| | | if (p < 50) return "#e6a23c"; |
| | | if (p < 80) return "#409eff"; |
| | | return "#67c23a"; |
| | | }; |
| | | let editrow = ref(null); |
| | | |
| | | // 查询列表 |
| | |
| | | |
| | | const showTransferCard = async row => { |
| | | transferCardRowData.value = row; |
| | | const qrContent = |
| | | proxy.javaApi + "/work-order?orderRow=" + JSON.stringify(row); |
| | | console.log(qrContent, "qrContent"); |
| | | const qrContent = String(row.id); |
| | | |
| | | transferCardQrUrl.value = await QRCode.toDataURL(qrContent); |
| | | transferCardVisible.value = true; |
| | |
| | | reportForm.workOrderId = row.id; |
| | | reportForm.reportWork = row.reportWork; |
| | | reportForm.productMainId = row.productMainId; |
| | | // 获取当前登录用户信息 |
| | | // 获取当前登录用户信息,设置为默认选中 |
| | | getUserProfile() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | reportForm.userId = res.data.userId; |
| | | reportForm.userName = res.data.userName; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error("获取用户信息失败", err); |
| | | }); |
| | | |
| | | reportDialogVisible.value = true; |
| | | }; |
| | |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getUserProfile() |
| | | // 获取用户列表 |
| | | const getUserList = () => { |
| | | userListNoPageByTenantId() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | reportForm.userName = res.data.userName; |
| | | reportForm.userId = res.data.userId; |
| | | userOptions.value = res.data || []; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error("获取用户信息失败", err); |
| | | console.error("获取用户列表失败", err); |
| | | }); |
| | | }; |
| | | |
| | | // 用户选择变化时更新 userName |
| | | const handleUserChange = (userId) => { |
| | | if (userId) { |
| | | const selectedUser = userOptions.value.find(user => user.userId === userId); |
| | | if (selectedUser) { |
| | | reportForm.userName = selectedUser.userName; |
| | | } |
| | | } else { |
| | | reportForm.userName = ""; |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getUserList(); |
| | | }); |
| | | </script> |
| | | |