安全须知管理页面

This commit is contained in:
zzyuan 2025-12-29 14:48:36 +08:00
parent ccbd69f20f
commit f69dfa6585
2 changed files with 138 additions and 95 deletions

View File

@ -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
})
}

View File

@ -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">
<template slot-scope="scope">
<span v-if="scope.row.fileUrl!=''" @click="checkFile(scope.row)" style="cursor: pointer;color: #46a6ff;">查看</span>
</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="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>
@ -121,29 +127,13 @@
<el-button type="primary" @click="submitForm()"> </el-button>
<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>
</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");
@ -264,40 +254,33 @@
handleUpdate(row) {
this.reset();
this.open = true;
this.baseForm = Object.assign({}, row)
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();