安全须知管理页面

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 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>
<el-table-column label="标题" align="center" prop="title" :show-overflow-tooltip="true"/> <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="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"> <template slot-scope="scope">
<span v-if="scope.row.state==1"></span> <span v-if="scope.row.state==1" style="font-size: 18px;color: rgb(3, 223, 109);"></span>
<span v-if="scope.row.state==2"></span> <span v-if="scope.row.state==0" style="font-size: 18px;color: red;"></span>
</template> </template>
</el-table-column> --> </el-table-column>
<el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true"> <el-table-column label="附件" align="center" prop="" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope"> <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> <span v-else>无附件</span>
</template> </template>
</el-table-column> </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"> <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
size="mini"
type="text" v-if="scope.row.state==0"
@click="handleOpen(scope.row)"
>开启</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -81,8 +87,8 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" > <el-col :span="24" >
<el-form-item label="使用类型" prop="useType"> <el-form-item label="使用类型" prop="type">
<el-radio-group v-model="baseForm.useType"> <el-radio-group v-model="baseForm.type">
<el-radio label="1">文本内容</el-radio> <el-radio label="1">文本内容</el-radio>
<el-radio label="2">附件内容</el-radio> <el-radio label="2">附件内容</el-radio>
</el-radio-group> </el-radio-group>
@ -122,28 +128,12 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </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> </div>
</template> </template>
<script> <script>
import { getCertificateApplyListPageApi,addCertificateApplyApi, editCertificateApplyApi, import { getRuleListApi,insertRuleApi, updateRuleApi,
delCertificateApplyApi,revokeCertificateApplyApi } from "@/api/certificateManage/index"; delCertificateApplyApi,updateRuleStateApi } from "@/api/certificateManage/index";
import base64 from 'base-64'; import base64 from 'base-64';
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { downloadFileByUrl } from '@/utils/download' import { downloadFileByUrl } from '@/utils/download'
@ -181,7 +171,7 @@
// //
baseForm: { baseForm: {
title:"", title:"",
useType:"1", type:"1",
content:"" content:""
}, },
// //
@ -189,7 +179,7 @@
title: [ title: [
{ required: true, message: "标题不能为空", trigger: "change" } { required: true, message: "标题不能为空", trigger: "change" }
], ],
useType: [ type: [
{ required: true, message: "使用类型不能为空", trigger: "change" } { required: true, message: "使用类型不能为空", trigger: "change" }
], ],
content: [ content: [
@ -206,8 +196,8 @@
url: process.env.VUE_APP_BASE_API + '/file/upload?type=file', url: process.env.VUE_APP_BASE_API + '/file/upload?type=file',
}, },
fileList:[], fileList:[],
fileUrls:[], fileUrl:[],
fileNames:[], fileName:[],
openFile:false,// openFile:false,//
dialogVisible:false,// dialogVisible:false,//
dialogImageUrl:"",// dialogImageUrl:"",//
@ -229,26 +219,26 @@
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
// this.loading = true; this.loading = true;
// let param = { let param = {
// "pageNum":this.queryParams.pageNum, "pageNum":this.queryParams.pageNum,
// "pageSize":this.queryParams.pageSize, "pageSize":this.queryParams.pageSize,
// "keyWord":this.queryParams.keyWord, "keyWord":this.queryParams.keyWord,
// } }
// getCertificateApplyListPageApi(param).then(response => { getRuleListApi(param).then(response => {
// this.tableListData = response.rows; this.tableListData = response.rows;
// this.total = Number(response.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
// }); });
}, },
// //
reset() { reset() {
this.fileList=[] this.fileList=[]
this.fileUrls=[] this.fileUrl=[]
this.fileNames = [] this.fileName = []
this.baseForm = { this.baseForm = {
title:"", title:"",
useType:"1", type:"1",
content:"" content:""
}; };
this.resetForm("baseForm"); this.resetForm("baseForm");
@ -265,39 +255,32 @@
this.reset(); this.reset();
this.open = true; this.open = true;
this.baseForm = Object.assign({}, row) this.baseForm = Object.assign({}, row)
this.fileList=[]
this.fileUrl=[]
this.fileName = []
if(row.fileUrl&&row.fileUrl!=''){ if(row.fileUrl&&row.fileUrl!=''){
let arr = row.fileUrl.split(","); this.fileList.push({url:row.fileUrl,name:row.fileName})
let arr2 = row.fileName.split(","); this.fileUrl.push(row.fileUrl)
arr.forEach((item,index)=>{ this.fileName.push(row.fileName)
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.title = "修改"; this.title = "修改";
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function(type) { submitForm: function() {
//applyState -1 0 //fileUrl
this.baseForm.applyState = type; this.baseForm.fileUrl = this.fileUrl[0]||""
//fileUrls this.baseForm.fileName = this.fileName[0]||""
this.baseForm.fileUrls = this.fileUrls
this.baseForm.fileNames = this.fileNames
console.log("this.baseForm",this.baseForm); console.log("this.baseForm",this.baseForm);
this.$refs["baseForm"].validate(valid => { this.$refs["baseForm"].validate(valid => {
if (valid) { if (valid) {
if (this.baseForm.checkId != undefined) { if (this.baseForm.id != undefined) {
editCertificateApplyApi(this.baseForm).then(response => { updateRuleApi(this.baseForm).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addCertificateApplyApi(this.baseForm).then(response => { insertRuleApi(this.baseForm).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -311,13 +294,13 @@
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// //
handleRevoke(row) { handleOpen(row) {
this.$modal.confirm('是否确认撤销申请').then(() => { this.$modal.confirm('是否确认开启该规则').then(() => {
revokeCertificateApplyApi({checkId:row.checkId}).then(response => { updateRuleStateApi({id:row.id,state:1}).then(response => {
console.log("revokeCertificateApplyApi",response); console.log("updateRuleStateApi",response);
this.getList(); this.getList();
this.$modal.msgSuccess("撤销成功"); this.$modal.msgSuccess("开启成功");
return; return;
}); });
}).catch(() => {}); }).catch(() => {});
@ -341,8 +324,8 @@
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
this.upload.isUploading = false; this.upload.isUploading = false;
if(response.code==200){ if(response.code==200){
this.fileUrls.push(response.data.url) this.fileUrl.push(response.data.url)
this.fileNames.push(response.data.name) this.fileName.push(response.data.name)
this.$modal.msgSuccess(response.msg); this.$modal.msgSuccess(response.msg);
}else{ }else{
this.$modal.msgError(response.msg); this.$modal.msgError(response.msg);
@ -350,13 +333,13 @@
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
let sum = 0 let sum = 0
this.fileNames.forEach((item, index) => { this.fileName.forEach((item, index) => {
if (item == file.name) { if (item == file.name) {
sum = index sum = index
} }
}) })
this.fileUrls.splice(sum, 1) this.fileUrl.splice(sum, 1)
this.fileNames.splice(sum, 1) this.fileName.splice(sum, 1)
}, },
async handlePreviewDownloadFile(file) { async handlePreviewDownloadFile(file) {
if (file.url != null && file.url !== '') { if (file.url != null && file.url !== '') {
@ -388,25 +371,35 @@
document.body.removeChild(link); // <a> document.body.removeChild(link); // <a>
} }
}, },
checkFile(row){ async downloadFile(file) {
this.fileList=[] if (file.fileUrl != null && file.fileUrl !== '') {
this.fileUrls=[] let downloadUrl = file.fileUrl;
this.fileNames = [] try {
if(row.fileUrl&&row.fileUrl!=''){ const response = await fetch(downloadUrl); //
let arr = row.fileUrl.split(","); if (!response.ok) {
let arr2 = row.fileName.split(","); throw new Error('文件下载失败');
arr.forEach((item,index)=>{ }
this.fileList.push({url:item,name:arr2[index]}) const blob = await response.blob(); // Blob
this.fileUrls.push(item) const link = document.createElement('a');
this.fileNames.push(arr2[index]) 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) { formatDate(date) {
const year = date.getFullYear(); const year = date.getFullYear();