update 国内标准

This commit is contained in:
赵霄
2023-08-28 18:03:33 +08:00
parent 0b366ab9a1
commit 3e18b33453
9 changed files with 458 additions and 63 deletions
+34 -5
View File
@@ -1,3 +1,5 @@
@primary-color: #D52C26;
/*列表上方操作按钮区域*/
/*.ant-card-body .table-operator {
margin-bottom: 8px;
@@ -31,16 +33,21 @@
.ant-card-body .table-operator,
.table-operator {
margin-bottom: 29px;
text-align: right;
font-size: 14px;
font-weight: 400;
color: #040B29;
}
.operator-text {
cursor: pointer;
margin-right: 53px;
font-size: 14px;
font-weight: 400;
color: #040B29;
display: inline-block;
.ant-upload {
font-size: 14px;
font-weight: 400;
color: #040B29;
}
}
.operator-text:last-child {
@@ -75,6 +82,10 @@
margin-left: 0;
}
.operate-icon-btn {
color: @primary-color;
}
/*列表页面弹出modal*/
.ant-modal-cust-warp {
height: 100%
@@ -503,10 +514,28 @@
// 鼠标移入树节点样式修改
.ant-tree li .ant-tree-node-content-wrapper:hover {
background: #FFFFFF;
box-shadow: 0 0 4px 0 rgba(0,0,0,0.1);
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px 4px 4px 4px;
opacity: 1;
margin-left: -24px;
padding-left: 29px;
width: 100%;
}
/*抽屉样式修改*/
.ant-drawer-body {
height: calc(100vh - 55px);
.ant-spin-container {
height: 100%;
}
.drawer-container {
height: calc(100% - 52px);
overflow: auto;
}
.drawer-footer {
margin-top: 20px;
}
}
+4 -1
View File
@@ -121,6 +121,9 @@ module.exports = {
uploadedBy: 'Uploaded By',
uploadTime: 'Upload Time',
uploadFileBtn: 'Upload File',
tips: 'Tips',
exportTip: 'Exporting, please wait',
fileDownloadFail: 'File download failure',
// 树右键
treeRight: {
addFolder: 'Create New Folder',
@@ -373,7 +376,7 @@ module.exports = {
confirmCollection: 'Confirm Collection?',
cancelConfirmCollection: 'Are you sure you want to cancel the collection?',
confirmSubscribe: 'Confirm Subscribe ?',
cancelConfirmSubscribe: 'Are you sure you want to cancel the subscribe',
cancelConfirmSubscribe: 'Are you sure you want to cancel the subscribe'
},
// 文档工具
docTool: {
@@ -1,6 +1,12 @@
module.exports = {
configStandard: 'Configuration standard', // 配置标准
removeStandard: 'Removal criteria', // 移出标准
// 国内标准
domesticStandard: {
treeSearchPlaceholder: 'Please enter the tree system' // 请输入树状图体系
treeSearchPlaceholder: 'Please enter the tree system', // 请输入树状图体系
collection: 'Invoice Collection', // 收藏
cancelCollection: 'Delete Collection', // 取消收藏
exportFileName: 'Domestic standard regulations', // 国内标准法规
templateName: 'Import templates for domestic standards and regulations' // 国内标准法规导入模板
}
}
@@ -1,6 +1,12 @@
module.exports = {
configStandard: '配置标准',
removeStandard: '移出标准',
// 国内标准
domesticStandard: {
treeSearchPlaceholder: '请输入树状图体系'
treeSearchPlaceholder: '请输入树状图体系',
collection: '收藏',
cancelCollection: '取消收藏',
exportFileName: '国内标准法规',
templateName: '国内标准法规导入模板'
}
}
+3
View File
@@ -121,6 +121,9 @@ module.exports = {
uploadedBy: '上传人',
uploadTime: '上传时间',
uploadFileBtn: '上传文件',
tips: '提示',
exportTip: '正在导出,请稍候',
fileDownloadFail: '文件下载失败',
// 树右键
treeRight: {
addFolder: '新增文件夹',
+228 -37
View File
@@ -1,31 +1,12 @@
/**
* 表头通过标签管理配置的模块的表格数据的混入
*/
import { getAction, postAction } from '@api/manage'
import { isHasPermission } from '../utils/hasPermission'
import { getTableHeader } from '@api/api'
import { downFile, downloadFile, getAction, postAction } from '@api/manage'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import store from '@/store'
// 模拟接口返回的表头数据
const TempApiReturnColumns = [
{
db_field_txt: '编号',
sort: 'true',
db_field_name: 'serial_number',
click: 'true'
},
{ db_field_txt: '标题', db_field_name: 'title', click: 'true' },
{
db_field_txt: '状态',
sort: 'true',
db_field_name: 'state'
},
{ db_field_txt: '适用地区', db_field_name: 'region' },
{
db_field_txt: '技术领域',
db_field_name: 'technology_territory'
},
{ db_field_txt: '发布日期', sort: 'true', db_field_name: 'issue_time' }
]
let importModalLoading
export const ConfigurableTableMixin = {
data () {
@@ -60,12 +41,19 @@ export const ConfigurableTableMixin = {
},
// type: '', // 这个字段不知道什么含义
filters: {}, // 固定的搜索条件
needFilterTableBtn: true // 是否需要过滤没有权限的按钮
needFilterTableBtn: true, // 是否需要过滤没有权限的按钮
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) }
}
},
computed: {
importExcelUrl () {
return `${window._CONFIG.domianURL}${this.url.importUrl}`
}
},
mounted () {
this.getTableHeader()
this.loadData()
// this.loadData()
// 过滤没有权限的按钮
// if (this.needFilterTableBtn) {
// this.operationList = this.operationList.filter(item => isHasPermission(item.has))
@@ -86,6 +74,9 @@ export const ConfigurableTableMixin = {
this.getTableHeader()
this.loadData()
},
/**
* 重置查询
*/
searchReset () {
this.searchParams = {}
this.selectedRowKeys = []
@@ -97,7 +88,6 @@ export const ConfigurableTableMixin = {
*/
getTableHeader () {
if (!this.url.tableHeader) {
this.columns = this.dealColumns(TempApiReturnColumns)
return
}
const params = { module: this.flag }
@@ -130,7 +120,7 @@ export const ConfigurableTableMixin = {
}
}
// 是否可排序
item.sorter = item.sort === 'true'
item.sorter = item.sortFlag === 1
item.width = 215
item.title = item.dbFieldTxt
item.dataIndex = item.dbFieldName
@@ -138,13 +128,11 @@ export const ConfigurableTableMixin = {
})
if (this.showAction && this.operateColumn) {
let width = 0
if (this.operationList.length > 0) {
for (let i = 0; i < this.operationList.length; i++) {
width += this.getTextWith(this.operationList[i].text)
}
if (this.operationList && this.operationList.length > 0) {
width += this.getTextWith(this.operationList[0].text) + this.getTextWith(this.$t('more'))
}
const operateColumn = JSON.parse(JSON.stringify(this.operateColumn))
operateColumn.width = width
operateColumn.width = width || 100
tempColumns.push(operateColumn)
}
return tempColumns
@@ -165,7 +153,7 @@ export const ConfigurableTableMixin = {
getQueryParams () {
const pageNo = this.ipagination.current
const pageSize = this.ipagination.pageSize
const params = {
return {
...this.filters,
...this.searchParams,
orderBy: this.orderBy,
@@ -174,13 +162,16 @@ export const ConfigurableTableMixin = {
pageNo: pageNo,
pageSize: pageSize
}
return params
},
loadData () {
loadData (arg) {
if (!this.url.list) {
this.$message.error('请设置url.list属性!')
return
}
// 加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1
}
const params = this.getQueryParams()
this.loading = true
postAction(this.url.list, params).then((res) => {
@@ -203,10 +194,210 @@ export const ConfigurableTableMixin = {
this.orderBy = sorter.order === 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.ipagination = pagination
this.loadData()
this.loadData(1)
},
onSelectChange (selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
/* 导入 */
handleImportExcel (info) {
// 加一个大的提示
if (!this.loading) {
importModalLoading = this.$info({
title: '提示',
content: <span>正在导入请稍候 <a-spin size="small" /></span>,
keyboard: false
})
}
this.loading = true
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList)
}
if (info.file.status === 'done') {
// 销毁这个提示
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.success) {
// this.$message.success(`${info.file.name} 文件上传成功`);
if (info.file.response.code === 201) {
const { message, result: { msg, fileUrl, fileName } } = info.file.response
const href = window._CONFIG.domianURL + fileUrl
this.$warning({
title: message,
content: (
<div>
<span>{msg}</span><br />
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
</div>
)
})
} else {
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
}
this.loadData()
} else {
this.$message.error(`${info.file.name} ${info.file.response.message}.`)
}
} else if (info.file.status === 'error') {
// 销毁这个提示
importModalLoading && importModalLoading.destroy()
this.loading = false
if (info.file.response.status === 500) {
const data = info.file.response
const token = Vue.ls.get(ACCESS_TOKEN)
if (token && data.message.includes('Token失效')) {
this.error({
title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录',
okText: '重新登录',
mask: false,
onOk: () => {
store.dispatch('Logout').then(() => {
Vue.ls.remove(ACCESS_TOKEN)
window.location.reload()
})
}
})
}
} else {
this.$message.error(`文件上传失败: ${info.file.msg} `)
}
}
},
/**
* 导出
* @param fileName
*/
handleExportXls (fileName) {
if (!fileName || typeof fileName !== 'string') {
fileName = '导出文件'
}
const param = this.getQueryParams()
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
param.selections = this.selectedRowKeys.join(',')
}
console.log('导出参数', param)
// 加一个大的提示
const modalLoading = this.$info({
title: this.$t('tips'),
content: <span>{this.$t('exportTip')}
<a-spin size="small" /></span>,
keyboard: false
})
// 把知道了这个按钮去掉
this.$nextTick(() => {
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
})
downFile(this.url.exportXlsUrl, param).then((data) => {
if (!data) {
this.$message.warning(this.$t('fileDownloadFail'))
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
} else {
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName + '.xls')
document.body.appendChild(link)
link.click()
document.body.removeChild(link) // 下载完成移除元素
window.URL.revokeObjectURL(url) // 释放掉blob对象
}
}).finally(() => {
// 销毁这个提示
modalLoading.destroy()
})
},
// 下载导入模板
downTemplate (fileName) {
if (!fileName || typeof fileName !== 'string') {
fileName = '模板文件'
}
downloadFile(this.url.downTemplateUrl, fileName + '.xlsx')
},
/**
* 批量删除
*/
batchDel () {
if (!this.url.deleteBatch) {
this.$message.error('请设置url.deleteBatch属性!')
return
}
if (this.selectedRowKeys.length <= 0) {
this.$message.warning(this.$t('selectARecord'))
} else {
let ids = ''
for (let a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ','
}
const that = this
this.$confirm({
title: this.$t('confirmBatchDeletion'),
content: this.$t('deleteAData'),
onOk: function() {
that.loading = true
postAction(that.url.deleteBatch, { ids: ids }).then((res) => {
if (res.success) {
// 重新计算分页问题
that.reCalculatePage(that.selectedRowKeys.length)
that.$message.success(res.message)
that.loadData()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.loading = false
})
}
})
}
},
/**
* 删除
* @param id
*/
handleDelete (id) {
if (!this.url.delete) {
this.$message.error('请设置url.delete属性!')
return
}
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
postAction(that.url.delete, { id: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
},
handleEdit (record) {
this.$refs.modalForm.edit(record)
this.$refs.modalForm.title = this.$t('edit')
this.$refs.modalForm.disableSubmit = false
},
handleAdd () {
this.$refs.modalForm.add()
this.$refs.modalForm.title = this.$t('newlyAdded')
this.$refs.modalForm.disableSubmit = false
}
}
}
@@ -40,12 +40,82 @@
</template>
</a-tree>
</div>
<div class="page-right-box"></div>
<div class="page-right-box">
<div class="table-page-search-wrapper">
<search ref="searchRef" :flag="flag" :url="url" @search="searchQuery" @reset="searchReset" />
</div>
<div class="table-operator">
<!-- 新增-->
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
<!-- 导入-->
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @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'))">
{{ $t('export') }}
</a-button>
<!-- 带文件导出-->
<a-button icon="upload" type="primary" ghost>{{ $t('exportWithFile') }}</a-button>
<!-- 模板下载-->
<a-button type="primary" icon="download" ghost @click="downTemplate('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="setting" ghost>{{ $t('standardRegulationLibrary.configStandard') }}</a-button>
<!-- 移出标准-->
<a-button type="primary" icon="minus-circle" ghost>{{ $t('standardRegulationLibrary.removeStandard') }}</a-button>
</div>
<div>
<j-table
v-if="columns && columns.length > 0"
:columns="columns"
:dataSource="dataSource"
:can-drag="true"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="ipagination"
:scroll="{x: '100%'}"
@change="tableOnChange">
<template v-slot:operation="{text, record}">
<a>{{$t('standardRegulationLibrary.domesticStandard.collection')}}</a>
<a-divider type="vertical" />
<a-dropdown>
<a-icon type="more" class="operate-icon-btn" />
<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>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</j-table>
</div>
</div>
</a-card>
</template>
<script>
import '@assets/less/common.less'
import { ConfigurableTableMixin } from '@/mixins/ConfigurableTableMixin'
import Search from '@comp/customField/Search.vue'
import JTable from '@comp/jero/JTable.vue'
const apiTreeData = [
{
@@ -72,11 +142,45 @@ const apiTreeData = [
export default {
name: 'DomesticStandardList',
components: { Search, JTable },
mixins: [ConfigurableTableMixin],
data () {
return {
treeInput: null, // 树查询绑定值
treeData: [],
mouseInNodeKey: null // 鼠标悬浮的节点key值
mouseInNodeKey: null, // 鼠标悬浮的节点key值
showAction: true,
operationList: [
// 收藏
{
text: this.$t('standardRegulationLibrary.domesticStandard.cancelCollection'),
clickEvent: 'collection',
has: ''
},
{
text: this.$t('edit'),
clickEvent: 'handleEdit',
has: ''
},
{
text: this.$t('share'),
clickEvent: 'handleShare',
has: ''
},
{
text: this.$t('delete'),
clickEvent: 'handleDelete',
has: ''
}
],
url: {
tableHeader: '/laws/standard/domestic/getCommonHeader',
getSearchList: '/laws/standard/domestic/getQueryCondition',
list: '/laws/standard/domestic/getCommonPage',
delete: '/laws/standard/domestic/deleteByIdsAndModule',
deleteBatch: '/laws/standard/domestic/deleteByIdsAndModule'
},
dataSource: [{ id: '131234' }]
}
},
created () {
@@ -0,0 +1,55 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
:maskClosable="false"
style="height: 100%;overflow: auto;"
>
<a-spin :spinning="confirmLoading" style="width: 100%;height:100%">
<div class="drawer-container">
</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-drawer>
</template>
<script>
export default {
name: 'DomesticStandardModal',
data () {
return {
visible: false,
title: '',
width: 800,
// 存储表单的数据
form: {},
confirmLoading: false
}
},
methods: {
add () {
this.edit({})
},
edit (record) {
this.visible = true
},
close () {
this.visible = false
}
}
}
</script>
<style scoped>
</style>
@@ -162,12 +162,12 @@
</template>
</a-row>
</a-form-model>
<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>
</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-drawer>
@@ -452,17 +452,15 @@ export default {
</script>
<style scoped lang="less">
.drawer-container {
.drawer-footer {
height: 32px;
display: flex;
justify-content: center;
.drawer-footer {
height: 32px;
display: flex;
justify-content: center;
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
}