rk
2025-12-15 12d724c247e4f7dcb77b3a94891ccf4d86b53cfa
admin/src/views/business/goodsLabels.vue
@@ -5,7 +5,7 @@
      <el-form-item label="分类名称" prop="name">
        <el-input v-model="searchForm.name" placeholder="请输入分类名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="所属板块" prop="module">
<!--      <el-form-item label="所属板块" prop="module">
        <el-select
          v-model="searchForm.module"
          placeholder="请选择所属板块"
@@ -21,7 +21,7 @@
            label="咖豆商城"
          ></el-option>
        </el-select>
      </el-form-item>
      </el-form-item>-->
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
@@ -49,6 +49,18 @@
        <el-table-column prop="name" label="分类名称" min-width="100px"></el-table-column>
        <el-table-column prop="sortnum" label="排序码(升序)" min-width="100px"></el-table-column>
        <el-table-column prop="createDate" label="创建时间" min-width="100px"></el-table-column>
        <el-table-column prop="status" label="状态" min-width="100px">
          <template slot-scope="{row}">
            <el-switch
                v-model="row.status"
                :active-value="1"
                :inactive-value="0"
                active-color="#13ce66"
                inactive-color="#ff4949"
                @change="statusChange(row)"
            ></el-switch>
          </template>
        </el-table-column>
        <el-table-column
          v-if="containPermissions(['business:productlabel:update', 'business:productlabel:delete'])"
          label="操作"
@@ -86,7 +98,7 @@
    return {
      // 搜索
      searchForm: {
        name: '',
        module: '',
        type: 0
@@ -101,6 +113,20 @@
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    statusChange (row) {
      this.api.updateById({ id: row.id, status: row.status })
        .then(() => {
          this.$message.success('操作成功')
        })
        .catch(e => {
          this.$message.error('操作成功')
        })
        .then(() => {
          this.handlePageChange()
        })
    }
  }
}
</script>