From a736b135957021cb96b14a8586b41a93a55322f5 Mon Sep 17 00:00:00 2001
From: sakuya <81883387@qq.com>
Date: Thu, 3 Jun 2021 22:25:12 +0800
Subject: [PATCH] UP 1.1.4
---
package.json | 2 +-
public/code/{table.vue => list/index.vue} | 18 ++--
public/code/list/save.vue | 72 ++++++++++++++
public/code/table-save.vue | 96 ------------------
src/config/index.js | 2 +-
src/style/fix.less | 2 +
src/views/test/autocode/index.vue | 2 +-
src/views/test/autocode/list.vue | 113 +++++++++++++---------
8 files changed, 154 insertions(+), 153 deletions(-)
rename public/code/{table.vue => list/index.vue} (93%)
create mode 100644 public/code/list/save.vue
delete mode 100644 public/code/table-save.vue
diff --git a/package.json b/package.json
index be0edfb8..f15a101e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "SCUI-Admin",
- "version": "1.1.3",
+ "version": "1.1.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
diff --git a/public/code/table.vue b/public/code/list/index.vue
similarity index 93%
rename from public/code/table.vue
rename to public/code/list/index.vue
index 5fba2c3c..6576c71c 100644
--- a/public/code/table.vue
+++ b/public/code/list/index.vue
@@ -62,8 +62,11 @@
},
data() {
return {
- apiObj: this.$API.role.list,
+ apiObj: this.$API.<%= api.list %>,
selection: [],
+ search: {
+ keyword: ""
+ },
saveDialogVisible: false,
saveMode: 'add',
titleMap: {
@@ -88,24 +91,23 @@
this.saveMode = 'edit';
this.saveDialogVisible = true;
this.$nextTick(() => {
- //这里应该再次根据ID查询详情接口
+ //这里可以再次根据ID查询详情接口
this.$refs.saveDialog.setData(row)
})
-
},
//查看
table_show(row){
this.saveMode = 'show';
this.saveDialogVisible = true;
this.$nextTick(() => {
- //这里应该再次根据ID查询详情接口
+ //这里可以再次根据ID查询详情接口
this.$refs.saveDialog.setData(row)
})
},
//删除
async table_del(row, index){
var reqData = {id: row.id}
- var res = await this.$API.user.del.post(reqData);
+ var res = await this.$API.<%= api.del %>.post(reqData);
if(res.code == 200){
//这里选择刷新整个表格 OR 插入/编辑现有表格数据
this.$refs.table.tableData.splice(index, 1);
@@ -116,7 +118,7 @@
},
//批量删除
async batch_del(){
- this.$confirm(`确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`, '提示', {
+ this.$confirm(`确定删除选中的 ${this.selection.length} 项吗?`, '提示', {
type: 'warning'
}).then(() => {
const loading = this.$loading();
@@ -137,7 +139,7 @@
saveForm(){
this.$refs.saveDialog.submit(async (formData) => {
this.isSaveing = true;
- var res = await this.$API.user.save.post(formData);
+ var res = await this.$API.<%= api.save %>.post(formData);
this.isSaveing = false;
if(res.code == 200){
//这里选择刷新整个表格 OR 插入/编辑现有表格数据
@@ -154,7 +156,7 @@
},
//搜索
upsearch(){
-
+
}
}
}
diff --git a/public/code/list/save.vue b/public/code/list/save.vue
new file mode 100644
index 00000000..a83f745c
--- /dev/null
+++ b/public/code/list/save.vue
@@ -0,0 +1,72 @@
+
+
+
+
+ <% column.forEach(function(item, index){ %>
+
+
+
+ <% })%>
+
+
+
+
+
+
diff --git a/public/code/table-save.vue b/public/code/table-save.vue
deleted file mode 100644
index d55f0235..00000000
--- a/public/code/table-save.vue
+++ /dev/null
@@ -1,96 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/config/index.js b/src/config/index.js
index 73d92835..2de351d8 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -3,7 +3,7 @@ const DEFAULT_CONFIG = {
APP_NAME: "SCUI",
//版本号
- APP_VER: "1.1.3",
+ APP_VER: "1.1.4",
//接口地址
API_URL: "",
diff --git a/src/style/fix.less b/src/style/fix.less
index 7dcf56d9..12c4254a 100644
--- a/src/style/fix.less
+++ b/src/style/fix.less
@@ -17,6 +17,8 @@
.el-card__header {border-bottom: 0}
.el-tree.menu .el-tree-node__content {height:36px;}
.el-input-number__decrease, .el-input-number__increase {top:2px;}
+.el-menu-item [class^=sc-icon-] {font-size: 18px;display: inline-block;line-height: 1;}
+.el-menu-item [class^=sc-icon-], .el-submenu [class^=sc-icon-] {margin-right: 5px;vertical-align: middle;width: 24px;text-align: center;}
/* 覆盖tinymce样式 */
.sceditor .tox-tinymce {border: 1px solid #DCDFE6;}
diff --git a/src/views/test/autocode/index.vue b/src/views/test/autocode/index.vue
index e4b8c63e..ad32915a 100644
--- a/src/views/test/autocode/index.vue
+++ b/src/views/test/autocode/index.vue
@@ -27,7 +27,7 @@
return {
list: [
{
- title: "List",
+ title: "CRUD",
des: "配置型生成经典的增删改查列表",
icon: "sc-icon-file-list-fill",
ver: "1.0.0-beta.1",
diff --git a/src/views/test/autocode/list.vue b/src/views/test/autocode/list.vue
index 945130ee..54168794 100644
--- a/src/views/test/autocode/list.vue
+++ b/src/views/test/autocode/list.vue
@@ -4,7 +4,7 @@
-
+
@@ -20,6 +20,11 @@
+
+
+
+
+
@@ -50,27 +55,27 @@
- this.$API.
+ $API.
- this.$API.
+ $API.
- this.$API.
+ $API.
- this.$API.
+ $API.
- this.$API.
+ $API.
@@ -83,11 +88,11 @@
- 下载VUE文件
+ 下载VUE文件
- 下载 index.vue
- 下载 save.vue
+ 下载 index.vue
+ 下载 save.vue
@@ -95,8 +100,8 @@
预览代码
- 预览 index.vue
- 预览 save.vue
+ 预览 index.vue
+ 预览 save.vue
@@ -104,7 +109,7 @@
-
+
{{ code }}
@@ -123,70 +128,86 @@
return {
codeVisible: false,
showcodeLoading: false,
+ downloadcodeLoading: false,
code: '',
base: {
- name: "newPageName",
+ name: "",
rowKey: "id"
},
api: {
- list: 'user.list',
- add: 'user.save',
- save: 'user.save',
- show: 'user.info',
- del: 'user.del'
+ list: '',
+ add: '',
+ save: '',
+ show: '',
+ del: ''
},
- column: [
- {
- label: "ID",
- prop: "id",
- width: "50",
- isSearch: false
- },
- {
- label: "姓名",
- prop: "name",
- width: "100",
- isSearch: true
- }
- ],
+ column: [],
addTemplate: {
label: "",
prop: "",
width: "100",
- isSearch: false
- },
+ isSearch: false,
+ isEdit: false
+ }
}
},
mounted(){
},
methods: {
- //预览
- async showcode(){
+ //列表预览
+ async showListCode(){
this.showcodeLoading = true;
- await this.getTpl()
+ await this.getListTpl()
this.showcodeLoading = false;
this.codeVisible=true;
},
- //同步获取模板文件
- async getTpl(){
+ //获取列表模板文件
+ async getListTpl(){
var data = {
createDate:new Date().toLocaleString(),
base: this.base,
- column: this.column
+ column: this.column,
+ api: this.api
}
- var tpl = await this.$HTTP.get('code/table.vue')
+ var tpl = await this.$HTTP.get('code/list/index.vue')
this.code = template(tpl, data)
},
- //下载按钮
- download(){
- this.createFile(this.code)
+ //详细预览
+ async showSaveCode(){
+ this.showcodeLoading = true;
+ await this.getSaveTpl()
+ this.showcodeLoading = false;
+ this.codeVisible=true;
+ },
+ //获取详细模板文件
+ async getSaveTpl(){
+ var data = {
+ createDate:new Date().toLocaleString(),
+ base: this.base,
+ column: this.column.filter(item => item.isEdit===true),
+ api: this.api
+ }
+ var tpl = await this.$HTTP.get('code/list/save.vue')
+ this.code = template(tpl, data)
+ },
+ async downloadListCode(){
+ this.downloadcodeLoading = true;
+ await this.getListTpl()
+ this.downloadcodeLoading = false;
+ this.createFile(this.code, 'index.vue')
+ },
+ async downloadSaveCode(){
+ this.downloadcodeLoading = true;
+ await this.getSaveTpl()
+ this.downloadcodeLoading = false;
+ this.createFile(this.code, 'save.vue')
},
//创建文件并下载
- createFile(row){
+ createFile(row, name){
const element = document.createElement('a')
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(row))
- element.setAttribute('download', 'index.vue')
+ element.setAttribute('download', name)
element.style.display = 'none'
element.click()
}