oil-station/fuintAdmin_zt/src/views/setting/sysLog.vue
DESKTOP-369JRHT\12997 1369e972ef 11.20
2024-11-20 11:44:45 +08:00

430 lines
11 KiB
Vue

<template>
<div class="app-container" style="padding: 0px">
<div class="tab-box">
<div class="f-box" v-for="(item,index) in tablist" :key="index" @click="activeindex=index,handleClick2()" :class="{ 'active' :activeindex==index}">{{item.name}}</div>
</div>
<div class="card-change" style="margin: 10px;margin-bottom: 0px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px">
<el-form-item label="" prop="createName">
<el-input
v-model="queryParams.createName"
placeholder="请输入用户名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="deptId">
<el-select
v-model="queryParams.deptId"
placeholder="请选择机构"
clearable
style="width: 240px"
>
<el-option
v-for="item in deptListSelect"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="moudle">
<el-input
v-model="queryParams.moudle"
placeholder="请输入操作模块"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="" prop="turnoverType" >
<el-date-picker
v-model="queryParams.startTime"
style="width: 140px"
type="date"
value-format="yyyy-MM-dd"
placeholder="开始日期">
</el-date-picker>
<el-date-picker
v-model="queryParams.endTime"
style="width: 140px"
type="date"
value-format="yyyy-MM-dd"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item style="float: right">
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<div style="height: 70vh;overflow: auto;scrollbar-width:none; ">
<el-table :data="tableData" style="width: 100%" border>
<el-table-column type="index" label="序号"></el-table-column>
<el-table-column prop="createAccount" label="登录账号"></el-table-column>
<el-table-column prop="createName" label="操作用户"></el-table-column>
<el-table-column prop="deptName" label="所属机构"></el-table-column>
<el-table-column prop="systemName" label="系统终端">
<template slot-scope="scope">
<div v-if="scope.row.systemName==1">
中台端
</div>
<div v-else>
油站端
</div>
</template>
</el-table-column>
<el-table-column prop="moudle" label="操作模块"></el-table-column>
<el-table-column prop="content" label="操作内容"></el-table-column>
<el-table-column prop="ipAddr" label="IP地址"></el-table-column>
<el-table-column prop="createTime" label="操作时间"></el-table-column>
</el-table>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="50%" append-to-body>
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="商品分类" prop="categoryName">
<el-select v-model="form.categoryName" style="width: 150px" placeholder="全部">
<el-option
v-for="dict in dict.type.hardware_type"
:key="dict.label"
:label="dict.label"
:value="dict.label"
/>
</el-select>
</el-form-item>
<el-form-item label="采购商家" prop="formStore">
<el-input v-model="form.formStore" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="图片" prop="image">
<ImageUpload v-model="form.image"></ImageUpload>
</el-form-item>
<el-form-item label="商品介绍" prop="content">
<el-input type="textarea" v-model="form.content"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">提交</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import {deleteApi, getListApi, saveApi, updateApi} from "@/api/setting/sysLog";
import { getToken } from '@/utils/auth'
import {selectChildByDeptId} from "@/api/system/Site/site";
export default {
name: "printIndex",
dicts: ['hardware_type','hardware_status'],
data() {
return {
activeindex:0,
tablist:[
{
name:'中台系统',
},
{
name:'油站系统',
},
],
tableData: [],
activeName:'first',
form: {
},
deptListSelect:[],
systemPositionList:[{
value: '首页',
label: '首页'
}, {
value: '系统首页',
label: '系统首页'
},],
// 是否显示弹出层
open: false,
title:"",
total:0,
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
bannerName:'',
systemPosition:'',
bannerStatus:'',
//初始化是中台系统子页面 默认
systemName:1,
},
// 上传地址
uploadAction: process.env.VUE_APP_BASE_API + 'backendApi/file/upload',
uploadHeader: { 'Access-Token' : getToken() }, // 上传文件列表
uploadFiles: [
{name:"nihao",
url:'http://localhost:8008/static/uploadImages/20231103/ffbbe7d3ee1441fdaf706802fa0f176a.png'}
],
// 图片根目录
imagePath: process.env.VUE_APP_BASE_API,
// 隐藏上传
hideUpload: false,
// 表单校验
rules: {
name: [
{ required: true, message: "商品名称不能为空", trigger: "blur" }
],
categoryName: [
{ required: true, message: "商品分类不能为空", trigger: "blur" }
],
formStore: [
{ required: true, message: "采购商家不能为空", trigger: "blur" }
],
image: [
{ required: true, message: "商品图片不能为空", trigger: "blur" }
],
content: [
{ required: true, message: "商品介绍不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList()
this.selectChildByDeptIdApi()
},
methods: {
selectChildByDeptIdApi() {
selectChildByDeptId().then(res=>{
this.deptListSelect = res.data
})
},
handleClick(tab, event) {
if (tab.$options.propsData.name == 'first'){
this.queryParams.systemName ='1'
}else {
this.queryParams.systemName ='2'
}
this.getList()
},
handleClick2() {
this.queryParams = {
page: 1,
pageSize: 10,
bannerName:'',
systemPosition:'',
bannerStatus:'',
}
if (this.activeindex == 0){
this.queryParams.systemName ='1'
}else {
this.queryParams.systemName ='2'
}
this.getList()
},
getList(){
this.queryParams.current = this.queryParams.page
console.log('请求参数',this.queryParams)
getListApi(this.queryParams).then(res=>{
this.tableData = res.data.records;
this.total = res.data.total
})
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
// 表单验证通过,可以提交数据
this.submitDeviceInfo();
} else {
// 表单验证失败,不执行任何操作
return false;
}
});
},
submitDeviceInfo() {
// 在这里调用接口提交设备信息数据
console.log('提交设备信息数据:', this.form);
if (this.form.id) {
updateApi(this.form).then(res=>{
if(res.code === 200) {
this.getList()
this.open = false
}
})
}else {
saveApi(this.form).then(res=>{
if(res.code === 200) {
this.getList()
this.open = false
}
})
}
},
changeStatus(data){
updateApi(data).then(res=>{
if(res.code === 200) {
this.$message({
type: 'success',
message: '修改状态成功!'
});
this.getList()
}
})
},
// 上传封面
handleUploadSuccessCover(file) {
this.form.productImage = file.data.fileName;
this.form.productImage = file.data.fileName;
},
handleQuery(){
this.getList()
},
resetQuery(){
this.queryParams = {
page: 1,
pageSize: 10,
deviceName:'',
},
this.getList()
},
handleAdd(e) {
this.clean()
this.open = true;
this.title = "新增商品"
},
edit(e) {
this.clean()
this.open = true;
this.title = "修改商品"
this.form = e
},
del(e) {
this.$confirm('此操作将永久删除该商品, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteApi(e.id).then(res=>{
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList()
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
clean() {
this.form= {
id: null, // 自增id
bannerName: '', // Banner名称
productImage: '', // 商品图片
systemPosition: '', // 系统位置
sortOrder: null, // 排序号
bannerLink: '', // Banner链接
bannerStatus: false, // Banner状态
note: '', // 备注
createByName: '', //
}
},
}
};
</script>
<style lang="scss" scoped>
.common-dialog >>> .el-upload--picture-card {
width: 60px;
height: 50px;
line-height: 60px;
}
.d-dialog >>> .el-upload--picture-card {
width: 100px;
height: 100px;
line-height: 100px;
}
.d-dialog >>> .avatar-uploader .el-upload {
width: 100px;
height: 100px;
}
.d-dialog >>> .el-upload-list--picture-card .el-upload-list__item {
width: 100px;
height: 100px;
}
.list-img{
width: 98px;
height: 98px;
}
.tabder-box{
width: 85%;
}
.tab-box{
width: 100%;
background: #fff;
display: flex;
box-sizing: border-box;
padding: 0px 50px;
}
.f-box{
height: 40px;
color: #999999;
margin-right: 50px;
display: flex;
align-items: center;
}
.active{
color: #FF9655 !important;
border-bottom: 2px solid #FF9655 !important;
}
</style>