update 海外标准

This commit is contained in:
赵霄
2023-09-20 17:29:06 +08:00
parent 898eef4a92
commit adbff88cab
8 changed files with 869 additions and 164 deletions
+34 -1
View File
@@ -45,6 +45,28 @@ const getOverseasStandardForm = (params) => getAction('/laws/standard/overseas/g
const getOverseasStandardDocumentInfo = (params) => getAction('/laws/standard/overseas/getByIdAndModule', params)
// 海外标准-获取表头信息
const getOverseasStandardTableHeader = (params) => getAction('/laws/standard/overseas/getCommonHeader', params)
// 海外标准-获取体系数据
const getOverseasStandardSystem = (params) => getAction('/laws/standard/lawsTreeNode/overseas', params)
// 海外标准-收藏
const collectionOverseasStandard = (params) => postAction('/personal/lawsStandardCollection/overseas/add', params)
// 海外标准-取消收藏
const cancelCollectionOverseasStandard = (params) => postAction('/personal/lawsStandardCollection/overseas/delete', params)
// 海外标准-分享
const shareOverseasStandard = (params) => postAction('/personal/lawsStandardSharing/overseas/add', params)
// 海外标准-体系删除
const deleteOverseasStandardSystem = (params) => postAction('/laws/standard/lawsTreeNode/overseas/delete', params)
// 海外标准-体系新增
const addOverseasStandardSystem = (params) => postAction('/laws/standard/lawsTreeNode/overseas/add', params)
// 海外标准-体系编辑
const editOverseasStandardSystem = (params) => postAction('/laws/standard/lawsTreeNode/overseas/edit', params)
// 海外标准-配置标准
const configOverseasStandard = (params) => getAction('/laws/standard/overseas/relatedStandard', params)
// 海外标准-移除标准
const removeOverseasStandard = (params) => getAction('/laws/standard/overseas/removeStandard', params)
// 海外标准-添加标准
const addOverseasStandard = (params) => postAction('/laws/standard/overseas/commonAdd', params)
// 海外标准-编辑标准
const editOverseasStandard = (params) => postAction('/laws/standard/overseas/commonEdit', params)
export {
// 国内标准
@@ -71,5 +93,16 @@ export {
getOverseasStandardSearchForm,
getOverseasStandardForm,
getOverseasStandardDocumentInfo,
getOverseasStandardTableHeader
getOverseasStandardTableHeader,
getOverseasStandardSystem,
collectionOverseasStandard,
cancelCollectionOverseasStandard,
shareOverseasStandard,
deleteOverseasStandardSystem,
editOverseasStandardSystem,
addOverseasStandardSystem,
configOverseasStandard,
removeOverseasStandard,
addOverseasStandard,
editOverseasStandard
}
@@ -102,8 +102,14 @@
<script>
import '@assets/less/common.less'
import { FieldType, StandardSource, TagsTypeEnums } from '../../../enums/commonEnums'
import { getDomesticStandardFormModal, shareDomesticStandard, getDomesticStandardDetail } from '../../../api/standardRegulationLibraryApi'
import { FieldType, StandardSource } from '../../../enums/commonEnums'
import {
getDomesticStandardFormModal,
shareDomesticStandard,
getDomesticStandardDetail,
getOverseasStandardForm,
getOverseasStandardDocumentInfo
} from '../../../api/standardRegulationLibraryApi'
import UpdateRecordModal from './modules/UpdateRecordModal.vue'
import SubmitQuestionModal from './modules/SubmitQuestionModal.vue'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
@@ -125,12 +131,28 @@ const DomesticStandardPermission = {
unwatermarkedDownload: 'domesticStandard:unwatermarkedDownload' // 无水印下载
}
// 海外标准权限
const OverseasStandardPermission = {
updateRecord: 'overseasStandard:updateRecord', // 更新记录
submitQuestion: 'overseasStandard:submitQuestion', // 提交问题
share: 'overseasStandard:share', // 分享
standardResolutionSheet: 'overseasStandard:standardResolutionSheet', // 标准分解单
download: 'overseasStandard:download', // 下载
unwatermarkedDownload: 'overseasStandard:unwatermarkedDownload' // 无水印下载
}
// 国内标准接口
const DomesticApi = {
getFormFunc: getDomesticStandardFormModal, // 获取字段
getDetailData: getDomesticStandardDetail // 获取详情数据
}
// 海外标准接口
const OverseasApi = {
getFormFunc: getOverseasStandardForm, // 获取字段
getDetailData: getOverseasStandardDocumentInfo // 获取详情数据
}
const FILE_TYPE_IMGS = ['jpg', 'jpeg', 'png', 'raw']
const FILE_TYPE_PDF = 'pdf'
@@ -176,9 +198,13 @@ export default {
let permission = {}
switch (this.type) {
// 国内标准法规
case TagsTypeEnums.DOMESTIC_LIST.value + '':
case StandardSource.DOMESTIC.value:
permission = DomesticStandardPermission
break
// 海外
case StandardSource.OVERSEAS.value:
permission = OverseasStandardPermission
break
default:
break
}
@@ -188,9 +214,12 @@ export default {
operateApiFunc () {
let func = {}
switch (this.type) {
case TagsTypeEnums.DOMESTIC_LIST.value + '':
case StandardSource.DOMESTIC.value:
func = DomesticApi
break
case StandardSource.OVERSEAS.value:
func = OverseasApi
break
default:
break
}
@@ -199,7 +199,7 @@ import {
collectionDomesticStandard,
cancelCollectionDomesticStandard
} from '../../../api/standardRegulationLibraryApi'
import { StandardSystemTreeNodeType, StandardSource, YesOrNoEnum } from '../../../enums/commonEnums'
import { StandardSystemTreeNodeType, YesOrNoEnum } from '../../../enums/commonEnums'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import DomesticSystemTreeModal from './modules/DomesticSystemTreeModal.vue'
import SelectionDomesticStandardDrawer from './modules/SelectionDomesticStandardDrawer.vue'
@@ -62,7 +62,7 @@
<script>
import { getDomesticStandardNoSystem } from '../../../../api/standardRegulationLibraryApi.js'
import { TagsTypeEnums } from '../../../../enums/commonEnums.js'
import { StandardSource } from '../../../../enums/commonEnums.js'
export default {
name: 'SelectionDomesticStandardDrawer',
@@ -156,7 +156,7 @@ export default {
pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize,
nodeCode: this.nodeCode,
source: '1'
source: StandardSource.DOMESTIC.value
}
this.selectedRowKeys = []
this.loading = true
@@ -1,64 +1,113 @@
<template>
<a-card :bordered="false" class="page-left-right-layout">
<!-- 树部分-->
<div class="page-left-box">
<!-- $t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')-->
<a-input-search v-model="treeInput" :placeholder="$t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')"
@search="handleTableSearch" />
<a-tree :show-line="true" :show-icon="true" :tree-data=treeData>
<a-icon type="folder" slot="folder" class="tree-icon" />
<a-input-search v-model="treeInput" class="tree-search"
:placeholder="$t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder')"
@search="handleTreeSearch" />
<div class="page-tree-box page-tree-box-has-search">
<a-spin :spinning="treeLoading">
<a-tree :show-line="true" :show-icon="true" :tree-data="treeData" :selected-keys="selectedTreeKeys">
<a-icon type="folder" slot="folder" class="tree-icon" />
<a-icon type="file" slot="file" class="tree-icon" />
<template #custom="{title, key}">
<div class="tree-operate-node" @mouseenter="handleTreeMouseover(key)" @mouseleave="handleTreeMouseout(key)">
<a-tooltip>
<template #title>
{{ title }}
</template>
<span class="tree-node-custom-title">{{ title }}</span>
</a-tooltip>
<template v-if="key === mouseInNodeKey">
<!-- 新增-->
<a-button icon="plus" class="tree-operate-node-btn"></a-button>
<!-- 编辑-->
<a-button class="tree-operate-node-btn">
<i class="iconfont icon-bianji" />
</a-button>
<!-- 删除-->
<a-button class="tree-operate-node-btn">
<i class="iconfont icon-shanchu_" />
</a-button>
<template #custom="record">
<div class="tree-operate-node"
@mouseenter="handleTreeMouseover(record.key)"
@mouseleave="handleTreeMouseout(record.key)"
@click="handleSelectTreeNode(record)">
<a-tooltip>
<template #title>
{{ record.title }}
</template>
<span class="tree-node-custom-title">{{ record.title }}</span>
</a-tooltip>
<div class="tree-operate-node-btn-box" :class="{'tree-operate-node-btn-box-hide': record.key !== mouseInNodeKey}">
<!-- 新增-->
<a-button icon="plus"
class="tree-operate-node-btn"
@click.stop="handleAddTreeNode(record)"
v-if="record.nodeType !== StandardSystemTreeNodeType.NOT_OPERATE_NODE.value"
v-has="'overseasStandard:tree:add'"></a-button>
<!-- 编辑根节点不能编辑-->
<a-button class="tree-operate-node-btn"
@click.stop="handleEditTreeNode(record)"
v-has="'overseasStandard:tree:edit'"
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value && record.nodeType !== StandardSystemTreeNodeType.NOT_OPERATE_NODE.value">
<i class="iconfont icon-bianji" />
</a-button>
<!-- 删除根节点不能删除-->
<a-button class="tree-operate-node-btn"
v-has="'overseasStandard:tree:delete'"
v-if="record.nodeType !== StandardSystemTreeNodeType.ROOT_NODE.value && record.nodeType !== StandardSystemTreeNodeType.NOT_OPERATE_NODE.value"
@click.stop="handleDelTreeNode(record)">
<i class="iconfont icon-shanchu_" />
</a-button>
</div>
</div>
</template>
</div>
</template>
</a-tree>
</a-tree>
</a-spin>
</div>
</div>
<!-- 表格部分-->
<div class="page-right-box">
<div class="table-page-search-wrapper">
<search ref="searchRef" :get-query-condition-func="getSearchFunc" @search="searchQuery" @reset="searchReset" />
<search ref="searchRef"
:url="url"
:get-query-condition-func="getQueryConditionFunc"
search-has="overseasStandard:search"
@search="searchQuery"
@reset="searchReset" />
</div>
<div class="table-operator">
<!-- 新增-->
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
<a-button icon="plus" type="primary" @click="handleAdd" v-has="'overseasStandard:add'">{{ $t('newlyAdded') }}</a-button>
<!-- 导入-->
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-upload name="file"
:showUploadList="false"
:multiple="false"
:headers="tokenHeader"
:action="importExcelUrl"
v-has="'overseasStandard:import'"
@change="handleImportExcel">
<a-button type="primary" icon="download" ghost>{{ $t('import') }}</a-button>
</a-upload>
<!-- 导出-->
<a-button icon="upload" type="primary" ghost @click="handleExportXls($t('standardRegulationLibrary.domesticStandard.treeSearchPlaceholder'))">
<a-button icon="upload"
type="primary"
ghost
v-has="'overseasStandard:export'"
@click="handleExportXls($t('standardRegulationLibrary.domesticStandard.exportFileName'))">
{{ $t('export') }}
</a-button>
<!-- 带文件导出-->
<a-button icon="upload" type="primary" ghost>{{ $t('exportWithFile') }}</a-button>
<a-button icon="upload"
type="primary"
ghost
v-has="'overseasStandard:exportFile'"
@click="handleFileExport($t('standardRegulationLibrary.domesticStandard.exportFileName'))">
{{ $t('exportWithFile') }}
</a-button>
<!-- 模板下载-->
<a-button type="primary" icon="download" ghost @click="downTemplate('standardRegulationLibrary.domesticStandard.templateName')">
<a-button type="primary"
icon="download"
ghost
v-has="'overseasStandard:downTemplate'"
@click="downTemplate($t('standardRegulationLibrary.domesticStandard.templateName'))">
{{ $t('templateDownload') }}
</a-button>
<!-- 批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel">{{ $t('batchDelete') }}</a-button>
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'overseasStandard: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" v-has="'overseasStandard:configStandard'">
{{ $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" v-has="'overseasStandard:removeStandard'">
{{ $t('standardRegulationLibrary.removeStandard') }}
</a-button>
</div>
<div>
<j-table
@@ -70,25 +119,48 @@
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%'}"
:loading="loading"
@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>{{ $t('standardRegulationLibrary.domesticStandard.collection') }}</a>
<!-- 收藏-->
<a @click="operationClick(operationList[0],record)" v-has="operationList[0].has">
<i class="iconfont icon-star1" v-show="record.collectionFlag" />
<i class="iconfont icon-star" v-show="!record.collectionFlag" />
</a>
<a-divider type="vertical" />
<a-dropdown>
<a-icon type="more" class="operate-icon-btn" />
<a-dropdown placement="bottomCenter">
<a-icon type="more" class="operate-icon-btn operate-icon-more" />
<a-menu slot="overlay">
<a-menu-item v-for="(operation, index) in operationList.slice(operateMaxNum)" :key="index">
<a @click="operationClick(operation,record)">
<span v-if="operation.text === $t('docLibrary.cancelCollection')" class="text">
{{ !record.collectFlag || record.collectFlag === '0' ? $t('docLibrary.collection') : $t('docLibrary.cancelCollection') }}
</span>
<span v-else-if="operation.text === $t('docLibrary.cancelSubscribe')" class="text">
{{ !record.subscribeFlag || record.subscribeFlag === '0' ? $t('docLibrary.subscribe') : $t('docLibrary.cancelSubscribe') }}
</span>
<span v-else class="text">
{{ operation.text }}
</span>
<a @click="operationClick(operation,record)" v-has="operation.has">
<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>
@@ -100,46 +172,44 @@
<!-- 新增编辑-->
<overseas-standard-modal ref="modalForm" @ok="modalFormOk" />
<!-- 分享选人-->
<user-select-modal ref="userSelectModal" type="checkbox" @change="continueShare" />
<!-- 树新增编辑-->
<overseas-system-tree-modal ref="treeModal" @ok="modalFormOk" />
<!-- 配置标准-->
<selection-overseas-standard-drawer ref="standardSelectionModal" :node-code="selectedTreeNodeCodes[0]" @change="continueConfigStandard" />
</a-card>
</template>
<script>
import '@assets/less/common.less'
import JTable from '../../../components/jero/JTable.vue'
import Search from '../../../components/customField/Search.vue'
import { ConfigurableTableMixin } from '../../../mixins/ConfigurableTableMixin'
import Search from '../../../components/customField/Search.vue'
import JTable from '../../../components/jero/JTable.vue'
import {
getOverseasStandardSearchForm,
getOverseasStandardTableHeader,
getOverseasStandardSystem,
collectionOverseasStandard,
cancelCollectionOverseasStandard,
shareOverseasStandard,
deleteOverseasStandardSystem,
configOverseasStandard,
removeOverseasStandard
} from '../../../api/standardRegulationLibraryApi'
import { StandardSystemTreeNodeType, YesOrNoEnum } from '../../../enums/commonEnums'
import UserSelectModal from '../../../components/selection/UserSelectModal.vue'
import OverseasStandardModal from './modules/OverseasStandardModal.vue'
import { getOverseasStandardTableHeader, getOverseasStandardSearchForm } from '../../../api/standardRegulationLibraryApi'
const apiTreeData = [
{
title: 'parent 1',
key: '0-0',
child: [
{
title: '张晨成',
key: '0-0-0',
disabled: true,
child: [
{ title: 'leaf', key: '0-0-0-0' },
{ title: 'leaf', key: '0-0-0-1' }
]
},
{
title: 'parent 1-1',
key: '0-0-1',
child: [{ key: '0-0-1-0', title: 'zcvc' }]
}
]
}
]
import OverseasSystemTreeModal from './modules/OverseasSystemTreeModal.vue'
import SelectionOverseasStandardDrawer from './modules/SelectionOverseasStandardDrawer.vue'
export default {
name: 'OverseasStandardList',
components: { JTable, Search, OverseasStandardModal },
components: { Search, JTable, UserSelectModal, OverseasStandardModal, OverseasSystemTreeModal, SelectionOverseasStandardDrawer },
mixins: [ConfigurableTableMixin],
data () {
return {
StandardSystemTreeNodeType,
treeInput: null, // 树查询绑定值
treeData: [],
mouseInNodeKey: null, // 鼠标悬浮的节点key值
@@ -148,69 +218,314 @@ export default {
// 收藏
{
text: this.$t('standardRegulationLibrary.domesticStandard.cancelCollection'),
clickEvent: 'collection',
has: ''
clickEvent: 'handleCollection',
has: 'overseasStandard:collection'
},
// 编辑
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: ''
has: 'overseasStandard:edit'
},
// 分享
{
text: this.$t('share'),
clickEvent: 'handleShare',
has: ''
has: 'overseasStandard:share'
},
// 删除
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: ''
has: 'overseasStandard:delete'
}
],
getTableHeaderFunc: getOverseasStandardTableHeader,
getSearchFunc: getOverseasStandardSearchForm,
url:
{
list: '/laws/standard/overseas/getCommonHeader',
delete: '/laws/standard/overseas/deleteByIdsAndModule'
}
getQueryConditionFunc: getOverseasStandardSearchForm,
url: {
list: '/laws/standard/overseas/getCommonPage',
delete: '/laws/standard/domestic/deleteByIdsAndModule',
deleteBatch: '/laws/standard/domestic/deleteByIdsAndModule',
downTemplateUrl: '', // 下载模板
exportXlsUrl: '', // 导出
exportZipUrl: '', // 带文件导出
importExcelUrl: '' // 导入
},
yesValue: YesOrNoEnum.YES.value,
noValue: YesOrNoEnum.NO.value,
nowShareInfo: {}, // 当前正在分享的数据
selectedTreeKeys: [], // 选中的树节点key
selectedTreeNodeCodes: [], // 选中树节点的code
tableSlotField: ['standard_name', 'standard_number'], // 表格中需要插槽的字段
treeLoading: false,
isCollection: false
}
},
computed: {
importExcelUrl () {
return `${window._CONFIG.domianURL}/${this.url.importExcelUrl}`
}
},
created () {
this.initTreeData()
},
methods: {
/**
* 获取树数据
*/
initTreeData () {
this.treeData = this.dealTreeData(apiTreeData)
this.treeLoading = true
getOverseasStandardSystem({ nodeName: this.treeInput }).then(res => {
this.treeData = []
this.selectedTreeKeys = []
this.selectedTreeNodeCodes = []
this.filters.nodeCode = null
if (res.success) {
const treeData = res.result || []
this.treeData = this.dealTreeData(treeData)
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.treeLoading = false
})
},
/**
* 处理树数据,加入自定义的节点插槽
* @param treeData
* @returns {*}
*/
dealTreeData (treeData) {
return treeData.map(item => {
if (item.child && item.child.length > 0) {
item.scopedSlots = { title: 'iconCustom' }
item.children = this.dealTreeData(item.child)
if (item.children && item.children.length > 0) {
item.scopedSlots = { icon: 'folder', title: 'custom' }
item.children = this.dealTreeData(item.children)
} else if (item.nodeType === StandardSystemTreeNodeType.ROOT_NODE.value) {
item.scopedSlots = { icon: 'folder', title: 'custom' }
} else {
item.scopedSlots = { title: 'custom' }
item.scopedSlots = { icon: 'file', title: 'custom' }
}
return item
})
},
handleTableSearch () {
/**
* 树节点查询
*/
handleTreeSearch () {
this.initTreeData()
},
/**
* 树节点鼠标移入
* @param key
*/
handleTreeMouseover (key) {
this.mouseInNodeKey = key
},
/**
* 树节点鼠标移出
* @param key
*/
handleTreeMouseout (key) {
if (this.mouseInNodeKey === key) {
this.mouseInNodeKey = null
}
},
operationClick (operation, record) {
if (operation.clickEvent === 'handleDelete') {
this.handleDelete(record.id)
} else {
this[operation.clickEvent](record)
/**
* 收藏/取消收藏
* @param record
*/
handleCollection ({ collectionFlag, id: standardId, standard_number: standardNumber }) {
if (this.isCollection) {
return
}
this.isCollection = true
let params
let submitFunc
// 取消收藏
if (collectionFlag) {
params = { id: standardId, standardNumber }
submitFunc = cancelCollectionOverseasStandard
} else {
params = { standardId, standardNumber }
submitFunc = collectionOverseasStandard
}
// 收藏
submitFunc(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.isCollection = false
})
},
/**
* 分享
*/
handleShare ({ id, standard_number: standardNumber }) {
this.nowShareInfo = {
standardId: id,
standardNumber
}
this.$refs.userSelectModal.open()
},
/**
* 选择分享的人之后继续分享
* @param ids
*/
continueShare (ids) {
const params = Object.assign(this.nowShareInfo, {
recipientId: ids // 分享给的用户的id
})
this.loading = true
shareOverseasStandard(params).then(res => {
if (res.success) {
this.$message.success(res.message)
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
},
modalFormOk () {
this.initTreeData()
// 新增/修改 成功时,重载列表
this.loadData()
// 清空列表选中
this.onClearSelected()
},
/**
* 新增树节点
* @param dataRef
*/
handleAddTreeNode ({ dataRef }) {
this.$refs.treeModal.add({ parentId: dataRef.id, parentCode: dataRef.nodeCode })
},
/**
* 编辑树节点
* @param dataRef
*/
handleEditTreeNode ({ dataRef }) {
this.$refs.treeModal.edit(dataRef)
},
/**
* 删除树节点
* @param dataRef
*/
handleDelTreeNode ({ dataRef }) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
deleteOverseasStandardSystem({ id: 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]
this.selectedTreeNodeCodes = [dataRef.nodeCode]
this.filters.nodeCode = dataRef.nodeCode
this.loadData(1)
},
/**
* 配置标准
*/
handleConfigStandard () {
// 没选择左侧树节点,需要提示“请先选择二级及以下体系”
if (!this.selectedTreeNodeCodes || this.selectedTreeNodeCodes.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 = {
nodeCode: this.selectedTreeNodeCodes[0],
ids: standardIds
}
configOverseasStandard(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.selectedTreeNodeCodes || this.selectedTreeNodeCodes.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 = {
nodeCode: this.selectedTreeNodeCodes[0],
ids: this.selectedRowKeys.join(',')
}
removeOverseasStandard(params).then(res => {
if (res.success) {
this.$message.success(res.message)
this.modalFormOk()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.loading = false
})
},
/**
* 跳转详情页
* @param id
* @param standardNumber
*/
toDetailPage ({ id }) {
this.$openPageNewSheet({
path: '/standardRegulationLibrary/OverseasStandardDetail',
query: {
id
}
})
},
/**
* 重置查询
*/
searchReset () {
this.searchParams = {}
this.selectedRowKeys = []
this.selectedTreeKeys = []
this.getTableHeader()
this.loadData()
}
}
}
@@ -224,35 +539,10 @@ export default {
}
.tree-icon {
line-height: 24px;
color: #1D2129;
}
.tree-operate-node {
display: flex;
width: 100%;
align-items: center;
&-btn {
width: 20px;
height: 20px;
background: rgba(213, 44, 38, 0.08);
border-radius: 2px 2px 2px 2px;
border: none;
display: flex;
align-items: center;
justify-content: center;
margin-left: 4px;
padding: 0;
/deep/ .anticon {
margin-top: 2px;
color: #D52C26;
}
img {
width: 13px;
height: 13px;
}
}
/deep/ .ant-tree li span.ant-tree-switcher.ant-tree-switcher-noop {
display: none;
}
</style>
@@ -7,28 +7,36 @@
@close="handleCancel"
:visible="visible"
:maskClosable="false"
style="height: 100%;overflow: auto;">
<a-spin :spinning="confirmLoading" style="width: 100%;height:100%">
<div class="drawer-container">
class="custom-drawer-style"
>
<div class="custom-drawer-style-scroll">
<a-spin :spinning="confirmLoading" style="width: 100%;height:100%">
<add-form ref="addForm"
:get-form-func="getFormFunc"
:get-document-info-func="getInfoFunc"
:get-document-info-func="getDocumentInfoFunc"
:special-placeholder="specialPlaceholder"
:default-value="defaultValue"
:disabled-field-list="disabledField"
@submitFormData="submitFormData" />
</div>
<div class="drawer-footer">
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
{{ $t('preservation') }}
</a-button>
<a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button>
</div>
</a-spin>
</a-spin>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;" :loading="confirmLoading">
{{ $t('preservation') }}
</a-button>
<a-button @click="handleCancel" style="margin-bottom: 0;" :loading="confirmLoading">{{ $t('close') }}</a-button>
</div>
</a-drawer>
</template>
<script>
import AddForm from '../../../../components/customField/AddForm.vue'
import { postAction } from '../../../../api/manage'
import { getOverseasStandardForm, getOverseasStandardDocumentInfo } from '../../../../api/standardRegulationLibraryApi'
import {
getOverseasStandardForm,
getOverseasStandardDocumentInfo,
addOverseasStandard,
editOverseasStandard
} from '../../../../api/standardRegulationLibraryApi'
export default {
name: 'OverseasStandardModal',
@@ -42,43 +50,60 @@ export default {
form: {},
confirmLoading: false,
getFormFunc: getOverseasStandardForm,
getInfoFunc: getOverseasStandardDocumentInfo,
url: {
add: '/laws/standard/overseas/commonAdd',
edit: '/laws/standard/overseas/commonEdit'
getDocumentInfoFunc: getOverseasStandardDocumentInfo,
// 特殊的placeholder
specialPlaceholder: {
standard_number: `${this.$t('standardRegulationLibrary.inputExample')}7258`
},
defaultValue: {
year_number: new Date().getFullYear() + ''
},
isEdit: null // 是否编辑
}
},
computed: {
// 不可编辑的字段
disabledField () {
console.log(this.isEdit)
if (this.isEdit) {
// 标准编号,被代替标准号,被引用标准号
return ['standard_number', 'replaced_by_standard_number', 'referenced_standard']
}
return ['replaced_by_standard_number', 'referenced_standard']
}
},
methods: {
add () {
this.visible = true
this.isEdit = false
this.$nextTick(() => {
this.$refs.addForm.add()
})
},
edit (record) {
this.visible = true
this.isEdit = true
this.$nextTick(() => {
this.$refs.addForm.edit(record)
})
},
handleOk () {
this.confirmLoading = true
this.$refs.addForm.submit()
},
// 表单提交的回调,获取表单数据
submitFormData (formInline) {
let url = ''
this.confirmLoading = true
let submitFunc
if (formInline.id) {
url = this.url.edit
submitFunc = editOverseasStandard
} else {
url = this.url.add
submitFunc = addOverseasStandard
}
postAction(url, formInline).then((res) => {
submitFunc(formInline).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
if (this.formInline.id) {
this.$emit('ok')
} else {
this.$emit('ok')
}
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
@@ -0,0 +1,103 @@
<template>
<a-modal
:title="title"
:maskClosable="false"
:width="width"
:visible="visible"
:confirm-loading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel">
<a-form :form="form">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('standardRegulationLibrary.nodeName')">
<a-input :placeholder="$t('pleaseEnter') + $t('standardRegulationLibrary.nodeName')"
@change="event => event.target.value = event.target.value.trim()"
:maxLength="50"
v-decorator="['nodeName', validatorRules.nodeName]" />
</a-form-item>
</a-form>
</a-modal>
</template>
<script>
import { addOverseasStandardSystem, editOverseasStandardSystem } from '../../../../api/standardRegulationLibraryApi.js'
export default {
name: 'OverseasSystemTreeModal',
data () {
return {
title: this.$t('operation'),
width: 800,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 4 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 }
},
validatorRules: {
// 节点名称
nodeName: {
rules: [{ required: true, message: this.$t('pleaseEnter') + this.$t('standardRegulationLibrary.nodeName') }],
validateTrigger: 'blur'
}
}
}
},
methods: {
add (parentInfo) {
this.edit(parentInfo)
},
edit (record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(this.model)
})
},
close () {
this.visible = false
},
handleOk () {
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const formData = Object.assign(this.model, values)
formData.nodeOrder = '0'
let submitFunc
if (this.model.id) {
submitFunc = editOverseasStandardSystem
} else {
submitFunc = addOverseasStandardSystem
}
submitFunc(formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
})
},
handleCancel () {
this.close()
}
}
}
</script>
<style scoped lang="less">
</style>
@@ -0,0 +1,225 @@
<template>
<a-drawer
:title="$t('standardSelect.standardSelection')"
:maskClosable="false"
:width="1000"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
class="custom-drawer-style">
<div class="custom-drawer-style-scroll">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :sm="8">
<a-form-item :label="$t('standardSelect.standardNumOrName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input :placeholder="$t('pleaseEnter')+$t('standardSelect.standardNumOrName')"
v-model="queryParam.standardNumberOrName"></a-input>
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;margin-right: 41px;margin-bottom: 20px" class="table-page-search-submitButtons">
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{ $t('reset') }}</a-button>
<a-button class="box-button" style="margin-left: 8px" type="primary" @click="searchQuery">{{ $t('query') }}</a-button>
</div>
</a-row>
</a-form>
</div>
<a-table
:columns="columns"
rowKey="serial_number"
:scroll="{x: 900}"
:data-source="dataList"
:pagination="ipagination"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="loading">
<!-- 标准编号标准名称跳转详情-->
<template v-slot:detail="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 slot="text" slot-scope="text">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
</a-table>
</div>
<div class="custom-drawer-style-bottom-btn">
<a-button @click="handleCancel">{{ $t('cancel') }}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{ $t('submit') }}</a-button>
</div>
</a-drawer>
</template>
<script>
import { getDomesticStandardNoSystem } from '../../../../api/standardRegulationLibraryApi.js'
import { StandardSource } from '../../../../enums/commonEnums.js'
export default {
name: 'SelectionOverseasStandardDrawer',
props: {
// 选中节点code
nodeCode: {
type: String,
required: false,
default: null
},
query: {
type: Object,
required: false,
default: () => {
return {}
}
}
},
data () {
return {
visible: false,
confirmLoading: false,
labelCol: {
sm: 8
},
wrapperCol: {
sm: 14
},
selectedRowKeys: [],
selectedRowList: [],
loading: false,
queryParam: {},
/* 分页参数 */
ipagination: {
current: 1,
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' ' + this.$t('total') + ' ' + total + ' ' + this.$t('strip')
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
columns: [
{
title: this.$t('standardSelect.standardNumber'),
dataIndex: 'standardNumber',
align: 'center',
width: 150,
scopedSlots: { customRender: 'detail' }
},
{
title: this.$t('standardSelect.standardName'),
dataIndex: 'standardName',
align: 'center',
width: 150,
scopedSlots: { customRender: 'detail' }
},
{
title: this.$t('standardSelect.releaseDate'),
dataIndex: 'releaseDate',
align: 'center',
width: 120,
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('standardSelect.textState'),
dataIndex: 'standardState_dictText',
align: 'center',
width: 120,
scopedSlots: { customRender: 'text' }
}
],
dataList: [],
url: {
searchList: 'document/bussDocumentLibraryEO/queryCondition' // 搜索字段
}
}
},
methods: {
open () {
this.visible = true
this.queryParam = {}
this.replacePage()
},
// 获取表格数据
replacePage () {
const query = {
...this.queryParam,
pageNo: this.ipagination.current,
pageSize: this.ipagination.pageSize,
nodeCode: this.nodeCode,
source: StandardSource.OVERSEAS.value
}
this.selectedRowKeys = []
this.loading = true
getDomesticStandardNoSystem(query).then((res) => {
if (res.success) {
this.dataList = res.result.records
this.ipagination.total = res.result.total
this.selectedRowKeys = this.standard[this.query.db_field_name] ? this.standard[this.query.db_field_name].split(',') : []
} else {
this.dataList = []
}
}).finally(() => {
this.loading = false
})
},
searchQuery () {
this.replacePage()
},
searchReset () {
this.queryParam = {}
this.replacePage()
},
// 表格选择改变
onSelectChange (value, row) {
this.selectedRowKeys = value
this.selectedRowList = row
},
handleCancel () {
this.visible = false
},
handleSubmit () {
const serialNumber = []
const replaceStandardId = []
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
// let content = JSON.parse(JSON.stringify(this.selectedRowList))
this.selectedRowList.forEach(res => {
serialNumber.push(res.serial_number)
replaceStandardId.push(res.id)
})
this.$emit('input', serialNumber.join(','))
this.$emit('change', this.query.dbFieldName, replaceStandardId.join(','))
// this.$emit('changecontent', this.content)
this.visible = false
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
/**
* 跳转详情页
* @param id
*/
toDetailPage ({ id }) {
this.$openPageNewSheet({
path: '/standardRegulationLibrary/DomesticStandardDetail',
query: {
id
}
})
}
}
}
</script>
<style scoped lang="less">
</style>