views

<el-col :span="1.5">
  <el-button
    type="danger"
    plain
    icon="el-icon-delete"
    size="mini"
    :disabled="multiple"
    @click="handleDelete"
    v-hasPermi="['qljsystem:businessplan:remove']"
  >删除</el-button>
</el-col>
<el-button
  size="mini"
  type="text"
  icon="el-icon-delete"
  @click="handleDelete(scope.row)"
  v-hasPermi="['qljsystem:businessplan:remove']"
>删除</el-button>
import { delBusinessplan } from "@/api/qljsystem/businessplan";
/** 删除按钮操作 */
handleDelete(row) {
  const ids = row.id || this.ids;
  this.$confirm('是否确认删除经营计划编号为"' + ids + '"的数据项?', "警告", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning"
  }).then(function() {
    return delBusinessplan(ids);
    //alert("ids==="+ids);
  }).then(() => {
    this.getList();
    this.msgSuccess("删除成功");
  })
},

api

// 删除供应草清单
export function delBusinessplan(id) {
  alert("delBusinessplanDelete==="+id);
  return request({
    url: '/qljsystem/businessplan/' + id,
    method: 'delete',
  })
}

controller

/**
    * 删除供应草清单
    */
   @PreAuthorize("@ss.hasPermi('qljsystem:businessplan:remove')")
   @Log(title = "经营计划", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
   public AjaxResult remove(@PathVariable Long[] ids)
   {
       return toAjax(qljBusinessplanService.deleteQljBusinessplanByIds(ids));
   }

service

/**
 * 批量删除经营计划
 * 
 * @param ids 需要删除的经营计划ID
 * @return 结果
 */
public int deleteQljBusinessplanByIds(Long[] ids);
/**
 * 批量删除供应草清单
 * 
 * @param ids 需要删除的供应草清单ID
 * @return 结果
 */
@Override
public int deleteQljBusinessplanByIds(Long[] ids)
{
    return qljBusinessplanMapper.deleteQljBusinessplanByIds(ids);
}

mapper

/**
 * 批量删除经营计划
 * 
 * @param ids 需要删除的数据ID
 * @return 结果
 */
public int deleteQljBusinessplanByIds(Long[] ids);

mapper.xml

<update id="deleteQljBusinessplanByIds" parameterType="String">
    update qlj_businessplan set delete_flag = 1 where id in
    <foreach item="id" collection="array" open="(" separator="," close=")">
        #{id}
    </foreach>
</update>
Logo

快速构建 Web 应用程序

更多推荐