排序号修改的逻辑

1.构建修改排序号传递的参数

formInline2:{ recommendType:4, //产品类型 merchantCodes:[], //产品code discountRecommendSort:0 //设置品牌特惠专区排序 },

2.给参数赋值

    //获得品牌商ID
    this.formInline2.merchantCodes=[];
      this.formInline2.merchantCodes.push(params.row.merchantCode);

给要修改的排序号赋值

.获得要修改的排序号recommendSort的值,并且将它赋值给我们输入的值 this.formInline2.discountRecommendSort=e.target.value;

3.调修改排序号的接口,将参数传递进去

areasort(this.formInline2).then(res=>{ //4.当调接口成功返回200,就调list 接口刷新页面 //console.log(res.status) } console.log(params.row.discountFlag); }).catch(error=>{

      });

4.刷新页面

if(params.row.discountRecommendSort==0) { this.data1=res.data.data ? res.data.data :[] } if(params.row.discountRecommendSort==1) { this.data2=res.data.data ? res.data.data :[]

}

5.table 中要修改的排序号添加方法

{ title: '特惠排序号', key: 'discountSort', align: 'center', sortable: true, //排序 sortType: 'asc', render: (h, params) => { return h('div', [ h('Input', { props: { type: 'text', size: 'small', value:params.row.discountSort }, style: { marginRight: '5px' }, on: { //失去焦点触发事件 'on-blur': (e) => { //console.log(params.row.productCode) this.sort(e,params); //修改排序的方法 } } }, )]) } },

完整代码:

js

    //修改排序号
sort(e,params) {
//1.获得品牌商ID
this.formInline2.merchantCodes=[];
this.formInline2.merchantCodes.push(params.row.merchantCode);
//2.获得要修改的排序号recommendSort的值,并且将它赋值给我们输入的值
this.formInline2.discountRecommendSort=e.target.value;
//3.调修改排序号的接口
areasort(this.formInline2).then(res=>{
//4.当调接口成功返回200,就调list 接口刷新页面
//console.log(res.status)
if(res.status==) {
//console.log(params.row.discountFlag);
referentialproduct(params.row.discountRecommendSort)
.then(res=>{
console.log(params.row.discountRecommendSort);
if(params.row.discountRecommendSort==) {
this.data1=res.data.data ? res.data.data :[]
}
if(params.row.discountRecommendSort==) {
this.data2=res.data.data ? res.data.data :[]
}
this.$Message.success(res.data.msg);
this.loading= false;
} )
.catch(error=>{} );
console.log(params.row.discountFlag)
}
console.log(params.row.discountFlag);
}).catch(error=>{ });
},

table

  {
title: '特惠排序号',
key: 'discountSort',
align: 'center',
sortable: true, //排序
sortType: 'asc',
render: (h, params) => {
return h('div', [
h('Input', {
props: {
type: 'text',
size: 'small',
value:params.row.discountSort
},
style: {
marginRight: '5px'
},
on: {
//失去焦点触发事件
'on-blur': (e) => {
//console.log(params.row.productCode)
this.sort(e,params); //修改排序的方法
}
}
}, )])
}
},

最新文章

  1. 如何快速开发SPA应用
  2. C++ 系列:多线程编程基础知识
  3. Thinkphp的初级注意点
  4. JAVA 语法基础综合练习——学生成绩管理系统
  5. 建站集成软件包 XAMPP搭建后台系统与微信小程序开发
  6. BZOJ3346 : Ural1811 Dual Sim Phone
  7. [CareerCup] 3.3 Set of Stacks 多个栈
  8. require 和 file_get_contents
  9. IOS绘图——简单三角形
  10. CLR via C# 序列化读书笔记
  11. jQuery事件绑定和委托
  12. <video>和<audio>标签
  13. 递归:这帮坑爹的小兔崽子 - 零基础入门学习Python023
  14. Scrapy安装问题
  15. JS操作字符串
  16. C++代码利用pthread线程池与curl批量下载地图瓦片数据
  17. HDU 2086 A1 = ? (找规律推导公式 + 水题)(Java版)
  18. Java+selenium之WebDriver常见特殊情况如iframe/弹窗处理(四)
  19. 变量存储缓存机制 Number (int bool float complex)
  20. [拍摄]『ROSE 拆解』SONY 摄像机镜头拆解。

热门文章

  1. 英语单词profile
  2. python学习笔记(三)字典操作和元组操作
  3. vue父组件异步数据子组件接收遇到的坑
  4. S1 Python 基础
  5. 前端每日实战:23# 视频演示如何用纯 CSS 创作一个菜单反色填充特效
  6. identityserver4踩坑总结
  7. selenium2-java 浏览器下进行登录
  8. CentOS7下安装安装android sdk & gradle
  9. Python 进阶_OOP 面向对象编程_静态方法和类方法
  10. spring boot 尚桂谷学习笔记07 嵌入式容器 ---Web