From da6ffd9b8d9687f8fb876e194da597c02f25f588 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期二, 18 六月 2024 16:57:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack

---
 zy-asrs-flow/src/pages/task/task/index.jsx |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 101 insertions(+), 7 deletions(-)

diff --git a/zy-asrs-flow/src/pages/task/task/index.jsx b/zy-asrs-flow/src/pages/task/task/index.jsx
index 44c0a24..c98f635 100644
--- a/zy-asrs-flow/src/pages/task/task/index.jsx
+++ b/zy-asrs-flow/src/pages/task/task/index.jsx
@@ -75,6 +75,46 @@
     }
 };
 
+const handleComplete = async (rows, intl) => {
+    if (!rows) return true;
+    const hide = message.loading(intl.formatMessage({ id: 'page.completeing', defaultMessage: '姝e湪瀹屾垚' }));
+    try {
+        const resp = await Http.doPost('api/task/complete/' + rows.map((row) => row.id).join(','));
+        if (resp.code === 200) {
+            message.success(intl.formatMessage({ id: 'page.complete.success', defaultMessage: '瀹屾垚鎴愬姛' }));
+            return true;
+        } else {
+            message.error(resp.msg);
+            return false;
+        }
+    } catch (error) {
+        message.error(intl.formatMessage({ id: 'page.complete.fail', defaultMessage: '瀹屾垚澶辫触锛岃閲嶈瘯锛�' }));
+        return false;
+    } finally {
+        hide();
+    }
+};
+
+const handleCancel = async (rows, intl) => {
+    if (!rows) return true;
+    const hide = message.loading(intl.formatMessage({ id: 'page.canceling', defaultMessage: '姝e湪鍙栨秷' }));
+    try {
+        const resp = await Http.doPost('api/task/cancel/' + rows.map((row) => row.id).join(','));
+        if (resp.code === 200) {
+            message.success(intl.formatMessage({ id: 'page.cancel.success', defaultMessage: '鍙栨秷鎴愬姛' }));
+            return true;
+        } else {
+            message.error(resp.msg);
+            return false;
+        }
+    } catch (error) {
+        message.error(intl.formatMessage({ id: 'page.cancel.fail', defaultMessage: '鍙栨秷澶辫触锛岃閲嶈瘯锛�' }));
+        return false;
+    } finally {
+        hide();
+    }
+};
+
 const handleExport = async (intl) => {
     const hide = message.loading(intl.formatMessage({ id: 'page.exporting', defaultMessage: '姝e湪瀵煎嚭' }));
     try {
@@ -151,6 +191,20 @@
             copyable: true,
             filterDropdown: (props) => <TextFilter
                 name='taskNo'
+                {...props}
+                actionRef={actionRef}
+                setSearchParam={setSearchParam}
+            />,
+        },
+        {
+            title: 'WMS浠诲姟鍙�',
+            dataIndex: 'wmsTaskNo',
+            valueType: 'text',
+            hidden: false,
+            width: 140,
+            copyable: true,
+            filterDropdown: (props) => <TextFilter
+                name='wmsTaskNo'
                 {...props}
                 actionRef={actionRef}
                 setSearchParam={setSearchParam}
@@ -471,7 +525,7 @@
         {
             title: '鎿嶄綔',
             dataIndex: 'option',
-            width: 140,
+            width: 240,
             valueType: 'option',
             render: (_, record) => [
                 <Button
@@ -484,16 +538,36 @@
                 >
                     <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>,
                 <Button
                     type="link"
-                    danger
-                    key="batchRemove"
+                    key="complete"
                     onClick={async () => {
                         Modal.confirm({
-                            title: intl.formatMessage({ id: 'page.delete', defaultMessage: '鍒犻櫎' }),
-                            content: intl.formatMessage({ id: 'page.delete.confirm', defaultMessage: '纭畾鍒犻櫎璇ラ」鍚楋紵' }),
+                            title: intl.formatMessage({ id: 'page.complete', defaultMessage: '瀹屾垚' }),
+                            content: intl.formatMessage({ id: 'page.complete.confirm', defaultMessage: '纭畾瀹屾垚璇ラ」鍚楋紵' }),
                             onOk: async () => {
-                                const success = await handleRemove([record], intl);
+                                const success = await handleComplete([record], intl);
                                 if (success) {
                                     if (actionRef.current) {
                                         actionRef.current.reload();
@@ -503,8 +577,28 @@
                         });
                     }}
                 >
-                    <FormattedMessage id='page.delete' defaultMessage='鍒犻櫎' />
+                    <FormattedMessage id='page.complete' defaultMessage='瀹屾垚' />
                 </Button>,
+                <Button
+                type="link"
+                key="cancel"
+                onClick={async () => {
+                    Modal.confirm({
+                        title: intl.formatMessage({ id: 'page.cancel', defaultMessage: '鍙栨秷' }),
+                        content: intl.formatMessage({ id: 'page.cancel.confirm', defaultMessage: '纭畾鍙栨秷璇ラ」鍚楋紵' }),
+                        onOk: async () => {
+                            const success = await handleCancel([record], intl);
+                            if (success) {
+                                if (actionRef.current) {
+                                    actionRef.current.reload();
+                                }
+                            }
+                        },
+                    });
+                }}
+            >
+                <FormattedMessage id='page.cancel' defaultMessage='鍙栨秷' />
+            </Button>,
             ],
         },
     ];

--
Gitblit v1.9.1