columns.js 11.4 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
  return [
    {
TZW's avatar
TZW committed
12
      title: '用户名-姓名',
TZW's avatar
TZW committed
13
      dataIndex: 'username',
TZW's avatar
TZW committed
14
      width: 120,
TZW's avatar
TZW committed
15
      key: 'usernamefullname',
TZW's avatar
TZW committed
16 17
      hideInTable: true,
      search: false,
TZW's avatar
TZW committed
18
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
19
      fieldProps: {
TZW's avatar
TZW committed
20
        placeholder: '请输入',
TZW's avatar
TZW committed
21
      },
TZW's avatar
TZW committed
22 23 24 25 26 27 28 29
      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
30
    },
TZW's avatar
TZW committed
31 32 33 34 35 36 37 38
    {
      title: '用户名',
      dataIndex: 'username',
      hideInForm: true,
      width: 120,
      key: 'username',
    },

TZW's avatar
TZW committed
39 40 41 42 43 44 45 46 47
    // {
    //   title: '用户名',
    //   dataIndex: 'username',
    //   width: 120,
    //   key: 'username',
    //   formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
    //   valueType: 'select',
    //   options,
    // },
wuhao's avatar
wuhao committed
48 49
    {
      title: '姓名',
TZW's avatar
TZW committed
50
      dataIndex: 'fullName',
TZW's avatar
TZW committed
51
      width: 100,
TZW's avatar
TZW committed
52
      key: 'fullName',
TZW's avatar
TZW committed
53
      hideInForm: true,
TZW's avatar
TZW committed
54
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
55 56 57
      render: (text, row) => {
        return (
          <a
TZW's avatar
TZW committed
58 59 60
            onClick={() => {
              fieldsDetail(
                [
TZW's avatar
TZW committed
61
                  {
TZW's avatar
TZW committed
62 63 64
                    title: '用户名',
                    dataIndex: 'username',
                    key: 'username',
TZW's avatar
TZW committed
65
                  },
TZW's avatar
TZW committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
                  {
                    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
99
                    dataIndex: 'sectionNames',
TZW's avatar
TZW committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
                    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
122 123 124 125 126
                  {
                    title: '个人图片',
                    dataIndex: 'pictureUrl',
                    key: 'pictureUrl',
                    render: (text, row) => {
TZW's avatar
TZW committed
127
                      if (row?.userImgList == null || row?.userImgList.length == 0) {
TZW's avatar
TZW committed
128 129
                        return '暂无图片';
                      } else {
TZW's avatar
TZW committed
130
                        return <Image width={70} src={row.userImgList[0]?.url} />;
TZW's avatar
TZW committed
131 132 133 134 135 136 137 138
                      }
                    },
                  },
                  {
                    title: '备注',
                    dataIndex: 'remarks',
                    key: 'remarks',
                  },
TZW's avatar
TZW committed
139
                ],
TZW's avatar
TZW committed
140
                setDrawer,
TZW's avatar
TZW committed
141 142 143 144
                row,
                '1',
                '/auth/sysUser/detail',
              );
TZW's avatar
TZW committed
145 146 147 148 149 150
            }}
          >
            {row.fullName}
          </a>
        );
      },
TZW's avatar
TZW committed
151
    },
TZW's avatar
TZW committed
152 153 154 155 156
    {
      title: '手机号',
      hideInTable: true,
      dataIndex: 'telephone',
      key: 'telephone',
TZW's avatar
TZW committed
157 158 159 160 161 162 163 164 165 166
      fieldProps: {
        disabled: true,
      },
      hideInTable: true,
      search: false,
    },
    {
      title: '邮箱',
      dataIndex: 'mailNo',
      key: 'mailNo',
TZW's avatar
TZW committed
167 168
      hideInTable: true,
      search: false,
TZW's avatar
TZW committed
169 170 171
      fieldProps: {
        disabled: true,
      },
TZW's avatar
TZW committed
172
    },
TZW's avatar
TZW committed
173 174
    {
      title: '公司名称',
wuhao's avatar
wuhao committed
175

TZW's avatar
TZW committed
176 177 178 179
      dataIndex: 'organizationName',
      width: 120,
      key: 'organizationId',
      valueType: 'select',
TZW's avatar
TZW committed
180 181 182 183
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
TZW's avatar
TZW committed
184
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
185 186 187 188 189
      options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
    },
    {
      title: '部门名称',
      width: 120,
TZW's avatar
TZW committed
190
      valueType: 'treeSelect',
TZW's avatar
TZW committed
191
      dataIndex: 'departmentName',
TZW's avatar
TZW committed
192
      search: false,
TZW's avatar
TZW committed
193
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
194 195
      key: 'departmentId',
      options: {
TZW's avatar
TZW committed
196
        path: '/auth/sysDepartment/query/children/tree',
TZW's avatar
TZW committed
197 198
        linkParams: {
          organizationId: 'parentId',
wuhao's avatar
wuhao committed
199 200 201
        },
      },
    },
TZW's avatar
TZW committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
    {
      title: '部门名称',
      width: 120,
      valueType: 'select',
      dataIndex: 'departmentName',
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
      key: 'departmentId',
      options: {
        path: '/auth/sysDepartment/query/all/department/selection',
      },
      fieldProps: {
        showSearch: true,
      },
      hideInForm: true,
      hideInTable: true,
    },
左玲玲's avatar
左玲玲 committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
    {
      title: '用户类型',
      dataIndex: 'f1',
      key: 'f1',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
      colProps: {
        span: 12,
      },
      valueType: 'select',
      mode: 'radio',
      options: [
        {
          label: '平台用户',
          value: '1',
        },
        {
          label: '租户用户',
          value: '2',
        },
      ],
    },
    {
      title: '所属客户',
      dataIndex: 'f2',
      key: 'f2',
      formItemProps: {
        rules: [
          {
            required: true,
            message: '此项为必填项',
          },
        ],
      },
      colProps: {
        span: 12,
      },
      valueType: 'select',
      mode: 'radio',
      options: {
        path: '',
        params: {},
      },
      hideInForm: {
        f1: {
          reverse: ['2'],
        },
      },
    },
TZW's avatar
TZW committed
273 274 275 276 277 278 279
    {
      title: '角色名称',
      dataIndex: 'roleNames',
      key: 'roleNames',
      hideInForm: true,
      hideInTable: true,
    },
wuhao's avatar
wuhao committed
280
    {
TZW's avatar
TZW committed
281
      title: '负责工厂',
TZW's avatar
TZW committed
282
      dataIndex: 'factoryNames',
TZW's avatar
TZW committed
283
      key: 'factoryIdList',
TZW's avatar
TZW committed
284 285 286 287 288
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
289 290
      width: 120,
      valueType: 'select',
wuhao's avatar
wuhao committed
291 292
      searchKey: 'factoryNames',
      searchValueType: 'input',
TZW's avatar
TZW committed
293
      options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
左玲玲's avatar
左玲玲 committed
294
      showAll: true,
wuhao's avatar
wuhao committed
295 296
    },
    {
TZW's avatar
TZW committed
297
      title: '负责车间',
TZW's avatar
TZW committed
298
      dataIndex: 'shopNames',
TZW's avatar
TZW committed
299 300 301 302 303
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
304 305
      searchKey: 'shopNames',
      searchValueType: 'input',
TZW's avatar
TZW committed
306 307 308
      width: 120,
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
309
        path: '/auth/sysShop/getShopSelectionByFactoryIdList',
TZW's avatar
TZW committed
310
        linkParams: {
wuhao's avatar
wuhao committed
311
          factoryIdList: '',
TZW's avatar
TZW committed
312
        },
wuhao's avatar
wuhao committed
313
      },
TZW's avatar
TZW committed
314
      key: 'shopIdList',
TZW's avatar
TZW committed
315
      formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
左玲玲's avatar
左玲玲 committed
316
      showAll: true,
wuhao's avatar
wuhao committed
317 318
    },
    {
TZW's avatar
TZW committed
319 320
      title: '负责工段',
      width: 120,
TZW's avatar
TZW committed
321
      dataIndex: 'sectionNames',
wuhao's avatar
wuhao committed
322

TZW's avatar
TZW committed
323
      search: false,
TZW's avatar
TZW committed
324
      key: 'sectionIdList',
TZW's avatar
TZW committed
325
      hideInTable: true,
TZW's avatar
TZW committed
326 327 328 329 330
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
331 332
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
333
        path: '/auth/sysSection/getAllSectionSelectionByShopIdList',
TZW's avatar
TZW committed
334
        linkParams: {
TZW's avatar
TZW committed
335
          shopIdList: '',
TZW's avatar
TZW committed
336
        },
wuhao's avatar
wuhao committed
337
      },
左玲玲's avatar
左玲玲 committed
338
      showAll: true,
wuhao's avatar
wuhao committed
339 340
    },
    {
TZW's avatar
TZW committed
341 342 343 344
      title: '负责产线',
      width: 120,
      dataIndex: 'productionLines',
      valueType: 'select',
TZW's avatar
TZW committed
345 346 347 348 349
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
350
      search: false,
TZW's avatar
TZW committed
351
      hideInTable: true,
TZW's avatar
TZW committed
352
      key: 'productionLineIdList',
TZW's avatar
TZW committed
353
      options: {
TZW's avatar
TZW committed
354
        path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
TZW's avatar
TZW committed
355
        linkParams: {
TZW's avatar
TZW committed
356
          shopIdList: '',
TZW's avatar
TZW committed
357
        },
wuhao's avatar
wuhao committed
358
      },
左玲玲's avatar
左玲玲 committed
359
      showAll: true,
wuhao's avatar
wuhao committed
360
    },
TZW's avatar
TZW committed
361 362 363
    {
      title: '角色配置',
      dataIndex: 'roleNames',
TZW's avatar
TZW committed
364
      key: 'roleIdList',
TZW's avatar
TZW committed
365 366 367 368 369 370 371 372 373
      valueType: 'select',
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
      options: {
        path: '/auth/sysRole/selection',
      },
TZW's avatar
TZW committed
374
      search: false,
TZW's avatar
TZW committed
375
    },
TZW's avatar
TZW committed
376

TZW's avatar
TZW committed
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
    {
      title: '直属领导',
      valueType: 'select',
      dataIndex: 'parentName',
      key: 'parentId',
      options: {
        path: '/auth/sysUser/selection',
      },
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
    },
    {
      title: '状态',
TZW's avatar
TZW committed
392 393
      hideInTable: true,
      hideInForm: true,
TZW's avatar
TZW committed
394 395
      dataIndex: 'statusName',
      key: 'status',
TZW's avatar
TZW committed
396
      valueType: 'select',
TZW's avatar
TZW committed
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
    {
      title: '状态',
      dataIndex: 'statusName',
      search: false,
      key: 'status',
TZW's avatar
TZW committed
414
      fieldProps: { disabled: true },
TZW's avatar
TZW committed
415
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
      valueType: 'radio',
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
    {
      title: '备注',
      hideInTable: true,
      dataIndex: 'remarks',
      valueType: 'textarea',
TZW's avatar
TZW committed
433
      width: 120,
TZW's avatar
TZW committed
434 435 436 437 438 439 440 441 442 443 444
      key: 'remarks',
      search: false,
    },
    {
      title: '个人图片',
      search: false,
      dataIndex: 'userImgList',
      key: 'userImgList',
      valueType: 'uploadImage',
      hideInTable: true,
      fieldProps: {
TZW's avatar
TZW committed
445
        limit: 1,
TZW's avatar
TZW committed
446
      },
TZW's avatar
TZW committed
447

TZW's avatar
TZW committed
448 449 450 451 452 453 454 455
      render: (text, row) => {
        if (row?.pictureUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.pictureUrl} />;
        }
      },
    },
wuhao's avatar
wuhao committed
456 457 458 459
  ];
}

export default getcolumns;