Commit ee691719 authored by Mac's avatar Mac

1

parent eda17e82
......@@ -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', {
......
<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