Merge branch 'test_dispaly' of https://git.code.tencent.com/lian-cbtc/jl-client into test_dispaly

This commit is contained in:
fan 2022-09-30 13:12:57 +08:00
commit d8686ec6af
8 changed files with 669 additions and 2 deletions

145
src/api/projectConfig.js Normal file
View File

@ -0,0 +1,145 @@
import request from '@/utils/request';
/** 后端项目配置分页 */
export function getBackProjectConfigByPage(params) {
return request({
url: `/api/project/page`,
method: 'get',
params
});
}
/** 全量后端项目配置 */
export function getAllBackProjectConfig() {
return request({
url: `/api/project/all`,
method: 'get'
});
}
/** 主键获取后端项目配置 */
export function getBackProjectConfigById(id) {
return request({
url: `/api/project/${id}`,
method: 'get'
});
}
/** 删除后端项目配置 */
export function deleteBackProjectConfig(id) {
return request({
url: `/api/project/del/${id}`,
method: 'delete'
});
}
/** 更新后端项目配置 */
export function updateBackProjectConfig(data) {
return request({
url: `/api/project/update`,
method: 'put',
data
});
}
/** 保存后端项目配置 */
export function saveBackProjectConfig(data) {
return request({
url: `/api/project/save`,
method: 'POST',
data
});
}
/** 获取后端项目列表,关联时使用 */
export function getBackProjectConfigList(id) {
return request({
url: `/api/project/simple`,
method: 'get'
});
}
/** 前端项目配置分页 */
export function getFrontProjectConfigByPage(params) {
return request({
url: `/api/project/viewSetting/page`,
method: 'get',
params
});
}
/** 全量前端项目配置 */
export function getAllFrontProjectConfig() {
return request({
url: `/api/project/viewSetting/all`,
method: 'get'
});
}
/** 获取前端项目配置 */
export function getFrontProjectConfigById(id) {
return request({
url: `/api/project/viewSetting/${id}`,
method: 'get'
});
}
/** 删除前端项目配置 */
export function deleteFrontProjectConfig(id) {
return request({
url: `/api/project/viewSetting/del/${id}`,
method: 'delete'
});
}
/** 更新前端项目配置 */
export function updateFrontProjectConfig(data) {
return request({
url: `/api/project/viewSetting/update`,
method: 'put',
data
});
}
/** 保存前端项目配置 */
export function saveFrontProjectConfig(data) {
return request({
url: `/api/project/viewSetting/save`,
method: 'POST',
data
});
}
/** 登录时根据前端标识获取配置 */
export function getFrontProjectConfigByLogin(markKey) {
return request({
url: `/api/project/viewSetting/project/${markKey}`,
method: 'get'
});
}
/** 登录时获取全量前端配置 */
export function getAllFrontProjectConfigByLogin(markKey) {
return request({
url: `/api/project/viewSetting/simple/all`,
method: 'get'
});
}
/** 检查项目code */
export function checkBackProjectExist(params) {
return request({
url: `/api/project/check/code`,
method: 'get',
params
});
}
/** 检查项目markKey */
export function checkFrontProjectExist(params) {
return request({
url: `/api/project/check/markKey`,
method: 'get',
params
});
}

View File

@ -104,5 +104,7 @@ export default {
projectServer: 'Project Server', projectServer: 'Project Server',
audioResourcesManage: 'Audio Resources Manage', audioResourcesManage: 'Audio Resources Manage',
iscsDeviceManage: 'ISCS Device Manage', iscsDeviceManage: 'ISCS Device Manage',
iscsResourcesManage: 'ISCS Resources Manage' iscsResourcesManage: 'ISCS Resources Manage',
projectManage: 'Project Manage',
frontProjectConfigManage:'Front Project Config Manage'
}; };

View File

@ -108,5 +108,7 @@ export default {
projectServer: '项目域名', projectServer: '项目域名',
audioResourcesManage: '音频资源管理', audioResourcesManage: '音频资源管理',
iscsDeviceManage: 'ISCS设备管理', iscsDeviceManage: 'ISCS设备管理',
iscsResourcesManage: 'ISCS资源管理' iscsResourcesManage: 'ISCS资源管理',
projectManage: '项目管理',
frontProjectConfigManage:'前端项目配置管理'
}; };

View File

@ -208,6 +208,9 @@ const UploadPdfList = () => import('@/views/uploadPdf/list');
const ThirdLogin = () => import('@/views/thirdLogin'); const ThirdLogin = () => import('@/views/thirdLogin');
const ProjectServer = () => import('@/views/system/serverManage'); const ProjectServer = () => import('@/views/system/serverManage');
const VoiceManage = () => import('@/views/fileManage/voiceManage'); const VoiceManage = () => import('@/views/fileManage/voiceManage');
const ProjectManage = () => import('@/views/system/projectManage');
const FrontProjectConfigManage = () => import('@/views/system/frontProjectConfigManage');
const IscsDeviceManage = () => import('@/views/system/iscsDeviceManage'); const IscsDeviceManage = () => import('@/views/system/iscsDeviceManage');
const IscsResourcesManage = () => import('@/views/system/iscsResourcesManage'); const IscsResourcesManage = () => import('@/views/system/iscsResourcesManage');
@ -1336,6 +1339,20 @@ export const asyncRouter = [
meta: { meta: {
i18n: 'router.audioResourcesManage' i18n: 'router.audioResourcesManage'
} }
},
{
path:'projectManage',
component: ProjectManage,
meta: {
i18n: 'router.projectManage'
}
},
{
path:'frontProjectConfigManage',
component: FrontProjectConfigManage,
meta: {
i18n: 'router.frontProjectConfigManage'
}
} }
] ]
}, },

View File

@ -0,0 +1,123 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="130px">
<el-form-item label="配置编码:" prop="markKey">
<el-input v-model="formModel.markKey" style="width: 260px;" />
</el-form-item>
<el-form-item label="关联项目:" prop="project">
<el-select v-model="formModel.project" placeholder="请选择" style="width: 260px;">
<el-option
v-for="item in projectList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { updateFrontProjectConfig, saveFrontProjectConfig, checkFrontProjectExist} from '@/api/projectConfig';
export default {
name:'AddProjectConfig',
data() {
return {
dialogVisible: false,
projectList:[],
formModel: {
id:'',
markKey: '', //
project: 'DEFAULT' //
// view_setting: '', //
},
loading: false
};
},
computed: {
rules() {
const crules = {
markKey: [
{ required: true, message: '请输入配置编码', trigger: 'blur' }
]
// project: [
// { required: true, message: '', trigger: 'blur' },
// { required: true, message: '', trigger: 'change' }
// ]
};
return crules;
},
title() {
return this.formModel.id ? '修改前端配置' : '创建前端配置';
}
},
methods:{
doShow({projectMap, row}) {
this.dialogVisible = true;
this.projectList = Object.values(projectMap);
if (row) {
this.formModel.id = row.id;
this.formModel.markKey = row.markKey;
this.formModel.project = row.project;
} else {
this.$nextTick(() => {
this.$refs.ruleForm.resetFields();
});
}
},
handleClose() {
this.formModel = {
id:'',
markKey: '', //
project: '' //
};
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.loading = true;
const data = Object.assign({}, this.formModel);
// markKey
checkFrontProjectExist({markKey:data.markKey}).then(res=>{
if (!res.data) {
if (data.id) {
//
updateFrontProjectConfig(data).then(resp => {
this.$message.success('修改前端配置成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
delete data.id;
//
saveFrontProjectConfig(data).then(resp => {
this.$message.success('创建前端配置成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
} else {
this.loading = false;
this.$message.error('此前端配置已存在,请修改配置编码');
}
});
}
});
}
}
};
</script>

View File

@ -0,0 +1,132 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-project-config ref="addProjectConfig" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getFrontProjectConfigByPage, deleteFrontProjectConfig, getBackProjectConfigList} from '@/api/projectConfig';
import AddProjectConfig from './add';
export default {
name:'FrontProjectConfigManage',
components: {
AddProjectConfig
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
markKey: {
type: 'text',
label: '配置编码'
},
project:{
type: 'select',
label: '关联项目',
config: {
data: []
}
}
}
},
projectMap:{},
queryList: {
query: this.getFrontProjectListByPage,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '配置编码',
prop: 'markKey'
},
{
title: '关联项目',
prop: 'project',
type: 'tag',
columnValue: (row) => { return this.projectMap[row.project] ? this.projectMap[row.project].label : ''; },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '300',
buttons: [
{
name: '编辑',
handleClick: this.handleEdit
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
// view_setting
// status01
],
actions: [
{ text: this.$t('global.add'), handler: this.createProjectConfig}
]
}
};
},
mounted() {
// 使
getBackProjectConfigList().then(resp => {
if (resp.data && resp.data.length > 0) {
this.projectMap['DEFAULT'] = {label:'默认', value:'DEFAULT'};
resp.data.forEach(each=>{
this.projectMap[each.value] = each;
});
this.queryForm.queryObject.project.config.data = Object.values(this.projectMap);
}
}).catch(error => {
console.log(error);
});
},
methods:{
//
async getFrontProjectListByPage(params) {
let res = '';
res = await getFrontProjectConfigByPage(params);
res.data.list.filter(item => {
return item.status == 1;
});
return res;
},
handleEdit(index, row) {
this.$refs.addProjectConfig.doShow({projectMap:this.projectMap, row:row});
},
createProjectConfig() {
this.$refs.addProjectConfig.doShow({projectMap:this.projectMap});
},
//
handleDelete(index, row) {
this.$confirm('此操作将删除该项目配置数据!', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteFrontProjectConfig(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -0,0 +1,128 @@
<template>
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" center :close-on-click-modal="false">
<el-form ref="ruleForm" :model="formModel" :rules="rules" label-width="130px">
<el-form-item label="项目编码:" prop="code">
<el-input v-model="formModel.code" style="width: 200px;" />
</el-form-item>
<el-form-item label="项目名称:" prop="name">
<el-input v-model="formModel.name" style="width: 200px;" />
</el-form-item>
<el-form-item label="项目描述:" prop="description">
<el-input v-model="formModel.description" style="width: 260px;" />
</el-form-item>
<el-form-item label="关联项目:" prop="viewShow">
<el-switch v-model="formModel.viewShow" />
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { saveBackProjectConfig, updateBackProjectConfig, checkBackProjectExist} from '@/api/projectConfig';
export default {
name: 'AddProject',
data() {
return {
dialogVisible: false,
formModel: {
id: '',
code: '', //
name: '', //
description: '', //
viewShow:false // 01
},
loading: false
};
},
computed: {
rules() {
const crules = {
code: [
{ required: true, message: '请输入项目编码', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入项目名称', trigger: 'blur' }
],
description: [
{ required: true, message: '请输入项目描述', trigger: 'blur' }
]
};
return crules;
},
title() {
return this.formModel.id ? '修改项目' : '创建项目';
}
},
methods:{
doShow(row) {
this.dialogVisible = true;
if (row) {
this.formModel.id = row.id;
this.formModel.code = row.code;
this.formModel.name = row.name;
this.formModel.description = row.description;
this.formModel.viewShow = !!row.viewShow;
} else {
this.$nextTick(() => {
this.$refs.ruleForm.resetFields();
});
}
},
handleClose() {
this.formModel = {
id: '',
code: '', //
name: '', //
description: '', //
viewShow:false // 01
};
this.$refs.ruleForm.resetFields();
this.dialogVisible = false;
this.loading = false;
},
doSave() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.loading = true;
const data = Object.assign({}, this.formModel);
data.viewShow = data.viewShow ? 1 : 0;
// code
checkBackProjectExist({code:data.code}).then(res=>{
if (!res.data) {
if (data.id) {
//
updateBackProjectConfig(data).then(resp => {
this.$message.success('修改项目成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
} else {
delete data.id;
//
saveBackProjectConfig(data).then(resp => {
this.$message.success('创建项目成功!');
this.handleClose();
this.$emit('reloadTable');
}).catch(error => {
this.$message.error(error.message);
this.loading = false;
});
}
} else {
this.loading = false;
this.$message.error('此项目已存在,请修改项目编码');
}
});
}
});
}
}
};
</script>

View File

@ -0,0 +1,118 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<add-project ref="addProject" @reloadTable="reloadTable" />
</div>
</template>
<script>
import { getBackProjectConfigByPage, deleteBackProjectConfig} from '@/api/projectConfig';
import AddProject from './add';
// getBackProjectConfigById
export default {
name:'ProjectManage',
components: {
AddProject
},
data() {
return {
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '120px',
reset: true,
queryObject: {
code: {
type: 'text',
label: '项目编码'
},
name: {
type: 'text',
label: '项目名称'
}
}
},
queryList: {
query: this.getProjectListByPage,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: '项目编码',
prop: 'code'
},
{
title: '项目名称',
prop: 'name'
},
{
title: '描述',
prop: 'description'
},
{
title: '关联项目选择',
prop: 'viewShow',
type: 'tag',
columnValue: (row) => { return row.viewShow ? '是' : '否'; },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '300',
buttons: [
{
name: '编辑',
handleClick: this.handleEdit
},
{
name: this.$t('global.delete'),
handleClick: this.handleDelete,
type: 'danger'
}
]
}
],
actions: [
{ text: this.$t('global.add'), handler: this.createProject}
]
}
};
},
methods:{
async getProjectListByPage(params) {
let res = '';
res = await getBackProjectConfigByPage(params);
res.data.list.filter(item => {
return item.status == 1;
});
return res;
},
handleEdit(index, row) {
this.$refs.addProject.doShow(row);
},
createProject() {
this.$refs.addProject.doShow();
},
handleDelete(index, row) {
this.$confirm('此操作将删除该项目数据!', this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
deleteBackProjectConfig(row.id).then(response => {
this.$message.success(this.$t('system.deleteSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.deleteFailed'));
});
});
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>