From fa3ac93010bea3805438ee3ab0a182bfbf7423da Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期一, 27 五月 2024 16:19:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/system/user/user.data.ts |  541 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 541 insertions(+), 0 deletions(-)

diff --git a/src/views/system/user/user.data.ts b/src/views/system/user/user.data.ts
new file mode 100644
index 0000000..4bbc4a1
--- /dev/null
+++ b/src/views/system/user/user.data.ts
@@ -0,0 +1,541 @@
+import { BasicColumn } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
+import { getAllRolesListNoByTenant, getAllTenantList } from './user.api';
+import { rules } from '/@/utils/helper/validator';
+import { render } from '/@/utils/common/renderUtils';
+export const columns: BasicColumn[] = [
+  {
+    title: '鐢ㄦ埛璐﹀彿',
+    dataIndex: 'username',
+    width: 120,
+  },
+  {
+    title: '鐢ㄦ埛濮撳悕',
+    dataIndex: 'realname',
+    width: 100,
+  },
+  {
+    title: '澶村儚',
+    dataIndex: 'avatar',
+    width: 120,
+    customRender: render.renderAvatar,
+  },
+  {
+    title: '鎬у埆',
+    dataIndex: 'sex',
+    width: 80,
+    sorter: true,
+    customRender: ({ text }) => {
+      return render.renderDict(text, 'sex');
+    },
+  },
+  {
+    title: '鐢熸棩',
+    dataIndex: 'birthday',
+    width: 100,
+  },
+  {
+    title: '鎵嬫満鍙�',
+    dataIndex: 'phone',
+    width: 100,
+  },
+  {
+    title: '閮ㄩ棬',
+    width: 150,
+    dataIndex: 'orgCodeTxt',
+  },
+  {
+    title: '璐熻矗閮ㄩ棬',
+    width: 150,
+    dataIndex: 'departIds_dictText',
+  },
+  {
+    title: '鐘舵��',
+    dataIndex: 'status_dictText',
+    width: 80,
+  },
+];
+
+export const recycleColumns: BasicColumn[] = [
+  {
+    title: '鐢ㄦ埛璐﹀彿',
+    dataIndex: 'username',
+    width: 100,
+  },
+  {
+    title: '鐢ㄦ埛濮撳悕',
+    dataIndex: 'realname',
+    width: 100,
+  },
+  {
+    title: '澶村儚',
+    dataIndex: 'avatar',
+    width: 80,
+    customRender: render.renderAvatar,
+  },
+  {
+    title: '鎬у埆',
+    dataIndex: 'sex',
+    width: 80,
+    sorter: true,
+    customRender: ({ text }) => {
+      return render.renderDict(text, 'sex');
+    },
+  },
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    label: '璐﹀彿',
+    field: 'username',
+    component: 'JInput',
+    colProps: { span: 6 },
+  },
+  {
+    label: '鍚嶅瓧',
+    field: 'realname',
+    component: 'JInput',
+    colProps: { span: 6 },
+  },
+  {
+    label: '鎬у埆',
+    field: 'sex',
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'sex',
+      placeholder: '璇烽�夋嫨鎬у埆',
+      stringToNumber: true,
+    },
+    colProps: { span: 6 },
+  },
+  {
+    label: '鎵嬫満鍙风爜',
+    field: 'phone',
+    component: 'Input',
+    colProps: { span: 6 },
+  },
+  {
+    label: '鐢ㄦ埛鐘舵��',
+    field: 'status',
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'user_status',
+      placeholder: '璇烽�夋嫨鐘舵��',
+      stringToNumber: true,
+    },
+    colProps: { span: 6 },
+  },
+];
+
+export const formSchema: FormSchema[] = [
+  {
+    label: '',
+    field: 'id',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '鐢ㄦ埛璐﹀彿',
+    field: 'username',
+    component: 'Input',
+    dynamicDisabled: ({ values }) => {
+      return !!values.id;
+    },
+    dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'username', model, schema, true),
+  },
+  {
+    label: '鐧诲綍瀵嗙爜',
+    field: 'password',
+    component: 'StrengthMeter',
+    rules: [
+      {
+        required: true,
+        message: '璇疯緭鍏ョ櫥褰曞瘑鐮�',
+      },
+    ],
+  },
+  {
+    label: '纭瀵嗙爜',
+    field: 'confirmPassword',
+    component: 'InputPassword',
+    dynamicRules: ({ values }) => rules.confirmPassword(values, true),
+  },
+  {
+    label: '鐢ㄦ埛濮撳悕',
+    field: 'realname',
+    required: true,
+    component: 'Input',
+  },
+  {
+    label: '宸ュ彿',
+    field: 'workNo',
+    required: true,
+    component: 'Input',
+    dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'work_no', model, schema, true),
+  },
+  {
+    label: '鑱屽姟',
+    field: 'post',
+    required: false,
+    component: 'JSelectPosition',
+    componentProps: {
+      rowKey: 'code',
+      labelKey: 'name',
+    },
+  },
+  {
+    label: '瑙掕壊',
+    field: 'selectedroles',
+    component: 'ApiSelect',
+    componentProps: {
+      mode: 'multiple',
+      api: getAllRolesListNoByTenant,
+      labelField: 'roleName',
+      valueField: 'id',
+    },
+  },
+  {
+    label: '鎵�灞為儴闂�',
+    field: 'selecteddeparts',
+    component: 'JSelectDept',
+    componentProps: ({ formActionType, formModel }) => {
+      return {
+        sync: false,
+        checkStrictly: true,
+        defaultExpandLevel: 2,
+
+        onSelect: (options, values) => {
+          const { updateSchema } = formActionType;
+          //鎵�灞為儴闂ㄤ慨鏀瑰悗鏇存柊璐熻矗閮ㄩ棬涓嬫媺妗嗘暟鎹�
+          updateSchema([
+            {
+              field: 'departIds',
+              componentProps: { options },
+            },
+          ]);
+          //鎵�灞為儴闂ㄤ慨鏀瑰悗鏇存柊璐熻矗閮ㄩ棬鏁版嵁
+          formModel.departIds && (formModel.departIds = formModel.departIds.filter((item) => values.value.indexOf(item) > -1));
+        },
+      };
+    },
+  },
+  {
+    label: '绉熸埛',
+    field: 'relTenantIds',
+    component: 'ApiSelect',
+    componentProps: {
+      mode: 'multiple',
+      api: getAllTenantList,
+      numberToString: true,
+      labelField: 'name',
+      valueField: 'id',
+    },
+  },
+  {
+    label: '韬唤',
+    field: 'userIdentity',
+    component: 'RadioGroup',
+    defaultValue: 1,
+    componentProps: ({ formModel }) => {
+      return {
+        options: [
+          { label: '鏅�氱敤鎴�', value: 1, key: '1' },
+          { label: '涓婄骇', value: 2, key: '2' },
+        ],
+        onChange: () => {
+          formModel.userIdentity == 1 && (formModel.departIds = []);
+        },
+      };
+    },
+  },
+  {
+    label: '璐熻矗閮ㄩ棬',
+    field: 'departIds',
+    component: 'Select',
+    componentProps: {
+      mode: 'multiple',
+    },
+    ifShow: ({ values }) => values.userIdentity == 2,
+  },
+  {
+    label: '澶村儚',
+    field: 'avatar',
+    component: 'JImageUpload',
+    componentProps: {
+      fileMax: 1,
+    },
+  },
+  {
+    label: '鐢熸棩',
+    field: 'birthday',
+    component: 'DatePicker',
+  },
+  {
+    label: '鎬у埆',
+    field: 'sex',
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'sex',
+      placeholder: '璇烽�夋嫨鎬у埆',
+      stringToNumber: true,
+    },
+  },
+  {
+    label: '閭',
+    field: 'email',
+    component: 'Input',
+    rules: rules.rule('email', false),
+  },
+  {
+    label: '鎵嬫満鍙风爜',
+    field: 'phone',
+    component: 'Input',
+    // dynamicRules: ({ model, schema }) => {
+    //   return [
+    //     { ...rules.duplicateCheckRule('sys_user', 'phone', model, schema, true)[0] },
+    //     { pattern: /^1[3456789]\d{9}$/, message: '鎵嬫満鍙风爜鏍煎紡鏈夎' },
+    //   ];
+    // },
+  },
+  {
+    label: '搴ф満',
+    field: 'telephone',
+    component: 'Input',
+    rules: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '璇疯緭鍏ユ纭殑搴ф満鍙风爜' }],
+  },
+  {
+    label: '宸ヤ綔娴佸紩鎿�',
+    field: 'activitiSync',
+    defaultValue: 1,
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'activiti_sync',
+      type: 'radio',
+      stringToNumber: true,
+    },
+  },
+];
+
+export const formPasswordSchema: FormSchema[] = [
+  {
+    label: '鐢ㄦ埛璐﹀彿',
+    field: 'username',
+    component: 'Input',
+    componentProps: { readOnly: true },
+  },
+  {
+    label: '鐧诲綍瀵嗙爜',
+    field: 'password',
+    component: 'StrengthMeter',
+    componentProps: {
+      placeholder: '璇疯緭鍏ョ櫥褰曞瘑鐮�',
+    },
+    rules: [
+      {
+        required: true,
+        message: '璇疯緭鍏ョ櫥褰曞瘑鐮�',
+      },
+    ],
+  },
+  {
+    label: '纭瀵嗙爜',
+    field: 'confirmPassword',
+    component: 'InputPassword',
+    dynamicRules: ({ values }) => rules.confirmPassword(values, true),
+  },
+];
+
+export const formAgentSchema: FormSchema[] = [
+  {
+    label: '',
+    field: 'id',
+    component: 'Input',
+    show: false,
+  },
+  {
+    field: 'userName',
+    label: '鐢ㄦ埛鍚�',
+    component: 'Input',
+    componentProps: {
+      readOnly: true,
+      allowClear: false,
+    },
+  },
+  {
+    field: 'agentUserName',
+    label: '浠g悊浜虹敤鎴峰悕',
+    required: true,
+    component: 'JSelectUser',
+    componentProps: {
+      rowKey: 'username',
+      labelKey: 'realname',
+      maxSelectCount: 10,
+    },
+  },
+  {
+    field: 'startTime',
+    label: '浠g悊寮�濮嬫椂闂�',
+    component: 'DatePicker',
+    required: true,
+    componentProps: {
+      showTime: true,
+      valueFormat: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: '璇烽�夋嫨浠g悊寮�濮嬫椂闂�',
+    },
+  },
+  {
+    field: 'endTime',
+    label: '浠g悊缁撴潫鏃堕棿',
+    component: 'DatePicker',
+    required: true,
+    componentProps: {
+      showTime: true,
+      valueFormat: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: '璇烽�夋嫨浠g悊缁撴潫鏃堕棿',
+    },
+  },
+  {
+    field: 'status',
+    label: '鐘舵��',
+    component: 'JDictSelectTag',
+    defaultValue: '1',
+    componentProps: {
+      dictCode: 'valid_status',
+      type: 'radioButton',
+    },
+  },
+];
+
+export const formQuitAgentSchema: FormSchema[] = [
+  {
+    label: '',
+    field: 'id',
+    component: 'Input',
+    show: false,
+  },
+  {
+    field: 'userName',
+    label: '鐢ㄦ埛鍚�',
+    component: 'Input',
+    componentProps: {
+      readOnly: true,
+      allowClear: false,
+    },
+  },
+  {
+    field: 'agentUserName',
+    label: '浜ゆ帴浜哄憳',
+    required: true,
+    component: 'JSelectUser',
+    componentProps: {
+      rowKey: 'username',
+      labelKey: 'realname',
+      maxSelectCount: 1,
+    },
+  },
+  {
+    field: 'startTime',
+    label: '浜ゆ帴寮�濮嬫椂闂�',
+    component: 'DatePicker',
+    required: true,
+    componentProps: {
+      showTime: true,
+      valueFormat: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: '璇烽�夋嫨浜ゆ帴寮�濮嬫椂闂�',
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'endTime',
+    label: '浜ゆ帴缁撴潫鏃堕棿',
+    component: 'DatePicker',
+    required: true,
+    componentProps: {
+      showTime: true,
+      valueFormat: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: '璇烽�夋嫨浜ゆ帴缁撴潫鏃堕棿',
+      getPopupContainer: () => document.body,
+    },
+  },
+  {
+    field: 'status',
+    label: '鐘舵��',
+    component: 'JDictSelectTag',
+    defaultValue: '1',
+    componentProps: {
+      dictCode: 'valid_status',
+      type: 'radioButton',
+    },
+  },
+];
+
+//绉熸埛鐢ㄦ埛鍒楄〃
+export const userTenantColumns: BasicColumn[] = [
+  {
+    title: '鐢ㄦ埛璐﹀彿',
+    dataIndex: 'username',
+    width: 120,
+  },
+  {
+    title: '鐢ㄦ埛濮撳悕',
+    dataIndex: 'realname',
+    width: 100,
+  },
+  {
+    title: '澶村儚',
+    dataIndex: 'avatar',
+    width: 120,
+    customRender: render.renderAvatar,
+  },
+  {
+    title: '鎵嬫満鍙�',
+    dataIndex: 'phone',
+    width: 100,
+  },
+  {
+    title: '閮ㄩ棬',
+    width: 150,
+    dataIndex: 'orgCodeTxt',
+  },
+  {
+    title: '鐘舵��',
+    dataIndex: 'status',
+    width: 80,
+    customRender: ({ text }) => {
+      if (text === '1') {
+        return '姝e父';
+      } else if (text === '3') {
+        return '瀹℃壒涓�';
+      } else {
+        return '宸叉嫆缁�';
+      }
+    },
+  },
+];
+
+//鐢ㄦ埛绉熸埛鎼滅储琛ㄥ崟
+export const userTenantFormSchema: FormSchema[] = [
+  {
+    label: '璐﹀彿',
+    field: 'username',
+    component: 'Input',
+    colProps: { span: 6 },
+  },
+  {
+    label: '鍚嶅瓧',
+    field: 'realname',
+    component: 'Input',
+    colProps: { span: 6 },
+  },
+  {
+    label: '鎬у埆',
+    field: 'sex',
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'sex',
+      placeholder: '璇烽�夋嫨鎬у埆',
+      stringToNumber: true,
+    },
+    colProps: { span: 6 },
+  },
+];

--
Gitblit v1.9.3