|
@@ -20,7 +20,7 @@
|
|
|
<TableAction :actions="createActions(record)" />
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
- <Popup @register="addRegister" :modelData="modelData" @saveData="saveData" />
|
|
|
+ <Popup @register="addRegister" :popupData="popupData" @saveData="saveData" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
@@ -30,7 +30,7 @@
|
|
|
import { useModal } from '/@/components/Modal';
|
|
|
import { getFormConfig, columns } from './data';
|
|
|
// import { getAllMenuList } from '/@/api/sys/menu';
|
|
|
- import { getUserList, addUser, editUser, deleteUser } from '/@/api/sys/user';
|
|
|
+ import { getUserList, addUser, editUser, deleteUser, getGroupTree } from '/@/api/sys/user';
|
|
|
import {
|
|
|
BasicTable,
|
|
|
useTable,
|
|
@@ -40,7 +40,7 @@
|
|
|
TableActionType,
|
|
|
} from '/@/components/Table';
|
|
|
|
|
|
- // interface ModelData {
|
|
|
+ // interface PopupData {
|
|
|
// title: string,
|
|
|
// treeData: object[],
|
|
|
// checkedKeys: string[] | number[],
|
|
@@ -51,11 +51,12 @@
|
|
|
export default defineComponent({
|
|
|
components: { BasicTable, TableAction, Popup },
|
|
|
setup() {
|
|
|
+ init();
|
|
|
const { createMessage } = useMessage();
|
|
|
const { success } = createMessage;
|
|
|
const tableRef = ref<Nullable<TableActionType>>(null);
|
|
|
const currentEditKeyRef = ref('');
|
|
|
- const modelData = reactive({
|
|
|
+ const popupData = reactive({
|
|
|
title: '添加',
|
|
|
treeData: [],
|
|
|
});
|
|
@@ -99,6 +100,7 @@
|
|
|
// 请求之前处理参数
|
|
|
function beforeFetch(params) {
|
|
|
console.log(params);
|
|
|
+ console.log('==========before========');
|
|
|
// params['op'] = {};
|
|
|
for (let k in params) {
|
|
|
if (!params[k]) {
|
|
@@ -116,7 +118,6 @@
|
|
|
// delete params[k];
|
|
|
// }
|
|
|
}
|
|
|
- console.log(params.filter);
|
|
|
|
|
|
console.log(params);
|
|
|
|
|
@@ -140,19 +141,26 @@
|
|
|
result.map((item) => {
|
|
|
if (item.groups) {
|
|
|
item.groups = item.groups.split(',');
|
|
|
+ item.groups_text = item.groups_text.split(',');
|
|
|
} else {
|
|
|
item.groups = null;
|
|
|
+ item.groups_text = [];
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ async function init() {
|
|
|
+ const GroupTree = await getGroupTree();
|
|
|
+ popupData.treeData = GroupTree.row;
|
|
|
+ }
|
|
|
+
|
|
|
function getSelectRowKeyList() {
|
|
|
// 获取选中行的key --- id
|
|
|
console.log(getTableAction().getSelectRowKeys());
|
|
|
}
|
|
|
|
|
|
function addRole() {
|
|
|
- modelData.title = '添加';
|
|
|
+ popupData.title = '添加';
|
|
|
openAdd(true, {
|
|
|
id: null,
|
|
|
username: '',
|
|
@@ -165,7 +173,7 @@
|
|
|
|
|
|
function handleEdit(record: EditRecordRow) {
|
|
|
currentEditKeyRef.value = record.id; // record.key
|
|
|
- modelData.title = '编辑';
|
|
|
+ popupData.title = '编辑';
|
|
|
|
|
|
const data = getTableAction().getDataSource();
|
|
|
data.map((item) => {
|
|
@@ -189,9 +197,9 @@
|
|
|
// getTableAction().setTableData(data.filter(item => item.id !== record.id))
|
|
|
}
|
|
|
|
|
|
- async function saveData(popupData: any) {
|
|
|
- const data = popupData.data;
|
|
|
- const closeModel = popupData.closeModal;
|
|
|
+ async function saveData(params: any) {
|
|
|
+ const data = params.data;
|
|
|
+ const closeModel = params.closeModal;
|
|
|
if (data.groups) {
|
|
|
data.groups = data.groups.toString();
|
|
|
} else {
|
|
@@ -240,7 +248,7 @@
|
|
|
console.log(getTableAction());
|
|
|
});
|
|
|
return {
|
|
|
- modelData,
|
|
|
+ popupData,
|
|
|
tableRef,
|
|
|
registerTable,
|
|
|
addRole,
|