Commit 4a0b85cd authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/xiangwei/horse into master

# Conflicts:
#	src/api/customer.ts
parents ba312684 ee691719
......@@ -39,6 +39,14 @@
data
})
}
// 客户标签移动
static async setCustomerFiledState(data: {Type:number, SortFiledId:number,FiledId:number}): Promise<HttpResponse> {
return Axios('/QYCustomer/SetCustomerFiledState', {
method: 'post',
responseType: 'json',
data
})
}
// 获取客户线索规则列表
static async getCustomerClueRuleList(data: any): Promise<HttpResponse> {
return Axios('/QYCustomer/GetCustomerClueRuleList', {
......
<style>
.my-special-class {
.my-special-class {
width: 200px;
margin-right: 6px;
}
}
.input_label {
.input_label {
width: 200px;
height: 40px;
border-radius: 4px;
......@@ -15,32 +15,32 @@
align-items: center;
justify-content: space-between;
cursor: pointer;
}
}
.right_select {
.right_select {
width: 40px;
position: absolute;
left: 0;
top: 20px;
}
}
.border_top {
.border_top {
border: 1px solid #d7d7d7;
width: 29px;
border-bottom: none;
border-right: none;
margin-left: 12px;
}
}
.border-bottom {
.border-bottom {
border: 1px solid #d7d7d7;
width: 29px;
border-top: none;
border-right: none;
margin-left: 12px;
}
}
.right_select .border_mid div {
.right_select .border_mid div {
width: 23px;
height: 23px;
text-align: center;
......@@ -49,70 +49,158 @@
font-size: 12px;
cursor: pointer;
background: #d8d8d8;
}
}
.right_select .border_mid .checked {
.right_select .border_mid .checked {
background: #333 !important;
color: #fff !important;
}
.tag-select-input {
}
.tag-select-input {
padding: 4px 10px;
border-radius: 5px;
background-color: #f6f6f6;
font-size: 14px;
}
}
</style>
<template>
<div class="requestgroup">
<div :style="{'position':'relative','padding-left':addMsg.length>1?'40px':'0'}">
<div class="row" v-for="(x,y) in addMsg" :key='y' style="margin-bottom: 8px">
<q-select outlined v-model="x.Name" :options="filedList" dense class="my-special-class" label='请选择客户信息'
option-value="Id" option-label="Name" />
<q-select v-if="x.Type==1 || x.Type=='' " outlined v-model="x.Direction" :options="directionList1" dense
label='请选择' class="my-special-class" option-value="Id" option-label="Name" />
<q-input v-if="x.Type==''" outlined v-model="x.StartValue" label="请输入" dense />
<div v-if="x.Name=='标签'" class="input_label" @click="showlabel(y)">
<div style="display: flex;" v-if="x.StartValue && x.StartValue.length>0">
<div class="text-clamp-1 tag-select-input" style="max-width:110px;">
{{x.StartValue[0].Name}}
</div>
<div v-if="x.StartValue.length>1" class="tag-select-input" style="margin-left: 5px;">
{{x.StartValue.length-1}}+
<div :style="{ 'position': 'relative', 'padding-left': addMsg.length > 1 ? '40px' : '0' }">
<div class="row" v-for="(x,y) in addMsg" :key="y" style="margin-bottom: 8px">
<!-- name -->
<q-select
outlined
v-model="x.Name"
:options="filedList"
dense
class="my-special-class"
label="请选择客户信息"
option-value="Id"
option-label="Name"
option-disable="disable"
emit-value
map-options
@update:model-value="changeName($event, y)"
/>
<!-- Direction -->
<q-select
v-if="x.Type === 1 || x.Type === 2 || x.Type === 5 || x.Type == ''"
outlined
v-model="x.Direction"
:options="x.directionList"
dense
label="请选择"
class="my-special-class"
option-value="Id"
option-label="Name"
emit-value
map-options
/>
<!-- StartValue -->
<div v-if="x.Name == '标签'" class="input_label" @click="showlabel(y)">
<div style="display: flex;" v-if="x.StartValue && x.StartValue.length > 0">
<div
class="text-clamp-1 tag-select-input"
style="max-width:110px;"
>{{ x.StartValue[0].Name }}</div>
<div
v-if="x.StartValue.length > 1"
class="tag-select-input"
style="margin-left: 5px;"
>{{ x.StartValue.length - 1 }}+</div>
</div>
<div v-if="x.StartValue && x.StartValue.length > 0" class="lablec">
<i
style="font-size: 16px;"
class="el-icon-error"
@click.stop="addMsg[y].StartValue = []"
></i>
</div>
<div v-if="x.StartValue && x.StartValue.length>0" class="lablec">
<i style="font-size: 16px;" class="el-icon-error"
@click.stop="addMsg[y].StartValue=[]"></i>
</div>
<div
v-if="(x.Type === 1 || x.Type === 2 || x.Type === 5 || x.Type == '') && x.Name !== '标签'"
>
<q-select
v-if="x.isSelect"
outlined
v-model="x.StartValue"
:options="x.OptionsList"
dense
label="请选择"
class="my-special-class"
option-value="Id"
option-label="Name"
emit-value
map-options
/>
<q-input v-if="!x.isSelect&&x.Direction" outlined v-model="x.StartValue" label="请输入" dense />
</div>
<!-- 新增和删除 -->
<div style="display: flex;align-items: center;">
<img src="../../assets/images/customer/delete.png" alt="" v-if="addMsg.length>1"
style='width: 20px;height: 20px;margin-left: 10px;' @click="deleteadd(y)" />
<img src="../../assets/images/customer/add.png" alt="" v-if="addMsg.length==y+1"
style='width: 20px;height: 20px;margin-left: 10px;' @click="addsList()" />
<img
src="../../assets/images/customer/delete.png"
alt
v-if="addMsg.length > 1"
style="width: 20px;height: 20px;margin-left: 10px;"
@click="deleteadd(y)"
/>
<img
src="../../assets/images/customer/add.png"
alt
v-if="addMsg.length == y + 1"
style="width: 20px;height: 20px;margin-left: 10px;"
@click="addsList()"
/>
</div>
</div>
<div data-v-0dbac2e3="" class="right_select" v-if="addMsg.length>1">
<div data-v-0dbac2e3="" class="border_top"
:style="{height:((addMsg.length*48 -8 - 46 - 40 )/2) + 'px'}"></div>
<div data-v-0dbac2e3="" class="border_mid">
<div data-v-0dbac2e3="" class="and" :class="{ 'checked': addtion == 1 }" @click="addtion=1">且</div>
<div data-v-0dbac2e3="" class="no" :class="{ 'checked': addtion == 2 }" @click="addtion=2">或</div>
<div class="right_select" v-if="addMsg.length > 1">
<div
class="border_top"
: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>
<div data-v-0dbac2e3="" class="border-bottom"
:style="{height:((addMsg.length*48 -8 - 46 - 40 )/2) + 'px'}"></div>
<div
class="border-bottom"
:style="{ height: ((addMsg.length * 48 - 8 - 46 - 40) / 2) + 'px' }"
></div>
</div>
</div>
<labelgroup v-if="isshowlabel" :list='LableList' @close="isshowlabel=false" @submit='getlabel'></labelgroup>
<labelgroup
v-if="isshowlabel"
:list="LableList"
@close="isshowlabel = false"
@submit="getlabel"
></labelgroup>
</div>
</template>
<script>
import { defineComponent, ref, onMounted } from 'vue'
import customerService from '@/api/customer'
import labelgroup from './label-group.vue'
export default defineComponent({
<script lang="ts">
import {
defineComponent,
ref,
watch,
onMounted
} from 'vue'
import customerService from '@/api/customer'
import labelgroup from './label-group.vue'
interface params {
Name: number | string
IsCustom: number
Type: number | string
Id?: number | string
Direction?: string
StartValue?: string
EndValue?: string
disable?: boolean
directionList?: Array<any>
OptionsList?: Array<any>
isSelect?: boolean
}
export default defineComponent({
props: {
addCondition: {
type: Number,
......@@ -124,85 +212,253 @@
},
setup(props) {
let addtion = ref(props.addCondition)
let filedList = ref([]);//客户字段数组
let addMsg = ref([])//筛选数组
let isshowlabel = ref(false)//标签弹出显示
let selectindex = ref(0)//现在筛选数组 索引
let LableList = []//标签的数组
const directionList1 = ref([{ Id: 1, Name: '包含所有' }, { Id: 2, Name: '包含任意' }, { Id: 3, Name: '不包含' }, { Id: 4, Name: '为空' }, { Id: 5, Name: '不为空' },])
const directionList2 = ref([{ Id: 1, Name: '等于' }, { Id: 1, Name: '不等于' }, { Id: 1, Name: '为空' }, { Id: 1, Name: '不为空' }, { Id: 1, Name: '模糊' },])
const directionList5 = ref([{ Id: 1, Name: '等于' }, { Id: 1, Name: '大于' }, { Id: 1, Name: '大于等于' }, { Id: 1, Name: '小于' }, { Id: 1, Name: '小于等于' },])
onMounted(() => {//进入页面就调用
getCustomerFiledList();//获取客户字段
})
const getCustomerFiledList = () => {
let filedList = ref<Array<params>>([]); //客户字段数组
let addMsg = ref<Array<params>>([]) //筛选数组
let isshowlabel = ref(false) //标签弹出显示
let selectindex = ref(0) //现在筛选数组 索引
let LableList = ref<Array<any> | string>([]) //标签的数组
const directionList1 = [{
Id: 1,
Name: '包含所有'
}, {
Id: 2,
Name: '包含任意'
}, {
Id: 3,
Name: '不包含'
}, {
Id: 4,
Name: '为空'
}, {
Id: 5,
Name: '不为空'
},]
const directionList2 = [{
Id: 1,
Name: '等于'
}, {
Id: 2,
Name: '不等于'
}, {
Id: 3,
Name: '为空'
}, {
Id: 4,
Name: '不为空'
}, {
Id: 5,
Name: '模糊'
},]
const directionList5 = [{
Id: 1,
Name: '等于'
}, {
Id: 2,
Name: '大于'
}, {
Id: 3,
Name: '大于等于'
}, {
Id: 4,
Name: '小于'
}, {
Id: 5,
Name: '小于等于'
},]
customerService.getCustomerFiledList({ Enable: 1 }).then((res) => {
const getCustomerFiledList = () => {
customerService.getCustomerFiledList({
Enable: 1
}).then((res) => {
let data = res.data.Data
filedList.value = data;
filedList.value.forEach((x) => {// IsCustom 是否自定义字段 1是 2标签 3阶段
filedList.value.forEach((x) => { // IsCustom 是否自定义字段 1是 2标签 3阶段
x.IsCustom = 1
})
let obj = { Id: '客户阶段', Name: '客户阶段', Type: 3, IsCustom: 3 }
getCustomerStageList(); //获取客户阶段
})
}
const getCustomerStageList = () => {
customerService.getCustomerStageList({}).then(res => {
let obj: params = {
Id: '客户阶段',
Name: '客户阶段',
Type: 3,
IsCustom: 3,
OptionsList: res.data.Data
}
filedList.value.unshift(obj)
let obj2 = { Id: '标签', Name: '标签', Type: 4, IsCustom: 2 }
filedList.value.unshift(obj2)
let type = 1;
if (filedList.value[0].Type == 4) {//多选
type = 1;
let obj2: params = {
Id: '标签',
Name: '标签',
Type: 4,
IsCustom: 2
}
filedList.value.unshift(obj2)
addMsg.value.push({
Name: filedList.value[0].Id,
Type: type,
Name: '标签',
Type: 1,
Direction: '',
StartValue: '',
EndValue: '',
IsCustom: filedList.value[0].IsCustom,
IsCustom: 2,
directionList: directionList1
})
console.log("标签", filedList.value)
})
}
const deleteadd = (index) => {//删除addMsg某一项
const deleteadd = (index) => { //删除addMsg某一项
addMsg.value.splice(index, 1)
}
const addsList = () => {
let obj = {
let obj: params = {
Name: '',
Type: '',
Direction: '',
StartValue: '',
EndValue: '',
IsCustom: '2',
IsCustom: 2,
directionList: directionList2
}
addMsg.value.push(obj)
}
const showlabel = (y) =>{
const showlabel = (y) => {
selectindex.value = y;
if(addMsg.value[y].StartValue==''){//为空赋值为数组
if (addMsg.value[y].StartValue == '') { //为空赋值为数组
LableList.value = []
}else{
LableList.value = addMsg.value[y].StartValue
} else {
LableList.value = addMsg.value[y].StartValue || ''
}
isshowlabel.value = true
}
const getlabel=(list)=> {
const getlabel = (list) => {
isshowlabel.value = false;
addMsg.value[selectindex.value].StartValue = list
}
//----------------------------------------------------------------------------
// 禁用标签
let changeLabel = () => {
let find: any = addMsg.value.find((e) => {
return e.Name == '标签'
})
if (find) {
filedList.value.map((_e) => {
if (_e.Id == '标签') {
_e.disable = true
}
})
} else {
filedList.value.map((_e) => {
if (_e.Id == '标签') {
_e.disable = false
}
})
}
//禁用生日
let find2: any = addMsg.value.find((e) => {
return e.Name == 26
})
if (find2) {
filedList.value.map((_e) => {
if (_e.Id == 26) {
_e.disable = true
}
})
} else {
filedList.value.map((_e) => {
if (_e.Id == 26) {
_e.disable = false
}
})
}
}
//标签改变
let changeName = (val: any, y: number) => {
switch (val) {
case "标签": {
addMsg.value[y].IsCustom = 2
break;
}
case "客户阶段": {
addMsg.value[y].IsCustom = 3
break;
}
default: {
addMsg.value[y].IsCustom = 1
}
}
let find: any = filedList.value.find((e) => {
return e.Id == val
})
console.log(400, find)
switch (find.Type) {
case 1: {
addMsg.value[y].directionList = directionList2
addMsg.value[y].Type = 2
addMsg.value[y].isSelect = false
break;
}
case 2: {
addMsg.value[y].directionList = directionList2
addMsg.value[y].Type = 2
addMsg.value[y].isSelect = false
break;
}
case 3: {
addMsg.value[y].directionList = directionList2
addMsg.value[y].Type = 2
if (find.OptionsList) {
addMsg.value[y].isSelect = true
addMsg.value[y].OptionsList = find.OptionsList
}
break;
}
case 4: {
addMsg.value[y].directionList = directionList1
addMsg.value[y].Type = 1
if (find.OptionsList) {
addMsg.value[y].isSelect = true
addMsg.value[y].OptionsList = find.OptionsList
}
console.log(426, addMsg.value[y])
break;
}
case 5: {
addMsg.value[y].Type = 3
addMsg.value[y].isSelect = false
break;
}
case 6: {
addMsg.value[y].Type = 4
addMsg.value[y].isSelect = false
break;
}
case 7: {
addMsg.value[y].directionList = directionList5
addMsg.value[y].Type = 5
addMsg.value[y].isSelect = false
break;
}
}
}
watch(() => [...addMsg.value], (val) => {
console.log('watch', val)
changeLabel()
}, { deep: true })
onMounted(() => { //进入页面就调用
getCustomerFiledList(); //获取客户字段
})
return {
getCustomerFiledList,
filedList,
addMsg,
directionList1,
directionList2,
directionList5,
deleteadd,
addsList,
addtion,
......@@ -210,9 +466,10 @@
selectindex,
LableList,
showlabel,
getlabel
getlabel,
changeName
}
}
})
})
</script>
\ No newline at end of file
<template>
<requestgroup></requestgroup>
<!-- <requestgroup></requestgroup> -->
<div class="q-pa-md customerField">
<table class="payTable">
<thead>
......@@ -30,11 +30,11 @@
<q-toggle v-if="element.IsLock==1" v-model="element.Enable" :true-value="1" :false-value="2"
icon="lock" disable />
<q-toggle v-else v-model="element.Enable" :true-value="1" :false-value="2"
@input="godelete(element,1,index)" />
@update:model-value="godelete(element,1,index)" />
</td>
<td>
<q-toggle v-model="element.Required" :true-value="1" :false-value="2"
@input="godelete(element,2,index)" />
@update:model-value="godelete(element,2,index)" />
</td>
<td>
<div>{{element.UpdateByName}}</div>
......@@ -47,7 +47,7 @@
class="q-mr-xs" label="删除" @click="godelete(element,3,index)" />
</td>
<td>
<i class="iconfont icon-weiyi" style="font-size: 14px;color: #777;"></i>
<i class="iconfont icon-drag" style="font-size: 20px;color: #777;"></i>
</td>
</tr>
</template>
......@@ -58,28 +58,109 @@
</div>
</template>
<script lang="ts">
import { defineComponent ,ref, onMounted } from 'vue'
import { defineComponent ,ref, onMounted,reactive } from 'vue'
import requestgroup from '../../../components/customer/request-group.vue'
import customerService from '@/api/customer'
import draggable from "vuedraggable";
import { useQuasar } from 'quasar'
interface listType {
Id: number
Enable:number
Required:number
[propName:string]:any
}
export default defineComponent({
components: { draggable ,requestgroup},
setup() {
const data =ref([]);
const dragId =ref(0);
const $q = useQuasar()
let data= ref<Array<listType>>([])
let dragId =ref(0);
const changePage = () => {
customerService.getCustomerFiledList({ Enable: -1 }).then((res) => {
data.value=res.data.Data
})
}
const datadragEnd = (e:any) => {
console.log('拖动结束',e)
// console.log('拖动结束',e)
let olddragId = 0
if(e.newIndex>0){
olddragId = data.value[e.newIndex-1].Id
}else{
olddragId = 0
}
let msg = {
Type: 4,
FiledId: dragId.value,
SortFiledId: olddragId,
}
customerService.setCustomerFiledState(msg).then((res) => {
if (res.data.Code == 1) {
}else{//如果移动失败 重新获取列表
changePage()
}
})
}
const getdata = (e:any) => {
console.log('拖动结束22323',e)
dragId.value = e.draggedContext.element.Id
}
const setFiledState = (item, Type) => {
let msg = {
Type: Type,
FiledId: item.Id,
SortFiledId: 0,
}
customerService.setCustomerFiledState(msg).then((res) => {
if (res.data.Code == 1) {
$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: `操作成功`,
position: 'top'
})
changePage()
}else{//如果移动失败 重新获取列表
}
})
}
const godelete = (item:any,type:number,index:number) => {
let text = ''
if(type==1){//tyep等于1和2的时候 先让弹出提示 然后再给予掉接口 所以把原本的值暂时先赋值给本身
text = '确定修改启用状态'
if(item.Enable==2){
data.value[index].Enable = 1
}else{
data.value[index].Enable = 2
}
}else if(type==2){
text = '确定修改必填状态'
if(item.Required==2){
data.value[index].Required = 1
}else{
data.value[index].Required = 2
}
}else if(type==3){
text = '删除后字段不在显示,是否删除?'
}
console.log(text)
$q.dialog({
title: "提示信息",
message: text,
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
setFiledState(item, type)
});
}
onMounted(() => {
changePage()
......@@ -89,7 +170,9 @@
data,
changePage,
datadragEnd,
getdata
getdata,
godelete,
setFiledState
}
}
......@@ -107,7 +190,7 @@
font-size: 12px;
font-weight: bold;
color: #2D2D2D;
background: #DDDEE0;
background: #f5f5fa;
}
.customerField .payTable tr {
......
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