From fee38f39e36bcda9924f5b26dca609dda6b331e0 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期日, 22 六月 2025 16:53:27 +0800
Subject: [PATCH] no message
---
zy-asrs-flow/src/pages/system/dept/components/edit.jsx | 334 ++++++++++++++++++++-----------------------------------
1 files changed, 123 insertions(+), 211 deletions(-)
diff --git a/zy-asrs-flow/src/pages/system/dept/components/edit.jsx b/zy-asrs-flow/src/pages/system/dept/components/edit.jsx
index e6de44a..f6366cc 100644
--- a/zy-asrs-flow/src/pages/system/dept/components/edit.jsx
+++ b/zy-asrs-flow/src/pages/system/dept/components/edit.jsx
@@ -1,211 +1,123 @@
-import React, { useState, useRef, useEffect } from 'react';
-import {
- ProForm,
- ProFormDigit,
- ProFormText,
- ProFormSelect,
- ProFormDateTimePicker
-} from '@ant-design/pro-components';
-import { Form, Modal } from 'antd';
-import moment from 'moment';
-import Http from '@/utils/http';
-
-const Edit = (props) => {
- const [form] = Form.useForm();
- const { } = props;
-
- useEffect(() => {
- form.resetFields();
- form.setFieldsValue({
- ...props.values
- })
- }, [form, props])
-
- const handleCancel = () => {
- props.onCancel();
- };
-
- const handleOk = () => {
- form.submit();
- }
-
- const handleFinish = async (values) => {
- props.onSubmit({ ...values });
- }
-
- return (
- <>
- <Modal
- title="Edit"
- width={640}
- forceRender
- destroyOnClose
- open={props.open}
- onCancel={handleCancel}
- onOk={handleOk}
- >
- <ProForm
- form={form}
- submitter={false}
- onFinish={handleFinish}
- layout="horizontal"
- grid={true}
- >
- <ProFormDigit
- name="id"
- disabled
- hidden={true}
- />
- <ProForm.Group>
- <ProFormText
- name="name"
- label="鍚嶇О"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- rules={[{ required: true, message: "鍚嶇О涓嶈兘涓虹┖锛�" }]}
- />
- <ProFormDigit
- name="parentId"
- label="涓婄骇閮ㄩ棬"
- colProps={{ md: 12, xl: 12 }}
- fieldProps={{ precision: 0 }}
- placeholder="璇疯緭鍏�"
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormText
- name="parentName"
- label="涓婄骇閮ㄩ棬鍚�"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- <ProFormText
- name="path"
- label="鍏宠仈璺緞"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormText
- name="pathName"
- label="鍏宠仈璺緞鍚�"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- <ProFormText
- name="fullName"
- label="鍏ㄧО"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormText
- name="brief"
- label="绠�杩�"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- <ProFormText
- name="code"
- label="鏍囪瘑"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormDigit
- name="type"
- label="绫诲瀷"
- colProps={{ md: 12, xl: 12 }}
- fieldProps={{ precision: 0 }}
- placeholder="璇疯緭鍏�"
- />
- <ProFormText
- name="leader"
- label="璐熻矗浜�"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇疯緭鍏�"
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormDigit
- name="count"
- label="鏁伴噺"
- colProps={{ md: 12, xl: 12 }}
- fieldProps={{ precision: 0 }}
- placeholder="璇疯緭鍏�"
- />
- <ProFormDigit
- name="sort"
- label="鎺掑簭"
- colProps={{ md: 12, xl: 12 }}
- fieldProps={{ precision: 0 }}
- placeholder="璇疯緭鍏�"
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormSelect
- name="status"
- label="鐘舵��"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇烽�夋嫨"
- options={[
- { label: '姝e父', value: 1 },
- { label: '绂佺敤', value: 0 },
- ]}
- />
- <ProFormDateTimePicker
- name="createTime"
- label="娣诲姞鏃堕棿"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇烽�夋嫨"
- transform={(value) => moment(value).toISOString()}
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormSelect
- name="createBy"
- label="娣诲姞浜哄憳"
- colProps={{ md: 12, xl: 12 }}
- fieldProps={{ precision: 0 }}
- placeholder="璇烽�夋嫨"
- showSearch
- debounceTime={300}
- request={async ({ keyWords }) => {
- const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
- return resp.data;
- }}
- />
- <ProFormDateTimePicker
- name="updateTime"
- label="淇敼鏃堕棿"
- colProps={{ md: 12, xl: 12 }}
- placeholder="璇烽�夋嫨"
- transform={(value) => moment(value).toISOString()}
- />
- </ProForm.Group>
- <ProForm.Group>
- <ProFormSelect
- name="updateBy"
- label="淇敼浜哄憳"
- colProps={{ md: 12, xl: 12 }}
- fieldProps={{ precision: 0 }}
- placeholder="璇烽�夋嫨"
- showSearch
- debounceTime={300}
- request={async ({ keyWords }) => {
- const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
- return resp.data;
- }}
- />
- </ProForm.Group>
-
- </ProForm>
- </Modal>
- </>
- )
-}
-
-export default Edit;
+import React, { useState, useRef, useEffect } from 'react';
+import {
+ ProForm,
+ ProFormDigit,
+ ProFormText,
+ ProFormSelect,
+ ProFormDateTimePicker,
+ ProFormTreeSelect
+} from '@ant-design/pro-components';
+import { Form, Modal } from 'antd';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import moment from 'moment';
+import Http from '@/utils/http';
+
+const Edit = (props) => {
+ const intl = useIntl();
+ const [form] = Form.useForm();
+ const { } = props;
+
+ useEffect(() => {
+ form.resetFields();
+ form.setFieldsValue({
+ ...props.values
+ })
+ }, [form, props])
+
+ const handleCancel = () => {
+ props.onCancel();
+ };
+
+ const handleOk = () => {
+ form.submit();
+ }
+
+ const handleFinish = async (values) => {
+ props.onSubmit({ ...values });
+ }
+
+ return (
+ <>
+ <Modal
+ title={
+ Object.keys(props.values).length > 0
+ ? intl.formatMessage({ id: 'page.edit', defaultMessage: '缂栬緫' })
+ : intl.formatMessage({ id: 'page.add', defaultMessage: '娣诲姞' })
+ }
+ width={640}
+ forceRender
+ destroyOnClose
+ open={props.open}
+ onCancel={handleCancel}
+ onOk={handleOk}
+ >
+ <ProForm
+ form={form}
+ submitter={false}
+ onFinish={handleFinish}
+ layout="horizontal"
+ grid={true}
+ >
+ <ProFormDigit
+ name="id"
+ disabled
+ hidden={true}
+ />
+ <ProForm.Group>
+ <ProFormTreeSelect
+ name="parentId"
+ label="涓婄骇閮ㄩ棬"
+ params={props.treeData}
+ request={async () => {
+ return props.treeData;
+ }}
+ colProps={{ md: 12, xl: 12 }}
+ rules={[{ required: true, message: "涓婄骇閮ㄩ棬涓嶈兘涓虹┖" }]}
+ fieldProps={{
+ treeDefaultExpandedKeys: [0]
+ }}
+ />
+ <ProFormText
+ name="name"
+ label="閮ㄩ棬鍚嶇О"
+ colProps={{ md: 12, xl: 12 }}
+ rules={[{ required: true, message: "閮ㄩ棬鍚嶇О涓嶈兘涓虹┖锛�" }]}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="leader"
+ label="璐熻矗浜�"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormDigit
+ name="sort"
+ label="鎺掑簭"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="status"
+ label="鐘舵��"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />
+ <ProFormText
+ name="memo"
+ label=" 澶囨敞"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+
+ </ProForm>
+ </Modal>
+ </>
+ )
+}
+
+export default Edit;
--
Gitblit v1.9.1