Commit 24778dac by luyt

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

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