|
@@ -139,7 +139,7 @@
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
import { onMounted, reactive, ref } from 'vue'
|
|
|
-import { ElMessage } from 'element-plus'
|
|
|
|
|
|
|
+import { ElLoading, ElMessage } from 'element-plus'
|
|
|
import config from '@/config'
|
|
import config from '@/config'
|
|
|
import {
|
|
import {
|
|
|
SuccessResultCode,
|
|
SuccessResultCode,
|
|
@@ -151,6 +151,7 @@ import {
|
|
|
import type { ChemicalsCatalog, ChemicalsCatalogQuery } from '@/types/base/ChemicalsCatalog'
|
|
import type { ChemicalsCatalog, ChemicalsCatalogQuery } from '@/types/base/ChemicalsCatalog'
|
|
|
import {getList} from '@/apis/base/ChemicalsCatalog'
|
|
import {getList} from '@/apis/base/ChemicalsCatalog'
|
|
|
import { permissionStatus } from '@/utils/globalPermission'
|
|
import { permissionStatus } from '@/utils/globalPermission'
|
|
|
|
|
+import { scheduledTask } from '@/apis/base/TaskLog'
|
|
|
|
|
|
|
|
// 表单引用
|
|
// 表单引用
|
|
|
const queryFormRef = ref<SearchPanelLayoutInstance>()
|
|
const queryFormRef = ref<SearchPanelLayoutInstance>()
|
|
@@ -226,6 +227,13 @@ const state = reactive<State>({
|
|
|
|
|
|
|
|
// 表格操作按钮配置
|
|
// 表格操作按钮配置
|
|
|
const actions = <Array<TableAction>>[
|
|
const actions = <Array<TableAction>>[
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'syncBaseData',
|
|
|
|
|
+ text: '数据同步',
|
|
|
|
|
+ onclick: onSyncData,
|
|
|
|
|
+ limit: permissionStatus('none', 'CHEMICALS_CATALOG_SYNC_BT'),
|
|
|
|
|
+ type: 'primary'
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
key: 'view',
|
|
key: 'view',
|
|
|
text: '查看',
|
|
text: '查看',
|
|
@@ -276,6 +284,41 @@ function onView(row: ChemicalsCatalog) {
|
|
|
state.viewTitle = '危化品详情'
|
|
state.viewTitle = '危化品详情'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//数据同步
|
|
|
|
|
+async function onSyncData() {
|
|
|
|
|
+ // 创建加载实例
|
|
|
|
|
+ const loadingInstance = ElLoading.service({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: '数据同步中...',
|
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await scheduledTask("9")
|
|
|
|
|
+
|
|
|
|
|
+ // 关闭加载
|
|
|
|
|
+ loadingInstance.close()
|
|
|
|
|
+
|
|
|
|
|
+ // 显示成功消息
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: '同步成功',
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ duration: 3000
|
|
|
|
|
+ })
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 关闭加载
|
|
|
|
|
+ loadingInstance.close()
|
|
|
|
|
+
|
|
|
|
|
+ // 显示错误消息
|
|
|
|
|
+ ElMessage({
|
|
|
|
|
+ message: `同步失败: ${error}`,
|
|
|
|
|
+ type: 'error',
|
|
|
|
|
+ duration: 3000
|
|
|
|
|
+ })
|
|
|
|
|
+ console.error('同步失败:', error)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 数据查询
|
|
// 数据查询
|
|
|
async function onLoadData() {
|
|
async function onLoadData() {
|
|
|
setLoading(true)
|
|
setLoading(true)
|