columns.js 12.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';
wuhao's avatar
wuhao committed
5 6 7 8
function getcolumns(setdrawer) {
  return [
    {
      title: '用户名',
TZW's avatar
TZW committed
9
      dataIndex: 'username',
TZW's avatar
TZW committed
10
      width: 120,
TZW's avatar
TZW committed
11 12
      key: 'username',
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
13 14 15
    },
    {
      title: '姓名',
TZW's avatar
TZW committed
16
      dataIndex: 'fullName',
TZW's avatar
TZW committed
17
      width: 100,
TZW's avatar
TZW committed
18 19
      key: 'fullName',
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
20 21 22
      render: (text, row) => {
        return (
          <a
TZW's avatar
TZW committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
            // onClick={async () => {
            //   let newfieldscolumns = [];
            //   const fieldscolumns = [
            //     {
            //       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: 'sectionName',
            //       key: 'sectionIdList',
            //     },
            //     {
            //       title: '负责产线',
            //       dataIndex: 'productionLines',
            //       key: 'productionLineIdList',
            //     },
            //     {
            //       title: '角色配置',
            //       dataIndex: 'roleNames',
            //       key: 'roleIdList',
            //     },
            //     {
            //       title: '直属领导',
            //       dataIndex: 'parentName',
            //       key: 'parentId',
            //     },
            //     {
            //       title: '状态',
            //       dataIndex: 'statusName',
            //       key: 'status',
            //     },
            //   ];
            //   const selectValueType = (type, options) => {
            //     switch (type) {
            //       case 1:
            //         return {
            //           valueType: 'input',
            //         };
            //       case 2:
            //         return {
            //           valueType: 'select',
            //           options,
            //         };
            //       case 3:
            //         return {
            //           valueType: 'radio',
            //           options,
            //         };
            //       case 4:
            //         return {
            //           valueType: 'select',
            //           options,
            //         };
            //       default:
            //         break;
            //     }
            //   };
TZW's avatar
TZW committed
113

TZW's avatar
TZW committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
            //   let res = await doFetch({
            //     url: '/base/paFormField/queryList',
            //     params: {
            //       formId: '1',
            //     },
            //   });
            //   if (res?.data?.dataList) {
            //     let column = [
            //       {
            //         title: '扩展字段',
            //         valueType: 'split',
            //       },
            //     ];
            //     res?.data?.dataList?.forEach((el) => {
            //       column.push({
            //         ...selectValueType(el.fieldChar, el.valueList),
            //         title: el.fieldName,
            //         dataIndex: el.id,
            //         key: el.id,
            //       });
            //     });
            //     newfieldscolumns = fieldscolumns.concat(column);
TZW's avatar
TZW committed
136
            //     //console.log('fieldscolumns', newfieldscolumns);
TZW's avatar
TZW committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
            //   }
            //   setdrawer((s) => ({
            //     ...s,
            //     visible: true,
            //     item: row,
            //     title: '详情',
            //     fields: newfieldscolumns,
            //     extendField: 'userCharList',
            //     detailpath: '/auth/sysUser/detail',
            //     params: { id: row.id },
            //     val: 'detail',
            //     title: row.fullName + '的详细信息',
            //   }));
            // }}
            onClick={() => {
              fieldsDetail(
                [
TZW's avatar
TZW committed
154
                  {
TZW's avatar
TZW committed
155 156 157
                    title: '用户名',
                    dataIndex: 'username',
                    key: 'username',
TZW's avatar
TZW committed
158
                  },
TZW's avatar
TZW committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
                  {
                    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: 'sectionName',
                    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',
              );
TZW's avatar
TZW committed
221 222 223 224 225 226
            }}
          >
            {row.fullName}
          </a>
        );
      },
TZW's avatar
TZW committed
227
    },
TZW's avatar
TZW committed
228 229 230 231 232 233 234 235
    {
      title: '手机号',
      hideInTable: true,
      dataIndex: 'telephone',
      key: 'telephone',
      hideInTable: true,
      search: false,
    },
TZW's avatar
TZW committed
236
    { title: '邮箱', dataIndex: 'mailNo', key: 'mailNo', hideInTable: true, search: false },
TZW's avatar
TZW committed
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
    {
      title: '公司名称',
      align: 'center',
      dataIndex: 'organizationName',
      width: 120,
      key: 'organizationId',
      valueType: 'select',
      options: { path: '/auth/sysDepartment/query/organization/selectbox', params: {} },
    },
    {
      title: '部门名称',
      width: 120,
      align: 'center',
      valueType: 'select',
      dataIndex: 'departmentName',
      key: 'departmentId',
      options: {
        path: '/auth/sysDepartment/query/depart/selectbox',
        linkParams: {
          organizationId: 'parentId',
wuhao's avatar
wuhao committed
257 258 259
        },
      },
    },
TZW's avatar
TZW committed
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
    {
      title: '负责工厂',
      dataIndex: 'factoryNames',
      align: 'center',
      key: 'factoryNames',
      hideInTable: true,
      hideInForm: true,
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
    },
    {
      title: '负责车间',
      dataIndex: 'shopNames',
      key: 'shopNames',
      align: 'center',
      hideInTable: true,
      hideInForm: true,
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
    },
    {
      title: '角色名称',
      dataIndex: 'roleNames',
      key: 'roleNames',
      hideInForm: true,
      hideInTable: true,
    },
wuhao's avatar
wuhao committed
285
    {
TZW's avatar
TZW committed
286
      title: '负责工厂',
TZW's avatar
TZW committed
287
      dataIndex: 'factoryNames',
TZW's avatar
TZW committed
288
      key: 'factoryIdList',
TZW's avatar
TZW committed
289 290 291 292 293 294
      search: false,
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
295 296 297 298
      width: 120,
      align: 'center',
      valueType: 'select',
      options: { path: '/auth/sysFactory/getAllFactorySelection', params: {} },
wuhao's avatar
wuhao committed
299 300
    },
    {
TZW's avatar
TZW committed
301
      title: '负责车间',
TZW's avatar
TZW committed
302
      dataIndex: 'shopNames',
TZW's avatar
TZW committed
303
      search: false,
TZW's avatar
TZW committed
304
      align: 'center',
TZW's avatar
TZW committed
305 306 307 308 309
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
310 311 312
      width: 120,
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
313
        path: '/auth/sysShop/getShopSelectionByFactoryIdList',
TZW's avatar
TZW committed
314
        linkParams: {
TZW's avatar
TZW committed
315
          factoryIdList: 'factoryIdList',
TZW's avatar
TZW committed
316
        },
wuhao's avatar
wuhao committed
317
      },
TZW's avatar
TZW committed
318
      key: 'shopIdList',
TZW's avatar
TZW committed
319
      formItemProps: { rules: [{ required: false, message: '此项为必填项' }] },
wuhao's avatar
wuhao committed
320 321
    },
    {
TZW's avatar
TZW committed
322 323
      title: '负责工段',
      width: 120,
TZW's avatar
TZW committed
324
      dataIndex: 'sectionNames',
TZW's avatar
TZW committed
325
      align: 'center',
TZW's avatar
TZW committed
326
      search: false,
TZW's avatar
TZW committed
327
      key: 'sectionIdList',
TZW's avatar
TZW committed
328
      hideInTable: true,
TZW's avatar
TZW committed
329 330 331 332 333
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
TZW's avatar
TZW committed
334 335
      valueType: 'select',
      options: {
TZW's avatar
TZW committed
336
        path: '/auth/sysSection/getAllSectionSelectionByShopIdList',
TZW's avatar
TZW committed
337
        linkParams: {
TZW's avatar
TZW committed
338
          shopIdList: '',
TZW's avatar
TZW committed
339
        },
wuhao's avatar
wuhao committed
340 341 342
      },
    },
    {
TZW's avatar
TZW committed
343
      title: '负责产线',
TZW's avatar
TZW committed
344
      search: false,
TZW's avatar
TZW committed
345 346 347
      width: 120,
      dataIndex: 'productionLines',
      valueType: 'select',
TZW's avatar
TZW committed
348 349 350 351 352
      fieldProps: {
        placeholder: '请选择',
        showSearch: true,
        mode: 'multiple',
      },
wuhao's avatar
wuhao committed
353
      search: false,
TZW's avatar
TZW committed
354
      hideInTable: true,
TZW's avatar
TZW committed
355
      key: 'productionLineIdList',
TZW's avatar
TZW committed
356 357
      align: 'center',
      options: {
TZW's avatar
TZW committed
358
        path: '/auth/sysProductionLine/getAllProductLineSelectionByShopIdList',
TZW's avatar
TZW committed
359
        linkParams: {
TZW's avatar
TZW committed
360
          shopIdList: '',
TZW's avatar
TZW committed
361
        },
wuhao's avatar
wuhao committed
362 363
      },
    },
TZW's avatar
TZW committed
364 365 366
    {
      title: '角色配置',
      dataIndex: 'roleNames',
TZW's avatar
TZW committed
367
      key: 'roleIdList',
TZW's avatar
TZW committed
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
      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
394
      // hideInTable: true,
TZW's avatar
TZW committed
395 396
      dataIndex: 'statusName',
      key: 'status',
TZW's avatar
TZW committed
397
      formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
TZW's avatar
TZW committed
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
      valueType: 'radio',
      options: [
        {
          label: '启用',
          value: 1,
        },
        {
          label: '禁用',
          value: 0,
        },
      ],
    },
    {
      title: '备注',
      hideInTable: true,
      dataIndex: 'remarks',
      valueType: 'textarea',
TZW's avatar
TZW committed
415
      width: 120,
TZW's avatar
TZW committed
416 417 418 419 420 421 422 423 424 425 426
      key: 'remarks',
      search: false,
    },
    {
      title: '个人图片',
      search: false,
      dataIndex: 'userImgList',
      key: 'userImgList',
      valueType: 'uploadImage',
      hideInTable: true,
      fieldProps: {
TZW's avatar
TZW committed
427
        limit: 1,
TZW's avatar
TZW committed
428
      },
TZW's avatar
TZW committed
429

TZW's avatar
TZW committed
430 431 432 433 434 435 436 437
      render: (text, row) => {
        if (row?.pictureUrl == null) {
          return '暂无图片';
        } else {
          return <Image width={70} src={row.pictureUrl} />;
        }
      },
    },
wuhao's avatar
wuhao committed
438 439 440 441
  ];
}

export default getcolumns;