hailin
2023-07-19 57edffda445efc23fd17752dbb36fc1b91c0716a
标准库第二次修改的bug补交
已修改1个文件
59 ■■■■■ 文件已修改
src/views/standardLibrary/index.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/standardLibrary/index.vue
@@ -107,7 +107,7 @@
          <div>
            <el-pagination
              :current-page="pageParams.pageNo"
              :page-sizes="[10, 20, 30, 40]"
              :page-sizes="[1, 2, 3, 4]"
              :page-size="pageParams.pageNo"
              layout="total, sizes, prev, pager, next, jumper"
              :total="pageParams.total"
@@ -170,14 +170,18 @@
        }
      ],
      // 分页参数
      pageParams: {
        pageNo: 1,
        pageSize: 10,
        pageSize: 1,
        total: 3
      },
      tablespecifications: [
      ],
      showTableCurrent: 0
      // 选中节点对应的表格 0 是标准表 1是型号表 2规格表
      showTableCurrent: 0,
      // 选中的节点数据
      selectNode: {}
    }
  },
  watch: {
@@ -210,9 +214,11 @@
      // console.log('children' in data)
      if (!('children' in data)) {
        // console.log('点击子节点', data)
        this.selectNode = data
        await this.getSpecifications(data)
        return
      }
      this.selectNode = data
      await this.getSerialNumber(data)
    },
    specificationDetails(row) {
@@ -246,9 +252,24 @@
      ]
      this.showTableCurrent = 0
    },
    // 获取对应型号下的所有规格
    async getSerialNumber(data) {
      const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams })
      console.log('点击父节点', row)// 根据标准获取对应标准下的规格
      this.tableData = row
      this.pageParams.total = total
      this.tablespecifications = [
        {
          prop: 'name',
          label: '型号名称',
          minWidth: '150px'
        }
      ]
      this.showTableCurrent = 1
    },
    // 获取标准下对应的所有型号
    async getSpecifications(data) {
      const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, pageNo: 1, pageSize: 10 })
      const { data: { row, total }} = await getSpecificationsList({ serialNumberId: data.id, ...this.pageParams })
      console.log(row)
      this.tableData = row
      this.pageParams.total = total
@@ -276,39 +297,29 @@
      ]
      this.showTableCurrent = 2
    },
    // 获取对应型号下的所有规格
    async getSerialNumber(data) {
      const { data: { row, total }} = await getSerialNumberList({ standardsId: data.id, ...this.pageParams })
      console.log('点击父节点', row)// 根据标准获取对应标准下的规格
      this.tableData = row
      this.pageParams.total = total
      this.tablespecifications = [
        {
          prop: 'name',
          label: '型号名称',
          minWidth: '150px'
        }
      ]
      this.showTableCurrent = 1
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      this.pageParams.pageSize = val
    // 分页条件改变时判断需要分页查询的方法
    judgment() {
      switch (this.showTableCurrent) {
        case 0:
          this.getAllStandard()
          break
        case 1:
          this.getAllStandard()
          this.getSerialNumber(this.selectNode)
          break
        case 2:
          this.getAllStandard()
          this.getSpecifications(this.selectNode)
          break
      }
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      this.pageParams.pageSize = val
      this.judgment()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
      this.pageParams.pageNo = val
      this.judgment()
    }
  }
}