This commit is contained in:
2025-12-23 18:05:53 +08:00
7 changed files with 372 additions and 25 deletions

View File

@ -3,16 +3,59 @@ import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
enum Api { enum Api {
Page = '/approve/appro/page', // Page = '/approve/appro/page',
Page = '/magic-api/sales//lngApproPage',
List = '/approve/appro/list', List = '/approve/appro/list',
Info = '/approve/appro/info', Info = '/approve/appro/info',
LngAppro = '/approve/appro', LngAppro = '/approve/appro',
compDept = '/magic-api/sales/getCompAndDeptByUserId',
depart = '/magic-api/mdm/queryAllDepartment',
user = '/magic-api/sales/getUsersByDept'
} }
/**
* @description: 根据部门查询部门下的用户
*/
export async function getUser(params: LngApproPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngApproPageResult>(
{
url: Api.user,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询全部组织机构数
*/
export async function getDept( mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngApproPageModel>(
{
url: Api.depart,
params: { },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 根据用户ID查询默认公司部门
*/
export async function getCompDept(userId: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngApproPageModel>(
{
url: Api.compDept,
params: { userId },
},
{
errorMessageMode: mode,
},
);
}
/** /**
* @description: 查询LngAppro分页列表 * @description: 查询LngAppro分页列表
*/ */

View File

@ -0,0 +1,128 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="65%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="deptListModal"></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 { getDept, } from '/@/api/approve/Appro';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{
field: 'name',
label: '组织名称',
component: 'Input',
},
{
field: 'code',
label: '组织编码',
component: 'Input',
},
];
const columns: BasicColumn[] = [
{
dataIndex: 'name',
title: '组织名称',
align: 'left',
sorter: true,
},
{
dataIndex: 'code',
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 props = defineProps({
selectType: { type: String, default: 'radio' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('部门列表'),
api: getDept,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9, offSet:10},
schemas: codeFormSchema,
showResetButton: true,
},
showIndexColumn: false,
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
console.log(params, 'params')
return { ...params};
},
rowSelection: {
type: props.selectType,
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 >
.deptListModal .basicCol{
position: inherit !important;
top: 0;
}
</style>

View File

@ -0,0 +1,149 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="70%" :title="getTitle" @ok="handleSubmit" @visible-change="handleVisibleChange" >
<div style="display: flex;">
<div class="w-1/3 xl:w-1/3 overflow-hidden bg-white" :style="{ 'border-right': '1px solid #e5e7eb' }">
<BasicTree :title="t('组织列表')" ref="asyncTreeRef" search toolbar :clickRowToExpand="true" expandOnSearch :treeData="treeData" :fieldNames="{ key: 'id', title: 'name' }" @select="handleSelect" />
</div>
<BasicTable @register="registerTable" class="deptUserModal w-2/3 xl:w-2/3"></BasicTable>
</div>
</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';
import { BasicTree, TreeActionType, TreeItem } from '/@/components/Tree';
import { getDept, getUser } from '/@/api/approve/Appro';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{
field: 'userName',
label: '用户名',
component: 'Input',
},
];
const treeData = ref<TreeItem[]>([]);
const columns: BasicColumn[] = [
{
dataIndex: 'name',
title: '姓名',
align: 'left',
sorter: true,
},
{
dataIndex: 'genderDesc',
title: '性别',
align: 'left',
sorter: true,
},
{
dataIndex: 'mobile',
title: '手机号',
align: 'left',
sorter: true,
},
{
dataIndex: 'email',
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 deptId = ref()
const props = defineProps({
selectType: { type: String, default: 'radio' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
fetch()
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('客户列表'),
api: getUser,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9, offSet:10},
schemas: codeFormSchema,
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params, deptId: deptId.value};
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleSelect = (val) => {
deptId.value = val[0]
reload({ searchInfo: { deptId: deptId.value } });
}
async function fetch() {
treeData.value = (await getDept()) as unknown as TreeItem[];
}
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 >
.deptUserModal .basicCol{
position: inherit !important;
top: 0;
}
</style>

View File

@ -42,18 +42,18 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="拟稿人" name="empIdName"> <a-form-item label="拟稿人" name="empName">
<a-input-search v-model:value="formState.empIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/> <a-input-search v-model:value="formState.empName" placeholder="请选择拟稿人" readonly @search="onSearchUser"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="拟稿人所属部门" name="bDeptIdName"> <a-form-item label="拟稿人所属部门" name="bDeptName">
<a-input-search v-model:value="formState.bDeptIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/> <a-input-search v-model:value="formState.bDeptName" placeholder="请选择拟稿人部门" readonly @search="onSearch"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="拟稿人所属公司" name="comIdName"> <a-form-item label="拟稿人所属公司" name="comName">
<a-input-search v-model:value="formState.comIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/> <a-input v-model:value="formState.comName" disabled/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -87,7 +87,8 @@
</a-card> </a-card>
</a-form> </a-form>
</div> </div>
<customerListModal @register="register" selectType="radio" @success="handleSuccess"/> <deptUserModal @register="register" @success="handleSuccess"/>
<deptListModal @register="registerDept" @success="handleSuccessDept" />
</a-spin> </a-spin>
</template> </template>
@ -102,13 +103,18 @@
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer'; import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { addLngScore,updateLngScore,getLngScore } from '/@/api/sales/ScoreCustomer'; import { addLngAppro,updateLngAppro,getLngAppro,getCompDept } from '/@/api/approve/Appro';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env'; import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue'; import UploadList from '/@/components/Form/src/components/UploadList.vue';
import customerListModal from '/@/components/common/customerListModal.vue'; import deptUserModal from '/@/components/common/deptUserModal.vue';
import deptListModal from '/@/components/common/deptListModal.vue';
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const tableName = 'Appro'; const tableName = 'Appro';
const columnName = 'Appro' const columnName = 'Appro'
@ -143,14 +149,15 @@
dateAppro: dayjs(new Date()), dateAppro: dayjs(new Date()),
}); });
const [register, { openModal:openModal}] = useModal(); const [register, { openModal:openModal}] = useModal();
const [registerDept, { openModal:openModalDept}] = useModal();
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
title: [{ required: true, message: "该项为必填项", trigger: 'change' }], title: [{ required: true, message: "该项为必填项", trigger: 'change' }],
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }], typeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
securityCode: [{ required: true, message: "该项为必填项", trigger: 'change' }], securityCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
urgencyCode: [{ required: true, message: "该项为必填项", trigger: 'change' }], urgencyCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
empIdName: [{ required: true, message: "该项为必填项", trigger: 'change' }], empName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
bDeptIdName: [{ required: true, message: "该项为必填项", trigger: 'change' }], bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
comIdName: [{ required: true, message: "该项为必填项", trigger: 'change' }], comName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateAppro: [{ required: true, message: "该项为必填项", trigger: 'change' }], dateAppro: [{ required: true, message: "该项为必填项", trigger: 'change' }],
content: [{ required: true, message: "该项为必填项", trigger: 'change' }], content: [{ required: true, message: "该项为必填项", trigger: 'change' }],
@ -191,6 +198,9 @@
getOption() getOption()
if (pageId.value) { if (pageId.value) {
getInfo(pageId.value) getInfo(pageId.value)
} else {
formState.empName = userInfo.name
formState.empId = userInfo.id
} }
}); });
@ -200,7 +210,7 @@
async function getInfo(id) { async function getInfo(id) {
spinning.value = true spinning.value = true
try { try {
let data = await getLngScore(id) let data = await getLngAppro(id)
spinning.value = false spinning.value = false
Object.assign(formState, {...data}) Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || []) Object.assign(dataFile.value, formState.lngFileUploadList || [])
@ -214,14 +224,27 @@
optionSelect.securityCodeList = await getDictionary('LNG_SECRET') optionSelect.securityCodeList = await getDictionary('LNG_SECRET')
optionSelect.urgencyCodeList = await getDictionary('LNG_URGEN') optionSelect.urgencyCodeList = await getDictionary('LNG_URGEN')
optionSelect.approCodeList = await getDictionary('LNG_APPRO') optionSelect.approCodeList = await getDictionary('LNG_APPRO')
const res = await getCompDept(userInfo.id)
formState.bDeptName = res?.dept?.name
formState.bDeptId = res?.dept?.id
formState.comName = res?.comp?.name
formState.comId = res?.comp?.id
} }
const onSearch = (val)=> { const onSearch = (val)=> {
openModalDept(true,{isUpdate: false})
}
const onSearchUser = (val)=> {
openModal(true,{isUpdate: false}) openModal(true,{isUpdate: false})
} }
const handleSuccess = (val) => { const handleSuccess = (val) => {
formState.cpCode = val[0].cuCode formState.empName = val[0].name
formState.classCode = val[0].classCode formState.empId = val[0].id
formState.cpCodeName = val[0].cuName }
const handleSuccessDept = (val) => {
formState.bDeptName = val[0].name
formState.bDeptId = val[0].id
} }
function close() { function close() {
@ -240,7 +263,7 @@
} }
spinning.value = true; spinning.value = true;
let request = !formState.id ? addLngScore :updateLngScore let request = !formState.id ? addLngAppro :updateLngAppro
try { try {
const data = await request(obj); const data = await request(obj);

View File

@ -125,7 +125,7 @@
showResetButton: false, showResetButton: false,
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' }; return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
}, },
afterFetch: (res) => { afterFetch: (res) => {
tableRef.value.setToolBarWidth(); tableRef.value.setToolBarWidth();

View File

@ -51,7 +51,9 @@
const emits = defineEmits(['success']); const emits = defineEmits(['success']);
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false, fixedHeight: true }); setModalProps({ confirmLoading: false, fixedHeight: true });
if (data.pageType == 'edit') {
setSelectedRowKeys1(data.orgs?.map((x) => x.id) || []); setSelectedRowKeys1(data.orgs?.map((x) => x.id) || []);
}
reload(); reload();
}); });

View File

@ -742,12 +742,14 @@
}; };
const handleOrgCreate = () => { const handleOrgCreate = () => {
openOrgModal(true, { openOrgModal(true, {
orgs: orgDatasource.value orgs: orgDatasource.value,
pageType: !unref(isUpdate) ? 'add' : 'edit'
}); });
}; };
const handleDeptCreate = () => { const handleDeptCreate = () => {
openDeptModal(true, { openDeptModal(true, {
orgs: deptDatasource.value orgs: deptDatasource.value,
pageType: !unref(isUpdate) ? 'add' : 'edit'
}); });
}; };