<template>
|
<div>
|
<div>
|
<div class="view-title">
|
<span>标准查新</span>
|
<span style="display: flex; align-items: center;">
|
<el-button size="medium" type="primary" @click="openHandleOut">导 出</el-button>
|
<el-upload ref='upload' :action="action"
|
:before-upload="beforeUpload" :headers="headers" :on-error="onError"
|
:on-success="handleSuccessUp" :show-file-list="false" accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
|
style="display: inline-block; margin-left: 10px;">
|
<el-button :loading="upLoading" size="medium" type="primary">导入</el-button>
|
</el-upload>
|
<el-button size="medium" style="margin-left: 10px;" type="primary" @click="openFormDia">新 增</el-button>
|
</span>
|
</div>
|
<div class="search-background">
|
<span v-if="tabIndex == 1" class="search-group">
|
<span>年份:</span>
|
<el-date-picker
|
v-model="searchForm.year"
|
format="yyyy"
|
placeholder="选择年"
|
type="year"
|
value-format="yyyy">
|
</el-date-picker>
|
</span>
|
<span class="search-group">
|
<span>时间:</span>
|
<el-select v-model="searchForm.date" clearable placeholder="请选择">
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</span>
|
<span class="search-group">
|
<el-button size="medium" @click="resetSearchForm">重 置</el-button>
|
<el-button size="medium" type="primary" @click="searchList">查 询</el-button>
|
</span>
|
</div>
|
<div class="table">
|
<div class="table-tab">
|
<el-radio-group v-model="tabIndex" @change="searchList">
|
<el-radio-button label="0">今年标准记录</el-radio-button>
|
<el-radio-button label="1">历史标准记录</el-radio-button>
|
</el-radio-group>
|
</div>
|
<div v-if="tabIndex === '0'">
|
<TableCard :showForm="false" :showTitle="false">
|
<template v-slot:table>
|
<ZTTable
|
:column="tableColumn"
|
:height="'calc(100vh - 26em)'"
|
:table-data="tableData"
|
:table-loading="tableLoading"
|
style="padding: 0 15px;margin-bottom: 16px">
|
</ZTTable>
|
</template>
|
</TableCard>
|
<el-pagination :current-page="1" :page-size="page.size" :page-sizes="[10, 20, 30, 50, 100]"
|
:total="total" layout="->,total, sizes, prev, pager, next, jumper"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange">
|
</el-pagination>
|
</div>
|
<div v-if="tabIndex === '1'">
|
<TableCard :showForm="false" :showTitle="false">
|
<template v-slot:table>
|
<ZTTable
|
:column="oldTableColumn"
|
:height="'calc(100vh - 27em)'"
|
:table-data="oldTableData"
|
:table-loading="oldTableLoading"
|
style="padding: 0 15px;margin-bottom: 16px">
|
</ZTTable>
|
</template>
|
</TableCard>
|
<el-pagination :current-page="1" :page-size="oldPage.size" :page-sizes="[10, 20, 30, 50, 100]"
|
:total="oldTotal" layout="->,total, sizes, prev, pager, next, jumper"
|
@size-change="handleOldSizeChange"
|
@current-change="handleOldCurrentChange">
|
</el-pagination>
|
</div>
|
</div>
|
<el-dialog :visible.sync="ratifyDialog" title="导出" width="30%" @close="ratifyDialog = false">
|
<span>编制人:
|
<el-select v-model="ratifyInfo.writeUserId" placeholder="请选择" size="small" style="width: 100%">
|
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
</el-select>
|
</span>
|
<span>批准人:
|
<el-select v-model="ratifyInfo.ratifyUserId" placeholder="请选择" size="small" style="width: 100%">
|
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
</el-select>
|
</span>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="ratifyDialog = false">取 消</el-button>
|
<el-button :loading="outLoading" type="primary" @click="handleOut">确 认</el-button>
|
</span>
|
</el-dialog>
|
<FormDialog v-if="formDialog" ref="formDialog" @closeDia="closeDia"></FormDialog>
|
<EditFormDia v-if="editFormDialog" ref="editFormDialog" @closeEditDia="closeEditDia"></EditFormDia>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import ZTTable from '../caorui/ZTTable/index.vue';
|
import TableCard from '../caorui/TableCard/index.vue';
|
import FormDialog from '../do/a7-standard-novelty-retrieval/FormDialog.vue';
|
import EditFormDia from '../do/a7-standard-novelty-retrieval/EditFormDia.vue';
|
|
export default {
|
name: 'a7-standard-novelty-retrieval',
|
// import 引入的组件需要注入到对象中才能使用
|
components: { FormDialog, TableCard, ZTTable, EditFormDia },
|
data() {
|
// 这里存放数据
|
return {
|
searchForm: {
|
year: '',
|
date: '',
|
},
|
options: [
|
{label: '上半年', value: '1'},
|
{label: '下半年', value: '2'},
|
],
|
tableColumn: [
|
{
|
label: '标准名称',
|
prop: 'methodName',
|
minWidth: '100'
|
},
|
{
|
label: '标准号',
|
prop: 'standardNo',
|
minWidth: '100'
|
},
|
{
|
label: '文件编号',
|
prop: 'fileNo',
|
minWidth: '100'
|
},
|
{
|
dataType: 'tag',
|
label: '是否是新标准',
|
prop: 'isNewStandard',
|
minWidth: '100',
|
formatData: (params) => {
|
if (params == 0) {
|
return '否';
|
} else if (params == 1) {
|
return '是';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 0) {
|
return 'danger';
|
} else if (params == 1) {
|
return 'success';
|
} else {
|
return null
|
}
|
}
|
},
|
{
|
label: '新标准名称',
|
prop: 'newMethodName',
|
minWidth: '100'
|
},
|
{
|
label: '新标准号',
|
prop: 'newStandardNo',
|
minWidth: '100'
|
},
|
{
|
dataType: 'tag',
|
label: '查询记录来源',
|
prop: 'searchNewSource',
|
minWidth: '100',
|
formatData: (params) => {
|
if (params == 0) {
|
return '标准网';
|
} else if (params == 1) {
|
return '委托情报';
|
} else if (params == 2) {
|
return '标准数';
|
} else if (params == 3) {
|
return '其他';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 0) {
|
return 'success';
|
} else if (params == 1) {
|
return 'danger';
|
} else if (params == 2) {
|
return 'warning';
|
} else if (params == 3) {
|
return 'info';
|
} else {
|
return null
|
}
|
}
|
},
|
{
|
dataType: 'tag',
|
label: '备注',
|
prop: 'remark',
|
minWidth: '100',
|
formatData: (params) => {
|
if (params == 0) {
|
return '作废';
|
} else if (params == 1) {
|
return '替换';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 0) {
|
return 'danger';
|
} else if (params == 1) {
|
return 'success';
|
} else {
|
return null
|
}
|
}
|
},
|
{
|
dataType: 'action',
|
minWidth: '50',
|
label: '操作',
|
operation: [
|
{
|
name: '编辑',
|
type: 'text',
|
clickFun: (row) => {
|
this.openEditFormDia(row);
|
},
|
}
|
]
|
}
|
],
|
tableData: [],
|
tableLoading: false,
|
page: {
|
size: 20,
|
current: 1,
|
},
|
total: 0,
|
oldTotal: 0,
|
oldPage: {
|
size: 20,
|
current: 1,
|
},
|
oldTableColumn: [
|
{
|
label: '标准名称',
|
prop: 'methodName',
|
minWidth: '100'
|
},
|
{
|
label: '标准号',
|
prop: 'standardNo',
|
minWidth: '100'
|
},
|
{
|
label: '文件编号',
|
prop: 'fileNo',
|
minWidth: '100'
|
},
|
{
|
dataType: 'tag',
|
label: '是否是新标准',
|
prop: 'isNewStandard',
|
minWidth: '100',
|
formatData: (params) => {
|
if (params == 0) {
|
return '否';
|
} else if (params == 1) {
|
return '是';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 0) {
|
return 'danger';
|
} else if (params == 1) {
|
return 'success';
|
} else {
|
return null
|
}
|
}
|
},
|
{
|
label: '新标准名称',
|
prop: 'newMethodName',
|
minWidth: '100'
|
},
|
{
|
label: '新标准号',
|
prop: 'newStandardNo',
|
minWidth: '100'
|
},
|
{
|
dataType: 'tag',
|
label: '查询记录来源',
|
prop: 'searchNewSource',
|
minWidth: '100',
|
formatData: (params) => {
|
if (params == 0) {
|
return '标准网';
|
} else if (params == 1) {
|
return '委托情报';
|
} else if (params == 2) {
|
return '标准数';
|
} else if (params == 3) {
|
return '其他';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 0) {
|
return 'success';
|
} else if (params == 1) {
|
return 'danger';
|
} else if (params == 2) {
|
return 'warning';
|
} else if (params == 3) {
|
return 'info';
|
} else {
|
return null
|
}
|
}
|
},
|
{
|
dataType: 'tag',
|
label: '备注',
|
prop: 'remark',
|
minWidth: '100',
|
formatData: (params) => {
|
if (params == 0) {
|
return '作废';
|
} else if (params == 1) {
|
return '替换';
|
} else {
|
return null
|
}
|
},
|
formatType: (params) => {
|
if (params == 0) {
|
return 'danger';
|
} else if (params == 1) {
|
return 'success';
|
} else {
|
return null
|
}
|
}
|
},
|
{
|
label: '创建时间',
|
prop: 'createTime',
|
minWidth: '100'
|
},
|
],
|
oldTableData: [],
|
oldTableLoading: false,
|
tabIndex: '0',
|
formDialog: false,
|
editFormDialog: false,
|
upLoading:false,
|
outLoading:false,
|
ratifyDialog:false,
|
ratifyInfo: {
|
writeUserId: '',
|
ratifyUserId: '',
|
},
|
userList: []
|
};
|
},
|
mounted() {
|
this.searchList()
|
},
|
// 方法集合
|
methods: {
|
// 查询列表
|
searchList () {
|
let beginDate = ''
|
let endDate = ''
|
const currentYear = new Date().getFullYear()
|
if (this.searchForm.year && this.searchForm.date) {
|
if (this.searchForm.date === '1') {
|
beginDate = this.searchForm.year + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = this.searchForm.year + '-' + '06-30' + ' ' + '23:59:59'
|
} else {
|
beginDate = this.searchForm.year + '-' + '07-01' + ' ' + '00:00:00'
|
endDate = this.searchForm.year + '-' + '12-31' + ' ' + '23:59:59'
|
}
|
} else if (!this.searchForm.year && this.searchForm.date) {
|
if (this.searchForm.date === '1') {
|
beginDate = currentYear + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = currentYear + '-' + '06-30' + ' ' + '23:59:59'
|
} else {
|
beginDate = currentYear + '-' + '07-01' + ' ' + '00:00:00'
|
endDate = currentYear + '-' + '12-31' + ' ' + '23:59:59'
|
}
|
} else if (this.searchForm.year && !this.searchForm.date) {
|
beginDate = this.searchForm.year + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = this.searchForm.year + '-' + '12-31' + ' ' + '23:59:59'
|
}
|
const entity = {
|
beginDate: beginDate,
|
endDate: endDate,
|
}
|
this.tableLoading = true
|
this.oldTableLoading = true
|
const page = this.tabIndex === '0' ? this.page : this.oldPage
|
this.$axios.post(this.$api.processMethodSearchNew.pageMethodSearchNew, {entity, page}, {
|
headers: {
|
"Content-Type": "application/json"
|
},
|
noQs: true
|
}).then(res => {
|
this.tableLoading = false
|
this.oldTableLoading = false
|
if (res.code === 201) return
|
if (this.tabIndex === '0') {
|
this.tableData = res.data.records
|
this.total = res.data.total
|
} else {
|
this.oldTableData = res.data.records
|
this.oldTotal = res.data.total
|
}
|
}).catch(err => {
|
console.log('err---', err);
|
this.tableLoading = false
|
this.oldTableLoading = false
|
})
|
},
|
// 重置查询条件
|
resetSearchForm () {
|
this.searchForm.year = '';
|
this.searchForm.date = '';
|
this.searchList()
|
},
|
// 操作新增框
|
openFormDia (row) {
|
this.formDialog = true
|
this.$nextTick(() => {
|
this.$refs.formDialog.openDia(row)
|
})
|
},
|
// 关闭新增弹框
|
closeDia () {
|
this.formDialog = false
|
this.searchList()
|
},
|
// 打开修改弹框
|
openEditFormDia (row) {
|
this.editFormDialog = true
|
this.$nextTick(() => {
|
this.$refs.editFormDialog.openDia(row)
|
})
|
},
|
//
|
closeEditDia () {
|
this.editFormDialog = false
|
this.searchList()
|
},
|
// 打开导出弹框选择编制人、批准人
|
openHandleOut () {
|
this.ratifyDialog = true
|
this.getUserList()
|
},
|
// 导出
|
handleOut () {
|
let beginDate = ''
|
let endDate = ''
|
const currentYear = new Date().getFullYear()
|
if (this.searchForm.year && this.searchForm.date) {
|
if (this.searchForm.date === '1') {
|
beginDate = this.searchForm.year + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = this.searchForm.year + '-' + '06-30' + ' ' + '23:59:59'
|
} else {
|
beginDate = this.searchForm.year + '-' + '07-01' + ' ' + '00:00:00'
|
endDate = this.searchForm.year + '-' + '12-31' + ' ' + '23:59:59'
|
}
|
} else if (!this.searchForm.year && this.searchForm.date) {
|
if (this.searchForm.date === '1') {
|
beginDate = currentYear + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = currentYear + '-' + '06-30' + ' ' + '23:59:59'
|
} else {
|
beginDate = currentYear + '-' + '07-01' + ' ' + '00:00:00'
|
endDate = currentYear + '-' + '12-31' + ' ' + '23:59:59'
|
}
|
} else if (this.searchForm.year && !this.searchForm.date) {
|
beginDate = this.searchForm.year + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = this.searchForm.year + '-' + '12-31' + ' ' + '23:59:59'
|
}
|
const entity = {
|
beginDate: beginDate,
|
endDate: endDate,
|
writeUserId: this.ratifyInfo.writeUserId,
|
ratifyUserId: this.ratifyInfo.ratifyUserId,
|
}
|
this.outLoading = true
|
this.$axios.post(this.$api.processMethodSearchNew.exportMethodSearchNew,{
|
entity:entity
|
},{
|
headers: {
|
'Content-Type': 'application/json'
|
},
|
noQs: true,responseType: "blob"}).then(res => {
|
this.outLoading = false
|
this.$message.success('导出成功')
|
const blob = new Blob([res],{ type: 'application/octet-stream' });
|
const url = URL.createObjectURL(blob);
|
const link = document.createElement('a');
|
link.href = url;
|
link.download = '标准查新导出.xlsx';
|
link.click();
|
})
|
},
|
// 导入
|
beforeUpload(file) {
|
if (file.size > 1024 * 1024 * 10) {
|
this.$message.error('上传文件不超过10M');
|
this.$refs.upload.clearFiles()
|
return false;
|
} else {
|
this.upLoading = true;
|
return true;
|
}
|
},
|
onError(err, file, fileList) {
|
this.$message.error('上传失败')
|
this.$refs.upload.clearFiles()
|
},
|
handleSuccessUp(response) {
|
this.upLoading = false;
|
if (response.code == 200) {
|
this.$message.success('上传成功');
|
this.searchList()
|
}
|
},
|
// 分页
|
handleSizeChange(val) {
|
this.page.size = val;
|
this.searchList();
|
},
|
handleCurrentChange(val) {
|
this.page.current = val;
|
this.searchList();
|
},
|
//
|
// 分页
|
handleOldSizeChange(val) {
|
this.oldPage.size = val;
|
this.searchList();
|
},
|
handleOldCurrentChange(val) {
|
this.oldPage.current = val;
|
this.searchList();
|
},
|
//
|
getUserList(){
|
this.$axios.post(this.$api.user.selectUserList, {
|
page: {current: -1, size: -1,},
|
entity: {name: null}
|
}, {
|
headers: {
|
'Content-Type': 'application/json'
|
}
|
}).then(res => {
|
if (res.code === 201) {
|
return
|
}
|
this.userList = res.data.body.records
|
})
|
},
|
},
|
// 用于上传文件的信息
|
computed: {
|
headers() {
|
return {
|
'token': sessionStorage.getItem('token')
|
}
|
},
|
action() {
|
return this.javaApi + this.$api.processMethodSearchNew.importMethodSearchNew
|
}
|
},
|
};
|
</script>
|
|
<style scoped>
|
.view-title {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
height: 60px;
|
padding-left: 20px;
|
}
|
.search-background {
|
width: 100%;
|
height: 80px;
|
line-height: 80px;
|
background-color: #ffffff;
|
display: flex;
|
}
|
.search-group {
|
display: flex;
|
align-items: center;
|
margin: 0 20px;
|
}
|
.table {
|
margin-top: 20px;
|
background-color: #ffffff;
|
padding-top: 10px;
|
}
|
.table-tab {
|
margin: 0 10px 10px 14px;
|
}
|
.inline-upload {
|
display: inline-block;
|
vertical-align: middle;
|
}
|
</style>
|