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" <el-input type="textarea"
rows="4" rows="4"
v-model="form.briefIntroduction" /> v-model="form.briefIntroduction" />
<Upload class="m-t-10" <el-upload class="m-t-10"
:limit="3" action="#"
:file-list.sync="pics" list-type="picture-card"
:on-remove="handleAnnexRemove" :on-remove="handlePicRemove"
@onSuccess="uploadPicSuccess"> :limit="3"
<template slot="tip"> :file-list="pics"
<p>最多选择3张图片</p> :on-exceed="handlePicExceed"
</template> :http-request="uploadPicSuccess">
</Upload> <i class="el-icon-plus"></i>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item label="二维码一"> <el-form-item label="二维码一">
<el-input v-model="form.qrCodeOneName" <el-input v-model="form.qrCodeOneName"
@ -221,7 +222,19 @@ export default {
methods: { methods: {
getData () { getData () {
this.$get(`${this.api.queryTeamInfo}?teamId=${this.teamId}`).then(res => { 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 => { }) }).catch(err => { })
}, },
@ -257,7 +270,6 @@ export default {
return this.$confirm(`确定移除 ${file.name}`); return this.$confirm(`确定移除 ${file.name}`);
}, },
handleRemove (field) { handleRemove (field) {
console.log("🚀 ~ file: basic.vue:255 ~ handleRemove ~ field:", field)
Oss.del(this.form[field]) Oss.del(this.form[field])
this.form[field] = '' this.form[field] = ''
}, },
@ -277,11 +289,18 @@ export default {
}, },
// //
uploadPicSuccess (file) { async uploadPicSuccess ({ file }) {
console.log(33, this.pics) 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) Oss.del(file.url)
this.pics = fileList this.pics = fileList
}, },
@ -292,6 +311,11 @@ export default {
if (!form.classificationName) return Util.warningMsg('请输入幼儿园名称') if (!form.classificationName) return Util.warningMsg('请输入幼儿园名称')
if (this.submiting) return false if (this.submiting) return false
this.submiting = true this.submiting = true
//
if (this.pics) {
form.pictureUrl = this.pics.map(e => e.url).join()
}
try { try {
await this.$post(this.api.updateTeamInfo, form).then(res => { await this.$post(this.api.updateTeamInfo, form).then(res => {
Util.successMsg('保存成功!'); Util.successMsg('保存成功!');

@ -35,6 +35,12 @@
<el-input v-model="form.classificationName" /> <el-input v-model="form.classificationName" />
</div> </div>
</el-form-item> </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-form-item label="供应商slogan">
<el-input type="textarea" <el-input type="textarea"
rows="4" rows="4"
@ -70,15 +76,16 @@
<el-input type="textarea" <el-input type="textarea"
rows="4" rows="4"
v-model="form.briefIntroduction" /> v-model="form.briefIntroduction" />
<Upload class="m-t-10" <el-upload class="m-t-10"
:limit="3" action="#"
:file-list.sync="pics" list-type="picture-card"
:on-remove="handleAnnexRemove" :on-remove="handlePicRemove"
@onSuccess="uploadPicSuccess"> :limit="3"
<template slot="tip"> :file-list="pics"
<p>最多选择3张图片</p> :on-exceed="handlePicExceed"
</template> :http-request="uploadPicSuccess">
</Upload> <i class="el-icon-plus"></i>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item label="二维码一"> <el-form-item label="二维码一">
<el-input v-model="form.qrCodeOneName" <el-input v-model="form.qrCodeOneName"
@ -187,11 +194,13 @@ export default {
qrCodeTwoUrl: '', qrCodeTwoUrl: '',
slogan: '', slogan: '',
}, },
classificationId: [],
provinceList: [], provinceList: [],
cityList: [], cityList: [],
pics: [], pics: [],
editing: false, editing: false,
submiting: false, submiting: false,
classifications: []
}; };
}, },
components: { components: {
@ -222,10 +231,47 @@ export default {
methods: { methods: {
getData () { getData () {
this.$get(`${this.api.queryTeamInfo}?teamId=${this.teamId}`).then(res => { 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 => { }) }).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 () { getProvince () {
this.$get(this.api.queryProvince).then(res => { this.$get(this.api.queryProvince).then(res => {
this.provinceList = res.list this.provinceList = res.list
@ -277,11 +323,18 @@ export default {
}, },
// //
uploadPicSuccess (file) { async uploadPicSuccess ({ file }) {
console.log(33, this.pics) 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) Oss.del(file.url)
this.pics = fileList this.pics = fileList
}, },
@ -292,6 +345,21 @@ export default {
if (!form.classificationName) return Util.warningMsg('请输入供应商名称') if (!form.classificationName) return Util.warningMsg('请输入供应商名称')
if (this.submiting) return false if (this.submiting) return false
this.submiting = true 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 { try {
await this.$post(this.api.updateTeamInfo, form).then(res => { await this.$post(this.api.updateTeamInfo, form).then(res => {
Util.successMsg('保存成功!'); Util.successMsg('保存成功!');

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

Loading…
Cancel
Save