Merge branch 'dev_长治_健齿齿科器材' of http://114.132.189.42:9002/r/product-inventory-management into dev_长治_健齿齿科器材
| | |
| | | <el-form :model="form" label-width="120px" :rules="formRules" ref="formRef"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设å¤ç¼å·" prop="deviceCode"> |
| | | <el-input v-model="form.deviceCode" placeholder="请è¾å
¥è®¾å¤ç¼å·" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设å¤åç§°" prop="deviceName"> |
| | | <el-input v-model="form.deviceName" placeholder="请è¾å
¥è®¾å¤åç§°" /> |
| | | </el-form-item> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¾åºå" prop="supplierName"> |
| | | <el-input v-model="form.supplierName" placeholder="请è¾å
¥ä¾åºå" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="转æ°(转/min)" prop="rpm"> |
| | | <el-input-number :min="0" style="width: 100%" |
| | | v-model="form.rpm" |
| | | placeholder="请è¾å
¥è½¬æ°" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¢è®¡è¿è¡æ¶é´" prop="planRuntimeTime"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¢è®¡è¿è¡æ¶é´" prop="planRuntimeTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.planRuntimeTime" |
| | |
| | | 'å
¶ä»è®¾å¤' |
| | | ]); |
| | | const formRules = { |
| | | deviceCode: [{ required: true, trigger: "blur", message: "请è¾å
¥è®¾å¤ç¼å·" }], |
| | | deviceName: [{ required: true, trigger: "blur", message: "请è¾å
¥" }], |
| | | deviceModel: [{ required: true, trigger: "blur", message: "请è¾å
¥" }], |
| | | type: [{ required: true, trigger: "change", message: "è¯·éæ©æè¾å
¥è®¾å¤ç±»å" }], |
| | |
| | | } |
| | | |
| | | const { form, resetForm } = useFormData({ |
| | | deviceCode: undefined, // 设å¤ç¼å· |
| | | deviceName: undefined, // 设å¤åç§° |
| | | deviceModel: undefined, // è§æ ¼åå· |
| | | deviceBrand: undefined, // 设å¤åç |
| | |
| | | } |
| | | const { code, data } = await getLedgerById(id); |
| | | if (code == 200) { |
| | | form.deviceCode = data.deviceCode; |
| | | form.deviceName = data.deviceName; |
| | | form.deviceModel = data.deviceModel; |
| | | form.deviceBrand = data.deviceBrand; |
| | |
| | | }, |
| | | [ |
| | | { |
| | | label: "设å¤ç¼å·", |
| | | prop: "deviceCode", |
| | | }, |
| | | { |
| | | label: "设å¤åç§°", |
| | | prop: "deviceName", |
| | | }, |
| | |
| | | prop: "supplierName", |
| | | }, |
| | | { |
| | | label: "转æ°(转/min)", |
| | | prop: "rpm", |
| | | }, |
| | | { |
| | | label: "åæ¾ä½ç½®", |
| | | prop: "storageLocation", |
| | | }, |
| | |
| | | width: 350, |
| | | operation: [ |
| | | { |
| | | name: "æ¥ç", |
| | | name: "çäº§åæ°", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showProcessParamModal(row); |
| | |
| | | |
| | | // 设å¤å表åé
ç½® |
| | | const deviceColumns = ref([ |
| | | { label: "设å¤ç¼å·", prop: "deviceCode" }, |
| | | { label: "设å¤åç§°", prop: "deviceName" }, |
| | | { label: "è§æ ¼åå·", prop: "deviceModel" }, |
| | | { label: "设å¤åç", prop: "deviceBrand" }, |
| | |
| | | |
| | | // å¯é设å¤å表åé
ç½® |
| | | const selectDeviceColumns = ref([ |
| | | { label: "设å¤ç¼å·", prop: "deviceCode" }, |
| | | { label: "设å¤åç§°", prop: "deviceName" }, |
| | | { label: "è§æ ¼åå·", prop: "deviceModel" }, |
| | | { label: "设å¤åç", prop: "deviceBrand" }, |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script setup lang="ts"> |
| | | import {computed, reactive, ref, watch} from "vue"; |
| | | |
| | | defineOptions({ |
| | | name: "ProductionRecordForm" |
| | | }); |
| | | |
| | | const props = defineProps({ |
| | | list: { |
| | | type: Array, |
| | | default() { |
| | | return []; |
| | | } |
| | | }, |
| | | labelWidth: { |
| | | type: Number, |
| | | default: 120 |
| | | } |
| | | }); |
| | | |
| | | const formRef = ref(); |
| | | const formData = reactive({ |
| | | list: [] as any[], |
| | | }); |
| | | |
| | | const fieldLabel = (item: any) => { |
| | | if (!item.unit || item.unit === "/") { |
| | | return item.parameterItem; |
| | | } |
| | | return `${item.parameterItem}ï¼${item.unit}ï¼`; |
| | | }; |
| | | |
| | | const getType = (item: any) => item.type || "ææ¬æ ¼å¼"; |
| | | |
| | | const rules = computed(() => { |
| | | const result: Record<string, any[]> = {}; |
| | | formData.list.forEach((item, index) => { |
| | | if (String(item.isRequired) === "1") { |
| | | result[`list.${index}.value`] = [{required: true, message: `请è¾å
¥${item.parameterItem}`, trigger: "blur"}]; |
| | | } |
| | | }); |
| | | return result; |
| | | }); |
| | | |
| | | const initData = () => { |
| | | formData.list = props.list || []; |
| | | formData.list.forEach(item => { |
| | | if (item.value === undefined) { |
| | | item.value = null; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const submitData = async () => { |
| | | const valid = await formRef.value.validate().catch(() => false) |
| | | |
| | | if (valid) { |
| | | return formData.list |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | |
| | | watch( |
| | | () => props.list, |
| | | () => { |
| | | initData(); |
| | | }, |
| | | {immediate: true, deep: true} |
| | | ); |
| | | |
| | | defineExpose({ |
| | | submitData |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <el-form ref="formRef" :model="formData" :rules="rules" :label-width="`${labelWidth}px`"> |
| | | <el-form-item |
| | | v-for="(item, index) in formData.list" |
| | | :key="item.id" |
| | | :label="fieldLabel(item)" |
| | | :prop="`list.${index}.value`" |
| | | > |
| | | <el-input-number |
| | | v-if="getType(item) === 'æ°å¼æ ¼å¼'" |
| | | v-model="item.value" |
| | | :controls="false" |
| | | style="width: 100%" |
| | | placeholder="请è¾å
¥" |
| | | /> |
| | | <el-date-picker |
| | | v-else-if="getType(item) === 'æ¶é´æ ¼å¼'" |
| | | v-model="item.value" |
| | | type="datetime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | placeholder="è¯·éæ©" |
| | | style="width: 100%" |
| | | /> |
| | | <el-date-picker |
| | | v-else-if="getType(item) === 'æ¥ææ ¼å¼'" |
| | | v-model="item.value" |
| | | type="date" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | placeholder="è¯·éæ©" |
| | | style="width: 100%" |
| | | /> |
| | | <el-select |
| | | v-else-if="getType(item) === 'æ¯/å¦éæ¡'" |
| | | v-model="item.value" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="æ¯" value="æ¯"/> |
| | | <el-option label="å¦" value="å¦"/> |
| | | </el-select> |
| | | <el-input |
| | | v-else |
| | | v-model="item.value" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | |
| | | :value="user.userId" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="设å¤éæ©"> |
| | | <el-select v-model="reportForm.deviceId" |
| | | style="width: 300px" |
| | | placeholder="è¯·éæ©è®¾å¤" |
| | | clearable |
| | | filterable |
| | | @change="handleDeviceChange"> |
| | | <el-option v-for="device in deviceOptions" |
| | | :key="device.id" |
| | | :label="device.deviceName" |
| | | :value="device.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="currentDevice" label="设å¤ç¼å·"> |
| | | <el-input v-model="currentDevice.deviceCode" |
| | | disabled |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="currentDevice" label="转æ°"> |
| | | <el-input v-model="currentDevice.rpm" |
| | | disabled |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <ProductionRecordForm ref="productionRecordFormRef" :list="processParamList"/> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { onMounted, ref, nextTick, computed } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | |
| | | downProductWorkOrder, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { getBindDevices } from "@/api/productionManagement/productionProcess.js"; |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | import FilesDia from "./components/filesDia.vue"; |
| | | import { |
| | | listPage as listProcessParamPage, |
| | | } from "@/api/productionManagement/productProcessParameter.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const ProductionRecordForm = defineAsyncComponent(() => import("./components/ProductionRecordForm.vue")); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | |
| | | const workOrderFilesRef = ref(null); |
| | | const reportFormRef = ref(null); |
| | | const userOptions = ref([]); |
| | | const deviceOptions = ref([]); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | totalInvestment: 0, |
| | |
| | | productProcessRouteItemId: "", |
| | | userId: "", |
| | | productMainId: null, |
| | | deviceId: null, |
| | | otherData: { |
| | | rows: [] |
| | | }, |
| | | }); |
| | | const productionRecordFormRef = ref(); |
| | | |
| | | const currentDevice = computed(() => { |
| | | if (!reportForm.deviceId) return null; |
| | | return deviceOptions.value.find(device => device.id === reportForm.deviceId) || null; |
| | | }); |
| | | |
| | | // æå
¥æ»ééªè¯è§å |
| | |
| | | }); |
| | | }; |
| | | |
| | | const showReportDialog = row => { |
| | | const processParamPage = reactive({ |
| | | current: 1, |
| | | size: 9999, |
| | | total: 0, |
| | | }); |
| | | const getProcessParamList = async (row) => { |
| | | const params = { |
| | | processId: row.processId, |
| | | ...processParamPage, |
| | | }; |
| | | const res = await listProcessParamPage(params) |
| | | return res.data.records |
| | | }; |
| | | |
| | | const processParamList = ref([]) |
| | | const showReportDialog = async row => { |
| | | currentReportRowData.value = row; |
| | | processParamList.value = await getProcessParamList(row) |
| | | reportForm.planQuantity = row.planQuantity; |
| | | reportForm.totalInvestment = row.totalInvestment; |
| | | reportForm.quantity = |
| | |
| | | reportForm.inspectedQuantity = row.inspectedQuantity; |
| | | reportForm.scrapQty = |
| | | row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null; |
| | | reportForm.deviceId = row.deviceId || null; |
| | | |
| | | // è·åå·¥åºç»å®è®¾å¤å表 |
| | | getDeviceList(row.processId); |
| | | |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | | }); |
| | |
| | | workOrderFilesRef.value?.openDialog(row); |
| | | }; |
| | | |
| | | const handleReport = () => { |
| | | const handleReport = async () => { |
| | | try { |
| | | const data = await productionRecordFormRef.value.submitData(); |
| | | console.log("ç产记å½è¡¨åæ°æ®:", data); |
| | | reportForm.otherData.rows = data || []; |
| | | } catch (error) { |
| | | console.error("è·åç产记å½è¡¨åæ°æ®å¤±è´¥", error); |
| | | return; |
| | | } |
| | | |
| | | reportFormRef.value?.validate(valid => { |
| | | if (!valid) { |
| | | return false; |
| | |
| | | ...reportForm, |
| | | quantity: quantity, |
| | | scrapQty: scrapQty, |
| | | otherData: JSON.stringify(reportForm.otherData) |
| | | }; |
| | | |
| | | // console.log(submitData); |
| | | addProductMain(submitData).then(res => { |
| | | if (res.code === 200) { |
| | | proxy.$modal.msgSuccess("æ¥å·¥æå"); |
| | |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | console.error("æ¥å·¥å¤±è´¥", err); |
| | | ElMessageBox.alert("æ¥å·¥å¤±è´¥", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | }); |
| | | }); |
| | | }); |
| | | }; |
| | |
| | | }); |
| | | }; |
| | | |
| | | // è·å设å¤å表 |
| | | const getDeviceList = (processId) => { |
| | | if (!processId) { |
| | | deviceOptions.value = []; |
| | | return; |
| | | } |
| | | getBindDevices(processId) |
| | | .then(res => { |
| | | if (res.code === 200) { |
| | | deviceOptions.value = res.data || []; |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error("è·å设å¤å表失败", err); |
| | | deviceOptions.value = []; |
| | | }); |
| | | }; |
| | | |
| | | // ç¨æ·éæ©ååæ¶æ´æ° userName |
| | | const handleUserChange = userId => { |
| | | if (userId) { |
| | |
| | | } |
| | | }; |
| | | |
| | | // 设å¤éæ©ååæ¶æ´æ° deviceId |
| | | const handleDeviceChange = deviceId => { |
| | | reportForm.deviceId = deviceId; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getUserList(); |