This commit is contained in:
parent
3cb13ef70d
commit
95d0223133
|
|
@ -76,6 +76,7 @@ import { getDeptSelectApi } from '@/api/select';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import website from '@/config/website';
|
import website from '@/config/website';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { getDeptTree } from '@/api/system/dept';
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -129,19 +130,36 @@ export default {
|
||||||
valueFormat: 'YYYY-MM-DD', // 👈 必须大写
|
valueFormat: 'YYYY-MM-DD', // 👈 必须大写
|
||||||
dataType: 'string' // 推荐加上,确保返回字符串
|
dataType: 'string' // 推荐加上,确保返回字符串
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// label: '接收部门',
|
||||||
|
// prop: 'deptId',
|
||||||
|
// search: true,
|
||||||
|
// type: 'tree',
|
||||||
|
// dicData: [], // 初始空,后面动态赋值
|
||||||
|
// props: {
|
||||||
|
// label: 'label',
|
||||||
|
// value: 'id',
|
||||||
|
// children: 'children'
|
||||||
|
// },
|
||||||
|
// // 显示时用插槽展示 deptName(因为 row.deptName 是名称)
|
||||||
|
// slot: true
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
label: '接收部门',
|
label: '接收部门',
|
||||||
prop: 'deptId',
|
prop: 'deptId',
|
||||||
|
dicData: [],
|
||||||
search: true,
|
search: true,
|
||||||
type: 'tree',
|
type: 'tree',
|
||||||
dicData: [], // 初始空,后面动态赋值
|
|
||||||
props: {
|
props: {
|
||||||
label: 'label',
|
label: 'title',
|
||||||
value: 'id',
|
|
||||||
children: 'children'
|
|
||||||
},
|
},
|
||||||
// 显示时用插槽展示 deptName(因为 row.deptName 是名称)
|
rules: [
|
||||||
slot: true
|
{
|
||||||
|
required: false,
|
||||||
|
message: '请选择接收部门',
|
||||||
|
trigger: 'click',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '移交清单',
|
label: '移交清单',
|
||||||
|
|
@ -254,15 +272,9 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadDeptOptions() {
|
loadDeptOptions() {
|
||||||
getDeptSelectApi().then(res => {
|
getDeptTree().then(res => {
|
||||||
this.treeDataList = this.convertToVueTree(res.data.data);
|
const column = this.findObject(this.option.column, 'deptId');
|
||||||
// 找到 deptId 列并更新 dicData
|
column.dicData = res.data.data;
|
||||||
const deptColumn = this.option.column.find(col => col.prop === 'deptId');
|
|
||||||
if (deptColumn) {
|
|
||||||
deptColumn.dicData = this.treeDataList; // Vue 3 可直接赋值;Vue 2 建议用 this.$set
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
console.error('加载部门列表失败', err);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 树数据过滤 - 支持无限层级转换
|
// 树数据过滤 - 支持无限层级转换
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue