Files
foton-laws-system-front/src/pages/regulatoryRepository/standardForComments/index.vue
T
2021-06-03 09:28:12 +08:00

569 lines
18 KiB
Vue

<comment>
# 标准征求意见
</comment>
<template>
<div class="standardForComments">
<!-- 顶部工具栏 -->
<table-tools-bar>
<div slot="left">
<div class="search-area">
<el-form :modal="standCommonlySearch" inline class="label-input-form" @keyup.enter.native="sarStandCompareHis">
<el-formItem label="类别" class="search-item">
<el-input v-model="oldNumOrName" class="s-c-input" placeholder="标准/政策" clearable :maxlength="100" @keyup.enter.native="sarStandCompareHis()"></el-input>
</el-formItem>
<el-formItem label="关键字" class="search-item">
<el-input v-model="newNumOrName" class="s-c-input" placeholder="请输入关键字" clearable :maxlength="100" @keyup.enter.native="sarStandCompareHis()"></el-input>
</el-formItem>
<el-formItem label="开始日期" class="search-item">
<el-datePicker v-model="newNumOrName1" :editable="false"
placeholder="请选择开始日期"></el-datePicker>
</el-formItem>
<el-formItem label="结束日期" class="search-item">
<el-datePicker v-model="newNumOrName2" :editable="false"
placeholder="请选择结束日期"></el-datePicker>
</el-formItem>
<el-formItem class="search-item btn-box">
<el-button
type="primary"
size="mini"
class="common-button-primary"
@click="sarStandCompareHisInfo">搜索</el-button>
<el-button
class="common-button-default"
size="mini"
@click="clearSearchStand">清空</el-button>
</el-formItem>
</el-form>
</div>
</div>
</table-tools-bar>
<div class="content">
<div class="action-bar">
</div>
<div class="table-wrap">
<div style="position: absolute;height: calc(100% - 10px);width: 100%;">
<el-table
ref="selection"
:data="standInfoList"
tooltip-effect="dark"
style="width: 100%;padding:0 0 20px 0;"
height="100%"
border
:header-cell-style="{background: '#f8f8f9', color: '#515a6e'}"
@selection-change="standSelectChange">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
prop="oldStandNum"
label="类别"
align="center">
<template slot-scope="scope">
<a class="table-jump" @click.stop="oldPreview(scope.row)">{{ scope.row.oldStandNum }}</a>
</template>
</el-table-column>
<el-table-column
prop="oldStandName"
label="标准名称/政策名称"
align="center">
<template slot-scope="scope">
<a @click="handlePreview(scope.row)" class="table-jump">{{ scope.row.oldStandName }}</a>
</template>
</el-table-column>
<el-table-column
prop="createTime"
label="征求意见周期"
sortable
align="center">
</el-table-column>
<el-table-column
prop="createTime"
label="上传时间"
sortable
align="center">
</el-table-column>
</el-table>
</div>
</div>
</div>
<pagination :page="splitInfoPage" :total="total" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination>
<loading :loading="spinShow">{{$t('m.dataLoading')}}……</loading>
<!-- 分享 -->
<el-drawer :title="$t('m.sharingStandard')" :visible.sync="drawerModal" width="300" :styles="drawerModalstyles" @on-close="treeCancel">
<div class="demo-drawer-content">
<dept-tree treeDivId="drawerModalTree"
ref="drawerModalTree"
@treeClick="selcetTree"
allDept
showUser
:editable="false"
style="padding: 0 15px">
</dept-tree>
</div>
<div class="demo-drawer-footer">
<el-button size="mini" type="primary" @click="shareStandardBt" icon="el-icon-check">确定</el-button>
<el-button size="mini" style="margin-right: 8px" @click="treeCancel" icon="el-icon-close">取消</el-button>
</div>
</el-drawer>
</div>
</template>
<script>
export default {
name: 'standardForComments',
components: {
},
data () {
return {
visibleOrgTable: false,
orgTableVal: '',
orgTableValName: '',
spinShow: false,
collect: '收藏',
cancelCollect: false,
standCommonlySearch: {},
oldNumOrName: '',
newNumOrName: '',
newNumOrName1: '',
newNumOrName2: '',
standInfoList: [],
tableHeight: null,
total: 0,
splitInfoPage: 1,
splitInfoPageSize: this.$store.getters.userInfo.configContent,
selectedList: [],
drawerModalstyles: {
height: 'calc(100% - 55px)',
overflow: 'auto',
paddingBottom: '53px',
position: 'static'
},
// end 分享相关的
shareStandardModal: false,
shareStandardSelect: [],
// 分享数据
resType: '',
// 消息推送保存对象
personShareEO: {
id: '',
recipientId: '',
shareUserId: '',
resType: '',
resId: '',
resUri: '',
resTitle: '',
readFlag: '',
validFlag: '',
modifyTime: '',
creationTime: '',
oldStandName: '',
},
// 收藏标准
personCollect: {
collectResId: '',
collectTitle: '',
collectType: ''
},
drawerModal: false // 分享
}
},
props: {
},
watch: {
},
methods: {
handleCommand (command) {
switch (command[1]) {
case '查看':
this.handlePreview(command[0])
break
case '查看类别':
this.oldPreview(command[0])
break
case '收藏':
this.collectInfo(command[0])
break
case '取消收藏':
this.cancelCollectInfo(command[0])
break
case '分享':
this.enjoyInfo(command[0])
break
case '删除':
this.delFileEditInfo(command[0].id)
break
}
},
// 树点击
isTreeOk (checkedList) {
this.shareStandardSelect = []
checkedList.map((item, index) => {
if (!item.isParent) {
this.shareStandardSelect.push(item.userId)
}
})
if (this.shareStandardSelect.length === 0) {
this.$message({
message: '请选择要分享的人!',
type: 'warning'
})
} else {
this.personShareEO.resType = 'COMPARISON'
this.personShareEO.resTitle = '【标准比对】 ' + (this.resPk.oldStandNum ? this.resPk.oldStandNum:'') + ' - ' + (this.resPk.newStandNum ? this.resPk.newStandNum:'')
/*if (this.resPk.standYear != null && this.resPk.standYear !== '') {
this.personShareEO.resTitle = this.resPk.oldStandName + ' ( 编号:' + this.resPk.oldFileType + ' ' + this.resPk.oldStandNum + '-' + this.resPk.standYear + ' )'
} else {
}*/
this.personShareEO.resId = this.resPk.id
this.personShareEO.resUri = JSON.stringify(this.resPk)
this.personShareEO.recipientId = this.shareStandardSelect
this.$http.post('/person/personShare/savePersonShare', this.personShareEO, {
_this: this
}, res => {
this.$message({
message: '标准分享成功!',
type: 'success'
})
this.shareStandardModal = false
this.visibleOrgTable = false
// this.drawerModal = false
this.shareStandardSelect = []
// this.$refs.drawerModalTree.treeReload()
}, e => {
this.$message.error('标准分享失败!')
})
}
},
// 消息推送
shareStandardBt () {
if (this.shareStandardSelect.length === 0) {
this.$message({
message: '请选择要分享的人!',
type: 'warning'
})
} else {
this.personShareEO.resType = 'COMPARISON'
this.personShareEO.resTitle = '【标准比对】 ' + (this.resPk.oldStandNum ? this.resPk.oldStandNum:'') + ' - ' + (this.resPk.newStandNum ? this.resPk.newStandNum:'')
/*if (this.resPk.standYear != null && this.resPk.standYear !== '') {
this.personShareEO.resTitle = this.resPk.oldStandName + ' ( 编号:' + this.resPk.oldFileType + ' ' + this.resPk.oldStandNum + '-' + this.resPk.standYear + ' )'
} else {
}*/
this.personShareEO.resId = this.resPk.id
this.personShareEO.resUri = JSON.stringify(this.resPk)
this.personShareEO.recipientId = this.shareStandardSelect
this.$http.post('/person/personShare/savePersonShare', this.personShareEO, {
_this: this
}, res => {
this.$message({
message: '标准分享成功!',
type: 'success'
})
this.shareStandardModal = false
this.drawerModal = false
this.shareStandardSelect = []
this.$refs.drawerModalTree.treeReload()
}, e => {
this.$message.error('标准分享失败!')
})
}
},
// 树点击
selcetTree (treeId, treeNode) {
this.shareStandardSelect = treeNode.id
},
// 取消
treeCancel () {
this.drawerModal = false
this.$refs.drawerModalTree.treeReload()
},
// 点击查看
handlePreview (item) {
sessionStorage.setItem('accessRow',JSON.stringify(item))
this.$store.commit('setDetailMap',this.$router.path)
this.$router.push({
name: 'consultationDetails',
params: {
id: item.id
}
})
},
oldPreview (item) {
sessionStorage.setItem('accessRow', JSON.stringify(item))
this.$store.commit('setDetailMap', this.$route.path)
this.$router.push({
name: 'categoryDetails',
params: {
id: item.id
}
})
},
// oldPreview (item) {
// let routeUrl = this.$router.resolve({
// name: 'categoryDetails',
// params: {
// id: item.id,
// pageType: 'INLAND_STAND'
// }
// })
// window.open(routeUrl.href, '_self')
// },
// handlePreview (params) {
// if (params.compareType === '条款比对') {
// this.$store.commit('setDetailMap', this.$route.path)
// this.$router.push({
// name: 'SeeDatalis',
// query: {
// row: JSON.stringify(params)
// }
// })
// } else {
// let rowDataLeft = {}
// let rowDataRight = {}
// rowDataLeft.showNumber = params.oldStandNum
// rowDataLeft.standName = params.oldStandName
// rowDataLeft.standNameSplit = null
// rowDataLeft.standNumSplit = null
// rowDataRight.showNumber = params.newStandNum
// rowDataRight.standName = params.newStandName
// rowDataRight.standNameSplit = null
// rowDataRight.standNumSplit = null
// this.$store.commit('setDetailMap', this.$route.path)
// this.$router.push({
// name: 'TextComparison',
// query: {
// id: params.id,
// flag: '查看',
// rowDataLeft: JSON.stringify(rowDataLeft),
// rowDataRight: JSON.stringify(rowDataRight)
// }
// })
// }
// },
// 删除
delFileEditInfo (id) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: this.$t('m.determine'),
cancelButtonText: this.$t('m.cancel'),
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
this.$http.post('lawss/sarStandCompareHis/deleteByIds', {
deleteByIdList: id
}, {
_this: this
}, res => {
if (res.ok) {
this.sarStandCompareHis()
}
})
}).catch(() => {
// 取消删除,清空选择
// this.$refs.selections.clearSelection()
})
},
enjoyInfo (item) {
// this.$message({
// message: '此功能正在开发中……',
// type: 'warning'
// })
// this.drawerModal = true
// this.$nextTick(() => {
// this.$refs.drawerModalTree.clearSearch()
// })
this.visibleOrgTable = true
this.resPk = JSON.parse(JSON.stringify(item))
},
// scope.$index 获取当前行下标
collectInfo (item) {
// 点击收藏
this.spinShow = true
item.isSubmit = true
this.personCollect.collectResId = item.id
if (item.standYear != null && item.standYear !== '') {
this.personCollect.collectTitle = item.newStandName + ' ( 编号:' + item.newStandNum + ' )'
} else {
this.personCollect.collectTitle = item.newStandName + ' ( 编号:' + item.newStandNum + ' )'
}
this.personCollect.collectType = 'INLAND_STAND'
this.$http.postData('person/personCollect', this.personCollect, {
_this: this
}, res => {
this.spinShow = false
item.isSubmit = false
item.collectBtn = !item.collectBtn
console.log(item.collectBtn, '点击收藏后')
item.collectId = res.data.id
this.cancelCollect = !this.cancelCollect
}, e => {
item.isSubmit = false
})
},
cancelCollectInfo (item) {
this.$http.put('person/personCollect/updateByUserId', {
id: item.collectId
}, {
_this: this
}, res => {
if (res.ok) {
item.collectBtn = !item.collectBtn
this.cancelCollect = !this.cancelCollect
item.collectId = ''
}
})
},
clearSearchStand () {
this.oldNumOrName = ''
this.newNumOrName = ''
this.splitInfoPage = 1
this.sarStandCompareHis()
},
sarStandCompareHisInfo() {
this.splitInfoPage = 1
this.sarStandCompareHis()
},
// 表格
sarStandCompareHis () {
this.spinShow = true
this.$http.get('lawss/sarStandCompareHis/page', {
page: this.splitInfoPage,
pageSize: this.splitInfoPageSize,
oldNumOrName: this.oldNumOrName,
newNumOrName: this.newNumOrName
}, {
_this: this
}, res => {
for (let i = 0; i < res.data.list.length; i++) {
res.data.list[i].checked = false
if (res.data.list[i].collectId != null && res.data.list[i].collectId !== '') {
res.data.list[i].collectBtn = false
res.data.list[i].cancelCollectBtn = true
} else {
res.data.list[i].collectBtn = true
res.data.list[i].cancelCollectBtn = false
}
res.data.list[i].isSubmit = false
}
this.standInfoList = res.data.list
this.total = res.data.count
this.spinShow = false
}, e => {
})
},
pageChange (page) {
this.splitInfoPage = page
this.sarStandCompareHis()
},
// 分页每页显示数改变后方法
pageSizeChange (pageSize) {
this.splitInfoPageSize = pageSize
this.sarStandCompareHis()
},
standSelectChange (data) {
this.selectedList = []
for (let i = 0; i < data.length; i++) {
this.selectedList.push(data[i].id)
}
},
contrastStandFile () {
this.$store.commit('setDetailMap', this.$route.path)
this.$router.push({
name: 'ContrastDetails'
})
},
batchDelete () {
if (this.selectedList.length === 0) {
this.$message({
message: '请选择要删除的数据',
type: 'warning'
})
} else {
this.$confirm('确认删除这些数据?', '提示', {
confirmButtonText: this.$t('m.determine'),
cancelButtonText: this.$t('m.cancel'),
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
this.$http.post('lawss/sarStandCompareHis/deleteByIds', {
deleteByIdList: this.selectedList.join(',')
}, {
_this: this
}, res => {
this.sarStandCompareHis()
}, e => {
})
}).catch(() => {
// 取消删除,清空选择
// this.$refs.multipleTable.clearSelection()
})
}
}
},
computed: {
},
mounted () {
this.sarStandCompareHis()
this.tableHeight = $('.content').height() - 44
window.onresize = () => {
this.tableHeight = $('.content').height() - 44
}
}
}
</script>
<style lang="less" scoped>
@import '~@/assets/styles/mixins';
@import '~@/assets/styles/style';
.standardForComments {
height: 100%;
background: #fff;
.el-divider--horizontal {
display: block;
height: 1px;
width: 100%;
margin: 0;
}
.flex();
flex-direction: column;
.action-bar {
margin-bottom: 5px;
padding: 0;
}
.content {
flex: auto;
overflow: hidden;
display: flex;
flex-direction: column;
.table-wrap {
flex: auto;
overflow: hidden;
position: relative;
}
}
& > .pagination {
position: static;
/deep/.pagination-slot {
padding: 0;
}
}
.s-c-input {
/deep/ .el-input__inner {
width: 190px;
}
}
}
::v-deep .el-drawer__header{
&>span:first-child{
outline:0 !important;
}
}
::v-deep .el-drawer{
outline:0 !important;
}
</style>