yangfeng
2023-10-18 a11d38dff8d7beca6d33251557b7e370c155faf1
src/views/productManage/productCategory/AddProductCategoryDialog.vue
@@ -36,10 +36,9 @@
        label-position="right"
        label-width="110px"
        size="mini"
        style="height: 290px; overflow-x: hidden"
      >
        <div class="basic-info">
          <FormBtnsView :showProduct="true" @productClick="productClick" />
          <FormBtnsView :showProduct="true" :countObject="statisticsMap" @productClick="productClick" />
          <div class="basic-info-view">
            <!-- <el-row> -->
            <!-- <el-col :span="24">
@@ -161,9 +160,9 @@
        </div>
      </el-form>
      <!-- 尾 -->
      <div v-if="showFooter" slot="footer" class="dialog-footer">
      <div slot="footer" class="dialog-footer">
        <!-- <el-button type="primary" size="small" @click="editConfig.visible = false">保并提交审批</el-button> -->
        <el-button type="primary" size="small" @click="saveClick('form')">保存</el-button>
        <el-button type="primary" size="small" @click="saveClick('form')" :disabled="!showFooter">保存</el-button>
        <el-button size="small" @click="editConfig.visible = false">取消</el-button>
      </div>
    </el-dialog>
@@ -174,6 +173,7 @@
import { addProductCategory, updateProductCategory, deleteProductCategory } from "@/api/product/productCategory"
import { getDataByType } from "@/api/data"
import {getProductList} from "@/api/product/product";
export default {
  name: "AddProductCategoryDialog",
  props: {
@@ -213,13 +213,35 @@
      showButton: true,
      showEdit: false, // 是否显示编辑按钮
      isDelClick: false, // 删除按钮是否可点击
      showFooter: false // 是否显示取消保存
      showFooter: false, // 是否显示取消保存,
      statisticsMap:{
        product: 0 // 产品数量
      }
    }
  },
  created() {
    this.setBottonView()
    this.getProductCount()
  },
  methods: {
    // 获取产品数量
    getProductCount(){
      getProductList({
        keyWord: '',
        categoryId: this.editConfig.title === "新建" ? null : this.editConfig.infomation.id,
        page: 1,
        pageSize: 1
      }).then((res) => {
        if (res.code === 200) {
          this.statisticsMap.product = res?.total ?? 0
        }else{
          this.statisticsMap.product = 0
        }
      }).catch(err=>{
        console.error(err)
        this.statisticsMap.product = 0
      })
    },
    // 设置删除/打印/编辑是否显示
    setBottonView() {
      if (this.editConfig.title === "新建") {