This commit is contained in:
2024-05-31 13:54:44 +08:00
2 changed files with 92 additions and 10 deletions

View File

@@ -409,6 +409,7 @@ export default {
children: [], children: [],
delFlag: 0, delFlag: 0,
isLast: 0, isLast: 0,
icon:'',
pid: data.id, pid: data.id,
sort: 0, sort: 0,
title: "" title: ""

View File

@@ -32,6 +32,7 @@
> >
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort" class="form_item"> <el-form-item label="排序" prop="sort" class="form_item">
<el-input-number <el-input-number
placeholder="请输入标签排序" placeholder="请输入标签排序"
@@ -44,6 +45,34 @@
> >
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
<el-form-item
label="封面图"
prop="icon"
label-width="120px"
class="form_item"
>
<div style="display:flex; align-items:center">
<div>
<el-upload
class="avatar-uploader"
:action="baseUrl + '/oss/fileoss'"
:show-file-list="false"
:on-success="handlePicSuccess"
>
<!-- <img v-if="!refreshImg" :src="addForm.images" class="avatar"> -->
<img v-if="fimages" :src="fimages" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
<div>
<div v-if="fimages != ''">
<el-tag class="delImgBtn" @click="delImg()" type="danger"
>清空图片</el-tag
>
</div>
</div>
</div>
</el-form-item>
<el-form-item <el-form-item
label="是否为最终级" label="是否为最终级"
prop="isLast" prop="isLast"
@@ -61,6 +90,7 @@
> >
</el-switch> </el-switch>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div <div
@@ -301,6 +331,7 @@
</template> </template>
<script> <script>
import global from "../../common/common.vue"; //引入共用组间
import debounce from "lodash/debounce"; //导入lodash中的debounce import debounce from "lodash/debounce"; //导入lodash中的debounce
import AddOrUpdate from "@/views/components/commonBookTags/bookTagsForm.vue"; import AddOrUpdate from "@/views/components/commonBookTags/bookTagsForm.vue";
import commonShop from "@/views/components/commonBookTags/shopproduct.vue"; import commonShop from "@/views/components/commonBookTags/shopproduct.vue";
@@ -310,6 +341,7 @@ import commonTree from "@/views/components/commonBookTags/tags.vue";
export default { export default {
data() { data() {
return { return {
baseUrl: global.baseUrl,
isEdit: false, isEdit: false,
checkAll: false, checkAll: false,
isIndeterminate: true, isIndeterminate: true,
@@ -334,6 +366,7 @@ export default {
} }
] ]
}, },
fimages:'',
currentNode: {}, currentNode: {},
treeDataList: [], treeDataList: [],
associatedGoodsList: [], //已关联商品列表 associatedGoodsList: [], //已关联商品列表
@@ -489,6 +522,7 @@ export default {
console.log("🚀 ~ getCommonShopDataList ~ type, id:", type, id); console.log("🚀 ~ getCommonShopDataList ~ type, id:", type, id);
this.currentNode = { data: { ...form } }; this.currentNode = { data: { ...form } };
this.addForm = form; this.addForm = form;
this.fimages = this.addForm.icon
await this.getDataList(); await this.getDataList();
// this.$refs.commonTree.setCurrentNodeShow(); // this.$refs.commonTree.setCurrentNodeShow();
@@ -506,7 +540,18 @@ export default {
} }
}); });
}, },
delImg() {
this.fimages = "";
this.addForm.icon = "";
},
handlePicSuccess(res, file) {
// console.log(res,'res')
// if (res.msg == "success") {
this.fimages = res.url;
this.addForm.icon = res.url;
this.$message.success("上传成功");
console.log(this.fimages, this.addForm.icon, "上传");
},
//新增修改 //新增修改
dataFormSubmit: debounce(async function(formName) { dataFormSubmit: debounce(async function(formName) {
// return false // return false
@@ -514,6 +559,8 @@ export default {
this.$message.error("请输入标签名称"); this.$message.error("请输入标签名称");
return false; return false;
} }
console.log(this.addForm, "this.addForm-----------");
await this.$refs[formName].validate(async valid => { await this.$refs[formName].validate(async valid => {
if (valid) { if (valid) {
await this.$http({ await this.$http({
@@ -531,7 +578,7 @@ export default {
this.$nextTick(async () => { this.$nextTick(async () => {
this.$refs.commonTree.setCurrentNodeShow(data.Medical.id); this.$refs.commonTree.setCurrentNodeShow(data.Medical.id);
this.fimages = data.market.icon
this.addForm = data.market; this.addForm = data.market;
this.currentNode = { data: { ...data.Medical } }; this.currentNode = { data: { ...data.Medical } };
this.$message({ this.$message({
@@ -547,7 +594,7 @@ export default {
this.$message.error(data.msg); this.$message.error(data.msg);
setTimeout(() => { setTimeout(() => {
this.addForm = { ...this.currentNode.data }; this.addForm = { ...this.currentNode.data };
},500) }, 500);
// console.log('this.addForm at line 550:', this.addForm) // console.log('this.addForm at line 550:', this.addForm)
// console.log('this.addForm at line 550:', this.currentNode) // console.log('this.addForm at line 550:', this.currentNode)
@@ -586,7 +633,7 @@ export default {
url: this.$http.adornUrl(`${this.urlList.deleteShop}`), url: this.$http.adornUrl(`${this.urlList.deleteShop}`),
method: "POST", method: "POST",
data: { data: {
id: row[0].bindId, id: row[0].bindId
// marketId: this.addForm.id // marketId: this.addForm.id
}, },
header: { header: {
@@ -648,6 +695,7 @@ export default {
children: [], children: [],
delFlag: 0, delFlag: 0,
isLast: 0, isLast: 0,
icon: "",
pid: data.id, pid: data.id,
sort: 0, sort: 0,
title: "" title: ""
@@ -669,7 +717,8 @@ export default {
isLast: 0, isLast: 0,
pid: 0, pid: 0,
sort: 0, sort: 0,
title: "" title: "",
icon: ""
}; };
this.handleClickNodes({ data: addform }, addform, "add"); this.handleClickNodes({ data: addform }, addform, "add");
// if (!this.currentNode) { // if (!this.currentNode) {
@@ -976,6 +1025,38 @@ export default {
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.delImgBtn {
cursor: pointer;
display: inline-block;
margin-left: 10px;
}
.el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
border: 1px dashed #d9d9d9;
border-color: #409eff;
font-size: 28px;
color: #8c939d;
width: 70px;
height: 70px;
line-height: 70px;
text-align: center;
}
.avatar {
width: 70px;
border: 1px dashed #409eff;
// border-color: #409eff;
height: 70px;
display: block;
}
.tree_box { .tree_box {
width: 350px !important; width: 350px !important;
height: 100%; height: 100%;
@@ -1122,7 +1203,7 @@ p {
overflow: hidden; overflow: hidden;
.form_item { .form_item {
width: 33%; width: 25%;
float: left; float: left;
} }
} }