安全须知管理页面
This commit is contained in:
parent
ccbd69f20f
commit
f69dfa6585
|
|
@ -460,3 +460,53 @@ export function getImpFunctionListPageApi(data) {
|
|||
params:data
|
||||
})
|
||||
}
|
||||
|
||||
// 安全须知-列表
|
||||
export function getRuleListApi(data) {
|
||||
return request({
|
||||
url: '/certificate/certificate_system/certificateInfo/getRuleList',
|
||||
method: 'get',
|
||||
headers: {
|
||||
//"merchant-id":"378915229716713472",
|
||||
},
|
||||
params:data
|
||||
})
|
||||
}
|
||||
|
||||
// 安全须知-新增
|
||||
export function insertRuleApi(data) {
|
||||
return request({
|
||||
url: '/certificate/certificate_system/certificateInfo/insertRule',
|
||||
method: 'post',
|
||||
headers: {
|
||||
//"merchant-id":"378915229716713472",
|
||||
},
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 安全须知-更新
|
||||
export function updateRuleApi(data) {
|
||||
return request({
|
||||
url: '/certificate/certificate_system/certificateInfo/updateRule',
|
||||
method: 'post',
|
||||
headers: {
|
||||
//"merchant-id":"378915229716713472",
|
||||
},
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
// 安全须知-更新状态
|
||||
export function updateRuleStateApi(data) {
|
||||
return request({
|
||||
url: '/certificate/certificate_system/certificateInfo/updateRuleState',
|
||||
method: 'post',
|
||||
headers: {
|
||||
//"merchant-id":"378915229716713472",
|
||||
},
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,20 +36,26 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="标题" align="center" prop="title" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="内容" align="center" prop="content" :show-overflow-tooltip="true"/>
|
||||
<!-- <el-table-column label="是否启用" align="center" prop="state" :show-overflow-tooltip="true">
|
||||
<el-table-column label="是否启用" align="center" prop="state" :show-overflow-tooltip="true" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.state==1">是</span>
|
||||
<span v-if="scope.row.state==2">否</span>
|
||||
<span v-if="scope.row.state==1" style="font-size: 18px;color: rgb(3, 223, 109);">是</span>
|
||||
<span v-if="scope.row.state==0" style="font-size: 18px;color: red;">否</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true">
|
||||
</el-table-column>
|
||||
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.fileUrl!=''" @click="checkFile(scope.row)" style="cursor: pointer;color: #46a6ff;">查看</span>
|
||||
<span v-if="scope.row.fileUrl!=''" @click="downloadFile(scope.row)" style="cursor: pointer;color: #46a6ff;">{{scope.row.fileName}}</span>
|
||||
<span v-else>无附件</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true" width="150"/>
|
||||
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text" v-if="scope.row.state==0"
|
||||
@click="handleOpen(scope.row)"
|
||||
>开启</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -81,8 +87,8 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" >
|
||||
<el-form-item label="使用类型" prop="useType">
|
||||
<el-radio-group v-model="baseForm.useType">
|
||||
<el-form-item label="使用类型" prop="type">
|
||||
<el-radio-group v-model="baseForm.type">
|
||||
<el-radio label="1">文本内容</el-radio>
|
||||
<el-radio label="2">附件内容</el-radio>
|
||||
</el-radio-group>
|
||||
|
|
@ -122,28 +128,12 @@
|
|||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="附件列表" :visible.sync="openFile" width="500px" append-to-body>
|
||||
<div style="width: 100%;height: 240px;padding: 10px;color: #46a6ff;display: flex;flex-wrap: wrap;">
|
||||
<div v-for="(item,index) in fileList" :key="index" style="margin: 10px;">
|
||||
<div style="margin-bottom: 10px;"><img :src="item.url" @click="handlePictureCardPreview(item)" style="width: 60px;height: 60px;margin-right: 8px;"/></div>
|
||||
<div style="cursor: pointer;" @click="handlePreviewDownloadFile(item)">{{ item.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="openFile=false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :visible.sync="dialogVisible" width="700px">
|
||||
<img style="width: 100%;height: 100%;" :src="dialogImageUrl" alt="">
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCertificateApplyListPageApi,addCertificateApplyApi, editCertificateApplyApi,
|
||||
delCertificateApplyApi,revokeCertificateApplyApi } from "@/api/certificateManage/index";
|
||||
import { getRuleListApi,insertRuleApi, updateRuleApi,
|
||||
delCertificateApplyApi,updateRuleStateApi } from "@/api/certificateManage/index";
|
||||
import base64 from 'base-64';
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { downloadFileByUrl } from '@/utils/download'
|
||||
|
|
@ -181,7 +171,7 @@
|
|||
// 表单参数
|
||||
baseForm: {
|
||||
title:"",
|
||||
useType:"1",
|
||||
type:"1",
|
||||
content:""
|
||||
},
|
||||
// 表单校验
|
||||
|
|
@ -189,7 +179,7 @@
|
|||
title: [
|
||||
{ required: true, message: "标题不能为空", trigger: "change" }
|
||||
],
|
||||
useType: [
|
||||
type: [
|
||||
{ required: true, message: "使用类型不能为空", trigger: "change" }
|
||||
],
|
||||
content: [
|
||||
|
|
@ -206,8 +196,8 @@
|
|||
url: process.env.VUE_APP_BASE_API + '/file/upload?type=file',
|
||||
},
|
||||
fileList:[],
|
||||
fileUrls:[],
|
||||
fileNames:[],
|
||||
fileUrl:[],
|
||||
fileName:[],
|
||||
openFile:false,//查看附件
|
||||
dialogVisible:false,//图片弹窗
|
||||
dialogImageUrl:"",//图片弹窗
|
||||
|
|
@ -229,26 +219,26 @@
|
|||
},
|
||||
/** 查询列表 */
|
||||
getList() {
|
||||
// this.loading = true;
|
||||
// let param = {
|
||||
// "pageNum":this.queryParams.pageNum,
|
||||
// "pageSize":this.queryParams.pageSize,
|
||||
// "keyWord":this.queryParams.keyWord,
|
||||
// }
|
||||
// getCertificateApplyListPageApi(param).then(response => {
|
||||
// this.tableListData = response.rows;
|
||||
// this.total = Number(response.total);
|
||||
this.loading = true;
|
||||
let param = {
|
||||
"pageNum":this.queryParams.pageNum,
|
||||
"pageSize":this.queryParams.pageSize,
|
||||
"keyWord":this.queryParams.keyWord,
|
||||
}
|
||||
getRuleListApi(param).then(response => {
|
||||
this.tableListData = response.rows;
|
||||
this.total = Number(response.total);
|
||||
this.loading = false;
|
||||
// });
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.fileList=[]
|
||||
this.fileUrls=[]
|
||||
this.fileNames = []
|
||||
this.fileUrl=[]
|
||||
this.fileName = []
|
||||
this.baseForm = {
|
||||
title:"",
|
||||
useType:"1",
|
||||
type:"1",
|
||||
content:""
|
||||
};
|
||||
this.resetForm("baseForm");
|
||||
|
|
@ -265,39 +255,32 @@
|
|||
this.reset();
|
||||
this.open = true;
|
||||
this.baseForm = Object.assign({}, row)
|
||||
this.fileList=[]
|
||||
this.fileUrl=[]
|
||||
this.fileName = []
|
||||
if(row.fileUrl&&row.fileUrl!=''){
|
||||
let arr = row.fileUrl.split(",");
|
||||
let arr2 = row.fileName.split(",");
|
||||
arr.forEach((item,index)=>{
|
||||
this.fileList.push({url:item,name:arr2[index]})
|
||||
this.fileUrls.push(item)
|
||||
this.fileNames.push(arr2[index])
|
||||
})
|
||||
}else{
|
||||
this.fileList=[]
|
||||
this.fileUrls=[]
|
||||
this.fileNames = []
|
||||
this.fileList.push({url:row.fileUrl,name:row.fileName})
|
||||
this.fileUrl.push(row.fileUrl)
|
||||
this.fileName.push(row.fileName)
|
||||
}
|
||||
this.title = "修改";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function(type) {
|
||||
//applyState -1 仅保存不提交 0保存提交
|
||||
this.baseForm.applyState = type;
|
||||
//fileUrls 附件 数组
|
||||
this.baseForm.fileUrls = this.fileUrls
|
||||
this.baseForm.fileNames = this.fileNames
|
||||
submitForm: function() {
|
||||
//fileUrl 附件 数组
|
||||
this.baseForm.fileUrl = this.fileUrl[0]||""
|
||||
this.baseForm.fileName = this.fileName[0]||""
|
||||
console.log("this.baseForm",this.baseForm);
|
||||
this.$refs["baseForm"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.baseForm.checkId != undefined) {
|
||||
editCertificateApplyApi(this.baseForm).then(response => {
|
||||
if (this.baseForm.id != undefined) {
|
||||
updateRuleApi(this.baseForm).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCertificateApplyApi(this.baseForm).then(response => {
|
||||
insertRuleApi(this.baseForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
|
@ -311,13 +294,13 @@
|
|||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 撤销
|
||||
handleRevoke(row) {
|
||||
this.$modal.confirm('是否确认撤销申请?').then(() => {
|
||||
revokeCertificateApplyApi({checkId:row.checkId}).then(response => {
|
||||
console.log("revokeCertificateApplyApi",response);
|
||||
// 开启
|
||||
handleOpen(row) {
|
||||
this.$modal.confirm('是否确认开启该规则?').then(() => {
|
||||
updateRuleStateApi({id:row.id,state:1}).then(response => {
|
||||
console.log("updateRuleStateApi",response);
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("撤销成功");
|
||||
this.$modal.msgSuccess("开启成功");
|
||||
return;
|
||||
});
|
||||
}).catch(() => {});
|
||||
|
|
@ -341,8 +324,8 @@
|
|||
handleFileSuccess(response, file, fileList) {
|
||||
this.upload.isUploading = false;
|
||||
if(response.code==200){
|
||||
this.fileUrls.push(response.data.url)
|
||||
this.fileNames.push(response.data.name)
|
||||
this.fileUrl.push(response.data.url)
|
||||
this.fileName.push(response.data.name)
|
||||
this.$modal.msgSuccess(response.msg);
|
||||
}else{
|
||||
this.$modal.msgError(response.msg);
|
||||
|
|
@ -350,13 +333,13 @@
|
|||
},
|
||||
handleRemove(file, fileList) {
|
||||
let sum = 0
|
||||
this.fileNames.forEach((item, index) => {
|
||||
this.fileName.forEach((item, index) => {
|
||||
if (item == file.name) {
|
||||
sum = index
|
||||
}
|
||||
})
|
||||
this.fileUrls.splice(sum, 1)
|
||||
this.fileNames.splice(sum, 1)
|
||||
this.fileUrl.splice(sum, 1)
|
||||
this.fileName.splice(sum, 1)
|
||||
},
|
||||
async handlePreviewDownloadFile(file) {
|
||||
if (file.url != null && file.url !== '') {
|
||||
|
|
@ -388,25 +371,35 @@
|
|||
document.body.removeChild(link); // 下载后移除 <a> 元素
|
||||
}
|
||||
},
|
||||
checkFile(row){
|
||||
this.fileList=[]
|
||||
this.fileUrls=[]
|
||||
this.fileNames = []
|
||||
if(row.fileUrl&&row.fileUrl!=''){
|
||||
let arr = row.fileUrl.split(",");
|
||||
let arr2 = row.fileName.split(",");
|
||||
arr.forEach((item,index)=>{
|
||||
this.fileList.push({url:item,name:arr2[index]})
|
||||
this.fileUrls.push(item)
|
||||
this.fileNames.push(arr2[index])
|
||||
})
|
||||
async downloadFile(file) {
|
||||
if (file.fileUrl != null && file.fileUrl !== '') {
|
||||
let downloadUrl = file.fileUrl;
|
||||
try {
|
||||
const response = await fetch(downloadUrl); // 获取文件内容
|
||||
if (!response.ok) {
|
||||
throw new Error('文件下载失败');
|
||||
}
|
||||
const blob = await response.blob(); // 将文件内容转换为 Blob 对象
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob); // 创建一个 URL 对象
|
||||
link.download = file.fileName; // 指定下载的文件名
|
||||
document.body.appendChild(link); // 将链接添加到 DOM 中
|
||||
link.click(); // 触发下载
|
||||
document.body.removeChild(link); // 下载后移除 <a> 元素
|
||||
} catch (error) {
|
||||
message.warning("文件下载失败!");
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
if (file.raw != null && file.raw !== '') {
|
||||
const blob = file.raw; // 将文件内容转换为 Blob 对象
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob); // 创建一个 URL 对象
|
||||
link.download = file.fileName; // 指定下载的文件名
|
||||
document.body.appendChild(link); // 将链接添加到 DOM 中
|
||||
link.click(); // 触发下载
|
||||
document.body.removeChild(link); // 下载后移除 <a> 元素
|
||||
}
|
||||
this.openFile = true
|
||||
},
|
||||
//图片点击查看
|
||||
handlePictureCardPreview(file) {
|
||||
this.dialogImageUrl = file.url
|
||||
this.dialogVisible = true
|
||||
},
|
||||
formatDate(date) {
|
||||
const year = date.getFullYear();
|
||||
|
|
|
|||
Loading…
Reference in New Issue