From 1d3c1b47cec06e09f0d345c1bac1a674df02e3c7 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 26 三月 2024 13:04:50 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/pages/rcs/motionSts/index.jsx | 428 +++++++++++
zy-asrs-flow/src/pages/rcs/motionCtg/index.jsx | 442 ++++++++++++
zy-asrs-flow/src/pages/rcs/motionCtg/components/edit.jsx | 160 ++++
zy-asrs-flow/src/pages/rcs/motion/index.jsx | 682 ++++++++++++++++++
zy-asrs-flow/src/pages/rcs/motion/components/edit.jsx | 297 ++++++++
zy-asrs-flow/src/pages/rcs/motionSts/components/edit.jsx | 148 ++++
6 files changed, 2,157 insertions(+), 0 deletions(-)
diff --git a/zy-asrs-flow/src/pages/rcs/motion/components/edit.jsx b/zy-asrs-flow/src/pages/rcs/motion/components/edit.jsx
new file mode 100644
index 0000000..dd3cb90
--- /dev/null
+++ b/zy-asrs-flow/src/pages/rcs/motion/components/edit.jsx
@@ -0,0 +1,297 @@
+import React, { useState, useRef, useEffect } from 'react';
+import {
+ ProForm,
+ ProFormDigit,
+ ProFormText,
+ ProFormSelect,
+ ProFormDateTimePicker
+} 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>
+ <ProFormText
+ name="uuid"
+ label="缂栧彿"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormDigit
+ name="wrkNo"
+ label="浠诲姟鍙�"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="serialNo"
+ label="搴忓垪鍙�"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="title"
+ label="鎻忚堪"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDigit
+ name="priority"
+ label="浼樺厛绾�"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ <ProFormSelect
+ name="sync"
+ label="鍚屾"
+ colProps={{ md: 12, xl: 12 }}
+ rules={[{ required: true }]}
+ options={[
+ { label: '鏄�', value: 1 },
+ { label: '鍚�', value: 0 },
+ ]}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="motionCtg"
+ label="浠诲姟绫诲瀷"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ rules={[{ required: true }]}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/motionCtg/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ <ProFormSelect
+ name="motionSts"
+ label="浠诲姟鐘舵��"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ rules={[{ required: true }]}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/motionSts/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="deviceType"
+ label="璁惧绫诲瀷"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/deviceType/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ <ProFormText
+ name="device"
+ label="璁惧"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="origin"
+ label="鏉ユ簮"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormDigit
+ name="oriDrt"
+ label="鏉ユ簮鏂瑰悜"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="target"
+ label="鐩爣"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormDigit
+ name="tarDrt"
+ label="鐩爣鏂瑰悜"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="dockNo"
+ label="瀵规帴璁惧"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormDateTimePicker
+ name="ioTime"
+ label="宸ヤ綔鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDateTimePicker
+ name="startTime"
+ label="寮�濮嬫椂闂�"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ <ProFormDateTimePicker
+ name="endTime"
+ label="缁撴潫鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDateTimePicker
+ name="errTime"
+ label="寮傚父鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ <ProFormDigit
+ name="errCode"
+ label="寮傚父浠g爜"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="errDesc"
+ label="寮傚父鎻忚堪"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="temp"
+ label="棰勭暀"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="status"
+ label="鐘舵��"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />
+ <ProFormSelect
+ name="createBy"
+ label="娣诲姞浜哄憳"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDateTimePicker
+ name="createTime"
+ label="娣诲姞鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ <ProFormSelect
+ name="updateBy"
+ label="淇敼浜哄憳"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDateTimePicker
+ name="updateTime"
+ label="淇敼鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ <ProFormText
+ name="memo"
+ label="澶囨敞"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+
+ </ProForm>
+ </Modal>
+ </>
+ )
+}
+
+export default Edit;
diff --git a/zy-asrs-flow/src/pages/rcs/motion/index.jsx b/zy-asrs-flow/src/pages/rcs/motion/index.jsx
new file mode 100644
index 0000000..6d8e1ce
--- /dev/null
+++ b/zy-asrs-flow/src/pages/rcs/motion/index.jsx
@@ -0,0 +1,682 @@
+
+import React, { useState, useRef, useEffect } from 'react';
+import { Button, message, Modal, Tag } from 'antd';
+import {
+ FooterToolbar,
+ PageContainer,
+ ProTable,
+ LightFilter,
+} from '@ant-design/pro-components';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
+import Http from '@/utils/http';
+import Edit from './components/edit'
+import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
+import { statusMap } from '@/utils/enum-util'
+import { repairBug } from '@/utils/common-util';
+
+const TABLE_KEY = 'pro-table-motion';
+
+const handleSave = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '姝e湪娣诲姞' }));
+ try {
+ const resp = await Http.doPost('api/motion/save', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.add.success', defaultMessage: '娣诲姞鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.add.fail', defaultMessage: '娣诲姞澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleUpdate = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '姝e湪鏇存柊' }));
+ try {
+ const resp = await Http.doPost('api/motion/update', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '鏇存柊鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '鏇存柊澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleRemove = async (rows, intl) => {
+ if (!rows) return true;
+ const hide = message.loading(intl.formatMessage({ id: 'page.deleting', defaultMessage: '姝e湪鍒犻櫎' }));
+ try {
+ const resp = await Http.doPost('api/motion/remove/' + rows.map((row) => row.id).join(','));
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.delete.success', defaultMessage: '鍒犻櫎鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.delete.fail', defaultMessage: '鍒犻櫎澶辫触锛岃閲嶈瘯锛�' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleExport = async (intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '姝e湪瀵煎嚭' }));
+ try {
+ const resp = await Http.doPostBlob('api/motion/export');
+ const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
+ window.location.href = window.URL.createObjectURL(blob);
+ message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '瀵煎嚭鎴愬姛' }));
+ return true;
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '瀵煎嚭澶辫触锛岃閲嶈瘯' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+
+const Main = () => {
+ const intl = useIntl();
+ const formTableRef = useRef();
+ const actionRef = useRef();
+ const [selectedRows, setSelectedRows] = useState([]);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [currentRow, setCurrentRow] = useState();
+ const [searchParam, setSearchParam] = useState({});
+
+ useEffect(() => {
+
+ }, []);
+
+ const columns = [
+ {
+ title: intl.formatMessage({
+ id: 'page.table.no',
+ defaultMessage: 'No'
+ }),
+ dataIndex: 'index',
+ valueType: 'indexBorder',
+ width: 48,
+ },
+ {
+ title: '缂栧彿',
+ dataIndex: 'uuid',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='uuid'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '浠诲姟鍙�',
+ dataIndex: 'wrkNo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='wrkNo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '搴忓垪鍙�',
+ dataIndex: 'serialNo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ copyable: true,
+ filterDropdown: (props) => <TextFilter
+ name='serialNo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鎻忚堪',
+ dataIndex: 'title',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='title'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '浼樺厛绾�',
+ dataIndex: 'priority',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='priority'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鍚屾',
+ dataIndex: 'sync$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <SelectFilter
+ name='sync'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ data={[
+ { label: '鏄�', value: 1 },
+ { label: '鍚�', value: 0 },
+ ]}
+ />,
+ },
+ {
+ title: '浠诲姟绫诲瀷',
+ dataIndex: 'motionCtg$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='motionCtg'
+ major='motionCtg'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '浠诲姟鐘舵��',
+ dataIndex: 'motionSts$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='motionSts'
+ major='motionSts'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '璁惧绫诲瀷',
+ dataIndex: 'deviceType$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='deviceType'
+ major='deviceType'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '璁惧',
+ dataIndex: 'device',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='device'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鏉ユ簮',
+ dataIndex: 'origin',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='origin'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鏉ユ簮鏂瑰悜',
+ dataIndex: 'oriDrt',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='oriDrt'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鐩爣',
+ dataIndex: 'target',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='target'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鐩爣鏂瑰悜',
+ dataIndex: 'tarDrt',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='tarDrt'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '瀵规帴璁惧',
+ dataIndex: 'dockNo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='dockNo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '宸ヤ綔鏃堕棿',
+ dataIndex: 'ioTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='ioTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '寮�濮嬫椂闂�',
+ dataIndex: 'startTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='startTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '缁撴潫鏃堕棿',
+ dataIndex: 'endTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='endTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '寮傚父鏃堕棿',
+ dataIndex: 'errTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='errTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '寮傚父浠g爜',
+ dataIndex: 'errCode',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='errCode'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '寮傚父鎻忚堪',
+ dataIndex: 'errDesc',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='errDesc'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '棰勭暀',
+ dataIndex: 'temp',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='temp'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鐘舵��',
+ dataIndex: 'status$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <SelectFilter
+ name='status'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ data={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />,
+ },
+ {
+ title: '娣诲姞浜哄憳',
+ dataIndex: 'createBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='createBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '娣诲姞鏃堕棿',
+ dataIndex: 'createTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='createTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼浜哄憳',
+ dataIndex: 'updateBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='updateBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼鏃堕棿',
+ dataIndex: 'updateTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='updateTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '澶囨敞',
+ dataIndex: 'memo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='memo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+
+ {
+ title: '鎿嶄綔',
+ dataIndex: 'option',
+ width: 140,
+ valueType: 'option',
+ render: (_, record) => [
+ <Button
+ type="link"
+ key="edit"
+ onClick={() => {
+ setModalVisible(true);
+ setCurrentRow(record);
+ }}
+ >
+ <FormattedMessage id='page.edit' defaultMessage='缂栬緫' />
+ </Button>,
+ <Button
+ type="link"
+ danger
+ key="batchRemove"
+ onClick={async () => {
+ Modal.confirm({
+ title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+ content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+ onOk: async () => {
+ const success = await handleRemove([record], intl);
+ if (success) {
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ },
+ });
+ }}
+ >
+ <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
+ </Button>,
+ ],
+ },
+ ];
+
+ return (
+ <PageContainer
+ header={{
+ breadcrumb: {},
+ }}
+ >
+ <div style={{ width: '100%', float: 'right' }}>
+ <ProTable
+ key="motion"
+ rowKey="id"
+ actionRef={actionRef}
+ formRef={formTableRef}
+ columns={columns}
+ cardBordered
+ scroll={{ x: 1300 }}
+ dateFormatter="string"
+ pagination={{ pageSize: 16 }}
+ search={false}
+ toolbar={{
+ search: {
+ onSearch: (value) => {
+ setSearchParam(prevState => ({
+ ...prevState,
+ condition: value
+ }));
+ actionRef.current?.reload();
+ },
+ },
+ filter: (
+ <LightFilter
+ onValuesChange={(val) => {
+ }}
+ >
+ </LightFilter>
+ ),
+ actions: [
+ <Button
+ type="primary"
+ key="save"
+ onClick={async () => {
+ setModalVisible(true)
+ }}
+ >
+ <PlusOutlined />
+ <FormattedMessage id='page.add' defaultMessage='娣诲姞' />
+ </Button>,
+ <Button
+ key="export"
+ onClick={async () => {
+ handleExport(intl);
+ }}
+ >
+ <ExportOutlined />
+ <FormattedMessage id='page.export' defaultMessage='瀵煎嚭' />
+ </Button>,
+ ],
+ }}
+ request={(params, sorter, filter) =>
+ Http.doPostPromise('/api/motion/page', { ...params, ...searchParam }, (res) => {
+ return {
+ data: res.data.records,
+ total: res.data.total,
+ success: true,
+ }
+ })
+ }
+ rowSelection={{
+ onChange: (ids, rows) => {
+ setSelectedRows(rows);
+ }
+ }}
+ columnsState={{
+ persistenceKey: TABLE_KEY,
+ persistenceType: 'localStorage',
+ defaultValue: {
+ // memo: { show: repairBug(TABLE_KEY, 'memo', false) },
+ option: { fixed: 'right', disable: true },
+ },
+ onChange(value) {
+ },
+ }}
+ />
+ </div>
+
+ {selectedRows?.length > 0 && (
+ <FooterToolbar
+ extra={
+ <div>
+ <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
+ <FormattedMessage id='page.selected' defaultMessage=' 椤瑰凡閫夋嫨' />
+ </div>
+ }
+ >
+ <Button
+ key="remove"
+ danger
+ onClick={async () => {
+ Modal.confirm({
+ title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+ content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+ onOk: async () => {
+ const success = await handleRemove(selectedRows, intl);
+ if (success) {
+ setSelectedRows([]);
+ actionRef.current?.reloadAndRest?.();
+ }
+ },
+ });
+ }}
+ >
+ <FormattedMessage id='page.delete.batch' defaultMessage='鎵归噺鍒犻櫎' />
+ </Button>
+ </FooterToolbar>
+ )}
+
+ <Edit
+ open={modalVisible}
+ values={currentRow || {}}
+ onCancel={
+ () => {
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ }
+ }
+ onSubmit={async (values) => {
+ let ok = false;
+ if (values.id) {
+ ok = await handleUpdate({ ...values }, intl)
+ } else {
+ ok = await handleSave({ ...values }, intl)
+ }
+ if (ok) {
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ }}
+ />
+ </PageContainer>
+ );
+};
+
+export default Main;
diff --git a/zy-asrs-flow/src/pages/rcs/motionCtg/components/edit.jsx b/zy-asrs-flow/src/pages/rcs/motionCtg/components/edit.jsx
new file mode 100644
index 0000000..f0f0292
--- /dev/null
+++ b/zy-asrs-flow/src/pages/rcs/motionCtg/components/edit.jsx
@@ -0,0 +1,160 @@
+import React, { useState, useRef, useEffect } from 'react';
+import {
+ ProForm,
+ ProFormDigit,
+ ProFormText,
+ ProFormSelect,
+ ProFormDateTimePicker
+} 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>
+ <ProFormSelect
+ name="deviceCtg"
+ label="璁惧绫诲瀷"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/deviceCtg/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ <ProFormText
+ name="uuid"
+ label="缂栧彿"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="name"
+ label="鍚嶇О"
+ colProps={{ md: 12, xl: 12 }}
+ rules={[{ required: true }]}
+ />
+ <ProFormText
+ name="flag"
+ label="鏍囪瘑"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="status"
+ label="鐘舵��"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />
+ <ProFormSelect
+ name="createBy"
+ label="娣诲姞浜哄憳"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDateTimePicker
+ name="createTime"
+ label="娣诲姞鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ <ProFormSelect
+ name="updateBy"
+ label="淇敼浜哄憳"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormDateTimePicker
+ name="updateTime"
+ label="淇敼鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ <ProFormText
+ name="memo"
+ label="澶囨敞"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+
+ </ProForm>
+ </Modal>
+ </>
+ )
+}
+
+export default Edit;
diff --git a/zy-asrs-flow/src/pages/rcs/motionCtg/index.jsx b/zy-asrs-flow/src/pages/rcs/motionCtg/index.jsx
new file mode 100644
index 0000000..07ae760
--- /dev/null
+++ b/zy-asrs-flow/src/pages/rcs/motionCtg/index.jsx
@@ -0,0 +1,442 @@
+
+import React, { useState, useRef, useEffect } from 'react';
+import { Button, message, Modal, Tag } from 'antd';
+import {
+ FooterToolbar,
+ PageContainer,
+ ProTable,
+ LightFilter,
+} from '@ant-design/pro-components';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
+import Http from '@/utils/http';
+import Edit from './components/edit'
+import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
+import { statusMap } from '@/utils/enum-util'
+import { repairBug } from '@/utils/common-util';
+
+const TABLE_KEY = 'pro-table-motionCtg';
+
+const handleSave = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '姝e湪娣诲姞' }));
+ try {
+ const resp = await Http.doPost('api/motionCtg/save', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.add.success', defaultMessage: '娣诲姞鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.add.fail', defaultMessage: '娣诲姞澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleUpdate = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '姝e湪鏇存柊' }));
+ try {
+ const resp = await Http.doPost('api/motionCtg/update', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '鏇存柊鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '鏇存柊澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleRemove = async (rows, intl) => {
+ if (!rows) return true;
+ const hide = message.loading(intl.formatMessage({ id: 'page.deleting', defaultMessage: '姝e湪鍒犻櫎' }));
+ try {
+ const resp = await Http.doPost('api/motionCtg/remove/' + rows.map((row) => row.id).join(','));
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.delete.success', defaultMessage: '鍒犻櫎鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.delete.fail', defaultMessage: '鍒犻櫎澶辫触锛岃閲嶈瘯锛�' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleExport = async (intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '姝e湪瀵煎嚭' }));
+ try {
+ const resp = await Http.doPostBlob('api/motionCtg/export');
+ const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
+ window.location.href = window.URL.createObjectURL(blob);
+ message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '瀵煎嚭鎴愬姛' }));
+ return true;
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '瀵煎嚭澶辫触锛岃閲嶈瘯' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+
+const Main = () => {
+ const intl = useIntl();
+ const formTableRef = useRef();
+ const actionRef = useRef();
+ const [selectedRows, setSelectedRows] = useState([]);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [currentRow, setCurrentRow] = useState();
+ const [searchParam, setSearchParam] = useState({});
+
+ useEffect(() => {
+
+ }, []);
+
+ const columns = [
+ {
+ title: intl.formatMessage({
+ id: 'page.table.no',
+ defaultMessage: 'No'
+ }),
+ dataIndex: 'index',
+ valueType: 'indexBorder',
+ width: 48,
+ },
+ {
+ title: '璁惧绫诲瀷',
+ dataIndex: 'deviceCtg$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='deviceCtg'
+ major='deviceCtg'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '缂栧彿',
+ dataIndex: 'uuid',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='uuid'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鍚嶇О',
+ dataIndex: 'name',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ copyable: true,
+ filterDropdown: (props) => <TextFilter
+ name='name'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鏍囪瘑',
+ dataIndex: 'flag',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='flag'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鐘舵��',
+ dataIndex: 'status$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <SelectFilter
+ name='status'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ data={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />,
+ },
+ {
+ title: '娣诲姞浜哄憳',
+ dataIndex: 'createBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='createBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '娣诲姞鏃堕棿',
+ dataIndex: 'createTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='createTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼浜哄憳',
+ dataIndex: 'updateBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='updateBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼鏃堕棿',
+ dataIndex: 'updateTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='updateTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '澶囨敞',
+ dataIndex: 'memo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='memo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+
+ {
+ title: '鎿嶄綔',
+ dataIndex: 'option',
+ width: 140,
+ valueType: 'option',
+ render: (_, record) => [
+ <Button
+ type="link"
+ key="edit"
+ onClick={() => {
+ setModalVisible(true);
+ setCurrentRow(record);
+ }}
+ >
+ <FormattedMessage id='page.edit' defaultMessage='缂栬緫' />
+ </Button>,
+ <Button
+ type="link"
+ danger
+ key="batchRemove"
+ onClick={async () => {
+ Modal.confirm({
+ title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+ content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+ onOk: async () => {
+ const success = await handleRemove([record], intl);
+ if (success) {
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ },
+ });
+ }}
+ >
+ <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
+ </Button>,
+ ],
+ },
+ ];
+
+ return (
+ <PageContainer
+ header={{
+ breadcrumb: {},
+ }}
+ >
+ <div style={{ width: '100%', float: 'right' }}>
+ <ProTable
+ key="motionCtg"
+ rowKey="id"
+ actionRef={actionRef}
+ formRef={formTableRef}
+ columns={columns}
+ cardBordered
+ scroll={{ x: 1300 }}
+ dateFormatter="string"
+ pagination={{ pageSize: 16 }}
+ search={false}
+ toolbar={{
+ search: {
+ onSearch: (value) => {
+ setSearchParam(prevState => ({
+ ...prevState,
+ condition: value
+ }));
+ actionRef.current?.reload();
+ },
+ },
+ filter: (
+ <LightFilter
+ onValuesChange={(val) => {
+ }}
+ >
+ </LightFilter>
+ ),
+ actions: [
+ <Button
+ type="primary"
+ key="save"
+ onClick={async () => {
+ setModalVisible(true)
+ }}
+ >
+ <PlusOutlined />
+ <FormattedMessage id='page.add' defaultMessage='娣诲姞' />
+ </Button>,
+ <Button
+ key="export"
+ onClick={async () => {
+ handleExport(intl);
+ }}
+ >
+ <ExportOutlined />
+ <FormattedMessage id='page.export' defaultMessage='瀵煎嚭' />
+ </Button>,
+ ],
+ }}
+ request={(params, sorter, filter) =>
+ Http.doPostPromise('/api/motionCtg/page', { ...params, ...searchParam }, (res) => {
+ return {
+ data: res.data.records,
+ total: res.data.total,
+ success: true,
+ }
+ })
+ }
+ rowSelection={{
+ onChange: (ids, rows) => {
+ setSelectedRows(rows);
+ }
+ }}
+ columnsState={{
+ persistenceKey: TABLE_KEY,
+ persistenceType: 'localStorage',
+ defaultValue: {
+ // memo: { show: repairBug(TABLE_KEY, 'memo', false) },
+ option: { fixed: 'right', disable: true },
+ },
+ onChange(value) {
+ },
+ }}
+ />
+ </div>
+
+ {selectedRows?.length > 0 && (
+ <FooterToolbar
+ extra={
+ <div>
+ <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
+ <FormattedMessage id='page.selected' defaultMessage=' 椤瑰凡閫夋嫨' />
+ </div>
+ }
+ >
+ <Button
+ key="remove"
+ danger
+ onClick={async () => {
+ Modal.confirm({
+ title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+ content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+ onOk: async () => {
+ const success = await handleRemove(selectedRows, intl);
+ if (success) {
+ setSelectedRows([]);
+ actionRef.current?.reloadAndRest?.();
+ }
+ },
+ });
+ }}
+ >
+ <FormattedMessage id='page.delete.batch' defaultMessage='鎵归噺鍒犻櫎' />
+ </Button>
+ </FooterToolbar>
+ )}
+
+ <Edit
+ open={modalVisible}
+ values={currentRow || {}}
+ onCancel={
+ () => {
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ }
+ }
+ onSubmit={async (values) => {
+ let ok = false;
+ if (values.id) {
+ ok = await handleUpdate({ ...values }, intl)
+ } else {
+ ok = await handleSave({ ...values }, intl)
+ }
+ if (ok) {
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ }}
+ />
+ </PageContainer>
+ );
+};
+
+export default Main;
diff --git a/zy-asrs-flow/src/pages/rcs/motionSts/components/edit.jsx b/zy-asrs-flow/src/pages/rcs/motionSts/components/edit.jsx
new file mode 100644
index 0000000..8dfc2ae
--- /dev/null
+++ b/zy-asrs-flow/src/pages/rcs/motionSts/components/edit.jsx
@@ -0,0 +1,148 @@
+import React, { useState, useRef, useEffect } from 'react';
+import {
+ ProForm,
+ ProFormDigit,
+ ProFormText,
+ ProFormSelect,
+ ProFormDateTimePicker
+} 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>
+ <ProFormText
+ name="uuid"
+ label="缂栧彿"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormText
+ name="name"
+ label="鍚嶇О"
+ colProps={{ md: 12, xl: 12 }}
+ rules={[{ required: true }]}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="flag"
+ label="鏍囪瘑"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ <ProFormSelect
+ name="status"
+ label="鐘舵��"
+ colProps={{ md: 12, xl: 12 }}
+ options={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="createBy"
+ label="娣诲姞浜哄憳"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ showSearch
+ debounceTime={300}
+ request={async ({ keyWords }) => {
+ const resp = await Http.doPostForm('api/user/query', { condition: keyWords });
+ return resp.data;
+ }}
+ />
+ <ProFormDateTimePicker
+ name="createTime"
+ label="娣诲姞鏃堕棿"
+ colProps={{ md: 12, xl: 12 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormSelect
+ name="updateBy"
+ label="淇敼浜哄憳"
+ colProps={{ md: 12, xl: 12 }}
+ fieldProps={{ precision: 0 }}
+ 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 }}
+ transform={(value) => moment(value).toISOString()}
+ />
+ </ProForm.Group>
+ <ProForm.Group>
+ <ProFormText
+ name="memo"
+ label="澶囨敞"
+ colProps={{ md: 12, xl: 12 }}
+ />
+ </ProForm.Group>
+
+ </ProForm>
+ </Modal>
+ </>
+ )
+}
+
+export default Edit;
diff --git a/zy-asrs-flow/src/pages/rcs/motionSts/index.jsx b/zy-asrs-flow/src/pages/rcs/motionSts/index.jsx
new file mode 100644
index 0000000..ff83e28
--- /dev/null
+++ b/zy-asrs-flow/src/pages/rcs/motionSts/index.jsx
@@ -0,0 +1,428 @@
+
+import React, { useState, useRef, useEffect } from 'react';
+import { Button, message, Modal, Tag } from 'antd';
+import {
+ FooterToolbar,
+ PageContainer,
+ ProTable,
+ LightFilter,
+} from '@ant-design/pro-components';
+import { FormattedMessage, useIntl } from '@umijs/max';
+import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
+import Http from '@/utils/http';
+import Edit from './components/edit'
+import { TextFilter, SelectFilter, DatetimeRangeFilter, LinkFilter } from '@/components/TableSearch'
+import { statusMap } from '@/utils/enum-util'
+import { repairBug } from '@/utils/common-util';
+
+const TABLE_KEY = 'pro-table-motionSts';
+
+const handleSave = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.adding', defaultMessage: '姝e湪娣诲姞' }));
+ try {
+ const resp = await Http.doPost('api/motionSts/save', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.add.success', defaultMessage: '娣诲姞鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.add.fail', defaultMessage: '娣诲姞澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleUpdate = async (val, intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.updating', defaultMessage: '姝e湪鏇存柊' }));
+ try {
+ const resp = await Http.doPost('api/motionSts/update', val);
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '鏇存柊鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.update.fail', defaultMessage: '鏇存柊澶辫触璇烽噸璇曪紒' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleRemove = async (rows, intl) => {
+ if (!rows) return true;
+ const hide = message.loading(intl.formatMessage({ id: 'page.deleting', defaultMessage: '姝e湪鍒犻櫎' }));
+ try {
+ const resp = await Http.doPost('api/motionSts/remove/' + rows.map((row) => row.id).join(','));
+ if (resp.code === 200) {
+ message.success(intl.formatMessage({ id: 'page.delete.success', defaultMessage: '鍒犻櫎鎴愬姛' }));
+ return true;
+ } else {
+ message.error(resp.msg);
+ return false;
+ }
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.delete.fail', defaultMessage: '鍒犻櫎澶辫触锛岃閲嶈瘯锛�' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+const handleExport = async (intl) => {
+ const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '姝e湪瀵煎嚭' }));
+ try {
+ const resp = await Http.doPostBlob('api/motionSts/export');
+ const blob = new Blob([resp], { type: 'application/vnd.ms-excel' });
+ window.location.href = window.URL.createObjectURL(blob);
+ message.success(intl.formatMessage({ id: 'page.export.success', defaultMessage: '瀵煎嚭鎴愬姛' }));
+ return true;
+ } catch (error) {
+ message.error(intl.formatMessage({ id: 'page.export.fail', defaultMessage: '瀵煎嚭澶辫触锛岃閲嶈瘯' }));
+ return false;
+ } finally {
+ hide();
+ }
+};
+
+
+const Main = () => {
+ const intl = useIntl();
+ const formTableRef = useRef();
+ const actionRef = useRef();
+ const [selectedRows, setSelectedRows] = useState([]);
+ const [modalVisible, setModalVisible] = useState(false);
+ const [currentRow, setCurrentRow] = useState();
+ const [searchParam, setSearchParam] = useState({});
+
+ useEffect(() => {
+
+ }, []);
+
+ const columns = [
+ {
+ title: intl.formatMessage({
+ id: 'page.table.no',
+ defaultMessage: 'No'
+ }),
+ dataIndex: 'index',
+ valueType: 'indexBorder',
+ width: 48,
+ },
+ {
+ title: '缂栧彿',
+ dataIndex: 'uuid',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='uuid'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鍚嶇О',
+ dataIndex: 'name',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ copyable: true,
+ filterDropdown: (props) => <TextFilter
+ name='name'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鏍囪瘑',
+ dataIndex: 'flag',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='flag'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '鐘舵��',
+ dataIndex: 'status$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <SelectFilter
+ name='status'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ data={[
+ { label: '姝e父', value: 1 },
+ { label: '绂佺敤', value: 0 },
+ ]}
+ />,
+ },
+ {
+ title: '娣诲姞浜哄憳',
+ dataIndex: 'createBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='createBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '娣诲姞鏃堕棿',
+ dataIndex: 'createTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='createTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼浜哄憳',
+ dataIndex: 'updateBy$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <LinkFilter
+ name='updateBy'
+ major='user'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '淇敼鏃堕棿',
+ dataIndex: 'updateTime$',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <DatetimeRangeFilter
+ name='updateTime'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+ {
+ title: '澶囨敞',
+ dataIndex: 'memo',
+ valueType: 'text',
+ hidden: false,
+ width: 140,
+ filterDropdown: (props) => <TextFilter
+ name='memo'
+ {...props}
+ actionRef={actionRef}
+ setSearchParam={setSearchParam}
+ />,
+ },
+
+ {
+ title: '鎿嶄綔',
+ dataIndex: 'option',
+ width: 140,
+ valueType: 'option',
+ render: (_, record) => [
+ <Button
+ type="link"
+ key="edit"
+ onClick={() => {
+ setModalVisible(true);
+ setCurrentRow(record);
+ }}
+ >
+ <FormattedMessage id='page.edit' defaultMessage='缂栬緫' />
+ </Button>,
+ <Button
+ type="link"
+ danger
+ key="batchRemove"
+ onClick={async () => {
+ Modal.confirm({
+ title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+ content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+ onOk: async () => {
+ const success = await handleRemove([record], intl);
+ if (success) {
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ },
+ });
+ }}
+ >
+ <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
+ </Button>,
+ ],
+ },
+ ];
+
+ return (
+ <PageContainer
+ header={{
+ breadcrumb: {},
+ }}
+ >
+ <div style={{ width: '100%', float: 'right' }}>
+ <ProTable
+ key="motionSts"
+ rowKey="id"
+ actionRef={actionRef}
+ formRef={formTableRef}
+ columns={columns}
+ cardBordered
+ scroll={{ x: 1300 }}
+ dateFormatter="string"
+ pagination={{ pageSize: 16 }}
+ search={false}
+ toolbar={{
+ search: {
+ onSearch: (value) => {
+ setSearchParam(prevState => ({
+ ...prevState,
+ condition: value
+ }));
+ actionRef.current?.reload();
+ },
+ },
+ filter: (
+ <LightFilter
+ onValuesChange={(val) => {
+ }}
+ >
+ </LightFilter>
+ ),
+ actions: [
+ <Button
+ type="primary"
+ key="save"
+ onClick={async () => {
+ setModalVisible(true)
+ }}
+ >
+ <PlusOutlined />
+ <FormattedMessage id='page.add' defaultMessage='娣诲姞' />
+ </Button>,
+ <Button
+ key="export"
+ onClick={async () => {
+ handleExport(intl);
+ }}
+ >
+ <ExportOutlined />
+ <FormattedMessage id='page.export' defaultMessage='瀵煎嚭' />
+ </Button>,
+ ],
+ }}
+ request={(params, sorter, filter) =>
+ Http.doPostPromise('/api/motionSts/page', { ...params, ...searchParam }, (res) => {
+ return {
+ data: res.data.records,
+ total: res.data.total,
+ success: true,
+ }
+ })
+ }
+ rowSelection={{
+ onChange: (ids, rows) => {
+ setSelectedRows(rows);
+ }
+ }}
+ columnsState={{
+ persistenceKey: TABLE_KEY,
+ persistenceType: 'localStorage',
+ defaultValue: {
+ // memo: { show: repairBug(TABLE_KEY, 'memo', false) },
+ option: { fixed: 'right', disable: true },
+ },
+ onChange(value) {
+ },
+ }}
+ />
+ </div>
+
+ {selectedRows?.length > 0 && (
+ <FooterToolbar
+ extra={
+ <div>
+ <a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
+ <FormattedMessage id='page.selected' defaultMessage=' 椤瑰凡閫夋嫨' />
+ </div>
+ }
+ >
+ <Button
+ key="remove"
+ danger
+ onClick={async () => {
+ Modal.confirm({
+ title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
+ content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+ onOk: async () => {
+ const success = await handleRemove(selectedRows, intl);
+ if (success) {
+ setSelectedRows([]);
+ actionRef.current?.reloadAndRest?.();
+ }
+ },
+ });
+ }}
+ >
+ <FormattedMessage id='page.delete.batch' defaultMessage='鎵归噺鍒犻櫎' />
+ </Button>
+ </FooterToolbar>
+ )}
+
+ <Edit
+ open={modalVisible}
+ values={currentRow || {}}
+ onCancel={
+ () => {
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ }
+ }
+ onSubmit={async (values) => {
+ let ok = false;
+ if (values.id) {
+ ok = await handleUpdate({ ...values }, intl)
+ } else {
+ ok = await handleSave({ ...values }, intl)
+ }
+ if (ok) {
+ setModalVisible(false);
+ setCurrentRow(undefined);
+ if (actionRef.current) {
+ actionRef.current.reload();
+ }
+ }
+ }}
+ />
+ </PageContainer>
+ );
+};
+
+export default Main;
--
Gitblit v1.9.1