columns.js 10.3 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 127 128 129 130 131 132 133 134 135 136 137 138
                  {
                    title: '个人图片',
                    dataIndex: 'pictureUrl',
                    key: 'pictureUrl',
                    render: (text, row) => {
                      if (row?.pictureUrl == null) {
                        return '暂无图片';
                      } else {
                        return <Image width={70} src={row.pictureUrl} />;
                      }
                    },
                  },
                  {
                    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,
    },
TZW's avatar
TZW committed
218 219 220 221 222 223 224
    {
      title: '角色名称',
      dataIndex: 'roleNames',
      key: 'roleNames',
      hideInForm: true,
      hideInTable: true,
    },
wuhao's avatar
wuhao committed
225
    {
TZW's avatar
TZW committed
226
      title: '负责工厂',
TZW's avatar
TZW committed
227
      dataIndex: 'factoryNames',
TZW's avatar
TZW committed
228
      key: 'factoryIdList',
TZW's avatar
TZW committed
229 230 231 232 233
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
234 235
      width: 120,
      valueType: 'select',
wuhao's avatar
wuhao committed
236 237
      searchKey: 'factoryNames',
      searchValueType: 'input',
TZW's avatar
TZW committed
238
      options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
wuhao's avatar
wuhao committed
239 240
    },
    {
TZW's avatar
TZW committed
241
      title: '负责车间',
TZW's avatar
TZW committed
242
      dataIndex: 'shopNames',
TZW's avatar
TZW committed
243 244 245 246 247
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
248 249
      searchKey: 'shopNames',
      searchValueType: 'input',
TZW's avatar
TZW committed
250 251 252
      width: 120,
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
253
        path: '/auth/sysShop/getShopSelectionByFactoryIdList',
TZW's avatar
TZW committed
254
        linkParams: {
wuhao's avatar
wuhao committed
255
          factoryIdList: '',
TZW's avatar
TZW committed
256
        },
wuhao's avatar
wuhao committed
257
      },
TZW's avatar
TZW committed
258
      key: 'shopIdList',
TZW's avatar
TZW committed
259
      formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
260 261
    },
    {
TZW's avatar
TZW committed
262 263
      title: '负责工段',
      width: 120,
TZW's avatar
TZW committed
264
      dataIndex: 'sectionNames',
wuhao's avatar
wuhao committed
265

TZW's avatar
TZW committed
266
      search: false,
TZW's avatar
TZW committed
267
      key: 'sectionIdList',
TZW's avatar
TZW committed
268
      hideInTable: true,
TZW's avatar
TZW committed
269 270 271 272 273
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
274 275
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
276
        path: '/auth/sysSection/getAllSectionSelectionByShopIdList',
TZW's avatar
TZW committed
277
        linkParams: {
TZW's avatar
TZW committed
278
          shopIdList: '',
TZW's avatar
TZW committed
279
        },
wuhao's avatar
wuhao committed
280 281 282
      },
    },
    {
TZW's avatar
TZW committed
283 284 285 286
      title: '负责产线',
      width: 120,
      dataIndex: 'productionLines',
      valueType: 'select',
TZW's avatar
TZW committed
287 288 289 290 291
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
292
      search: false,
TZW's avatar
TZW committed
293
      hideInTable: true,
TZW's avatar
TZW committed
294
      key: 'productionLineIdList',
TZW's avatar
TZW committed
295
      options: {
TZW's avatar
TZW committed
296
        path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
TZW's avatar
TZW committed
297
        linkParams: {
TZW's avatar
TZW committed
298
          shopIdList: '',
TZW's avatar
TZW committed
299
        },
wuhao's avatar
wuhao committed
300 301
      },
    },
TZW's avatar
TZW committed
302 303 304
    {
      title: '角色配置',
      dataIndex: 'roleNames',
TZW's avatar
TZW committed
305
      key: 'roleIdList',
TZW's avatar
TZW committed
306 307 308 309 310 311 312 313 314
      valueType: 'select',
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
      options: {
        path: '/auth/sysRole/selection',
      },
TZW's avatar
TZW committed
315
      search: false,
TZW's avatar
TZW committed
316
    },
TZW's avatar
TZW committed
317

TZW's avatar
TZW committed
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
    {
      title: '直属领导',
      valueType: 'select',
      dataIndex: 'parentName',
      key: 'parentId',
      options: {
        path: '/auth/sysUser/selection',
      },
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
      },
    },
    {
      title: '状态',
TZW's avatar
TZW committed
333 334
      hideInTable: true,
      hideInForm: true,
TZW's avatar
TZW committed
335 336
      dataIndex: 'statusName',
      key: 'status',
TZW's avatar
TZW committed
337
      valueType: 'select',
TZW's avatar
TZW committed
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
    {
      title: '状态',
      dataIndex: 'statusName',
      search: false,
      key: 'status',
TZW's avatar
TZW committed
355
      fieldProps: { disabled: true },
TZW's avatar
TZW committed
356
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
      valueType: 'radio',
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
    {
      title: '备注',
      hideInTable: true,
      dataIndex: 'remarks',
      valueType: 'textarea',
TZW's avatar
TZW committed
374
      width: 120,
TZW's avatar
TZW committed
375 376 377 378 379 380 381 382 383 384 385
      key: 'remarks',
      search: false,
    },
    {
      title: '个人图片',
      search: false,
      dataIndex: 'userImgList',
      key: 'userImgList',
      valueType: 'uploadImage',
      hideInTable: true,
      fieldProps: {
TZW's avatar
TZW committed
386
        limit: 1,
TZW's avatar
TZW committed
387
      },
TZW's avatar
TZW committed
388

TZW's avatar
TZW committed
389 390 391 392 393 394 395 396
      render: (text, row) => {
        if (row?.pictureUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.pictureUrl} />;
        }
      },
    },
wuhao's avatar
wuhao committed
397 398 399 400
  ];
}

export default getcolumns;