3 changed files with 537 additions and 569 deletions
@ -1,357 +1,359 @@ |
|||||
<template> |
<template> |
||||
<div class="user-edit"> |
<div class="user-edit"> |
||||
<!-- Drawer抽屉 --> |
<!-- Drawer抽屉 --> |
||||
<Drawer |
<Drawer :title="title" v-model="visible" width="720" draggable :mask-closable="type == '0'"> |
||||
:title="title" |
<div :style="{ maxHeight: maxHeight }" class="drawer-content"> |
||||
v-model="visible" |
|
||||
width="720" |
|
||||
draggable |
|
||||
:mask-closable="type == '0'" |
|
||||
> |
|
||||
<div :style="{ maxHeight: maxHeight }" class="drawer-content"> |
|
||||
|
|
||||
|
|
||||
<Form |
<Form ref="form" :model="form" :rules="formValidate" label-position="top"> |
||||
ref="form" |
<Row :gutter="32"> |
||||
:model="form" |
<Col span="12"> |
||||
:rules="formValidate" |
<FormItem label="店铺名称" prop="shopName"> |
||||
label-position="top" |
<Input v-model="form.shopName" autocomplete="off" :maxlength="16" /> |
||||
> |
</FormItem> |
||||
<Row :gutter="32" > |
</Col> |
||||
<Col span="12"> |
<Col span="12"> |
||||
<FormItem label="店铺名称" prop="shopName"> |
<FormItem label="店铺图标" class="form-noheight"> |
||||
<Input |
<upload-pic-input v-model="form.shopIcon"></upload-pic-input> |
||||
v-model="form.shopName" |
</FormItem> |
||||
autocomplete="off" |
</Col> |
||||
:maxlength="16" |
</Row> |
||||
/> |
<Row :gutter="32"> |
||||
</FormItem> |
<Col span="12"> |
||||
</Col> |
<FormItem label="所属区域" class="form-noheight"> |
||||
<Col span="12"> |
<shopArea-tree-choose @on-change="handleSelectShopAreaTree" |
||||
<FormItem label="店铺图标" class="form-noheight"> |
ref="shopAreaTree"></shopArea-tree-choose> |
||||
<upload-pic-input v-model="form.shopIcon"></upload-pic-input> |
</FormItem> |
||||
</FormItem> |
</Col> |
||||
</Col> |
<Col span="12"> |
||||
</Row> |
<FormItem label="店铺分类" class="form-noheight"> |
||||
<Row :gutter="32"> |
<dict dict="shopType" v-model="form.shopType" transfer /> |
||||
<Col span="12"> |
</FormItem> |
||||
<FormItem label="所属区域" class="form-noheight"> |
</Col> |
||||
<shopArea-tree-choose |
</Row> |
||||
@on-change="handleSelectShopAreaTree" |
<Row :gutter="32"> |
||||
ref="shopAreaTree" |
<Col span="24"> |
||||
></shopArea-tree-choose> |
<FormItem label="店铺详细地址" prop="shopAddress"> |
||||
</FormItem> |
<Input v-model="form.shopAddress" /> |
||||
</Col> |
</FormItem> |
||||
<Col span="12"> |
</Col> |
||||
<FormItem label="店铺分类" class="form-noheight"> |
</Row> |
||||
<dict dict="shopType" v-model="form.shopType" transfer /> |
<Row :gutter="32"> |
||||
</FormItem> |
<Col span="12"> |
||||
</Col> |
<FormItem label="联系方式" prop="contactPhone"> |
||||
</Row> |
<Input v-model="form.contactPhone" autocomplete="off" :maxlength="16" /> |
||||
<Row :gutter="32"> |
</FormItem> |
||||
<Col span="24"> |
</Col> |
||||
<FormItem label="店铺详细地址" prop="shopAddress"> |
<Col span="12"> |
||||
<Input v-model="form.shopAddress" /> |
<FormItem label="副标题" prop="contactPhone"> |
||||
</FormItem> |
<Input v-model="form.subtitle" autocomplete="off" :maxlength="16" /> |
||||
</Col> |
</FormItem> |
||||
</Row> |
</Col> |
||||
<Row :gutter="32" > |
</Row> |
||||
<Col span="12"> |
<Row :gutter="32"> |
||||
<FormItem label="联系方式" prop="contactPhone"> |
<Col span="12"> |
||||
<Input |
<FormItem label="支付宝账号" prop="contactPhone"> |
||||
v-model="form.contactPhone" |
<Input v-model="form.aliAccount" autocomplete="off" :maxlength="16" /> |
||||
autocomplete="off" |
</FormItem> |
||||
:maxlength="16" |
</Col> |
||||
/> |
<Col span="12"> |
||||
</FormItem> |
<FormItem label="支付宝户名" prop="contactPhone"> |
||||
</Col> |
<Input v-model="form.aliName" autocomplete="off" :maxlength="16" /> |
||||
<Col span="12"> |
</FormItem> |
||||
<FormItem label="副标题" prop="contactPhone"> |
</Col> |
||||
<Input |
</Row> |
||||
v-model="form.subtitle" |
<Row :gutter="32"> |
||||
autocomplete="off" |
<Col span="12"> |
||||
:maxlength="16" |
<FormItem label="排名" prop="shoprank"> |
||||
/> |
<Input v-model="form.shoprank" autocomplete="off" :maxlength="16" /> |
||||
</FormItem> |
</FormItem> |
||||
</Col> |
</Col> |
||||
</Row> |
</Row> |
||||
<Row :gutter="32" > |
<Row :gutter="32"> |
||||
<Col span="12"> |
|
||||
<FormItem label="支付宝账号" prop="contactPhone"> |
|
||||
<Input |
|
||||
v-model="form.aliAccount" |
|
||||
autocomplete="off" |
|
||||
:maxlength="16" |
|
||||
/> |
|
||||
</FormItem> |
|
||||
</Col> |
|
||||
<Col span="12"> |
|
||||
<FormItem label="支付宝户名" prop="contactPhone"> |
|
||||
<Input |
|
||||
v-model="form.aliName" |
|
||||
autocomplete="off" |
|
||||
:maxlength="16" |
|
||||
/> |
|
||||
</FormItem> |
|
||||
</Col> |
|
||||
</Row> |
|
||||
<Row :gutter="32" > |
|
||||
<Col span="12"> |
|
||||
<FormItem label="排名" prop="shoprank"> |
|
||||
<Input |
|
||||
v-model="form.shoprank" |
|
||||
autocomplete="off" |
|
||||
:maxlength="16" |
|
||||
/> |
|
||||
</FormItem> |
|
||||
</Col> |
|
||||
</Row> |
|
||||
<Row :gutter="32"> |
|
||||
|
|
||||
<Col span="24"> |
<Col span="24"> |
||||
<FormItem label="备注"> |
<FormItem label="备注"> |
||||
<Input type="textarea" v-model="form.remark" :rows="4" /> |
<Input type="textarea" v-model="form.remark" :rows="4" /> |
||||
</FormItem> |
</FormItem> |
||||
</Col> |
</Col> |
||||
</Row> |
</Row> |
||||
<Divider /> |
<Divider /> |
||||
|
|
||||
|
|
||||
|
|
||||
</Form> |
</Form> |
||||
</div> |
</div> |
||||
<div class="drawer-footer br" v-show="type != '0'"> |
<div class="drawer-footer br" v-show="type != '0'"> |
||||
<Button type="primary" :loading="submitLoading" @click="submit" |
<Button type="primary" :loading="submitLoading" @click="submit">提交</Button> |
||||
>提交</Button |
<Button @click="visible = false">取消</Button> |
||||
> |
</div> |
||||
<Button @click="visible = false">取消</Button> |
</Drawer> |
||||
</div> |
</div> |
||||
</Drawer> |
|
||||
</div> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import {getUsersByRoleName,getDictDataByType} from "@/api/index"; |
import { |
||||
import { |
getUsersByRoleName, |
||||
validateUsername, |
getDictDataByType |
||||
validateMobile, |
} from "@/api/index"; |
||||
validatePassword, |
import { |
||||
} from "@/libs/validate"; |
validateUsername, |
||||
import shopAreaTreeChoose from "@/views/my-components/hiver/shopArea-tree-choose"; |
validateMobile, |
||||
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input"; |
validatePassword, |
||||
import SetPassword from "@/views/my-components/hiver/set-password"; |
} from "@/libs/validate"; |
||||
import dict from "@/views/my-components/hiver/dict"; |
import shopAreaTreeChoose from "@/views/my-components/hiver/shopArea-tree-choose"; |
||||
import {addShop, editShop} from "@/api/app"; |
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input"; |
||||
export default { |
import SetPassword from "@/views/my-components/hiver/set-password"; |
||||
name: "addEdit", |
import dict from "@/views/my-components/hiver/dict"; |
||||
components: { |
import { |
||||
shopAreaTreeChoose, |
addShop, |
||||
uploadPicInput, |
editShop, |
||||
SetPassword, |
initShopArea, |
||||
dict, |
loadShopArea, |
||||
}, |
} from "@/api/app"; |
||||
props: { |
export default { |
||||
value: { |
name: "addEdit", |
||||
type: Boolean, |
components: { |
||||
default: false, |
shopAreaTreeChoose, |
||||
}, |
uploadPicInput, |
||||
data: { |
SetPassword, |
||||
type: Object, |
dict, |
||||
}, |
}, |
||||
type: { |
props: { |
||||
type: String, |
value: { |
||||
default: "0", |
type: Boolean, |
||||
}, |
default: false, |
||||
}, |
}, |
||||
data() { |
data: { |
||||
return { |
type: Object, |
||||
roleList: [], |
}, |
||||
roleList2: [], |
type: { |
||||
shopAreaList: [], |
type: String, |
||||
businessDistrictLevelList: [], |
default: "0", |
||||
visible: this.value, |
}, |
||||
title: "", |
}, |
||||
passColor: "", |
data() { |
||||
submitLoading: false, |
return { |
||||
maxHeight: 510, |
roleList: [], |
||||
form: { |
roleList2: [], |
||||
address: [], |
shopAreaList: [], |
||||
}, |
businessDistrictLevelList: [], |
||||
formValidate: { |
visible: this.value, |
||||
// 表单验证规则 |
title: "", |
||||
username: [ |
passColor: "", |
||||
{ required: true, message: "请输入登录账号", trigger: "blur" }, |
submitLoading: false, |
||||
{ validator: validateUsername, trigger: "blur" }, |
maxHeight: 510, |
||||
], |
form: { |
||||
nickname: [ |
address: [], |
||||
{ required: true, message: "请输入用户名", trigger: "blur" }, |
}, |
||||
], |
formValidate: { |
||||
mobile: [ |
// 表单验证规则 |
||||
{ required: true, message: "请输入手机号", trigger: "blur" }, |
username: [{ |
||||
{ validator: validateMobile, trigger: "blur" }, |
required: true, |
||||
], |
message: "请输入登录账号", |
||||
password: [ |
trigger: "blur" |
||||
{ required: true, message: "请输入密码", trigger: "blur" }, |
}, |
||||
{ validator: validatePassword, trigger: "blur" }, |
{ |
||||
], |
validator: validateUsername, |
||||
email: [ |
trigger: "blur" |
||||
{ required: true, message: "请输入邮箱地址" }, |
}, |
||||
{ type: "email", message: "邮箱格式不正确" }, |
], |
||||
], |
nickname: [{ |
||||
}, |
required: true, |
||||
}; |
message: "请输入用户名", |
||||
}, |
trigger: "blur" |
||||
methods: { |
}, ], |
||||
init() { |
mobile: [{ |
||||
this.getRoleList(); |
required: true, |
||||
}, |
message: "请输入手机号", |
||||
getRoleList() { |
trigger: "blur" |
||||
getUsersByRoleName("ROLE_OWNER").then((res) => { |
}, |
||||
if (res.success) { |
{ |
||||
this.roleList = res.result; |
validator: validateMobile, |
||||
} |
trigger: "blur" |
||||
}); |
}, |
||||
getUsersByRoleName("ROLE_MANAGER").then((res) => { |
], |
||||
if (res.success) { |
password: [{ |
||||
this.roleList2 = res.result; |
required: true, |
||||
} |
message: "请输入密码", |
||||
}); |
trigger: "blur" |
||||
getDictDataByType("mallMuseumType").then((res) => { |
}, |
||||
if (res.success) { |
{ |
||||
this.businessDistrictLevelList = res.result; |
validator: validatePassword, |
||||
} |
trigger: "blur" |
||||
}); |
}, |
||||
getDictDataByType("mallRegion").then((res) => { |
], |
||||
if (res.success) { |
email: [{ |
||||
this.shopAreaList = res.result; |
required: true, |
||||
} |
message: "请输入邮箱地址" |
||||
}); |
}, |
||||
getDictDataByType("shopType").then((res) => { |
{ |
||||
if (res.success) { |
type: "email", |
||||
this.shopType = res.result; |
message: "邮箱格式不正确" |
||||
} |
}, |
||||
}); |
], |
||||
}, |
}, |
||||
handleSelectShopAreaTree(v) { |
}; |
||||
this.form.shopArea = v; |
}, |
||||
}, |
methods: { |
||||
changePass(v, grade, strength) { |
init(v) { |
||||
this.form.passStrength = strength; |
console.log("111") |
||||
}, |
this.getRoleList(v); |
||||
submit() { |
}, |
||||
this.$refs.form.validate((valid) => { |
getRoleList(v) { |
||||
if (valid) { |
getUsersByRoleName("ROLE_OWNER").then((res) => { |
||||
if (typeof this.form.chargeTime == "object") { |
if (res.success) { |
||||
this.form.chargeTime = this.format(this.form.chargeTime, "yyyy-MM-dd"); |
this.roleList = res.result; |
||||
} |
} |
||||
if (typeof this.form.startTime == "object") { |
}); |
||||
this.form.startTime = this.format(this.form.startTime, "yyyy-MM-dd"); |
getUsersByRoleName("ROLE_MANAGER").then((res) => { |
||||
} |
if (res.success) { |
||||
if (typeof this.form.endTime == "object") { |
this.roleList2 = res.result; |
||||
this.form.endTime = this.format(this.form.endTime, "yyyy-MM-dd"); |
} |
||||
} |
}); |
||||
debugger; |
getDictDataByType("mallMuseumType").then((res) => { |
||||
if(this.form.users == '' || this.form.users == null){ |
if (res.success) { |
||||
delete this.form.users; |
this.businessDistrictLevelList = res.result; |
||||
} |
} |
||||
// 处理商品分类的名称 |
}); |
||||
if(this.form.shopType != '' && this.form.shopType != null){ |
initShopArea().then((res) => { |
||||
this.shopType.forEach(item => { |
|
||||
debugger; |
if (res.success) { |
||||
if (this.form.shopType == item.value) { |
res.result.forEach(function(e) { |
||||
this.form.shopTypeTitle = item.title; |
if (e.isParent) { |
||||
} |
e.loading = false; |
||||
}); |
e.children = []; |
||||
} |
e._loading = false; |
||||
this.form.shopMangerId = this.form.shopOwnerId |
} |
||||
if (this.type == "1") { |
}); |
||||
// 编辑 |
this.data = res.result; |
||||
this.submitLoading = true; |
} |
||||
delete this.form.products |
}); |
||||
delete this.form.saleCount |
getDictDataByType("shopType").then((res) => { |
||||
delete this.form.shopTakeaway |
if (res.success) { |
||||
|
this.shopType = res.result; |
||||
editShop(this.form).then((res) => { |
} |
||||
this.submitLoading = false; |
}); |
||||
if (res.success) { |
}, |
||||
this.$Message.success("操作成功"); |
handleSelectShopAreaTree(v) { |
||||
this.$emit("on-submit", true); |
this.form.shopArea = v; |
||||
this.visible = false; |
}, |
||||
} |
changePass(v, grade, strength) { |
||||
}); |
this.form.passStrength = strength; |
||||
} else { |
}, |
||||
// 添加 |
submit() { |
||||
this.submitLoading = true; |
this.$refs.form.validate((valid) => { |
||||
addShop(this.form).then((res) => { |
if (valid) { |
||||
this.submitLoading = false; |
if (typeof this.form.chargeTime == "object") { |
||||
if (res.success) { |
this.form.chargeTime = this.format(this.form.chargeTime, "yyyy-MM-dd"); |
||||
this.$Message.success("操作成功"); |
} |
||||
this.$emit("on-submit", true); |
if (typeof this.form.startTime == "object") { |
||||
this.visible = false; |
this.form.startTime = this.format(this.form.startTime, "yyyy-MM-dd"); |
||||
} |
} |
||||
}); |
if (typeof this.form.endTime == "object") { |
||||
} |
this.form.endTime = this.format(this.form.endTime, "yyyy-MM-dd"); |
||||
} |
} |
||||
}); |
debugger; |
||||
}, |
if (this.form.users == '' || this.form.users == null) { |
||||
setCurrentValue(value) { |
delete this.form.users; |
||||
if (value === this.visible) { |
} |
||||
return; |
// 处理商品分类的名称 |
||||
} |
if (this.form.shopType != '' && this.form.shopType != null) { |
||||
if (this.type == "1") { |
this.shopType.forEach(item => { |
||||
this.title = "编辑店铺"; |
debugger; |
||||
this.maxHeight = |
if (this.form.shopType == item.value) { |
||||
Number(document.documentElement.clientHeight - 121) + "px"; |
this.form.shopTypeTitle = item.title; |
||||
} else if (this.type == "2") { |
} |
||||
this.title = "添加店铺"; |
}); |
||||
this.maxHeight = |
} |
||||
Number(document.documentElement.clientHeight - 121) + "px"; |
this.form.shopMangerId = this.form.shopOwnerId |
||||
} else { |
if (this.type == "1") { |
||||
this.title = "店铺详情"; |
// 编辑 |
||||
this.maxHeight = "100%"; |
this.submitLoading = true; |
||||
} |
delete this.form.products |
||||
// 清空数据 |
delete this.form.saleCount |
||||
this.$refs.form.resetFields(); |
delete this.form.shopTakeaway |
||||
if (this.type == "0" || this.type == "1") { |
|
||||
// 回显数据 |
editShop(this.form).then((res) => { |
||||
let data = this.data; |
this.submitLoading = false; |
||||
// 地址 |
if (res.success) { |
||||
if (data.address) { |
this.$Message.success("操作成功"); |
||||
data.address = data.address.split(","); |
this.$emit("on-submit", true); |
||||
} else { |
this.visible = false; |
||||
data.address = []; |
} |
||||
} |
}); |
||||
// 商圈 |
} else { |
||||
this.$refs.shopAreaTree.setData(data.shopArea, data.shopAreaTitle); |
// 添加 |
||||
// 回显 |
this.submitLoading = true; |
||||
this.form = data; |
addShop(this.form).then((res) => { |
||||
} else { |
this.submitLoading = false; |
||||
// 添加 |
if (res.success) { |
||||
//this.$refs.shopAreaTree.setData("", ""); |
this.$Message.success("操作成功"); |
||||
this.form = { |
this.$emit("on-submit", true); |
||||
/*type: 0, |
this.visible = false; |
||||
sex: "", |
} |
||||
address: [],*/ |
}); |
||||
}; |
} |
||||
} |
} |
||||
this.visible = value; |
}); |
||||
}, |
}, |
||||
}, |
setCurrentValue(value) { |
||||
watch: { |
if (value === this.visible) { |
||||
value(val) { |
return; |
||||
this.setCurrentValue(val); |
} |
||||
}, |
if (this.type == "1") { |
||||
visible(value) { |
this.title = "编辑店铺"; |
||||
this.$emit("input", value); |
this.maxHeight = |
||||
}, |
Number(document.documentElement.clientHeight - 121) + "px"; |
||||
}, |
} else if (this.type == "2") { |
||||
mounted() { |
this.title = "添加店铺"; |
||||
this.init(); |
this.maxHeight = |
||||
}, |
Number(document.documentElement.clientHeight - 121) + "px"; |
||||
}; |
} else { |
||||
|
this.title = "店铺详情"; |
||||
|
this.maxHeight = "100%"; |
||||
|
} |
||||
|
// 清空数据 |
||||
|
this.$refs.form.resetFields(); |
||||
|
if (this.type == "0" || this.type == "1") { |
||||
|
// 回显数据 |
||||
|
let data = this.data; |
||||
|
// 地址 |
||||
|
if (data.address) { |
||||
|
data.address = data.address.split(","); |
||||
|
} else { |
||||
|
data.address = []; |
||||
|
} |
||||
|
// 商圈 |
||||
|
this.$refs.shopAreaTree.setData(data.shopArea, data.shopAreaTitle); |
||||
|
// 回显 |
||||
|
this.form = data; |
||||
|
} else { |
||||
|
// 添加 |
||||
|
//this.$refs.shopAreaTree.setData("", ""); |
||||
|
this.form = { |
||||
|
/*type: 0, |
||||
|
sex: "", |
||||
|
address: [],*/ |
||||
|
}; |
||||
|
} |
||||
|
this.visible = value; |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
value(val) { |
||||
|
this.setCurrentValue(val); |
||||
|
}, |
||||
|
visible(value) { |
||||
|
this.$emit("input", value); |
||||
|
}, |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.init(); |
||||
|
}, |
||||
|
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="less"> |
<style lang="less"> |
||||
@import "@/styles/drawer-common.less"; |
@import "@/styles/drawer-common.less"; |
||||
</style> |
</style> |
||||
|
|
||||
@ -1,226 +1,199 @@ |
|||||
<template> |
<template> |
||||
<div> |
<div> |
||||
<div style="display: flex;"> |
<div style="display: flex;"> |
||||
<Input |
<Input v-model="shopAreaTitle" readonly :size="size" :disabled="disabled" :prefix="prefix" :suffix="suffix" |
||||
v-model="shopAreaTitle" |
style="margin-right: 10px" :placeholder="placeholder" :clearable="clearable" @on-clear="clearSelect" /> |
||||
readonly |
<Poptip transfer trigger="click" placement="right" title="选择区域" width="250"> |
||||
:size="size" |
<Button :size="size" :disabled="disabled" :icon="icon" :type="type" :shape="shape" |
||||
:disabled="disabled" |
:ghost="ghost">{{ text }}</Button> |
||||
:prefix="prefix" |
<div slot="content"> |
||||
:suffix="suffix" |
<Input v-model="searchKey" suffix="ios-search" @on-change="searchDep" placeholder="输入区域名搜索" |
||||
style="margin-right: 10px" |
clearable /> |
||||
:placeholder="placeholder" |
<div class="dep-tree-bar"> |
||||
:clearable="clearable" |
<Tree :data="dataDep" :load-data="loadData" @on-select-change="selectTree" :multiple="multiple"> |
||||
@on-clear="clearSelect" |
</Tree> |
||||
/> |
<Spin size="large" fix v-if="depLoading"></Spin> |
||||
<Poptip |
</div> |
||||
transfer |
</div> |
||||
trigger="click" |
</Poptip> |
||||
placement="right" |
</div> |
||||
title="选择区域" |
</div> |
||||
width="250" |
|
||||
> |
|
||||
<Button |
|
||||
:size="size" |
|
||||
:disabled="disabled" |
|
||||
:icon="icon" |
|
||||
:type="type" |
|
||||
:shape="shape" |
|
||||
:ghost="ghost" |
|
||||
>{{ text }}</Button |
|
||||
> |
|
||||
<div slot="content"> |
|
||||
<Input |
|
||||
v-model="searchKey" |
|
||||
suffix="ios-search" |
|
||||
@on-change="searchDep" |
|
||||
placeholder="输入区域名搜索" |
|
||||
clearable |
|
||||
/> |
|
||||
<div class="dep-tree-bar"> |
|
||||
<Tree |
|
||||
:data="dataDep" |
|
||||
:load-data="loadData" |
|
||||
@on-select-change="selectTree" |
|
||||
:multiple="multiple" |
|
||||
></Tree> |
|
||||
<Spin size="large" fix v-if="depLoading"></Spin> |
|
||||
</div> |
|
||||
</div> |
|
||||
</Poptip> |
|
||||
</div> |
|
||||
</div> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import { initShopArea, loadShopArea, searchShopArea } from "@/api/app"; |
import { |
||||
export default { |
initShopArea, |
||||
name: "shopAreaTreeChoose", |
loadShopArea, |
||||
props: { |
searchShopArea |
||||
text: { |
} from "@/api/app"; |
||||
type: String, |
export default { |
||||
default: "选择区域", |
name: "shopAreaTreeChoose", |
||||
}, |
props: { |
||||
icon: { |
text: { |
||||
type: String, |
type: String, |
||||
default: "md-list", |
default: "选择区域", |
||||
}, |
}, |
||||
disabled: { |
icon: { |
||||
type: Boolean, |
type: String, |
||||
default: false, |
default: "md-list", |
||||
}, |
}, |
||||
size: String, |
disabled: { |
||||
type: String, |
type: Boolean, |
||||
shape: String, |
default: false, |
||||
ghost: { |
}, |
||||
type: Boolean, |
size: String, |
||||
default: false, |
type: String, |
||||
}, |
shape: String, |
||||
prefix: String, |
ghost: { |
||||
suffix: String, |
type: Boolean, |
||||
multiple: { |
default: false, |
||||
type: Boolean, |
}, |
||||
default: false, |
prefix: String, |
||||
}, |
suffix: String, |
||||
clearable: { |
multiple: { |
||||
type: Boolean, |
type: Boolean, |
||||
default: true, |
default: false, |
||||
}, |
}, |
||||
placeholder: { |
clearable: { |
||||
type: String, |
type: Boolean, |
||||
default: "点击选择区域", |
default: true, |
||||
}, |
}, |
||||
}, |
placeholder: { |
||||
data() { |
type: String, |
||||
return { |
default: "点击选择区域", |
||||
depLoading: false, |
}, |
||||
shopAreaTitle: "", |
}, |
||||
searchKey: "", |
data() { |
||||
dataDep: [], |
return { |
||||
selectDep: [], |
depLoading: false, |
||||
shopArea: [], |
shopAreaTitle: "", |
||||
}; |
searchKey: "", |
||||
}, |
dataDep: [], |
||||
methods: { |
selectDep: [], |
||||
initShopAreaData() { |
shopArea: [], |
||||
loadShopArea(JSON.parse(this.getStore("userInfo")).departmentId).then((res) => { |
}; |
||||
if (res.success) { |
}, |
||||
res.result.forEach(function (e) { |
methods: { |
||||
if (e.isParent) { |
initShopAreaData() { |
||||
e.loading = false; |
initShopArea().then((res) => { |
||||
e.children = []; |
if (res.success) { |
||||
} |
res.result.forEach(function(e) { |
||||
if (e.status == -1) { |
if (e.isParent) { |
||||
e.title = "[已禁用] " + e.title; |
e.loading = false; |
||||
e.disabled = true; |
e.children = []; |
||||
} |
} |
||||
}); |
if (e.status == -1) { |
||||
this.dataDep = res.result; |
e.title = "[已禁用] " + e.title; |
||||
} |
e.disabled = true; |
||||
}); |
} |
||||
}, |
}); |
||||
loadData(item, callback) { |
this.dataDep = res.result; |
||||
loadShopArea(item.id).then((res) => { |
} |
||||
if (res.success) { |
}); |
||||
res.result.forEach(function (e) { |
}, |
||||
if (e.isParent) { |
loadData(item, callback) { |
||||
e.loading = false; |
loadShopArea(item.id).then((res) => { |
||||
e.children = []; |
if (res.success) { |
||||
} |
res.result.forEach(function(e) { |
||||
if (e.status == -1) { |
if (e.isParent) { |
||||
e.title = "[已禁用] " + e.title; |
e.loading = false; |
||||
e.disabled = true; |
e.children = []; |
||||
} |
} |
||||
}); |
if (e.status == -1) { |
||||
callback(res.result); |
e.title = "[已禁用] " + e.title; |
||||
} |
e.disabled = true; |
||||
}); |
} |
||||
}, |
}); |
||||
searchDep() { |
callback(res.result); |
||||
// 搜索圈层 |
} |
||||
if (this.searchKey) { |
}); |
||||
this.depLoading = true; |
}, |
||||
searchShopArea({ title: this.searchKey }).then((res) => { |
searchDep() { |
||||
this.depLoading = false; |
// 搜索圈层 |
||||
if (res.success) { |
if (this.searchKey) { |
||||
res.result.forEach(function (e) { |
this.depLoading = true; |
||||
if (e.status == -1) { |
searchShopArea({ |
||||
e.title = "[已禁用] " + e.title; |
title: this.searchKey |
||||
e.disabled = true; |
}).then((res) => { |
||||
} |
this.depLoading = false; |
||||
}); |
if (res.success) { |
||||
this.dataDep = res.result; |
res.result.forEach(function(e) { |
||||
} |
if (e.status == -1) { |
||||
}); |
e.title = "[已禁用] " + e.title; |
||||
} else { |
e.disabled = true; |
||||
this.initShopAreaData(); |
} |
||||
} |
}); |
||||
}, |
this.dataDep = res.result; |
||||
selectTree(v) { |
} |
||||
let ids = [], |
}); |
||||
title = ""; |
} else { |
||||
v.forEach((e) => { |
this.initShopAreaData(); |
||||
ids.push(e.id); |
} |
||||
if (title == "") { |
}, |
||||
title = e.title; |
selectTree(v) { |
||||
} else { |
let ids = [], |
||||
title = title + "、" + e.title; |
title = ""; |
||||
} |
v.forEach((e) => { |
||||
}); |
ids.push(e.id); |
||||
this.shopArea = ids; |
if (title == "") { |
||||
this.shopAreaTitle = title; |
title = e.title; |
||||
if (this.multiple) { |
} else { |
||||
this.$emit("on-change", this.shopArea); |
title = title + "、" + e.title; |
||||
} else { |
} |
||||
this.$emit("on-change", this.shopArea[0]); |
}); |
||||
} |
this.shopArea = ids; |
||||
}, |
this.shopAreaTitle = title; |
||||
clearSelect() { |
if (this.multiple) { |
||||
this.shopArea = []; |
this.$emit("on-change", this.shopArea); |
||||
this.shopAreaTitle = ""; |
} else { |
||||
this.initShopAreaData(); |
this.$emit("on-change", this.shopArea[0]); |
||||
if (this.multiple) { |
} |
||||
this.$emit("on-change", []); |
}, |
||||
} else { |
clearSelect() { |
||||
this.$emit("on-change", ""); |
this.shopArea = []; |
||||
} |
this.shopAreaTitle = ""; |
||||
this.$emit("on-clear"); |
this.initShopAreaData(); |
||||
}, |
if (this.multiple) { |
||||
setData(ids, title) { |
this.$emit("on-change", []); |
||||
this.shopAreaTitle = title; |
} else { |
||||
if (this.multiple) { |
this.$emit("on-change", ""); |
||||
this.shopArea = ids; |
} |
||||
} else { |
this.$emit("on-clear"); |
||||
this.shopArea = []; |
}, |
||||
this.shopArea.push(ids); |
setData(ids, title) { |
||||
} |
this.shopAreaTitle = title; |
||||
this.$emit("on-change", this.shopArea); |
if (this.multiple) { |
||||
}, |
this.shopArea = ids; |
||||
}, |
} else { |
||||
mounted() { |
this.shopArea = []; |
||||
this.initShopAreaData(); |
this.shopArea.push(ids); |
||||
}, |
} |
||||
}; |
this.$emit("on-change", this.shopArea); |
||||
|
}, |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.initShopAreaData(); |
||||
|
}, |
||||
|
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="less"> |
<style lang="less"> |
||||
.dep-tree-bar { |
.dep-tree-bar { |
||||
position: relative; |
position: relative; |
||||
min-height: 80px; |
min-height: 80px; |
||||
max-height: 500px; |
max-height: 500px; |
||||
overflow: auto; |
overflow: auto; |
||||
margin-top: 5px; |
margin-top: 5px; |
||||
} |
} |
||||
|
|
||||
.dep-tree-bar::-webkit-scrollbar { |
.dep-tree-bar::-webkit-scrollbar { |
||||
width: 6px; |
width: 6px; |
||||
height: 6px; |
height: 6px; |
||||
} |
} |
||||
|
|
||||
.dep-tree-bar::-webkit-scrollbar-thumb { |
|
||||
border-radius: 4px; |
|
||||
-webkit-box-shadow: inset 0 0 2px #d1d1d1; |
|
||||
background: #e4e4e4; |
|
||||
} |
|
||||
</style> |
|
||||
|
|
||||
|
.dep-tree-bar::-webkit-scrollbar-thumb { |
||||
|
border-radius: 4px; |
||||
|
-webkit-box-shadow: inset 0 0 2px #d1d1d1; |
||||
|
background: #e4e4e4; |
||||
|
} |
||||
|
</style> |
||||
Loading…
Reference in new issue