懒加载
parent
f99a823ca9
commit
bd50c3fc95
|
|
@ -372,10 +372,10 @@ const setList = (newProducts) => {
|
|||
// 改版账期
|
||||
const changePayment = (val) => {
|
||||
|
||||
const currentDate = new Date(); // 获取当前日期
|
||||
const currentMonth = currentDate.getMonth() + 1; // 获取当前月份(注意月份是从0开始的,所以需要加1)
|
||||
const daysInMonth = new Date(currentDate.getFullYear(), currentMonth, 0).getDate(); // 获取指定月份的天数
|
||||
formData.value.creditCalcCycle = (val > 2 ? parseInt(daysInMonth + Number(val)) : 0)
|
||||
// const currentDate = new Date(); // 获取当前日期
|
||||
// const currentMonth = currentDate.getMonth() + 1; // 获取当前月份(注意月份是从0开始的,所以需要加1)
|
||||
// const daysInMonth = new Date(currentDate.getFullYear(), currentMonth, 0).getDate(); // 获取指定月份的天数
|
||||
formData.value.creditCalcCycle = (val > 2 ? parseInt(30 + Number(val)) : 0)
|
||||
formData.value.creditLimit = parseInt(formData.value.totalPrice / 365 * formData.value.creditCalcCycle)
|
||||
}
|
||||
const { push } = useRouter()
|
||||
|
|
|
|||
|
|
@ -37,16 +37,23 @@
|
|||
<el-select
|
||||
:disabled="formData.customerDefault"
|
||||
v-model="formData.customerId"
|
||||
:loading="loading"
|
||||
loading-text="数据加载中..."
|
||||
filterable
|
||||
placeholder="请选择客户"
|
||||
class="w-1/1"
|
||||
>
|
||||
clearable
|
||||
popper-class="event-select-poper"
|
||||
v-el-select-loadmore="loadmore"
|
||||
:placeholder="placeholder"
|
||||
style="width: 100%"
|
||||
:filter-method="filterOptions"
|
||||
@change="handleEventsChange"
|
||||
@visible-change="handleVisibleChange">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
:value="item.id" />
|
||||
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -59,7 +66,7 @@
|
|||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电话" prop="telephone">
|
||||
<el-input v-model="formData.telephone" placeholder="请输入电话" />
|
||||
<el-input v-model="formData.telephone" oninput = "value=value.replace(/[^\d]/g,'')" placeholder="请输入电话" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
|
|
@ -204,12 +211,26 @@ const formData = ref({
|
|||
const formRules = reactive({
|
||||
name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
||||
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
||||
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
|
||||
email: [{ required: false, message: '电子邮箱不能为空', trigger: 'blur' } ,
|
||||
{
|
||||
pattern:
|
||||
/^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})$/,
|
||||
message: "请输入正确的电子邮箱",
|
||||
}
|
||||
],
|
||||
mobile: [{ required: false, message: '手机号不能为空', trigger: 'blur' } ,
|
||||
{pattern: /^(1[3-9][0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/, message: '请输入正确手机号'}
|
||||
],
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const customerList = ref<CustomerApi.CustomerVO[]>([]) // 客户列表
|
||||
const contactList = ref<ContactApi.ContactVO[]>([]) // 联系人列表
|
||||
let pageNo = ref(1)
|
||||
let pageSize = ref(10)
|
||||
let total = 0
|
||||
const options = ref([]);
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number, customerId?: number, businessId?: number) => {
|
||||
|
|
@ -226,6 +247,7 @@ const open = async (type: string, id?: number, customerId?: number, businessId?:
|
|||
formLoading.value = false
|
||||
}
|
||||
} else {
|
||||
// console.log('%csrc/views/crm/contact/ContactForm.vue:229 customerId', 'color: #007acc;', customerId);
|
||||
if (customerId) {
|
||||
formData.value.customerId = customerId
|
||||
formData.value.customerDefault = true // 默认客户的选择,不允许变
|
||||
|
|
@ -239,6 +261,7 @@ const open = async (type: string, id?: number, customerId?: number, businessId?:
|
|||
contactList.value = await ContactApi.getSimpleContactList()
|
||||
// 获得客户列表
|
||||
customerList.value = await CustomerApi.getSelfCustomerSimpleList()
|
||||
options.value = customerList.value.slice(0, 10)
|
||||
// 获得地区列表
|
||||
areaList.value = await AreaApi.getAreaTree()
|
||||
// 获得用户列表
|
||||
|
|
@ -301,4 +324,81 @@ const resetForm = () => {
|
|||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
const loading = ref(false);
|
||||
const placeholder = ref('请选择');
|
||||
const allFilterEvents = reactive([]);
|
||||
const vElSelectLoadmore = {
|
||||
beforeMount(el, binding) {
|
||||
const selectDom = document.querySelector('.event-select-poper .el-select-dropdown__wrap');
|
||||
const loadMores = function() {
|
||||
const isBase = this.scrollHeight - this.scrollTop <= this.clientHeight + 20;
|
||||
if (isBase) {
|
||||
binding.value && binding.value();
|
||||
}
|
||||
};
|
||||
el.selectDomInfo = selectDom;
|
||||
el.selectLoadMore = loadMores;
|
||||
selectDom?.addEventListener('scroll', loadMores.bind(selectDom));
|
||||
},
|
||||
beforeUnmount(el) {
|
||||
if (el.selectLoadMore) {
|
||||
el.selectDomInfo.removeEventListener('scroll', el.selectLoadMore);
|
||||
delete el.selectDomInfo;
|
||||
delete el.selectLoadMore;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
watch(() => allFilterEvents, () => {
|
||||
let startIndex = pageNo.value * pageSize.value - pageSize.value;
|
||||
let endIndex = pageNo.value * pageSize.value;
|
||||
options.value = allFilterEvents.slice(startIndex, endIndex);
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true
|
||||
});
|
||||
|
||||
const loadmore = () => {
|
||||
if (customerList.value.length <= options.value.length) return;
|
||||
pageNo.value++;
|
||||
nextTick(() => {
|
||||
loading.value = true;
|
||||
let startIndex = pageNo.value * pageSize.value - pageSize.value;
|
||||
let endIndex = pageNo.value * pageSize.value;
|
||||
options.value = [
|
||||
...options.value,
|
||||
...customerList.value.slice(startIndex, endIndex)
|
||||
];
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const filterOptions = (query = '') => {
|
||||
pageNo.value = 1;
|
||||
nextTick(() => {
|
||||
if (query === '') {
|
||||
allFilterEvents.splice(0, allFilterEvents.length, ...customerList.value);
|
||||
} else {
|
||||
allFilterEvents.splice(0, allFilterEvents.length, ...customerList.value.filter(item => item.name.includes(query)));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleVisibleChange = (visible) => {
|
||||
if (!visible) {
|
||||
pageNo.value = 1;
|
||||
nextTick(() => {
|
||||
allFilterEvents.splice(0, allFilterEvents.length, ...customerList.value);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleEventsChange = (val) => {
|
||||
console.log('Selected value:', val);
|
||||
};
|
||||
|
||||
|
||||
// onMounted(async() => {
|
||||
// })
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ const handleQuery = () => {
|
|||
/** 添加操作 */
|
||||
const formRef = ref()
|
||||
const openForm = () => {
|
||||
formRef.value.open('create', undefined, props.customerId, props.businessId)
|
||||
formRef.value.open('create', undefined, props.bizId, props.businessId)
|
||||
}
|
||||
|
||||
/** 打开联系人详情 */
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ const resetQuery = () => {
|
|||
/** 添加操作 */
|
||||
const formRef = ref()
|
||||
const openForm = () => {
|
||||
formRef.value.open('create')
|
||||
formRef.value.open('create', '', Number(props.customerId))
|
||||
}
|
||||
|
||||
/** 关联联系人提交 */
|
||||
|
|
|
|||
|
|
@ -266,13 +266,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="客户详情" prop="customerDetails">
|
||||
<el-input v-model="formData.customerDetails" type="textarea" placeholder="请输入客户详情" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
分配
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="customer.ownerUserId && permissionListRef?.validateOwnerUser"
|
||||
v-if="customer.ownerUserId && permissionListRef?.validateOwnerUser && !customer.dealStatus"
|
||||
@click="handlePutPool"
|
||||
>
|
||||
放入公海
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="拓展人" prop="expanderUserId">
|
||||
<el-select v-model="formData.expanderUserId" placeholder="请选择拓展人">
|
||||
<el-option
|
||||
|
|
@ -245,7 +245,7 @@
|
|||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="方案报价人" prop="pricingUserId">
|
||||
<el-select v-model="formData.pricingUserId" disabled placeholder="请选择方案报价人">
|
||||
|
|
@ -258,7 +258,7 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="报价签约人" prop="signUserId">
|
||||
<el-select v-model="formData.signUserId" placeholder="请选择报价签约人">
|
||||
<el-option
|
||||
|
|
@ -269,7 +269,7 @@
|
|||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="签约人联系电话" prop="signPhoneNumber">
|
||||
<el-input v-model="formData.signPhoneNumber" placeholder="请输入签约人联系电话" />
|
||||
|
|
@ -323,12 +323,8 @@
|
|||
</el-select> -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信额度" prop="creditLimit">
|
||||
<el-input v-model="formData.creditLimit" placeholder="请输入授信额度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="票据模板" prop="invoiceTemplateId">
|
||||
<el-select v-model="formData.invoiceTemplateId" :disabled="!formData.businessId" @change="changeTemplate" placeholder="请选择票据模板">
|
||||
<el-option
|
||||
|
|
@ -340,12 +336,16 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="第几次报价" prop="quotationTimes">
|
||||
<el-input v-model="formData.quotationTimes" placeholder="请输入报价次数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="第几次报价" prop="quotationTimes">
|
||||
<el-input v-model="formData.quotationTimes" placeholder="请输入报价次数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信额度" prop="creditLimit">
|
||||
<el-input v-model="formData.creditLimit" placeholder="请输入授信额度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
<el-option
|
||||
v-for="dict in TaskOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:label="dict.userName"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<el-option
|
||||
v-for="dict in TaskOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:label="dict.userName"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue