fix 80286

This commit is contained in:
赵霄
2024-01-12 16:04:19 +08:00
parent d78e3f096d
commit 304e9f2af1
3 changed files with 128 additions and 51 deletions
+6 -2
View File
@@ -86,6 +86,7 @@ export const ConfigurableTableMixin = {
// 过滤没有权限的按钮 // 过滤没有权限的按钮
if (this.needFilterTableBtn) { if (this.needFilterTableBtn) {
this.operationList = this.operationList.filter(item => !item.has || isHasPermission(item.has)) this.operationList = this.operationList.filter(item => !item.has || isHasPermission(item.has))
console.log(this.operationList)
} }
}, },
methods: { methods: {
@@ -164,8 +165,11 @@ export const ConfigurableTableMixin = {
}) })
if (this.showAction && this.operateColumn) { if (this.showAction && this.operateColumn) {
let width = 0 let width = 0
if (this.operationList && this.operationList.length > 0) { if (this.operationList && this.operationList.length > this.operateMaxNum + 1) {
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.$t('more')) width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.$t('more'))
} else if (this.operationList && this.operationList.length > 1) {
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.operationList[1].text)
console.log(width)
} }
const operateColumn = JSON.parse(JSON.stringify(this.operateColumn)) const operateColumn = JSON.parse(JSON.stringify(this.operateColumn))
operateColumn.width = width || 100 operateColumn.width = width || 100
@@ -184,7 +188,7 @@ export const ConfigurableTableMixin = {
const context = canvas.getContext('2d') const context = canvas.getContext('2d')
context.font = fontStyle || '14px' // 设置字体样式 context.font = fontStyle || '14px' // 设置字体样式
const dimension = context.measureText(text) const dimension = context.measureText(text)
return dimension.width + 40 return dimension.width + 60
}, },
getQueryParams () { getQueryParams () {
const param = Object.assign({}, this.searchParams, this.isorter, this.filters) const param = Object.assign({}, this.searchParams, this.isorter, this.filters)
@@ -158,30 +158,66 @@
</template> </template>
<template v-slot:operation="{text, record}"> <template v-slot:operation="{text, record}">
<!-- 收藏--> <template v-if="operationList.length > operateMaxNum + 1">
<a @click="operationClick(operationList[0],record)" v-has="operationList[0].has"> <!-- 收藏-->
<i class="iconfont icon-star1" v-show="record.collectionFlag" /> <a @click="operationClick(operationList[0],record)"
<i class="iconfont icon-star" v-show="!record.collectionFlag" /> v-if="operationList[0].text === $t('standardRegulationLibrary.domesticStandard.cancelCollection')">
</a> <i class="iconfont icon-star1" v-show="record.collectionFlag" />
<a-divider type="vertical" /> <i class="iconfont icon-star" v-show="!record.collectionFlag" />
<a-dropdown placement="bottomCenter"> </a>
<a-icon type="more" class="operate-icon-btn operate-icon-more" /> <a v-else @click="operationClick(operationList[0],record)">
<a-menu slot="overlay"> <div class="operate-btn">
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index"> <!-- 编辑图标-->
<a @click="operationClick(operation,record)" v-has="operation.has"> <i class="iconfont icon-bianji operate-btn-icon" v-if="operationList[0].text === $t('edit')" />
<div class="operate-btn"> <!-- 分享图标-->
<!-- 编辑图标--> <i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operationList[0].text === $t('share')" />
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" /> <!-- 删除图标-->
<!-- 分享图标--> <i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operationList[0].text === $t('delete')" />
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" /> {{ operationList[0].text }}
<!-- 删除图标--> </div>
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" /> </a>
{{ operation.text }} <a-divider type="vertical" />
</div> <a-dropdown placement="bottomCenter">
</a> <a-icon type="more" class="operate-icon-btn operate-icon-more" />
</a-menu-item> <a-menu slot="overlay">
</a-menu> <a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
</a-dropdown> <a @click="operationClick(operation,record)">
<div class="operate-btn">
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标-->
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" />
<!-- 删除图标-->
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
{{ operation.text }}
</div>
</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
<template v-else-if="operationList.length > 0">
<template v-for="(operation, index) in operationList">
<!-- 收藏-->
<a :key="index" @click="operationClick(operationList[0],record)"
v-if="operation.text === $t('standardRegulationLibrary.domesticStandard.cancelCollection')">
<i class="iconfont icon-star1" v-show="record.collectionFlag" />
<i class="iconfont icon-star" v-show="!record.collectionFlag" />
</a>
<a v-else @click="operationClick(operation,record)" style="display: inline-block">
<div class="operate-btn">
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标-->
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" />
<!-- 删除图标-->
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
{{ operation.text }}
</div>
</a>
<a-divider type="vertical" v-if="index !== operationList.length - 1" />
</template>
</template>
</template> </template>
</j-table> </j-table>
</div> </div>
@@ -287,7 +323,8 @@ export default {
tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段 tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段
treeLoading: false, treeLoading: false,
isCollection: false, isCollection: false,
expandedKeys: [] // 展开的节点 expandedKeys: [], // 展开的节点
needFilterTableBtn: true
} }
}, },
computed: { computed: {
@@ -159,30 +159,66 @@
</template> </template>
<template v-slot:operation="{text, record}"> <template v-slot:operation="{text, record}">
<!-- 收藏--> <template v-if="operationList.length > operateMaxNum + 1">
<a @click="operationClick(operationList[0],record)" v-has="operationList[0].has"> <!-- 收藏-->
<i class="iconfont icon-star1" v-show="record.collectionFlag" /> <a @click="operationClick(operationList[0],record)"
<i class="iconfont icon-star" v-show="!record.collectionFlag" /> v-if="operationList[0].text === $t('standardRegulationLibrary.domesticStandard.cancelCollection')">
</a> <i class="iconfont icon-star1" v-show="record.collectionFlag" />
<a-divider type="vertical" /> <i class="iconfont icon-star" v-show="!record.collectionFlag" />
<a-dropdown placement="bottomCenter"> </a>
<a-icon type="more" class="operate-icon-btn operate-icon-more" /> <a v-else @click="operationClick(operationList[0],record)">
<a-menu slot="overlay"> <div class="operate-btn">
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index"> <!-- 编辑图标-->
<a @click="operationClick(operation,record)" v-has="operation.has"> <i class="iconfont icon-bianji operate-btn-icon" v-if="operationList[0].text === $t('edit')" />
<div class="operate-btn"> <!-- 分享图标-->
<!-- 编辑图标--> <i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operationList[0].text === $t('share')" />
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" /> <!-- 删除图标-->
<!-- 分享图标--> <i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operationList[0].text === $t('delete')" />
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" /> {{ operationList[0].text }}
<!-- 删除图标--> </div>
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" /> </a>
{{ operation.text }} <a-divider type="vertical" />
</div> <a-dropdown placement="bottomCenter">
</a> <a-icon type="more" class="operate-icon-btn operate-icon-more" />
</a-menu-item> <a-menu slot="overlay">
</a-menu> <a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
</a-dropdown> <a @click="operationClick(operation,record)">
<div class="operate-btn">
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标-->
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" />
<!-- 删除图标-->
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
{{ operation.text }}
</div>
</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
<template v-else-if="operationList.length > 0">
<template v-for="(operation, index) in operationList">
<!-- 收藏-->
<a :key="index" @click="operationClick(operationList[0],record)"
v-if="operation.text === $t('standardRegulationLibrary.domesticStandard.cancelCollection')">
<i class="iconfont icon-star1" v-show="record.collectionFlag" />
<i class="iconfont icon-star" v-show="!record.collectionFlag" />
</a>
<a v-else @click="operationClick(operation,record)" style="display: inline-block">
<div class="operate-btn">
<!-- 编辑图标-->
<i class="iconfont icon-bianji operate-btn-icon" v-if="operation.text === $t('edit')" />
<!-- 分享图标-->
<i class="iconfont icon-fangxingfenxiang operate-btn-icon" v-if="operation.text === $t('share')" />
<!-- 删除图标-->
<i class="iconfont icon-shanchu_ operate-btn-icon" v-if="operation.text === $t('delete')" />
{{ operation.text }}
</div>
</a>
<a-divider type="vertical" v-if="index !== operationList.length - 1" />
</template>
</template>
</template> </template>
</j-table> </j-table>
</div> </div>