Explorar o código

fix: 巡检无法开始审批、编辑合同保存状态等问题

lanjianrong %!s(int64=4) %!d(string=hai) anos
pai
achega
baf8b190ae

+ 2 - 2
src/components/AuditContent/index.tsx

@@ -62,7 +62,7 @@ interface iAuditContentProps {
   }
 }
 
-const Index: React.FC<iAuditContentProps> = props => {
+const AuditContent: React.FC<iAuditContentProps> = props => {
   const { onSelect, onDelete, data: { auditors, status, auditHistory, uid } } = props
   const [ visible, setVisible ] = useState({
     check: false,
@@ -506,4 +506,4 @@ const Index: React.FC<iAuditContentProps> = props => {
   )
 }
 
-export default observer(Index)
+export default observer(AuditContent)

+ 2 - 3
src/components/MoneyInput/index.tsx

@@ -1,6 +1,5 @@
-import { formatMoney } from '@/utils/util'
-import { Form, Input } from 'antd'
-import { InputProps } from 'antd/lib/input'
+import { Form } from 'antd'
+import Input, { InputProps } from 'antd/lib/input'
 import React, { ChangeEvent, useState } from 'react'
 import './index.scss'
 

+ 12 - 9
src/pages/Contract/Content/Income/components/Modal/index.tsx

@@ -90,7 +90,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
 
   useEffect(() => {
     if (visible) {
-      form.setFieldsValue({ treeId: row.id, bidsectionId: row.bidsectionId })
+      form.setFieldsValue({ treeId: row.id, bidsectionId: tenderStore.bid })
 
       if (type === 'create') {
         initTreeSection()
@@ -127,18 +127,16 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
     return maxPrice
   }
 
-  // 当row id或者type变化时,重置表单数据
-  useEffect(() => {
-    form.resetFields()
-  }, [ type, row.id ])
-
 
   return (
     <Modal
       getContainer={false}
       visible={visible}
       title={modalObj[type]?.title}
-      onCancel={onCancel}
+      onCancel={() => {
+        form.resetFields()
+        onCancel()
+      }}
       footer={
         <div className="pi-justify-end">
           {type === 'update' ? (
@@ -148,7 +146,10 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
               </Button>
             </Authorization>
           ) : null}
-          <Button type="default" size="small" key="cancel" className="pi-btn-secondary" onClick={onCancel}>
+          <Button type="default" size="small" key="cancel" className="pi-btn-secondary" onClick={() => {
+            form.resetFields()
+            onCancel()
+          }}>
             {modalObj[type]?.cancelText}
           </Button>
           <Button
@@ -161,6 +162,8 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
               form
                 .validateFields()
                 .then(values => {
+                  console.log(values)
+
                   form.resetFields()
                   if (type === 'update') {
                     values.signerTime = dayjsFormat(values.signerTime, 'YYYY-MM-DD HH:mm:ss')
@@ -185,7 +188,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
         <Form.Item name="bidsectionId" hidden>
           <Input />
         </Form.Item>
-        <Form.Item name="treeId" label="合同劳务" hidden={type === 'create' ? false : true}>
+        <Form.Item name="treeId" label="合同劳务" hidden={type === 'create' ? false : true} rules={[ { required: true, message: '请选择项目节' } ]}>
           <TreeSelect treeData={contractSection} />
         </Form.Item>
         {/* <Form.Item name="treeId" label="合同劳务" hidden>

+ 3 - 3
src/pages/Login/index.tsx

@@ -58,19 +58,19 @@ class NormalLoginForm extends Component<iLoginProps, iState> {
         <h5 className={[ 'project-title' ].join(' ')} >{projectInfo}</h5>
         <Form.Item
           name="code"
-          rules={[ { required: true, message: 'Please input your Project!' } ]}
+          rules={[ { required: true, message: '请输入项目编号!' } ]}
         >
           <Input placeholder="项目编号" onChange={this.handleProjectCode} autoFocus/>
         </Form.Item>
         <Form.Item
           name="account"
-          rules={[ { required: true, message: 'Please input your Account!' } ]}
+          rules={[ { required: true, message: '请输入账号!' } ]}
         >
           <Input placeholder="登录账号" />
         </Form.Item>
         <Form.Item
           name="password"
-          rules={[ { required: true, message: 'Please input your Password!' } ]}
+          rules={[ { required: true, message: '请输入密码!' } ]}
         >
           <Input.Password type="password" placeholder="密码" />
         </Form.Item>

+ 1 - 1
src/pages/Management/Tender/Member/index.tsx

@@ -184,7 +184,7 @@ const Member: React.FC<RouteComponentProps> = props => {
     }
   ]
   const initGroupList = async (serach?: string) => {
-    const data = await getUserGroup({ name: serach, hasOwner: false, bidsectionId: tenderStore.bid })
+    const data = await getUserGroup({ name: serach, hasOwner: false })
     setState({ ...state, groups: data })
   }
 

+ 7 - 1
src/pages/Safe/Content/Info/Detail/index.tsx

@@ -120,6 +120,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
   }
 
   const addAuditor = (type: string, user: iUserInfo) => {
+
     if (detail.auditors.find(item => item.progress === (type === 'check' ? '0' : '2') && item.auditId === user.id)) {
       return message.error('该审批组下已存在该审批人,请勿重复添加!')
     }
@@ -144,7 +145,7 @@ const Detail: React.FC<RouteComponentProps> = props => {
       const len = detail.auditors.filter((item: iAuditor) => item.progress === '2').length
       newAuditors.push({
         id: '',
-        auditId: user.id,
+        audit_id: user.id,
         mobile: '',
         auditOrder: len + 1,
         position: user.position,
@@ -169,6 +170,11 @@ const Detail: React.FC<RouteComponentProps> = props => {
   }
 
   const btnClick = (type: string) => {
+    if (type === 'start') {
+      if (!detail.inspectionDetail || !detail.demand) {
+        return message.error('现场检查情况或处理要求措施不能为空')
+      }
+    }
     setModalObj({ ...modalObj, auditType: type, auditModal: true })
   }
   const onModalConfirm = (values?: object) => {

+ 11 - 2
src/utils/common/api.ts

@@ -45,11 +45,20 @@ export async function apiGetGroupList() {
 }
 
 /** 获取账号列表(检索标段下的成员账号) */
-export async function apiGetAccountWithSearch(bidsectionId: string, name?: string) {
-  const { data } = await request.get("/api/projectSetting/bid/account", { bidsectionId, name })
+export async function apiGetAccountWithSearch(bidsectionId?: string, name?: string) {
+  const url = bidsectionId ? '/api/projectSetting/bid/account' : '/api/projectAccount/search'
+  const payload: any = {}
+  if (bidsectionId) {
+    payload.bidsectionId = bidsectionId
+  }
+  if (name) {
+    payload.name = name
+  }
+  const { data } = await request.get(url, payload)
   return data
 }
 
+
 /** 获取权限列表 */
 export async function apiGetPermissionWithBid(bidsectionId: string) {
   const { data } = await request.get('', { bidsectionId })

+ 2 - 2
src/utils/common/user.ts

@@ -44,11 +44,11 @@ export const getUserGroupName = (key: number): iGroup | undefined =>{
 
 interface UserGroupQuery {
   name?: string
-  bidsectionId: string
+  bidsectionId?: string
   hasOwner?: boolean
 }
 // 根据group对用户列表进行分组
-export const getUserGroup = async ({ name = '', bidsectionId = '', hasOwner = true } : UserGroupQuery) => {
+export const getUserGroup = async ({ name, bidsectionId, hasOwner = true } : UserGroupQuery) => {
   const { code = -1, data = [] } = await apiGetAccountWithSearch(bidsectionId, name)
   const accountGroup: iAccountGroupItem[] = []
   if (code === consts.RET_CODE.SUCCESS) {