|
|
@@ -73,7 +73,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getList as getSubjectTreeList } from "@/api/basicResource/subjectSetting";
|
|
|
+import { getList as getCompSubjectList } from "@/api/basicResource/compSubjectSetting";
|
|
|
import YearMonthSelect from "@/components/year-month-select";
|
|
|
import UploadExcelDialog from "@/components/upload-excel-dialog";
|
|
|
import projectSelect from "@/components/project-select";
|
|
|
@@ -95,7 +95,6 @@ export default window.$crudCommon({
|
|
|
yearAndMonth: moment(new Date()).format('YYYYMM'),
|
|
|
},
|
|
|
isSelAnnual: false,
|
|
|
- treeData: [],
|
|
|
|
|
|
wideTableColumns: [],
|
|
|
printTitle: "",
|
|
|
@@ -126,27 +125,13 @@ export default window.$crudCommon({
|
|
|
this.getSubjectList();
|
|
|
},
|
|
|
methods: {
|
|
|
- loopData(data, level) {
|
|
|
- level++;
|
|
|
- return data.map(item => {
|
|
|
- item.level = level;
|
|
|
- item.disabled = level === 4 ? false : true;
|
|
|
-
|
|
|
- if (item.children && item.children.length) {
|
|
|
- this.loopData(item.children, level);
|
|
|
- }
|
|
|
-
|
|
|
- return item;
|
|
|
- });
|
|
|
- },
|
|
|
getSubjectList() {
|
|
|
- getSubjectTreeList().then(res => {
|
|
|
+ getCompSubjectList().then(res => {
|
|
|
this.loading = false;
|
|
|
if (res.data.code == 200) {
|
|
|
|
|
|
- const column = this.findObject(this.option.column, "subjectId");
|
|
|
- column.dicData = this.loopData(JSON.parse(JSON.stringify(res.data.data)), 0);
|
|
|
- this.treeData = column.dicData;
|
|
|
+ const column = this.findObject(this.option.column, "esubjectId");
|
|
|
+ column.dicData = res.data.data.records;
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -174,40 +159,15 @@ export default window.$crudCommon({
|
|
|
this.$refs.printWideTable.printTable(isLandscape);
|
|
|
})
|
|
|
},
|
|
|
- findParentNames(categories, childId, parentNames = []) {
|
|
|
- const child = categories.find(cat => cat.id == childId);
|
|
|
-
|
|
|
- if (!child || !child.parentId) {
|
|
|
- return parentNames;
|
|
|
- }
|
|
|
-
|
|
|
- const parent = categories.find(cat => cat.id == child.parentId);
|
|
|
- if (parent) {
|
|
|
- parentNames.unshift(parent.name); // 添加到数组开头保持顺序
|
|
|
- return this.findParentNames(categories, parent.id, parentNames);
|
|
|
- }
|
|
|
-
|
|
|
- return parentNames;
|
|
|
- },
|
|
|
getFormData() {
|
|
|
- let newList = [];
|
|
|
- const getAllList = data => {
|
|
|
- data.forEach(element => {
|
|
|
- newList.push(element);
|
|
|
- if (element.children && element.children.length) {
|
|
|
- getAllList(element.children)
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- getAllList(this.treeData);
|
|
|
- let parentNames = this.findParentNames(newList, this.form.subjectId);
|
|
|
- let currSubjectObj = newList.find(item => item.id == this.form.subjectId);
|
|
|
+ const column = this.findObject(this.option.column, "esubjectId");
|
|
|
+ let currSubjectObj = column.dicData.find(item => item.id == this.form.esubjectId);
|
|
|
|
|
|
return {
|
|
|
...this.form,
|
|
|
- subjectName: `${parentNames.join('\\')}\\${this.form.$subjectId}`,
|
|
|
+ esubjectName: currSubjectObj ? currSubjectObj.name : '',
|
|
|
yearAndMonth: this.params.yearAndMonth,
|
|
|
- subjectCode: currSubjectObj ? currSubjectObj.code : ''
|
|
|
+ esubjectCode: currSubjectObj ? currSubjectObj.code : ''
|
|
|
};
|
|
|
},
|
|
|
},
|