Files
foton-laws-system-front/src/pages/regulatoryRepository/standardTranslationAcquisitionRequest/components/standardTranslationAcquisitionRequestModal.vue
T
2024-03-29 14:59:36 +08:00

309 lines
8.6 KiB
Vue

<template>
<el-dialog
title="标准/译文获取申请"
width="70%"
:visible.sync="visible"
:before-close="handleClose"
>
<div class="operate">
<el-button size="mini" type="primary" @click="standardTranslationAcquisitionRequestAdd">新增标准/译文获取申请</el-button>
<el-upload
action="http://localhost:9090/api/lawss/standardApplyFor/importData"
:headers="headers"
style="margin: 0 10px"
:on-success="importSuccess"
:on-error="importError"
:show-file-list="false"
:multiple="false"
accept=".xlsx,xls"
>
<el-button size="mini" type="primary">导入</el-button>
</el-upload>
<el-button size="mini" @click="templateDownload">模版下载</el-button>
<el-button size="mini" @click="batchDelete()">批量删除</el-button>
</div>
<div class="table-container">
<el-table
ref="selections"
tooltip-effect="dark"
style="width: 100%; flex: auto;"
class="drag-table"
height="300px"
row-key="id"
border
:data="StandardApplyForEO"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px', fontWeight: 'bold', height: '48px'}"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
/>
<el-table-column
type="index"
fixed="left"
width="55"
label="序号"
align="center"
/>
<el-table-column
show-overflow-tooltip
label="类型"
prop="typeShow"
align="center"
min-width="100"
/>
<el-table-column
show-overflow-tooltip
label="标准编号"
width="150"
align="center"
prop="standNumShow"
/>
<el-table-column
show-overflow-tooltip
label="标准名称"
prop="standName"
align="center"
min-width="150"
/>
<el-table-column
show-overflow-tooltip
label="原语言"
prop="sourceLanguage"
align="center"
min-width="100"
/>
<el-table-column
show-overflow-tooltip
label="目标语言"
prop="targetLanguage"
align="center"
min-width="100"
/>
<el-table-column
show-overflow-tooltip
label="理由"
prop="reason"
align="center"
min-width="300"
/>
<el-table-column
show-overflow-tooltip
label="申请状态"
prop="status"
align="center"
min-width="100"
>
<template slot-scope="scope">
{{ scope.row.status === 'refuse' ? '驳回' : scope.row.status === 'pendingApproval' ? '待审批' : scope.row.status === 'pass' ? '通过' : '草稿' }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200" fixed="right">
<template slot-scope="scope">
<div class="table-operate-btn" @click="toView(scope.row)">查看</div>
<div class="table-operate-btn" @click="edit(scope.row)">编辑</div>
<div class="table-operate-btn" @click="batchDelete(scope.row.id)">删除</div>
</template>
</el-table-column>
</el-table>
<!--分页-->
<pagination
style="position: relative;"
:page="page"
:total="total"
@pageChange="pageChange"
@pageSizeChange="pageSizeChange"
/>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="mini" type="primary" @click="cancel">取消</el-button>
<el-button size="mini" type="primary" @click="submitData(1)">提交</el-button>
</span>
<loading :loading="tableLoading">数据加载中……</loading>
<addModal ref="addModalRef" @updateList="getList" />
<detailModal ref="detailModalRef" />
</el-dialog>
</template>
<script>
import addModal from './addModal';
import detailModal from './detailModal';
export default {
name: 'StandardTranslationAcquisitionRequestModal',
components: {
addModal,
detailModal
},
data () {
return {
visible: false,
tableLoading: false,
StandardApplyForEO: [],
selectedList: [],
page: 1,
headers: {
token: JSON.parse(localStorage.getItem('userInfo')).token
},
pageSize: this.$store.getters.userInfo.configContent,
total: 0,
fileList: '',
url: {
deleteUrl: '/lawss/standardApplyFor/batchUpdateValidFlag',
getList: '/lawss/standardApplyFor/queryStagingByPage',
importData: '/lawss/standardApplyFor/importData'
}
}
},
methods: {
showModal () {
this.visible = true
this.StandardApplyForEO = []
this.page = 1
this.getList()
},
handleClose () {
this.visible = false
this.$emit('updateIndexList')
},
toView (item) {
this.$refs.detailModalRef.showModal(item)
},
edit (item) {
this.$refs.addModalRef.showModal(item)
},
importSuccess (response) {
if (response.ok) {
this.$message({
message: response.message,
dangerouslyUseHTMLString: true,
type: 'success'
})
}else {
this.$message({
message: response.message,
dangerouslyUseHTMLString: true,
type: 'warning'
})
}
this.getList()
},
importError () {
this.$message.error('操作失败')
},
templateDownload () {
window.open('/api/lawss/standardApplyFor/exportTemplateFile?fileName=标准/译文获取申请模板.xlsx')
},
getList () {
this.tableLoading = true
this.$http.get(this.url.getList, { page: this.page, pageSize: this.pageSize }, {
_this: this,
}, res => {
if (res.ok) {
this.StandardApplyForEO = res.data.records
this.total = res.data.total
}else {
this.StandardApplyForEO = []
this.total = 0
}
this.tableLoading = false
})
},
batchDelete (id) {
let ids = ''
let tipsText = ''
if (id) {
ids = id
tipsText = '确认删除这条数据?'
} else {
if (this.selectedList && this.selectedList.length > 0) {
ids = this.selectedList.join(',')
tipsText = '确认删除这些数据?'
}else{
this.$message.warning('请至少勾选一条数据')
return
}
}
this.$confirm(tipsText, '提示', {
confirmButtonText: '确定',
confirmButtonClass: 'common-button-primary',
cancelButtonText: '取消',
type: 'warning',
roundButton: false
}).then(() => {
this.$http.postData(this.url.deleteUrl, { ids: ids }, { _this: this }, res => {
if (res.ok) {
this.$message.success('操作成功')
this.getList()
this.selectedList = []
}else{
this.$message.warning(res.message)
}
})
}).catch(() => {
// 取消删除,清空选择
this.$refs.selections.clearSelection()
})
},
submitData () {
if (this.selectedList && this.selectedList.length > 0) {
const query = {
status: 'pendingApproval',
ids: this.selectedList.join(',')
}
this.$http.postData('/lawss/standardApplyFor/batchUpdateStatus', query, { _this: this }, res => {
if (res.ok) {
this.$message.success('操作成功')
this.getList()
}else{
this.$message.warning(res.message)
}
})
} else {
this.$message.warning('请至少勾选一条数据')
}
},
handleSelectionChange (value) {
const ids = []
value.forEach(item => {
ids.push(item.id)
})
this.selectedList = [ ...ids ]
},
standardTranslationAcquisitionRequestAdd () {
this.$refs.addModalRef.addModel()
},
pageChange (page) {
this.questionSerach.page = page
this.getList()
},
pageSizeChange (pageSize) {
this.questionSerach.pageSize = pageSize
this.getList()
},
cancel () {
this.visible = false
},
}
}
</script>
<style scoped>
.operate {
display: flex;
justify-content: right;
margin-bottom: 5px;
}
.table-operate-btn {
display: inline-block;
cursor: pointer;
color: #409EFF;
margin: 0 5px;
}
/deep/.el-input.is-disabled .el-input__inner{
background-color: #fff;
color: #606266;
}
</style>