import { doFetch } from '@/utils/doFetch'; import { Image } from 'antd'; import fieldsDetail from '@/utils/fieldsDetail'; import { useState, useEffect } from 'react'; function getcolumns(setDrawer, ifs, formRef) { // const options = usermsg?.map((it) => ({ // label: `${it?.username}-${it?.fullName}`, // value: it?.id, // })); return [ { title: '用户名', dataIndex: 'username', width: 120, key: 'username', formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, fieldProps: { placeholder: '请输入用户名', }, valueType: 'MyAutoComplete', onSelect: (value, option) => { formRef.current.setFieldValue('telephone', option?.phone); formRef.current.setFieldValue('fullName', option?.fullName); formRef.current.setFieldValue('mailNo', option?.mailbox); formRef.current.setFieldValue('status', option?.enabled); }, disabled: ifs, }, // { // title: '用户名', // dataIndex: 'username', // width: 120, // key: 'username', // formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, // valueType: 'select', // options, // }, { title: '姓名', dataIndex: 'fullName', width: 100, key: 'fullName', hideInForm: true, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, render: (text, row) => { return ( { fieldsDetail( [ { title: '用户名', dataIndex: 'username', key: 'username', }, { title: '姓名', dataIndex: 'fullName', key: 'fullName', }, { title: '手机号', dataIndex: 'telephone', key: 'telephone' }, { title: '邮箱', dataIndex: 'mailNo', key: 'mailNo', }, { title: '公司名称', dataIndex: 'organizationName', key: 'organizationId', }, { title: '部门名称', dataIndex: 'departmentName', key: 'departmentId', }, { title: '负责工厂', dataIndex: 'factoryNames', key: 'factoryNames', }, { title: '负责车间', dataIndex: 'shopNames', key: 'shopNames', }, { title: '负责工段', dataIndex: 'sectionNames', key: 'sectionIdList', }, { title: '负责产线', dataIndex: 'productionLines', key: 'productionLineIdList', }, { title: '角色配置', dataIndex: 'roleNames', key: 'roleIdList', }, { title: '直属领导', dataIndex: 'parentName', key: 'parentId', }, { title: '状态', dataIndex: 'statusName', key: 'status', }, ], setDrawer, row, '1', '/auth/sysUser/detail', ); }} > {row.fullName} ); }, }, { title: '手机号', hideInTable: true, dataIndex: 'telephone', key: 'telephone', fieldProps: { disabled: true, }, hideInTable: true, search: false, }, { title: '邮箱', dataIndex: 'mailNo', key: 'mailNo', hideInTable: true, search: false, fieldProps: { disabled: true, }, }, { title: '公司名称', dataIndex: 'organizationName', width: 120, key: 'organizationId', valueType: 'select', fieldProps: { placeholder: '请选择', showSearch: true, }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} }, }, { title: '部门名称', width: 120, valueType: 'treeSelect', dataIndex: 'departmentName', fieldProps: { placeholder: '请选择', showSearch: true, }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, key: 'departmentId', options: { path: '/auth/sysDepartment/query/children/tree', linkParams: { organizationId: 'parentId', }, }, }, { title: '角色名称', dataIndex: 'roleNames', key: 'roleNames', hideInForm: true, hideInTable: true, }, { title: '负责工厂', dataIndex: 'factoryNames', key: 'factoryIdList', fieldProps: { placeholder: '请选择', showSearch: true, mode: 'multiple', }, width: 120, valueType: 'select', options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} }, }, { title: '负责车间', dataIndex: 'shopNames', fieldProps: { placeholder: '请选择', showSearch: true, mode: 'multiple', }, width: 120, valueType: 'select', options: { path: '/auth/sysShop/getShopSelectionByFactoryIdList', linkParams: { factoryIdList: 'factoryIdList', }, }, key: 'shopIdList', formItemProps: { rules: [{ required: false, message: '此项为必填项' }] }, }, { title: '负责工段', width: 120, dataIndex: 'sectionNames', search: false, key: 'sectionIdList', hideInTable: true, fieldProps: { placeholder: '请选择', showSearch: true, mode: 'multiple', }, valueType: 'select', options: { path: '/auth/sysSection/getAllSectionSelectionByShopIdList', linkParams: { shopIdList: '', }, }, }, { title: '负责产线', search: false, width: 120, dataIndex: 'productionLines', valueType: 'select', fieldProps: { placeholder: '请选择', showSearch: true, mode: 'multiple', }, search: false, hideInTable: true, key: 'productionLineIdList', options: { path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList', linkParams: { shopIdList: '', }, }, }, { title: '角色配置', dataIndex: 'roleNames', key: 'roleIdList', valueType: 'select', search: false, fieldProps: { placeholder: '请选择', showSearch: true, mode: 'multiple', }, options: { path: '/auth/sysRole/selection', }, }, { title: '直属领导', valueType: 'select', dataIndex: 'parentName', key: 'parentId', options: { path: '/auth/sysUser/selection', }, fieldProps: { placeholder: '请选择', showSearch: true, }, }, { title: '状态', // hideInTable: true, dataIndex: 'statusName', key: 'status', fieldProps: { disabled: true }, formItemProps: { rules: [{ required: true, message: '此项为必填项' }] }, valueType: 'radio', options: [ { label: '启用', value: 1, }, { label: '禁用', value: 0, }, ], }, { title: '备注', hideInTable: true, dataIndex: 'remarks', valueType: 'textarea', width: 120, key: 'remarks', search: false, }, { title: '个人图片', search: false, dataIndex: 'userImgList', key: 'userImgList', valueType: 'uploadImage', hideInTable: true, fieldProps: { limit: 1, }, render: (text, row) => { if (row?.pictureUrl == null) { return '暂无图片'; } else { return ; } }, }, ]; } export default getcolumns;