yujialong 11 months ago
parent f9319ef4fb
commit 1e5e311e46
  1. 54
      src/pages/preschool/manage/basic.vue
  2. 96
      src/pages/supplier/manage/basic.vue
  3. 1
      src/pages/supplierClassification/list/index.vue

@ -70,15 +70,16 @@
<el-input type="textarea"
rows="4"
v-model="form.briefIntroduction" />
<Upload class="m-t-10"
:limit="3"
:file-list.sync="pics"
:on-remove="handleAnnexRemove"
@onSuccess="uploadPicSuccess">
<template slot="tip">
<p>最多选择3张图片</p>
</template>
</Upload>
<el-upload class="m-t-10"
action="#"
list-type="picture-card"
:on-remove="handlePicRemove"
:limit="3"
:file-list="pics"
:on-exceed="handlePicExceed"
:http-request="uploadPicSuccess">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="二维码一">
<el-input v-model="form.qrCodeOneName"
@ -221,7 +222,19 @@ export default {
methods: {
getData () {
this.$get(`${this.api.queryTeamInfo}?teamId=${this.teamId}`).then(res => {
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('保存成功!');

@ -35,6 +35,12 @@
<el-input v-model="form.classificationName" />
</div>
</el-form-item>
<el-form-item label="供应商分类">
<el-cascader v-model="classificationId"
:options="classifications"
:props="{ checkStrictly: true, value: 'id',label: 'classificationName' }"
clearable></el-cascader>
</el-form-item>
<el-form-item label="供应商slogan">
<el-input type="textarea"
rows="4"
@ -70,15 +76,16 @@
<el-input type="textarea"
rows="4"
v-model="form.briefIntroduction" />
<Upload class="m-t-10"
:limit="3"
:file-list.sync="pics"
:on-remove="handleAnnexRemove"
@onSuccess="uploadPicSuccess">
<template slot="tip">
<p>最多选择3张图片</p>
</template>
</Upload>
<el-upload class="m-t-10"
action="#"
list-type="picture-card"
:on-remove="handlePicRemove"
:limit="3"
:file-list="pics"
:on-exceed="handlePicExceed"
:http-request="uploadPicSuccess">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="二维码一">
<el-input v-model="form.qrCodeOneName"
@ -187,11 +194,13 @@ export default {
qrCodeTwoUrl: '',
slogan: '',
},
classificationId: [],
provinceList: [],
cityList: [],
pics: [],
editing: false,
submiting: false,
classifications: []
};
},
components: {
@ -222,10 +231,47 @@ export default {
methods: {
getData () {
this.$get(`${this.api.queryTeamInfo}?teamId=${this.teamId}`).then(res => {
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('保存成功!');

@ -70,6 +70,7 @@ export default {
this.getData();
},
methods: {
//
async getData () {
const { list } = await this.$post(this.api.treeStructureList)
this.list = list

Loading…
Cancel
Save