|
@@ -21,6 +21,7 @@ import {
|
|
|
YES_OR_NO,
|
|
|
} from "@/types";
|
|
|
import {
|
|
|
+ checkAssIsPointApi,
|
|
|
getAssIndexDetailApi,
|
|
|
getAssIndexTreeApi,
|
|
|
saveAssIndexApi,
|
|
@@ -62,7 +63,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
const inspectionRef = useRef<InspectionEditableMethods | null>(null);
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
const [values, setValues] = useState<any>({
|
|
|
- isPoint: YES_OR_NO.YES,
|
|
|
+ isPoint: YES_OR_NO.NO,
|
|
|
isWarn: YES_OR_NO.YES,
|
|
|
});
|
|
|
const [treeData, setTreeData] = useState<AssIndexTreeItemType[]>([]);
|
|
@@ -71,6 +72,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
[location]
|
|
|
);
|
|
|
const [detail, setDetail] = useState<null | IAssIndexDetail>(null);
|
|
|
+ const [disablePointBtn, setDisablePointBtn] = useState(false);
|
|
|
const isFixed = params.type === ASS_INDEX_TYPE.FIXED;
|
|
|
const parentId = Form.useWatch("parentId", form);
|
|
|
/** 考察要点 */
|
|
@@ -163,6 +165,9 @@ const CreateOrEditIndex: FC = () => {
|
|
|
if (temp.level < 2) {
|
|
|
temp.children = filterTreeData(children);
|
|
|
}
|
|
|
+ if (temp.isPoint === YES_OR_NO.YES) {
|
|
|
+ temp.disabled = true;
|
|
|
+ }
|
|
|
|
|
|
return temp;
|
|
|
});
|
|
@@ -177,6 +182,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
try {
|
|
|
setLoading(true);
|
|
|
const data = await getAssIndexDetailApi(Number(params.id));
|
|
|
+ const hasChildren = await checkAssIsPointApi(params.id!);
|
|
|
const pointData =
|
|
|
data.isPoint === YES_OR_NO.YES && data.jsonPoint
|
|
|
? JSON.parse(data.jsonPoint)
|
|
@@ -186,6 +192,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
? JSON.parse(data.jsonWarn)
|
|
|
: null;
|
|
|
setDetail(data);
|
|
|
+ hasChildren && setDisablePointBtn(true);
|
|
|
form.setFieldsValue({
|
|
|
parentId: data.parentId,
|
|
|
name: data.name,
|
|
@@ -339,6 +346,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
initialValue={values.isPoint}
|
|
|
>
|
|
|
<Radio.Group
|
|
|
+ disabled={disablePointBtn}
|
|
|
options={CONFIRM_OPTIONS}
|
|
|
optionType="button"
|
|
|
buttonStyle="solid"
|
|
@@ -357,6 +365,8 @@ const CreateOrEditIndex: FC = () => {
|
|
|
>
|
|
|
<InputNumber
|
|
|
precision={0}
|
|
|
+ min={0}
|
|
|
+ maxLength={4}
|
|
|
placeholder="请输入正整数"
|
|
|
className="w160"
|
|
|
/>
|
|
@@ -437,6 +447,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
>
|
|
|
<InputNumber
|
|
|
precision={0}
|
|
|
+ min={0}
|
|
|
placeholder="请输入正整数"
|
|
|
className="w100"
|
|
|
/>
|
|
@@ -468,6 +479,7 @@ const CreateOrEditIndex: FC = () => {
|
|
|
<Form.Item noStyle name={["warnData", "num2"]}>
|
|
|
<InputNumber
|
|
|
precision={0}
|
|
|
+ min={0}
|
|
|
placeholder="请输入正整数"
|
|
|
className="w100"
|
|
|
/>
|