| | |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | prefix-icon="Search" /> |
| | | prefix-icon="Search"/> |
| | | </div> |
| | | <div class="search-item"> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | @click="handleQuery">æç´¢ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress :percentage="toProgressPercentage(row?.completionStatus)" :color="progressColor(toProgressPercentage(row?.completionStatus))" :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | </template> |
| | | </PIMTable> |
| | | <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="ç¼è¾æ¶é´" |
| | |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | style="width: 300px"/> |
| | | </el-form-item> |
| | | <el-form-item label="计åç»ææ¶é´"> |
| | | <el-date-picker v-model="editrow.planEndTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | style="width: 300px"/> |
| | | </el-form-item> |
| | | <el-form-item label="å®é
å¼å§æ¶é´"> |
| | | <el-date-picker v-model="editrow.actualStartTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | style="width: 300px"/> |
| | | </el-form-item> |
| | | <el-form-item label="å®é
ç»ææ¶é´"> |
| | | <el-date-picker v-model="editrow.actualEndTime" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 300px" /> |
| | | style="width: 300px"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | transferCardRowData.status |
| | | }}</span> |
| | | </div> --> |
| | | |
| | | |
| | | <div class="info-item"> |
| | | <span class="info-label">计åå¼å§æ¶é´</span> |
| | | <span class="info-value">{{ transferCardRowData.planStartTime }}</span> |
| | |
| | | <div class="qr-container"> |
| | | <img :src="transferCardQrUrl" |
| | | alt="æµè½¬å¡äºç»´ç " |
| | | style="width: 200px; height: 200px;" /> |
| | | style="width: 200px; height: 200px;"/> |
| | | <!-- <div class="qr-tip" |
| | | style="margin-top: 10px; text-align: center;">æµè½¬å¡äºç»´ç </div> --> |
| | | </div> |
| | |
| | | margin-bottom: 40px;"> |
| | | <el-button type="primary" |
| | | style="margin-top: 20px;" |
| | | @click="printTransferCard">æå°æµè½¬å¡</el-button> |
| | | @click="printTransferCard">æå°æµè½¬å¡ |
| | | </el-button> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog v-model="reportDialogVisible" |
| | |
| | | <el-form-item label="å¾
ç产æ°é"> |
| | | <el-input v-model="reportForm.planQuantity" |
| | | readonly |
| | | style="width: 300px" /> |
| | | style="width: 300px"/> |
| | | </el-form-item> |
| | | <el-form-item label="æ¬æ¬¡ç产æ°é" prop="quantity"> |
| | | <el-input v-model.number="reportForm.quantity" |
| | |
| | | step="1" |
| | | style="width: 300px" |
| | | placeholder="请è¾å
¥æ¬æ¬¡ç产æ°é" |
| | | @input="handleQuantityInput" /> |
| | | @input="handleQuantityInput"/> |
| | | </el-form-item> |
| | | <el-form-item label="æ¥åºæ°é" prop="scrapQty"> |
| | | <el-input v-model.number="reportForm.scrapQty" |
| | |
| | | step="1" |
| | | style="width: 300px" |
| | | placeholder="请è¾å
¥æ¥åºæ°é" |
| | | @input="handleScrapQtyInput" /> |
| | | @input="handleScrapQtyInput"/> |
| | | </el-form-item> |
| | | <el-form-item label="çç»ä¿¡æ¯"> |
| | | <el-select v-model="reportForm.userId" |
| | |
| | | <el-option v-for="user in userOptions" |
| | | :key="user.userId" |
| | | :label="user.userName" |
| | | :value="user.userId" /> |
| | | :value="user.userId"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <FilesDia ref="workOrderFilesRef" /> |
| | | <FilesDia ref="workOrderFilesRef"/> |
| | | <CopperPrintingForm |
| | | v-if="copperPrintingFormVisible" |
| | | v-model:isShow="copperPrintingFormVisible" |
| | | :isEdit="true" |
| | | :row="currentReportRowData" |
| | | @refreshData="getList"/> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | | productWorkOrderPage, |
| | | updateProductWorkOrder, |
| | | addProductMain, |
| | | downProductWorkOrder, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | import FilesDia from "./components/filesDia.vue"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const { priority_type } = proxy.useDict("priority_type"); |
| | | import {onMounted, ref, nextTick} from "vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | | productWorkOrderPage, |
| | | updateProductWorkOrder, |
| | | addProductMain, |
| | | downProductWorkOrder, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import {getUserProfile, userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | import QRCode from "qrcode"; |
| | | import {getCurrentInstance, reactive, toRefs} from "vue"; |
| | | import FilesDia from "./components/filesDia.vue"; |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ä¼å
级", |
| | | prop: "priority", |
| | | width: '100px', |
| | | dataType: "tag", |
| | | formatData: val => proxy.selectDictLabel(priority_type.value, val), |
| | | formatType: val => { |
| | | const v = Number(val); |
| | | if (v === 0) return "danger"; // çº¢è² |
| | | if (v === 1) return "warning"; // é»è² |
| | | if (v === 2) return "success"; // ç»¿è² |
| | | return ""; |
| | | const {proxy} = getCurrentInstance(); |
| | | const {priority_type} = proxy.useDict("priority_type"); |
| | | |
| | | const CopperPrintingForm = defineAsyncComponent(() => import("./components/CopperPrintingForm.vue")); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ä¼å
级", |
| | | prop: "priority", |
| | | width: '100px', |
| | | dataType: "tag", |
| | | formatData: val => proxy.selectDictLabel(priority_type.value, val), |
| | | formatType: val => { |
| | | const v = Number(val); |
| | | if (v === 0) return "danger"; // çº¢è² |
| | | if (v === 1) return "warning"; // é»è² |
| | | if (v === 2) return "success"; // ç»¿è² |
| | | return ""; |
| | | }, |
| | | }, |
| | | // { |
| | | // label: "å·¥åç±»å", |
| | | // prop: "workOrderType", |
| | | // width: "80", |
| | | // }, |
| | | { |
| | | label: "å·¥åç¼å·", |
| | | prop: "workOrderNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "ç产订åå·", |
| | | prop: "productOrderNpsNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "è§æ ¼", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "å·¥åºåç§°", |
| | | prop: "processName", |
| | | }, |
| | | { |
| | | label: "éæ±æ°é", |
| | | prop: "planQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "宿æ°é", |
| | | prop: "completeQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "宿è¿åº¦", |
| | | prop: "completionStatus", |
| | | dataType: "slot", |
| | | slot: "completionStatus", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计åå¼å§æ¶é´", |
| | | prop: "planStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计åç»ææ¶é´", |
| | | prop: "planEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "å®é
å¼å§æ¶é´", |
| | | prop: "actualStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "å®é
ç»ææ¶é´", |
| | | prop: "actualEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "æä½", |
| | | width: "200", |
| | | align: "center", |
| | | dataType: "action", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | clickFun: row => { |
| | | handleEdit(row); |
| | | handleEdit(row); |
| | | }, |
| | | }, |
| | | }, |
| | | // { |
| | | // label: "å·¥åç±»å", |
| | | // prop: "workOrderType", |
| | | // width: "80", |
| | | // }, |
| | | { |
| | | label: "å·¥åç¼å·", |
| | | prop: "workOrderNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "ç产订åå·", |
| | | prop: "productOrderNpsNo", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "产ååç§°", |
| | | prop: "productName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "è§æ ¼", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | label: "å·¥åºåç§°", |
| | | prop: "processName", |
| | | }, |
| | | { |
| | | label: "éæ±æ°é", |
| | | prop: "planQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "宿æ°é", |
| | | prop: "completeQuantity", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "宿è¿åº¦", |
| | | prop: "completionStatus", |
| | | dataType: "slot", |
| | | slot: "completionStatus", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计åå¼å§æ¶é´", |
| | | prop: "planStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计åç»ææ¶é´", |
| | | prop: "planEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "å®é
å¼å§æ¶é´", |
| | | prop: "actualStartTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "å®é
ç»ææ¶é´", |
| | | prop: "actualEndTime", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "æä½", |
| | | width: "200", |
| | | align: "center", |
| | | dataType: "action", |
| | | fixed: "right", |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | clickFun: row => { |
| | | handleEdit(row); |
| | | }, |
| | | { |
| | | name: "æµè½¬å¡", |
| | | clickFun: row => { |
| | | downloadAndPrintWorkOrder(row); |
| | | }, |
| | | { |
| | | name: "æµè½¬å¡", |
| | | clickFun: row => { |
| | | downloadAndPrintWorkOrder(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "éä»¶", |
| | | clickFun: row => { |
| | | openWorkOrderFiles(row); |
| | | }, |
| | | { |
| | | name: "éä»¶", |
| | | clickFun: row => { |
| | | openWorkOrderFiles(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "æ¥å·¥", |
| | | clickFun: row => { |
| | | showReportDialog(row); |
| | | }, |
| | | { |
| | | name: "æ¥å·¥", |
| | | clickFun: row => { |
| | | showReportDialog(row); |
| | | }, |
| | | disabled: row => row.planQuantity <= 0, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const qrCodeUrl = ref(""); |
| | | const qrRowData = ref(null); |
| | | const editDialogVisible = ref(false); |
| | | const transferCardVisible = ref(false); |
| | | const transferCardData = ref([]); |
| | | const transferCardQrUrl = ref(""); |
| | | const transferCardRowData = ref(null); |
| | | const reportDialogVisible = ref(false); |
| | | const workOrderFilesRef = ref(null); |
| | | const reportFormRef = ref(null); |
| | | const userOptions = ref([]); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | quantity: null, |
| | | scrapQty: null, |
| | | userName: "", |
| | | workOrderId: "", |
| | | reportWork: "", |
| | | productProcessRouteItemId: "", |
| | | userId: "", |
| | | productMainId: null, |
| | | }); |
| | | |
| | | // æ¬æ¬¡ç产æ°ééªè¯è§å |
| | | const validateQuantity = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === '') { |
| | | callback(new Error('请è¾å
¥æ¬æ¬¡ç产æ°é')); |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // æ´æ°ä¸å¤§äºçäº1 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 1) { |
| | | callback(new Error('æ¬æ¬¡ç产æ°éå¿
须大äºçäº1')); |
| | | return; |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | // æ¥åºæ°ééªè¯è§å |
| | | const validateScrapQty = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === '') { |
| | | callback(); |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // æ´æ°ä¸å¤§äºçäº0 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 0) { |
| | | callback(new Error('æ¥åºæ°éå¿
须大äºçäº0')); |
| | | return; |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | // éªè¯è§å |
| | | const reportFormRules = { |
| | | quantity: [ |
| | | { required: true, validator: validateQuantity, trigger: 'blur' } |
| | | disabled: row => row.planQuantity <= 0, |
| | | }, |
| | | ], |
| | | scrapQty: [ |
| | | { validator: validateScrapQty, trigger: 'blur' } |
| | | ] |
| | | }; |
| | | |
| | | // å¤çæ¬æ¬¡ç产æ°éè¾å
¥ï¼éå¶å¿
须大äºçäº1 |
| | | const handleQuantityInput = (value) => { |
| | | if (value === '' || value === null || value === undefined) { |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const qrCodeUrl = ref(""); |
| | | const qrRowData = ref(null); |
| | | const editDialogVisible = ref(false); |
| | | const copperPrintingFormVisible = ref(false); |
| | | const transferCardVisible = ref(false); |
| | | const transferCardData = ref([]); |
| | | const transferCardQrUrl = ref(""); |
| | | const transferCardRowData = ref(null); |
| | | const reportDialogVisible = ref(false); |
| | | const workOrderFilesRef = ref(null); |
| | | const reportFormRef = ref(null); |
| | | const userOptions = ref([]); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | quantity: null, |
| | | scrapQty: null, |
| | | userName: "", |
| | | workOrderId: "", |
| | | reportWork: "", |
| | | productProcessRouteItemId: "", |
| | | userId: "", |
| | | productMainId: null, |
| | | }); |
| | | |
| | | // æ¬æ¬¡ç产æ°ééªè¯è§å |
| | | const validateQuantity = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === '') { |
| | | callback(new Error('请è¾å
¥æ¬æ¬¡ç产æ°é')); |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // æ´æ°ä¸å¤§äºçäº1 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 1) { |
| | | callback(new Error('æ¬æ¬¡ç产æ°éå¿
须大äºçäº1')); |
| | | return; |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | // æ¥åºæ°ééªè¯è§å |
| | | const validateScrapQty = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === '') { |
| | | callback(); |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // æ´æ°ä¸å¤§äºçäº0 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 0) { |
| | | callback(new Error('æ¥åºæ°éå¿
须大äºçäº0')); |
| | | return; |
| | | } |
| | | callback(); |
| | | }; |
| | | |
| | | // éªè¯è§å |
| | | const reportFormRules = { |
| | | quantity: [ |
| | | {required: true, validator: validateQuantity, trigger: 'blur'} |
| | | ], |
| | | scrapQty: [ |
| | | {validator: validateScrapQty, trigger: 'blur'} |
| | | ] |
| | | }; |
| | | |
| | | // å¤çæ¬æ¬¡ç产æ°éè¾å
¥ï¼éå¶å¿
须大äºçäº1 |
| | | const handleQuantityInput = (value) => { |
| | | if (value === '' || value === null || value === undefined) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 妿å°äº1ï¼æ¸
é¤ |
| | | if (num < 1) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | // 妿æ¯å°æ°åæ´æ°é¨å |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | // 妿忴åå°äº1ï¼æ¸
é¤ |
| | | if (intValue < 1) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 妿å°äº1ï¼æ¸
é¤ |
| | | if (num < 1) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | // 妿æ¯å°æ°åæ´æ°é¨å |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | // 妿忴åå°äº1ï¼æ¸
é¤ |
| | | if (intValue < 1) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | | reportForm.quantity = intValue; |
| | | return; |
| | | } |
| | | reportForm.quantity = num; |
| | | }; |
| | | |
| | | // å¤çæ¥åºæ°é |
| | | const handleScrapQtyInput = (value) => { |
| | | if (value === '' || value === null || value === undefined) { |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 妿æ¯NaNï¼ä¿æåå¼ |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 妿æ¯è´æ°ï¼æ¸
é¤è¾å
¥ |
| | | if (num < 0) { |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | // 妿æ¯å°æ°ï¼åæ´æ°é¨å |
| | | if (!Number.isInteger(num)) { |
| | | reportForm.scrapQty = Math.floor(num); |
| | | return; |
| | | } |
| | | // ææçéè´æ´æ°ï¼å
æ¬0ï¼ |
| | | reportForm.scrapQty = num; |
| | | }; |
| | | const currentReportRowData = ref(null); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | reportForm.quantity = intValue; |
| | | return; |
| | | } |
| | | reportForm.quantity = num; |
| | | }; |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | workOrderNo: "", |
| | | }, |
| | | }); |
| | | 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 handleScrapQtyInput = (value) => { |
| | | if (value === '' || value === null || value === undefined) { |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 妿æ¯NaNï¼ä¿æåå¼ |
| | | if (isNaN(num)) { |
| | | return; |
| | | } |
| | | // 妿æ¯è´æ°ï¼æ¸
é¤è¾å
¥ |
| | | if (num < 0) { |
| | | reportForm.scrapQty = null; |
| | | return; |
| | | } |
| | | // 妿æ¯å°æ°ï¼åæ´æ°é¨å |
| | | if (!Number.isInteger(num)) { |
| | | reportForm.scrapQty = Math.floor(num); |
| | | return; |
| | | } |
| | | // ææçéè´æ´æ°ï¼å
æ¬0ï¼ |
| | | reportForm.scrapQty = num; |
| | | }; |
| | | const currentReportRowData = ref(null); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | productWorkOrderPage(params) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | workOrderNo: "", |
| | | }, |
| | | }); |
| | | 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 handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = {...searchForm.value, ...page}; |
| | | productWorkOrderPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | }; |
| | | |
| | | // ä¸è½½å¹¶æå°å·¥åæµè½¬å¡ï¼æä»¶æµï¼ |
| | | const downloadAndPrintWorkOrder = async row => { |
| | | if (!row || !row.id) { |
| | | proxy.$modal.msgError("缺å°å·¥åIDï¼æ æ³ä¸è½½æµè½¬å¡"); |
| | | return; |
| | | } |
| | | const fileName = row.workOrderNo |
| | | // ä¸è½½å¹¶æå°å·¥åæµè½¬å¡ï¼æä»¶æµï¼ |
| | | const downloadAndPrintWorkOrder = async row => { |
| | | if (!row || !row.id) { |
| | | proxy.$modal.msgError("缺å°å·¥åIDï¼æ æ³ä¸è½½æµè½¬å¡"); |
| | | return; |
| | | } |
| | | const fileName = row.workOrderNo |
| | | ? `å·¥åæµè½¬å¡_${row.workOrderNo}.xlsx` |
| | | : "å·¥åæµè½¬å¡.xlsx"; |
| | | try { |
| | | // è°ç¨æ¥å£ï¼ä»¥ responseType: 'blob' è·åæä»¶æµ |
| | | const blob = await downProductWorkOrder(row.id); |
| | | try { |
| | | // è°ç¨æ¥å£ï¼ä»¥ responseType: 'blob' è·åæä»¶æµ |
| | | const blob = await downProductWorkOrder(row.id); |
| | | |
| | | if (!blob) { |
| | | proxy.$modal.msgError("æªè·åå°æµè½¬å¡æä»¶"); |
| | | return; |
| | | } |
| | | |
| | | // å建 Blob URL |
| | | const fileBlob = |
| | | blob instanceof Blob ? blob : new Blob([blob], { type: blob.type || "application/octet-stream" }); |
| | | const url = window.URL.createObjectURL(fileBlob); |
| | | |
| | | // å建éè iframeï¼ç¨äºè§¦åæµè§å¨æå° |
| | | const iframe = document.createElement("iframe"); |
| | | iframe.style.position = "fixed"; |
| | | iframe.style.right = "0"; |
| | | iframe.style.bottom = "0"; |
| | | iframe.style.width = "0"; |
| | | iframe.style.height = "0"; |
| | | iframe.style.border = "0"; |
| | | iframe.src = url; |
| | | document.body.appendChild(iframe); |
| | | |
| | | iframe.onload = () => { |
| | | try { |
| | | iframe.contentWindow?.focus(); |
| | | iframe.contentWindow?.print(); |
| | | } catch (e) { |
| | | console.error("èªå¨è°ç¨æå°å¤±è´¥", e); |
| | | // éèæ±å
¶æ¬¡ï¼æå¼æ°çªå£ç±ç¨æ·æå¨æå° |
| | | window.open(url); |
| | | } |
| | | }; |
| | | } catch (e) { |
| | | console.error("ä¸è½½å·¥åæµè½¬å¡å¤±è´¥", e); |
| | | proxy.$modal.msgError("ä¸è½½å·¥åæµè½¬å¡å¤±è´¥"); |
| | | if (!blob) { |
| | | proxy.$modal.msgError("æªè·åå°æµè½¬å¡æä»¶"); |
| | | return; |
| | | } |
| | | }; |
| | | |
| | | const showTransferCard = async row => { |
| | | transferCardRowData.value = row; |
| | | const qrContent = String(row.id); |
| | | // å建 Blob URL |
| | | const fileBlob = |
| | | blob instanceof Blob ? blob : new Blob([blob], {type: blob.type || "application/octet-stream"}); |
| | | const url = window.URL.createObjectURL(fileBlob); |
| | | |
| | | transferCardQrUrl.value = await QRCode.toDataURL(qrContent); |
| | | transferCardVisible.value = true; |
| | | }; |
| | | // å建éè iframeï¼ç¨äºè§¦åæµè§å¨æå° |
| | | const iframe = document.createElement("iframe"); |
| | | iframe.style.position = "fixed"; |
| | | iframe.style.right = "0"; |
| | | iframe.style.bottom = "0"; |
| | | iframe.style.width = "0"; |
| | | iframe.style.height = "0"; |
| | | iframe.style.border = "0"; |
| | | iframe.src = url; |
| | | document.body.appendChild(iframe); |
| | | |
| | | const printTransferCard = () => { |
| | | window.print(); |
| | | }; |
| | | iframe.onload = () => { |
| | | try { |
| | | iframe.contentWindow?.focus(); |
| | | iframe.contentWindow?.print(); |
| | | } catch (e) { |
| | | console.error("èªå¨è°ç¨æå°å¤±è´¥", e); |
| | | // éèæ±å
¶æ¬¡ï¼æå¼æ°çªå£ç±ç¨æ·æå¨æå° |
| | | window.open(url); |
| | | } |
| | | }; |
| | | } catch (e) { |
| | | console.error("ä¸è½½å·¥åæµè½¬å¡å¤±è´¥", e); |
| | | proxy.$modal.msgError("ä¸è½½å·¥åæµè½¬å¡å¤±è´¥"); |
| | | } |
| | | }; |
| | | |
| | | const handleEdit = row => { |
| | | editrow.value = JSON.parse(JSON.stringify(row)); |
| | | editDialogVisible.value = true; |
| | | }; |
| | | const showTransferCard = async row => { |
| | | transferCardRowData.value = row; |
| | | const qrContent = String(row.id); |
| | | |
| | | const handleUpdate = () => { |
| | | updateProductWorkOrder(editrow.value) |
| | | transferCardQrUrl.value = await QRCode.toDataURL(qrContent); |
| | | transferCardVisible.value = true; |
| | | }; |
| | | |
| | | const printTransferCard = () => { |
| | | window.print(); |
| | | }; |
| | | |
| | | const handleEdit = row => { |
| | | editrow.value = JSON.parse(JSON.stringify(row)); |
| | | editDialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleUpdate = () => { |
| | | updateProductWorkOrder(editrow.value) |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | editDialogVisible.value = false; |
| | |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | }); |
| | | }; |
| | | }; |
| | | |
| | | const showReportDialog = row => { |
| | | currentReportRowData.value = row; |
| | | reportForm.planQuantity = row.planQuantity; |
| | | reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null; |
| | | reportForm.productProcessRouteItemId = row.productProcessRouteItemId; |
| | | reportForm.workOrderId = row.id; |
| | | reportForm.reportWork = row.reportWork; |
| | | reportForm.productMainId = row.productMainId; |
| | | reportForm.scrapQty = row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null; |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | | }); |
| | | // è·åå½åç»å½ç¨æ·ä¿¡æ¯ï¼è®¾ç½®ä¸ºé»è®¤éä¸ |
| | | getUserProfile() |
| | | const showReportDialog = row => { |
| | | currentReportRowData.value = row; |
| | | if (row.processName === 'å°é') { |
| | | copperPrintingFormVisible.value = true |
| | | return |
| | | } |
| | | reportForm.planQuantity = row.planQuantity; |
| | | reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null; |
| | | reportForm.productProcessRouteItemId = row.productProcessRouteItemId; |
| | | reportForm.workOrderId = row.id; |
| | | reportForm.reportWork = row.reportWork; |
| | | reportForm.productMainId = row.productMainId; |
| | | reportForm.scrapQty = row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null; |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | | }); |
| | | // è·åå½åç»å½ç¨æ·ä¿¡æ¯ï¼è®¾ç½®ä¸ºé»è®¤éä¸ |
| | | getUserProfile() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | reportForm.userId = res.data.userId; |
| | |
| | | console.error("è·åç¨æ·ä¿¡æ¯å¤±è´¥", err); |
| | | }); |
| | | |
| | | reportDialogVisible.value = true; |
| | | }; |
| | | reportDialogVisible.value = true; |
| | | }; |
| | | |
| | | const openWorkOrderFiles = row => { |
| | | workOrderFilesRef.value?.openDialog(row); |
| | | }; |
| | | const openWorkOrderFiles = row => { |
| | | workOrderFilesRef.value?.openDialog(row); |
| | | }; |
| | | |
| | | const handleReport = () => { |
| | | reportFormRef.value?.validate((valid) => { |
| | | if (!valid) { |
| | | return false; |
| | | } |
| | | |
| | | if (reportForm.planQuantity <= 0) { |
| | | ElMessageBox.alert("å¾
ç产æ°é为0ï¼æ æ³æ¥å·¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // éªè¯æ¬æ¬¡ç产æ°é |
| | | if (reportForm.quantity === null || reportForm.quantity === undefined || reportForm.quantity === '') { |
| | | ElMessageBox.alert("请è¾å
¥æ¬æ¬¡ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | const quantity = Number(reportForm.quantity); |
| | | const scrapQty = reportForm.scrapQty === null || reportForm.scrapQty === undefined || reportForm.scrapQty === '' |
| | | ? 0 |
| | | : Number(reportForm.scrapQty); |
| | | |
| | | // æ¬æ¬¡ç产æ°é |
| | | if (isNaN(quantity) || !Number.isInteger(quantity) || quantity < 1) { |
| | | ElMessageBox.alert("æ¬æ¬¡ç产æ°éå¿
须大äºçäº1", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // æ¥åºæ°éå¿
é¡»æ¯æ´æ°ä¸å¤§äºçäº0 |
| | | if (isNaN(scrapQty) || !Number.isInteger(scrapQty) || scrapQty < 0) { |
| | | ElMessageBox.alert("æ¥åºæ°éå¿
须大äºçäº0", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (quantity > reportForm.planQuantity) { |
| | | ElMessageBox.alert("æ¬æ¬¡ç产æ°éä¸è½è¶
è¿å¾
ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | const submitData = { |
| | | ...reportForm, |
| | | quantity: quantity, |
| | | scrapQty: scrapQty |
| | | }; |
| | | |
| | | // console.log(submitData); |
| | | addProductMain(submitData).then(res => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("æ¥å·¥æå"); |
| | | reportDialogVisible.value = false; |
| | | getList(); |
| | | } else { |
| | | ElMessageBox.alert(res.msg || "æ¥å·¥å¤±è´¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | } |
| | | const handleReport = () => { |
| | | reportFormRef.value?.validate((valid) => { |
| | | if (!valid) { |
| | | return false; |
| | | } |
| | | |
| | | if (reportForm.planQuantity <= 0) { |
| | | ElMessageBox.alert("å¾
ç产æ°é为0ï¼æ æ³æ¥å·¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | }); |
| | | }; |
| | | return; |
| | | } |
| | | |
| | | // è·åç¨æ·å表 |
| | | const getUserList = () => { |
| | | userListNoPageByTenantId() |
| | | // éªè¯æ¬æ¬¡ç产æ°é |
| | | if (reportForm.quantity === null || reportForm.quantity === undefined || reportForm.quantity === '') { |
| | | ElMessageBox.alert("请è¾å
¥æ¬æ¬¡ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | const quantity = Number(reportForm.quantity); |
| | | const scrapQty = reportForm.scrapQty === null || reportForm.scrapQty === undefined || reportForm.scrapQty === '' |
| | | ? 0 |
| | | : Number(reportForm.scrapQty); |
| | | |
| | | // æ¬æ¬¡ç产æ°é |
| | | if (isNaN(quantity) || !Number.isInteger(quantity) || quantity < 1) { |
| | | ElMessageBox.alert("æ¬æ¬¡ç产æ°éå¿
须大äºçäº1", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // æ¥åºæ°éå¿
é¡»æ¯æ´æ°ä¸å¤§äºçäº0 |
| | | if (isNaN(scrapQty) || !Number.isInteger(scrapQty) || scrapQty < 0) { |
| | | ElMessageBox.alert("æ¥åºæ°éå¿
须大äºçäº0", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (quantity > reportForm.planQuantity) { |
| | | ElMessageBox.alert("æ¬æ¬¡ç产æ°éä¸è½è¶
è¿å¾
ç产æ°é", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | const submitData = { |
| | | ...reportForm, |
| | | quantity: quantity, |
| | | scrapQty: scrapQty |
| | | }; |
| | | |
| | | // console.log(submitData); |
| | | addProductMain(submitData).then(res => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("æ¥å·¥æå"); |
| | | reportDialogVisible.value = false; |
| | | getList(); |
| | | } else { |
| | | ElMessageBox.alert(res.msg || "æ¥å·¥å¤±è´¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // è·åç¨æ·å表 |
| | | const getUserList = () => { |
| | | userListNoPageByTenantId() |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | userOptions.value = res.data || []; |
| | |
| | | .catch(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 = ""; |
| | | // ç¨æ·éæ©ååæ¶æ´æ° 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(); |
| | | }); |
| | | onMounted(() => { |
| | | getList(); |
| | | getUserList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .search_form { |
| | | margin-bottom: 20px; |
| | | .search-row { |
| | | display: flex; |
| | | gap: 20px; |
| | | align-items: center; |
| | | .search-item { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 10px; |
| | | } |
| | | } |
| | | } |
| | | .search_form { |
| | | margin-bottom: 20px; |
| | | |
| | | .transfer-card-title { |
| | | font-size: 24px; |
| | | font-weight: bold; |
| | | text-align: center; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .transfer-card-container { |
| | | .search-row { |
| | | display: flex; |
| | | gap: 20px; |
| | | height: 350px; |
| | | .transfer-card-info { |
| | | flex: 1; |
| | | overflow: auto; |
| | | .info-group { |
| | | width: 50%; |
| | | float: left; |
| | | } |
| | | .info-item { |
| | | display: flex; |
| | | margin-bottom: 15px; |
| | | .info-label { |
| | | width: 120px; |
| | | font-weight: bold; |
| | | margin-right: 20px; |
| | | } |
| | | .info-value { |
| | | flex: 1; |
| | | } |
| | | } |
| | | } |
| | | .transfer-card-qr { |
| | | width: 240px; |
| | | align-items: center; |
| | | |
| | | .search-item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | gap: 10px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .transfer-card-title { |
| | | font-size: 24px; |
| | | font-weight: bold; |
| | | text-align: center; |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .transfer-card-container { |
| | | display: flex; |
| | | gap: 20px; |
| | | height: 350px; |
| | | |
| | | .transfer-card-info { |
| | | flex: 1; |
| | | overflow: auto; |
| | | |
| | | .info-group { |
| | | width: 50%; |
| | | float: left; |
| | | } |
| | | |
| | | .info-item { |
| | | display: flex; |
| | | margin-bottom: 15px; |
| | | |
| | | .info-label { |
| | | width: 120px; |
| | | font-weight: bold; |
| | | margin-right: 20px; |
| | | } |
| | | |
| | | .info-value { |
| | | flex: 1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .transfer-card-qr { |
| | | width: 240px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | <style lang="scss"> |
| | | @media print { |
| | | @page { |
| | | size: landscape; |
| | | <style lang="scss"> |
| | | @media print { |
| | | @page { |
| | | size: landscape; |
| | | } |
| | | body * { |
| | | visibility: hidden; |
| | | } |
| | | .el-dialog__wrapper, |
| | | .el-dialog, |
| | | .el-dialog__body, |
| | | .transfer-card-title, |
| | | .transfer-card-container, |
| | | .transfer-card-container *, |
| | | .info-item, |
| | | .info-label, |
| | | .info-value { |
| | | visibility: visible; |
| | | } |
| | | .print-button-container { |
| | | visibility: hidden; |
| | | } |
| | | .el-dialog__wrapper { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: 0; |
| | | } |
| | | .el-dialog { |
| | | width: 100% !important; |
| | | max-width: 800px; |
| | | margin: 0 auto !important; |
| | | } |
| | | .el-dialog__header, |
| | | .el-dialog__footer { |
| | | display: none; |
| | | } |
| | | .el-dialog__body { |
| | | padding: 20px; |
| | | } |
| | | .transfer-card-container { |
| | | height: auto; |
| | | display: flex; |
| | | gap: 20px; |
| | | } |
| | | .transfer-card-info { |
| | | flex: 1; |
| | | |
| | | .info-group { |
| | | width: 100%; |
| | | float: none; |
| | | margin-bottom: 20px; |
| | | } |
| | | body * { |
| | | visibility: hidden; |
| | | } |
| | | .el-dialog__wrapper, |
| | | .el-dialog, |
| | | .el-dialog__body, |
| | | .transfer-card-title, |
| | | .transfer-card-container, |
| | | .transfer-card-container *, |
| | | .info-item, |
| | | .info-label, |
| | | .info-value { |
| | | visibility: visible; |
| | | } |
| | | .print-button-container { |
| | | visibility: hidden; |
| | | } |
| | | .el-dialog__wrapper { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | margin: 0; |
| | | } |
| | | .el-dialog { |
| | | width: 100% !important; |
| | | max-width: 800px; |
| | | margin: 0 auto !important; |
| | | } |
| | | .el-dialog__header, |
| | | .el-dialog__footer { |
| | | display: none; |
| | | } |
| | | .el-dialog__body { |
| | | padding: 20px; |
| | | } |
| | | .transfer-card-container { |
| | | height: auto; |
| | | |
| | | .info-item { |
| | | display: flex; |
| | | gap: 20px; |
| | | } |
| | | .transfer-card-info { |
| | | flex: 1; |
| | | .info-group { |
| | | width: 100%; |
| | | float: none; |
| | | margin-bottom: 20px; |
| | | margin-bottom: 10px; |
| | | |
| | | .info-label { |
| | | width: 100px; |
| | | font-weight: bold; |
| | | margin-right: 15px; |
| | | white-space: nowrap; |
| | | } |
| | | .info-item { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | .info-label { |
| | | width: 100px; |
| | | font-weight: bold; |
| | | margin-right: 15px; |
| | | white-space: nowrap; |
| | | } |
| | | .info-value { |
| | | flex: 1; |
| | | word-break: break-word; |
| | | } |
| | | |
| | | .info-value { |
| | | flex: 1; |
| | | word-break: break-word; |
| | | } |
| | | } |
| | | .transfer-card-qr { |
| | | width: 160px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | .qr-container img { |
| | | width: 140px !important; |
| | | height: 140px !important; |
| | | } |
| | | } |
| | | .transfer-card-qr { |
| | | width: 160px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: flex-start; |
| | | } |
| | | .qr-container img { |
| | | width: 140px !important; |
| | | height: 140px !important; |
| | | } |
| | | } |
| | | </style> |