Commit d44eb8d6 by luyt

add:1.更新GlCombiForm,GlTableButton使用文档 2.table序号,复选框的宽度调整

1 parent e1271827
......@@ -48,7 +48,10 @@
title: 'GLTableButton',
link: '/components/GLTableButton'
},
{
title: 'GLCombiForm',
link: '/components/GLCombiForm'
},
]
}]
})
......
......@@ -125,6 +125,10 @@ export default {
visible: false,
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'id',
// 多选ref的名称
mutiSelectName: 'list',
tableOption: true,
tableColumns: [
{
......@@ -500,7 +504,10 @@ export default {
},
attrs: {
type: 'text',
disabled: false
//boolean或者函数
disabled:(row,condition)=>{
return true
}
},
listeners: {
click: this.conditionFn
......@@ -556,7 +563,11 @@ export default {
// },
// 属性
attrs: {
type: 'text'
type: 'text',
//boolean或者函数, 参数 row ,config
disabled:(row,condition)=>{
return true
}
},
//click事件 参数 row ,config
listeners: {
......
<!-- <content> -->
<h5>Tips:由于响应式是针对全屏显示,网站的内容区域宽度有限,所以会出现展示demo有些问题,但不影响使用1062px|1440px|1720px,表格每一项都有item.attrs,item.listeners穿透到element-ui组件</h5>
<GLCombiForm ref="showSearch" :rowNumber="2" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="handleOkFn" @handleRest="handleRestFn"></GLCombiForm>
<el-button type="warning" @click="toggleShow(1)">显示代码</el-button>
```js {mixin:true}
{
data() {
return {
demo1: true,
//gl-search数据
searchForm: {
queryText: '',
orderStatus: '',
packageCode: '',
merchantId: '',
dqtId: '',
pqId: '',
mdId: '',
auditStatus: '',
dataPerfection: '',
successDate: [],
effectiveDate: []
},
searchSelectObj: {
nameOrNoOrVin: {
attr: 'customerName',
value: ''
}
},
searchFormData: [
{
type: 'selectInput',
selectName: 'nameOrNoOrVin',
isClear: true,
inputWidth: '320px',
selectWidth: '110px',
selectOption: [
{
label: '客户姓名客户姓名客户姓名',
name: 'customerName'
},
{
label: '合同号',
name: 'contractNo'
},
{
label: '车架号',
name: 'vin'
}
],
handleSelectChange: value => {
this.searchSelectObj.nameOrNoOrVin.value = ''
}
},
{
label: '服务状态',
name: 'orderStatus',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'orderStatusList'
},
{
label: '产品名称',
name: 'packageCode',
type: 'select',
optionList: [],
optionId: 'packageCode',
optionLabel: 'packageName',
optionsName: 'goodsStatusList'
},
{
label: '提单成功时间',
name: 'successDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions',
//label 显示隐藏
showLabel:false,
},
{
label: '生效时间',
name: 'effectiveDate',
type: 'datePicker',
isClear: true,
isHide:true
},
// {
// label: '财务审核状态',
// name: 'auditStatus',
// type: 'select',
// optionList: [],
// optionId: 'confId',
// optionLabel: 'confName',
// optionsName: 'auditStatusList'
// },
// {
// label: '上传资料',
// name: 'dataPerfection',
// type: 'select',
// optionList: [],
// optionId: 'confId',
// optionLabel: 'confName',
// optionsName: 'dataPerfectionList'
// },
// {
// label: '总部',
// name: 'merchantId',
// type: 'select',
// optionList: [],
// optionId: 'merchantNo',
// optionLabel: 'merchantName',
// optionsName: 'merchantList',
// isHide: true,
// changeAttr: (val, targetItem) => {
// var idx = this.searchFormData.findIndex(item => item.name == this.levelToShow['2'])
// this.searchFormData[idx].isHide = false
// this.searchForm[this.levelToShow['2']] = ''
// var tempIdx = ''
// for (var i = 3; i <= 4; i++) {
// tempIdx = this.searchFormData.findIndex(item => item.name == this.levelToShow[i + ''])
// this.searchFormData[tempIdx].isHide = true
// this.searchForm[this.levelToShow[i + '']] = ''
// }
// this.getMerchantList(val, 2, this.searchFormData[idx].name, this.searchFormData[idx].optionsName)
// }
// },
// {
// label: '大区',
// name: 'dqtId',
// type: 'select',
// optionList: [],
// optionId: 'merchantNo',
// optionLabel: 'merchantName',
// optionsName: 'dqList',
// isHide: true,
// changeAttr: (val, targetItem) => {
// var idx = this.searchFormData.findIndex(item => item.name == this.levelToShow['3'])
// this.searchFormData[idx].isHide = false
// this.searchForm[this.levelToShow['3']] = ''
// var tempIdx = this.searchFormData.findIndex(item => item.name == this.levelToShow['4'])
// this.searchFormData[tempIdx].isHide = true
// this.searchForm[this.levelToShow['4']] = ''
// this.getMerchantList(val, 3, this.searchFormData[idx].name, this.searchFormData[idx].optionsName)
// }
// },
// {
// label: '片区',
// name: 'pqId',
// type: 'select',
// optionList: [],
// optionId: 'merchantNo',
// optionLabel: 'merchantName',
// optionsName: 'pqList',
// isHide: true,
// changeAttr: (val, targetItem) => {
// var idx = this.searchFormData.findIndex(item => item.name == this.levelToShow['4'])
// this.searchFormData[idx].isHide = false
// this.searchForm[this.levelToShow['4']] = ''
// this.getMerchantList(val, 4, this.searchFormData[idx].name, this.searchFormData[idx].optionsName)
// }
// },
// {
// label: '门店',
// name: 'mdId',
// type: 'select',
// optionList: [],
// optionId: 'merchantNo',
// optionLabel: 'merchantName',
// optionsName: 'mdList',
// isHide: true
// }
],
}
},
methods:{
toggleShow(num){
// console.log(123)
this['demo' + num] = !this['demo' + num]
},
handleOkFn() {
console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
},
}
}
```
# 用来作为 markdown 代码的示例部分
<div v-if="demo1">
```html
<template>
<GLCombiForm ref="showSearch" :rowNumber="2"
:formObj="searchForm"
:searchSelectObj="searchSelectObj"
:formData="searchFormData"
@handleOk="handleOkFn"
@handleRest="handleRestFn"></GLCombiForm>
</template>
<script>
export default {
data() {
return {
//gl-search数据
searchForm: {
queryText: '',
orderStatus: '',
packageCode: '',
merchantId: '',
dqtId: '',
pqId: '',
mdId: '',
auditStatus: '',
dataPerfection: '',
successDate: [],
effectiveDate: []
},
searchSelectObj: {
nameOrNoOrVin: {
attr: 'customerName',
value: ''
}
},
searchFormData: [
{
type: 'selectInput',
selectName: 'nameOrNoOrVin',
isClear: true,
inputWidth: '320px',
selectWidth: '110px',
selectOption: [
{
label: '客户姓名客户姓名客户姓名',
name: 'customerName'
},
{
label: '合同号',
name: 'contractNo'
},
{
label: '车架号',
name: 'vin'
}
],
handleSelectChange: value => {
this.searchSelectObj.nameOrNoOrVin.value = ''
}
},
{
label: '服务状态',
name: 'orderStatus',
type: 'select',
optionList: [],
optionId: 'confId',
optionLabel: 'confName',
optionsName: 'orderStatusList'
},
{
label: '产品名称',
name: 'packageCode',
type: 'select',
optionList: [],
optionId: 'packageCode',
optionLabel: 'packageName',
optionsName: 'goodsStatusList'
},
{
label: '提单成功时间',
name: 'successDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions',
//label 显示隐藏
showLabel:false,
},
{
label: '生效时间',
name: 'effectiveDate',
type: 'datePicker',
isClear: true,
isHide:true
},
]
}
},
methods: {
handleOkFn() {
console.log('您点击了确定')
},
handleRestFn() {
console.log('您点击了取消')
},
}
}
</script>
```
</div>
<!-- </content> -->
\ No newline at end of file
......@@ -28,7 +28,7 @@
:
</div>
</div>
<!-- addHtml自定义插槽 -->
<slot v-if="item.addHtml" :name="item.addHtml" :scope="item"></slot>
<span v-else-if="item.type === 'showTxt'">{{ formObj[item.name] }}</span>
<div v-else-if="item.type === 'input'">
......@@ -90,6 +90,7 @@
</div>
</GLSearchItem>
</el-form-item>
<!-- footer插槽 -->
<slot name="footer"></slot>
</el-form>
</GLSearch>
......@@ -129,6 +130,7 @@ export default {
type: Number,
default: 2
},
// 是否锁定
isBlock: {
type: Boolean,
default: false
......@@ -137,10 +139,13 @@ export default {
// type: String,
// default: '215px'
// },
// 表格ref
formRef: {
type: String,
default: 'formRef'
},
// 是否可以编辑
isEdit: {
type: Boolean,
default: false
......@@ -150,22 +155,28 @@ export default {
// // 默认是四个字符长度
// default: 56
// },
// label的右padding
labelPaddingRight: {
type: Number,
default: 0
},
// 表格数据
formData: {
type: Array,
default: () => []
},
// 表格对象
formObj: {
type: Object,
default: () => {}
},
// 是否有标题
hasTitle: {
type: Boolean,
default: true
},
// 表格校验规则
formRules: {
type: Object,
default: () => {}
......@@ -252,21 +263,25 @@ export default {
},
//gl-search 方法
handleOkFn() {
// 确定回调
this.$emit('handleOk')
},
handleRestFn() {
// 重置回调
this.$emit('handleRest')
},
// 选择框-添加其他属性
selectAddAttr(value, targetItem) {
// 选择框-添加其他属性
targetItem.changeAttr && targetItem.changeAttr(value, targetItem)
},
handleInputDown(e, item) {
// 处理input输入
if (e.keyCode === 13 && item.hasOwnProperty('keyFn')) {
item.keyFn()
}
},
handleInputBlur(e, item) {
// 处理input失去焦点
item.inputBlur && item.inputBlur(e, item)
}
},
......
......@@ -99,10 +99,14 @@
return '打开'
},
condition: row => {
return false
return true
},
attrs: {
type: 'text'
type: 'text',
//boolean或者函数
disabled:(row,condition)=>{
return true
}
},
listeners: {
click: this.conditionFn
......@@ -124,7 +128,7 @@
}
},
{
type: 'el-button',
type: 'GLButton',
name: row => {
return '新增2'
},
......@@ -132,28 +136,39 @@
return true
},
attrs: {
type: 'text'
type: 'text',
fn:'1-1-1-1'
},
listeners: {
click: this.conditionFn
}
},
{
// 类型
// 类型 GLButton | el-button
type: 'el-button',
// 名字 //自定义内容 可以是html结构
name: row => {
return '新增3'
},
// 条件判断
// 名字 //自定义内容 可以是html结构 || 或者字符串
// name: row => {
// return '新增3'
// },
name: '新增3',
// 条件判断 fn 或者不传,默认显示(todo promise), 参数 row ,config
condition: row => {
return true
},
// condition: (row) => {
// return new Promise((resolve, reject) => {
// setTimeout(resolve(true),2000)
// })
// },
// 属性
attrs: {
type: 'text'
type: 'text',
//boolean或者函数, 参数 row ,config
disabled:(row,condition)=>{
return true
}
},
//click事件
//click事件 参数 row ,config
listeners: {
click: this.conditionFn
}
......@@ -206,7 +221,7 @@
export default {
data() {
return {
// 测试表格更多操作项
// 测试表格更多操作项
buttonList: [
{
type: 'el-button',
......@@ -214,10 +229,14 @@
return '打开'
},
condition: row => {
return false
return true
},
attrs: {
type: 'text'
type: 'text',
//boolean或者函数
disabled:(row,condition)=>{
return true
}
},
listeners: {
click: this.conditionFn
......@@ -239,7 +258,7 @@
}
},
{
type: 'el-button',
type: 'GLButton',
name: row => {
return '新增2'
},
......@@ -247,28 +266,39 @@
return true
},
attrs: {
type: 'text'
type: 'text',
fn:'1-1-1-1'
},
listeners: {
click: this.conditionFn
}
},
{
// 类型
// 类型 GLButton | el-button
type: 'el-button',
// 名字 //自定义内容 可以是html结构
name: row => {
return '新增3'
},
// 条件判断
// 名字 //自定义内容 可以是html结构 || 或者字符串
// name: row => {
// return '新增3'
// },
name: '新增3',
// 条件判断 fn 或者不传,默认显示(todo promise), 参数 row ,config
condition: row => {
return true
},
// condition: (row) => {
// return new Promise((resolve, reject) => {
// setTimeout(resolve(true),2000)
// })
// },
// 属性
attrs: {
type: 'text'
type: 'text',
//boolean或者函数, 参数 row ,config
disabled:(row,condition)=>{
return true
}
},
//click事件
//click事件 参数 row ,config
listeners: {
click: this.conditionFn
}
......@@ -295,7 +325,7 @@
methods: {
//test table 更多 单行数据 ,单行的配置项
conditionFn(row,config) {
console.log('row: ', row,config)
console.log('row: ', row,config)
}
}
}
......
......@@ -7,8 +7,8 @@
<span :scope="scope"></span>
</template>
</el-table-column>
<el-table-column v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName" type="selection" width="55" :selectable="checkSelectable" :reserve-selection="true"></el-table-column>
<el-table-column v-if="hasNum" align="left" width="72px" label="序号" type="index" :index="index => index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"></el-table-column>
<el-table-column v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName" class-name="select-column" type="selection" width="48" :selectable="checkSelectable" :reserve-selection="true"></el-table-column>
<el-table-column v-if="hasNum" align="left" width="74" label="序号" class-name="select-index" type="index" :index="index => index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1"></el-table-column>
<el-table-column v-for="(item, index) in tableColumns" :key="index" v-bind="item.columnattrs ? item.columnattrs : {}" v-on="item.columnlisteners ? item.columnlisteners : {}" :label="item.label" :prop="item.prop" :width="item.width" :min-width="item.minWidth" :fixed="item.fixed" :align="item.align || 'left'" :sortable="item.sortable" :render-header="item.renderHeader">
<template slot-scope="scope">
<slot v-if="item.addHtml" :name="item.addHtml" :scope="scope.row" :prop="item.prop" :width="item.width"></slot>
......@@ -476,6 +476,16 @@ export default {
padding-right: 14px !important;
}
.glsx-table {
// .select-column{
// .cell{
// }
// }
// .select-index{
// .cell{
// }
// }
.el-table__empty-text {
line-height: 1;
}
......
......@@ -26,6 +26,7 @@
# 用来作为 markdown 代码的示例部分
<!-- <div v-if="demo1"> -->
```html
<template>
<test-comp @click="btnClick">常规按钮</test-comp>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!