Commit d27e8323 authored by shangtx's avatar shangtx

feat: 系统参数

parent 8c8f6e21
......@@ -41,7 +41,7 @@ export default {
useSelection: true,
// 标题
title: '列表',
keep: false, // 保持状态
keep: true, // 保持状态
useSearch: true, // 显示搜索
customClass: '',
useTitle: true,
......
......@@ -79,7 +79,7 @@ const user = {
commit('SET_AVATAR', data.userInfo.avatar);
commit('SET_BUTTONS', buttonAuthList);
SocketService.init(data.userInfo.id)
SocketService.init()
resolve(response)
......
......@@ -4,8 +4,9 @@ import { notification } from 'ant-design-vue'
export default class SocketService {
static webSocket = null
static reConnectTimeout = 1000
static init(userId) {
const ws = new WebSocket(`${process.env.VUE_APP_WEBSOCKET}?userId=${userId}`)
static init() {
const token = sessionStorage.getItem('Access-Token') || localStorage.getItem('Access-Token')
const ws = new WebSocket(`${process.env.VUE_APP_WEBSOCKET}?token=${token}`)
this.reConnectTimeout = 1000
ws.onmessage = this.onmessage
......
......@@ -28,7 +28,7 @@ export default {
return {
columns,
useYScroll: true,
title: '推广管理'
title: '推广统计'
}
},
methods: {
......
This diff is collapsed.
<template>
<a-drawer
title="系统参数编辑"
placement="right"
:closable="false"
@close="onClose"
:visible="visible"
width="30%"
wrapClassName="sys-param"
>
<a-form>
<a-row>
<a-col v-if="param.type == 3" :span="24">
<a-form-item :label="param.name" v-bind="formItemLayout">
<RichText ref="RichText" :height="600" />
</a-form-item>
</a-col>
<a-col v-if="param.type == 1" :span="24">
<a-form-item :label="param.name" v-bind="formItemLayout">
<a-input-number style="width: 180px" v-model="value" />
</a-form-item>
</a-col>
<a-col v-if="param.type == 2" :span="24">
<a-form-item :label="param.name" v-bind="formItemLayout">
<a-input v-model="value" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<div class="drawer-form-bottom-toolbar">
<a-button :style="{ marginRight: '8px' }" @click="onClose">
返回
</a-button>
<a-button type="primary" @click="saveForm(record)"> 保存 </a-button>
</div>
</a-drawer>
</template>
<script>
import RichText from '@/components/richtext/richtext-editor'
import ImageUpload from '@/components/image-upload/ImageUpload'
import { save } from '@/api/base/sysParam'
export default {
name: 'SysParamEdit',
components: { RichText, ImageUpload },
data() {
return {
type: 1,
visible: false,
param: { value: null },
value: null
}
},
methods: {
show(row) {
this.param = row
this.visible = true
this.$nextTick(() => {
if (row.type == 3) {
this.$refs.RichText.setContent(row.value)
} else {
this.value = row.value
}
})
},
onClose() {
this.param = { value: null }
this.visible = false
},
saveForm() {
let value = null
if (this.param.type == 3) {
value = this.$refs.RichText.getContent()
} else {
value = this.value
}
if (!value) {
this.loading = false
this.$notification.error({
message: '提示',
description: '参数值不能为空',
duration: 4
})
return
}
save({ id: this.param.id, value }).then(({ code }) => {
if (code == 200) {
this.$notification.success({
message: '系统提示',
description: '保存成功',
duration: 4
})
this.$emit('onSuccess')
this.onClose()
}
})
}
}
}
</script>
\ No newline at end of file
<template>
<div>
<sys-param-component
:type="type"
:listName="listName"
></sys-param-component>
</div>
<table-template :soul="this">
<template #action="{ record }">
<a @click="editRow(record)">编辑</a>
</template>
<template #tags="{ value }">
<a-tag>{{ codeMapping['SYS0005'][value] }}</a-tag>
</template>
<template #value="{ record }">
<span>{{ getValue(record) }}</span>
</template>
<template #free>
<SysParamEdit ref="SysParamEdit" @onSuccess="reset" />
</template>
</table-template>
</template>
<script>
import SysParamComponent from './SysParamComponent'
import dayjs from 'dayjs'
import { TableTemplate, TableScript, SearchType } from '@/components/table'
import { getPage } from '@/api/base/sysParam'
import SysParamEdit from './SysParamEdit.vue'
const columns = [
{
title: '参数名称',
dataIndex: 'name',
width: 200,
filter: { type: SearchType.STRING }
},
{
title: '参数类型',
dataIndex: 'type',
width: 100,
scopedSlots: { customRender: 'tags' },
filter: { type: SearchType.ENUM },
enum: 'SYS0005'
},
{ title: '参数值', key: 'value', scopedSlots: { customRender: 'value' } },
{ title: '备注', width: 100, dataIndex: 'remark' },
{ title: '排序号', width: 110, dataIndex: 'showOrder', sorter: true },
{ title: '修改人', width: 110, dataIndex: 'username' },
{
title: '修改时间',
dataIndex: 'lmDate',
width: 180,
sorter: true,
customRender: (text) => dayjs(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '操作',
key: 'operation',
width: 90,
scopedSlots: { customRender: 'action' }
}
]
export default {
name: 'SysParamList',
components: { SysParamComponent },
components: { TableTemplate, SysParamEdit },
mixins: [TableScript],
data() {
return {
type: 'system',
listName: '总控系统参数列表'
title: '系统参数',
columns,
codes: [['SYS0005'], []]
}
},
methods: {}
methods: {
queryData: getPage,
getValue(record) {
if (record.type == 3) {
return '[点击编辑查看]'
}
return record.value
},
editRow(row) {
this.$refs.SysParamEdit.show(row)
}
}
}
</script>
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