[update] 绑定零部件进入收起侧边栏,url中增加了type字段,根据type字段做操作按钮是否显示的判断

This commit is contained in:
lideqin
2024-05-07 11:14:03 +08:00
parent 92f6bdbe42
commit 42acfee359
+35 -2
View File
@@ -61,7 +61,7 @@
</a-form>
</div>
<div class="table-operator">
<div class="table-operator" v-if="type && type + '' !== '2'">
<!-- 新增 -->
<a-button v-if="isCanAdd" icon="plus" type="primary" @click="handleAdd" v-has="'sys:bindingPart:add'">{{ $t('newlyAdded') }}</a-button>
<!-- 批量删除 -->
@@ -124,6 +124,8 @@ import BingingPartsModal from './modules/BingingPartsModal'
import ClauseModal from './modules/ClauseModal'
import { isHasPermission } from '../../../utils/hasPermission'
import { isTreeNodeHaveBind, useBindingRelationship } from '../../../api/api'
import { mapActions } from 'vuex'
import { triggerWindowResizeEvent } from '@/utils/util'
export default {
name: 'BindingParts',
@@ -197,7 +199,32 @@ export default {
disableMixinCreated: true,
isCanAdd: false, // 是否可以新增
isCanUseBind: false, // 是否有使用绑定关系按钮
isHaveBindResult: {} // 是否有绑定结果
isHaveBindResult: {}, // 是否有绑定结果
type: '2' // 操作类型 1是操作 2是查看
}
},
watch: {
type: {
immediate: true,
handler (val) {
if (val && val + '' === '2') {
// 是查看,隐藏操作栏
this.columns = this.columns.filter(item => item.title !== this.$t('operation'))
} else {
// 是操作,显示操作栏
if (!this.columns.find(item => item.title === this.$t('operation'))) {
this.columns.push(
{ // 操作
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 170
}
)
}
}
}
}
},
created () {
@@ -213,9 +240,15 @@ export default {
this.queryParam.partNo = partNo
}
this.loadData()
// 收起侧边栏
this.setSidebar(false)
triggerWindowResizeEvent()
// 设置操作类型
this.type = this.$route.query.type || '2'
},
methods: {
isHasPermission,
...mapActions(['setSidebar']),
/**
* 判断分类树下有没有绑定关系,传入零部件分类内部码
* @param partCategoryNum 分类内部码