diff --git a/template/admin/src/api/setting.js b/template/admin/src/api/setting.js index 42c6e22b3..3a581e0a0 100644 --- a/template/admin/src/api/setting.js +++ b/template/admin/src/api/setting.js @@ -1115,9 +1115,9 @@ export function langCodeTranslate(data) { /** * @description 代码生成 */ -export function codeCurd(data) { +export function codeCrud(data) { return request({ - url: `curd`, + url: `system/crud`, method: 'post', data, }); diff --git a/template/admin/src/api/systemCodeGeneration.js b/template/admin/src/api/systemCodeGeneration.js index 0a4208071..06afebd3e 100644 --- a/template/admin/src/api/systemCodeGeneration.js +++ b/template/admin/src/api/systemCodeGeneration.js @@ -29,7 +29,7 @@ export function crudColumnType() { }); } /** - * @description 代码生成 - 第一步提交 获取CRUD文件存放 + * @description 代码生成 - 第一步提交 */ export function crudFilePath(data) { return request({ @@ -40,44 +40,21 @@ export function crudFilePath(data) { } /** - * @description 管理员添加表单 + * @description 代码生成 - 列表 */ -export function adminFromApi() { +export function crudList(data) { return request({ - url: '/setting/admin/create', + url: '/system/crud', + method: 'get', + params: data, + }); +} +/** + * @description 代码生成 - 列表查看文件 + */ +export function crudDet(id) { + return request({ + url: `/system/crud/${id}`, method: 'get', }); } - -/** - * @description 管理员编辑表单 - * @param {Number} param id {Number} 管理员id - */ -export function adminEditFromApi(id) { - return request({ - url: `/setting/admin/${id}/edit`, - method: 'get', - }); -} - -/** - * @description 管理员删除 - * @param {Number} param id {Number} 管理员id - */ -export function adminDelFromApi(id) { - return request({ - url: `/setting/admin/${id}`, - method: 'DELETE', - }); -} - -/** - * @description 管理员 修改状态 - * @param {Object} param data {Object} 传值 - */ -export function setShowApi(data) { - return request({ - url: `setting/set_status/${data.id}/${data.status}`, - method: 'PUT', - }); -} diff --git a/template/admin/src/pages/system/codeGeneration/components/Field.vue b/template/admin/src/pages/system/codeGeneration/components/Field.vue index 327944cad..61514f079 100644 --- a/template/admin/src/pages/system/codeGeneration/components/Field.vue +++ b/template/admin/src/pages/system/codeGeneration/components/Field.vue @@ -2,26 +2,49 @@
-
- - -
- + --> +
+
+
+
{{ item.name }}
+
{{ item.field }}
+
+
+ +
+ +
+
+ + {{ item.field }} +
+
+
+
+
@@ -35,37 +58,17 @@ export default { return {}; }, }, + rowList: { + type: Array, + default: () => { + return []; + }, + }, }, data() { return { modal: false, rowName: '', - rowList: [ - { - value: 'New York', - label: 'New York', - }, - { - value: 'London', - label: 'London', - }, - { - value: 'Sydney', - label: 'Sydney', - }, - { - value: 'Ottawa', - label: 'Ottawa', - }, - { - value: 'Paris', - label: 'Paris', - }, - { - value: 'Canberra', - label: 'Canberra', - }, - ], columns: [ { title: 'id', @@ -74,46 +77,119 @@ export default { width: 110, }, { - title: 'field', - key: 'field', + title: '操作', + slot: 'action', align: 'center', - minWidth: 110, + width: 110, }, ], dataList: [ { - id: '字段id', - field: '字段field', + name: 'id', + field: 'id', + }, + { + name: '操作', + field: '删除', + slot: true, }, ], + comment: '', + rowData: {}, }; }, created() {}, mounted() {}, methods: { addRow() { - this.modal = true; - }, - add() { - this.dataList[0][this.rowName] = '字段'; - this.$nextTick((e) => { - this.columns.push({ - title: this.rowName, - key: this.rowName, - align: 'center', - minWidth: 110, - }); + if (this.dataList.length >= 10) return this.$Message.warning('最多添加10个'); + let i = this.dataList.length - 1; + // this.modal = true; + this.dataList.splice(i, 0, { + name: '', + field: '', }); }, + changeRow(e) { + this.rowData = e; + this.rowList.map((i) => { + if (i.value === e.value) this.rowData.comment = i.comment; + }); + }, + // add() { + // let i = this.dataList.length - 1; + // console.log(i); + // this.$nextTick((e) => { + // this.dataList.splice(i, 0, { + // name: this.rowData.label, + // field: this.rowData.value, + // }); + // this.comment = ''; + // }); + // }, + delItem(i) { + this.dataList.splice(i, 1); + }, }, }; - diff --git a/template/admin/src/pages/system/codeGeneration/components/FormItem.vue b/template/admin/src/pages/system/codeGeneration/components/FormItem.vue index 7cb5c551d..de5fbaa57 100644 --- a/template/admin/src/pages/system/codeGeneration/components/FormItem.vue +++ b/template/admin/src/pages/system/codeGeneration/components/FormItem.vue @@ -6,7 +6,7 @@
-
@@ -14,7 +14,7 @@
-
@@ -23,7 +23,7 @@
-
+
@@ -41,6 +41,12 @@ export default { return {}; }, }, + rowList: { + type: Array, + default: () => { + return []; + }, + }, }, data() { return { @@ -54,7 +60,6 @@ export default { label: '是', }, ], - rowList: [], reqMetList: [ { value: 0, @@ -77,15 +82,7 @@ export default { label: 'number', }, ], - dataList: [ - { - rowName: 0, - method: 0, - field: '', - required: 0, - textarea: '', - }, - ], + dataList: [], }; }, created() {}, @@ -93,8 +90,8 @@ export default { methods: { addRow() { this.dataList.push({ - rowName: 0, - method: 0, + name: '', + type: '', field: '', required: 0, textarea: '', diff --git a/template/admin/src/pages/system/codeGeneration/components/FoundationForm.vue b/template/admin/src/pages/system/codeGeneration/components/FoundationFor.vue similarity index 90% rename from template/admin/src/pages/system/codeGeneration/components/FoundationForm.vue rename to template/admin/src/pages/system/codeGeneration/components/FoundationFor.vue index 4d5a1cd9e..946cb8ebf 100644 --- a/template/admin/src/pages/system/codeGeneration/components/FoundationForm.vue +++ b/template/admin/src/pages/system/codeGeneration/components/FoundationFor.vue @@ -28,7 +28,7 @@ 是 - +
@@ -42,6 +42,12 @@
+
+ +
diff --git a/template/admin/src/pages/system/codeGeneration/components/StorageLoc.vue b/template/admin/src/pages/system/codeGeneration/components/StorageLoc.vue index 79b1a45e7..518b16611 100644 --- a/template/admin/src/pages/system/codeGeneration/components/StorageLoc.vue +++ b/template/admin/src/pages/system/codeGeneration/components/StorageLoc.vue @@ -1,17 +1,32 @@ - + diff --git a/template/admin/src/pages/system/codeGeneration/list.vue b/template/admin/src/pages/system/codeGeneration/list.vue new file mode 100644 index 000000000..265a25741 --- /dev/null +++ b/template/admin/src/pages/system/codeGeneration/list.vue @@ -0,0 +1,476 @@ + + + + + diff --git a/template/admin/src/router/modules/system.js b/template/admin/src/router/modules/system.js index 487e86cde..eb137e622 100644 --- a/template/admin/src/router/modules/system.js +++ b/template/admin/src/router/modules/system.js @@ -35,6 +35,15 @@ export default { }, component: () => import('@/pages/system/codeGeneration/index'), }, + { + path: 'code_generation_list', + name: `${pre}code_generation_list`, + meta: { + auth: ['system-config-code-generation-list'], + title: '代码生成列表', + }, + component: () => import('@/pages/system/codeGeneration/list'), + }, { path: 'backend_routing', name: `${pre}backend_routing`,