<template>
|
<div>
|
<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 class="btn">
|
<el-button size="medium" type="primary" @click="openHandleOut">导 出</el-button>
|
<el-upload ref='upload' :action="action" :before-upload="beforeUpload" :headers="uploadHeader"
|
: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>
|
</div>
|
</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>
|
<limsTable :column="tableColumn" :height="'calc(100vh - 22em)'" :table-data="tableData"
|
:table-loading="tableLoading" style="padding: 0 15px;margin-bottom: 16px" :page="page"
|
@pagination="pagination">
|
</limsTable>
|
</template>
|
</TableCard>
|
</div>
|
<div v-if="tabIndex === '1'">
|
<TableCard :showForm="false" :showTitle="false">
|
<template v-slot:table>
|
<limsTable :column="oldTableColumn" :height="'calc(100vh - 23em)'" :table-data="oldTableData"
|
:table-loading="oldTableLoading" style="padding: 0 15px;margin-bottom: 16px" :page="oldPage"
|
@pagination="oldPagination">
|
</limsTable>
|
</template>
|
</TableCard>
|
</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-date-picker v-model="ratifyInfo.writeDate" format="yyyy-MM-dd" placeholder="选择日期" size="small"
|
style="width:100%" type="date" value-format="yyyy-MM-dd">
|
</el-date-picker>
|
</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>批准日期:
|
<el-date-picker v-model="ratifyInfo.ratifyDate" format="yyyy-MM-dd" placeholder="选择日期" size="small"
|
style="width:100%" type="date" value-format="yyyy-MM-dd">
|
</el-date-picker>
|
</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 limsTable from "@/components/Table/lims-table.vue";
|
import TableCard from '@/components/TableCard/index.vue';
|
import FormDialog from './components/FormDialog.vue';
|
import EditFormDia from './components/EditFormDia.vue';
|
import { selectUserCondition } from "@/api/system/user";
|
import {
|
pageMethodSearchNew,
|
deleteById,
|
exportMethodSearchNew,
|
} from '@/api/cnas/process/method/standardNoveltyRetrieval.js'
|
export default {
|
name: 'a7-standard-novelty-retrieval',
|
// import 引入的组件需要注入到对象中才能使用
|
components: { FormDialog, TableCard, limsTable, 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
|
}
|
}
|
},
|
{
|
label: '创建时间',
|
prop: 'createTime',
|
minWidth: '100'
|
},
|
{
|
dataType: 'action',
|
minWidth: '80',
|
label: '操作',
|
operation: [
|
{
|
name: '编辑',
|
type: 'text',
|
clickFun: (row) => {
|
this.openEditFormDia(row);
|
},
|
},
|
{
|
name: '删除',
|
type: 'text',
|
color: '#f56c6c',
|
clickFun: (row) => {
|
this.delete(row)
|
},
|
}
|
]
|
}
|
],
|
tableData: [],
|
tableLoading: false,
|
page: {
|
size: 20,
|
current: 1,
|
total: 0,
|
},
|
total: 0,
|
oldTotal: 0,
|
oldPage: {
|
size: 20,
|
current: 1,
|
total: 0,
|
},
|
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: '',
|
writeDate: '',
|
ratifyDate: '',
|
},
|
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'
|
}
|
if (this.tabIndex === '0' && !this.searchForm.date) {
|
beginDate = currentYear + '-' + '01-01' + ' ' + '00:00:00'
|
endDate = currentYear + '-' + '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
|
pageMethodSearchNew({ ...entity, ...page }).then(res => {
|
this.tableLoading = false
|
this.oldTableLoading = false
|
if (res.code === 201) return
|
if (this.tabIndex === '0') {
|
this.tableData = res.data.records
|
this.page.total = res.data.total
|
} else {
|
this.oldTableData = res.data.records
|
this.oldPage.total = 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()
|
},
|
delete(row) {
|
this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteById({ methodSearchNewId: row.methodSearchNewId }).then(res => {
|
if (res.code == 200) {
|
this.$message.success('删除成功')
|
this.searchList()
|
}
|
})
|
}).catch(() => {
|
});
|
},
|
// 打开导出弹框选择编制人、批准人
|
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,
|
writeDate: this.ratifyInfo.writeDate,
|
ratifyDate: this.ratifyInfo.ratifyDate,
|
}
|
this.outLoading = true
|
exportMethodSearchNew(entity).then(res => {
|
this.outLoading = false
|
this.ratifyDialog = true;
|
const blob = new Blob([res], { type: 'application/octet-stream' });
|
this.$download.saveAs(blob, '标准查新导出.xlsx')
|
})
|
},
|
// 导入
|
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()
|
}
|
},
|
// 分页
|
pagination({ page, limit }) {
|
this.page.current = page;
|
this.page.size = limit;
|
this.searchList();
|
},
|
// 分页
|
oldPagination({ page, limit }) {
|
this.oldPage.current = page;
|
this.oldPage.size = limit;
|
this.searchList();
|
},
|
//
|
getUserList() {
|
selectUserCondition().then(res => {
|
if (res.code === 201) {
|
return
|
}
|
this.userList = res.data
|
})
|
},
|
},
|
// 用于上传文件的信息
|
computed: {
|
action() {
|
return this.javaApi + '/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;
|
position: relative;
|
}
|
|
.table {
|
background-color: #ffffff;
|
padding-top: 10px;
|
}
|
|
.table-tab {
|
margin: 0 10px 10px 14px;
|
}
|
|
.inline-upload {
|
display: inline-block;
|
vertical-align: middle;
|
}
|
|
.btn {
|
position: absolute;
|
top: 16px;
|
right: 20px;
|
}
|
</style>
|