Commit 24778dac by luyt

feat:1.表单样式添加 ml20 公共类

2.表单样式修复gl-form-min 下的计数器样式
3.el-textarea下的数字限制定位调整到外边
4.调整表单input禁用样式
1 parent 74f59bc6
......@@ -43,8 +43,8 @@
</GLDialog> -->
<hr />
<h3>el-table调整</h3>
<i class="gl-icon-question"></i>
<GLTableOption @change="changeFn" :optionsList="optionsList"></GLTableOption>
<i class="gl-icon-circle-question"></i>
<GLTableOption @change="changeFn" :optionsList="optionsList" @onEnd="onEnd"></GLTableOption>
<GLTable ref="liveRoomRef" :tableParams="tableParams" :tableData="tableData" max-height="250">
<span slot="shareImgUrl" slot-scope="scope">
<img class="img-60" :src="scope.scope.shareImgUrl" />
......@@ -814,7 +814,16 @@ export default {
},
{
label: '复选框c',
prop: 'liveStatus3',
// prop: 'liveStatus3',
children:[
{
label: '复选框c-1',
prop: 'liveStatus3-1',
},{
label: '复选框c-2',
prop: 'liveStatus3-2',
},
]
},
{
label: '禁用',
......@@ -1151,6 +1160,9 @@ export default {
changeFn(checkList,checkAttrList){
console.log('checkList,checkAttrList: ', checkList,checkAttrList);
},
onEnd(list){
console.log('list: ', list);
}
}
......
......@@ -4,15 +4,20 @@
<div class="gl-title">
表头字段配置
<el-tooltip content="点击字段前的图标可拖动位置" popper-class="gl-tip" placement="bottom" effect="light">
<i class="gl-icon-question"></i>
<i class="gl-icon-circle-question"></i>
</el-tooltip>
</div>
<div class="gl-content">
<el-checkbox-group v-model="innerValue" @change="changeFn">
<vuedraggable v-model="innerOptionsList" draggable=".item" group="tableClomns" animation="500" @onStart="startHook" @onEnd="endHook">
<transition-group>
<el-checkbox :class="{ item: !disabledList.includes(item[attr]) }" v-for="(item, index) in innerOptionsList" :label="item[attr]" :key="'tableOpt' + index" :disabled="disabledList.includes(item[attr])">{{ item[attrLabel] }}</el-checkbox>
</transition-group>
<vuedraggable v-model="innerOptionsList" draggable=".item" group="tableClomns" animation="10" @start="startHook" @end="endHook">
<template v-for="(item, index) in innerOptionsList">
<template v-if="item.children">
<subOption :key="'tableOpt' + index" :class="{ item: !disabledList.includes(item[attr]) }" :innerOptionsObj="item" :disabledList="disabledList" :attr="attr" :attrLabel="attrLabel" @onStart="onStartFn" @onEnd="onEndFn" @change="subChange"></subOption>
</template>
<template v-else>
<el-checkbox :key="'tableOpt' + index" :class="{ item: !disabledList.includes(item[attr]) }" :label="item[attr]" :disabled="disabledList.includes(item[attr])">{{ item[attrLabel] }}</el-checkbox>
</template>
</template>
</vuedraggable>
</el-checkbox-group>
</div>
......@@ -21,12 +26,13 @@
<el-button type="primary" size="small">确定</el-button>
</div>
</div>
<el-button plain size="small" class="btn-three" icon="gl-icon-cog-fill" round slot="reference"></el-button>
<el-button plain size="small" class="btn-three" icon="gl-icon-cog" round slot="reference"></el-button>
</el-popover>
</template>
<script>
import vuedraggable from 'vuedraggable'
import subOption from './sub.vue'
export default {
name: 'GLTableOption',
props: {
......@@ -48,26 +54,28 @@ export default {
},
data() {
return {
innerValue: [],
innerValue: [], //父项选中的值
innerOptionsList: [],
disabledList:[]
disabledList: [],
subSelectArr: [] //子项选中的值
}
},
mounted() {
this.innerOptionsList = this.getOrderList()
this.innerValue = this.getCheckAttrList('checkItem')
this.disabledList = this.getCheckAttrList('disabledCheck')
this.innerValue = this.getCheckAttrList('checkItem')
this.disabledList = this.getCheckAttrList('disabledCheck')
},
methods: {
// 获取选中项的对应的attr属性数组
getCheckAttrList(propertyName){
return this.innerOptionsList.filter(item=>item[propertyName]).map(item=>item[this.attr])
getCheckAttrList(propertyName) {
return this.innerOptionsList.filter(item => item[propertyName]).map(item => item[this.attr])
},
//排序order(将禁用项提前)
getOrderList(){
return this.optionsList.sort((a,b)=>{
if(!a.order)a.order = 0
if(!b.order)b.order = 0
getOrderList() {
return this.optionsList.sort((a, b) => {
if (!a.order) a.order = 0
if (!b.order) b.order = 0
return b.order - a.order
})
},
......@@ -76,25 +84,49 @@ export default {
},
endHook() {
//列表顺序
this.$emit('onEnd', innerOptionsList)
this.$emit('onEnd', this.innerOptionsList)
},
onStartFn() {
this.startHook()
},
onEndFn(list) {
console.log('list: ', list)
this.endHook()
},
// 当绑定值变化时触发的事件
changeFn() {
this.$emit('change', this.getCheckList(), this.innerValue)
changeFn(selectList) {
//选中的checkbox项
let res = selectList.concat(this.subSelectArr)
this.$emit('change', this.getCheckList(), res)
},
subChange(selectList) {
// this.changeFn(selectList)
this.subSelectArr = selectList
let res = this.innerValue.concat(selectList)
this.$emit('change', this.getCheckList(), res)
},
// 获取选中的列表配置项
getCheckList() {
if (this.innerOptionsList.length === 0) return
const resultArr = this.innerOptionsList.filter(item => {
if (this.innerValue.includes(item[this.attr])) {
return item
}
})
return resultArr
// const resultArr = this.innerOptionsList.filter(item => {
// if (this.innerValue.includes(item[this.attr])) {
// return item
// }
// })
// return resultArr
let arr = this.innerOptionsList.flat()
}
},
components: {
vuedraggable
vuedraggable,
subOption
}
}
</script>
......
<template>
<div class="sub-option">
<div class="title">{{ innerOptionsObj[attrLabel] }}</div>
<el-checkbox-group v-model="subSelectValue" @change="changeFn">
<vuedraggable v-model="innerOptionsObj.children" draggable=".item" group="tableClomns-sub" @start="startHook" @end="endHook">
<template v-for="(item, index) in innerOptionsObj.children">
<template v-if="item.children">
<subOption :key="'tableOpt' + index" :class="{ item: !disabledList.includes(item[attr]) }" :innerOptionsObj="item.children" :disabledList="disabledList" :attr="attr" :attrLabel="attrLabel" @change="subChange"></subOption>
</template>
<template v-else>
<el-checkbox :key="'tableOpt' + index" :class="{ item: !disabledList.includes(item[attr]) }" :label="item[attr]" :disabled="disabledList.includes(item[attr])">{{ item[attrLabel] }}</el-checkbox>
</template>
</template>
</vuedraggable>
</el-checkbox-group>
</div>
</template>
<script>
import { utils } from 'glsx-common'
import vuedraggable from 'vuedraggable'
export default {
name: 'sub-option',
props: {
innerOptionsObj: {
type: Object,
default: () => ({})
},
disabledList: {
type: Array,
default: () => []
},
attr: {
type: String,
default: 'prop'
},
attrLabel: {
type: String,
default: 'label'
}
},
data() {
return {
subSelectValue: [], //本次选中
resSelectValue: [] //最终导出
}
},
mounted() {
//还原勾选数据
if (sessionStorage.getItem('subSelect')) {
this.subSelectValue = JSON.parse(sessionStorage.getItem('subSelect'))
}
},
methods: {
startHook() {
this.$emit('onStart')
},
endHook() {
//列表顺序
this.$emit('onEnd', this.innerOptionsObj)
},
changeFn(selectList) {
let copySelectList = utils.deepClone(selectList)
sessionStorage.setItem('subSelect', JSON.stringify(copySelectList))
this.$emit('change', selectList)
},
subChange(selectList) {
this.changeFn(selectList)
}
},
components: {
vuedraggable
}
}
</script>
<style lang="scss">
.sub-option {
.title {
font-size: 14px;
}
.el-checkbox {
margin-left: 10px;
}
}
</style>
......@@ -672,6 +672,9 @@ $lightColorDisabled: $color-primary-light04;
.ml12 {
margin-left: 12px;
}
.ml20{
margin-left: 20px;
}
.mr12 {
margin-right: 12px;
}
......@@ -723,6 +726,11 @@ $lightColorDisabled: $color-primary-light04;
border-radius: 4px;
}
.el-input {
&.is-disabled{ //禁用样式
.el-input__inner{
background-color:#EEEEEE;
}
}
width: 432px;
}
.el-input-number{
......@@ -739,6 +747,10 @@ $lightColorDisabled: $color-primary-light04;
}
.el-textarea {
width: 580px !important;
.el-input__count{
right: -38px;
bottom: -12px;
}
}
.el-select {
width: 432px;
......@@ -772,6 +784,12 @@ $lightColorDisabled: $color-primary-light04;
width: 284px;
}
}
.el-input-number{
width: 136px;
.el-input {
width:100%;
}
}
.el-date-editor {
width: 284px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!