diff --git a/src/mobile/components/SelectInput.jsx b/src/mobile/components/SelectInput.jsx index 11e2c0f..fc9624a 100644 --- a/src/mobile/components/SelectInput.jsx +++ b/src/mobile/components/SelectInput.jsx @@ -1,5 +1,5 @@ import React, { useState, useRef, useEffect, useCallback } from "react"; -import { Input, Popup, Button, Toast, PickerView, SearchBar } from "antd-mobile"; +import { Input, Popup, Button, Toast, PickerView, SearchBar,Checkbox } from "antd-mobile"; import { DownOutline } from "antd-mobile-icons"; import commonConfig from "@/utils/config"; import * as commonServices from "@/services/services"; @@ -18,8 +18,11 @@ const SelectInput = props => { const { masterData } = props.state; const [bCanInput, setBCanInput] = useState(props.bCanInput); const { bReadonly } = itemDetail || {}; + const [propsType, setPropsType] = useState(""); useEffect(() => { if (!itemDetail) return; + const type = itemDetail.sName.charAt(0); + setPropsType(type); const viewRowNew = itemDetail.sName ? viewRow?.[itemDetail.sName] : ""; if (itemDetail.sDropDownType === "const") { return; @@ -109,7 +112,7 @@ const SelectInput = props => { setCopyColumns(list); // getSqlDropDownData(searchValue); } else if ((sDropDownType = "const")) { - if (!itemDetail.showDropDown) return + if (!itemDetail.showDropDown) return; const list = Object.entries(JSON.parse(itemDetail.showDropDown)).map(([key, value]) => ({ label: value, value: key, @@ -121,7 +124,7 @@ const SelectInput = props => { if (sDropDownType === "sql") { getSqlDropDownData(searchValue); } else if ((sDropDownType = "const")) { - if (!itemDetail.showDropDown) return + if (!itemDetail.showDropDown) return; const list = Object.entries(JSON.parse(itemDetail.showDropDown)).map(([key, value]) => ({ label: value, value: key, @@ -144,20 +147,27 @@ const SelectInput = props => { return (
- { - setValue(val); - props.onDataChange(tableName, itemDetail.sName, { [itemDetail.sName]: val }, null, coplyColumns); - }} - readOnly={bReadonly} - /> - {!bCanInput ? ( -
- + {propsType === "b" ? ( + + ) : ( +
+ {" "} + { + setValue(val); + props.onDataChange(tableName, itemDetail.sName, { [itemDetail.sName]: val }, null, coplyColumns); + }} + readOnly={bReadonly} + /> + {!bCanInput ? ( +
+ +
+ ) : null}
- ) : null} + )}
setVisible(false)} onClose={() => setVisible(false)} bodyStyle={{ height: "50vh" }}>
diff --git a/src/mobile/quotation/detailNew.jsx b/src/mobile/quotation/detailNew.jsx index 062d723..4e70e34 100644 --- a/src/mobile/quotation/detailNew.jsx +++ b/src/mobile/quotation/detailNew.jsx @@ -1,6 +1,6 @@ import { useRef, useEffect, useState, useCallback, useMemo } from "react"; import { history } from "umi"; -import { Toast, Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog, Radio, Space } from "antd-mobile"; +import { Toast, Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog, Radio, Space, CenterPopup } from "antd-mobile"; import { AddOutline, MinusOutline, EditFill, CloseOutline } from "antd-mobile-icons"; import commonConfig from "@/utils/config"; import * as commonServices from "@/services/services"; @@ -1171,11 +1171,11 @@ const MasterComponent = props => { const QuotationTabs = props => { const { state } = props; const { selectedNode } = state; - const sAllPartsName = selectedNode?.sAllPartsName; - const sAllPartsNameList = sAllPartsName?.split(","); - // sAllPartsNameList.push('+') - const [activeKey, setActiveKey] = useState(sAllPartsNameList && sAllPartsNameList.length ? sAllPartsNameList[0] : null); - + const [sAllPartsNameList, setSAllPartsNameList] = useState(selectedNode?.sAllPartsName?.split(",") || []); + const [activeKey, setActiveKey] = useState(sAllPartsNameList.length ? sAllPartsNameList[0] : null); + const [visible, setVisible] = useState(false); + const [value, setValue] = useState(""); + const partsList = selectedNode?.sAllPartsName?.split(","); useEffect(() => { // 更新父组件的状态 props.setState(pre => ({ ...pre, boxModel: activeKey })); @@ -1185,6 +1185,15 @@ const QuotationTabs = props => { ...props, boxModel: activeKey, }; + + // 处理添加新标签的逻辑 + const handleAdd = () => { + // 弹窗 + setVisible(true); + // const newSAllPartsNameList = [...sAllPartsNameList, '111']; // 创建一个新的数组,包含新增的元素 + // setSAllPartsNameList(newSAllPartsNameList); // 更新状态,触发组件重新渲染 + }; + return (
@@ -1194,25 +1203,91 @@ const QuotationTabs = props => { setActiveKey(key); }} > - {sAllPartsNameList && sAllPartsNameList.length + {sAllPartsNameList.length ? sAllPartsNameList.map((pane, index) => ( - - - {/* */} - + <> + +
{pane}
+ {partsList.includes(pane) ? ( + "" + ) : ( + { + const newTabs = sAllPartsNameList.filter(panes => panes !== pane); + setSAllPartsNameList(newTabs); + // 如果删除的是当前活动的 Tab,选择新的活动 Tab + setActiveKey(0); + }} + /> + )} +
+ } + > + + + )) : ""} - {/* */} + + { + // setVisible(false); + // }} + > +
+
请输入新标签名称:
+ { + setValue(val); + }} + /> +
+ + +
+
+
); diff --git a/src/mobile/quotation/quotationDetail.css b/src/mobile/quotation/quotationDetail.css index 6cf6a23..85ba57a 100644 --- a/src/mobile/quotation/quotationDetail.css +++ b/src/mobile/quotation/quotationDetail.css @@ -140,3 +140,22 @@ right: 0; top: 0; } +.tabsBox .tabTitle { + display: flex; + align-items: center; + position: relative; +} +.addTabs { + height: 12rem; + padding: 1rem; + position: relative; +} +.addTabs :global .adm-input-element { + height: 3rem; + border: 1px solid #dededf; +} +.addTabs .addTabsBtn { + position: absolute; + right: 5%; + bottom: 10%; +} diff --git a/src/mobile/quotation/quotationDetail.less b/src/mobile/quotation/quotationDetail.less index cce9dec..24989a4 100644 --- a/src/mobile/quotation/quotationDetail.less +++ b/src/mobile/quotation/quotationDetail.less @@ -148,4 +148,23 @@ right: 0; top: 0; } + .tabTitle{ + display: flex; + align-items: center; + position: relative; + } } +.addTabs{ + height: 12rem; + padding: 1rem; + position: relative; + :global .adm-input-element{ + height: 3rem; + border: 1px solid #dededf; + } + .addTabsBtn{ + position: absolute; + right: 5%; + bottom: 10%; + } +} \ No newline at end of file