Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_NEW_pro
| | |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/technologyRouting", |
| | | url: "/technologyRouting/addTechRoute", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | |
| | | |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/technologyRouting", |
| | | url: "/technologyRouting/editTechRoute", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | |
| | | data: data, |
| | | }); |
| | | } |
| | | // 按工艺路线工序同步工序参数-生产订单 |
| | | export function syncProcessParamItemOrder(data) { |
| | | return request({ |
| | | url: "/productionOrderRoutingOperationParam/sync", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | |
| | | // 列表查询 |
| | | export function findProductProcessRouteItemList(query) { |
| | | return request({ |
| | | url: "/productProcessRoute/list", |
| | | url: "/productionOrderRouting/list", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | |
| | | |
| | | export function addOrUpdateProductProcessRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/updateRouteItem", |
| | | url: "/productionOrderRouting/updateRouteItem", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | |
| | | // 生产订单下:新增工艺路线项目 |
| | | export function addRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/addRouteItem", |
| | | url: "/productionOrderRouting/addRouteItem", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // 获取生产订单关联的工艺路线主信息 |
| | | export function listMain(orderId) { |
| | | return request({ |
| | | url: "/productProcessRoute/listMain", |
| | | url: "/productionOrderRouting/listMain", |
| | | method: "get", |
| | | params: { orderId }, |
| | | }); |
| | |
| | | // 删除工艺路线项目(路由后拼接 id) |
| | | export function deleteRouteItem(id) { |
| | | return request({ |
| | | url: `/productProcessRoute/deleteRouteItem/${id}`, |
| | | url: `/productionOrderRouting/deleteRouteItem/${id}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | |
| | | // 生产订单下:排序工艺路线项目 |
| | | export function sortRouteItem(data) { |
| | | return request({ |
| | | url: "/productProcessRoute/sortRouteItem", |
| | | url: "/productionOrderRouting/sortRouteItem", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // 获取工序参数列表-生产订单 |
| | | export function findProcessParamListOrder(query) { |
| | | return request({ |
| | | url: `/productionOrderRouteItemParam/list`, |
| | | url: `/productionOrderRoutingOperationParam/list`, |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | |
| | | // 工艺路线参数新增-生产订单 |
| | | export function addProcessRouteItemParamOrder(data) { |
| | | return request({ |
| | | url: "/productionOrderRouteItemParam/add", |
| | | url: "/productionOrderRoutingOperationParam", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | |
| | | // 工艺路线参数修改-生产订单 |
| | | export function editProcessRouteItemParamOrder(data) { |
| | | return request({ |
| | | url: "/productionOrderRouteItemParam/update", |
| | | url: "/productionOrderRoutingOperationParam", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | |
| | | // 工艺路线参数删除-生产订单 |
| | | export function delProcessRouteItemParamOrder(id) { |
| | | return request({ |
| | | url: `/productionOrderRouteItemParam/delete/${id}`, |
| | | url: `/productionOrderRoutingOperationParam/${id}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | |
| | | // 生产订单-绑定工艺路线 |
| | | export function bindingRoute(data) { |
| | | return request({ |
| | | url: "/productOrder/bindingRoute", |
| | | url: "/productionOrder/bindingRoute", |
| | | method: "post", |
| | | data, |
| | | }); |
| | |
| | | // 生产订单-新增 |
| | | export function addProductOrder(data) { |
| | | return request({ |
| | | url: "/productionOrder", |
| | | url: "/productionOrder/addOrder", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | |
| | | |
| | | export function delProductOrder(ids) { |
| | | return request({ |
| | | url: `/productOrder/${ids}`, |
| | | url: `/productionOrder/delete/${ids}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | |
| | | <script setup> |
| | | const props = defineProps({ |
| | | list: { |
| | | fileList: { |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | |
| | | }) |
| | | |
| | | const normalizedList = computed(() => { |
| | | return (props.list || []) |
| | | return (props.fileList || []) |
| | | .filter((item) => item && item.previewURL) |
| | | .map((item, index) => ({ |
| | | id: item.id ?? index, |
| | |
| | | }) |
| | | |
| | | const uploadTip = computed(() => { |
| | | return `支持 ${props.fileType.join('/')},单张不超过 ${props.fileSize}MB` |
| | | return `支持 ${props.fileType.join('/')},单张不超过 ${props.fileSize}MB,最多上传 ${props.limit} 张图片` |
| | | }) |
| | | |
| | | function getItemUid(item, index) { |
| | |
| | | // 调用API新增参数 |
| | | if (props.pageType === "order") { |
| | | addProcessRouteItemParamOrder({ |
| | | orderId: Number(props.orderId), |
| | | // processId: props.process.id, |
| | | routeItemId: props.process.id, |
| | | // routeItemId: Number(props.routeId), |
| | | productionOrderId: Number(props.orderId), |
| | | productionOrderRoutingOperationId: props.process.id, |
| | | technologyRoutingOperationParamId: props.process.id, |
| | | paramId: selectedParam.value.id, |
| | | standardValue: selectedParam.value.standardValue || "", |
| | | isRequired: selectedParam.value.isRequired || 0, |
| | |
| | | if (props.pageType === "order") { |
| | | editProcessRouteItemParamOrder({ |
| | | id: editParamForm.value.id, |
| | | // routeItemId: props.process.id, |
| | | // paramId: editParamForm.value.paramId, |
| | | standardValue: editParamForm.value.standardValue || "", |
| | | isRequired: editParamForm.value.isRequired || 0, |
| | | }) |
| | |
| | | // 富文本组件 |
| | | import Editor from "@/components/Editor"; |
| | | // 文件上传组件 |
| | | import FileUpload from "@/components/FileUpload"; |
| | | import FileUpload from "@/components/AttachmentUpload/file"; |
| | | // 图片上传组件 |
| | | import ImageUpload from "@/components/ImageUpload"; |
| | | import ImageUpload from "@/components/AttachmentUpload/image"; |
| | | // 图片预览组件 |
| | | import ImagePreview from "@/components/ImagePreview"; |
| | | import ImagePreview from "@/components/AttachmentPreview/image"; |
| | | // 字典标签组件 |
| | | import DictTag from "@/components/DictTag"; |
| | | // 表格组件 |
| | |
| | | const currentMediaIndex = ref(0); |
| | | const mediaList = ref([]); // 存储当前要查看的媒体列表(含图片和视频对象) |
| | | const mediaType = ref('image'); // image | video |
| | | const javaApi = proxy.javaApi; |
| | | |
| | | // 处理 URL:将 Windows 路径转换为可访问的 URL |
| | | function processFileUrl(fileUrl) { |
| | | if (!fileUrl) return ''; |
| | | |
| | | // 如果 URL 是 Windows 路径格式(包含反斜杠),需要转换 |
| | | if (fileUrl && fileUrl.indexOf('\\') > -1) { |
| | | // 查找 uploads 关键字的位置,从那里开始提取相对路径 |
| | | const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads'); |
| | | if (uploadsIndex > -1) { |
| | | // 从 uploads 开始提取路径,并将反斜杠替换为正斜杠 |
| | | const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/'); |
| | | fileUrl = '/' + relativePath; |
| | | } else { |
| | | // 如果没有找到 uploads,提取最后一个目录和文件名 |
| | | const parts = fileUrl.split('\\'); |
| | | const fileName = parts[parts.length - 1]; |
| | | fileUrl = '/uploads/' + fileName; |
| | | } |
| | | } |
| | | |
| | | // 确保所有非 http 开头的 URL 都拼接 baseUrl |
| | | if (fileUrl && !fileUrl.startsWith('http')) { |
| | | // 确保路径以 / 开头 |
| | | if (!fileUrl.startsWith('/')) { |
| | | fileUrl = '/' + fileUrl; |
| | | } |
| | | // 拼接 baseUrl |
| | | fileUrl = javaApi + fileUrl; |
| | | } |
| | | |
| | | return fileUrl; |
| | | } |
| | | |
| | | // 处理每一类数据:分离图片和视频 |
| | | function processItems(items) { |
| | |
| | | } |
| | | |
| | | items.forEach(item => { |
| | | if (!item || !item.url) return; |
| | | if (!item || !item.previewURL || !item.contentType) return; |
| | | |
| | | |
| | | // 处理文件 URL |
| | | const fileUrl = processFileUrl(item.url); |
| | | const fileUrl = item.previewURL; |
| | | const contentType = String(item.contentType).toLowerCase(); |
| | | |
| | | // 根据文件扩展名判断是图片还是视频 |
| | | const urlLower = fileUrl.toLowerCase(); |
| | | if (urlLower.match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)) { |
| | | // 根据 contentType 判断是图片还是视频 |
| | | if (contentType.startsWith('image/')) { |
| | | images.push(fileUrl); |
| | | } else if (urlLower.match(/\.(mp4|avi|mov|wmv|flv|mkv|webm)$/)) { |
| | | } else if (contentType.startsWith('video/')) { |
| | | videos.push(fileUrl); |
| | | } else if (item.contentType) { |
| | | // 如果有 contentType,使用 contentType 判断 |
| | | if (item.contentType.startsWith('image/')) { |
| | | images.push(fileUrl); |
| | | } else if (item.contentType.startsWith('video/')) { |
| | | videos.push(fileUrl); |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | // 打开弹窗并加载数据 |
| | | const openDialog = async (row) => { |
| | | // 使用正确的字段名:commonFileListBefore, commonFileListAfter |
| | | // productionIssues 可能不存在,使用空数组 |
| | | const { images: beforeImgs, videos: beforeVids } = processItems(row.commonFileListBefore || []); |
| | | const { images: afterImgs, videos: afterVids } = processItems(row.commonFileListAfter || []); |
| | | const { images: issueImgs, videos: issueVids } = processItems(row.productionIssues || []); |
| | | const { images: beforeImgs, videos: beforeVids } = processItems(row.commonFileListBeforeVO || []); |
| | | const { images: afterImgs, videos: afterVids } = processItems(row.commonFileListAfterVO || []); |
| | | const { images: issueImgs, videos: issueVids } = processItems(row.commonFileListVO || []); |
| | | |
| | | beforeProductionImgs.value = beforeImgs; |
| | | beforeProductionVideos.value = beforeVids; |
| | |
| | | <!-- 顶部问候条 --> |
| | | <div class="welcome-banner"> |
| | | <div class="welcome-title"> |
| | | <span class="welcome-user">{{ userStore.roleName || '系统管理员' }}</span> |
| | | <span class="welcome-user">{{ userStore.nickName || '系统管理员' }}</span> |
| | | <span> 您好!祝您开心每一天</span> |
| | | </div> |
| | | <div class="welcome-time">登录于: {{ userStore.currentLoginTime }}</div> |
| | |
| | | style="width: 100%"> |
| | | <el-table-column type="expand"> |
| | | <template #default> |
| | | <el-form ref="form" |
| | | <el-form ref="bomFormRef" |
| | | :model="bomDataValue"> |
| | | <el-table :data="bomDataValue.dataList" |
| | | row-key="tempId" |
| | |
| | | prop="model" /> |
| | | </el-table> |
| | | <ProductSelectDialog v-if="bomDataValue.showProductDialog" |
| | | v-model:model-value="bomDataValue.showProductDialog" |
| | | v-model="bomDataValue.showProductDialog" |
| | | :single="true" |
| | | @confirm="handleBomProduct" /> |
| | | <!-- 新增/编辑弹窗 --> |
| | |
| | | prop="productModelId"> |
| | | <el-button type="primary" |
| | | @click="showProductSelectDialog = true"> |
| | | {{ form.productName && form.model |
| | | ? `${form.productName} - ${form.model}` |
| | | {{ form.productName |
| | | ? (form.model ? `${form.productName} - ${form.model}` : form.productName) |
| | | : '选择产品' }} |
| | | </el-button> |
| | | </el-form-item> |
| | |
| | | prop="isQuality"> |
| | | <el-switch v-model="form.isQuality" |
| | | :active-value="true" |
| | | inactive-value="false" /> |
| | | :inactive-value="false" /> |
| | | </el-form-item> |
| | | <el-form-item label="是否生产" |
| | | prop="isProduction"> |
| | | <el-switch v-model="form.isProduction" |
| | | :active-value="true" |
| | | inactive-value="false" /> |
| | | :inactive-value="false" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | batchDeleteProcessRouteItem, |
| | | getProcessParamList, |
| | | } from "@/api/productionManagement/processRouteItem.js"; |
| | | import { syncProcessParamItem } from "@/api/productionManagement/processRouteItem.js"; |
| | | import { |
| | | syncProcessParamItem, |
| | | syncProcessParamItemOrder, |
| | | } from "@/api/productionManagement/processRouteItem.js"; |
| | | import { |
| | | findProductProcessRouteItemList, |
| | | deleteRouteItem, |
| | |
| | | queryList, |
| | | addBomDetail, |
| | | } from "@/api/productionManagement/productStructure.js"; |
| | | |
| | | import { useRoute } from "vue-router"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import Sortable from "sortablejs"; |
| | |
| | | const dialogVisible = ref(false); |
| | | const operationType = ref("add"); // add | edit |
| | | const formRef = ref(null); |
| | | const bomFormRef = ref(null); |
| | | const submitLoading = ref(false); |
| | | const cardsContainer = ref(null); |
| | | const tableRef = ref(null); |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | if (pageType.value === "order") { |
| | | syncProcessParamItemOrder({ |
| | | replaceExisting: true, |
| | | technologyRoutingOperationId: currentProcess.value.id, |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | ElMessage.success("同步成功"); |
| | | refreshParamList(); |
| | | } else { |
| | | ElMessage.error(res.msg || "同步失败"); |
| | | } |
| | | }); |
| | | } else { |
| | | syncProcessParamItem({ |
| | | replaceExisting: true, |
| | | technologyRoutingOperationId: currentProcess.value.id, |
| | |
| | | ElMessage.error(res.msg || "同步失败"); |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | |
| | | |
| | | // 产品选择 |
| | | const handleProductSelect = products => { |
| | | console.log(products, "===products==="); |
| | | if (products && products.length > 0) { |
| | | const product = products[0]; |
| | | form.value.productModelId = product.id; |
| | | form.value.productName = product.productName; |
| | | form.value.model = product.model; |
| | | form.value.unit = product.unit || ""; |
| | | console.log(product, "product"); |
| | | form.value = { |
| | | ...form.value, |
| | | productModelId: product.id, |
| | | productName: product.productName, |
| | | model: product.model, |
| | | unit: product.unit || "", |
| | | }; |
| | | showProductSelectDialog.value = false; |
| | | // 触发表单验证 |
| | | formRef.value?.validateField("productModelId"); |
| | | // formRef.value?.validateField("productModelId"); |
| | | } |
| | | }; |
| | | |
| | |
| | | productName: "", |
| | | model: "", |
| | | unit: "", |
| | | isQuality: false, |
| | | isProduction: false, |
| | | }; |
| | | formRef.value?.resetFields(); |
| | | }; |
| | |
| | | currentProcess.value = row; |
| | | const query = { |
| | | technologyRoutingOperationId: row.id, |
| | | orderId: orderId.value, |
| | | productionOrderId: orderId.value, |
| | | }; |
| | | |
| | | const apiPromise = |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog v-model="dialogVisible" title="领料台账" width="1200px" @close="handleClose"> |
| | | <el-dialog v-model="dialogVisible" |
| | | title="领料台账" |
| | | width="1200px" |
| | | @close="handleClose"> |
| | | <div class="material-toolbar"> |
| | | <el-button type="primary" @click="handleAddMaterialRow">新增</el-button> |
| | | <el-button type="primary" |
| | | @click="handleAddMaterialRow">新增</el-button> |
| | | </div> |
| | | <el-table v-loading="materialTableLoading" :data="materialTableData" border row-key="tempId"> |
| | | <el-table-column label="工序名称" min-width="180"> |
| | | <el-table v-loading="materialTableLoading" |
| | | :data="materialTableData" |
| | | border |
| | | row-key="tempId"> |
| | | <el-table-column label="工序名称" |
| | | min-width="180"> |
| | | <template #default="{ row }"> |
| | | <span v-if="row.bom === true">{{ row.processName || "-" }}</span> |
| | | <el-select |
| | | v-else |
| | | <el-select v-else |
| | | v-model="row.processName" |
| | | placeholder="请选择工序" |
| | | clearable |
| | | filterable |
| | | style="width: 100%;" |
| | | @change="val => handleProcessNameChange(row, val)" |
| | | > |
| | | <el-option v-for="item in processOptions" :key="item.id" :label="item.name" :value="item.name" /> |
| | | @change="val => handleProcessNameChange(row, val)"> |
| | | <el-option v-for="item in processOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" /> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="原料名称" min-width="160"> |
| | | <el-table-column label="原料名称" |
| | | min-width="160"> |
| | | <template #default="{ row }"> |
| | | <span v-if="row.bom === true">{{ row.materialName || "-" }}</span> |
| | | <el-button v-else type="primary" link @click="openMaterialProductSelect(row)"> |
| | | <el-button v-else |
| | | type="primary" |
| | | link |
| | | @click="openMaterialProductSelect(row)"> |
| | | {{ row.materialName || "选择原料" }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="原料型号" min-width="180"> |
| | | <el-table-column label="原料型号" |
| | | min-width="180"> |
| | | <template #default="{ row }"> |
| | | {{ row.materialModel || "-" }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="需求数量" min-width="120"> |
| | | <el-table-column label="需求数量" |
| | | min-width="120"> |
| | | <template #default="{ row }"> |
| | | <span v-if="row.bom === true">{{ row.requiredQty ?? "-" }}</span> |
| | | <el-input-number |
| | | v-else |
| | | <el-input-number v-else |
| | | v-model="row.requiredQty" |
| | | :min="0" |
| | | :precision="3" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%;" |
| | | @change="val => handleRequiredQtyChange(row, val)" |
| | | /> |
| | | @change="val => handleRequiredQtyChange(row, val)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="计量单位" width="120"> |
| | | <el-table-column label="计量单位" |
| | | width="120"> |
| | | <template #default="{ row }"> |
| | | {{ row.unit || "-" }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="领用数量" min-width="120"> |
| | | <el-table-column label="领用数量" |
| | | min-width="120"> |
| | | <template #default="{ row }"> |
| | | <el-input-number |
| | | v-model="row.pickQty" |
| | | <el-input-number v-model="row.pickQty" |
| | | :min="0" |
| | | :precision="3" |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%;" |
| | | /> |
| | | style="width: 100%;" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="90" fixed="right"> |
| | | <el-table-column label="操作" |
| | | width="90" |
| | | fixed="right"> |
| | | <template #default="{ $index, row }"> |
| | | <el-button v-if="row.bom !== true" type="danger" link @click="handleDeleteMaterialRow($index)">删除</el-button> |
| | | <el-button v-if="row.bom !== true" |
| | | type="danger" |
| | | link |
| | | @click="handleDeleteMaterialRow($index)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" :loading="materialSaving" @click="handleMaterialSave">保存</el-button> |
| | | <el-button type="primary" |
| | | :loading="materialSaving" |
| | | @click="handleMaterialSave">保存</el-button> |
| | | <el-button @click="dialogVisible = false">取消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <ProductSelectDialog |
| | | v-model="materialProductDialogVisible" |
| | | <ProductSelectDialog v-model="materialProductDialogVisible" |
| | | @confirm="handleMaterialProductConfirm" |
| | | single |
| | | request-url="/stockInventory/rawMaterials" |
| | | /> |
| | | single /> |
| | | <!-- request-url="/stockInventory/rawMaterials" --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | |
| | | const getProcessOptions = async () => { |
| | | if (!props.orderRow?.id) return; |
| | | const res = await findProductProcessRouteItemList({ orderId: props.orderRow.id }); |
| | | const routeList = Array.isArray(res?.data) ? res.data : res?.data?.records || []; |
| | | const res = await findProductProcessRouteItemList({ |
| | | orderId: props.orderRow.id, |
| | | }); |
| | | const routeList = Array.isArray(res?.data) |
| | | ? res.data |
| | | : res?.data?.records || []; |
| | | const processMap = new Map(); |
| | | routeList.forEach(item => { |
| | | const processId = item.processId; |
| | |
| | | materialTableData.value = []; |
| | | await getProcessOptions(); |
| | | try { |
| | | const detailRes = await listMaterialPickingDetail({ orderId: props.orderRow.id }); |
| | | const detailRes = await listMaterialPickingDetail({ |
| | | orderId: props.orderRow.id, |
| | | }); |
| | | const detailList = Array.isArray(detailRes?.data) |
| | | ? detailRes.data |
| | | : detailRes?.data?.records || []; |
| | |
| | | materialTableData.value = detailList.map(item => createMaterialRow(item)); |
| | | return; |
| | | } |
| | | const ledgerRes = await listMaterialPickingLedger({ orderId: props.orderRow.id }); |
| | | const ledgerRes = await listMaterialPickingLedger({ |
| | | orderId: props.orderRow.id, |
| | | }); |
| | | const ledgerList = Array.isArray(ledgerRes?.data) |
| | | ? ledgerRes.data |
| | | : ledgerRes?.data?.records || []; |
| | |
| | | }; |
| | | |
| | | const openMaterialProductSelect = row => { |
| | | currentMaterialSelectRowIndex.value = materialTableData.value.findIndex(item => item.tempId === row.tempId); |
| | | currentMaterialSelectRowIndex.value = materialTableData.value.findIndex( |
| | | item => item.tempId === row.tempId |
| | | ); |
| | | materialProductDialogVisible.value = true; |
| | | }; |
| | | |
| | |
| | | if (index < 0 || !materialTableData.value[index]) return; |
| | | const product = products[0]; |
| | | const row = materialTableData.value[index]; |
| | | row.materialModelId = product.materialModelId || product.modelId || product.id; |
| | | row.materialName = product.materialName || product.productName || product.name || ""; |
| | | row.materialModelId = |
| | | product.materialModelId || product.modelId || product.id; |
| | | row.materialName = |
| | | product.materialName || product.productName || product.name || ""; |
| | | row.materialModel = product.materialModel || product.model || ""; |
| | | row.unit = product.unit || product.measureUnit || ""; |
| | | currentMaterialSelectRowIndex.value = -1; |
| | |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="产品名称:"> |
| | | <el-input v-model="searchForm.productCategory" |
| | | <el-input v-model="searchForm.productName" |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="规格:"> |
| | | <el-input v-model="searchForm.specificationModel" |
| | | <el-input v-model="searchForm.model" |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | |
| | | customerName: "", |
| | | salesContractNo: "", |
| | | projectName: "", |
| | | productCategory: "", |
| | | specificationModel: "", |
| | | productName: "", |
| | | model: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | |
| | | try { |
| | | await bindingRoute({ |
| | | id: bindForm.orderId, |
| | | routeId: bindForm.routeId, |
| | | technologyRoutingId: bindForm.routeId, |
| | | }); |
| | | proxy.$modal.msgSuccess("绑定成功"); |
| | | bindRouteDialogVisible.value = false; |
| | |
| | | id: data.id, |
| | | bomId: data.bomId, |
| | | processRouteCode: data.processRouteCode || "", |
| | | productName: data.productName || "", |
| | | model: data.model || "", |
| | | bomNo: data.bomNo || "", |
| | | productName: row.productName || "", |
| | | model: row.model || "", |
| | | bomNo: row.bomNo || "", |
| | | description: data.description || "", |
| | | orderId, |
| | | type: "order", |
| | |
| | | query: { |
| | | id: row.id, |
| | | bomNo: row.bomNo || "", |
| | | productName: row.productCategory || "", |
| | | productModelName: row.specificationModel || "", |
| | | productName: row.productName || "", |
| | | productModelName: row.model || "", |
| | | orderId: row.id, |
| | | type: "order", |
| | | }, |
| | |
| | | }, |
| | | { |
| | | label: "已下发数量", |
| | | prop: "assignedQuantity", |
| | | prop: "quantityIssued", |
| | | width: "120px", |
| | | className: "spec-cell", |
| | | // formatData: (cell, row) => (cell ? `${cell}${row.unit || "方"}` : 0), |
| | |
| | | name: "下发", |
| | | type: "text", |
| | | showHide: row => { |
| | | return row.status == 0; |
| | | return row.status != 2; |
| | | }, |
| | | clickFun: row => { |
| | | mergeForm.productName = row.productName || ""; |
| | | mergeForm.model = row.model || ""; |
| | | mergeForm.totalAssignedQuantity = Number(row.qtyRequired || 0); |
| | | mergeForm.totalAssignedQuantity = |
| | | Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0); |
| | | mergeForm.planCompleteTime = row.requiredDate || ""; |
| | | mergeForm.productId = row.productId || ""; |
| | | mergeForm.ids = [row.id]; |
| | | sumAssignedQuantity.value = Number(row.qtyRequired || 0); |
| | | sumAssignedQuantity.value = |
| | | Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0); |
| | | isShowNewModal.value = true; |
| | | }, |
| | | }, |
| | |
| | | }; |
| | | } |
| | | summary[category].totalAssignedQuantity += Number( |
| | | ( |
| | | Number(row.qtyRequired || 0) - Number(row.assignedQuantity || 0) |
| | | ).toFixed(4) |
| | | (Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0)).toFixed( |
| | | 4 |
| | | ) |
| | | ); |
| | | }); |
| | | |
| | |
| | | |
| | | // 判断行是否可选择 |
| | | const isSelectable = row => { |
| | | // 如果是已下发状态,禁止勾选 |
| | | if (row.status == 2) { |
| | | return false; |
| | | } |
| | | // 计算剩余数量 |
| | | const remainingQty = (row.qtyRequired || 0) - (row.assignedQuantity || 0); |
| | | const remainingQty = (row.qtyRequired || 0) - (row.quantityIssued || 0); |
| | | // 如果剩余数量小于等于0,禁止选择 |
| | | if (remainingQty <= 0) { |
| | | return false; |
| | |
| | | |
| | | // 计算总制造数量 (默认qtyRequired的和) |
| | | const totalAssignedQuantity = selectedRows.value.reduce((sum, row) => { |
| | | return sum + Number(row.qtyRequired || 0); |
| | | return sum + Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0); |
| | | }, 0); |
| | | sumAssignedQuantity.value = totalAssignedQuantity; |
| | | console.log(totalAssignedQuantity); |
| | |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="销售订单号:"> |
| | | <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search" style="width: 200px" |
| | | <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search" |
| | | style="width: 200px" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="车牌号:"> |
| | | <el-input v-model="searchForm.shippingCarNumber" placeholder="请输入" clearable prefix-icon="Search" style="width: 200px" |
| | | <el-input v-model="searchForm.shippingCarNumber" placeholder="请输入" clearable prefix-icon="Search" |
| | | style="width: 200px" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="快递单号:"> |
| | | <el-input v-model="searchForm.expressNumber" placeholder="请输入" clearable prefix-icon="Search" style="width: 200px" |
| | | <el-input v-model="searchForm.expressNumber" placeholder="请输入" clearable prefix-icon="Search" |
| | | style="width: 200px" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | |
| | | link |
| | | type="primary" |
| | | :disabled="!isApproved(scope.row.status)" |
| | | @click="openForm('edit', scope.row)">补充发货信息</el-button> |
| | | @click="openForm('edit', scope.row)">补充发货信息 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | style="color: #67C23A" |
| | | @click="openDetail(scope.row)" |
| | | >详情</el-button> |
| | | >详情 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | :disabled="isApproving(scope.row.status)" |
| | | @click="handleDeleteSingle(scope.row)">删除</el-button> |
| | | @click="handleDeleteSingle(scope.row)">删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '新增发货台账' : '编辑发货台账'" width="40%" |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '新增发货台账' : '编辑发货台账'" |
| | | width="40%" |
| | | @close="closeDia"> |
| | | <el-form :model="form" label-width="120px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="发货图片:"> |
| | | <el-upload |
| | | v-model:file-list="deliveryFileList" |
| | | :action="upload.url" |
| | | multiple |
| | | ref="deliveryFileUpload" |
| | | auto-upload |
| | | :headers="upload.headers" |
| | | :data="{ type: 9 }" |
| | | :before-upload="handleDeliveryBeforeUpload" |
| | | :on-error="handleDeliveryUploadError" |
| | | :on-success="handleDeliveryUploadSuccess" |
| | | :on-remove="handleDeliveryRemove" |
| | | list-type="picture-card" |
| | | :limit="9" |
| | | accept="image/png,image/jpeg,image/jpg" |
| | | > |
| | | <el-icon class="avatar-uploader-icon"><Plus /></el-icon> |
| | | <template #tip> |
| | | <div class="el-upload__tip"> |
| | | 支持 jpg、jpeg、png 格式,最多上传 9 张,单张大小不超过 10MB |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | <ImageUpload v-model:file-list="deliveryFileList" :limit="9"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-descriptions-item label="快递公司">{{ detailRow.expressCompany || '--' }}</el-descriptions-item> |
| | | <el-descriptions-item label="快递单号" :span="2">{{ detailRow.expressNumber || '--' }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | | <div class="detail-images" v-if="detailImages.length"> |
| | | <div class="detail-images-title">发货图片</div> |
| | | <el-image |
| | | v-for="img in detailImages" |
| | | :key="img.url" |
| | | :src="img.url" |
| | | :preview-src-list="detailImages.map(i => i.url)" |
| | | fit="cover" |
| | | class="detail-image" |
| | | /> |
| | | </div> |
| | | <div v-else class="detail-images-empty">暂无发货图片</div> |
| | | <ImagePreview :file-list="detailRow.storageBlobVOs || []" /> |
| | | </div> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { onMounted, ref, reactive, toRefs, getCurrentInstance } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { Plus } from "@element-plus/icons-vue"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import { getCurrentDate } from "@/utils/index.js"; |
| | | import { |
| | | deliveryLedgerListPage, |
| | | addOrUpdateDeliveryLedger, |
| | | delDeliveryLedger, deductStock, |
| | | } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { delLedgerFile } from "@/api/salesManagement/salesLedger.js"; |
| | | import ImageUpload from "@/components/AttachmentUpload/image/index.vue"; |
| | | import ImagePreview from "@/components/AttachmentPreview/image/index.vue"; |
| | | |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | |
| | | }); |
| | | const total = ref(0); |
| | | const deliveryFileList = ref([]); |
| | | const javaApi = proxy.javaApi; |
| | | // 详情弹框 |
| | | const detailDialogVisible = ref(false); |
| | | const detailRow = ref(null); |
| | | const detailImages = ref([]); |
| | | |
| | | const normalizeFileUrl = (rawUrl = '') => { |
| | | let fileUrl = rawUrl || ''; |
| | | // Windows 路径转 URL |
| | | if (fileUrl && fileUrl.indexOf('\\') > -1) { |
| | | const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads'); |
| | | if (uploadsIndex > -1) { |
| | | const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/'); |
| | | fileUrl = '/' + relativePath; |
| | | } else { |
| | | const parts = fileUrl.split('\\'); |
| | | const fileName = parts[parts.length - 1]; |
| | | fileUrl = '/uploads/' + fileName; |
| | | } |
| | | } |
| | | if (fileUrl && !fileUrl.startsWith('http')) { |
| | | if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl; |
| | | fileUrl = javaApi + fileUrl; |
| | | } |
| | | return fileUrl; |
| | | }; |
| | | |
| | | // 上传配置 |
| | | const upload = reactive({ |
| | | // 上传的地址 |
| | | url: import.meta.env.VITE_APP_BASE_API + "/file/upload", |
| | | // 设置上传的请求头部 |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | }); |
| | | |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | |
| | | |
| | | // 查询列表 |
| | |
| | | } |
| | | |
| | | operationType.value = type; |
| | | const baseUrl = import.meta.env.VITE_APP_BASE_API; |
| | | |
| | | if (type === 'edit' && row) { |
| | | form.value = { |
| | |
| | | expressCompany: row.expressCompany ?? "", |
| | | expressNumber: row.expressNumber ?? "", |
| | | }; |
| | | // 如果有图片,将 commonFileList 转换为文件列表格式 |
| | | if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) { |
| | | deliveryFileList.value = row.commonFileList.map((file, index) => { |
| | | const fileUrl = normalizeFileUrl(file.url || ''); |
| | | |
| | | return { |
| | | uid: file.id || Date.now() + index, |
| | | name: file.name || `image_${index + 1}.jpg`, |
| | | url: fileUrl, |
| | | status: 'success', |
| | | response: { |
| | | code: 200, |
| | | data: { |
| | | tempId: file.id, |
| | | url: fileUrl |
| | | } |
| | | }, |
| | | tempId: file.id // 保存文件ID,用于提交时使用 |
| | | }; |
| | | }); |
| | | } else { |
| | | deliveryFileList.value = []; |
| | | } |
| | | } else { |
| | | form.value = { |
| | | id: null, |
| | | salesContractNo: "", |
| | | customerName: "", |
| | | type: "货车", |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | | expressNumber: "", |
| | | }; |
| | | deliveryFileList.value = []; |
| | | deliveryFileList.value = row.storageBlobVOS || []; |
| | | } |
| | | |
| | | dialogFormVisible.value = true; |
| | |
| | | const openDetail = (row) => { |
| | | detailRow.value = row || null; |
| | | const list = Array.isArray(row?.commonFileList) ? row.commonFileList : []; |
| | | detailImages.value = list |
| | | .map((f) => ({ url: normalizeFileUrl(f?.url || '') })) |
| | | .filter((i) => !!i.url); |
| | | detailDialogVisible.value = true; |
| | | }; |
| | | const closeDetail = () => { |
| | | detailDialogVisible.value = false; |
| | | detailRow.value = null; |
| | | detailImages.value = []; |
| | | }; |
| | | |
| | | // 提交表单 |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | let tempFileIds = []; |
| | | if (deliveryFileList.value !== null && deliveryFileList.value.length > 0) { |
| | | tempFileIds = deliveryFileList.value.map((item) => item.tempId); |
| | | } |
| | | const payload = { |
| | | id: form.value.id, |
| | | type: form.value.type, |
| | |
| | | shippingCarNumber: form.value.type === "货车" ? form.value.shippingCarNumber : "", |
| | | expressCompany: form.value.type === "快递" ? form.value.expressCompany : "", |
| | | expressNumber: form.value.type === "快递" ? form.value.expressNumber : "", |
| | | tempFileIds: tempFileIds, |
| | | storageBlobDTOs: deliveryFileList.value || [], |
| | | }; |
| | | deductStock(payload).then((res) => { |
| | | proxy.$modal.msgSuccess("操作成功"); |
| | |
| | | proxy.$modal.loading("正在上传图片,请稍候..."); |
| | | return true; |
| | | } |
| | | |
| | | // 发货图片上传失败 |
| | | function handleDeliveryUploadError(err) { |
| | | proxy.$modal.msgError("上传图片失败"); |
| | | proxy.$modal.closeLoading(); |
| | | } |
| | | |
| | | // 发货图片上传成功回调 |
| | | function handleDeliveryUploadSuccess(res, file, uploadFiles) { |
| | | proxy.$modal.closeLoading(); |
| | |
| | | proxy.$refs.deliveryFileUpload.handleRemove(file); |
| | | } |
| | | } |
| | | |
| | | // 移除发货图片 |
| | | function handleDeliveryRemove(file) { |
| | | console.log('file--', file) |
| | |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | .detail-wrapper { |
| | | padding: 8px 0; |
| | | } |
| | | |
| | | .detail-images { |
| | | margin-top: 16px; |
| | | } |
| | | |
| | | .detail-images-title { |
| | | font-weight: 600; |
| | | margin-bottom: 10px; |
| | | color: #303133; |
| | | } |
| | | |
| | | .detail-image { |
| | | width: 120px; |
| | | height: 120px; |
| | |
| | | margin-bottom: 10px; |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .detail-images-empty { |
| | | margin-top: 16px; |
| | | color: #909399; |