Commit ca50bbb5 authored by munan's avatar munan

系统设置

parent c4a55e24
......@@ -2,24 +2,11 @@ import request from '@/utils/request'
import Qs from 'qs'
/**
* 1. 列表查询
* 2. 查询详细信息
* 3. 新增
* 4. 修改
* 5. 逻辑删除
* 6. 导出
* 1. 查询
* 2. 修改
*
*/
// 1. 查询系统设置列表
export function listSysSettings(query) {
return request({
url: '/syssettings/list',
method: 'get',
params: query
})
}
// 2. 查询系统设置详细信息
export function getSysSettings(businessId) {
return request({
......@@ -28,16 +15,6 @@ export function getSysSettings(businessId) {
})
}
// 3. 新增系统设置
export function addSysSettings(data) {
data = Qs.stringify(data)
return request({
url: '/syssettings/add',
method: 'post',
data: data
})
}
// 4. 修改系统设置
export function updateSysSettings(data) {
const businessId = data.businessId
......@@ -49,20 +26,3 @@ export function updateSysSettings(data) {
})
}
// 5. 逻辑删除系统设置
export function delSysSettings(businessId) {
return request({
url: '/syssettings/deleteLogical/' + businessId,
method: 'delete'
})
}
// 6. 导出系统设置
export function exportSysSettings(query) {
return request({
url: '/syssettings/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
......@@ -53,6 +53,7 @@
/>
</el-select>
</el-form-item>
<div class="search">
<el-form-item>
<el-button
:class="commonField.queryClass"
......@@ -83,6 +84,7 @@
@click="handleExport">导出</el-button>
</el-form-item>
</div>
</div>
</el-form>
</div>
<div class="placeholder" />
......@@ -99,11 +101,6 @@
{{ scope.row.userName || '-' }}
</template>
</el-table-column>
<el-table-column label="用户" prop="teaId" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.teaId || '-' }}
</template>
</el-table-column>
<el-table-column label="姓名" prop="teaName" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.teaName || '-' }}
......@@ -169,9 +166,6 @@
<el-form-item label="账号" prop="userName">
<el-input v-model.trim="form.userName" show-word-limit :maxlength="255" placeholder="请输入账号" />
</el-form-item>
<el-form-item label="用户" prop="teaId">
<el-input-number v-model.trim="form.teaId" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="姓名" prop="teaName">
<el-input v-model.trim="form.teaName" show-word-limit :maxlength="255" placeholder="请输入姓名" />
</el-form-item>
......
......@@ -82,9 +82,7 @@
</el-form-item>
</div>
</el-form>
<div class="placeholder" />
<div style="padding:5px 10px">
<div class="mb12 font-small-bold">数据集信息列表</div>
<el-table v-loading="loading" border :data="resDatasetInfoList" >
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column label="数据集编号" prop="dataCode" :show-overflow-tooltip="true">
......@@ -113,8 +111,8 @@
</el-table-column>
<el-table-column width="100" label="状态" prop="flag">
<template slot-scope="scope">
<span v-if="scope.row.flag === '1'">启动 </span>
<span v-else-if="scope.row.flag === '0'">停用 </span>
<span v-if="scope.row.flag === '1'"></span>
<span v-else-if="scope.row.flag === '0'"></span>
<el-switch
v-model="scope.row.flag"
class="switchDisabledStyle"
......@@ -129,7 +127,7 @@
{{ scope.row.remarks || '-' }}
</template>
</el-table-column>
<el-table-column label="创建时间" width="160" prop="createDate" :show-overflow-tooltip="true">
<el-table-column label="创建时间" width="200" prop="createDate" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
......
<template>
<div class="app-container">
<div v-if="themeType == '8'" class="tableTitle">系统设置列表</div>
<div class="search">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="系统名称" prop="systemName">
<div class="container">
<div class="header">
<div v-if="themeType == '8'" class="tableTitle">系统设置信息</div>
</div>
<el-main class="main-content">
<div class="input-field">
<div class="system-name">
<label for="systemName" class="input-label">系统名称:</label>
<el-input
v-model="queryParams.systemName"
id="systemName"
v-model="sysSettingsList.systemName"
type="text"
placeholder="请输入系统名称"
clearable
:maxlength="32"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="系统版本" prop="systemVersion">
size="middle"
@blur="validateSystemName"/>
</div>
</div>
<div class="input-field" >
<div class="system-background-image" >
<label for="systemBg" class="input-label">系统背景图:</label>
<el-upload
ref="upload"
v-model="sysSettingsList.systemBg"
class="avatar-uploader"
action="your-upload-endpoint"
:auto-upload="true"
list-type="picture-card"
:http-request="handleUpload"
:show-file-list="true"
:file-list="fileList"
:before-upload="handleBefore"
accept="image/png"
:on-remove="handleFileRemove">
<i v-if="!sysSettingsList.systemBg" class="el-icon-plus" />
</el-upload>
</div>
</div>
<hr style="border: #889ba9 solid 5px">
<div class="input-field">
<div class="system-version">
<label for="systemVersion" class="input-label">系统版本:</label>
<el-input
v-model="queryParams.systemVersion"
placeholder="请输入系统版本"
v-model="sysSettingsList.systemVersion"
placeholder="1.02.14"
clearable
:maxlength="50"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="系统license" prop="systemLicense">
<el-input
v-model="queryParams.systemLicense"
placeholder="请输入系统license"
clearable
:maxlength="255"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="系统编码" prop="systemSn">
size="middle"
readonly/>
</div>
</div>
<div class="input-field">
<div class="system-serial-number">
<label for="systemSn" class="input-label">系统编码:</label>
<el-input
v-model="queryParams.systemSn"
placeholder="请输入系统编码"
v-model="sysSettingsList.systemSn"
placeholder="GB12123"
clearable
:maxlength="32"
size="small"
style="width: 150px"
/>
</el-form-item>
<el-form-item label="过期时间">
size="middle"
readonly/>
</div>
</div>
<div class="input-field">
<div class="expiration-date">
<label for="systemExpire"class="input-label">过期时间:</label>
<el-date-picker
v-model="dateRange"
size="small"
size="middle"
style="width: 200px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="网卡编码" prop="systemRj49">
type="dateRange"
placeholder="2025-08-01"
readonly/>
</div>
</div>
<div class="input-field">
<div class="system-auth-host">
<label for="system-auth-host" class="input-label">授权服务器数量:</label>
<el-input
v-model="queryParams.systemRj49"
placeholder="请输入网卡编码"
v-model="sysSettingsList.systemAuthHost"
placeholder="1"
clearable
:maxlength="32"
size="small"
style="width: 150px"
/>
</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>
<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"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery">重置</el-button>
</el-form-item>
<div style="float: right">
<el-form-item>
<el-button
:class="commonField.addClass"
:type="commonField.typePrimary"
:icon="commonField.addIcon"
:size="commonField.smallSize"
@click="handleAdd">新增</el-button>
<el-button
:class="commonField.exportClass"
:type="commonField.typeSuccess"
:icon="commonField.exportIcon"
:size="commonField.smallSize"
@click="handleExport">导出</el-button>
</el-form-item>
:maxlength="50"
size="middle"
readonly/>
</div>
</el-form>
</div>
<div style="padding:5px 10px">
<div v-if="themeType !== '8'" class="tableTitle">系统设置列表</div>
<el-table v-loading="loading" border :data="sysSettingsList" >
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column label="系统名称" prop="systemName" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.systemName || '-' }}
</template>
</el-table-column>
<el-table-column label="系统背景图" prop="systemBg" :show-overflow-tooltip="true" width="150px">
<template slot-scope="scope">
<div :id="step(scope.$index)">
<el-image
style="width:100%;height:100%;"
:src="scope.row.ossInfoList && scope.row.ossInfoList.length > 0 ? scope.row.ossInfoList[0].systemBg : require('@/assets/image/profile.jpg')"
:preview-src-list="[scope.row.ossInfoList && scope.row.ossInfoList.length > 0 ? scope.row.ossInfoList[0].systemBg : require('@/assets/image/profile.jpg')]"
@click="handleClickStop(scope.$index)"
>
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline" />
<div class="input-field">
<div class="system-gpu-number">
<label for="systemAuthGpu" class="input-label">GPU数量:</label>
<el-input
v-model="sysSettingsList.systemAuthGpu"
placeholder="1"
clearable
:maxlength="50"
size="middle"
readonly/>
</div>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column label="系统版本" prop="systemVersion" :show-overflow-tooltip="true" >
<template slot-scope="scope" >
{{ scope.row.systemVersion || '23H2' }}
</template>
</el-table-column>
<el-table-column label="系统license" prop="systemLicense" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.systemLicense || '-' }}
</template>
</el-table-column>
<el-table-column label="系统编码" prop="systemSn" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.systemSn || 'GB2312' }}
</template>
</el-table-column>
<el-table-column label="过期时间" prop="systemExpire" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ scope.row.systemExpire | transformDateByFormat('2024-08-01 18:00:00') }}</span>
</template>
</el-table-column>
<el-table-column label="授权服务器数量" prop="systemAuthHost" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.systemAuthHost || '1' }}
</template>
</el-table-column>
<el-table-column label="授权数量" prop="systemAuthGpu" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.systemAuthGpu || '1' }}
</template>
</el-table-column>
<el-table-column label="网卡编码" prop="systemRj49" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.systemRj49 || 'e01' }}
</template>
</el-table-column>
<el-table-column width="120" 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)"
<div class="input-field">
<div class="network-card-serial">
<label for="systemRj45" class="input-label">网卡编码:</label>
<el-input
v-model="sysSettingsList.systemRj45"
clearable
placeholder="127.0.01"
:maxlength="50"
readonly
/>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="200px">
<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"
</div>
<div class="input-field">
<div style="width: 500px">
<label for="systemLicense" class="input-label">系统license:</label>
<el-input
v-model="sysSettingsList.systemLicense"
type="textarea"
clearable
:maxlength="50"
:rows="5"
/>
<!-- 添加或修改系统设置配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body >
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px">
<el-form-item label="系统名称" prop="systemName">
<el-input v-model.trim="form.systemName" show-word-limit :maxlength="32" placeholder="请输入系统名称" />
</el-form-item>
<el-form-item label="系统背景图" >
<el-upload
class="avatar-uploader"
action="#"
list-type="picture-card"
:http-request="handleUpload"
:show-file-list="true"
:file-list="fileList"
:before-upload="handleBefore"
accept="png"
:on-remove="handleFileRemove"
>
<i v-if="oss" class="el-icon-plus" />
</el-upload>
</el-form-item>
<el-form-item label="系统版本" prop="systemVersion">
<el-input v-model.trim="form.systemVersion" show-word-limit :maxlength="50" placeholder="23H2" readonly/>
</el-form-item>
<el-form-item label="系统编码" prop="systemSn">
<el-input v-model.trim="form.systemSn" show-word-limit :maxlength="32" placeholder="GB2312" readonly/>
</el-form-item>
<el-form-item label="过期时间" prop="systemExpire" >
<el-date-picker
v-model="form.systemExpire"
value-format="yyyy-MM-dd hh:mm:ss"
type="date"
placeholder="2024.08.01 18:00:00"
readonly>
</el-date-picker>
</el-form-item>
<el-form-item label="授权服务器数量" prop="systemAuthHost">
<el-input-number v-model.trim="form.systemAuthHost" controls-position="right" :min="0" disabled/>
</el-form-item>
<el-form-item label="授权数量" prop="systemAuthGpu">
<el-input-number v-model.trim="form.systemAuthGpu" controls-position="right" :min="0" disabled/>
</el-form-item>
<el-form-item label="网卡编码" prop="systemRj49">
<el-input v-model.trim="form.systemRj49" show-word-limit :maxlength="32" placeholder="e01 " readonly/>
</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="系统license" prop="systemLicense">
<el-input v-model.trim="form.systemLicense" show-word-limit :maxlength="255" placeholder="请输入系统license" />
</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>
</div>
</el-main>
</div>
</template>
<script>
<script lang="ts">
import {
listSysSettings,
getSysSettings,
delSysSettings,
addSysSettings,
updateSysSettings,
exportSysSettings } from '@/api/sysSettings'
} from '@/api/sysSettings'
import commonField from '@/utils/commonField'
import {getDataCache, setDataCache} from "@/assets/js/filterData";
export default {
name: 'SysSettings',
data() {
return {
sysSettingsList: {
systemBg: '', // 存储系统背景图的 URL
},
fileList: [], // 文件列表
oss: true, // 控制图标显示
// 遮罩层
loading: true,
// 总条数
......@@ -321,7 +187,7 @@ export default {
form: {},
// 表单校验
rules: {
systemName:[{type: 'string',required: true,message: "系统名称必填", trigger: 'blur'}],
systemName: [{type: 'string', required: true, message: "系统名称必填", trigger: 'blur'}],
}
}
},
......@@ -335,12 +201,13 @@ export default {
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
setDataCache(this.$route.path, this.queryParams)
setDataCache(this.$route.path, this.sysSettingsList)
next()
},
created() {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
this.sysSettingsList = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
this.getList() // 列表查询
this.loadCachedImage();
},
methods: {
/**
......@@ -358,6 +225,15 @@ export default {
console.log(this.pictureId)
})
},
loadCachedImage() {
const cachedUrl = localStorage.getItem('systemBg');
if (cachedUrl) {
this.sysSettingsList.systemBg = cachedUrl;
}
},
saveImageToCache(url) {
localStorage.setItem('systemBg', url);
},
handleFileRemove(file, fileList) {
// 从 fileList 中移除已删除的文件
this.fileList = fileList
......@@ -379,24 +255,20 @@ export default {
this.loading = true
listSysSettings(this.addDateRange(this.queryParams, this.dateRange)).then(
response => {
this.sysSettingsList = response.rows
this.sysSettingsList = response.rows[3]
console.log('sysSettingsList', this.sysSettingsList)
this.total = response.total
this.loading = false
}
)
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
businessId: undefined,
remarks: undefined,
systemName: undefined,
systemBg:'',
systemBg: '',
systemVersion: undefined,
systemLicense: undefined,
systemSn: undefined,
......@@ -432,12 +304,6 @@ export default {
}
this.handleQuery()
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加系统设置'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
......@@ -455,19 +321,19 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return updateSysSettings(row)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
}).catch(function () {
row.flag = row.flag === '0' ? '1' : '0'
})
},
/** 提交按钮 */
submitForm: function() {
submitForm: function () {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.businessId !== undefined) {
......@@ -493,7 +359,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return delSysSettings(id)
}).then(() => {
this.getList()
......@@ -501,7 +367,7 @@ export default {
message: '删除成功',
type: 'success'
})
}).catch(function() {
}).catch(function () {
})
},
/** 导出按钮操作 */
......@@ -511,7 +377,7 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
}).then(function () {
return exportSysSettings(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
......@@ -525,8 +391,7 @@ export default {
})
})
},
/** 列表图片唯一标识*/
/** 列表图片唯一标识*/
step(index) {
return 'step' + index
},
......@@ -544,18 +409,86 @@ export default {
})
}
}
}
</script>
<style lang="scss" scoped>
.app-container {
font-size: 18px;
padding: 0;
.placeholder {
height: 1.3vh;
background-color: #F4F4F4;
margin-bottom: 10px
}
<style scoped>
.input-field {
margin: 4px;
display: flex;
justify-content: center;
}
.input-label{
font-size: 15px;
color: #606266;
margin-right: 8px;
width: 100px;
white-space: nowrap;
flex-shrink: 0;
}
.container{
flex-direction: column;
height: 100%;
overflow-y: auto;
overflow-x: auto;
padding: 20px;
}
.system-license {
display: flex;
align-items: center;
justify-content: center;
}
.system-name {
display: flex;
align-items: center;
}
.system-background-image {
display: flex;
align-items: center;
justify-content: center;
}
.system-version {
display: flex;
align-items: center;
}
.system-serial-number {
display: flex;
align-items: center;
}
.expiration-date {
display: flex;
align-items: center;
}
.system-gpu-number {
display: flex;
align-items: center;
}
.network-card-serial {
display: flex;
align-items: center;
}
.system-auth-host {
display: flex;
align-items: center;
}
.header{
display: flex;
align-items: center;
margin-bottom: 16px;
}
</style>
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