columns.js 8.66 KB
Newer Older
TZW's avatar
TZW committed
1 2
import { doFetch } from '@/utils/doFetch';
import { Image } from 'antd';
TZW's avatar
TZW committed
3
import fieldsDetail from '@/utils/fieldsDetail';
TZW's avatar
TZW committed
4
import { useState, useEffect } from 'react';
TZW's avatar
TZW committed
5
function getcolumns(setDrawer, ifs, formRef) {
TZW's avatar
TZW committed
6 7 8 9
  // const options = usermsg?.map((it) => ({
  //   label: `${it?.username}-${it?.fullName}`,
  //   value: it?.id,
  // }));
wuhao's avatar
wuhao committed
10 11 12
  return [
    {
      title: '用户名',
TZW's avatar
TZW committed
13
      dataIndex: 'username',
TZW's avatar
TZW committed
14
      width: 120,
TZW's avatar
TZW committed
15 16
      key: 'username',
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
17 18 19
      fieldProps: {
        placeholder: '请输入用户名',
      },
TZW's avatar
TZW committed
20 21 22 23 24 25 26 27
      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,
wuhao's avatar
wuhao committed
28
    },
TZW's avatar
TZW committed
29 30 31 32 33 34 35 36 37
    // {
    //   title: '用户名',
    //   dataIndex: 'username',
    //   width: 120,
    //   key: 'username',
    //   formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
    //   valueType: 'select',
    //   options,
    // },
wuhao's avatar
wuhao committed
38 39
    {
      title: '姓名',
TZW's avatar
TZW committed
40
      dataIndex: 'fullName',
TZW's avatar
TZW committed
41
      width: 100,
TZW's avatar
TZW committed
42
      key: 'fullName',
TZW's avatar
TZW committed
43
      hideInForm: true,
TZW's avatar
TZW committed
44
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
45 46 47
      render: (text, row) => {
        return (
          <a
TZW's avatar
TZW committed
48 49 50
            onClick={() => {
              fieldsDetail(
                [
TZW's avatar
TZW committed
51
                  {
TZW's avatar
TZW committed
52 53 54
                    title: '用户名',
                    dataIndex: 'username',
                    key: 'username',
TZW's avatar
TZW committed
55
                  },
TZW's avatar
TZW committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
                  {
                    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: '负责工段',
TZW's avatar
TZW committed
89
                    dataIndex: 'sectionNames',
TZW's avatar
TZW committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
                    key: 'sectionIdList',
                  },
                  {
                    title: '负责产线',
                    dataIndex: 'productionLines',
                    key: 'productionLineIdList',
                  },
                  {
                    title: '角色配置',
                    dataIndex: 'roleNames',
                    key: 'roleIdList',
                  },
                  {
                    title: '直属领导',
                    dataIndex: 'parentName',
                    key: 'parentId',
                  },
                  {
                    title: '状态',
                    dataIndex: 'statusName',
                    key: 'status',
                  },
                ],
TZW's avatar
TZW committed
113
                setDrawer,
TZW's avatar
TZW committed
114 115 116 117
                row,
                '1',
                '/auth/sysUser/detail',
              );
TZW's avatar
TZW committed
118 119 120 121 122 123
            }}
          >
            {row.fullName}
          </a>
        );
      },
TZW's avatar
TZW committed
124
    },
TZW's avatar
TZW committed
125 126 127 128 129
    {
      title: '手机号',
      hideInTable: true,
      dataIndex: 'telephone',
      key: 'telephone',
TZW's avatar
TZW committed
130 131 132 133 134 135 136 137 138 139
      fieldProps: {
        disabled: true,
      },
      hideInTable: true,
      search: false,
    },
    {
      title: '邮箱',
      dataIndex: 'mailNo',
      key: 'mailNo',
TZW's avatar
TZW committed
140 141
      hideInTable: true,
      search: false,
TZW's avatar
TZW committed
142 143 144
      fieldProps: {
        disabled: true,
      },
TZW's avatar
TZW committed
145
    },
TZW's avatar
TZW committed
146 147
    {
      title: '公司名称',
wuhao's avatar
wuhao committed
148

TZW's avatar
TZW committed
149 150 151 152
      dataIndex: 'organizationName',
      width: 120,
      key: 'organizationId',
      valueType: 'select',
TZW's avatar
TZW committed
153 154 155 156
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
157
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
158 159 160 161 162
      options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
    },
    {
      title: '部门名称',
      width: 120,
TZW's avatar
TZW committed
163
      valueType: 'treeSelect',
TZW's avatar
TZW committed
164
      dataIndex: 'departmentName',
TZW's avatar
TZW committed
165
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
166 167
      key: 'departmentId',
      options: {
TZW's avatar
TZW committed
168
        path: '/auth/sysDepartment/query/children/tree',
TZW's avatar
TZW committed
169 170
        linkParams: {
          organizationId: 'parentId',
wuhao's avatar
wuhao committed
171 172 173
        },
      },
    },
TZW's avatar
TZW committed
174 175 176 177 178 179 180
    {
      title: '角色名称',
      dataIndex: 'roleNames',
      key: 'roleNames',
      hideInForm: true,
      hideInTable: true,
    },
wuhao's avatar
wuhao committed
181
    {
TZW's avatar
TZW committed
182
      title: '负责工厂',
TZW's avatar
TZW committed
183
      dataIndex: 'factoryNames',
TZW's avatar
TZW committed
184
      key: 'factoryIdList',
TZW's avatar
TZW committed
185 186 187 188 189
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
190 191
      width: 120,
      valueType: 'select',
wuhao's avatar
wuhao committed
192 193
      searchKey: 'factoryNames',
      searchValueType: 'input',
TZW's avatar
TZW committed
194
      options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
wuhao's avatar
wuhao committed
195 196
    },
    {
TZW's avatar
TZW committed
197
      title: '负责车间',
TZW's avatar
TZW committed
198
      dataIndex: 'shopNames',
TZW's avatar
TZW committed
199 200 201 202 203
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
204 205
      searchKey: 'shopNames',
      searchValueType: 'input',
TZW's avatar
TZW committed
206 207 208
      width: 120,
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
209
        path: '/auth/sysShop/getShopSelectionByFactoryIdList',
TZW's avatar
TZW committed
210
        linkParams: {
wuhao's avatar
wuhao committed
211
          factoryIdList: '',
TZW's avatar
TZW committed
212
        },
wuhao's avatar
wuhao committed
213
      },
TZW's avatar
TZW committed
214
      key: 'shopIdList',
TZW's avatar
TZW committed
215
      formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
216 217
    },
    {
TZW's avatar
TZW committed
218 219
      title: '负责工段',
      width: 120,
TZW's avatar
TZW committed
220
      dataIndex: 'sectionNames',
wuhao's avatar
wuhao committed
221

TZW's avatar
TZW committed
222
      search: false,
TZW's avatar
TZW committed
223
      key: 'sectionIdList',
TZW's avatar
TZW committed
224
      hideInTable: true,
TZW's avatar
TZW committed
225 226 227 228 229
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
230 231
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
232
        path: '/auth/sysSection/getAllSectionSelectionByShopIdList',
TZW's avatar
TZW committed
233
        linkParams: {
TZW's avatar
TZW committed
234
          shopIdList: '',
TZW's avatar
TZW committed
235
        },
wuhao's avatar
wuhao committed
236 237 238
      },
    },
    {
TZW's avatar
TZW committed
239 240 241 242
      title: '负责产线',
      width: 120,
      dataIndex: 'productionLines',
      valueType: 'select',
TZW's avatar
TZW committed
243 244 245 246 247
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
248
      search: false,
TZW's avatar
TZW committed
249
      hideInTable: true,
TZW's avatar
TZW committed
250
      key: 'productionLineIdList',
TZW's avatar
TZW committed
251
      options: {
TZW's avatar
TZW committed
252
        path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
TZW's avatar
TZW committed
253
        linkParams: {
TZW's avatar
TZW committed
254
          shopIdList: '',
TZW's avatar
TZW committed
255
        },
wuhao's avatar
wuhao committed
256 257
      },
    },
TZW's avatar
TZW committed
258 259 260
    {
      title: '角色配置',
      dataIndex: 'roleNames',
TZW's avatar
TZW committed
261
      key: 'roleIdList',
TZW's avatar
TZW committed
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
      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: '状态',
TZW's avatar
TZW committed
288
      // hideInTable: true,
TZW's avatar
TZW committed
289 290
      dataIndex: 'statusName',
      key: 'status',
TZW's avatar
TZW committed
291
      fieldProps: { disabled: true },
TZW's avatar
TZW committed
292
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
      valueType: 'radio',
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
    {
      title: '备注',
      hideInTable: true,
      dataIndex: 'remarks',
      valueType: 'textarea',
TZW's avatar
TZW committed
310
      width: 120,
TZW's avatar
TZW committed
311 312 313 314 315 316 317 318 319 320 321
      key: 'remarks',
      search: false,
    },
    {
      title: '个人图片',
      search: false,
      dataIndex: 'userImgList',
      key: 'userImgList',
      valueType: 'uploadImage',
      hideInTable: true,
      fieldProps: {
TZW's avatar
TZW committed
322
        limit: 1,
TZW's avatar
TZW committed
323
      },
TZW's avatar
TZW committed
324

TZW's avatar
TZW committed
325 326 327 328 329 330 331 332
      render: (text, row) => {
        if (row?.pictureUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.pictureUrl} />;
        }
      },
    },
wuhao's avatar
wuhao committed
333 334 335 336
  ];
}

export default getcolumns;