客户组
This commit is contained in:
90
src/api/sales/CustomerGroup/index.ts
Normal file
90
src/api/sales/CustomerGroup/index.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { LngCustomerGroupPageModel, LngCustomerGroupPageParams, LngCustomerGroupPageResult } from './model/CustomerGroupModel';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
Page = '/sales/customerGroup/page',
|
||||||
|
List = '/sales/customerGroup/list',
|
||||||
|
Info = '/sales/customerGroup/info',
|
||||||
|
LngCustomerGroup = '/sales/customerGroup',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DataLog = '/sales/customerGroup/datalog',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询LngCustomerGroup分页列表
|
||||||
|
*/
|
||||||
|
export async function getLngCustomerGroupPage(params: LngCustomerGroupPageParams, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngCustomerGroupPageResult>(
|
||||||
|
{
|
||||||
|
url: Api.Page,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取LngCustomerGroup信息
|
||||||
|
*/
|
||||||
|
export async function getLngCustomerGroup(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngCustomerGroupPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.Info,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增LngCustomerGroup
|
||||||
|
*/
|
||||||
|
export async function addLngCustomerGroup(lngCustomerGroup: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngCustomerGroup,
|
||||||
|
params: lngCustomerGroup,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 更新LngCustomerGroup
|
||||||
|
*/
|
||||||
|
export async function updateLngCustomerGroup(lngCustomerGroup: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.put<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngCustomerGroup,
|
||||||
|
params: lngCustomerGroup,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除LngCustomerGroup(批量删除)
|
||||||
|
*/
|
||||||
|
export async function deleteLngCustomerGroup(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.delete<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngCustomerGroup,
|
||||||
|
data: ids,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
44
src/api/sales/CustomerGroup/model/CustomerGroupModel.ts
Normal file
44
src/api/sales/CustomerGroup/model/CustomerGroupModel.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngCustomerGroup分页参数 模型
|
||||||
|
*/
|
||||||
|
export interface LngCustomerGroupPageParams extends BasicPageParams {
|
||||||
|
grpCode: string;
|
||||||
|
|
||||||
|
typeCode: string;
|
||||||
|
|
||||||
|
dateFrom: string;
|
||||||
|
|
||||||
|
dateTo: string;
|
||||||
|
|
||||||
|
grpName: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngCustomerGroup分页返回值模型
|
||||||
|
*/
|
||||||
|
export interface LngCustomerGroupPageModel {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
grpCode: string;
|
||||||
|
|
||||||
|
typeCode: string;
|
||||||
|
|
||||||
|
dateFrom: string;
|
||||||
|
|
||||||
|
dateTo: string;
|
||||||
|
|
||||||
|
grpName: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngCustomerGroup分页返回值结构
|
||||||
|
*/
|
||||||
|
export type LngCustomerGroupPageResult = BasicFetchResult<LngCustomerGroupPageModel>;
|
||||||
@ -3,8 +3,13 @@
|
|||||||
ref="systemFormRef"
|
ref="systemFormRef"
|
||||||
:formProps="data.formDataProps"
|
:formProps="data.formDataProps"
|
||||||
:formModel="{}"
|
:formModel="{}"
|
||||||
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
:isWorkFlow="props.fromPage!=FromPageType.MENU">
|
||||||
/>
|
<template #pid="{ formModel }">
|
||||||
|
<FormItem label="上级ID" :label-col="{ span: 7, offset: 0 }" labelAlign="right" name="pid">
|
||||||
|
{{ formModel.pid == '0' ? '' : formModel.pid }}
|
||||||
|
</FormItem>
|
||||||
|
</template>
|
||||||
|
</SimpleForm>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
||||||
@ -20,6 +25,8 @@
|
|||||||
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||||
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { Form, Col, Row, Tabs, TabPane, Divider } from 'ant-design-vue';
|
||||||
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
const { filterFormSchemaAuth } = usePermission();
|
const { filterFormSchemaAuth } = usePermission();
|
||||||
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
||||||
|
|||||||
@ -316,10 +316,10 @@ export const formProps: FormProps = {
|
|||||||
key: 'ed8d105c346a4306bf6502ecca668328',
|
key: 'ed8d105c346a4306bf6502ecca668328',
|
||||||
field: 'pid',
|
field: 'pid',
|
||||||
label: '上级ID',
|
label: '上级ID',
|
||||||
type: 'input',
|
type: 'slot',
|
||||||
component: 'Input',
|
|
||||||
colProps: { span: 8 },
|
colProps: { span: 8 },
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
|
slotName: 'pid',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
span: '',
|
span: '',
|
||||||
|
|||||||
@ -2,10 +2,7 @@
|
|||||||
<div class="bankListTb">
|
<div class="bankListTb">
|
||||||
<BasicModal v-bind="$attrs" :zIndex="1001" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
|
<BasicModal v-bind="$attrs" :zIndex="1001" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
|
||||||
@visible-change="handleVisibleChange" >
|
@visible-change="handleVisibleChange" >
|
||||||
<BasicTable @register="registerTable" class="bankListModal">
|
<BasicTable @register="registerTable" class="bankListModal"></BasicTable>
|
||||||
|
|
||||||
</BasicTable>
|
|
||||||
|
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -95,21 +92,6 @@
|
|||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
|
||||||
if (unref(isUpdate)) {
|
|
||||||
rowId.value = data.record.id;
|
|
||||||
const record = await getCodeRuleInfo(data.record.id);
|
|
||||||
|
|
||||||
let datas = JSON.parse({ ...record }.formatJson);
|
|
||||||
datas.forEach((data) => {
|
|
||||||
if (!data.sortNum) {
|
|
||||||
data.sortNum = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
setTableData(datas);
|
|
||||||
} else {
|
|
||||||
setTableData([]);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
|
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
|
||||||
|
|||||||
110
src/views/sales/CustomerGroup/components/CustomerGroupModal.vue
Normal file
110
src/views/sales/CustomerGroup/components/CustomerGroupModal.vue
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||||
|
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||||
|
</BasicModal>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed, reactive } from 'vue';
|
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { formProps } from './config';
|
||||||
|
import ModalForm from './Form.vue';
|
||||||
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
|
|
||||||
|
const emit = defineEmits(['success', 'register']);
|
||||||
|
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const formRef = ref();
|
||||||
|
const state = reactive({
|
||||||
|
formModel: {},
|
||||||
|
isUpdate: true,
|
||||||
|
isView: false,
|
||||||
|
isCopy: false,
|
||||||
|
rowId: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
state.isUpdate = !!data?.isUpdate;
|
||||||
|
state.isView = !!data?.isView;
|
||||||
|
state.isCopy = !!data?.isCopy;
|
||||||
|
|
||||||
|
setModalProps({
|
||||||
|
destroyOnClose: true,
|
||||||
|
maskClosable: false,
|
||||||
|
showCancelBtn: !state.isView,
|
||||||
|
showOkBtn: !state.isView,
|
||||||
|
canFullscreen: true,
|
||||||
|
width: 900,
|
||||||
|
});
|
||||||
|
if (state.isUpdate || state.isView || state.isCopy) {
|
||||||
|
state.rowId = data.id;
|
||||||
|
if (state.isView) {
|
||||||
|
await formRef.value.setDisabledForm();
|
||||||
|
}
|
||||||
|
await formRef.value.setFormDataFromId(state.rowId);
|
||||||
|
} else {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||||
|
|
||||||
|
async function saveModal() {
|
||||||
|
let saveSuccess = false;
|
||||||
|
try {
|
||||||
|
const values = await formRef.value?.validate();
|
||||||
|
//添加隐藏组件
|
||||||
|
if (formProps.hiddenComponent?.length) {
|
||||||
|
formProps.hiddenComponent.forEach((component) => {
|
||||||
|
values[component.bindField] = component.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (values !== false) {
|
||||||
|
try {
|
||||||
|
if (!state.isUpdate || state.isCopy) {
|
||||||
|
saveSuccess = await formRef.value.add(values);
|
||||||
|
} else {
|
||||||
|
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
|
||||||
|
}
|
||||||
|
return saveSuccess;
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return saveSuccess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const saveSuccess = await saveModal();
|
||||||
|
setModalProps({ confirmLoading: true });
|
||||||
|
if (saveSuccess) {
|
||||||
|
if (!state.isUpdate || state.isCopy) {
|
||||||
|
//false 新增
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('新增成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
} else {
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('修改成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
}
|
||||||
|
closeModal();
|
||||||
|
formRef.value.resetFields();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
368
src/views/sales/CustomerGroup/components/Form.vue
Normal file
368
src/views/sales/CustomerGroup/components/Form.vue
Normal file
@ -0,0 +1,368 @@
|
|||||||
|
<template>
|
||||||
|
<SimpleForm
|
||||||
|
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="请选择" />
|
||||||
|
</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="请选择" />
|
||||||
|
</FormItem>
|
||||||
|
</template>
|
||||||
|
</SimpleForm>
|
||||||
|
|
||||||
|
<a-card :bordered="false" >
|
||||||
|
<template #title>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="color: red;">*</span>
|
||||||
|
<span style="margin-left: 8px;">客户组成员</span>
|
||||||
|
<span style="font-size: 12px;font-weight: normal;">(至少填写一条数据)</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<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>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
<customerListModal @register="register" @success="handleSuccess"/>
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
||||||
|
import { formProps, formEventConfigs ,formConfig} from './config';
|
||||||
|
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||||
|
import { addLngCustomerGroup, getLngCustomerGroup, updateLngCustomerGroup, deleteLngCustomerGroup } from '/@/api/sales/CustomerGroup';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||||
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
|
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||||
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
|
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
|
||||||
|
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||||
|
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { Form, Col, Row, Tabs, TabPane, Divider, message } from 'ant-design-vue';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import customerListModal from './customerListModal.vue';
|
||||||
|
import { getDictionary } from '/@/api/sales/Customer';
|
||||||
|
|
||||||
|
const FormItem = Form.Item;
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { filterFormSchemaAuth } = usePermission();
|
||||||
|
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
|
||||||
|
const RowKey = 'id';
|
||||||
|
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||||
|
const props = defineProps({
|
||||||
|
fromPage: {
|
||||||
|
type: Number,
|
||||||
|
default: FromPageType.MENU,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const systemFormRef = ref();
|
||||||
|
const data: { formDataProps: FormDataProps } = reactive({
|
||||||
|
formDataProps: {schemas:[]} as FormDataProps,
|
||||||
|
});
|
||||||
|
const state = reactive({
|
||||||
|
formModel: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
let customFormEventConfigs=[];
|
||||||
|
|
||||||
|
|
||||||
|
const columns= ref([
|
||||||
|
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
|
||||||
|
{ title: t('客户编码'), dataIndex: 'cuCode', sorter: true, width:100},
|
||||||
|
{ title: t('客户名称'), dataIndex: 'cuName', sorter: true},
|
||||||
|
{ title: t('国内/国际'), dataIndex: 'natureCode', sorter: true, width: 140},
|
||||||
|
{ title: t('客户类别'), dataIndex: 'typeCode', sorter: true, width: 140},
|
||||||
|
{ title: t('客户分类'), dataIndex: 'classCode', sorter: true, width: 140},
|
||||||
|
{ title: t('操作'), dataIndex: 'operation', width: 120},
|
||||||
|
]);
|
||||||
|
const dataList = ref([])
|
||||||
|
const optionSelect = reactive({
|
||||||
|
natureCodeList: [],
|
||||||
|
classCodeList: [],
|
||||||
|
typeCodeList: []
|
||||||
|
})
|
||||||
|
const isView = ref(false)
|
||||||
|
|
||||||
|
const disabledDateStart = (startValue) => {
|
||||||
|
let value = getFormModel()
|
||||||
|
const endValue = value?.dateTo;
|
||||||
|
if (!startValue || !endValue) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return startValue.valueOf() >= endValue.valueOf();
|
||||||
|
}
|
||||||
|
const disabledDateEnd = (endValue) => {
|
||||||
|
let value = getFormModel()
|
||||||
|
const startValue = value?.dateFrom;
|
||||||
|
if (!endValue || !startValue) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return endValue.valueOf() <= startValue.valueOf();
|
||||||
|
}
|
||||||
|
const [register, { openModal:openModal}] = useModal();
|
||||||
|
const handleAdd = (val)=> {
|
||||||
|
openModal(true,{isUpdate: false})
|
||||||
|
}
|
||||||
|
const btnCheck = (record, index) => {
|
||||||
|
dataList.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
const handleSuccess = (val) => {
|
||||||
|
if (!dataList.value.length) {
|
||||||
|
dataList.value = val
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let arr = []
|
||||||
|
val.forEach(v => {
|
||||||
|
dataList.value.forEach(i => {
|
||||||
|
if (v.cuCode == i.cuCode){
|
||||||
|
message.warning(v.cuCode + '已重复')
|
||||||
|
} else {
|
||||||
|
arr.push(v)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
dataList.value = [...dataList.value, ...arr]
|
||||||
|
}
|
||||||
|
async function getOption() {
|
||||||
|
optionSelect.natureCodeList = await getDictionary('LNG_ENT_PR')
|
||||||
|
optionSelect.classCodeList = await getDictionary('LNG_CLASS')
|
||||||
|
optionSelect.typeCodeList = await getDictionary('LNG_CU_TYP')
|
||||||
|
}
|
||||||
|
onMounted(async () => {
|
||||||
|
getOption()
|
||||||
|
isView.value = currentRoute.value?.fullPath.includes('viewForm')
|
||||||
|
if (isView.value) {
|
||||||
|
let idx = columns.value.findIndex(v =>v.dataIndex=='operation')
|
||||||
|
idx>-1 && columns.value.splice(idx, 1)
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
||||||
|
await mergeCustomFormRenderConfig();
|
||||||
|
|
||||||
|
if (props.fromPage == FromPageType.MENU) {
|
||||||
|
setMenuPermission();
|
||||||
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
} else if (props.fromPage == FromPageType.FLOW) {
|
||||||
|
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||||
|
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
|
||||||
|
} else if (props.fromPage == FromPageType.PREVIEW) {
|
||||||
|
// 预览 无需权限,表单事件也无需执行
|
||||||
|
} else if (props.fromPage == FromPageType.DESKTOP) {
|
||||||
|
// 桌面设计 表单事件需要执行
|
||||||
|
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||||
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
}
|
||||||
|
emits('form-mounted', formProps);
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
async function mergeCustomFormRenderConfig() {
|
||||||
|
let cloneProps=cloneDeep(formProps);
|
||||||
|
let fEventConfigs=cloneDeep(formEventConfigs);
|
||||||
|
if (formConfig.useCustomConfig) {
|
||||||
|
if(props.fromPage !== FromPageType.FLOW){
|
||||||
|
let formPath=currentRoute.value.query.formPath;
|
||||||
|
//1.合并字段配置
|
||||||
|
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
|
||||||
|
//2.合并表单事件配置
|
||||||
|
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.formDataProps=cloneProps;
|
||||||
|
customFormEventConfigs=fEventConfigs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||||
|
function setMenuPermission() {
|
||||||
|
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验form 通过返回表单数据
|
||||||
|
async function validate() {
|
||||||
|
let values = [];
|
||||||
|
try {
|
||||||
|
values = await systemFormRef.value?.validate();
|
||||||
|
//添加隐藏组件
|
||||||
|
if (data.formDataProps.hiddenComponent?.length) {
|
||||||
|
data.formDataProps.hiddenComponent.forEach((component) => {
|
||||||
|
values[component.bindField] = component.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||||
|
async function setFormDataFromId(rowId, skipUpdate) {
|
||||||
|
try {
|
||||||
|
const record = await getLngCustomerGroup(rowId);
|
||||||
|
if (skipUpdate) {
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
setFieldsValue(record);
|
||||||
|
state.formModel = record
|
||||||
|
dataList.value = record?.lngCustomerGroupCustomerList || []
|
||||||
|
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||||
|
return record;
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 辅助设置表单数据
|
||||||
|
function setFieldsValue(record) {
|
||||||
|
systemFormRef.value.setFieldsValue(record);
|
||||||
|
}
|
||||||
|
// 重置表单数据
|
||||||
|
async function resetFields() {
|
||||||
|
await systemFormRef.value.resetFields();
|
||||||
|
}
|
||||||
|
// 设置表单数据全部为Disabled 【查看】
|
||||||
|
async function setDisabledForm(isDisabled) {
|
||||||
|
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
|
||||||
|
}
|
||||||
|
// 获取行键值
|
||||||
|
function getRowKey() {
|
||||||
|
return RowKey;
|
||||||
|
}
|
||||||
|
// 更新api表单数据
|
||||||
|
async function update({ values, rowId }) {
|
||||||
|
try {
|
||||||
|
values[RowKey] = rowId;
|
||||||
|
state.formModel = values;
|
||||||
|
let list = JSON.parse(JSON.stringify(dataList.value));
|
||||||
|
list.forEach(v => {
|
||||||
|
!v.gsId && (v.gsId = values.gsId)
|
||||||
|
!v.id && (v.id = values.id)
|
||||||
|
})
|
||||||
|
let obj = {
|
||||||
|
...values,
|
||||||
|
lngCustomerGroupCustomerList: list
|
||||||
|
}
|
||||||
|
if (!dataList.value.length) {
|
||||||
|
message.warn('请添加组成员')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let saveVal = await updateLngCustomerGroup(obj);
|
||||||
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:提交表单
|
||||||
|
return saveVal;
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
// 新增api表单数据
|
||||||
|
async function add(values) {
|
||||||
|
try {
|
||||||
|
state.formModel = values;
|
||||||
|
let obj = {
|
||||||
|
...values,
|
||||||
|
lngCustomerGroupCustomerList: dataList.value,
|
||||||
|
valid: 'Y'
|
||||||
|
}
|
||||||
|
if (!dataList.value.length) {
|
||||||
|
message.warn('请添加组成员')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let saveVal = await addLngCustomerGroup(obj);
|
||||||
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:提交表单
|
||||||
|
return saveVal;
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||||
|
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||||
|
try {
|
||||||
|
const cloneProps=cloneDeep(formProps);
|
||||||
|
customFormEventConfigs=cloneDeep(formEventConfigs);
|
||||||
|
if (formConfig.useCustomConfig) {
|
||||||
|
const parts = obj.formConfigKey.split('_');
|
||||||
|
const formId=parts[1];
|
||||||
|
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
|
||||||
|
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
|
||||||
|
}
|
||||||
|
|
||||||
|
let flowData = changeWorkFlowForm(cloneProps, obj);
|
||||||
|
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||||
|
data.formDataProps = buildOptionJson;
|
||||||
|
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||||
|
if (isViewProcess) {
|
||||||
|
setDisabledForm(); //查看
|
||||||
|
}
|
||||||
|
state.formModel = formModels;
|
||||||
|
if(formModels[RowKey]) {
|
||||||
|
setFormDataFromId(formModels[RowKey], false)
|
||||||
|
} else {
|
||||||
|
setFieldsValue(formModels)
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
|
await createFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(customFormEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
}
|
||||||
|
function getFormModel() {
|
||||||
|
return systemFormRef.value.formModel
|
||||||
|
}
|
||||||
|
async function handleDelete(id) {
|
||||||
|
return await deleteLngCustomerGroup([id]);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
|
resetFields,
|
||||||
|
validate,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
setFormDataFromId,
|
||||||
|
setDisabledForm,
|
||||||
|
setMenuPermission,
|
||||||
|
setWorkFlowForm,
|
||||||
|
getRowKey,
|
||||||
|
getFormModel,
|
||||||
|
handleDelete
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
:deep(.dateStyle .ant-form-item-label) {
|
||||||
|
width: 120px !important;
|
||||||
|
max-width: 120px !important;
|
||||||
|
flex: none !important
|
||||||
|
}
|
||||||
|
</style>
|
||||||
429
src/views/sales/CustomerGroup/components/config.ts
Normal file
429
src/views/sales/CustomerGroup/components/config.ts
Normal file
@ -0,0 +1,429 @@
|
|||||||
|
import { FormProps, FormSchema } from '/@/components/Form';
|
||||||
|
import { BasicColumn } from '/@/components/Table';
|
||||||
|
|
||||||
|
export const formConfig = {
|
||||||
|
useCustomConfig: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'dateFrom',
|
||||||
|
label: '日期',
|
||||||
|
component: 'RangePicker',
|
||||||
|
componentProps: {
|
||||||
|
format: 'YYYY-MM-DD',
|
||||||
|
style: { width: '100%' },
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'grpName',
|
||||||
|
label: '客户组说明',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'typeCode',
|
||||||
|
label: '类型',
|
||||||
|
component: 'XjrSelect',
|
||||||
|
componentProps: {
|
||||||
|
datasourceType: 'dic',
|
||||||
|
params: { itemId: '1990241330091048961' },
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'value',
|
||||||
|
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
dataIndex: 'grpCode',
|
||||||
|
title: '客户组编码',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'typeCode',
|
||||||
|
title: '类型',
|
||||||
|
componentType: 'select',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'dateFrom',
|
||||||
|
title: '超始日期',
|
||||||
|
componentType: 'date',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'dateTo',
|
||||||
|
title: '结束日期',
|
||||||
|
componentType: 'date',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'grpName',
|
||||||
|
title: '客户组说明',
|
||||||
|
componentType: 'textarea',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'note',
|
||||||
|
title: '备注',
|
||||||
|
componentType: 'textarea',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
//表单事件
|
||||||
|
export const formEventConfigs = {
|
||||||
|
0: [
|
||||||
|
{
|
||||||
|
type: 'circle',
|
||||||
|
color: '#2774ff',
|
||||||
|
text: '开始节点',
|
||||||
|
icon: '#icon-kaishi',
|
||||||
|
bgcColor: '#D8E5FF',
|
||||||
|
isUserDefined: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: '#F6AB01',
|
||||||
|
icon: '#icon-chushihua',
|
||||||
|
text: '初始化表单',
|
||||||
|
bgcColor: '#f9f5ea',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
color: '#B36EDB',
|
||||||
|
icon: '#icon-shujufenxi',
|
||||||
|
text: '获取表单数据',
|
||||||
|
detail: '(新增无此操作)',
|
||||||
|
bgcColor: '#F8F2FC',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
2: [
|
||||||
|
{
|
||||||
|
color: '#F8625C',
|
||||||
|
icon: '#icon-jiazai',
|
||||||
|
text: '加载表单',
|
||||||
|
bgcColor: '#FFF1F1',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
3: [
|
||||||
|
{
|
||||||
|
color: '#6C6AE0',
|
||||||
|
icon: '#icon-jsontijiao',
|
||||||
|
text: '提交表单',
|
||||||
|
bgcColor: '#F5F4FF',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
4: [
|
||||||
|
{
|
||||||
|
type: 'circle',
|
||||||
|
color: '#F8625C',
|
||||||
|
text: '结束节点',
|
||||||
|
icon: '#icon-jieshuzhiliao',
|
||||||
|
bgcColor: '#FFD6D6',
|
||||||
|
isLast: true,
|
||||||
|
isUserDefined: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
export const formProps: FormProps = {
|
||||||
|
labelCol: { span: 3, offset: 0 },
|
||||||
|
labelAlign: 'right',
|
||||||
|
layout: 'horizontal',
|
||||||
|
size: 'default',
|
||||||
|
schemas: [
|
||||||
|
{
|
||||||
|
key: 'd788c25634344c4d9e76e6c20cfbf949',
|
||||||
|
field: 'grpCode',
|
||||||
|
label: '客户组编码',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 12 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入客户组编码',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: true,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'b272dd41b20040808c1ea3ddac99a47f',
|
||||||
|
field: 'typeCode',
|
||||||
|
label: '类型',
|
||||||
|
type: 'select',
|
||||||
|
component: 'XjrSelect',
|
||||||
|
colProps: { span: 12 },
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请选择下拉选择',
|
||||||
|
sepTextField: '',
|
||||||
|
showLabel: true,
|
||||||
|
showSearch: false,
|
||||||
|
clearable: false,
|
||||||
|
disabled: false,
|
||||||
|
staticOptions: [
|
||||||
|
{ key: 1, label: 'Option 1', value: 'Option 1' },
|
||||||
|
{ key: 2, label: 'Option 2', value: 'Option 2' },
|
||||||
|
{ key: 3, label: 'Option 3', value: 'Option 3' },
|
||||||
|
],
|
||||||
|
defaultSelect: null,
|
||||||
|
datasourceType: 'dic',
|
||||||
|
params: { itemId: '1990241330091048961' },
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'value',
|
||||||
|
apiConfig: {
|
||||||
|
path: 'CodeGeneration/selection',
|
||||||
|
method: 'GET',
|
||||||
|
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
|
||||||
|
},
|
||||||
|
dicOptions: [],
|
||||||
|
required: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isShow: true,
|
||||||
|
itemId: '1990241330091048961',
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '3fc7c48352794ec5901605f3cffad0dc',
|
||||||
|
field: 'dateFrom',
|
||||||
|
label: '超始日期',
|
||||||
|
// type: 'date',
|
||||||
|
type: 'slot',
|
||||||
|
slotName: 'dateFrom',
|
||||||
|
component: 'DatePicker',
|
||||||
|
colProps: { span: 12 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
span: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
defaultValue: '',
|
||||||
|
width: '100%',
|
||||||
|
placeholder: '请选择超始日期',
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
showLabel: true,
|
||||||
|
allowClear: true,
|
||||||
|
disabled: false,
|
||||||
|
required: false,
|
||||||
|
isShow: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'db833a66db2c45dab55ef34b47e4c95a',
|
||||||
|
field: 'dateTo',
|
||||||
|
label: '结束日期',
|
||||||
|
// type: 'date',
|
||||||
|
type: 'slot',
|
||||||
|
slotName: 'dateTo',
|
||||||
|
component: 'DatePicker',
|
||||||
|
colProps: { span: 12 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
span: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
defaultValue: '',
|
||||||
|
width: '100%',
|
||||||
|
placeholder: '请选择结束日期',
|
||||||
|
format: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
showLabel: true,
|
||||||
|
allowClear: true,
|
||||||
|
disabled: false,
|
||||||
|
required: false,
|
||||||
|
isShow: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'c95c753263bd4f20ade0bf3edce4061f',
|
||||||
|
field: 'grpName',
|
||||||
|
label: '客户组说明',
|
||||||
|
type: 'textarea',
|
||||||
|
component: 'InputTextArea',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: true,
|
||||||
|
placeholder: '请输入客户组说明,最多200字',
|
||||||
|
maxlength: 200,
|
||||||
|
rows: 2,
|
||||||
|
autoSize: false,
|
||||||
|
showCount: false,
|
||||||
|
disabled: false,
|
||||||
|
showLabel: true,
|
||||||
|
allowClear: false,
|
||||||
|
required: true,
|
||||||
|
isShow: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'c4697d84099e4b5392062f4d7bd775ab',
|
||||||
|
field: 'note',
|
||||||
|
label: '备注',
|
||||||
|
type: 'textarea',
|
||||||
|
component: 'InputTextArea',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: true,
|
||||||
|
placeholder: '请输入备注,最多200字',
|
||||||
|
maxlength: 200,
|
||||||
|
rows: 2,
|
||||||
|
autoSize: false,
|
||||||
|
showCount: false,
|
||||||
|
disabled: false,
|
||||||
|
showLabel: true,
|
||||||
|
allowClear: false,
|
||||||
|
required: false,
|
||||||
|
isShow: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// key: '0459b560bc024780b529f9d346a1e5b1',
|
||||||
|
// label: '表格组件',
|
||||||
|
// field: 'lngCustomerGroupCustomerList',
|
||||||
|
// type: 'form',
|
||||||
|
// component: 'SubForm',
|
||||||
|
// required: true,
|
||||||
|
// colProps: { span: 24 },
|
||||||
|
// componentProps: {
|
||||||
|
// mainKey: 'lngCustomerGroupCustomerList',
|
||||||
|
// columns: [
|
||||||
|
// {
|
||||||
|
// key: 'fe7ce464a2294fc8b9ccc4c3764f12b7',
|
||||||
|
// title: '单行文本',
|
||||||
|
// dataIndex: 'grpCode',
|
||||||
|
// componentType: 'Input',
|
||||||
|
// defaultValue: '',
|
||||||
|
// componentProps: {
|
||||||
|
// width: '100%',
|
||||||
|
// span: '',
|
||||||
|
// defaultValue: '',
|
||||||
|
// labelWidthMode: 'fix',
|
||||||
|
// labelFixWidth: 120,
|
||||||
|
// responsive: false,
|
||||||
|
// respNewRow: false,
|
||||||
|
// placeholder: '请输入单行文本',
|
||||||
|
// maxlength: null,
|
||||||
|
// prefix: '',
|
||||||
|
// suffix: '',
|
||||||
|
// addonBefore: '',
|
||||||
|
// addonAfter: '',
|
||||||
|
// disabled: false,
|
||||||
|
// allowClear: false,
|
||||||
|
// showLabel: true,
|
||||||
|
// required: false,
|
||||||
|
// rules: [],
|
||||||
|
// events: {},
|
||||||
|
// isSave: false,
|
||||||
|
// isShow: true,
|
||||||
|
// scan: false,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// { title: '操作', key: 'action', fixed: 'right', width: '50px' },
|
||||||
|
// ],
|
||||||
|
// span: '24',
|
||||||
|
// preloadType: 'api',
|
||||||
|
// apiConfig: {},
|
||||||
|
// itemId: '',
|
||||||
|
// dicOptions: [],
|
||||||
|
// useSelectButton: false,
|
||||||
|
// buttonName: '选择数据',
|
||||||
|
// showLabel: true,
|
||||||
|
// showComponentBorder: true,
|
||||||
|
// showFormBorder: true,
|
||||||
|
// showIndex: false,
|
||||||
|
// isShow: true,
|
||||||
|
// multipleHeads: [],
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
buttonLocation: 'center',
|
||||||
|
actionColOptions: { span: 24 },
|
||||||
|
showResetButton: false,
|
||||||
|
showSubmitButton: false,
|
||||||
|
hiddenComponent: [],
|
||||||
|
};
|
||||||
138
src/views/sales/CustomerGroup/components/customerListModal.vue
Normal file
138
src/views/sales/CustomerGroup/components/customerListModal.vue
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
|
||||||
|
@visible-change="handleVisibleChange" >
|
||||||
|
<BasicTable @register="registerTable" class="customerListModal"></BasicTable>
|
||||||
|
</BasicModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed, unref, nextTick } from 'vue';
|
||||||
|
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||||
|
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||||
|
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { getLngCustomerPage} from '/@/api/sales/Customer';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const codeFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'cuName',
|
||||||
|
label: '客户名称',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
dataIndex: 'cuCode',
|
||||||
|
title: '客户编码',
|
||||||
|
align: 'left',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'cuName',
|
||||||
|
title: '客户名称',
|
||||||
|
align: 'left',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'cuSname',
|
||||||
|
title: '客户简称',
|
||||||
|
align: 'left',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'natureCode',
|
||||||
|
title: '国内/国际',
|
||||||
|
align: 'left',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'classCode',
|
||||||
|
title: '客户分类',
|
||||||
|
align: 'left',
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
const emit = defineEmits(['success', 'register']);
|
||||||
|
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const isUpdate = ref(true);
|
||||||
|
const rowId = ref('');
|
||||||
|
const selectedKeys = ref<string[]>([]);
|
||||||
|
const selectedValues = ref([]);
|
||||||
|
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
|
||||||
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
|
||||||
|
title: t('客户列表'),
|
||||||
|
api: getLngCustomerPage,
|
||||||
|
columns,
|
||||||
|
|
||||||
|
bordered: true,
|
||||||
|
pagination: true,
|
||||||
|
canResize: false,
|
||||||
|
formConfig: {
|
||||||
|
labelCol:{span: 9, offSet:10},
|
||||||
|
schemas: codeFormSchema,
|
||||||
|
showResetButton: true,
|
||||||
|
},
|
||||||
|
immediate: false, // 设置为不立即调用
|
||||||
|
beforeFetch: (params) => {
|
||||||
|
return { ...params, valid: 'Y',approCode: 'YSP'};
|
||||||
|
},
|
||||||
|
rowSelection: {
|
||||||
|
type: 'checkBox',
|
||||||
|
onChange: onSelectChange
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const handleVisibleChange = (visible: boolean) => {
|
||||||
|
if (visible) {
|
||||||
|
nextTick(() => {
|
||||||
|
reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function onSelectChange(rowKeys: string[], e) {
|
||||||
|
selectedKeys.value = rowKeys;
|
||||||
|
selectedValues.value = e
|
||||||
|
}
|
||||||
|
const getTitle = computed(() => (!unref(isUpdate) ? t('客户列表') : t('')));
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
if (!selectedValues.value.length) {
|
||||||
|
notification.warning({
|
||||||
|
message: t('提示'),
|
||||||
|
description: t('请选择客户')
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
|
closeModal();
|
||||||
|
emit('success', selectedValues.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style >
|
||||||
|
.customerListModal .basicCol{
|
||||||
|
position: inherit !important;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
121
src/views/sales/CustomerGroup/components/workflowPermission.ts
Normal file
121
src/views/sales/CustomerGroup/components/workflowPermission.ts
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
export const permissionList = [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '客户组编码',
|
||||||
|
fieldId: 'grpCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'd788c25634344c4d9e76e6c20cfbf949',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '类型',
|
||||||
|
fieldId: 'typeCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'select',
|
||||||
|
key: 'b272dd41b20040808c1ea3ddac99a47f',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '超始日期',
|
||||||
|
fieldId: 'dateFrom',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'date',
|
||||||
|
key: '3fc7c48352794ec5901605f3cffad0dc',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '结束日期',
|
||||||
|
fieldId: 'dateTo',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'date',
|
||||||
|
key: 'db833a66db2c45dab55ef34b47e4c95a',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '客户组说明',
|
||||||
|
fieldId: 'grpName',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'textarea',
|
||||||
|
key: 'c95c753263bd4f20ade0bf3edce4061f',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '备注',
|
||||||
|
fieldId: 'note',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'textarea',
|
||||||
|
key: 'c4697d84099e4b5392062f4d7bd775ab',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSubTable: true,
|
||||||
|
showChildren: false,
|
||||||
|
tableName: 'lngCustomerGroupCustomerList',
|
||||||
|
fieldName: '表格组件',
|
||||||
|
fieldId: 'lngCustomerGroupCustomerList',
|
||||||
|
type: 'form',
|
||||||
|
key: '0459b560bc024780b529f9d346a1e5b1',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSubTable: true,
|
||||||
|
isSaveTable: false,
|
||||||
|
showChildren: false,
|
||||||
|
tableName: 'lngCustomerGroupCustomerList',
|
||||||
|
fieldName: '单行文本',
|
||||||
|
fieldId: 'grpCode',
|
||||||
|
key: 'fe7ce464a2294fc8b9ccc4c3764f12b7',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
311
src/views/sales/CustomerGroup/index.vue
Normal file
311
src/views/sales/CustomerGroup/index.vue
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
<template>
|
||||||
|
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||||
|
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||||
|
|
||||||
|
<template #toolbar>
|
||||||
|
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||||
|
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||||
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
|
{{ button.name }}
|
||||||
|
</a-button>
|
||||||
|
<a-button v-else :type="button.type">
|
||||||
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
|
{{ button.name }}
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.dataIndex === 'action'">
|
||||||
|
<TableAction :actions="getActions(record)" />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<CustomerGroupModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
|
||||||
|
</PageWrapper>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const modalVisible = ref(false);
|
||||||
|
const logId = ref('')
|
||||||
|
const logPath = ref('/sales/customerGroup/datalog');
|
||||||
|
import { DataLog } from '/@/components/pcitc';
|
||||||
|
import { ref, computed, onMounted, onUnmounted, createVNode, } from 'vue';
|
||||||
|
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
|
import { getLngCustomerGroupPage, deleteLngCustomerGroup} from '/@/api/sales/CustomerGroup';
|
||||||
|
import { PageWrapper } from '/@/components/Page';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
|
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { setIndexFlowStatus } from '/@/utils/flow/index'
|
||||||
|
import { getLngCustomerGroup } from '/@/api/sales/CustomerGroup';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import CustomerGroupModal from './components/CustomerGroupModal.vue';
|
||||||
|
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||||
|
import Icon from '/@/components/Icon/index';
|
||||||
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const { t } = useI18n();
|
||||||
|
defineEmits(['register']);
|
||||||
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
|
||||||
|
|
||||||
|
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||||
|
const customConfigColums =ref(filterColumns);
|
||||||
|
const customSearchFormSchema =ref(searchFormSchema);
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
//所有按钮
|
||||||
|
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]);
|
||||||
|
//展示在列表内的按钮
|
||||||
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||||
|
const buttonConfigs = computed(()=>{
|
||||||
|
return filterButtonAuth(buttons.value);
|
||||||
|
})
|
||||||
|
|
||||||
|
const tableButtonConfig = computed(() => {
|
||||||
|
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||||
|
});
|
||||||
|
|
||||||
|
const actionButtonConfig = computed(() => {
|
||||||
|
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||||
|
});
|
||||||
|
|
||||||
|
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,delete : handleDelete,}
|
||||||
|
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
const router = useRouter();
|
||||||
|
const formIdComputedRef = ref();
|
||||||
|
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||||
|
const schemaIdComputedRef = ref();
|
||||||
|
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||||
|
const [registerModal, { openModal }] = useModal();
|
||||||
|
const formName='客户组';
|
||||||
|
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
|
||||||
|
title: '' || (formName + '列表'),
|
||||||
|
api: getLngCustomerGroupPage,
|
||||||
|
rowKey: 'id',
|
||||||
|
columns: customConfigColums,
|
||||||
|
formConfig: {
|
||||||
|
rowProps: {
|
||||||
|
gutter: 16,
|
||||||
|
},
|
||||||
|
schemas: customSearchFormSchema,
|
||||||
|
fieldMapToTime: [['dateFrom', ['dateFromStart', 'dateFromEnd'], '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' };
|
||||||
|
},
|
||||||
|
afterFetch: (res) => {
|
||||||
|
clearSelectedRowKeys()
|
||||||
|
tableRef.value.setToolBarWidth();
|
||||||
|
|
||||||
|
},
|
||||||
|
useSearchForm: true,
|
||||||
|
showTableSetting: true,
|
||||||
|
|
||||||
|
striped: false,
|
||||||
|
actionColumn: {
|
||||||
|
width: 160,
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
slots: { customRender: 'action' },
|
||||||
|
},
|
||||||
|
tableSetting: {
|
||||||
|
size: false,
|
||||||
|
setting: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function dbClickRow(record) {
|
||||||
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
|
if (taskIds && taskIds.length) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (schemaId && !taskIds && processId) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/CustomerGroup/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'sales/CustomerGroup',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonClick(code) {
|
||||||
|
|
||||||
|
btnEvent[code]();
|
||||||
|
}
|
||||||
|
function handleDatalog (record: Recordable) {
|
||||||
|
modalVisible.value = true
|
||||||
|
logId.value = record.id
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/CustomerGroup/0/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'sales/CustomerGroup',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/form/CustomerGroup/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'sales/CustomerGroup',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteLngCustomerGroup(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleRefresh() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
function handleSuccess() {
|
||||||
|
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleView(record: Recordable) {
|
||||||
|
|
||||||
|
dbClickRow(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||||
|
bus.on(CREATE_FLOW, handleRefresh);
|
||||||
|
} else {
|
||||||
|
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
|
||||||
|
mergeCustomListRenderConfig();
|
||||||
|
});
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
bus.off(FLOW_PROCESSED, handleRefresh);
|
||||||
|
bus.off(CREATE_FLOW, handleRefresh);
|
||||||
|
} else {
|
||||||
|
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function getActions(record: Recordable):ActionItem[] {
|
||||||
|
|
||||||
|
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||||
|
if (!record.workflowData?.processId) {
|
||||||
|
return {
|
||||||
|
icon: button?.icon,
|
||||||
|
tooltip: button?.name,
|
||||||
|
color: button.code === 'delete' ? 'error' : undefined,
|
||||||
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (button.code === 'view') {
|
||||||
|
return {
|
||||||
|
icon: button?.icon,
|
||||||
|
tooltip: button?.name,
|
||||||
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return actionsList;
|
||||||
|
}
|
||||||
|
async function mergeCustomListRenderConfig(){
|
||||||
|
if (formConfig.useCustomConfig) {
|
||||||
|
let formId=currentRoute.value.meta.formId;
|
||||||
|
//1.合并展示字段配置
|
||||||
|
let cols= await mergeColumns(customConfigColums.value,formId);
|
||||||
|
customConfigColums.value=cols;
|
||||||
|
//2.合并搜索字段配置
|
||||||
|
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
|
||||||
|
customSearchFormSchema.value=sFormSchema;
|
||||||
|
//3.合并按钮配置
|
||||||
|
let btns= await mergeButtons(buttons.value,formId);
|
||||||
|
buttons.value=btns;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
:deep(.ant-table-selection-col) {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
:deep(.w-full .ant-col-8:nth-child(1) .ant-form-item-label) {
|
||||||
|
width: 50px !important;
|
||||||
|
}
|
||||||
|
.show{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.hide{
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -5,13 +5,16 @@
|
|||||||
:formModel="{}"
|
:formModel="{}"
|
||||||
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||||
/>
|
/>
|
||||||
<a-button type="primary" style="margin-bottom: 10px;" @click="handleAdd">新增</a-button>
|
<a-button v-if="!isView" type="primary" style="margin-bottom: 10px;" @click="handleAdd">新增</a-button>
|
||||||
<a-table :columns="columns" :data-source="dataList" >
|
<a-table :columns="columns" :data-source="dataList" :pagination="false">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.dataIndex === 'operation'">
|
<template v-if="column.dataIndex === 'operation'">
|
||||||
<a style="margin-right: 10px" @click="btnCheck('edit', record, index)">编辑</a>
|
<a style="margin-right: 10px" @click="btnCheck('edit', record, index)">编辑</a>
|
||||||
<a style="margin-right: 10px" @click="btnCheck('delete', record, index)">删除</a>
|
<a style="margin-right: 10px" @click="btnCheck('delete', record, index)">删除</a>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'eDeptCode'">
|
||||||
|
{{ !record.id ? record.eDeptName : '' }}
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
<evaluateModal @register="registerEvaluate" @success="handleSuccessEvaluate"></evaluateModal>
|
<evaluateModal @register="registerEvaluate" @success="handleSuccessEvaluate"></evaluateModal>
|
||||||
@ -37,7 +40,7 @@
|
|||||||
const { filterFormSchemaAuth } = usePermission();
|
const { filterFormSchemaAuth } = usePermission();
|
||||||
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
|
||||||
const { currentRoute } = useRouter();
|
const { currentRoute } = useRouter();
|
||||||
|
const isView = ref(false)
|
||||||
const RowKey = 'id';
|
const RowKey = 'id';
|
||||||
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -61,7 +64,7 @@
|
|||||||
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
|
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
|
||||||
{ title: t('评价事项'), dataIndex: 'itemName', sorter: true, width:200},
|
{ title: t('评价事项'), dataIndex: 'itemName', sorter: true, width:200},
|
||||||
{ title: t('评价标准'), dataIndex: 'itemDesc', sorter: true, },
|
{ title: t('评价标准'), dataIndex: 'itemDesc', sorter: true, },
|
||||||
{ title: t('评价部门'), dataIndex: 'eDeptCode', sorter: true, width: 140},
|
{ title: t('评价部门'), dataIndex: 'eDeptCode', sorter: true, width: 200},
|
||||||
{ title: t('操作'), dataIndex: 'operation', width: 120},
|
{ title: t('操作'), dataIndex: 'operation', width: 120},
|
||||||
]);
|
]);
|
||||||
const curIdx = ref(null)
|
const curIdx = ref(null)
|
||||||
@ -87,6 +90,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
isView.value = currentRoute.value?.fullPath.includes('viewForm')
|
||||||
|
if (isView.value) {
|
||||||
|
let idx = columns.value.findIndex(v =>v.dataIndex=='operation')
|
||||||
|
idx>-1 && columns.value.splice(idx, 1)
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
// 合并渲染覆盖配置中的字段配置、表单事件配置
|
||||||
await mergeCustomFormRenderConfig();
|
await mergeCustomFormRenderConfig();
|
||||||
@ -194,15 +202,15 @@
|
|||||||
try {
|
try {
|
||||||
values[RowKey] = rowId;
|
values[RowKey] = rowId;
|
||||||
state.formModel = values;
|
state.formModel = values;
|
||||||
let obj = {
|
let list = JSON.parse(JSON.stringify(dataList.value));
|
||||||
|
list.forEach(v => {
|
||||||
|
delete v.eDeptName
|
||||||
|
!v.gsId && (v.gsId = values.gsId)
|
||||||
|
!v.id && (v.id = values.id)
|
||||||
|
})
|
||||||
|
let obj = {
|
||||||
...values,
|
...values,
|
||||||
lngGradeSystemItemList: dataList.value.map(v => {
|
lngGradeSystemItemList: list
|
||||||
return {
|
|
||||||
...v,
|
|
||||||
gsId: values.gsId,
|
|
||||||
id: values.id,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
let saveVal = await updateLngGradeSystem(obj);
|
let saveVal = await updateLngGradeSystem(obj);
|
||||||
await submitFormEvent(customFormEventConfigs, state.formModel,
|
await submitFormEvent(customFormEventConfigs, state.formModel,
|
||||||
@ -215,9 +223,13 @@
|
|||||||
async function add(values) {
|
async function add(values) {
|
||||||
try {
|
try {
|
||||||
state.formModel = values;
|
state.formModel = values;
|
||||||
|
let list = JSON.parse(JSON.stringify(dataList.value));
|
||||||
|
list.forEach(v => {
|
||||||
|
delete v.eDeptName
|
||||||
|
})
|
||||||
let obj = {
|
let obj = {
|
||||||
...values,
|
...values,
|
||||||
lngGradeSystemItemList: dataList.value,
|
lngGradeSystemItemList: list,
|
||||||
valid: 'Y'
|
valid: 'Y'
|
||||||
}
|
}
|
||||||
let saveVal = await addLngGradeSystem(obj);
|
let saveVal = await addLngGradeSystem(obj);
|
||||||
|
|||||||
@ -37,6 +37,19 @@ export const searchFormSchema: FormSchema[] = [
|
|||||||
getPopupContainer: () => document.body,
|
getPopupContainer: () => document.body,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'valid',
|
||||||
|
label: '是否有效',
|
||||||
|
component: 'XjrSelect',
|
||||||
|
componentProps: {
|
||||||
|
datasourceType: 'dic',
|
||||||
|
params: { itemId: '1978057078528327681' },
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'value',
|
||||||
|
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
|
|||||||
@ -14,8 +14,8 @@
|
|||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="评价部门" name="eDeptCode" >
|
<a-form-item label="评价部门" name="eDeptCode" >
|
||||||
<a-cascader v-model:value="formState.eDeptCode" :options="options" :load-data="loadData" @change="onChange"
|
<a-cascader v-model:value="formState.eDeptCode" :options="options" :load-data="loadData" @change="onChange" change-on-select
|
||||||
:field-names="{label: 'fullName', value: 'code', children: 'children'}" placeholder="请选择部门"/>
|
:field-names="{label: 'name', value: 'code', children: 'children'}" placeholder="请选择部门"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
@ -30,6 +30,7 @@ import { Form, message } from 'ant-design-vue';
|
|||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import type { CascaderProps } from 'ant-design-vue';
|
import type { CascaderProps } from 'ant-design-vue';
|
||||||
|
import { requestMagicApi } from '/@/api/magicApi';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const isUpdate = ref(true);
|
const isUpdate = ref(true);
|
||||||
@ -45,18 +46,28 @@ const rules = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
initialFetch()
|
|
||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
console.log(isUpdate.value, 88888888888)
|
|
||||||
if (!isUpdate.value) {
|
if (!isUpdate.value) {
|
||||||
initialFetch()
|
initialFetch()
|
||||||
} else {
|
|
||||||
const resData = await getAreaInfo({code: 1,excludeType:'excludeType' });
|
|
||||||
options.value = resData.areaList
|
|
||||||
}
|
}
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
Object.assign(formState, {...data.record})
|
Object.assign(formState, {...data.record})
|
||||||
|
const res = await requestMagicApi({
|
||||||
|
method: "get",
|
||||||
|
url: "mdm/getDepartmentByCode",
|
||||||
|
body: undefined,
|
||||||
|
query: {
|
||||||
|
code: data?.record?.eDeptCode
|
||||||
|
}
|
||||||
|
});
|
||||||
|
options.value = (res.tree || []).map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
isLeaf: !item.hasChild,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Object.assign(formState,{...formState, 'eDeptCode':res.codeArr})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -66,10 +77,14 @@ const loadData: CascaderProps['loadData'] = async (selectedOptions) => {
|
|||||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||||
targetOption.loading = true;
|
targetOption.loading = true;
|
||||||
try {
|
try {
|
||||||
const res = await getAreaList({
|
const res = await requestMagicApi({
|
||||||
pid: targetOption.id,
|
method: "get",
|
||||||
excludeType: 'excludeType',
|
url: "mdm/queryChildByCode",
|
||||||
});
|
body: undefined,
|
||||||
|
query: {
|
||||||
|
code: targetOption.code
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (Array.isArray(res)) {
|
if (Array.isArray(res)) {
|
||||||
const children = (res || []).map(item => {
|
const children = (res || []).map(item => {
|
||||||
@ -89,7 +104,14 @@ const loadData: CascaderProps['loadData'] = async (selectedOptions) => {
|
|||||||
};
|
};
|
||||||
async function initialFetch() {
|
async function initialFetch() {
|
||||||
try {
|
try {
|
||||||
const res = await getAreaList({ pid: '', excludeType:'CONTINENT' });
|
const res = await requestMagicApi({
|
||||||
|
method: "get",
|
||||||
|
url: "mdm/queryChildByCode",
|
||||||
|
body: undefined,
|
||||||
|
query: {
|
||||||
|
code: '0'
|
||||||
|
}
|
||||||
|
});
|
||||||
options.value = (res || []).map(item => {
|
options.value = (res || []).map(item => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
@ -100,6 +122,10 @@ const loadData: CascaderProps['loadData'] = async (selectedOptions) => {
|
|||||||
}
|
}
|
||||||
const onChange = (value, selectedOptions) => {
|
const onChange = (value, selectedOptions) => {
|
||||||
console.log(value, 55,selectedOptions )
|
console.log(value, 55,selectedOptions )
|
||||||
|
let list = selectedOptions.map(v=> {
|
||||||
|
return v.name
|
||||||
|
})
|
||||||
|
formState.eDeptName = list.join('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex cusFormStyle GradeSystem">
|
||||||
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
|
||||||
|
|
||||||
<template #toolbar>
|
<template #toolbar>
|
||||||
@ -359,6 +359,14 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="less">
|
||||||
|
.cusFormStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.GradeSystem .w-full .advanceRow> div:nth-of-type(4){
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
:deep(.ant-table-selection-col) {
|
:deep(.ant-table-selection-col) {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
|
|||||||
Reference in New Issue
Block a user