jiaosong
2023-09-21 2193f1e8240e2a0ed5900dddc6347a1d9db081cf
company_admin/src/views/business/goods.vue
@@ -68,7 +68,7 @@
          <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(0)">批量上架</el-button>
          <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(1)">批量下架</el-button>
          <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:goods:delete']">删除</el-button></li> -->
          <el-button style="background: red;border-color:red" type="primary" :loading="isWorking.export" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:goods:delete']">批量删除</el-button>
        </ul>
        <el-table
          v-loading="isWorking.search"
@@ -151,7 +151,6 @@
      <selectProduct ref="selectProduct" @success="handlePageChange" @result="search"/>
    </TableLayout>
  </template>
  <script>
  import BaseTable from '@/components/base/BaseTable'
  import TableLayout from '@/layouts/TableLayout'
@@ -200,19 +199,21 @@
      this.getcategory()
    },
    methods: {
      handleSelectionChange(e) {
        let arr = e.map(item => item.id)
        this.ids = arr.join(',')
        console.log(this.ids)
      },
    // handleSelectionChange(e) {
    //   let arr = e.map(item => item.id)
    //   this.ids = arr.join(',')
    //   console.log(this.ids)
    // },
      // 批量上下架
      bulkOperation(type) {
        if (!this.ids) {
      if (this.tableData.selectedRows.length === 0) {
      // if (!this.ids) {
          this.$message.warning({ message: '至少选择一项内容' })
          return
        }
      const idList = this.tableData.selectedRows.map(item => item.id)
        batchUpdateDisableById({
          ids: this.ids,
        ids: idList.join(','),
          status: type
        }).then(res => {
          this.$message.success({ message: res })
@@ -312,4 +313,3 @@
    }
  }
  </script>