From 1e5e311e4641a450d5f60a3c67e7c3e9c9012cfa Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Fri, 29 Dec 2023 15:18:41 +0800
Subject: [PATCH] fix
---
src/pages/preschool/manage/basic.vue | 54 ++++++++---
src/pages/supplier/manage/basic.vue | 96 ++++++++++++++++---
.../supplierClassification/list/index.vue | 1 +
3 files changed, 122 insertions(+), 29 deletions(-)
diff --git a/src/pages/preschool/manage/basic.vue b/src/pages/preschool/manage/basic.vue
index fa051ea..7543b35 100644
--- a/src/pages/preschool/manage/basic.vue
+++ b/src/pages/preschool/manage/basic.vue
@@ -70,15 +70,16 @@
-
-
- 最多选择3张图片
-
-
+
+
+
{
- Object.assign(this.form, res.teamInfo)
+ const data = res.teamInfo
+ Object.assign(this.form, data)
+
+ // 描述图片回显
+ if (data.pictureUrl) {
+ const urls = data.pictureUrl.split(',')
+ this.pics = urls.map(e => {
+ return {
+ name: e,
+ url: e
+ }
+ })
+ }
}).catch(err => { })
},
@@ -257,7 +270,6 @@ export default {
return this.$confirm(`确定移除 ${file.name}?`);
},
handleRemove (field) {
- console.log("🚀 ~ file: basic.vue:255 ~ handleRemove ~ field:", field)
Oss.del(this.form[field])
this.form[field] = ''
},
@@ -277,11 +289,18 @@ export default {
},
- // 附件上传成功
- uploadPicSuccess (file) {
- console.log(33, this.pics)
+ // 简介自定义上传
+ async uploadPicSuccess ({ file }) {
+ Oss.upload(file).then(({ url }) => {
+ this.pics.push({
+ url
+ })
+ })
+ },
+ handlePicExceed (files, fileList) {
+ Util.warningMsg(`当前限制选择 3 个文件,如需更换,请删除上一个文件再重新选择!`);
},
- handleAnnexRemove (file, fileList) {
+ handlePicRemove (file, fileList) {
Oss.del(file.url)
this.pics = fileList
},
@@ -292,6 +311,11 @@ export default {
if (!form.classificationName) return Util.warningMsg('请输入幼儿园名称')
if (this.submiting) return false
this.submiting = true
+
+ // 简介图片处理
+ if (this.pics) {
+ form.pictureUrl = this.pics.map(e => e.url).join()
+ }
try {
await this.$post(this.api.updateTeamInfo, form).then(res => {
Util.successMsg('保存成功!');
diff --git a/src/pages/supplier/manage/basic.vue b/src/pages/supplier/manage/basic.vue
index 86b247d..0d99ab6 100644
--- a/src/pages/supplier/manage/basic.vue
+++ b/src/pages/supplier/manage/basic.vue
@@ -35,6 +35,12 @@
+
+
+
-
-
- 最多选择3张图片
-
-
+
+
+
{
- Object.assign(this.form, res.teamInfo)
+ const data = res.teamInfo
+ Object.assign(this.form, data)
+
+ // 分类回显
+ const type = res.supplierClassification
+ if (type && type.length) {
+ this.classificationId = [type[0].supplierClassificationId]
+ }
+
+ // 描述图片回显
+ if (data.pictureUrl) {
+ const urls = data.pictureUrl.split(',')
+ this.pics = urls.map(e => {
+ return {
+ name: e,
+ url: e
+ }
+ })
+ }
+ this.getClassifications()
}).catch(err => { })
},
+ // 获取供应商分类
+ async getClassifications () {
+ const { list } = await this.$post(this.api.treeStructureList)
+ this.classifications = list[0].children
+ this.handleClassifications(this.classifications, this.classificationId[0])
+ },
+ // 递归处理供应商分类
+ handleClassifications (list, id, parent) {
+ for (const e of list) {
+ if (e.id === id) {
+ this.classificationId = parent ? [parent.id, e.id] : [e.id]
+ // break
+ } else {
+ this.handleClassifications(e.children, id, e)
+ }
+ if (!e.children.length) delete e.children
+ }
+ },
getProvince () {
this.$get(this.api.queryProvince).then(res => {
this.provinceList = res.list
@@ -277,11 +323,18 @@ export default {
},
- // 附件上传成功
- uploadPicSuccess (file) {
- console.log(33, this.pics)
+ // 简介自定义上传
+ async uploadPicSuccess ({ file }) {
+ Oss.upload(file).then(({ url }) => {
+ this.pics.push({
+ url
+ })
+ })
+ },
+ handlePicExceed (files, fileList) {
+ Util.warningMsg(`当前限制选择 3 个文件,如需更换,请删除上一个文件再重新选择!`);
},
- handleAnnexRemove (file, fileList) {
+ handlePicRemove (file, fileList) {
Oss.del(file.url)
this.pics = fileList
},
@@ -292,6 +345,21 @@ export default {
if (!form.classificationName) return Util.warningMsg('请输入供应商名称')
if (this.submiting) return false
this.submiting = true
+
+ // 简介图片处理
+ if (this.pics) {
+ form.pictureUrl = this.pics.map(e => e.url).join()
+ }
+
+ // 选择了供应商分类,则保存分类
+ const type = this.classificationId
+ if (type.length) {
+ form.supplierClassificationConfigs = [
+ {
+ classificationId: type[type.length - 1]
+ }
+ ]
+ }
try {
await this.$post(this.api.updateTeamInfo, form).then(res => {
Util.successMsg('保存成功!');
diff --git a/src/pages/supplierClassification/list/index.vue b/src/pages/supplierClassification/list/index.vue
index f95a09f..2a6f041 100644
--- a/src/pages/supplierClassification/list/index.vue
+++ b/src/pages/supplierClassification/list/index.vue
@@ -70,6 +70,7 @@ export default {
this.getData();
},
methods: {
+ // 获取分类
async getData () {
const { list } = await this.$post(this.api.treeStructureList)
this.list = list