yangfeng
2023-09-28 04489cc3864aa38fde8b539aee6c4c9eed6ab1d4
src/views/productManage/productCategory/AddProductCategoryDialog.vue
@@ -15,13 +15,15 @@
            <span>打印</span>
          </span> -->
          <span class="btn" style="margin-left: 15px">
            <el-button
            <i class="el-icon-s-tools"></i>
            <span>动作</span>
            <!-- <el-button
              plain
              size="mini"
              style="margin-left: 15px"
              @click="deleteClick"
              >删除</el-button
            >
            > -->
          </span>
          <el-button
            v-if="showEdit"
@@ -48,7 +50,7 @@
          <div class="basic-info-view">
            <el-row>
              <el-col :span="24">
                <div style="margin-left: 20px">类别</div>
                <div style="margin-left: 20px"><span class="color_F56C6C">*</span>类别</div>
                <el-form-item label="" prop="name" label-width="20px">
                  <el-input
                    v-model="editConfig.infomation.name"
@@ -191,6 +193,7 @@
  updateProductCategory,
  deleteProductCategory,
} from "@/api/product/productCategory";
import { getDataByType } from "@/api/data";
export default {
  name: "AddProductCategoryDialog",
@@ -259,9 +262,11 @@
      deleteProductCategory({ id: data.id }).then((res) => {
        if (res.code === 200) {
          this.editConfig.visible = false;
          this.$message.success("刪除成功");
          this.$message.success("刪除成功!");
          this.$emit("refresh");
        }
        } else {
            this.$message.warning(res.msg?res.msg:"删除失败!")
         }
      });
    },
    // 编辑
@@ -294,17 +299,21 @@
            addProductCategory(params).then((res) => {
              if (res.code === 200) {
                this.editConfig.visible = false;
                this.$message.success("添加成功");
                this.$message.success("添加成功!");
                this.$emit("refresh");
              }
              } else {
                    this.$message.warning(res.msg?res.msg:"添加失败!")
                }
            });
          } else {
            updateProductCategory(params).then((res) => {
              if (res.code === 200) {
                this.editConfig.visible = false;
                this.$message.success("编辑成功");
                this.$message.success("编辑成功!");
                this.$emit("refresh");
              }
              } else {
                    this.$message.warning(res.msg?res.msg:"编辑失败!")
                }
            });
          }
        } else {
@@ -317,10 +326,15 @@
    delClick() {},
    // 产品
    productClick() {
      this.$router.push({
        path: "/productManage/productList",
        query: { name: "产品" },
      });
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$router.push({
            path: "/productManage/product",
            query: { categoryName:this.editConfig.infomation.name, id: this.editConfig.title === "新建"?'':this.editConfig.infomation.id},
          });
        }
      })
    },
  },
};