@@ -5,28 +5,11 @@ let extension = {
55 //表单header、content、footer对应位置扩充的组件
66 gridHeader : '' ,
77 gridBody : {
8- render ( ) {
9- return h (
10- resolveComponent ( 'ElAlert' ) ,
11- {
12- style : { 'margin-bottom' : '12px' } ,
13- 'show-icon' : true ,
14- type : 'success' ,
15- closable : false
16- } ,
17- [
18- h (
19- 'p' ,
20- { } ,
21- '1、 onInit(){ this.setFiexdSearchForm(true); //设置固定显示所有查询条件}'
22- ) ,
23- h (
24- 'p' ,
25- { } ,
26- ' 2、 可在扩展js中的onInit方法设置this.tableHeight/tableMaxHeight属性,指定table高度(默认自适应),如果设置 了tableMaxHeight属性,tableHeight则不会生效)'
27- )
28- ]
29- ) ;
8+ render ( h ) {
9+ return < el-alert style = { { 'margin-bottom' : '10px' } } type = "success" show-icon >
10+ < p v-html = "1、 onInit(){ this.setFiexdSearchForm(true){设置固定显示所有查询条件}" > </ p >
11+ < p v-html = "2、自定义表格按钮、弹出框提示、弹出框分组信息,见示例:App_Appointment.js文件" > </ p >
12+ </ el-alert >
3013 }
3114 } ,
3215 gridFooter : '' ,
@@ -40,12 +23,66 @@ let extension = {
4023 text :
4124 '代码生成器中设置[是否只读]或如果没有编辑或新建权限弹出框都是只读的(点击用户姓名列可查看表单分组)' ,
4225 methods : {
26+ btn1Click ( row , $e ) {
27+ $e . stopPropagation ( )
28+ this . edit ( row )
29+ } ,
30+ btn2Click ( row , $e ) {
31+ $e . stopPropagation ( )
32+ this . $message . success ( '点击了按钮' )
33+ } ,
4334 //事件扩展
4435 onInit ( ) {
4536
4637 //设置显示所有查询条件
4738 this . setFiexdSearchForm ( true ) ;
4839
40+ //表格上添加自定义按钮
41+ this . columns . push ( {
42+ title : "操作" ,
43+ field : "操作" ,
44+ width : 150 ,
45+ align : "center" ,
46+ render : ( h , { row, column, index } ) => {
47+ return < div >
48+ < el-button onClick = { ( $e ) => { this . btn1Click ( row , $e ) } } type = "primary" plain size = "small" style = "padding: 10px !important;" > 查看</ el-button >
49+ < el-button onClick = { ( $e ) => { this . btn2Click ( row , $e ) } } type = "success" plain size = "small" style = "padding: 10px !important;" > 按钮</ el-button >
50+ </ div >
51+ }
52+ } )
53+
54+ //增加弹出框提示信息
55+ //https://cn.vuejs.org/guide/extras/render-function.html#passing-slots
56+ //自定义提示
57+ this . editFormOptions [ 0 ] [ 0 ] . extra =
58+ {
59+ render : ( h ) => {
60+ return < el-popover
61+ placement = "top-start"
62+ title = "Title"
63+ width = "200"
64+ trigger = "hover"
65+ content = "this is content, this is content, this is content"
66+ >
67+ { /* 这里对应下面的#reference数据槽 */ }
68+ { { reference : < i class = 'el-icon-warning-outline' > </ i > } }
69+ </ el-popover >
70+ }
71+ }
72+
73+ // <el-popover
74+ // placement="top-start"
75+ // title="Title"
76+ // :width="200"
77+ // trigger="hover"
78+ // content="this is content, this is content, this is content"
79+ // >
80+ // <template #reference>
81+ // <el-button>Hover to activate</el-button>
82+ // </template>
83+ // </el-popover>
84+
85+
4986 //格式化单格颜色
5087 this . columns . forEach ( x => {
5188 if ( x . field == "PhoneNo" ) {
@@ -62,9 +99,9 @@ let extension = {
6299 }
63100 }
64101 }
65-
66- if ( x . field == 'Name' ) {
67- x . title = "点击查看表单"
102+
103+ if ( x . field == 'Name' ) {
104+ x . title = "点击查看表单"
68105 }
69106
70107 } )
@@ -74,83 +111,41 @@ let extension = {
74111 {
75112 colSize : 12 ,
76113 render : ( h ) => {
77- return h (
78- 'div' ,
79- {
80- style : {
81- display : 'flex' ,
82- 'margin-bottom' : '-4px' ,
83- 'line-height' : '20px' ,
84- 'margin-top' : '-10px' ,
85- 'padding-bottom' : '5px' ,
86- 'border-bottom' : '1px solid #eee'
87- }
88- } ,
89- [
90- h ( 'div' , {
91- style : {
92- height : '19px' ,
93- background : '#2dced9' ,
94- width : '9px' ,
95- 'border-radius' : '10px'
96- }
97- } ) ,
98- h (
99- 'div' ,
100- {
101- style : {
102- 'padding-left' : '6px' ,
103- 'font-weight' : 'bold' ,
104- 'font-size' : '13px'
105- }
106- } ,
107- '基础信息'
108- )
109- ]
110- ) ;
114+ return < div style = { {
115+ display : 'flex' , 'margin-bottom' : '-4px' , 'line-height' : '20px' ,
116+ 'margin-top' : '5px' , 'padding-bottom' : '5px' , 'border-bottom' : '1px solid rgb(238, 238, 238)'
117+ } } >
118+ < div style = "height: 19px; background: rgb(45, 206, 217); width: 9px; border-radius: 10px;" > </ div >
119+ < div style = "padding-left: 6px; font-weight: bold; font-size: 13px;" > 基本信息</ div >
120+ </ div >
111121 }
112122 }
113123 ] ) ;
114124
125+ //设置表单分组
115126
116127 this . editFormOptions . splice ( 2 , 0 , [
117128 {
118129 colSize : 12 ,
119130 render : ( h ) => {
120- return h (
121- 'div' ,
122- {
123- style : {
124- display : 'flex' ,
125- 'margin-bottom' : '-4px' ,
126- 'line-height' : '20px' ,
127- 'margin-top' : '5px' ,
128- 'padding-bottom' : '5px' ,
129- 'border-bottom' : '1px solid #eee'
130- }
131- } ,
132- [
133- h ( 'div' , {
134- style : {
135- height : '19px' ,
136- background : '#2dced9' ,
137- width : '9px' ,
138- 'border-radius' : '10px'
139- }
140- } ) ,
141- h (
142- 'div' ,
143- {
144- style : {
145- 'padding-left' : '6px' ,
146- 'font-weight' : 'bold' ,
147- 'font-size' : '13px'
148- }
149- } ,
150- '其他信息'
151- )
152- ]
153- ) ;
131+ return < div style = { {
132+ display : 'flex' , 'margin-bottom' : '-4px' , 'line-height' : '20px' ,
133+ 'margin-top' : '5px' , 'padding-bottom' : '5px' , 'border-bottom' : '1px solid rgb(238, 238, 238)'
134+ } } >
135+ < div style = "height: 19px; background: rgb(45, 206, 217); width: 9px; border-radius: 10px;" > </ div >
136+ < div style = "padding-left: 6px; font-weight: bold; font-size: 13px;" > 基本信息</ div >
137+ </ div >
138+ }
139+ }
140+ ] ) ;
141+
142+ //增加分段alert提示
143+ this . editFormOptions . splice ( 3 , 0 , [
144+ {
145+ colSize : 12 ,
146+ render : ( h ) => {
147+ return < el-alert title = "这里是自定的提示信息" style = { { padding : 0 } } type = "success" >
148+ </ el-alert >
154149 }
155150 }
156151 ] )
@@ -162,7 +157,7 @@ let extension = {
162157 this . tableMaxHeight = document . body . clientHeight - 415 ;
163158 } else {
164159 //设置表的最大高度
165- this . tableMaxHeight = this . height - 125 ; //400
160+ this . tableMaxHeight = this . height - 125 ; //400
166161 }
167162 //移除快捷查询
168163 this . singleSearch = null ;
0 commit comments