代码调整

This commit is contained in:
joylink_cuiweidong 2022-09-29 16:30:20 +08:00
parent 3ed2c52a73
commit e29fdb0cb3
3 changed files with 46 additions and 30 deletions

View File

@ -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;

View File

@ -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
// 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;
});
}
}).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) {

View File

@ -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;" />