| | |
| | | style="margin-right: 10px;"> |
| | | 卡片视图 |
| | | </el-button> |
| | | <el-button type="primary" |
| | | <el-button v-if="editable" |
| | | type="primary" |
| | | @click="handleAdd">新增</el-button> |
| | | </div> |
| | | </div> |
| | |
| | | <el-table-column label="单位" |
| | | prop="unit" |
| | | width="100" /> |
| | | <el-table-column label="计费类型" |
| | | prop="type" |
| | | width="100"> |
| | | <template #default="scope"> |
| | | {{scope.row.type==0 ? "计时" : "计件"}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="是否质检" |
| | | prop="isQuality" |
| | | width="100"> |
| | |
| | | link |
| | | size="small" |
| | | @click="handleEdit(scope.row)" |
| | | :disabled="scope.row.isComplete">编辑</el-button> |
| | | :disabled="scope.row.isComplete || !editable">编辑</el-button> |
| | | <el-button type="danger" |
| | | link |
| | | size="small" |
| | | @click="handleDelete(scope.row)" |
| | | :disabled="scope.row.isComplete">删除</el-button> |
| | | :disabled="scope.row.isComplete || !editable">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | style="margin-right: 10px;"> |
| | | 表格视图 |
| | | </el-button> |
| | | <el-button type="primary" |
| | | <el-button v-if="editable" |
| | | type="primary" |
| | | @click="handleAdd">新增</el-button> |
| | | </div> |
| | | </div> |
| | |
| | | {{ item.model }} |
| | | <!-- <span v-if="item.unit" class="product-unit">{{ item.unit }}</span> --> |
| | | </div> |
| | | <el-tag class="product-tag" |
| | | :type="item.type == 1 ? 'primary' : 'success'" |
| | | style="margin-left: 8px;">{{ item.type==0?'计时':'计件' }}</el-tag> |
| | | <el-tag type="primary" |
| | | class="product-tag" |
| | | style="margin-left: 8px;" |
| | | v-if="item.isQuality">质检</el-tag> |
| | | <el-tag type="primary" |
| | | class="product-tag" |
| | | :style="item.isQuality?'margin-left:8px':''" |
| | | style="margin-left: 8px;" |
| | | v-if="item.isProduction">生产</el-tag> |
| | | </div> |
| | | <div v-else |
| | |
| | | link |
| | | size="small" |
| | | @click="handleEdit(item)" |
| | | :disabled="item.isComplete">编辑</el-button> |
| | | :disabled="item.isComplete || !editable">编辑</el-button> |
| | | <el-button type="info" |
| | | link |
| | | size="small" |
| | |
| | | link |
| | | size="small" |
| | | @click="handleDelete(item)" |
| | | :disabled="item.isComplete">删除</el-button> |
| | | :disabled="item.isComplete || !editable">删除</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | style="margin-top: 20px;"> |
| | | <div class="section-title">BOM 结构</div> |
| | | <div class="section-actions" |
| | | v-if="pageType === 'order'"> |
| | | v-if="pageType === 'order' && editable"> |
| | | <el-button v-if="!bomDataValue.isEdit" |
| | | type="primary" |
| | | @click="bomDataValue.isEdit = true"> |
| | |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | @change="handleUnitQuantityChange(row)" |
| | | @change="handleUnitQuantityChange" |
| | | :disabled="!bomDataValue.isEdit || bomDataValue.dataList.some(item => (item).tempId === row.tempId)" /> |
| | | </el-form-item> |
| | | </template> |
| | |
| | | :step="1" |
| | | controls-position="right" |
| | | style="width: 100%" |
| | | :disabled="!bomDataValue.isEdit || bomDataValue.dataList.some(item => (item).tempId === row.tempId)" /> |
| | | :disabled="true" /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | v-else> |
| | | <span>{{ form.unit }}</span> |
| | | </el-form-item> |
| | | <el-form-item label="计费类型" |
| | | prop="type"> |
| | | <el-radio-group v-model="form.type"> |
| | | <el-radio :label="0">计时</el-radio> |
| | | <el-radio :label="1">计件</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="是否质检" |
| | | prop="isQuality"> |
| | | <el-switch v-model="form.isQuality" |
| | |
| | | @confirm="handleProductSelect" |
| | | single /> |
| | | <!-- 参数列表对话框 --> |
| | | <!-- :editable="!routeInfo.status" --> |
| | | <ProcessParamListDialog v-model="showParamListDialog" |
| | | :title="`${currentProcess ? (currentProcess.processName || currentProcess.technologyOperationName || currentProcess.operationName) : ''} - 参数列表`" |
| | | :route-id="routeId" |
| | |
| | | :process="currentProcess" |
| | | :page-type="pageType" |
| | | :param-list="paramList" |
| | | :editable="editable" |
| | | @getsyncProcessParamItem="getsyncProcessParamItem" |
| | | @refresh="refreshParamList" /> |
| | | </div> |
| | |
| | | const routeId = computed(() => route.query.id); |
| | | const orderId = computed(() => route.query.orderId); |
| | | const pageType = computed(() => route.query.type); |
| | | const editable = computed(() => route.query.editable !== "false"); |
| | | |
| | | const tableLoading = ref(false); |
| | | const tableData = ref([]); |
| | |
| | | model: "", |
| | | unit: "", |
| | | isQuality: false, |
| | | type: 0, |
| | | isProduction: false, |
| | | }); |
| | | |
| | |
| | | model: row.model || "", |
| | | unit: row.unit || "", |
| | | isQuality: row.isQuality, |
| | | type: row.type || 0, |
| | | isProduction: row.isProduction, |
| | | }; |
| | | dialogVisible.value = true; |
| | |
| | | operationName: getProcessName(form.value.technologyOperationId), |
| | | productModelId: form.value.productModelId, |
| | | isQuality: form.value.isQuality, |
| | | type: form.value.type, |
| | | isProduction: form.value.isProduction, |
| | | dragSort, |
| | | }) |
| | |
| | | technologyOperationId: form.value.technologyOperationId, |
| | | productModelId: form.value.productModelId, |
| | | isQuality: form.value.isQuality, |
| | | type: form.value.type, |
| | | isProduction: form.value.isProduction, |
| | | dragSort, |
| | | }); |
| | |
| | | operationName: getProcessName(form.value.technologyOperationId), |
| | | productModelId: form.value.productModelId, |
| | | isQuality: form.value.isQuality, |
| | | type: form.value.type, |
| | | isProduction: form.value.isProduction, |
| | | }) |
| | | : addOrUpdateProcessRouteItem1({ |
| | |
| | | productModelId: form.value.productModelId, |
| | | id: form.value.id, |
| | | isQuality: form.value.isQuality, |
| | | type: form.value.type, |
| | | isProduction: form.value.isProduction, |
| | | }); |
| | | |
| | |
| | | model: "", |
| | | unit: "", |
| | | isQuality: false, |
| | | type: 0, |
| | | isProduction: false, |
| | | }; |
| | | formRef.value?.resetFields(); |
| | |
| | | // 初始化拖拽排序 |
| | | const initSortable = () => { |
| | | destroySortable(); |
| | | if (!editable.value) return; |
| | | |
| | | if (viewMode.value === "table") { |
| | | // 表格视图的拖拽排序 |
| | |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const toQuantityNumber = value => { |
| | | const numberValue = Number(value); |
| | | if (!Number.isFinite(numberValue)) { |
| | | return 0; |
| | | } |
| | | return Number(numberValue.toFixed(2)); |
| | | }; |
| | | |
| | | const syncDemandedQuantityTree = (items, parentDemandedQuantity = null) => { |
| | | items.forEach(item => { |
| | | if (parentDemandedQuantity !== null) { |
| | | item.demandedQuantity = toQuantityNumber( |
| | | parentDemandedQuantity * toQuantityNumber(item.unitQuantity) |
| | | ); |
| | | } |
| | | |
| | | if (Array.isArray(item.children) && item.children.length > 0) { |
| | | syncDemandedQuantityTree( |
| | | item.children, |
| | | toQuantityNumber(item.demandedQuantity) |
| | | ); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const recalculateDemandedQuantities = () => { |
| | | if (pageType.value !== "order") { |
| | | return; |
| | | } |
| | | |
| | | const rootDemandedQuantity = routeInfo.value.quantity; |
| | | if ( |
| | | rootDemandedQuantity === undefined || |
| | | rootDemandedQuantity === null || |
| | | rootDemandedQuantity === "" |
| | | ) { |
| | | syncDemandedQuantityTree(bomDataValue.value.dataList); |
| | | return; |
| | | } |
| | | |
| | | syncDemandedQuantityTree( |
| | | bomDataValue.value.dataList, |
| | | toQuantityNumber(rootDemandedQuantity) |
| | | ); |
| | | }; |
| | | |
| | | const processChange = value => { |
| | | processOptions.value.forEach(item => { |
| | | if (item.id == value) { |
| | | form.value.isQuality = item.isQuality; |
| | | form.value.type = item.type || 0; |
| | | form.value.isProduction = item.isProduction; |
| | | } |
| | | }); |
| | |
| | | ); |
| | | bomDataValue.value.dataList = data || []; |
| | | normalizeTreeData(bomDataValue.value.dataList); |
| | | recalculateDemandedQuantities(); |
| | | } catch (err) { |
| | | console.error("获取BOM数据失败:", err); |
| | | } |
| | |
| | | }); |
| | | }; |
| | | |
| | | const handleUnitQuantityChange = row => { |
| | | if (routeInfo.value.quantity && routeInfo.value.quantity !== 0) { |
| | | row.demandedQuantity = (row.unitQuantity || 0) * routeInfo.value.quantity; |
| | | } |
| | | const handleUnitQuantityChange = () => { |
| | | recalculateDemandedQuantities(); |
| | | }; |
| | | |
| | | const addchildItem = (item, tempId) => { |
| | |
| | | "", |
| | | operationName: "", |
| | | unitQuantity: 1, |
| | | demandedQuantity: |
| | | routeInfo.value.quantity && routeInfo.value.quantity !== 0 |
| | | ? 1 * routeInfo.value.quantity |
| | | : 0, |
| | | demandedQuantity: 0, |
| | | children: [], |
| | | unit: "", |
| | | tempId: new Date().getTime(), |
| | | }); |
| | | recalculateDemandedQuantities(); |
| | | return true; |
| | | } |
| | | if (item.children && item.children.length > 0) { |
| | |
| | | "", |
| | | operationName: "", |
| | | unitQuantity: 1, |
| | | demandedQuantity: |
| | | routeInfo.value.quantity && routeInfo.value.quantity !== 0 |
| | | ? 1 * routeInfo.value.quantity |
| | | : 0, |
| | | demandedQuantity: 0, |
| | | unit: "", |
| | | children: [], |
| | | tempId: new Date().getTime(), |
| | | }); |
| | | recalculateDemandedQuantities(); |
| | | return; |
| | | } |
| | | addchildItem(item, tempId); |
| | |
| | | console.log(bomDataValue.value.dataList, "bomDataValue.value.dataList"); |
| | | |
| | | normalizeTreeData(bomDataValue.value.dataList); |
| | | recalculateDemandedQuantities(); |
| | | |
| | | const valid = validateAllBom(); |
| | | if (valid) { |
| | |
| | | .then(() => { |
| | | ElMessage.success("BOM保存成功"); |
| | | bomDataValue.value.isEdit = false; |
| | | fetchBomData(); |
| | | refreshCurrentPage(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.error("BOM保存失败"); |
| | |
| | | } |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | const refreshCurrentPage = () => { |
| | | getRouteInfo(); |
| | | getList(); |
| | | getProcessList(); |
| | | fetchBomData(); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | refreshCurrentPage(); |
| | | }); |
| | | |
| | | onUnmounted(() => { |