mirror of
https://github.com/nuintun/command-manager.git
synced 2025-10-20 18:31:21 +08:00
update files
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var ipc = require('ipc-renderer');
|
||||
var Vue = require('../../vue/vue');
|
||||
|
||||
require('../project-base');
|
||||
@@ -16,11 +15,27 @@ module.exports = Vue.component('project-configure', {
|
||||
template: fs.readFileSync(path.join(__dirname, 'project-configure.html')).toString(),
|
||||
props: {
|
||||
project: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
uniqueProjects: {
|
||||
type: Object,
|
||||
twoWay: true,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data: function (){
|
||||
return {
|
||||
nameError: '',
|
||||
pathError: '',
|
||||
submitError: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
projectClone: function (){
|
||||
return JSON.parse(JSON.stringify(this.project));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
focus: function (event){
|
||||
if (event.target.type === 'text') {
|
||||
@@ -28,9 +43,26 @@ module.exports = Vue.component('project-configure', {
|
||||
}
|
||||
},
|
||||
edit: function (){
|
||||
this.$broadcast('submit');
|
||||
var name = this.projectClone.name;
|
||||
var originName = this.project.name;
|
||||
|
||||
console.log(this.project);
|
||||
if (this.projectClone.name && this.projectClone.path) {
|
||||
if (name !== originName && this.uniqueProjects[name]) {
|
||||
this.submitError = '项目已存在';
|
||||
} else {
|
||||
// clean error
|
||||
this.submitError = '';
|
||||
|
||||
// send message
|
||||
this.$dispatch('edit', this.projectClone);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
events: {
|
||||
'configure-refresh': function (){
|
||||
this.submitError = '';
|
||||
this.$broadcast('clean-error');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user