|
|
@@ -3,9 +3,9 @@
|
|
|
<DkSplit ref="toolSplit" v-model="split">
|
|
|
<div slot="left">
|
|
|
<!--字段-->
|
|
|
- <DkButton ref="button" class="btn-class" size="small">{{'字段'}}
|
|
|
- <Icon v-if="hideFlag" type="md-arrow-dropleft" @click.stop="handleTools"/>
|
|
|
- <Icon v-else type="md-arrow-dropright" @click.stop="handleTools"/>
|
|
|
+ <DkButton ref="button" class="btn-class" size="small">{{ '字段' }}
|
|
|
+ <Icon v-if="hideFlag" type="md-arrow-dropleft" @click.stop="handleTools"/>
|
|
|
+ <Icon v-else type="md-arrow-dropright" @click.stop="handleTools"/>
|
|
|
</DkButton>
|
|
|
<DkSplit mode="vertical" :height="tableHeight" v-model="leftSplit">
|
|
|
<div slot="top" style="display: flex; justify-content: space-between; "
|
|
|
@@ -126,7 +126,7 @@
|
|
|
:key="index"
|
|
|
:field="item+''"
|
|
|
width="auto" :filter="false"
|
|
|
- :title="item+''"></DkTableColumn>
|
|
|
+ :title="getTitle(item)"></DkTableColumn>
|
|
|
</div>
|
|
|
<!--列维度(多维度)-->
|
|
|
<div v-else>
|
|
|
@@ -143,16 +143,16 @@
|
|
|
<DkTableColumn v-for="(cItem,cIndex) in [...colFields[colFields.length - 1].valuesFiltered]"
|
|
|
ref="col"
|
|
|
:key="cIndex"
|
|
|
- :field="itemTop + '_' + getTitle(groupCols,index) + cItem"
|
|
|
+ :field="itemTop + '_' + getField(groupCols,index) + cItem"
|
|
|
width="auto" :filter="false"
|
|
|
- :title="cItem+''"></DkTableColumn>
|
|
|
+ :title="getTitle(cItem)"></DkTableColumn>
|
|
|
</div>
|
|
|
<div v-if="gIndex === groupCols.length - 1 && dataFields.length > 1">
|
|
|
<!--子级(有多个值列)-->
|
|
|
<DkTableColumn v-for="(cItem,cIndex) in dataFields"
|
|
|
ref="col"
|
|
|
:key="cIndex"
|
|
|
- :field="itemTop + '_' + getTitle(groupCols,index) + cItem.key"
|
|
|
+ :field="itemTop + '_' + getField(groupCols,index) + cItem.key"
|
|
|
width="auto" :filter="false"
|
|
|
:title="cItem.label"></DkTableColumn>
|
|
|
</div>
|
|
|
@@ -167,7 +167,7 @@
|
|
|
:key="cIndex"
|
|
|
:field="itemTop + '_' + cItem"
|
|
|
width="auto" :filter="false"
|
|
|
- :title="cItem+''"></DkTableColumn>
|
|
|
+ :title="getTitle(cItem)"></DkTableColumn>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<!--子级(有多个值列)-->
|
|
|
@@ -287,15 +287,16 @@ export default {
|
|
|
this.fields.filter(field => field.valueFilter).forEach(field => {
|
|
|
fieldValues[field.key] = {}
|
|
|
})
|
|
|
-
|
|
|
+ const vm = Window.vm
|
|
|
return {
|
|
|
+ vm:vm,
|
|
|
internal: {
|
|
|
availableFieldKeys: this.availableFieldKeys,
|
|
|
rowFieldKeys: this.rowFieldKeys,
|
|
|
colFieldKeys: this.colFieldKeys,
|
|
|
dataFieldKeys: this.dataFieldKeys,
|
|
|
},
|
|
|
- hideFlag:false,
|
|
|
+ hideFlag: false,
|
|
|
split: 0.4,
|
|
|
leftSplit: 0.5,
|
|
|
tableHeight: 800,
|
|
|
@@ -340,8 +341,12 @@ export default {
|
|
|
// 有过滤
|
|
|
valueFilterableFields.forEach(field => {
|
|
|
let value = field.getter(item);
|
|
|
- if (value) {
|
|
|
+ if (typeof value === 'boolean') {
|
|
|
fieldsWithValues[field.key].valuesSet.add(value)
|
|
|
+ }else{
|
|
|
+ if (value) {
|
|
|
+ fieldsWithValues[field.key].valuesSet.add(value)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
// 无过滤
|
|
|
@@ -355,6 +360,7 @@ export default {
|
|
|
|
|
|
// Creates values sorted from valuesSet
|
|
|
valueFilterableFields.forEach(field => {
|
|
|
+ console.log('bb',field.sort)
|
|
|
fieldsWithValues[field.key].values = Array.from(fieldsWithValues[field.key].valuesSet).sort(field.sort || naturalSort)
|
|
|
// 给optionsValue赋值
|
|
|
fieldsWithValues[field.key].optionValues = fieldsWithValues[field.key].values.map(it => {
|
|
|
@@ -363,7 +369,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+ console.log('fieldsWithValues', fieldsWithValues)
|
|
|
return fieldsWithValues
|
|
|
},
|
|
|
// Fields selected values as set
|
|
|
@@ -496,10 +502,11 @@ export default {
|
|
|
* @author : 周兴
|
|
|
* @date : 2023/3/23 21:32
|
|
|
*/
|
|
|
- handleTools(){
|
|
|
+ handleTools() {
|
|
|
this.hideFlag = !this.hideFlag;
|
|
|
- if(this.hideFlag){
|
|
|
- this.$refs['toolSplit'].hidePane();``
|
|
|
+ if (this.hideFlag) {
|
|
|
+ this.$refs['toolSplit'].hidePane();
|
|
|
+ ``
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
@@ -523,7 +530,7 @@ export default {
|
|
|
* @author : 周兴
|
|
|
* @date : 2023/3/21 13:34
|
|
|
*/
|
|
|
- getTitle(groupCols, index) {
|
|
|
+ getField(groupCols, index) {
|
|
|
let titles = []
|
|
|
if (groupCols && groupCols.length > 0) {
|
|
|
groupCols.forEach(it => {
|
|
|
@@ -539,6 +546,19 @@ export default {
|
|
|
return '';
|
|
|
},
|
|
|
/**
|
|
|
+ * @desc : 要处理boolean的显示
|
|
|
+ * @author : 周兴
|
|
|
+ * @date : 2023/4/6 15:36
|
|
|
+ */
|
|
|
+ getTitle(value){
|
|
|
+ console.log('vv',value)
|
|
|
+ if(typeof value === 'boolean'){
|
|
|
+ return value? vm.$t('yes'):vm.$t('no')
|
|
|
+ }else{
|
|
|
+ return value + '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
* @desc : 更新表头列
|
|
|
* @author : 周兴
|
|
|
* @date : 2023/3/21 9:02
|
|
|
@@ -590,7 +610,7 @@ export default {
|
|
|
rowKey.push(field.getter(it) + '')
|
|
|
rowColumns[field.key] = field.getter(it) + ''
|
|
|
})
|
|
|
- if(rowColumns && Object.keys(rowColumns).length > 0){
|
|
|
+ if (rowColumns && Object.keys(rowColumns).length > 0) {
|
|
|
this.tableData.pushNoRepeat(rowColumns)
|
|
|
}
|
|
|
this.colFields.forEach(field => {
|
|
|
@@ -640,17 +660,17 @@ export default {
|
|
|
this.$refs.col.forEach(col => {
|
|
|
let headerFields = col.field.split('_')
|
|
|
// 如果只有一个值域,是不要显示
|
|
|
- if(this.dataFields.length == 1){
|
|
|
- let index = headerFields.findIndex(it=>it == this.dataFields[0].key)
|
|
|
+ if (this.dataFields.length == 1) {
|
|
|
+ let index = headerFields.findIndex(it => it == this.dataFields[0].key)
|
|
|
// 删除掉
|
|
|
- if(index >= 0){
|
|
|
- headerFields.splice(index,1)
|
|
|
+ if (index >= 0) {
|
|
|
+ headerFields.splice(index, 1)
|
|
|
}
|
|
|
}
|
|
|
let key = [...rowKeys, ...headerFields]
|
|
|
let value = valuesHashTable.get(key);
|
|
|
item[col.field] = value ? value.toThousandth() : null;
|
|
|
- // console.log('col.field',col.field,headerFields,valuesHashTable,key)
|
|
|
+ console.log('col.field',col.field,headerFields,valuesHashTable,key)
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
@@ -762,7 +782,7 @@ export default {
|
|
|
width: 100% !important;
|
|
|
}
|
|
|
|
|
|
-.btn-class{
|
|
|
+.btn-class {
|
|
|
width: 100%;
|
|
|
text-align: left;
|
|
|
}
|
|
|
@@ -790,5 +810,4 @@ export default {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
</style>
|