|
@@ -17,27 +17,28 @@ export default defineComponent({
|
|
|
emits: ["close", "confirm"],
|
|
|
setup(props, { emit }) {
|
|
|
const state = reactive({
|
|
|
- subjectValue: props.subject || "",
|
|
|
- instrumentCode: "",
|
|
|
+ subjectValue: null as any,
|
|
|
+ instrumentCode: null as any,
|
|
|
selectList: [] as any,
|
|
|
});
|
|
|
|
|
|
//
|
|
|
const selectItem = () => {
|
|
|
- const i = props.subjectList.find((item: any) => item.value === props.subject);
|
|
|
+ const i: any = props.subjectList.find((item: any) => item.value === props.subject);
|
|
|
if (!i) {
|
|
|
props.subjectList.forEach((item: any) => {
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
item.children.forEach((child: any) => {
|
|
|
if (child.value === props.subject) {
|
|
|
state.instrumentCode = child.value;
|
|
|
+ state.subjectValue = item.id;
|
|
|
+ state.selectList = item.children;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- if (state.instrumentCode) {
|
|
|
- state.subjectValue = item.value;
|
|
|
- }
|
|
|
});
|
|
|
+ } else {
|
|
|
+ state.subjectValue = i.id;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -52,13 +53,14 @@ export default defineComponent({
|
|
|
<div class={styles.subjectContainer}>
|
|
|
{props.subjectList.map((item: any) => (
|
|
|
<div
|
|
|
- class={[styles.subjectItem, item.children.length > 0 && styles.arrow, item.value === state.subjectValue && styles.active]}
|
|
|
+ class={[styles.subjectItem, item.children.length > 0 && styles.arrow, item.id === state.subjectValue && styles.active]}
|
|
|
onClick={() => {
|
|
|
- state.subjectValue = item.value;
|
|
|
- state.selectList = item.children;
|
|
|
if (item.children.length <= 0) {
|
|
|
state.instrumentCode = "";
|
|
|
}
|
|
|
+ state.subjectValue = item.id;
|
|
|
+ state.instrumentCode = item.value;
|
|
|
+ state.selectList = item.children;
|
|
|
}}
|
|
|
>
|
|
|
{item.text}
|