| | |
| | | <div class="app-container"> |
| | | <el-form :model="filters" :inline="true"> |
| | | <el-form-item label="会计科目:"> |
| | | <el-cascader v-model="filters.subject" :options="subjectOptions" :props="{ label: 'name', value: 'code' }" placeholder="请选择会计科目" clearable style="width: 250px;" filterable /> |
| | | <el-cascader v-model="filters.subject" :options="subjectOptions" :props="{ label: 'name', value: 'code', checkStrictly: true }" placeholder="请选择会计科目" clearable style="width: 250px;" filterable /> |
| | | </el-form-item> |
| | | <el-form-item label="期间:"> |
| | | <el-date-picker v-model="filters.startMonth" type="month" placeholder="开始月份" value-format="YYYY-MM" style="width: 140px;" /> |
| | |
| | | |
| | | const filters = reactive({ |
| | | subject: [], |
| | | startMonth: "2024-01", |
| | | endMonth: "2024-03", |
| | | startMonth: "", |
| | | endMonth: "", |
| | | }); |
| | | |
| | | const dataList = ref([]); |
| | |
| | | }; |
| | | |
| | | const currentSubject = computed(() => { |
| | | if (!filters.subject || filters.subject.length === 0) return null; |
| | | const code = filters.subject[filters.subject.length - 1]; |
| | | const code = getSelectedSubjectCode(filters.subject); |
| | | if (!code) return null; |
| | | return findSubject(subjectOptions.value, code); |
| | | }); |
| | | |
| | | const getSelectedSubjectCode = (subjectValue) => { |
| | | if (Array.isArray(subjectValue)) { |
| | | return subjectValue.length ? subjectValue[subjectValue.length - 1] : ""; |
| | | } |
| | | return subjectValue || ""; |
| | | }; |
| | | |
| | | const findSubject = (options, code) => { |
| | | for (const item of options) { |
| | | if (item.code === code) return item; |