1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
| window.parentVue = new Vue({
| el: '#app0',
| data() {
| return {
| query: {
| huiMinName: '',
| huiMinType: '',
| dateRange: [],
| status: '',
| huiMinStatus: '',
| },
| loading: false,
| currentPage: 1,
| pageSize: 10,
| total: 800,
| ids: [],
| tableData: [
| ]
| }
| },
| methods: {
| handleSearch() {
| console.log('搜索条件:', this.query)
| this.loading = true;
| const vm = this; // 保留Vue实例引用
| let ajax = new $ax(Feng.ctxPath + "/tHuiminCard/list",
| (data) => { // 改用箭头函数
| console.log('原始数据:', data);
| this.loading = false;
| if(data.rows && Array.isArray(data.rows)){
| vm.tableData = data.rows;
| vm.total = data.total;
| }else{
| vm.tableData = [];
| vm.total = 0;
| }
| },
| (data) => {
| this.loading = false;
| Feng.error("搜索失败: " + (data.responseJSON?.message || '服务器异常')); // 错误提示优化
| });
|
| console.log('请求参数222:', this.query.dateRange)
| // 添加请求参数
| ajax.set({
| current: this.currentPage,
| size: this.pageSize,
| startTime: this.query.dateRange !=null && this.query.dateRange.length > 0 ? this.query.dateRange[0] : null,
| endTime: this.query.dateRange !=null && this.query.dateRange.length > 0 ? this.query.dateRange[1] : null,
| ...this.query
| });
| ajax.start();
| },
| handleAdd() {
| // 添加逻辑
| THuiminCard.openAddTHuiminCard();
| },
| handleEdit(id) {
| if (this.ids.length === 0){
| Feng.info('请选择要操作的数据')
| return
| }
| if (this.ids.length > 1){
| Feng.info('请选择一条数据')
| return
| }
| THuiminCard.openTHuiminCardDetail(this.ids[0], 'edit')
| },
| handleDelete() {
| // 删除逻辑
| console.log(this.ids)
| if (this.ids.length === 0){
| Feng.info('请选择要操作的数据')
| return
| }
| const mv = this
| this.ids.forEach(id => {
|
| const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/delete", function (data) {
| Feng.success("操作成功!");
| mv.handleSearch();
| }, function (data) {
| Feng.error("操作失败!" + data.responseJSON.message + "!");
| });
| ajax.set("ids",mv.ids.join(","));
| ajax.start();
| })
| },
| handleShelves(status) {
| // 上架逻辑
| console.log(this.ids)
| if (this.ids.length === 0){
| Feng.info('请选择要操作的数据')
| return
| }
| const mv = this
| this.ids.forEach(id => {
|
| const ajax = new $ax(Feng.ctxPath + "/tHuiminCard/changeState", function (data) {
| Feng.success("操作成功!");
| mv.handleSearch();
| }, function (data) {
| Feng.error("操作失败!" + data.responseJSON.message + "!");
| });
| ajax.set("id",id);
| ajax.set("status",status);
| ajax.start();
|
|
| })
|
| },
| handleUnshelve() {
| // 下架逻辑
| },
| handleSizeChange(val) {
| this.pageSize = val
| this.handleSearch()
| },
| handleCurrentChange(val) {
| this.currentPage = val
| this.handleSearch()
| },
| handleSelectionChange(selection) {
| // 多选处理
| console.log(11)
| this.ids = selection.map(item => item.id)
| },
| handleViewDetail(row) {
| if (this.ids.length === 0 && !row){
| Feng.info('请选择要操作的数据')
| return
| }
| if (this.ids.length > 1 && !row){
| Feng.info('请选择一条数据')
| return
| }
| // 查看详情
| let id;
| if (row){
| id = row.id
| }else {
| id = this.ids[0]
| }
| THuiminCard.openTHuiminCardDetail(id,'detail')
| }
| },
| created() {
| // 初始化逻辑
| this.handleSearch()
| }
| });
|
|