|
@@ -72,7 +72,20 @@ import StatusIndicator from '@/components/StatusIndicator'
|
|
const visible = ref(false) // 弹窗显示隐藏
|
|
const visible = ref(false) // 弹窗显示隐藏
|
|
const isCreate = ref(true)
|
|
const isCreate = ref(true)
|
|
const activeData = ref({})
|
|
const activeData = ref({})
|
|
-const formsDialog = [
|
|
|
|
|
|
+const curSelectionRows = ref([]) // 表格选中数据
|
|
|
|
+const formsDialog = ref([
|
|
|
|
+ {
|
|
|
|
+ prop: 'pid',
|
|
|
|
+ label: '上级部门',
|
|
|
|
+ itemType: 'cascader',
|
|
|
|
+ props: {
|
|
|
|
+ value: 'id',
|
|
|
|
+ label: 'name',
|
|
|
|
+ emitPath: false,
|
|
|
|
+ checkStrictly: true
|
|
|
|
+ },
|
|
|
|
+ options: []
|
|
|
|
+ },
|
|
{
|
|
{
|
|
prop: 'name',
|
|
prop: 'name',
|
|
label: '名称',
|
|
label: '名称',
|
|
@@ -104,11 +117,11 @@ const formsDialog = [
|
|
itemType: 'input',
|
|
itemType: 'input',
|
|
rules: [{ required: true, message: '请输入备注', trigger: 'blur' }]
|
|
rules: [{ required: true, message: '请输入备注', trigger: 'blur' }]
|
|
}
|
|
}
|
|
-]
|
|
|
|
|
|
+])
|
|
// 新增的表单 和 编辑的表单
|
|
// 新增的表单 和 编辑的表单
|
|
const formOptions = computed(() => {
|
|
const formOptions = computed(() => {
|
|
return {
|
|
return {
|
|
- forms: formsDialog,
|
|
|
|
|
|
+ forms: formsDialog.value,
|
|
labelWidth: 120,
|
|
labelWidth: 120,
|
|
span: 30,
|
|
span: 30,
|
|
showResetBtn: true,
|
|
showResetBtn: true,
|
|
@@ -120,15 +133,16 @@ const formOptions = computed(() => {
|
|
const groupFilterText = ref('')
|
|
const groupFilterText = ref('')
|
|
const treeRef = ref<InstanceType<typeof ElTree>>()
|
|
const treeRef = ref<InstanceType<typeof ElTree>>()
|
|
|
|
|
|
-// 表格搜索条件
|
|
|
|
-const forms = ref([
|
|
|
|
- {
|
|
|
|
- prop: 'keyword',
|
|
|
|
- label: '角色名称:',
|
|
|
|
- itemType: 'input',
|
|
|
|
- placeholder: '请输入角色名称'
|
|
|
|
- }
|
|
|
|
-])
|
|
|
|
|
|
+const replaceChildren = arr => {
|
|
|
|
+ arr.forEach(item => {
|
|
|
|
+ item.label = item.name
|
|
|
|
+ item.value = item.id
|
|
|
|
+ if (item.children && item.children.length > 0) {
|
|
|
|
+ replaceChildren(item.children)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return arr
|
|
|
|
+}
|
|
|
|
|
|
// table列表数据请求
|
|
// table列表数据请求
|
|
const queryList = async () => {
|
|
const queryList = async () => {
|
|
@@ -138,6 +152,10 @@ const queryList = async () => {
|
|
const list = await department.departmentPageApi(searchParams)
|
|
const list = await department.departmentPageApi(searchParams)
|
|
// tableOpts.total = total
|
|
// tableOpts.total = total
|
|
tableOpts.list = list
|
|
tableOpts.list = list
|
|
|
|
+ formsDialog.value[0].options = list
|
|
|
|
+ // const test = replaceChildren(list)
|
|
|
|
+ // console.log(test);
|
|
|
|
+ // formsDialog.value[1].options = list
|
|
} catch {
|
|
} catch {
|
|
console.log('获取列表数据失败')
|
|
console.log('获取列表数据失败')
|
|
// tableOpts.total = 0
|
|
// tableOpts.total = 0
|
|
@@ -150,9 +168,19 @@ const queryList = async () => {
|
|
|
|
|
|
const selectionChange = e => {
|
|
const selectionChange = e => {
|
|
// console.error('click 测试', e)
|
|
// console.error('click 测试', e)
|
|
- console.log(e, 'selectionChange')
|
|
|
|
|
|
+ curSelectionRows.value = e
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 表格搜索条件
|
|
|
|
+const forms = ref([
|
|
|
|
+ {
|
|
|
|
+ prop: 'keyword',
|
|
|
|
+ label: '角色名称:',
|
|
|
|
+ itemType: 'input',
|
|
|
|
+ placeholder: '请输入角色名称'
|
|
|
|
+ }
|
|
|
|
+])
|
|
|
|
+
|
|
// table 参数
|
|
// table 参数
|
|
const columns = [
|
|
const columns = [
|
|
{
|
|
{
|
|
@@ -215,11 +243,11 @@ const columns = [
|
|
}
|
|
}
|
|
]
|
|
]
|
|
|
|
|
|
-const { searchData, tableOpts, checkedColumns, activeColumns, curSelectionRows, updateParams } = useTablePage(
|
|
|
|
|
|
+const { searchData, tableOpts, checkedColumns, activeColumns, updateParams } = useTablePage(
|
|
{
|
|
{
|
|
options: {
|
|
options: {
|
|
showIndex: false,
|
|
showIndex: false,
|
|
- // treeProps: { children: 'children', hasChildren: 'hasChildren' },
|
|
|
|
|
|
+ defaultExpandAll: true,
|
|
onSelectionChange: selectionChange
|
|
onSelectionChange: selectionChange
|
|
},
|
|
},
|
|
// 需要展示的列
|
|
// 需要展示的列
|
|
@@ -285,7 +313,6 @@ const addHandler = () => {
|
|
activeData.value = {}
|
|
activeData.value = {}
|
|
visible.value = true
|
|
visible.value = true
|
|
}
|
|
}
|
|
-
|
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
queryList()
|
|
queryList()
|
|
})
|
|
})
|