From abc6017ece923c24e62c02073299bd3f333e69ee Mon Sep 17 00:00:00 2001
From: z_yu <1534695664@qq.com>
Date: Wed, 15 Jun 2022 13:58:17 +0800
Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E7=B1=BB=E7=AE=A1=E7=90=86=20?=
=?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../category/descriptionPreview/index.vue | 40 ++++++-----
src/views/components/category/PreviewForm.vue | 70 +++++--------------
src/views/components/category/SettingForm.vue | 62 ++++++++--------
3 files changed, 70 insertions(+), 102 deletions(-)
diff --git a/src/views/category/descriptionPreview/index.vue b/src/views/category/descriptionPreview/index.vue
index e54bbd3..243faa6 100644
--- a/src/views/category/descriptionPreview/index.vue
+++ b/src/views/category/descriptionPreview/index.vue
@@ -68,6 +68,7 @@
import PreviewForm from '@/views/components/category/PreviewForm'
import SettingForm from '@/views/components/category/SettingForm'
import { FetchArchivesTypeManage } from '@/api/category/category'
+import { edit } from '@/api/category/fieldManage'
export default {
name: 'DescriptionPreview',
components: { PreviewForm, SettingForm },
@@ -86,12 +87,12 @@ export default {
settingFormVisible: false, // 修改编辑字段 - dialog
previewFormVisible: false, // 界面预览form - dialog
fieldsActive: 0, // 当前字段index
- thisFields: {} // 当前项字段内容
+ thisFields: { dictionaryConfigId: { dicName: null, id: null }} // 当前项字段内容
}
},
watch: {
selectedCategory: function(newValue, oldValue) {
- this.crud.refresh()
+ this.getArchivesType()
}
},
mounted() {
@@ -100,20 +101,15 @@ export default {
methods: {
getArchivesType() {
FetchArchivesTypeManage({ categoryId: this.selectedCategory.id }).then(res => {
- this.allFieldsData = res
- console.log(this.allFieldsData)
- this.allFieldsData.forEach((item, index) => {
+ res.forEach((item, index) => {
// 防止对应字典是null时报错
- item.dictionaryConfigId = item.dictionaryConfigId || { dicName: '', id: null }
- // if (item.isInput) {
- // console.log(item)
- // this.fieldsActive = index
- // this.thisFields = arr[this.fieldsActive]
- // return
- // }
+ item.dictionaryConfigId = item.dictionaryConfigId || { dicName: null, id: null }
+ this.allFieldsData.push(item)
+ if (item.isInput && !this.thisFields.id) {
+ this.fieldsActive = index
+ this.thisFields = item
+ }
})
- this.thisFields = this.allFieldsData.find((item) => { return item.isInput })
- this.fieldsActive = this.allFieldsData.findIndex((item) => { return item.isInput })
})
},
handleClose(done) {
@@ -133,10 +129,18 @@ export default {
},
// 修改字段"保存"提交
editSubmit() {
- this.$refs.editForm.submitForm('form')
- },
- editResetForm() {
- this.$refs.editForm.resetForm('form')
+ this.$refs['editForm'].$refs['form'].validate(valid => {
+ if (!valid) {
+ return
+ }
+ edit(this.thisFields).then(() => {
+ this.settingFormVisible = false
+ // 清空数组数据
+ this.allFieldsData.splice(0, this.allFieldsData.length)
+ this.getArchivesType()
+ })
+ })
+ return false
}
}
}
diff --git a/src/views/components/category/PreviewForm.vue b/src/views/components/category/PreviewForm.vue
index e9874f2..86c06d9 100644
--- a/src/views/components/category/PreviewForm.vue
+++ b/src/views/components/category/PreviewForm.vue
@@ -5,44 +5,14 @@