From 13c2ac24690c081cef123225d3c2591bfd2ad89f Mon Sep 17 00:00:00 2001 From: BoBoooooo <17746714@qq.com> Date: Fri, 8 Feb 2019 15:27:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=20?= =?UTF-8?q?=E7=B1=BB=E7=9B=AE=20=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FormDesigner/GenerateForm.vue | 1 - src/components/FormDesigner/ListConfig.vue | 14 +- .../FormDesigner/WidgetFormItem.vue | 4 - src/views/system/dict.vue | 121 ++++++++++++++---- 4 files changed, 101 insertions(+), 39 deletions(-) diff --git a/src/components/FormDesigner/GenerateForm.vue b/src/components/FormDesigner/GenerateForm.vue index 7fe129c..2a2a6c5 100644 --- a/src/components/FormDesigner/GenerateForm.vue +++ b/src/components/FormDesigner/GenerateForm.vue @@ -92,7 +92,6 @@ export default { } genList.push({ ...obj }) - console.log(genList) for (let i = 0; i < genList.length; i++) { if (genList[i].type === 'grid') { genList[i].columns.forEach((item) => { diff --git a/src/components/FormDesigner/ListConfig.vue b/src/components/FormDesigner/ListConfig.vue index 59ce86b..8296e8b 100644 --- a/src/components/FormDesigner/ListConfig.vue +++ b/src/components/FormDesigner/ListConfig.vue @@ -147,11 +147,7 @@ - - - - - - + > + + {{ node.label }} + + + 添加 + + + 修改 + + + 删除 + + + + @@ -21,6 +44,38 @@ + + + + + + + + + + + + + + + + + @@ -40,9 +95,20 @@ export default { data() { return { dicttypeoptions: [], + dialogFormVisible: false, + textMap: { + update: '编辑', + create: '新增', + }, status: 'create', dicttypeList: null, - temp: null, + entity: { + id: '', + name: '', + sort: '', + pid: '', + }, + dialogStatus: '', defaultProps: { children: 'children', label: 'nodeName', @@ -59,47 +125,56 @@ export default { }, methods: { - clearObj() { - Object.keys(this.temp).forEach((key) => { - this.temp[key] = '' - }) - this.status = 'create' - }, - fetchDictType() { - GetDictTypeTree().then((response) => { - this.dicttypeList = response.data; - }); - }, - dicttypeTreeClick(obj) { - this.status = 'update' - this.Edit(obj.id) + append(data) { + this.dialogStatus = 'create' + this.clearObj() + this.entity.pid = data.id + this.dialogFormVisible = true }, - - Delete() { + remove(data) { this.$confirm('确认删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }) .then(() => { - DeleteDictType(this.temp.id).then(() => { + DeleteDictType(data.id).then(() => { + this.dialogFormVisible = false this.fetchDictType() }) }) }, + + clearObj() { + Object.keys(this.entity).forEach((key) => { + this.entity[key] = '' + }) + this.status = 'create' + }, + fetchDictType() { + GetDictTypeTree().then((response) => { + this.dicttypeList = response.data; + }); + }, + + Edit(id) { GetDictTypeDetail(id).then((response) => { - this.temp = response.data; + this.entity = response.data; + this.status = 'update' + this.dialogFormVisible = true }); }, save() { if (this.status === 'create') { - AddDictType(this.temp).then(() => { + AddDictType(this.entity).then(() => { this.fetchDictType(); + this.dialogFormVisible = false }) } else { - UpdateDictType(this.temp).then(() => { + UpdateDictType(this.entity).then(() => { this.fetchDictType(); + this.dialogFormVisible = false }) } },