|
|
@@ -128,7 +128,7 @@
|
|
|
autosize
|
|
|
v-if="
|
|
|
row.apiFlag === '1' &&
|
|
|
- (row.formType === 'select' || row.formType === 'multiSelect')
|
|
|
+ (row.formType === 'select' || row.formType === 'multiSelect')
|
|
|
"
|
|
|
>
|
|
|
<el-button slot="append" type="text" @click="editOptions(row)">编辑 </el-button>
|
|
|
@@ -139,7 +139,7 @@
|
|
|
disabled
|
|
|
v-if="
|
|
|
(row.apiFlag === '2' || row.apiFlag === '3') &&
|
|
|
- (row.formType === 'select' || row.formType === 'multiSelect')
|
|
|
+ (row.formType === 'select' || row.formType === 'multiSelect')
|
|
|
"
|
|
|
>
|
|
|
<el-button slot="append" type="text" @click="editSelectField(row)"
|
|
|
@@ -297,28 +297,28 @@ export default {
|
|
|
this.loading = true;
|
|
|
this.$http
|
|
|
.get('/genCode/getOne', {
|
|
|
- className: this.$route.query.className,
|
|
|
+ className: this.$route.query.className
|
|
|
})
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
console.log(res);
|
|
|
this.loading = false;
|
|
|
|
|
|
this.$http
|
|
|
.get('/genCode/tableFields', {
|
|
|
- className: res.tablePackage,
|
|
|
+ className: res.tablePackage
|
|
|
})
|
|
|
- .then((fields) => {
|
|
|
+ .then(fields => {
|
|
|
this.formData = {
|
|
|
...this.formData,
|
|
|
...res,
|
|
|
className: res.className,
|
|
|
tableName: res.tableName,
|
|
|
- genRouter: false,
|
|
|
+ genRouter: false
|
|
|
};
|
|
|
let finalFields = [];
|
|
|
|
|
|
- fields.forEach((field) => {
|
|
|
- let f = this.formData.fields.find((i) => {
|
|
|
+ fields.forEach(field => {
|
|
|
+ let f = this.formData.fields.find(i => {
|
|
|
return (i.modelName = field.modalName);
|
|
|
});
|
|
|
if (f) {
|
|
|
@@ -330,11 +330,11 @@ export default {
|
|
|
this.fields = finalFields;
|
|
|
this.subtables = this.formData.subtables;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
this.loading = false;
|
|
|
});
|
|
|
@@ -344,31 +344,31 @@ export default {
|
|
|
if (this.$route.query.className) {
|
|
|
this.loading = true;
|
|
|
return this.$http.get('/genCode/getOne', {
|
|
|
- className: this.$route.query.className,
|
|
|
+ className: this.$route.query.className
|
|
|
});
|
|
|
} else {
|
|
|
return Promise.resolve();
|
|
|
}
|
|
|
})
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
this.loading = false;
|
|
|
if (res) {
|
|
|
this.$http
|
|
|
.get('/genCode/tableFields', {
|
|
|
- className: res.tablePackage,
|
|
|
+ className: res.tablePackage
|
|
|
})
|
|
|
- .then((fields) => {
|
|
|
+ .then(fields => {
|
|
|
this.formData = {
|
|
|
...this.formData,
|
|
|
...res,
|
|
|
className: res.className,
|
|
|
tableName: res.tableName,
|
|
|
- genRouter: false,
|
|
|
+ genRouter: false
|
|
|
};
|
|
|
let finalFields = [];
|
|
|
|
|
|
- fields.forEach((field) => {
|
|
|
- let f = res.fields.find((item) => {
|
|
|
+ fields.forEach(field => {
|
|
|
+ let f = res.fields.find(item => {
|
|
|
return item.modelName === field.modelName;
|
|
|
});
|
|
|
if (f) {
|
|
|
@@ -380,19 +380,19 @@ export default {
|
|
|
this.fields = finalFields;
|
|
|
this.subtables = this.formData.subtables;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
}
|
|
|
return this.$http.get('/genCode/getSrcPath');
|
|
|
})
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
this.formData.javaPath = res.javaPath;
|
|
|
this.formData.viewPath = res.viewPath;
|
|
|
this.formData.routerPath = res.routerPath;
|
|
|
this.formData.resourcesPath = res.resourcesPath;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
this.$message.error(e.error);
|
|
|
this.loading = false;
|
|
|
@@ -400,26 +400,26 @@ export default {
|
|
|
|
|
|
this.$http
|
|
|
.get('/genCode/all')
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
this.subCodes = res;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
|
|
|
this.$http
|
|
|
.get('/dev/selectMappings')
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
let temp = {};
|
|
|
if (res.length > 0) {
|
|
|
- res.forEach((item) => {
|
|
|
+ res.forEach(item => {
|
|
|
temp[item.url] = item;
|
|
|
});
|
|
|
}
|
|
|
this.selectMappingsJson = temp;
|
|
|
this.selectMappings = res;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
|
|
|
@@ -446,7 +446,7 @@ export default {
|
|
|
{ label: '树形选择', value: 'tree' },
|
|
|
{ label: '开关', value: 'switch' },
|
|
|
{ label: '多行文本', value: 'textarea' },
|
|
|
- { label: '富文本', value: 'richText' },
|
|
|
+ { label: '富文本', value: 'richText' }
|
|
|
],
|
|
|
validatorTypes: [
|
|
|
{ label: '英文', value: 'english' },
|
|
|
@@ -454,7 +454,7 @@ export default {
|
|
|
{ label: '手机', value: 'phone' },
|
|
|
{ label: '网址', value: 'url' },
|
|
|
{ label: '电子邮件', value: 'email' },
|
|
|
- { label: '身份证', value: 'id' },
|
|
|
+ { label: '身份证', value: 'id' }
|
|
|
],
|
|
|
rules: {
|
|
|
className: [
|
|
|
@@ -469,8 +469,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
tableName: [
|
|
|
{ required: true, message: '请填写表名', trigger: 'blur' },
|
|
|
@@ -484,31 +484,31 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
remark: [{ required: true, message: '请填写描述', trigger: 'blur' }],
|
|
|
dataBaseType: [
|
|
|
{
|
|
|
required: true,
|
|
|
message: '请选择数据库类型',
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
dataSourceCode: [
|
|
|
{
|
|
|
required: true,
|
|
|
message: '请填选择数据库',
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
],
|
|
|
typeFlag: [
|
|
|
{
|
|
|
required: true,
|
|
|
message: '请填填写分类',
|
|
|
- trigger: 'blur',
|
|
|
- },
|
|
|
- ],
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
formData: {
|
|
|
tableName: '',
|
|
|
@@ -525,7 +525,7 @@ export default {
|
|
|
dataSourceCode: 'dataSource',
|
|
|
className: '',
|
|
|
subtables: [],
|
|
|
- fields: [],
|
|
|
+ fields: []
|
|
|
},
|
|
|
fields: [],
|
|
|
tableList: [],
|
|
|
@@ -539,19 +539,19 @@ export default {
|
|
|
optionsTableList: [],
|
|
|
optionsFields: [],
|
|
|
showGenOptionsDialog: false,
|
|
|
- tempRow: {},
|
|
|
+ tempRow: {}
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
editableFields() {
|
|
|
- return this.fields.filter((i) => {
|
|
|
+ return this.fields.filter(i => {
|
|
|
return i.name;
|
|
|
});
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
onSave() {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
if (valid) {
|
|
|
this.submit();
|
|
|
} else {
|
|
|
@@ -568,7 +568,7 @@ export default {
|
|
|
.then(() => {
|
|
|
this.loading = true;
|
|
|
return this.$http.post('/genCode/save', this.formData, {
|
|
|
- body: 'json',
|
|
|
+ body: 'json'
|
|
|
});
|
|
|
})
|
|
|
.then(() => {
|
|
|
@@ -576,7 +576,7 @@ export default {
|
|
|
this.$message.success('代码生成成功');
|
|
|
this.$router.go(-1);
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
this.loading = false;
|
|
|
if ('cancel' === e) {
|
|
|
this.$message.info('生成取消');
|
|
|
@@ -596,7 +596,7 @@ export default {
|
|
|
showInList: true,
|
|
|
showInForm: true,
|
|
|
formType: 'singleLineText',
|
|
|
- sortable: true,
|
|
|
+ sortable: true
|
|
|
});
|
|
|
},
|
|
|
removeField(i) {
|
|
|
@@ -608,16 +608,16 @@ export default {
|
|
|
this.tableList = [];
|
|
|
this.$http
|
|
|
.get('/dev/entities')
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
this.tableList = res;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
},
|
|
|
getPackageByTableName(tableName) {
|
|
|
var packageName = '';
|
|
|
- this.tableList.forEach((item) => {
|
|
|
+ this.tableList.forEach(item => {
|
|
|
if (item.name == tableName) {
|
|
|
packageName = item.package;
|
|
|
}
|
|
|
@@ -637,27 +637,27 @@ export default {
|
|
|
},
|
|
|
getTableFields(tableName) {
|
|
|
var data = {
|
|
|
- className: this.getPackageByTableName(tableName),
|
|
|
+ className: this.getPackageByTableName(tableName)
|
|
|
};
|
|
|
this.$http
|
|
|
.get('/genCode/tableFields', data)
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
this.fields = res;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
},
|
|
|
getOptionsTableFields(tableName) {
|
|
|
var data = {
|
|
|
- className: this.getPackageByTableName(tableName),
|
|
|
+ className: this.getPackageByTableName(tableName)
|
|
|
};
|
|
|
this.$http
|
|
|
.get('/genCode/tableFields', data)
|
|
|
- .then((res) => {
|
|
|
+ .then(res => {
|
|
|
this.optionsFields = res;
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
+ .catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
},
|
|
|
@@ -666,7 +666,7 @@ export default {
|
|
|
name: '',
|
|
|
column: '',
|
|
|
subColumn: '',
|
|
|
- subCode: '',
|
|
|
+ subCode: ''
|
|
|
});
|
|
|
},
|
|
|
removeSubtable(i) {
|
|
|
@@ -721,11 +721,11 @@ export default {
|
|
|
editOptions(row) {
|
|
|
this.tempRow = row;
|
|
|
this.showGenOptionsDialog = true;
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
components: {
|
|
|
- GenOptionDialog,
|
|
|
- },
|
|
|
+ GenOptionDialog
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|