代码调整
This commit is contained in:
parent
3ed2c52a73
commit
e29fdb0cb3
@ -1,26 +1,28 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="580px" :before-close="handleClose" center :close-on-click-modal="false">
|
||||
<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: 200px;" />
|
||||
<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="请选择">
|
||||
<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.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
: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, getBackProjectConfigList} from '@/api/projectConfig';
|
||||
// 获取后端项目列表,关联时使用
|
||||
// getBackProjectConfigList
|
||||
import { updateFrontProjectConfig, saveFrontProjectConfig} from '@/api/projectConfig';
|
||||
export default {
|
||||
name:'AddProjectConfig',
|
||||
data() {
|
||||
@ -30,7 +32,7 @@ export default {
|
||||
formModel: {
|
||||
id:'',
|
||||
markKey: '', // 配置编码
|
||||
project: '' // 关联项目
|
||||
project: 'DEFAULT' // 关联项目
|
||||
// view_setting: '', // 前端服务设置
|
||||
},
|
||||
loading: false
|
||||
@ -41,11 +43,11 @@ export default {
|
||||
const crules = {
|
||||
markKey: [
|
||||
{ required: true, message: '请输入配置编码', trigger: 'blur' }
|
||||
],
|
||||
project: [
|
||||
{ required: true, message: '请选择关联项目', trigger: 'blur' },
|
||||
{ required: true, message: '请选择关联项目', trigger: 'change' }
|
||||
]
|
||||
// project: [
|
||||
// { required: true, message: '请选择关联项目', trigger: 'blur' },
|
||||
// { required: true, message: '请选择关联项目', trigger: 'change' }
|
||||
// ]
|
||||
};
|
||||
return crules;
|
||||
},
|
||||
@ -53,17 +55,10 @@ export default {
|
||||
return this.formModel.id ? '修改前端配置' : '创建前端配置';
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getBackProjectConfigList().then(resp => {
|
||||
debugger;
|
||||
this.projectList;
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
doShow(row) {
|
||||
doShow({projectMap, row}) {
|
||||
this.dialogVisible = true;
|
||||
this.projectList = Object.values(projectMap);
|
||||
if (row) {
|
||||
this.formModel.id = row.id;
|
||||
this.formModel.markKey = row.markKey;
|
||||
|
@ -5,7 +5,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getFrontProjectConfigByPage, deleteFrontProjectConfig} from '@/api/projectConfig';
|
||||
import { getFrontProjectConfigByPage, deleteFrontProjectConfig, getBackProjectConfigList} from '@/api/projectConfig';
|
||||
import AddProjectConfig from './add';
|
||||
export default {
|
||||
name:'FrontProjectConfigManage',
|
||||
@ -24,6 +24,7 @@ export default {
|
||||
queryObject: {
|
||||
}
|
||||
},
|
||||
projectMap:{},
|
||||
queryList: {
|
||||
query: this.getFrontProjectListByPage,
|
||||
selectCheckShow: false,
|
||||
@ -35,7 +36,11 @@ export default {
|
||||
},
|
||||
{
|
||||
title: '关联项目',
|
||||
prop: 'project'
|
||||
prop: 'project',
|
||||
type: 'tag',
|
||||
columnValue: (row) => { return this.projectMap[row.project] ? this.projectMap[row.project].label : ''; },
|
||||
tagType: (row) => { return 'success'; }
|
||||
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@ -55,10 +60,26 @@ export default {
|
||||
}
|
||||
// view_setting: 前端服务设置
|
||||
// status:0删除,1有效
|
||||
],
|
||||
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;
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
// 前端项目配置分页
|
||||
async getFrontProjectListByPage(params) {
|
||||
@ -70,10 +91,10 @@ export default {
|
||||
return res;
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
this.$refs.addProjectConfig.doShow(row);
|
||||
this.$refs.addProjectConfig.doShow({projectMap:this.projectMap, row:row});
|
||||
},
|
||||
createProject() {
|
||||
this.$refs.addProjectConfig.doShow();
|
||||
createProjectConfig() {
|
||||
this.$refs.addProjectConfig.doShow({projectMap:this.projectMap});
|
||||
},
|
||||
// 删除前端项目配置
|
||||
handleDelete(index, row) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="580px" :before-close="handleClose" center :close-on-click-modal="false">
|
||||
<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;" />
|
||||
|
Loading…
Reference in New Issue
Block a user