| | |
| | | <div class="app-container"> |
| | | <PageHeader content="产品结构详情"> |
| | | <template #right-button> |
| | | <el-button v-if="dataValue.isEdit" |
| | | <el-button v-if="dataValue.isEdit && !isOrderPage" |
| | | type="primary" |
| | | @click="addItem">添加 |
| | | </el-button> |
| | | <el-button v-if="!dataValue.isEdit" |
| | | <el-button v-if="!dataValue.isEdit && !isOrderPage" |
| | | type="primary" |
| | | @click="dataValue.isEdit = true">编辑 |
| | | </el-button> |
| | | <el-button v-if="dataValue.isEdit" |
| | | <el-button v-if="dataValue.isEdit && !isOrderPage" |
| | | type="primary" |
| | | @click="cancelEdit">取消 |
| | | </el-button> |
| | | <el-button type="primary" |
| | | <el-button v-if="!isOrderPage" |
| | | type="primary" |
| | | :loading="dataValue.loading" |
| | | @click="submit" |
| | | :disabled="!dataValue.isEdit">确认 |
| | |
| | | </el-table-column> |
| | | <el-table-column label="操作" fixed="right" width="100"> |
| | | <template #default="{ row, $index }"> |
| | | <el-button type="danger" |
| | | <el-button v-if="dataValue.isEdit" |
| | | type="danger" |
| | | text |
| | | @click="dataValue.dataList.splice($index, 1)">删除 |
| | | </el-button> |
| | |
| | | ref, |
| | | } from "vue"; |
| | | import { queryList, add } from "@/api/productionManagement/productStructure.js"; |
| | | import { listProcessBom } from "@/api/productionManagement/productionOrder.js"; |
| | | import { list } from "@/api/productionManagement/productionProcess"; |
| | | import { ElMessage } from "element-plus"; |
| | | import {useRoute, useRouter} from "vue-router"; |
| | |
| | | const routeBomNo = computed(() => route.query.bomNo || ''); |
| | | const routeProductName = computed(() => route.query.productName || ''); |
| | | const routeProductModelName = computed(() => route.query.productModelName || ''); |
| | | const routeOrderId = computed(() => route.query.orderId); |
| | | const pageType = computed(() => route.query.type); |
| | | const isOrderPage = computed(() => pageType.value === 'order' && routeOrderId.value); |
| | | |
| | | const dataValue = reactive({ |
| | | dataList: [], |
| | |
| | | }; |
| | | |
| | | const fetchData = async () => { |
| | | const { data } = await queryList(routeId.value); |
| | | // 产品信息从路由参数获取,优先使用路由参数 |
| | | if (isOrderPage.value) { |
| | | // 订单情况:使用订单的产品结构接口 |
| | | const { data } = await listProcessBom({ orderId: routeOrderId.value }); |
| | | dataValue.dataList = data || []; |
| | | } else { |
| | | // 非订单情况:使用原来的接口 |
| | | const { data } = await queryList(routeId.value); |
| | | dataValue.dataList = data || []; |
| | | } |
| | | }; |
| | | |
| | | const fetchProcessOptions = async () => { |
| | |
| | | tableData[0].model = routeProductModelName.value; |
| | | tableData[0].bomNo = routeBomNo.value; |
| | | |
| | | // 订单情况下禁用编辑 |
| | | if (isOrderPage.value) { |
| | | dataValue.isEdit = false; |
| | | } |
| | | |
| | | fetchData(); |
| | | fetchProcessOptions(); |
| | | }); |