瀏覽代碼

feat: 抽屉按钮以及参与者卡片赋予对应校验状态

lanjianrong 3 年之前
父節點
當前提交
c615aa43ea
共有 2 個文件被更改,包括 21 次插入7 次删除
  1. 8 0
      src/global.less
  2. 13 7
      src/pages/Project/Verification/Detail/Flow/components/Drawer/index.tsx

+ 8 - 0
src/global.less

@@ -107,6 +107,14 @@ ol {
   }
 }
 
+.ant-btn-primary[disabled],
+.ant-btn-primary[disabled]:hover,
+.ant-btn-primary[disabled]:focus,
+.ant-btn-primary[disabled]:active {
+  color: rgba(255, 255, 255, 0.8) !important;
+  background: #a0cfff !important;
+  border-color: #98cbff !important;
+}
 .ant-select-tree .ant-select-tree-treenode-disabled .ant-select-tree-node-content-wrapper {
   color: rgba(0, 0, 0, 0.45) !important;
   cursor: not-allowed;

+ 13 - 7
src/pages/Project/Verification/Detail/Flow/components/Drawer/index.tsx

@@ -24,8 +24,6 @@ const FlowDrawer = () => {
 
   useEffect(() => {
     if (nodeID && visible) {
-      console.log(flowState.flowData.get(nodeID))
-
       const defaultConfig = flowState.flowData.get(nodeID) || {
         approvalWay: ApprovalWay.ACCOUNT,
         accounts: []
@@ -50,6 +48,7 @@ const FlowDrawer = () => {
     }
     return false
   }, [state.approvalWay, state.accounts])
+
   const handleCancel = () => dispatch({ type: Actions.CLOSE_MODAL })
 
   const plainOptions = [{ label: '指定用户', value: ApprovalWay.ACCOUNT }]
@@ -60,11 +59,9 @@ const FlowDrawer = () => {
       setState({ ...state, approvalWay: target.value })
     }
   }
+
   const handleOnOk = async () => {
     const { approvalWay, accounts } = state
-    // if (!state.accounts.length) {
-    //   return message.error('请添加用户后再进行操作')
-    // }
     if (!accounts.every(item => item.institutionID && item.ID)) {
       setState({
         ...state,
@@ -124,6 +121,10 @@ const FlowDrawer = () => {
   }
 
   const saveCardData = (targetID, formData) => {
+    const validityIDs =
+      formData.ID && formData.institutionID
+        ? state.validityIDs.filter(ID => ID !== targetID)
+        : state.validityIDs
     setState({
       ...state,
       accounts: state.accounts.map(item => {
@@ -132,7 +133,8 @@ const FlowDrawer = () => {
           return newItem
         }
         return item
-      })
+      }),
+      validityIDs
     })
   }
 
@@ -179,7 +181,11 @@ const FlowDrawer = () => {
       footer={
         <div className="flex justify-end">
           <Button onClick={handleCancel}>取消</Button>
-          <Button className="ml-8px" type="primary" onClick={handleOnOk}>
+          <Button
+            className="ml-8px"
+            type="primary"
+            disabled={!state.accounts.length}
+            onClick={handleOnOk}>
             确认
           </Button>
         </div>