huminmin
2026-04-23 aa45660ef6b61118148bfe01a87ef1984f706489
Merge branch 'dev_衡阳_鹏创电子' of http://114.132.189.42:9002/r/product-inventory-management into dev_衡阳_鹏创电子
已修改3个文件
72 ■■■■ 文件已修改
src/api/productionManagement/productBom.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productStructure/Detail/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productStructure/index.vue 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productionManagement/productBom.js
@@ -28,6 +28,15 @@
  });
}
// 复制
export function copyBom(data) {
  return request({
    url: "/productBom/copy",
    method: "post",
    data: data,
  });
}
// 批量删除
export function batchDelete(ids) {
  return request({
src/views/productionManagement/productStructure/Detail/index.vue
@@ -87,7 +87,7 @@
                                     :step="1"
                                     controls-position="right"
                                     style="width: 100%"
                                     :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
                                     :disabled="!dataValue.isEdit" />
                  </el-form-item>
                </template>
              </el-table-column>
src/views/productionManagement/productStructure/index.vue
@@ -18,12 +18,12 @@
    <StructureEdit v-if="showEdit" v-model:show-model="showEdit" :record="currentRow" />
    <!-- 新增/编辑弹窗 -->
    <el-dialog v-model="dialogVisible" :title="operationType === 'add' ? '新增BOM' : '编辑BOM'" width="600px"
    <el-dialog v-model="dialogVisible" :title="dialogTitle" width="600px"
      @close="closeDialog">
      <el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="产品名称" prop="productModelId">
          <el-button type="primary" @click="showProductSelectDialog = true">
            {{ form.productName || '选择产品' }}
            {{ form.productName || form.productModelName || '选择产品' }}
          </el-button>
        </el-form-item>
        <el-form-item label="版本号" prop="version">
@@ -51,9 +51,9 @@
</template>
<script setup>
import { ref, reactive, toRefs, onMounted, getCurrentInstance, defineAsyncComponent } from "vue";
import { ref, reactive, toRefs, computed, onMounted, getCurrentInstance, defineAsyncComponent } from "vue";
import { getToken } from "@/utils/auth";
import { listPage, add, update, batchDelete, exportBom, downloadTemplate } from "@/api/productionManagement/productBom.js";
import { listPage, add, update, copyBom, batchDelete, exportBom, downloadTemplate } from "@/api/productionManagement/productBom.js";
import { useRouter } from 'vue-router'
import { ElMessageBox } from 'element-plus'
import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
@@ -102,13 +102,20 @@
    label: "操作",
    align: "center",
    fixed: "right",
    width: 150,
    width: 220,
    operation: [
      {
        name: "编辑",
        type: "text",
        clickFun: (row) => {
          handleEdit(row)
        }
      },
      {
        name: "复制",
        type: "text",
        clickFun: (row) => {
          handleCopy(row)
        }
      },
      {
@@ -129,9 +136,18 @@
const selectedRows = ref([]);
const currentRow = ref({});
const dialogVisible = ref(false);
const operationType = ref('add'); // add | edit
const operationType = ref('add'); // add | edit | copy
const copySourceId = ref(undefined);
const formRef = ref(null);
const showProductSelectDialog = ref(false);
const dialogTitle = computed(() => {
  const titleMap = {
    add: "新增BOM",
    edit: "编辑BOM",
    copy: "复制BOM"
  };
  return titleMap[operationType.value] || "BOM";
});
//  BOM导入参数
const upload = reactive({
@@ -205,6 +221,7 @@
// 新增
const handleAdd = () => {
  operationType.value = 'add';
  copySourceId.value = undefined;
  Object.assign(form.value, {
    id: undefined,
    productName: "",
@@ -219,6 +236,7 @@
// 编辑
const handleEdit = (row) => {
  operationType.value = 'edit';
  copySourceId.value = undefined;
  Object.assign(form.value, {
    id: row.id,
    productName: row.productName || "",
@@ -226,6 +244,21 @@
    productModelId: row.productModelId || "",
    remark: row.remark || "",
    version: row.version || ""
  });
  dialogVisible.value = true;
};
// 复制
const handleCopy = (row) => {
  operationType.value = 'copy';
  copySourceId.value = row.id;
  Object.assign(form.value, {
    id: undefined,
    productName: "",
    productModelName: "",
    productModelId: "",
    remark: "",
    version: ""
  });
  dialogVisible.value = true;
};
@@ -301,7 +334,7 @@
          .catch(() => {
            proxy.$modal.msgError('新增失败');
          });
      } else {
      } else if (operationType.value === 'edit') {
        update(payload)
          .then(() => {
            proxy.$modal.msgSuccess('修改成功');
@@ -311,6 +344,19 @@
          .catch(() => {
            proxy.$modal.msgError('修改失败');
          });
      } else {
        copyBom({
          ...payload,
          copyId: copySourceId.value
        })
          .then(() => {
            proxy.$modal.msgSuccess('复制成功');
            closeDialog();
            getList();
          })
          .catch(() => {
            proxy.$modal.msgError('复制失败');
          });
      }
    }
  });
@@ -319,6 +365,7 @@
// 关闭弹窗
const closeDialog = () => {
  dialogVisible.value = false;
  copySourceId.value = undefined;
  formRef.value?.resetFields();
};