|
@@ -22,7 +22,7 @@
|
|
|
import { nextTick, ref, watch } from 'vue'
|
|
|
import mainApi from '~api/static/actual.js'
|
|
|
import { getArrValue } from 'js-fast-way'
|
|
|
-
|
|
|
+import { getdepartmentList } from '~api/other'
|
|
|
const props = defineProps({
|
|
|
cur: {
|
|
|
type: [String, Number],
|
|
@@ -47,6 +47,8 @@ year.value = checkyear
|
|
|
if (key === 'decost') {
|
|
|
console.log('获部门计划')
|
|
|
budgetAndPracticalByDept()
|
|
|
+ getDepartmentDict()
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -64,8 +66,22 @@ const budgetAndPracticalByDept = async () => {
|
|
|
tableData.value = []
|
|
|
}
|
|
|
}
|
|
|
+const department = ref([])
|
|
|
+//获取所属部门列表
|
|
|
+const getDepartmentDict = async ()=>{
|
|
|
+ const { error, code, data } = await getdepartmentList({ deptType:2 })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ department.value = getArrValue(data)
|
|
|
+ getColData()
|
|
|
+
|
|
|
+ } else {
|
|
|
+ department.value = []
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+const colData = ref([])
|
|
|
const tableColData = ref([
|
|
|
- {
|
|
|
+ {
|
|
|
id:'time',
|
|
|
name: '时间',
|
|
|
children:[
|
|
@@ -73,84 +89,114 @@ const tableColData = ref([
|
|
|
name: '时间' },
|
|
|
],
|
|
|
},
|
|
|
-
|
|
|
- {
|
|
|
- id: 'market',
|
|
|
- name: '市场部',
|
|
|
- children:[
|
|
|
+])
|
|
|
+const getColData = ()=>{
|
|
|
+ department.value.forEach((ele, index)=>{
|
|
|
+ tableColData.value.push({
|
|
|
+ id:ele.id,
|
|
|
+ name:ele.deptName,
|
|
|
+ children:[
|
|
|
{
|
|
|
- id: 'budget1',
|
|
|
+ id: 'budget' + index,
|
|
|
name: '预算支出',
|
|
|
},
|
|
|
{
|
|
|
- id: 'practical1',
|
|
|
+ id: 'practical' + index,
|
|
|
name: '实际支出',
|
|
|
},
|
|
|
+ ],
|
|
|
+ })
|
|
|
+ })
|
|
|
+ console.log(colData.value, 'colData.value')
|
|
|
+
|
|
|
+}
|
|
|
+// const tableColData = ref([
|
|
|
+// {
|
|
|
+// id:'time',
|
|
|
+// name: '时间',
|
|
|
+// children:[
|
|
|
+// { id:'time',
|
|
|
+// name: '时间' },
|
|
|
+// ],
|
|
|
+// },
|
|
|
+
|
|
|
+// {
|
|
|
+// id: 'market',
|
|
|
+// name: '市场部',
|
|
|
+// children:[
|
|
|
+// {
|
|
|
+// id: 'budget1',
|
|
|
+// name: '预算支出',
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'practical1',
|
|
|
+// name: '实际支出',
|
|
|
+// },
|
|
|
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'technology',
|
|
|
- name: '研发部',
|
|
|
- children:[
|
|
|
- {
|
|
|
- id: 'budget2',
|
|
|
- name: '预算支出',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'practical2',
|
|
|
- name: '实际支出',
|
|
|
- },
|
|
|
+// ],
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'technology',
|
|
|
+// name: '研发部',
|
|
|
+// children:[
|
|
|
+// {
|
|
|
+// id: 'budget2',
|
|
|
+// name: '预算支出',
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'practical2',
|
|
|
+// name: '实际支出',
|
|
|
+// },
|
|
|
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'implement',
|
|
|
- name: '实施部',
|
|
|
- children:[
|
|
|
- {
|
|
|
- id: 'budget3',
|
|
|
- name: '预算支出',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'practical3',
|
|
|
- name: '实际支出',
|
|
|
- },
|
|
|
+// ],
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'implement',
|
|
|
+// name: '实施部',
|
|
|
+// children:[
|
|
|
+// {
|
|
|
+// id: 'budget3',
|
|
|
+// name: '预算支出',
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'practical3',
|
|
|
+// name: '实际支出',
|
|
|
+// },
|
|
|
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'maintenance',
|
|
|
- name: '维护部',
|
|
|
- children:[
|
|
|
- {
|
|
|
- id: 'budget4',
|
|
|
- name: '预算支出',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'practical4',
|
|
|
- name: '实际支出',
|
|
|
- },
|
|
|
+// ],
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'maintenance',
|
|
|
+// name: '维护部',
|
|
|
+// children:[
|
|
|
+// {
|
|
|
+// id: 'budget4',
|
|
|
+// name: '预算支出',
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'practical4',
|
|
|
+// name: '实际支出',
|
|
|
+// },
|
|
|
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'mannager',
|
|
|
- name: '管理中心',
|
|
|
- children:[
|
|
|
- {
|
|
|
- id: 'budget5',
|
|
|
- name: '预算支出',
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'practical5',
|
|
|
- name: '实际支出',
|
|
|
- },
|
|
|
+// ],
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'mannager',
|
|
|
+// name: '管理中心',
|
|
|
+// children:[
|
|
|
+// {
|
|
|
+// id: 'budget5',
|
|
|
+// name: '预算支出',
|
|
|
+// },
|
|
|
+// {
|
|
|
+// id: 'practical5',
|
|
|
+// name: '实际支出',
|
|
|
+// },
|
|
|
|
|
|
- ],
|
|
|
- },
|
|
|
+// ],
|
|
|
+// },
|
|
|
|
|
|
-])
|
|
|
+// ])
|
|
|
//合并
|
|
|
|
|
|
const headerStyle = ({ column, rowIndex, columnIndex })=>{
|