Commit 5b15e252 authored by liangjingpeng's avatar liangjingpeng

kk

parent 5ec0999a
......@@ -53,7 +53,12 @@
</td>
<th style="border: 1px solid black; width: 200px;">填表日期</th>
<td style="border: 1px solid black;">
<el-input v-model="ruleForm.name" style="width: 200px; margin: 0 10px" />
<!-- <el-input v-model="ruleForm.name" style="width: 200px; margin: 0 10px" />-->
<el-date-picker
v-model="value1"
type="date"
placeholder="选择日期">
</el-date-picker>
</td>
</tr>
<tr>
......@@ -330,8 +335,9 @@
</tr>
</table>
<div style="margin: 10px; text-align: center;">
<el-button type="primary">临时保存</el-button>
<el-button type="primary">提交立项申请</el-button>
<el-button v-if="showBtn" type="primary" @click="temporarySaving">临时保存</el-button>
<el-button v-if="showBtn" type="primary" @click="submitRequest">提交立项申请</el-button>
<el-button v-else type="primary" @click="quashRequest">撤销申请</el-button>
</div>
</div>
</el-tab-pane>
......@@ -360,8 +366,10 @@ export default {
return {
checked: false,
showForm: false,
showBtn: true,
implementationPlan: '',
content: '',
value1: '',
formData: {
name: '',
age: '',
......@@ -421,6 +429,48 @@ export default {
},
goBack() {
this.$router.go(-1)
},
temporarySaving() {
this.$message({
message: '临时保存成功',
type: 'success'
})
},
submitRequest() {
this.$confirm('是否提交立项申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '立项申请提交成功!'
})
this.showBtn = false
}).catch(() => {
this.$message({
type: 'info',
message: '已取消提交立项申请'
})
})
},
quashRequest() {
this.$confirm('是否撤销立项申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '撤销立项申请成功!'
})
this.showBtn = true
}).catch(() => {
this.$message({
type: 'info',
message: '撤销取消立项申请成功!'
})
})
}
}
......
<template>
<div>课题列表</div>
<div class="app-container">
<div v-if="themeType === '8'" class="tableTitle">评审课题</div>
<!-- <div class="search">-->
<div>
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="关键字" prop="labelName">
<el-input
v-model="queryParams.labelName"
placeholder="请输入标签名称"
clearable
:maxlength="255"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="标签分类" prop="labelType">
<el-select v-model="queryParams.labelType" placeholder="请选择标签分类" clearable size="small">
<el-option
v-for="dict in sortOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="flag">
<el-select v-model="queryParams.flag" placeholder="请选择状态" clearable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<div style="float: right">
<el-form-item>
<el-button
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
:size="commonField.smallSize"
@click="handleQuery"
>查询
</el-button>
<el-button
:class="commonField.resetClass"
:type="commonField.typePrimary"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery"
>重置
</el-button>
<el-button
:class="commonField.addClass"
:type="commonField.typePrimary"
:icon="commonField.addIcon"
:size="commonField.smallSize"
@click="handleAdd"
>新增
</el-button>
<!-- //导入按钮-->
<!-- TODO 标签管理去掉: v-hasPermi="hasImportPerm" -->
<el-button
:class="commonField.importClass"
:type="commonField.typeWarning"
:icon="commonField.importIcon"
:size="commonField.smallSize"
@click="handleImport"
>{{
commonField.importName
}}
</el-button>
<el-button
:class="commonField.exportClass"
:type="commonField.typePrimary"
:icon="commonField.exportIcon"
:size="commonField.smallSize"
@click="handleExport"
>导出
</el-button>
</el-form-item>
</div>
</el-form>
</div>
<div style="padding:5px 10px">
<div v-if="themeType !== '8'" class="tableTitle">标签管理列表</div>
<el-table v-loading="loading" border :data="resLabelInfoList">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column label="课题号" prop="createDate" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}
</template>
</el-table-column>
<el-table-column label="课题名称" prop="labelName" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.labelName || '-' }}
</template>
</el-table-column>
<el-table-column width="120" label="申报分类" prop="labelType" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.labelTypeName || '-' }}
</template>
</el-table-column>
<el-table-column width="120" label="权重" prop="weight" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.weight || '-' }}
</template>
</el-table-column>
<el-table-column width="80" label="状态" prop="flag">
<template slot-scope="scope">
<el-switch
v-model="scope.row.flag"
class="switchDisabledStyle"
inactive-value="0"
active-value="1"
@click.native="handleStatusChange(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.remarks || '-' }}
</template>
</el-table-column>
<el-table-column label="创建时间" width="160" prop="createDate" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="100px">
<template slot-scope="scope">
<el-button
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
:class="commonField.delClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- 添加或修改标签信息配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="标签名称" prop="labelName">
<el-input v-model.trim="form.labelName" show-word-limit :maxlength="50" placeholder="请输入标签名称"/>
</el-form-item>
<el-form-item label="标签分类" prop="labelType">
<el-radio-group v-model="form.labelType">
<el-radio label="1" :checked="form.labelType === '1'">模板</el-radio>
<el-radio label="2">镜像</el-radio>
<el-radio label="3">数据集</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="权重" prop="weight">
<el-input-number v-model="form.weight" style="width: 100%" controls-position="right" :min="0"/>
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.flag">
<el-radio label="1">启用</el-radio>
<el-radio label="0">停用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model.trim="form.remarks" maxlength="200" show-word-limit type="textarea"
placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="cancel">取 消</el-button>
<el-button class="submitBtn" type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
<!-- 标签导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:on-change="employeeUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-preview="handlePreview"
:before-upload="beforeAvatarUpload"
:file-list="fileList"
drag
>
<i class="el-icon-upload"/>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
</div>
<div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="upload.open = false">取 消</el-button>
<el-button class="submitBtn" :loading="importLoading" type="primary" @click="submitFileForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script setup>
<script>
import {
// listResLabelInfo,
getResLabelInfo,
delResLabelInfo,
addResLabelInfo,
updateResLabelInfo,
exportResLabelInfo,
importExcel,
uploadFalseFile,
importTemplate
} from '@/api/resLabelInfo'
import {listResLabelInfo} from './reviewExperts'
import {getDataCache, setDataCache} from '@/assets/js/filterData'
import commonField from '@/utils/commonField'
import {getToken} from '@/utils/auth'
export default {
name: 'ResLabelInfo',
data() {
return {
// 权限
// hasImportPerm: [''],
// 遮罩层
loading: true,
// 总条数
total: 0,
// 导入列表
fileList: [],
importLoading: false,
// 标签信息表格数据
resLabelInfoList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 状态菜单
statusOptions: [
{
dictLabel: '启用',
dictValue: '1'
},
{
dictLabel: '停用',
dictValue: '0'
}
],
sortOptions: [
{
dictLabel: '模板',
dictValue: '1'
},
{
dictLabel: '镜像',
dictValue: '2'
},
{
dictLabel: '数据集',
dictValue: '3'
}
],
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: '',
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: {Authorization: 'Bearer ' + getToken()},
// 上传的地址
url: process.env.VUE_APP_BASE_API + '/resLabeLInfo/importExcel'
},
// 查询参数
queryParams: {
page: 1,
rows: 10,
labelName: undefined,
labelType: undefined,
weight: undefined,
flag: ''
},
// 表单参数
form: {},
// 表单校验
rules: {
labelName: [
{required: true, message: '标签名称不能为空', trigger: 'blur'}
],
labelType: [
{required: true, message: '标签分类不能为空', trigger: 'blur'}
],
weight: [
{required: true, message: '权重不能为空', trigger: 'blur'}
]
}
}
},
computed: {
themeType() {
return localStorage.getItem('theme')
},
commonField() {
return commonField
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
setDataCache(this.$route.path, this.queryParams)
next()
},
created() {
this.queryParams = JSON.parse(getDataCache(this.$route.path))
this.getList() // 列表查询
},
methods: {
/** 查询标签信息列表 */
getList() {
this.loading = true
listResLabelInfo(this.queryParams).then(
response => {
this.resLabelInfoList = response.rows
this.total = Number(response.total)
this.loading = false
this.resLabelInfoList.forEach(item => {
item.labelTypeName = this.sortOptions.find(item1 => item1.dictValue === item.labelType).dictLabel
})
console.log('resLabelInfoList', this.resLabelInfoList)
}
)
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
businessId: undefined,
remarks: undefined,
labelName: undefined,
labelType: '1',
weight: undefined,
flag: '1'
}
this.resetForm('form')
},
/** 查询按钮操作 */
handleQuery() {
this.queryParams.page = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
labelName: undefined,
labelType: undefined,
weight: undefined,
flag: ''
}
this.handleQuery()
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '新增标签信息'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.businessId
getResLabelInfo(id).then(response => {
this.form = response.data
this.open = true
this.title = '修改标签信息'
})
},
// 改变状态
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return updateResLabelInfo(row)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function () {
row.flag = row.flag === '0' ? '1' : '0'
})
},
/** 提交按钮 */
submitForm: function () {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
updateResLabelInfo(this.form).then(response => {
this.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addResLabelInfo(this.form).then(response => {
this.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.businessId
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return delResLabelInfo(id)
}).then(() => {
this.getList()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(function () {
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
return exportResLabelInfo(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '标签管理信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
})
})
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = '标签导入'
this.upload.open = true
},
/** 下载模板操作 */
importTemplate() {
// eslint-disable-next-line no-undef
importTemplate().then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '标签导入模板' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert(response.msg, '导入结果', {dangerouslyUseHTMLString: true})
this.getList()
},
// 提交上传文件
submitFileForm() {
// this.$refs.upload.submit()
this.importLoading = true
const that = this
if (this.fileList.length === 0) {
this.$message.warning('请上传文件')
// 导入成功后关闭弹出框
this.importLoading = false
this.upload.open = true
} else { // 根据后台需求数据格式
var formData = new FormData() // 当前为空
formData.append('file', this.fileList)
importExcel(formData).then(res => {
if (res.code === 200) {
if (res.data.filename === null) {
this.$message.success('导入成功')
this.fileList = []
// 导入成功后关闭弹出框
this.importLoading = false
this.upload.open = false
// 导入成功后刷新页面
this.getList()
} else {
uploadFalseFile({fileName: res.data.filename}).then(res => {
const blob = new Blob([res])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) // 创建下载的链接
downloadElement.href = href
downloadElement.download = '模板错误提示' + '.txt' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click() // 点击下载
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
this.importLoading = false
})
}
this.importLoading = false
} else if (res.code === 41020) {
this.$message.info('上传超时,请重新上传')
this.importLoading = false
} else {
this.$message.error(res.message)
this.importLoading = false
}
}).catch(() => {
// this.$message.error(err.message)
that.importLoading = false
})
}
},
beforeAvatarUpload(file) {
console.log('file', file)
},
/** 导入change*/
employeeUpload(file, fileList) {
if (fileList.length > 1) {
fileList.splice(0, 1)
}
this.fileList = fileList[0].raw
},
/** 导入remove操作*/
handleRemove(file, fileList) {
this.fileList = []
},
/** 导入beforeRemove操作*/
beforeRemove(file, fileList) {
this.fileList = []
},
/* 上传文件所需求 */
handlePreview(file) {
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
font-size: 18px;
padding: 0;
<style scoped lang="scss">
.placeholder {
height: 1.3vh;
background-color: #F4F4F4;
margin-bottom: 10px
}
}
</style>
import request from '@/utils/request'
import Qs from 'qs'
/**
* 1. 列表查询
* 2. 查询详细信息
* 3. 新增
* 4. 修改
* 5. 逻辑删除
* 6. 导出
* 7、导入标签信息
* 8.下载错误文件
* -------------------------
* 9.下载用户导入模板
*/
// 1. 查询标签信息列表
export function listResLabelInfo(query) {
return request({
url: '/reslabelinfo/list',
method: 'get',
params: query
})
}
//
// export function listResLabelInfoAll(query) {
// return request({
// url: '/reslabelinfo/listAll',
// method: 'get',
// params: query
// })
// }
//
// // 2. 查询标签信息详细信息
// export function getResLabelInfo(businessId) {
// return request({
// url: '/reslabelinfo/detail/' + businessId,
// method: 'get'
// })
// }
//
// // 3. 新增标签信息
// export function addResLabelInfo(data) {
// data = Qs.stringify(data)
// return request({
// url: '/reslabelinfo/add',
// method: 'post',
// data: data
// })
// }
//
// // 4. 修改标签信息
// export function updateResLabelInfo(data) {
// const businessId = data.businessId
// data = Qs.stringify(data)
// return request({
// url: '/reslabelinfo/update/' + businessId,
// method: 'put',
// data
// })
// }
//
// // 5. 逻辑删除标签信息
// export function delResLabelInfo(businessId) {
// return request({
// url: '/reslabelinfo/deleteLogical/' + businessId,
// method: 'delete'
// })
// }
//
// // 6. 导出标签信息
// export function exportResLabelInfo(query) {
// return request({
// url: '/reslabelinfo/export',
// method: 'get',
// params: query,
// responseType: 'blob'
// })
// }
//
// // 7、导入标签信息
// export function importExcel(data) {
// return request({
// url: '/reslabelinfo/importExcel',
// method: 'post',
// headers: {
// 'Content-Type': 'multipart/form-data'
// },
// transformRequest: [(data) => {
// return data
// }],
// data
// })
// }
// // 8.下载错误文件
// export function uploadFalseFile(params) {
// params = Qs.stringify(params)
// return request({
// url: '/reslabelinfo/downFalseFile',
// method: 'post',
// data: params,
// responseType: 'blob'
// })
// }
// // 9.下载用户导入模板
// export function importTemplate(params) {
// return request({
// url: '/reslabelinfo/importTemplate',
// method: 'get',
// responseType: 'blob',
// params
// })
// }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment