ms project

This commit is contained in:
Captain.B 2020-02-26 18:31:07 +08:00
parent 758165157a
commit 9c7b776a37
4 changed files with 29 additions and 23 deletions

View File

@ -1,6 +1,7 @@
const en_US = {
commons: {
'workspace': 'Workspace',
'project': 'Project',
'name': 'Name',
'description': 'Description',
'save': 'Save',
@ -17,11 +18,14 @@ const en_US = {
'input_name': 'Please enter a workspace name',
'input_name_2_50': '2 to 50 characters in length',
'search_by_name': 'Search by name',
'organization_name': 'Organizationn Name',
'organization_name': 'Organization Name',
'please_choose_organization': 'Please Choose Organization',
},
project: {
'recent': 'Recent Projects'
'recent': 'Recent Projects',
'create': 'Create Project',
'delete_confirm': 'Are you sure you want to delete this project?',
'search_by_name': 'Search by name',
},
i18n: {
'home': 'Home',

View File

@ -1,6 +1,7 @@
const zh_CN = {
commons: {
'workspace': '工作空间',
'project': '项目',
'name': '名称',
'description': '描述',
'save': '保存',
@ -21,7 +22,10 @@ const zh_CN = {
'please_choose_organization': '请选择组织',
},
project: {
'recent': '最近的项目'
'recent': '最近的项目',
'create': '创建项目',
'delete_confirm': '这个项目确定要删除吗?',
'search_by_name': '根据名称搜索',
},
i18n: {
'home': '首页',

View File

@ -5,18 +5,19 @@
<div slot="header">
<el-row type="flex" justify="space-between" align="middle">
<span class="title">
项目
{{$t('commons.project')}}
<ms-create-box :tips="btnTips" :exec="create"/>
</span>
<span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
<el-input type="text" size="small" :placeholder="$t('project.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60" v-model="condition" clearable/>
</span>
</el-row>
</div>
<el-table :data="items" style="width: 100%">
<el-table-column prop="name" label="名称"/>
<el-table-column prop="description" label="描述"/>
<el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" :label="$t('commons.description')"/>
<el-table-column>
<template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
@ -43,17 +44,17 @@
</div>
</el-card>
<el-dialog title="创建项目" :visible.sync="createVisible">
<el-dialog :title="$t('project.create')" :visible.sync="createVisible">
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
<el-form-item label="名称">
<el-form-item :label="$t('commons.name')">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="描述">
<el-form-item :label="$t('commons.description')">
<el-input type="textarea" v-model="form.description"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button>
<el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
</div>
</el-dialog>
</div>
@ -71,7 +72,7 @@
return {
createVisible: false,
result: {},
btnTips: "添加项目",
btnTips: this.$t('project.create'),
condition: "",
items: [],
form: {},
@ -99,7 +100,7 @@
},
edit(row) {
this.createVisible = true;
this.form = row;
this.form = Object.assign({}, row);
},
submit(formName) {
this.$refs[formName].validate((valid) => {
@ -111,7 +112,7 @@
this.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false;
this.list();
Message.success('保存成功');
Message.success(this.$t('commons.save_success'));
});
} else {
return false;
@ -119,17 +120,15 @@
});
},
del(row) {
this.$confirm('这个项目确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('project.delete_confirm'), this.$t('commons.prompt'), {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
}, () => {
this.$get('/project/delete/' + row.id, () => {
Message.success('删除成功');
Message.success(this.$t('commons.delete_success'));
this.list();
});
}).catch(() => {
});
},
list() {

View File

@ -96,8 +96,7 @@
}
},
watch: {
'$route'(to, from) {
window.console.log(to, from);
'$route'(to) {
this.projectId = to.params.projectId;
this.initTableData();
}