add 标准详情;更新记录

This commit is contained in:
赵霄
2023-09-07 17:57:47 +08:00
parent 397f30423a
commit 3432c9c322
15 changed files with 749 additions and 128 deletions
@@ -5,11 +5,14 @@
<!-- $t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')-->
<a-input-search v-model="treeInput" :placeholder="$t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')"
@search="handleTreeSearch" />
<a-tree :show-line="true" :show-icon="true" :tree-data=treeData>
<a-tree :show-line="true" :show-icon="true" :tree-data=treeData :selected-keys="selectedTreeKeys">
<a-icon type="folder" slot="folder" class="tree-icon" />
<template #custom="record">
<div class="tree-operate-node" @mouseenter="handleTreeMouseover(record.key)" @mouseleave="handleTreeMouseout(record.key)">
<div class="tree-operate-node"
@mouseenter="handleTreeMouseover(record.key)"
@mouseleave="handleTreeMouseout(record.key)"
@click="handleSelectTreeNode(record)">
<a-tooltip>
<template #title>
{{ record.nodeName }}
@@ -18,13 +21,15 @@
</a-tooltip>
<template v-if="record.key === mouseInNodeKey">
<!-- 新增-->
<a-button icon="plus" class="tree-operate-node-btn" @click="handleAddTreeNode(record)"></a-button>
<a-button icon="plus" class="tree-operate-node-btn" @click.stop="handleAddTreeNode(record)"></a-button>
<!-- 编辑-->
<a-button class="tree-operate-node-btn" @click="handleEditTreeNode(record)">
<a-button class="tree-operate-node-btn" @click.stop="handleEditTreeNode(record)">
<i class="iconfont icon-bianji" />
</a-button>
<!-- 删除,根节点不能删除-->
<a-button class="tree-operate-node-btn" v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value">
<a-button class="tree-operate-node-btn"
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value"
@click.stop="handleDelTreeNode(record)">
<i class="iconfont icon-shanchu_" />
</a-button>
</template>
@@ -75,9 +80,11 @@
<!-- 批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel">{{ $t('batchDelete') }}</a-button>
<!-- 配置标准-->
<a-button type="primary" icon="setting" ghost>{{ $t('standardRegulationLibrary.configStandard') }}</a-button>
<a-button type="primary" icon="setting" ghost @click="handleConfigStandard">{{ $t('standardRegulationLibrary.configStandard') }}</a-button>
<!-- 移出标准-->
<a-button type="primary" icon="minus-circle" ghost>{{ $t('standardRegulationLibrary.removeStandard') }}</a-button>
<a-button type="primary" icon="minus-circle" ghost @click="handleRemoveStandard">
{{ $t('standardRegulationLibrary.removeStandard') }}
</a-button>
</div>
<div>
<j-table
@@ -91,6 +98,24 @@
:scroll="{x: '100%'}"
@change="tableOnChange">
<!-- 标准编号-->
<template v-slot:standard_number="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{ text }}</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<!-- 标准名称-->
<template v-slot:standard_name="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text can-click-table-text" v-if="text || text === 0" @click="toDetailPage(record)">{{ text }}</div>
<div v-else class="table-text">{{ global.emptyLine }}</div>
</a-tooltip>
</template>
<template v-slot:operation="{text, record}">
<!-- 收藏-->
<a @click="operationClick(operationList[0],record)">
@@ -127,6 +152,8 @@
<user-select-modal ref="userSelectModal" type="checkbox" @change="continueShare" />
<!-- 树新增、编辑-->
<domestic-system-tree-modal ref="treeModal" @ok="modalFormOk" />
<!-- 配置标准-->
<standard-selection-modal ref="standardSelectionModal" @change="continueConfigStandard" />
</a-card>
</template>
@@ -136,10 +163,18 @@ import { ConfigurableTableMixin } from '../../../mixins/ConfigurableTableMixin'
import Search from '../../../components/customField/Search.vue'
import JTable from '../../../components/jero/JTable.vue'
import DomesticStandardModal from './modules/DomesticStandardModal.vue'
import { getDomesticStandardTableHeader, getDomesticStandardSearchForm, shareDomesticStandard } from '../../../api/standardRegulationLibraryApi'
import { YesOrNoEnum, StandardSystemTreeNodeType } from '../../../enums/commonEnums'
import {
getDomesticStandardTableHeader,
getDomesticStandardSearchForm,
shareDomesticStandard,
deleteDomesticSystemTree,
configDomesticStandard,
removeDomesticStandard
} from '../../../api/standardRegulationLibraryApi'
import { YesOrNoEnum, StandardSystemTreeNodeType, TagsTypeEnums } from '../../../enums/commonEnums'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import DomesticSystemTreeModal from './modules/DomesticSystemTreeModal.vue'
import StandardSelectionModal from '../../../components/selection/StandardSelectionModal.vue'
const apiTreeData = [
{
@@ -166,7 +201,7 @@ const apiTreeData = [
export default {
name: 'DomesticStandardList',
components: { Search, JTable, DomesticStandardModal, UserSelectModal, DomesticSystemTreeModal },
components: { Search, JTable, DomesticStandardModal, UserSelectModal, DomesticSystemTreeModal, StandardSelectionModal },
mixins: [ConfigurableTableMixin],
data () {
return {
@@ -208,10 +243,12 @@ export default {
exportZipUrl: '', // 带文件导出
importExcelUrl: '' // 导入
},
dataSource: [{ id: 1, collectionFlag: '1' }],
dataSource: [{ id: 1, collectionFlag: '1', standard_name: '标准001', standard_number: 'BZ001' }],
yesValue: YesOrNoEnum.YES.value,
noValue: YesOrNoEnum.NO.value,
nowShareId: null // 当前正在分享的数据的id
nowShareId: null, // 当前正在分享的数据的id
selectedTreeKeys: [], // 选中的树节点
tableSlotField: ['standard_name', 'standard_number'] // 表格中需要插槽的字段
}
},
computed: {
@@ -324,11 +361,118 @@ export default {
// 清空列表选中
this.onClearSelected()
},
/**
* 新增树节点
* @param dataRef
*/
handleAddTreeNode ({ dataRef }) {
this.$refs.treeModal.add({ parentId: dataRef.key })
},
/**
* 编辑树节点
* @param dataRef
*/
handleEditTreeNode ({ dataRef }) {
this.$refs.treeModal.edit(dataRef)
},
/**
* 删除树节点
* @param dataRef
*/
handleDelTreeNode ({ dataRef }) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
deleteDomesticSystemTree({ ids: dataRef.id }).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warning(res.message)
}
})
}
})
},
/**
* 选中树节点
* @param dataRef
*/
handleSelectTreeNode ({ dataRef }) {
this.selectedTreeKeys = [dataRef.key]
},
/**
* 配置标准
*/
handleConfigStandard () {
// 没选择左侧树节点,需要提示“请先选择二级及以下体系”
if (!this.selectedTreeKeys || this.selectedTreeKeys.length === 0) {
this.$message.warn(this.$t('standardRegulationLibrary.configStandardNoTreeNode'))
return
}
this.$refs.standardSelectionModal.open()
},
/**
* 配置标准-提交
* @param dbFieldName
* @param standardIds
*/
continueConfigStandard (dbFieldName, standardIds) {
this.loading = true
const params = {
nodeId: this.selectedTreeKeys[0],
standardIds
}
configDomesticStandard(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 移出标准
*/
handleRemoveStandard () {
// 没选择左侧树节点,需要提示“请先选择二级及以下体系”
if (!this.selectedTreeKeys || this.selectedTreeKeys.length === 0) {
this.$message.warn(this.$t('standardRegulationLibrary.configStandardNoTreeNode'))
return
}
// 没有选择列表数据,需要提示“选中至少一条列表数据”
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('standardRegulationLibrary.selectLeastOneTableData'))
return
}
this.loading = true
const params = {
nodeId: this.selectedTreeKeys[0],
ids: this.selectedRowKeys.join(',')
}
removeDomesticStandard(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
},
toDetailPage ({ id }) {
this.$openPageNewSheet({
path: '/standardRegulationLibrary/DomesticStandardDetail',
query: {
id,
type: TagsTypeEnums.DOMESTIC_LIST.value
}
})
}
}
}