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