Compare commits
No commits in common. "a504218a393b591c08c9ef8407c58e48b7c697e7" and "0f391c0c47428c0d3c0cfc141bfb3642e7262897" have entirely different histories.
a504218a39
...
0f391c0c47
|
@ -1,5 +1,5 @@
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ export const deleteOne = (params, handleSuccess) => {
|
||||||
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
handleSuccess();
|
handleSuccess();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
|
@ -57,9 +57,9 @@ export const batchDelete = (params, handleSuccess) => {
|
||||||
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
handleSuccess();
|
handleSuccess();
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存或者更新
|
* 保存或者更新
|
||||||
|
@ -69,5 +69,4 @@ export const batchDelete = (params, handleSuccess) => {
|
||||||
export const saveOrUpdate = (params, isUpdate) => {
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,6 @@ enum Api {
|
||||||
dictItemCheck = '/sys/dictItem/dictItemCheck',
|
dictItemCheck = '/sys/dictItem/dictItemCheck',
|
||||||
refreshCache = '/sys/dict/refleshCache',
|
refreshCache = '/sys/dict/refleshCache',
|
||||||
queryAllDictItems = '/sys/dict/queryAllDictItems',
|
queryAllDictItems = '/sys/dict/queryAllDictItems',
|
||||||
async = '/sys/dict/async',
|
|
||||||
listByType = '/asyncmain/asyncMain/listByType',
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 导出api
|
* 导出api
|
||||||
|
@ -156,20 +154,3 @@ export const refreshCache = () => defHttp.get({ url: Api.refreshCache }, { isTra
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const queryAllDictItems = () => defHttp.get({ url: Api.queryAllDictItems }, { isTransformResponse: false });
|
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 });
|
|
||||||
};
|
|
|
@ -25,7 +25,7 @@
|
||||||
</template>
|
</template>
|
||||||
<!--操作栏-->
|
<!--操作栏-->
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<TableAction :actions="getTableAction(record)" :dropDownActions="getTableDropDownAction(record)" />
|
<TableAction :actions="getTableAction(record)" />
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<!--字典弹窗-->
|
<!--字典弹窗-->
|
||||||
|
@ -34,28 +34,11 @@
|
||||||
<DictItemList @register="registerDrawer" />
|
<DictItemList @register="registerDrawer" />
|
||||||
<!--回收站弹窗-->
|
<!--回收站弹窗-->
|
||||||
<DictRecycleBinModal @register="registerModal1" @success="reload" />
|
<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>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="system-dict" setup>
|
<script lang="ts" name="system-dict" setup>
|
||||||
//ts语法
|
//ts语法
|
||||||
import { ref, computed, unref, nextTick } from 'vue';
|
import { ref, computed, unref } from 'vue';
|
||||||
import { BasicTable, TableAction } from '/src/components/Table';
|
import { BasicTable, TableAction } from '/src/components/Table';
|
||||||
import { useDrawer } from '/src/components/Drawer';
|
import { useDrawer } from '/src/components/Drawer';
|
||||||
import { useModal } from '/src/components/Modal';
|
import { useModal } from '/src/components/Modal';
|
||||||
|
@ -65,33 +48,10 @@ import DictRecycleBinModal from './components/DictRecycleBinModal.vue';
|
||||||
import { useMessage } from '/src/hooks/web/useMessage';
|
import { useMessage } from '/src/hooks/web/useMessage';
|
||||||
import { removeAuthCache, setAuthCache } from '/src/utils/auth';
|
import { removeAuthCache, setAuthCache } from '/src/utils/auth';
|
||||||
import { columns, searchFormSchema } from './dict.data';
|
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 { DB_DICT_DATA_KEY } from '/src/enums/cacheEnum';
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
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();
|
const { createMessage } = useMessage();
|
||||||
//字典model
|
//字典model
|
||||||
const [registerModal, { openModal }] = useModal();
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
Loading…
Reference in New Issue