liding
9 天以前 0d62d9184a24fdfcb43702db0dbd0cc9d3108625
fix(product): 产品型号复制功能的进行勾选复制
已修改1个文件
21 ■■■■■ 文件已修改
src/views/basicData/product/index.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/product/index.vue
@@ -47,7 +47,7 @@
                  v-if="node.level > 1"
                  type="success"
                  link
                  @click="handleDownCopy(node, data)"
                  @click.stop="handleDownCopy(node, data)"
                >
                  向下复制
                </el-button>
@@ -374,6 +374,11 @@
// 向下复制
const handleDownCopy = (node, data) => {
  if (currentId.value !== data.id) {
    proxy.$modal.msgWarning("请先选中当前产品并勾选需要复制的型号");
    return;
  }
  // 获取同层级节点
  const parent = node.parent;
  const siblings = parent.childNodes || [];
@@ -387,13 +392,23 @@
    return;
  }
  const modelListId = selectedRows.value.map((item) => item.id);
  if (!modelListId.length) {
    proxy.$modal.msgWarning("没有选择要复制的型号");
    return;
  }
  ElMessageBox.confirm("确认将当前节点的规格型号复制到下一行节点?", "向下复制", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "info",
  })
    .then(() => {
      downCopyProductModel({ productId: data.id, targetProductId: nextNode.data.id }).then(() => {
      downCopyProductModel({
        productId: data.id,
        targetProductId: nextNode.data.id,
        modelListId,
      }).then(() => {
        proxy.$modal.msgSuccess("复制成功");
      });
    })
@@ -406,6 +421,7 @@
  // 只有叶子节点才执行以下逻辑
  currentId.value = val.id;
  currentParentId.value = val.parentId;
  selectedRows.value = [];
  getModelList();
};
@@ -440,6 +456,7 @@
};
const getModelList = () => {
  tableLoading.value = true;
  selectedRows.value = [];
  modelListPage({
    id: currentId.value,
    current: page.current,