config.js
3.39 KB
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
//组件参数数据
export const componentsData = {
categoryOptions:{
'xuan_huan':'玄幻',
'qi_huan':'奇幻',
'wu_xia':'武侠',
'xian_xia':'仙侠',
'du_shi':'都市',
'ke_huan':'科幻',
'lin_yi':'灵异'
}
};
// 搜索model
export const bookSearchModel = {
'code': null,
'name': null,
'category': null
};
// 表格展示配置
export const tableColumns = function() {
return [
{
type: 'checkbox',
fixed: 'left'
},
{
text: '编号',
field: 'code',
minWidth: 140,
render: (h, param) => {
return h('elLink', {
props: {
type: 'primary'
},
on: {
click: () => {
this.handleOpt('VIEW', param.row);
}
}
}, param.row.code);
},
align: 'left'
},
{
text: '书名',
field: 'name',
width: 200,
align: 'left'
},
{
text: '类别',
field: 'category',
width: 200,
render: (h, param) => {
if(param.row && param.row.category){
let text = [];
param.row.category.split(',').forEach(item=>{
text.push(componentsData.categoryOptions[item]);
})
return text.join(',');
}
return '--';
},
align: 'left'
},
{
text: '简介',
field: 'description',
width: 200,
align: 'left'
},
{
text: '创建人',
field: 'createdByName',
align: 'left',
width: 100
},
{
text: '创建时间',
field: 'createdAt',
width: 160,
sortable: true,
render: (h, param) => {
if(param.row.createdAt){
const text = param.row.createdAt.substr(0,16);
return text;
}
return '--';
},
align: 'left'
},
{
field: 'opt',
fixed: 'right',
text: '操作',
width: 100,
render: (h, param) => {
const row = param.row;
const optArr = [];
const editBtn = h('QgButton', {
props: {
toolTip: '编辑',
type: 'text',
icon: 'el-icon-edit'
},
on: {
click: () => {
this.handleOpt('EDIT', row);
}
}
});
optArr.push(editBtn);
const deleteBtn = h('QgButton', {
props: {
toolTip: '删除',
type: 'text',
icon: 'el-icon-delete'
},
on: {
click: () => {
this.handleOpt('DELETE', row);
}
}
});
optArr.push(deleteBtn);
return h('div', optArr, '');
}
}
];
};
// 表单对象
export const bookModel = {
code:null,
name:null,
category:['科幻','Option2','奇幻'],
description:null,
picture:null
};