Commit dba51a58 by 张立顺

fix bug修复

1 parent 77b9317f
......@@ -421,3 +421,12 @@ export function contentManagerTaskListStaffPage(data) {
data.method = `${path2}contentManagerTask.listStaffPage`
return request(data, "post")
}
/** 省市树 */
export function mapDistricts(data) {
data.method = `${path2}map.districts`
return request(data, "post")
}
// export function getCarbrandTree(data = {}) {
// data.method = `merchants.api.merchantCommon.getCarbrandTree`
// return request(data, "post")
// }
......@@ -139,7 +139,6 @@
</div>
<!-- <template v-if="getEmpType.btn"> -->
<span class="radio-box empTypeBtn" @click="addEmp">选择标签</span>
<div v-loading="customerLoading">
<div class="customer-box m-t-10">
<div class="itemLabel" v-for="(item, iemSubIdx) in empTypeList" :key="iemSubIdx">
......@@ -151,7 +150,10 @@
<el-tag v-for="(k, n) in subItem.labelList || subItem.child" :key="n" class="customer-tag"
size="small" type="info" :closable="!disabledFn" :disable-transitions="false"
@close="handleDeleteCustomer(n, subIdx, iemSubIdx)">
<span>{{ subItem.labelGroup.name }}:{{ k.name || k.tagName }}</span>
<span v-if="item.selectStaffType == 1">{{ subItem.labelGroup.name }}:{{ k.name }}{{
k.tagName ? ':' + k.tagName : '' }}</span>
<span v-else>{{ subItem.name || subItem.labelGroup.name }}:{{ k.name || k.tagName
}}</span>
</el-tag>
</div>
</span>
......@@ -288,8 +290,8 @@
<img width="100%" :src="dialogObj.url" alt="图片" />
</el-dialog>
<component v-if="groupVisible" :is="getEmpType.componentName" :relateStoreVisible="groupVisible"
:dialogVisible="groupVisible" :activeBtnIndex="activeBtnIndex" :config="{}" ref="selectTagForm"
@tagSelected="handleDialogConfirm" @closeDialogFn="closeGroupDialog" :storeSelected="empTableData"
:dialogVisible="groupVisible" :activeBtnIndex="activeBtnIndex" ref="selectTagForm"
:selectedList="defaultSelectList" @tagSelected="handleDialogConfirm" @closeDialogFn="closeGroupDialog"
@handleRelateStoreClose="closeGroupDialog" @handleRelateStoreConfirm="confirmGroup"
@confirmDialogFn="handleDialogConfirm">
</component>
......@@ -310,6 +312,8 @@ import findStaffTagCourseDialog from "./components/findStaffTagCourseDialog"
import selectCourseTag from "./labelCourse/selectTag/index"
import selectTag from "./components/selectTag"
import selectTagSop from "./components/selectTagSop"
import selectTagSopCar from "./components/selectTagSopCar"
import selectTagSopAera from "./components/selectTagSopAera"
import preview from "./components/preview"
import uploadPdf from "./components/uploadPdf"
import tableDialog from "./components/tableDialog"
......@@ -344,10 +348,14 @@ export default {
selectTag,
findStaffTagCourseDialog,
selectCourseTag,
selectTagSop
selectTagSop,
selectTagSopCar,
selectTagSopAera
},
data() {
var validatorForm = (rule, value, callback) => {
console.log(this.storeSearchForm?.configList)
console.log(this.storeSearchForm.configList.length > 0)
if (this.storeSearchForm?.configList && this.storeSearchForm.configList.length > 0) {
callback()
} else {
......@@ -367,6 +375,7 @@ export default {
activeBtnIndex: 1,
findStaffTagCourseVisible: false,
scriptVisible: false,
defaultSelectList: [],
scriptList: [],
empTableData: [],
contentTypeList: [
......@@ -416,7 +425,7 @@ export default {
selectStaffType: 3,
btn: "标签",
labelType: 1,
componentName: "selectTag",
componentName: "selectTagSopCar",
status: 0,
selectStaffValue: []
},
......@@ -443,7 +452,7 @@ export default {
selectStaffType: 8,
btn: "展业",
labelType: 1,
componentName: "merchantDialog",
componentName: "selectTagSopAera",
status: 0,
selectStaffValue: []
},
......@@ -934,8 +943,9 @@ export default {
} else {
this.groupVisible = true
const item = this.empTypeList.find(item => item.selectStaffType == this.activeBtnIndex)
this.defaultSelectList = item.selectStaffValue
this.$nextTick(() => {
this.$refs.selectTagForm.init({
this.$refs.selectTagForm.init && this.$refs.selectTagForm.init({
item: item.selectStaffValue
})
})
......@@ -947,7 +957,7 @@ export default {
const item = this.empTypeList.find(item => item.selectStaffType == 1)
console.log(item, 'item')
this.$nextTick(() => {
this.$refs.selectTagForm.init({
this.$refs.selectTagForm.init && this.$refs.selectTagForm.init({
item: item.selectStaffValue
})
})
......@@ -1148,39 +1158,26 @@ export default {
console.log(item.selectStaffValue, 'item.selectStaffValue')
// const mapList = item.selectStaffValue || item.child
// if (item.selectStaffValue == 1) {
if (item.labelType == 1) {
obj.selectStaffValue = item.selectStaffValue.map(el => {
let newel = {
id: el.labelGroup.id,
name: el.labelGroup.name
// if (item.selectStaffType == 1) {
obj.selectStaffValue = item.selectStaffValue.map(el => {
let newel = {
id: el.id || el.labelGroup.id,
name: el.name || el.labelGroup.name
}
const mapList = el?.labelList || el.child
newel.child = mapList.map(ele => {
return {
id: ele.id,
name: ele?.tagName ? `${ele.name}: ${ele?.tagName}` : ele.name
// name: `${ele?.groupAttName} : ${ele?.groupName} : ${ele?.tagName}`
}
const mapList = el.labelList || el.child
newel.child = mapList.map(ele => {
return {
id: ele.id,
name: ele.name || `${ele?.tagName}`
// name: `${ele?.groupAttName} : ${ele?.groupName} : ${ele?.tagName}`
}
})
return newel
})
} else {
obj.selectStaffValue = item.child
// .map(el => {
// let newel = {
// id: el.labelGroup.id,
// name: el.labelGroup.name,
// }
// newel.child = el.labelList.map(ele => {
// return {
// id: ele.id,
// name: ele.name || `${ele?.tagName}`,
// // name: `${ele?.groupAttName} : ${ele?.groupName} : ${ele?.tagName}`
// }
// })
// return newel
// })
}
return newel
})
// } else {
// console.log(item, item.child, 1111)
// obj.selectStaffValue = item.child
// }
}
if (item.labelType == 2 && item.selectStaffType == 2) {
obj.selectStaffValue = item.selectStaffValue.map(el => {
......
<template>
<d2-dialog title="选择品牌" :is-visible="dialogVisible" class="brand-dialog" width="50%" @closeDialog="handleClose"
<d2-dialog title="选择品牌222" :is-visible="dialogVisible" class="brand-dialog" width="50%" @closeDialog="handleClose"
@confirmDialog="handleConfirm">
<el-form :inline="true" size="mini" class="demo-form-inline">
<el-form-item label="品牌名称:">
......@@ -12,8 +12,8 @@
<div class="content">
<div class="tree-box">
<div class="title">预选品牌</div>
<el-tree ref="tree" node-key="id" :filter-node-method="filterNode" :data="brandData" :props="defaultProps" show-checkbox
@check-change="handleNodeClick"></el-tree>
<el-tree ref="tree" node-key="id" :filter-node-method="filterNode" :data="brandData" :props="defaultProps"
show-checkbox @check-change="handleNodeClick"></el-tree>
</div>
<!-- <div class="check-box">
<div class="title">已选品牌
......@@ -22,12 +22,12 @@
<template v-if="checkList.length == 0">
<div class="no-data">暂无数据</div>
</template>
<template v-else>
<template v-else>
<div class="check-list">
<div class="check-item" v-for="item in checkList" :key="item.id">{{ item.label }}<i class="el-icon-close" @click="closeChecked(item)"></i></div>
</div>
</template>
</div> -->
</div> -->
</div>
</d2-dialog>
......@@ -108,7 +108,7 @@ export default {
});
}
});
// 过滤掉一级项中 id 存在于 childrenIds 中的项
return checkList.filter(item => !childrenIds.has(item.id));
},
......@@ -173,6 +173,7 @@ export default {
height: 324px;
overflow-y: auto;
width: 100%;
// margin-right: 20px;
.tree-title {
display: flex;
......@@ -199,11 +200,13 @@ export default {
align-items: center;
justify-content: center;
}
.check-list {
margin-top: 12px;
height: calc(100% - 64px);
overflow-y: auto;
}
.check-item {
display: flex;
align-items: center;
......
<template>
<d2-dialog title="选择品牌" :is-visible="dialogVisible" class="brand-dialog" width="50%" @closeDialog="handleClose"
@confirmDialog="handleConfirm">
<el-form :inline="true" size="mini" class="demo-form-inline">
<el-form-item label="品牌名称:">
<el-input v-model="filterText" placeholder="请输入" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearch">查询</el-button>
</el-form-item>
</el-form>
<div class="content">
<div class="tree-box">
<div class="title">预选品牌</div>
<el-tree ref="tree" node-key="id" :filter-node-method="filterNode" :data="brandData" :props="defaultProps"
show-checkbox @check-change="handleNodeClick"></el-tree>
</div>
<div class="check-box">
<div class="title">已选品牌
<el-button type="text" @click="resetChecked">清空</el-button>
</div>
<template v-if="checkList.length == 0">
<div class="no-data">暂无数据</div>
</template>
<template v-else>
<div class="check-list">
<div class="check-item" v-for="item in checkList" :key="item.id">{{ item.name }}<i class="el-icon-close"
@click="closeChecked(item)"></i></div>
</div>
</template>
</div>
</div>
</d2-dialog>
</template>
<script>
import { deepClone } from "@/common/util"
import { mapDistricts } from "@api/contentManager"
export default {
name: "brandTree",
props: {
dialogVisible: Boolean,
selectedList: Array
},
data() {
return {
filterText: '',
checked: false,
checkList: [],
brandData: [],
defaultProps: {
children: 'child',
label: 'name'
},
selectList: []
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
// selectedList(val) {
// console.log(val)
// this.$nextTick(() => {
// // val.forEach(i => {
// // this.$refs.tree.setChecked(i, true)
// // })
// this.$refs.tree.setCheckedKeys(val)
// })
// }
},
mounted() {
this.getCarbrandTree()
},
methods: {
// 获取品牌树
async getCarbrandTree() {
const res = await mapDistricts({})
console.log(res, 'res')
this.brandData = res.districts[0].districts.map(item => {
item.id = item.code
// item.label = item.name
item.child = item.districts.map(child => {
child.id = child.code
// child.label = child.name
return child
})
return item
})
this.$nextTick(() => {
const defaultKeys = this.selectedList.reduce((pre, item) => {
// pre.push(item.id)
item.child.forEach(i => {
pre.push(i.id)
})
return pre;
}, [])
console.log(defaultKeys, 'defaultKeys')
this.$refs.tree.setCheckedKeys(defaultKeys)
})
},
handleClose() {
this.resetChecked()
this.$emit('closeDialogFn')
},
handleConfirm() {
this.resetChecked()
console.log(this.checkList, 'checkList')
const newList = this.filterCheckList(deepClone(this.checkList))
console.log(newList, 'newList')
// this.$emit('confirmDialogFn', {
// checkList: this.checkList,
// newList: newList
// })
this.$emit('confirmDialogFn', newList)
},
onSearch() {
this.$refs.tree.filter(this.filterText)
},
handleNodeClick(data) {
console.log(data, this.$refs.tree.getCheckedNodes());
this.checkList = this.$refs.tree.getCheckedNodes()
},
filterCheckList(checkList) {
// 收集所有 children 中的 id
const childrenIds = new Set();
checkList.forEach(item => {
if (item.child && item.child.length > 0) {
item.child.forEach(child => {
childrenIds.add(child.id);
});
}
});
// 过滤掉一级项中 id 存在于 childrenIds 中的项
return checkList.filter(item => !childrenIds.has(item.id));
},
// 清空
resetChecked() {
this.$refs.tree.setCheckedKeys([]);
},
closeChecked(row) {
console.log(row)
this.$refs.tree.setChecked(row.id, false)
console.log(this.$refs.tree.getCheckedNodes())
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
handleChange(e) {
console.log(e)
if (e) {
const nodes = this.getTreeArray()
this.$refs.tree.setCheckedKeys(nodes)
} else {
this.$refs.tree.setCheckedKeys([]);
}
},
//获取选择项
getTreeArray() {
let tree_arr = []
this.brandData.forEach(k => {
let child = k.child
if (child && child.length > 0) {
child.forEach(j => {
tree_arr.push(j.id)
})
} else {
tree_arr.push(k.id)
}
})
return tree_arr
},
}
}
</script>
<style scoped lang="scss">
.content {
display: flex;
.title {
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
opacity: 1;
border-bottom: 1px solid #e5e5e5;
background: #f2f4f7;
padding: 0 16px;
}
.tree-box {
border: 1px solid #e5e5e5;
background: #ffffff;
height: 324px;
overflow-y: auto;
width: 50%;
margin-right: 20px;
.tree-title {
display: flex;
align-items: center;
height: 40px;
opacity: 1;
border-bottom: 1px solid #e5e5e5;
background: #f2f4f7;
padding: 0 16px;
}
}
.check-box {
flex: 1;
height: 324px;
opacity: 1;
border: 1px solid #e5e5e5;
}
.no-data {
width: 100%;
height: calc(100% - 40px);
display: flex;
align-items: center;
justify-content: center;
}
.check-list {
margin-top: 12px;
height: calc(100% - 64px);
overflow-y: auto;
}
.check-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 16px;
}
}
</style>
<style lang="scss">
.brand-dialog {
.el-dialog__body {
padding: 20px !important;
}
}
</style>
\ No newline at end of file
<template>
<d2-dialog title="选择品牌" :is-visible="dialogVisible" class="brand-dialog" width="50%" @closeDialog="handleClose"
@confirmDialog="handleConfirm">
<el-form :inline="true" size="mini" class="demo-form-inline">
<el-form-item label="品牌名称:">
<el-input v-model="filterText" placeholder="请输入" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearch">查询</el-button>
</el-form-item>
</el-form>
<div class="content">
<div class="tree-box">
<div class="title">预选品牌</div>
<el-tree ref="tree" node-key="id" :filter-node-method="filterNode" :data="brandData" :props="defaultProps"
show-checkbox @check-change="handleNodeClick"></el-tree>
</div>
<div class="check-box">
<div class="title">已选品牌
<el-button type="text" @click="resetChecked">清空</el-button>
</div>
<template v-if="checkList.length == 0">
<div class="no-data">暂无数据</div>
</template>
<template v-else>
<div class="check-list">
<div class="check-item" v-for="item in checkList" :key="item.id">{{ item.name }}<i class="el-icon-close"
@click="closeChecked(item)"></i></div>
</div>
</template>
</div>
</div>
</d2-dialog>
</template>
<script>
import { deepClone } from "@/common/util"
import { getCarbrandTree } from "@api/contentManager"
export default {
name: "brandTree",
props: {
dialogVisible: Boolean,
selectedList: Array
},
data() {
return {
filterText: '',
checked: false,
checkList: [],
brandData: [],
defaultProps: {
children: 'child',
label: 'name'
},
selectList: []
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val);
},
// defaultKeys(val) {
// console.log(val)
// this.$nextTick(() => {
// // val.forEach(i => {
// // this.$refs.tree.setChecked(i, true)
// // })
// this.$refs.tree.setCheckedKeys(val)
// })
// }
},
mounted() {
this.getCarbrandTree()
},
methods: {
// 获取品牌树
async getCarbrandTree() {
let res = await getCarbrandTree()
res = res.map(item => {
item.name = item.label
item.child = []
if (item?.children) {
item.child = item?.children.map(child => {
child.name = child.label
return child
})
}
// delete item.children
return item
})
this.brandData = res
this.$nextTick(() => {
const defaultKeys = this.selectedList.reduce((pre, item) => {
// pre.push(item.id)
item.child.forEach(i => {
pre.push(i.id)
})
return pre;
}, [])
console.log(defaultKeys, 'defaultKeys')
this.$refs.tree.setCheckedKeys(defaultKeys)
})
},
handleClose() {
this.resetChecked()
this.$emit('closeDialogFn')
},
handleConfirm() {
this.resetChecked()
console.log(this.checkList, 'checkList')
const newList = this.filterCheckList(deepClone(this.checkList))
console.log(newList, 'newList')
this.$emit('confirmDialogFn', newList)
// this.$emit('submit', {
// checkList: this.checkList,
// newList: newList
// })
},
onSearch() {
this.$refs.tree.filter(this.filterText)
},
handleNodeClick(data) {
console.log(data, this.$refs.tree.getCheckedNodes());
this.checkList = this.$refs.tree.getCheckedNodes()
},
filterCheckList(checkList) {
// 收集所有 children 中的 id
const childrenIds = new Set();
checkList.forEach(item => {
if (item.child && item.child.length > 0) {
item.child.forEach(child => {
childrenIds.add(child.id);
});
}
});
// 过滤掉一级项中 id 存在于 childrenIds 中的项
return checkList.filter(item => !childrenIds.has(item.id));
},
// 清空
resetChecked() {
this.$refs.tree.setCheckedKeys([]);
},
closeChecked(row) {
console.log(row)
this.$refs.tree.setChecked(row.id, false)
console.log(this.$refs.tree.getCheckedNodes())
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
handleChange(e) {
console.log(e)
if (e) {
const nodes = this.getTreeArray()
this.$refs.tree.setCheckedKeys(nodes)
} else {
this.$refs.tree.setCheckedKeys([]);
}
},
//获取选择项
getTreeArray() {
let tree_arr = []
this.brandData.forEach(k => {
let child = k.child
if (child && child.length > 0) {
child.forEach(j => {
tree_arr.push(j.id)
})
} else {
tree_arr.push(k.id)
}
})
return tree_arr
},
}
}
</script>
<style scoped lang="scss">
.content {
display: flex;
.title {
display: flex;
align-items: center;
justify-content: space-between;
height: 40px;
opacity: 1;
border-bottom: 1px solid #e5e5e5;
background: #f2f4f7;
padding: 0 16px;
}
.tree-box {
border: 1px solid #e5e5e5;
background: #ffffff;
height: 324px;
overflow-y: auto;
width: 50%;
margin-right: 20px;
.tree-title {
display: flex;
align-items: center;
height: 40px;
opacity: 1;
border-bottom: 1px solid #e5e5e5;
background: #f2f4f7;
padding: 0 16px;
}
}
.check-box {
flex: 1;
height: 324px;
opacity: 1;
border: 1px solid #e5e5e5;
}
.no-data {
width: 100%;
height: calc(100% - 40px);
display: flex;
align-items: center;
justify-content: center;
}
.check-list {
margin-top: 12px;
height: calc(100% - 64px);
overflow-y: auto;
}
.check-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 16px;
}
}
</style>
<style lang="scss">
.brand-dialog {
.el-dialog__body {
padding: 20px !important;
}
}
</style>
\ No newline at end of file
......@@ -12,10 +12,10 @@
<div class="content">
<div class="tree-box">
<div class="title">预选品牌</div>
<el-tree ref="tree" node-key="id" :filter-node-method="filterNode" :data="brandData" :props="defaultProps" show-checkbox
@check-change="handleNodeClick"></el-tree>
<el-tree ref="tree" node-key="id" :filter-node-method="filterNode" :data="brandData" :props="defaultProps"
show-checkbox @check-change="handleNodeClick"></el-tree>
</div>
<!-- <div class="check-box">
<div class="check-box">
<div class="title">已选品牌
<el-button type="text" @click="resetChecked">清空</el-button>
</div>
......@@ -24,10 +24,11 @@
</template>
<template v-else>
<div class="check-list">
<div class="check-item" v-for="item in checkList" :key="item.id">{{ item.label }}<i class="el-icon-close" @click="closeChecked(item)"></i></div>
<div class="check-item" v-for="item in checkList" :key="item.id">{{ item.label }}<i class="el-icon-close"
@click="closeChecked(item)"></i></div>
</div>
</template>
</div> -->
</div>
</div>
</d2-dialog>
......@@ -108,7 +109,7 @@ export default {
});
}
});
// 过滤掉一级项中 id 存在于 childrenIds 中的项
return checkList.filter(item => !childrenIds.has(item.id));
},
......@@ -173,6 +174,7 @@ export default {
height: 324px;
overflow-y: auto;
width: 100%;
// margin-right: 20px;
.tree-title {
display: flex;
......@@ -199,11 +201,13 @@ export default {
align-items: center;
justify-content: center;
}
.check-list {
margin-top: 12px;
height: calc(100% - 64px);
overflow-y: auto;
}
.check-item {
display: flex;
align-items: center;
......
......@@ -113,7 +113,10 @@
<el-tag v-for="(k, n) in subItem.labelList || subItem.child" :key="n" class="customer-tag"
size="small" type="info" :disable-transitions="false"
@close="handleDeleteCustomer(n, subIdx, iemSubIdx)">
<span>{{ subItem.labelGroup.name }}:{{ k.name }}</span>
<!-- <span>{{ subItem.labelGroup.name }}:{{ k.name }}</span> -->
<span v-if="item.selectStaffType == 1">{{ subItem.labelGroup.name }}:{{ k.name }}{{
k.tagName ? ':' + k.tagName : '' }}</span>
<span v-else>{{ subItem.labelGroup.name }}:{{ k.name || k.tagName }}</span>
</el-tag>
</div>
</span>
......@@ -212,7 +215,7 @@
<el-row slot>
<el-form :model="storeSearchForm" ref="relate" :inline="true">
<el-form-item label="关键字:">
<el-input v-model.trim="storeSearchForm.staffNameOrPhone" placeholder="请输入员工名称/手机号进行搜索"
<el-input v-model.trim="storeSearchForm.keyWord" placeholder="请输入员工名称/手机号进行搜索"
@keydown.native="handleStoreInput" clearable />
</el-form-item>
<el-button type="primary" @click="handleSearchStore">搜索</el-button>
......@@ -503,7 +506,7 @@ export default {
getList: contentManagerTaskListStaffPage,
customerDataList: [],
storeSearchForm: {
staffNameOrPhone: ""
keyWord: ""
}
}
},
......@@ -565,7 +568,7 @@ export default {
// }, 3000)
},
handleRelateStoreClose() {
this.storeSearchForm.staffNameOrPhone = ""
this.storeSearchForm.keyWord = ""
this.relateStoreVisible = false
},
handlePopStaff() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!