mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
improve: 代码生成优化
This commit is contained in:
parent
8126d15243
commit
cf773ed3cd
@ -212,14 +212,6 @@ export default {
|
||||
created() {
|
||||
this.getCrudMenus();
|
||||
},
|
||||
watch:{
|
||||
tableField:{
|
||||
handler(newArr){
|
||||
|
||||
},
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
disabledInput(index) {
|
||||
@ -281,15 +273,16 @@ export default {
|
||||
}
|
||||
}
|
||||
let i = this.tableField.length;
|
||||
if (this.isCreate) {
|
||||
i = this.tableField.length - 2;
|
||||
}
|
||||
if (this.isDelete) {
|
||||
i = this.tableField.length - 1;
|
||||
}
|
||||
if (this.isCreate && this.isDelete) {
|
||||
i = this.tableField.length - 3;
|
||||
}
|
||||
let spliceIndex = 0;
|
||||
this.tableField.map((e) => {
|
||||
if (e.field === 'create_time' || e.field === 'update_time') {
|
||||
spliceIndex++;
|
||||
}
|
||||
if (e.field === 'delete_time') {
|
||||
spliceIndex++;
|
||||
}
|
||||
});
|
||||
i = this.tableField.length - spliceIndex;
|
||||
this.tableField.splice(i, 0, {
|
||||
field: '',
|
||||
field_type: '',
|
||||
@ -374,10 +367,11 @@ export default {
|
||||
}
|
||||
},
|
||||
changeField(index) {
|
||||
console.log(this.tableField[index].field)
|
||||
if (this.tableField[index].field) {
|
||||
for (let i = 0; i < this.tableField.length; i++) {
|
||||
const e = this.tableField[i];
|
||||
if (['id', 'create_time', 'update_time', 'delete_time'].includes(e.field)) {
|
||||
if (['id', 'create_time', 'update_time', 'delete_time'].includes(this.tableField[index].field)) {
|
||||
this.$Message.warning('列表中已存在该字段名称');
|
||||
this.tableField[index].field = '';
|
||||
return;
|
||||
|
||||
@ -109,9 +109,11 @@ export default {
|
||||
this.formItem.foundation.menuName = data.menuName;
|
||||
this.$refs.TableForm.tableField = data.tableField;
|
||||
this.formItem.storage = data.filePath;
|
||||
let i = 0;
|
||||
data.tableField.map((e) => {
|
||||
if (e.field === 'create_time') {
|
||||
this.$refs.TableForm.isCreate = true;
|
||||
if (e.field === 'create_time' || e.field === 'update_time') {
|
||||
i++;
|
||||
if (i == 2) this.$refs.TableForm.isCreate = true;
|
||||
}
|
||||
if (e.field === 'delete_time') {
|
||||
this.$refs.TableForm.isDelete = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user