Сделал предустановку значений из процесса

jwt
Rinsvent 2 years ago
parent af0c3bcd98
commit 2cd4d87d0a
  1. 2
      components/elements/commands/elements/argument/index.tsx
  2. 5
      components/elements/commands/elements/options/index.tsx

@ -13,7 +13,7 @@ export interface ArgumentInterface {
export default function Argument(argument: ArgumentInterface) {
let {argumentList, setArgumentList} = useContext<ContextInterface>(Context)
let [value, setValue] = useState('')
let [value, setValue] = useState(argumentList[argument.name] || '')
useEffect(() => {
let temp = {

@ -11,8 +11,7 @@ interface OptionsInterface {
export default function Options({optionList}: OptionsInterface) {
let {optionList: ol, setOptionList} = useContext<ContextInterface>(Context)
let [selectedOptions, setSelectedOptions] = useState<OptionInterface[]>([]);
let [values, setValues] = useState<OptionInterface[]>([]);
let [selectedValues, setSelectedValues] = useState<string[]>([]);
let [selectedValues, setSelectedValues] = useState<string[]>(Object.keys(ol) || []);
useEffect(() => {
let result: OptionInterface[] = [];
@ -25,7 +24,7 @@ export default function Options({optionList}: OptionsInterface) {
let temp: any = {}
optionList.forEach((value, index, array) => {
let check = selectedValues.find(item => item === value.name)
check && (temp[value.name] = value.acceptValue ? '' : null)
check && (temp[value.name] = value.acceptValue ? '' : true)
})
setOptionList(temp)
}, [selectedValues]);

Loading…
Cancel
Save