Sfoglia il codice sorgente

feat: 考勤菜单获取

outaozhen 5 anni fa
parent
commit
eed4321cbf

+ 20 - 30
.eslintrc.js

@@ -1,32 +1,22 @@
 module.exports = {
-  extends: [require.resolve('@umijs/fabric/dist/eslint')],
-  globals: {
-    ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
-    page: true,
-    REACT_APP_ENV: true
-  },
-  rules: {
-    semi: ['error', 'never'],
-    'no-multiple-empty-lines': [1, { max: 2 }],
-    'comma-dangle': [2, 'never'],
-    'react/prop-types': 0,
-    'spaced-comment': 'error',
-    // 'array-bracket-spacing': ['error', 'always'], // 和prettier冲突
-    'object-curly-spacing': ['error', 'always'],
-    'no-use-before-define': ['error', { functions: false }], // 允许在未定义function前调用
-    'react/self-closing-comp': [
-      'error',
-      {
-        component: true,
-        html: true
-      }
+    "env": {
+        "browser": true,
+        "es2021": true
+    },
+    "extends": [
+        "eslint:recommended",
+        "plugin:react/recommended"
     ],
-    'react-hooks/exhaustive-deps': 0,
-    'no-unused-expressions': [
-      'error',
-      {
-        allowShortCircuit: true
-      }
-    ]
-  }
-}
+    "parserOptions": {
+        "ecmaFeatures": {
+            "jsx": true
+        },
+        "ecmaVersion": 12,
+        "sourceType": "module"
+    },
+    "plugins": [
+        "react"
+    ],
+    "rules": {
+    }
+};

+ 3 - 0
package.json

@@ -88,6 +88,7 @@
     "@umijs/preset-react": "1.8.12",
     "@umijs/yorkie": "^2.0.3",
     "agent-base": "^6.0.2",
+    "babel-eslint": "^10.1.0",
     "babel-plugin-import": "^1.13.3",
     "carlo": "^0.9.46",
     "chalk": "^4.0.0",
@@ -97,8 +98,10 @@
     "detect-installer": "^1.0.1",
     "enzyme": "^3.11.0",
     "eslint": "^7.18.0",
+    "eslint-plugin-import": "^2.23.4",
     "eslint-plugin-javascript": "^1.3.4",
     "eslint-plugin-jsx": "^0.1.0",
+    "eslint-plugin-react": "^7.24.0",
     "eslint-plugin-typescript": "^0.14.0",
     "express": "^4.17.1",
     "gh-pages": "^3.0.0",

+ 10 - 0
src/components/EditableForm/src/editableFormItem.jsx

@@ -132,6 +132,16 @@ const EditableFormItem = ({
           />
         )
         break
+      case 'treeselect':
+        cell = (
+          <ChangeSelect
+            ref={iRef}
+            defaultValue={state.val}
+            options={options}
+            onSave={save}
+            onBlur={save}
+          />
+        )
       case 'textarea':
         cell = (
           <Input.TextArea

+ 43 - 0
src/pages/Staff/Employee/components/AddStaff/index.jsx

@@ -0,0 +1,43 @@
+import { ModalForm } from '@ant-design/pro-form'
+import { Button, Row, Col } from 'antd'
+import React from 'react'
+
+const AddStaff = props => {
+  const { onConfirm } = props
+  const layout = {
+    layout: 'horizontal',
+    labelCol: { flex: '100px' }
+  }
+  return (
+    <ModalForm
+      {...layout}
+      title="添加员工"
+      trigger={
+        <Button key="button" type="primary" size="small" className="flex items-center">
+          <Plus className="zh-mg-right-5" />
+          员工
+        </Button>
+      }
+      onFinish={async values => {
+        await onConfirm(values)
+        return true
+      }}>
+      <Row>
+        <Col span={12}>
+          <ProFormText
+            name="clientName"
+            label="姓名"
+            rules={[{ required: true, message: '请输入姓名' }]}
+          />
+          <ProFormText
+            name="telephone"
+            label="办事处/部门"
+            rules={[{ required: true, message: '请输入手机号码' }]}
+          />
+        </Col>
+      </Row>
+    </ModalForm>
+  )
+}
+
+export default AddStaff

+ 1 - 0
src/pages/Staff/Employee/components/EmployeeDetail/EmployeeForm.jsx

@@ -63,6 +63,7 @@ const EmployeeForm = props => {
     {
       dataIndex: 'gender',
       label: '性别',
+      editCellType: 'select',
       span: 12
     },
     {

+ 1 - 1
src/pages/Staff/Employee/index.jsx

@@ -131,7 +131,7 @@ const Employee = () => {
                 // onConfirm={() => console.log(state.params.id)}
                 onConfirm={() => handleDelDepartment(state.params.id)}>
                 <Button danger size="small">
-                  删除
+                  删除部门
                 </Button>
               </Popconfirm>
             )}