客户组

This commit is contained in:
‘huanghaiixia’
2025-12-17 16:06:44 +08:00
parent 1eee4dcd60
commit a27bf90e9d
16 changed files with 2773 additions and 615 deletions

View File

@ -1,21 +1,21 @@
<template>
<SimpleForm
class="formViewStyle"
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU">
<template #dateFrom="{ formModel }">
<FormItem label="起始日期" :label-col="{ span: 5, offset: 0 }" labelAlign="right" name="dateFrom" class="dateStyle">
<a-date-picker v-model:value="formModel.dateFrom" format="YYYY-MM-DD" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择" />
<a-date-picker v-model:value="formModel.dateFrom" :disabled="isView" format="YYYY-MM-DD" :disabled-date="disabledDateStart" style="width: 100%" placeholder="请选择" />
</FormItem>
</template>
<template #dateTo="{ formModel }">
<FormItem label="结束日期" labelAlign="right" name="dateTo" class="dateStyle">
<a-date-picker v-model:value="formModel.dateTo" format="YYYY-MM-DD" :disabled-date="disabledDateEnd" style="width: 100%" placeholder="请选择" />
<a-date-picker v-model:value="formModel.dateTo" :disabled="isView" format="YYYY-MM-DD" :disabled-date="disabledDateEnd" style="width: 100%" placeholder="请选择" />
</FormItem>
</template>
</template>
</SimpleForm>
<a-card :bordered="false" >
<template #title>
<div style="display: flex; align-items: center;">
@ -27,15 +27,6 @@
<a-button v-if="!isView" type="primary" style="margin-bottom: 10px;" @click="handleAdd">新增组成员</a-button>
<a-table :columns="columns" :data-source="dataList" :pagination="false">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'natureCode'">
{{ (optionSelect.natureCodeList.find(v=>v.code == record.natureCode) || {}).name }}
</template>
<template v-if="column.dataIndex === 'typeCode'">
{{ (optionSelect.typeCodeList.find(v=>v.code == record.typeCode) || {}).name }}
</template>
<template v-if="column.dataIndex === 'classCode'">
{{ (optionSelect.classCodeList.find(v=>v.code == record.classCode) || {}).name }}
</template>
<template v-if="column.dataIndex === 'operation'">
<a @click="btnCheck(record, index)">删除</a>
</template>
@ -62,7 +53,7 @@
import { useI18n } from '/@/hooks/web/useI18n';
import { useModal } from '/@/components/Modal';
import customerListModal from './customerListModal.vue';
import { getDictionary } from '/@/api/sales/Customer';
import dayjs from 'dayjs';
const FormItem = Form.Item;
const { t } = useI18n();
@ -99,11 +90,6 @@
{ title: t('操作'), dataIndex: 'operation', width: 120},
]);
const dataList = ref([])
const optionSelect = reactive({
natureCodeList: [],
classCodeList: [],
typeCodeList: []
})
const isView = ref(false)
const disabledDateStart = (startValue) => {
@ -144,15 +130,19 @@
}
})
})
dataList.value = [...dataList.value, ...arr]
dataList.value = unique([...dataList.value, ...arr], 'cuCode')
}
async function getOption() {
optionSelect.natureCodeList = await getDictionary('LNG_ENT_PR')
optionSelect.classCodeList = await getDictionary('LNG_CLASS')
optionSelect.typeCodeList = await getDictionary('LNG_CU_TYP')
function unique(arr, u_key) {
const map = new Map()
arr.forEach((item, index) => {
if (!map.has(item[u_key])) {
map.set(item[u_key], item)
}
})
return [...map.values()]
}
onMounted(async () => {
getOption()
isView.value = currentRoute.value?.fullPath.includes('viewForm')
if (isView.value) {
let idx = columns.value.findIndex(v =>v.dataIndex=='operation')
@ -231,7 +221,9 @@
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getLngCustomerGroup(rowId);
let record = await getLngCustomerGroup(rowId);
record.dateFrom = record.dateFrom ? dayjs(record.dateFrom) : null
record.dateTo = record.dateTo ? dayjs(record.dateTo) : null
if (skipUpdate) {
return record;
}

View File

@ -13,6 +13,7 @@ export const searchFormSchema: FormSchema[] = [
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
allowClear: true,
getPopupContainer: () => document.body,
},
},
@ -47,7 +48,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'typeCode',
dataIndex: 'typeName',
title: '类型',
componentType: 'select',
align: 'left',

View File

@ -99,12 +99,12 @@
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateFrom', ['dateFromStart', 'dateFromEnd'], 'YYYY-MM-DD HH:mm:ss ', true],
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true],
['dateTo', ['dateToStart', 'dateToEnd'], 'YYYY-MM-DD HH:mm:ss ', true],],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
clearSelectedRowKeys()