Merge branch 'dev' of http://47.94.165.164:13000/geg-gas/geg-gas-web into dev
This commit is contained in:
@ -3,16 +3,59 @@ import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/approve/appro/page',
|
||||
// Page = '/approve/appro/page',
|
||||
Page = '/magic-api/sales//lngApproPage',
|
||||
List = '/approve/appro/list',
|
||||
Info = '/approve/appro/info',
|
||||
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分页列表
|
||||
*/
|
||||
|
||||
128
src/components/common/deptListModal.vue
Normal file
128
src/components/common/deptListModal.vue
Normal 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>
|
||||
149
src/components/common/deptUserModal.vue
Normal file
149
src/components/common/deptUserModal.vue
Normal 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>
|
||||
@ -42,18 +42,18 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="拟稿人" name="empIdName">
|
||||
<a-input-search v-model:value="formState.empIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/>
|
||||
<a-form-item label="拟稿人" name="empName">
|
||||
<a-input-search v-model:value="formState.empName" placeholder="请选择拟稿人" readonly @search="onSearchUser"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="拟稿人所属部门" name="bDeptIdName">
|
||||
<a-input-search v-model:value="formState.bDeptIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/>
|
||||
<a-form-item label="拟稿人所属部门" name="bDeptName">
|
||||
<a-input-search v-model:value="formState.bDeptName" placeholder="请选择拟稿人部门" readonly @search="onSearch"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="拟稿人所属公司" name="comIdName">
|
||||
<a-input-search v-model:value="formState.comIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/>
|
||||
<a-form-item label="拟稿人所属公司" name="comName">
|
||||
<a-input v-model:value="formState.comName" disabled/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
@ -87,7 +87,8 @@
|
||||
</a-card>
|
||||
</a-form>
|
||||
</div>
|
||||
<customerListModal @register="register" selectType="radio" @success="handleSuccess"/>
|
||||
<deptUserModal @register="register" @success="handleSuccess"/>
|
||||
<deptListModal @register="registerDept" @success="handleSuccessDept" />
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
@ -102,13 +103,18 @@
|
||||
import type { Rule } from 'ant-design-vue/es/form';
|
||||
import { getDictionary } from '/@/api/sales/Customer';
|
||||
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 { getAppEnvConfig } from '/@/utils/env';
|
||||
import { message } from 'ant-design-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 { useUserStore } from '/@/store/modules/user';
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const tableName = 'Appro';
|
||||
const columnName = 'Appro'
|
||||
@ -143,14 +149,15 @@
|
||||
dateAppro: dayjs(new Date()),
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const [registerDept, { openModal:openModalDept}] = useModal();
|
||||
const rules: Record<string, Rule[]> = {
|
||||
title: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
typeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
securityCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
urgencyCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
empIdName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
bDeptIdName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
comIdName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
empName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
comName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
dateAppro: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
content: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
|
||||
@ -191,6 +198,9 @@
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getInfo(pageId.value)
|
||||
} else {
|
||||
formState.empName = userInfo.name
|
||||
formState.empId = userInfo.id
|
||||
}
|
||||
|
||||
});
|
||||
@ -200,7 +210,7 @@
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngScore(id)
|
||||
let data = await getLngAppro(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
@ -214,14 +224,27 @@
|
||||
optionSelect.securityCodeList = await getDictionary('LNG_SECRET')
|
||||
optionSelect.urgencyCodeList = await getDictionary('LNG_URGEN')
|
||||
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)=> {
|
||||
openModalDept(true,{isUpdate: false})
|
||||
}
|
||||
const onSearchUser = (val)=> {
|
||||
openModal(true,{isUpdate: false})
|
||||
}
|
||||
const handleSuccess = (val) => {
|
||||
formState.cpCode = val[0].cuCode
|
||||
formState.classCode = val[0].classCode
|
||||
formState.cpCodeName = val[0].cuName
|
||||
formState.empName = val[0].name
|
||||
formState.empId = val[0].id
|
||||
}
|
||||
const handleSuccessDept = (val) => {
|
||||
formState.bDeptName = val[0].name
|
||||
formState.bDeptId = val[0].id
|
||||
}
|
||||
|
||||
function close() {
|
||||
@ -240,7 +263,7 @@
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngScore :updateLngScore
|
||||
let request = !formState.id ? addLngAppro :updateLngAppro
|
||||
|
||||
try {
|
||||
const data = await request(obj);
|
||||
|
||||
@ -125,7 +125,7 @@
|
||||
showResetButton: false,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page: params.limit};
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableRef.value.setToolBarWidth();
|
||||
|
||||
@ -51,7 +51,9 @@
|
||||
const emits = defineEmits(['success']);
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
setModalProps({ confirmLoading: false, fixedHeight: true });
|
||||
setSelectedRowKeys1(data.orgs?.map((x) => x.id) || []);
|
||||
if (data.pageType == 'edit') {
|
||||
setSelectedRowKeys1(data.orgs?.map((x) => x.id) || []);
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
|
||||
@ -742,12 +742,14 @@
|
||||
};
|
||||
const handleOrgCreate = () => {
|
||||
openOrgModal(true, {
|
||||
orgs: orgDatasource.value
|
||||
orgs: orgDatasource.value,
|
||||
pageType: !unref(isUpdate) ? 'add' : 'edit'
|
||||
});
|
||||
};
|
||||
const handleDeptCreate = () => {
|
||||
openDeptModal(true, {
|
||||
orgs: deptDatasource.value
|
||||
orgs: deptDatasource.value,
|
||||
pageType: !unref(isUpdate) ? 'add' : 'edit'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user