Explorar o código

style: 微调样式,完善查询

ZhaoJun hai 1 ano
pai
achega
8047260d29
Modificáronse 1 ficheiros con 43 adicións e 10 borrados
  1. 43 10
      src/pages/Flow/index.js

+ 43 - 10
src/pages/Flow/index.js

@@ -11,14 +11,19 @@ import {
 
 function Audit(props) {
   const { list = [], classify = [], dispatch, loading } = props;
+
   let navigate = useNavigate();
+
   const [modal, contextHolder] = Modal.useModal();
+
   const [data, setData] = useState();
   const [visible, setVisible] = useState({
     audit: false,
     auditNode: false,
   });
+
   const detailRef = useRef();
+
   const columns = [
     {
       title: '审批流名称',
@@ -27,20 +32,24 @@ function Audit(props) {
     {
       title: '分类',
       dataIndex: 'classify_id',
-      render: (id) => classify?.find((item) => item.id == id)?.name || 'BOM',
+      render: (id) => classify?.find((item) => item.id === id)?.name || 'BOM',
     },
     {
       title: '操作',
       render: (item, index) => (
         <Space>
-          <a
+          <Button
+            size="small"
+            type="link"
             onClick={() => {
               setCurrentNode(item);
             }}
           >
             编辑
-          </a>
-          <a
+          </Button>
+          <Button
+            size="small"
+            type="link"
             onClick={() => {
               setData(item);
               changeVisible('audit', true);
@@ -48,12 +57,20 @@ function Audit(props) {
             }}
           >
             复制
-          </a>
-          <a onClick={() => handleDel(item)}>删除</a>
+          </Button>
+          <Button
+            size="small"
+            type="link"
+            danger
+            onClick={() => handleDel(item)}
+          >
+            删除
+          </Button>
         </Space>
       ),
     },
   ];
+
   const queryDetail = async (item) => {
     const res = await queryProcessFlows({ ids: Number(item.id) });
     if (res?.data) {
@@ -62,7 +79,7 @@ function Audit(props) {
   };
 
   const handleDel = (item) => {
-    console.log(item);
+    console.log(item.id);
     modal.confirm({
       title: '提示',
       content: `确定删除改审批流【${item.name}】删除后不能复原!`,
@@ -70,12 +87,12 @@ function Audit(props) {
         //删除审批流
         await queryFlowDelete(item.id)
           .then((data) => {
-            if (data?.code == 200) {
+            if (data?.code === 200) {
               message.success('删除成功');
               dispatch({
                 type: 'flow/queryAuditList',
                 payload: {
-                  flow_type: 1,
+                  flow_type: 'all',
                 },
               });
             }
@@ -106,6 +123,7 @@ function Audit(props) {
       },
     });
   };
+
   const handleAuditOk = (values) => {
     dispatch({
       type: 'flow/addAudit',
@@ -115,16 +133,24 @@ function Audit(props) {
       },
       callback: () => {
         message.success('新增成功');
+        dispatch({
+          type: 'flow/queryAuditList',
+          payload: {
+            flow_type: 'all',
+          },
+        });
         changeVisible('audit', false);
       },
     });
   };
+
   const changeVisible = (type, visible) => {
     setVisible({
       ...visible,
       [type]: visible,
     });
   };
+
   const setCurrentNode = (item) => {
     localStorage.setItem('currentAudit', JSON.stringify(item));
     dispatch({
@@ -164,11 +190,18 @@ function Audit(props) {
         新建流程
       </Button>
       <Table
-        style={{ marginTop: 20 }}
+        style={{ marginTop: 15, maxHeight: 'calc(100% - 120px)' }}
         loading={loading['flow/queryAuditList']}
         rowKey="id"
         dataSource={list}
         columns={columns}
+        pagination={{
+          position: ['bottomRight'],
+          total: list.length,
+          pageSize: 9,
+          responsive: true,
+          showSizeChanger: false,
+        }}
       />
 
       <AuditModal