Commit 479e43a3 authored by 罗超's avatar 罗超

1

parent afd3c6a1
......@@ -5,6 +5,7 @@
persistent
transition-show="scale"
transition-hide="scale"
@show="showDialog"
@hide="hideDialog"
>
<q-card style="width: 600px;height:600px; max-width: 80vw;">
......@@ -41,17 +42,12 @@
no-connectors
v-model:ticked="defaultArray"
@update:ticked="tickedTree"
/>
</div>
<div class="col-6 q-px-sm">
<div class="list-title">已选择的部门或成员</div>
<div class="q-pb-none col-12 list-box">
<div
v-for="(item,index) in selectArray"
:key="index"
class="list-item"
>
<div v-for="(item,index) in selectArray" :key="index" class="list-item">
<div class="flex-center">
<q-icon
name="work"
......@@ -65,7 +61,7 @@
/>
<span class="q-ml-sm">{{ item.Name }}</span>
</div>
<q-icon name="cancel" @click="delItem(item.Id,index)"></q-icon>
<q-icon name="cancel" @click="delItem(item.Id, index)"></q-icon>
</div>
</div>
</div>
......@@ -80,14 +76,14 @@
</q-dialog>
</template>
<script lang="ts">
import { ref } from 'vue'
import { ref, watch } from 'vue'
interface parmas {
[key: string]: any
}
interface SelectParams{
Id:string,
Name:string
interface SelectParams {
Id: string,
Name: string
}
export default {
props: {
......@@ -130,97 +126,116 @@ export default {
type: String,
default: 'children'
},
//滴答策略
strategy: {
type: String,
default: 'strict'
},
},
setup(props, ctx) {
let tree = ref<any>(null);
let list = ref<Array<string>>([])
let keys = ref<Array<string>>([])
let selectArray = ref<Array<SelectParams>>([])
let hideDialog = () => {
ctx.emit("update:modelValue", false)
}
const getselectArray=(arr: parmas)=>{
for(var i = 0;i<arr.length;i++){
let initDefault = () => {
if (props.defaultArray && props.defaultArray.length > 0) {
props.defaultArray.forEach((e, i) => {
if (e.slice(0, 1) == 1) {
props.defaultArray.splice(i, 1)
const node = tree.value.getNodeByKey(e)
if (node[props.childrenKey] && node[props.childrenKey].length > 0) {
findChild(node[props.childrenKey])
} else {
props.defaultArray.push('2-' + node.DeptId)
}
}
})
}
console.log(160, props.defaultArray)
}
let findChild(arr: Array<parmas>) => {
arr.map(e => {
if (e[props.childrenKey] && e[props.childrenKey].length > 0) {
findChild(e[props.childrenKey])
} else {
props.defaultArray.push('2-' + e.DeptId)
}
})
}
let showDialog = () => {
initDefault()
}
const getselectArray = (arr: parmas[]) => {
for (var i = 0; i < arr.length; i++) {
let j = arr[i]
let flag= tree.value.isTicked (j.newId)
if(flag==true){
selectArray.value.push({Id:j.newId , Name:j.DeptName})
}else{
if(j.ChildList && j.ChildList.length>0){
getselectArray(j.ChildList)
let flag = tree.value.isTicked(j[props.nodeKey])
if (flag == true) {
selectArray.value.push({ Id: j[props.nodeKey], Name: j.DeptName })
} else {
if (j[props.childrenKey] && j[props.childrenKey].length > 0) {
getselectArray(j[props.childrenKey])
}
}
}
}
let tickedTree = (val) => {
ctx.emit("update:defaultArray", val)
setTimeout(()=>{
selectArray.value=[]
setTimeout(() => {
selectArray.value = []
getselectArray(props.treeData)
console.log(selectArray.value,'selectArray')
},100)
}, 100)
}
let delItemitem=(arr: parmas)=>{
console.log(arr,'arr')
arr.map(x=>{
if(x.ChildList && x.ChildList>0){
delItemitem(x.ChildList)
}else{
keys.value.push(x.newId)
let delItemitem = (arr: parmas) => {
arr.map(x => {
if (x[props.childrenKey] && x[props.childrenKey].length > 0) {
delItemitem(x[props.childrenKey])
} else {
keys.value.push(x[props.nodeKey])
}
})
}
let delItemArray =(arr: parmas,Id:string)=>{
for(let i = 0;i<arr.length;i++){
let delItemArray = (arr: parmas, Id: string) => {
for (let i = 0; i < arr.length; i++) {
let j = arr[i]
if(j.newId == Id){
if(j.ChildList && j.ChildList.length>0){
console.log(j)
delItemitem(j.ChildList)
}else{
if (j[props.nodeKey] == Id) {
if (j[props.childrenKey] && j[props.childrenKey].length > 0) {
delItemitem(j[props.childrenKey])
} else {
keys.value.push(Id)
}
}else{
if(j.ChildList && j.ChildList.length>0){
delItemArray(j.ChildList,Id)
} else {
if (j[props.childrenKey] && j[props.childrenKey].length > 0) {
delItemArray(j[props.childrenKey], Id)
}
}
}
}
let delItem = (Id: string,i:number) => {
let delItem = (Id: string, i: number) => {
keys.value = []
delItemArray(props.treeData,Id)
tree.value.setTicked (keys.value,false)
delItemArray(props.treeData, Id)
tree.value.setTicked(keys.value, false)
selectArray.value.splice(i, 1)
}
watch(() => [...selectArray.value], (val) => {
ctx.emit('change', val)
}, { deep: true })
watch(() => [...selectArray.value], (val) => {
ctx.emit('change', val)
}, { deep: true })
return {
tree,
hideDialog,
tickedTree,
delItem,
list,
getselectArray,
selectArray,
delItemArray,
delItemitem
delItemitem,
showDialog
}
}
......
......@@ -222,8 +222,16 @@
:style="{ height: ((addMsg.length * 48 - 8 - 46 - 40) / 2) + 'px' }"
></div>
<div class="border_mid">
<div class="and" :class="{ 'checked': addtion == 1 }" @click="addtion = 1">且</div>
<div class="no" :class="{ 'checked': addtion == 2 }" @click="addtion = 2">或</div>
<div
class="and"
:class="{ 'checked': addCondition == 1 }"
@click="changeAddCondition(1)"
>且</div>
<div
class="no"
:class="{ 'checked': addCondition == 2 }"
@click="changeAddCondition(2)"
>或</div>
</div>
<div
class="border-bottom"
......@@ -250,12 +258,13 @@ import customerService from '@/api/customer'
import labelgroup from './label-group.vue'
import dayjs, { Dayjs } from 'dayjs'
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
import { Notify } from 'quasar'
interface params {
Name: number | string
IsCustom: number
Type: number | string
Id?: number | string
Direction?: string
Direction?: string|number
StartValue?: string | Array<any>
EndValue?: string
disable?: boolean
......@@ -283,7 +292,6 @@ export default defineComponent({
setup(props, ctx) {
let rangeArr = ref<Dayjs[]>([])
let birthday = ref([])//只有一个
let addtion = ref(props.addCondition)
let filedList = ref<Array<params>>([]); //客户字段数组
let addMsg = ref<Array<params>>([]) //筛选数组
let isshowlabel = ref(false) //标签弹出显示
......@@ -356,7 +364,9 @@ export default defineComponent({
Name: '小于等于'
},]
let changeAddCondition = (val) => {
ctx.emit('update:addCondition', val)
}
const getCustomerFiledList = () => {
customerService.getCustomerFiledList({
Enable: 1
......@@ -404,7 +414,7 @@ export default defineComponent({
}
const addsList = () => {
let obj: params = {
Id:0,
Id: 0,
Name: '',
Type: '',
Direction: '',
......@@ -489,10 +499,10 @@ export default defineComponent({
let find: any = filedList.value.find((e) => {
return e.Id == val
})
if(find){
if (find) {
addMsg.value[y].Name = find.Name
}
console.log(500,find)
console.log(500, find)
switch (find.Type) {
case 1: {
addMsg.value[y].directionList = directionList2
......@@ -554,6 +564,41 @@ export default defineComponent({
addMsg.value[y].EndValue = b
}
const checkRule = (val:params[]) => {
let flag = false
flag = val.every(e => {
if(e.Type==1){
if(e.Direction==1||e.Direction==2||e.Direction==3){
return !!e.Id && !!e.StartValue
}else{
return !!e.Id&&e.Direction
}
}else if(e.Type==2){
console.log(222222222222)
if(e.Direction==1||e.Direction==2){
return !!e.Id && !!e.StartValue
}else{
return e.Id &&e.Direction
}
}else if(e.Type==3){
return e.Id&&e.StartValue
}else if(e.Type==4){
return e.Id&&e.StartValue&& e.EndValue
}else{
return e.Id&&e.Direction && e.StartValue
}
})
if (!flag) {
Notify.create({
type:'warning',
position:'top',
message: '规则适用范围不可空'
})
}
return flag
}
watch(() => [...addMsg.value], (val) => {
changeLabel()
let newVal: Array<params> = []
......@@ -586,7 +631,6 @@ export default defineComponent({
addMsg,
deleteadd,
addsList,
addtion,
isshowlabel,
selectindex,
LableList,
......@@ -596,6 +640,8 @@ export default defineComponent({
changeDate,
changeRange,
locale,
changeAddCondition,
checkRule
}
}
......
import { reactive } from 'vue'
import { ref, reactive } from 'vue'
import customerService from '@/api/customer'
import customerService2 from '@/api/customer2'
import router from '@/router/index'
interface dataParams {
showDialog: boolean
shape: number
......@@ -17,7 +16,7 @@ const msg = () => {
RuleId: curQueryId
}
}
const condition = ref<any>(null)
const data = reactive<dataParams>({
showDialog: false,
shape: 0,
......@@ -51,12 +50,48 @@ const changeDialog = () => {
}
const editRuleModule = () => {
//获取分配客户条件
const getCondition = val => {
data.editMsg.ConditionList = [...val]
}
//获取已选部门成员
const getdpt = val => {
data.editMsg.DeptList = []
data.editMsg.EmpList = []
val.map(e => {
if (e.Id.slice(0, 1) == 1) {
data.editMsg.DeptList.push({
DeptId: e.Id.slice(2),
DeptName: e.Name
})
} else {
data.editMsg.EmpList.push({
Id: e.Id.slice(2),
EmployeeName: e.Name
})
}
})
console.log(61, data.editMsg)
}
//获取线索详情
const getDetail = () => {
customerService.getCustomerClueRuleDetail(msg()).then(res => {
console.log(res.data.Data, '详情数据')
data.defaultArray = []
// res.data.Data.
const d = res.data.Data
data.editMsg.DeptList = d.DeptList
data.editMsg.EmpList = d.EmpList
data.editMsg.ConditionList = d.ConditionList
data.editMsg.RuleAllotWay = d.RuleAllotWay
data.editMsg.RuleSelectType = d.RuleSelectType
const Dep= d.DeptList.map(e => {
return '1-'+ e.DeptId
})
const Emp= d.EmpList.map(e => {
return '2-'+ e.Id
})
data.defaultArray = [...Dep, ...Emp]
console.log( data.defaultArray, '数据2')
})
}
//获取部门数据
......@@ -67,7 +102,6 @@ const editRuleModule = () => {
// 重组唯一id
if (data.dataTree.length == 0) return
data.dataTree.forEach(x => {
// x.newId = x.DataType + '-' +x. DeptName + '-' + x.DeptId
x.newId = x.DataType + '-' + x.DeptId
if (x.ChildList && x.ChildList.length > 0) {
getChildList(x.ChildList)
......@@ -77,7 +111,6 @@ const editRuleModule = () => {
}
const getChildList = (ChildList: Array<any>) => {
ChildList.forEach(x => {
// x.newId = x.DataType + '-' + x.DeptName + '-' + x.DeptId
x.newId = x.DataType + '-' + x.DeptId
if (x.ChildList && x.ChildList.length > 0) {
getChildList(x.ChildList)
......@@ -86,18 +119,25 @@ const editRuleModule = () => {
}
// 新增,修改
const setCustomerClueRuleInfo = () => {
// console.log(data.editMsg.ConditionList)
// const flag = condition.value.checkRule(data.editMsg.ConditionList)
console.log(94, data.editMsg)
// if (!flag) return
customerService.setCustomerClueRuleInfo(data.editMsg).then(res => {
console.log('setCustomerClueRuleInfo', res)
})
}
return {
msg,
condition,
data,
getDetail,
getEmployeeData,
jumpBeforePage,
changeDialog,
setCustomerClueRuleInfo
setCustomerClueRuleInfo,
getCondition,
getdpt
}
}
......
<template>
<div class="q-pa-md">
<div class="q-gutter-lg">
<q-radio v-model="configMsg.ClueType" :val="1" label="自动分配" @update:model-value='configChange'></q-radio>
<q-radio v-model="configMsg.ClueType" :val="2" label="手动分配" @update:model-value='configChange'></q-radio>
<q-radio
v-model="configMsg.ClueType"
:val="1"
label="自动分配"
@update:model-value="configChange"
></q-radio>
<q-radio
v-model="configMsg.ClueType"
:val="2"
label="手动分配"
@update:model-value="configChange"
></q-radio>
</div>
<div class="q-pa-md" v-if="configMsg.ClueType === 1">
<div class="aoto-matic-header">
......@@ -17,6 +27,7 @@
<table class="payTable">
<thead>
<tr>
<th>序号</th>
<th>查询类型</th>
<th>是否默认</th>
<th>部门列表</th>
......@@ -33,6 +44,7 @@
</tr>
<template v-if="defaultData.length > 0">
<tr v-for="(item,index) in defaultData" :key="index">
<td></td>
<td>
<span v-if="item.RuleSelectType === 1">并且</span>
<span v-if="item.RuleSelectType === 2">或者</span>
......@@ -78,8 +90,9 @@
@update="datadragEnd"
v-if="data.length > 0"
>
<template #item="{ element }">
<template #item="{ element, index }">
<tr>
<td>{{ index + 1 }}</td>
<td>
<span v-if="element.RuleSelectType === 1">并且</span>
<span v-if="element.RuleSelectType === 2">或者</span>
......@@ -134,17 +147,25 @@
</table>
</div>
<div class="q-pa-md manual" v-if="configMsg.ClueType === 2">
<div class="box-manual " :class="{'checked-border':configMsg.ClueAllotWay==1}" @click="configMsg.ClueAllotWay=1;configChange()">
<div
class="box-manual"
:class="{ 'checked-border': configMsg.ClueAllotWay == 1 }"
@click="configMsg.ClueAllotWay = 1; configChange()"
>
<q-icon name="autorenew" size="lg" />
<div>按已选员工顺序依次轮流分配</div>
<div class="right" v-if="configMsg.ClueAllotWay==1">
<div class="right" v-if="configMsg.ClueAllotWay == 1">
<q-icon name="check" class="check-icon" />
</div>
</div>
<div class="box-manual" :class="{'checked-border':configMsg.ClueAllotWay==2}" @click="configMsg.ClueAllotWay=2;configChange()">
<div
class="box-manual"
:class="{ 'checked-border': configMsg.ClueAllotWay == 2 }"
@click="configMsg.ClueAllotWay = 2; configChange()"
>
<q-icon name="shuffle" size="lg" />
<div>按已选员工随机分配</div>
<div class="right" v-if="configMsg.ClueAllotWay==2">
<div class="right" v-if="configMsg.ClueAllotWay == 2">
<q-icon name="check" class="check-icon" />
</div>
</div>
......@@ -182,6 +203,11 @@ export default defineComponent({
draggable,
},
setup() {
let stateMsg = {
RuleId: 0,
Type: 1,// 1移动规则 2删除
TargetId: 0,//移动至目标的后面 0 表示移动至第一个
}
let defaultData: Array<dataType> = reactive([])
let data: Array<dataType> = reactive([])
const datadragEnd = (e: any) => {
......@@ -198,15 +224,15 @@ export default defineComponent({
})
})
}
let configMsg=reactive <dataConfigType>( {
let configMsg = reactive<dataConfigType>({
ClueType: 1,// 1手动分配 2自动分配
ClueAllotWay: 1,// 1依次轮流 2随机分配
})
const getCustomerClueRuleConfig = () => {
customerService.getCustomerClueRuleConfig({}).then(res => {
let data=res.data.Data
configMsg.ClueType=data.ClueType
configMsg.ClueAllotWay=data.ClueAllotWay
let data = res.data.Data
configMsg.ClueType = data.ClueType
configMsg.ClueAllotWay = data.ClueAllotWay
})
}
const jumpPage = (url: string, Id = 0) => {
......@@ -217,9 +243,15 @@ export default defineComponent({
}
})
}
const configChange=()=>{
const configChange = () => {
customerService.setCustomerClueRuleConfig(configMsg).then(res => {
console.log(228,res.data)
console.log(228, res.data)
})
}
const setState = () => {
customerService.setCustomerClueRuleState(stateMsg).then(res => {
console.log(232, res.data)
})
}
onMounted(() => {
......@@ -232,7 +264,8 @@ export default defineComponent({
data,
datadragEnd,
jumpPage,
configMsg
configMsg,
setState
}
}
})
......
......@@ -11,7 +11,7 @@
<div class="content-block">
<div class="fission-title">选择待分配客户</div>
<div class="fission-subtitle">当待分配客户符合以下条件时</div>
<requestGroup />
<requestGroup v-model:addCondition="editMsg.RuleSelectType" ref="condition" @change="getCondition"/>
</div>
<div class="content-block mt20">
<div class="fission-title">分配给以下部门/成员</div>
......@@ -25,8 +25,8 @@
</div>
</div>
<div class="staff-box mt20">
<!-- <q-chip color="primary" text-color="white" icon="work" label="部门"></q-chip>
<q-chip color="accent" text-color="white" icon="person" label="员工"></q-chip> -->
<q-chip color="primary" v-for="(item,index) in editMsg.DeptList" :key='index' text-color="white" icon="work" :label="item.DeptName"></q-chip>
<q-chip color="primary" v-for="(item,index) in editMsg.EmpList" :key='index' text-color="white" icon="person" :label="item.EmployeeName"></q-chip>
</div>
</div>
<div class="content-block mt20">
......@@ -48,6 +48,7 @@
childrenKey="ChildList"
strategy='leaf'
:treeData="dataTree"
@change="getdpt"
/>
</div>
</template>
......@@ -71,9 +72,12 @@ export default defineComponent({
changeDialog,
msg,
data,
condition,
getDetail,
getEmployeeData,
setCustomerClueRuleInfo,
getCondition,
getdpt
} = editRuleModule();
onMounted(() => {
if (msg().RuleId > 0) {
......@@ -85,8 +89,11 @@ export default defineComponent({
return {
jumpBeforePage,
changeDialog,
condition,
...toRefs(data),
setCustomerClueRuleInfo
setCustomerClueRuleInfo,
getCondition,
getdpt
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment