完善字典,基本功能完成,下一步,菜单

main
expressgy 3 months ago
parent eff6f9626f
commit b05d6e16ad
  1. 6
      src/api/http.js
  2. 3
      src/views/Auth/Dict/DictTable.vue
  3. 37
      src/views/Auth/Dict/index.vue

@ -48,6 +48,7 @@ service.interceptors.request.use(
} else if (config.url === '/authUser/sign/refresh') {
// ! 刷新Token请求,传入RefreshToken
config.headers.Authorization = `Bearer ${systemStore.state.refreshToken}`;
config.isRefresh = true;
} else {
if (isExpired) {
// ! 等待刷新token后放行
@ -73,6 +74,11 @@ service.interceptors.response.use(
// ! 正常响应,返回数据
return data.data;
} else if (data.statusCode === 403) {
if(response.config.isRefresh === true){
systemStore.goBackSignin();
window.pino.fatal('RefreshToken过期');
return
}
// ! WARN ============================================
window.pino.error('Token过期');

@ -49,7 +49,7 @@ const tableColumnObject = {
dictIcon: {
title: '字典图标',
dataIndex: 'dictIcon',
customRender: ({ text, record, index, column }) => (text ? h(IconPool[text], { style: { fontSize: '20px' } }) : null),
customRender: ({ text, record, index, column }) => (text && IconPool[text] ? h(IconPool[text], { style: { fontSize: '20px' } }) : h('div', text)),
key: 'dictIcon',
},
dictType: {
@ -74,6 +74,7 @@ const tableColumnObject = {
dataIndex: 'createtime',
key: 'createtime',
width: '140px',
sorter: true,
},
createName: {
title: '创建人',

@ -51,7 +51,7 @@ const formData = reactive({
const tableData = reactive({
dataSource: [],
methods: {
handleTableChange: () => {},
handleTableChange,
handleRemoveAck,
handleUpdate,
},
@ -89,6 +89,7 @@ async function handleCreateAck(data) {
clearSearchData();
clearFormData();
getPage();
baseDataStore.getDictList();
}
// !
async function handleRemoveAck(data) {
@ -98,6 +99,7 @@ async function handleRemoveAck(data) {
tableData.pageInfo.pageNumber--;
}
getPage();
baseDataStore.getDictList();
}
// !
async function handleUpdate(data) {
@ -122,6 +124,7 @@ async function handleUpdateAck(data) {
Message.success('更新字典成功!');
clearFormData();
getPage();
baseDataStore.getDictList();
}
// !
watch(tableData.pageInfo, () => {
@ -137,11 +140,20 @@ watch(tableData.pageInfo, () => {
});
// !
async function getPage() {
baseDataStore.getDictList();
const resd = await CoreDict.getDict(tableData.pageInfo);
tableData.dataSource = resd.rowData;
tableData.total = Number(resd.total);
}
// !
function handleTableChange(page, filter, sorter){
if (sorter.order == 'ascend') {
tableData.pageInfo.isAsc = true;
} else if (sorter.order == 'descend') {
tableData.pageInfo.isAsc = false;
} else {
tableData.pageInfo.isAsc = undefined;
}
}
// !
const handlePageChange = (page, pageSize) => {
tableData.pageInfo.pageSize = pageSize;
@ -150,17 +162,15 @@ const handlePageChange = (page, pageSize) => {
};
// !
function clearSearchData() {
tableData.pageInfo = {
pageSize: 10,
pageNumber: 1,
isList: false,
isAsc: false,
dictInfo: undefined,
dictType: undefined,
root: undefined,
serviceKey: undefined,
status: undefined,
};
tableData.pageInfo.pageSize=10;
tableData.pageInfo.pageNumber= 1;
tableData.pageInfo.isList= false;
tableData.pageInfo.isAsc= false;
tableData.pageInfo.dictInfo= undefined;
tableData.pageInfo.dictType=undefined;
tableData.pageInfo.root=undefined;
tableData.pageInfo.serviceKey=undefined;
tableData.pageInfo.status=undefined;
}
// !
function clearFormData() {
@ -180,6 +190,7 @@ function clearFormData() {
formData.formData.orderNum = 0;
}
onMounted(() => {
baseDataStore.getDictList();
getPage();
if (baseDataStore.state.serviceList.length == 0) {
baseDataStore.getServiceList();

Loading…
Cancel
Save