Compare commits

..

No commits in common. "a504218a393b591c08c9ef8407c58e48b7c697e7" and "0f391c0c47428c0d3c0cfc141bfb3642e7262897" have entirely different histories.

3 changed files with 13 additions and 115 deletions

View File

@ -1,12 +1,12 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/asyncmain/asyncMain/list',
save = '/asyncmain/asyncMain/add',
edit = '/asyncmain/asyncMain/edit',
save='/asyncmain/asyncMain/add',
edit='/asyncmain/asyncMain/edit',
deleteOne = '/asyncmain/asyncMain/delete',
deleteBatch = '/asyncmain/asyncMain/deleteBatch',
importExcel = '/asyncmain/asyncMain/importExcel',
@ -35,11 +35,11 @@ export const list = (params) => defHttp.get({ url: Api.list, params });
* @param params
* @param handleSuccess
*/
export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
};
}
/**
*
@ -54,12 +54,12 @@ export const batchDelete = (params, handleSuccess) => {
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
},
}
});
};
}
/**
*
@ -69,5 +69,4 @@ export const batchDelete = (params, handleSuccess) => {
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
};
}

View File

@ -21,8 +21,6 @@ enum Api {
dictItemCheck = '/sys/dictItem/dictItemCheck',
refreshCache = '/sys/dict/refleshCache',
queryAllDictItems = '/sys/dict/queryAllDictItems',
async = '/sys/dict/async',
listByType = '/asyncmain/asyncMain/listByType',
}
/**
* api
@ -156,20 +154,3 @@ export const refreshCache = () => defHttp.get({ url: Api.refreshCache }, { isTra
* @param params
*/
export const queryAllDictItems = () => defHttp.get({ url: Api.queryAllDictItems }, { isTransformResponse: false });
/**
*
* @param params
*/
export const asyncData = (params) => {
return defHttp.post({ url: Api.async, params });
};
/**
*
* @param params
* @returns
*/
export const listByType = (params) => {
return defHttp.post({ url: Api.listByType, params });
};

View File

@ -25,7 +25,7 @@
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getTableDropDownAction(record)" />
<TableAction :actions="getTableAction(record)" />
</template>
</BasicTable>
<!--字典弹窗-->
@ -34,28 +34,11 @@
<DictItemList @register="registerDrawer" />
<!--回收站弹窗-->
<DictRecycleBinModal @register="registerModal1" @success="reload" />
<a-modal v-model:open="showAsyncResult" title="同步结果" @ok="showAsyncResult = false" width="70vw">
<a-tabs v-model:activeKey="activeTabKey" style="margin-left: 10px;margin-right: 10px;margin-bottom: 10px;">
<a-tab-pane key="error" :tab="`同步异常 (${errorList.length})`">
<a-table :dataSource="errorList" :columns="resultColumns" :pagination="false" size="small" bordered
:scroll="{ y: '50vh' }" />
</a-tab-pane>
<a-tab-pane key="processing" :tab="`同步中/待同步 (${processingList.length})`">
<a-table :dataSource="processingList" :columns="resultColumns" :pagination="false" size="small" bordered
:scroll="{ y: '50vh' }" />
</a-tab-pane>
<a-tab-pane key="success" :tab="`同步完成 (${successList.length})`">
<a-table :dataSource="successList" :columns="resultColumns" :pagination="false" size="small" bordered
:scroll="{ y: '50vh' }" />
</a-tab-pane>
</a-tabs>
</a-modal>
</template>
<script lang="ts" name="system-dict" setup>
//ts
import { ref, computed, unref, nextTick } from 'vue';
import { ref, computed, unref } from 'vue';
import { BasicTable, TableAction } from '/src/components/Table';
import { useDrawer } from '/src/components/Drawer';
import { useModal } from '/src/components/Modal';
@ -65,33 +48,10 @@ import DictRecycleBinModal from './components/DictRecycleBinModal.vue';
import { useMessage } from '/src/hooks/web/useMessage';
import { removeAuthCache, setAuthCache } from '/src/utils/auth';
import { columns, searchFormSchema } from './dict.data';
import { list, deleteDict, batchDeleteDict, getExportUrl, getImportUrl, refreshCache, queryAllDictItems, asyncData, listByType } from './dict.api';
import { list, deleteDict, batchDeleteDict, getExportUrl, getImportUrl, refreshCache, queryAllDictItems } from './dict.api';
import { DB_DICT_DATA_KEY } from '/src/enums/cacheEnum';
import { useUserStore } from '/@/store/modules/user';
const showAsyncResult = ref(false)
const activeTabKey = ref('error');
const errorList = ref<Recordable[]>([]);
const processingList = ref<Recordable[]>([]);
const successList = ref<Recordable[]>([]);
const resultColumns = [
{
title: '机构名称',
dataIndex: 'orgName',
key: 'orgName',
},
{
title: '机构编码',
dataIndex: 'orgCode',
key: 'orgCode',
},
{
title: '备注',
dataIndex: 'descr',
key: 'descr',
}
];
const { createMessage } = useMessage();
//model
const [registerModal, { openModal }] = useModal();
@ -231,48 +191,6 @@ function getTableAction(record) {
},
];
}
function getTableDropDownAction(record) {
return [
{
label: '同步数据',
onClick: handleAsync.bind(null, record),
},
{
label: '同步结果',
onClick: AsyncResultFunc.bind(null, record),
},
]
}
/**
* 同步
*/
function handleAsync(record) {
asyncData(record).then(res => {
createMessage.success("操作成功,请在同步结果中进行查看!")
})
}
/**
* 同步结果
*/
function AsyncResultFunc(record) {
showAsyncResult.value = true;
activeTabKey.value = 'error';
//
errorList.value = [];
processingList.value = [];
successList.value = [];
listByType({ primaryKey: record.id }).then(res => {
if (res) {
errorList.value = res.errorList || [];
processingList.value = res.processingList || [];
successList.value = res.successList || [];
}
});
}
</script>
<style scoped></style>