hldy_vue/src/views/synchronization/directive/syncList.vue

427 lines
13 KiB
Vue

<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
:wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="title">
<template #label><span title="机构名称">机构名称</span></template>
<a-input placeholder="请输入机构名称" v-model:value="queryParam.title" allow-clear></a-input>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
style="margin-left: 8px">重置</a-button>
</a-col>
<a-col :lg="12" style="text-align: right;">
<a-button type="primary" preIcon="ant-design:cloud-sync-outlined" @click="handleJingxiang"
style="margin-right: 10px;">镜像</a-button>
<a-button type="primary" preIcon="ant-design:file-text-twotone" @click="handleViewLogs"
style="margin-right: 10px;">日志</a-button>
<a-button type="primary" preIcon="ant-design:safety-certificate-twotone" @click="handleDirectiveMainFunc"
style="margin-right: 10px;">标准指令库</a-button>
<a-button type="primary" preIcon="ant-design:copy-outlined" @click="handleDirectiveBackups"
style="margin-right: 10px;">指令备份</a-button>
<!-- <a-badge :count="609" style="margin-right: 10px;"> -->
<!-- <a-button type="primary" preIcon="ant-design:eye-outlined" style="margin-right: 10px;"
@click="handleLookNewDirectives">新增指令</a-button> -->
<!-- </a-badge> -->
</a-col>
</a-row>
</a-form>
</div>
<OrgListCom ref="orgListComRef" :title="queryParam.title" @handleOrgDetail="handleDetail" :showDetail=true
:showDMTip="true">
</OrgListCom>
<ConfigServiceDirectiveListModal ref="configServiceDirectiveListModal" />
<SyncStepListModal ref="syncStepListModal" />
<!-- <a-modal v-model:visible="logsVisible" title="日志" width="90vw"
:bodyStyle="{ height: '70vh', display: 'flex', flexDirection: 'column', overflow: 'auto' }"
wrapClassName="org-list-modal" @cancel="handleCancelLogs">
<a-row>
<a-col :span="2" :push="22" style="margin-top: 15px;margin-left: 60px;">
<a-button type="primary" @click="handleRefreshLogs" title="刷新">
刷新
</a-button>
</a-col>
</a-row>
<template #footer>
<a-button @click="handleCancelLogs" type="primary">关闭</a-button>
</template>
<AsyncListComponent ref="logsRef"></AsyncListComponent>
</a-modal> -->
<a-drawer title="日志" width="85vw" v-model:visible="logsVisible"
:bodyStyle="{ height: '70vh', display: 'flex', flexDirection: 'column', overflow: 'auto' }"
wrapClassName="org-list-modal" @cancel="handleCancelLogs">
<a-row style="overflow-x: hidden !important; background-color: white;">
<a-col :span="2" :push="22" style="margin-top: 18px;margin-left: 30px;">
<a-button type="primary" @click="handleRefreshLogs" title="刷新">
刷新
</a-button>
</a-col>
<a-col :span="24">
<AsyncListComponent ref="logsRef" :type="'directive'" @handleDetail="handleDetail"></AsyncListComponent>
</a-col>
</a-row>
<template #footer>
<a-button @click="handleCancelLogs" type="primary" style="float:right;">关闭</a-button>
</template>
</a-drawer>
<!-- 标准指令库 -->
<a-drawer v-model:visible="directiveMainVisible" title="标准指令库" width="85vw" :footer-style="{ textAlign: 'right' }"
:bodyStyle="{ height: '70vh', display: 'flex', flexDirection: 'column', overflow: 'auto' }"
wrapClassName="org-list-modal" @cancel="handleCanceldirectiveMain">
<template #footer>
<a-button @click="handleCanceldirectiveMain" type="primary" style="margin-right: 10px;">关闭</a-button>
<a-button @click="handleAsyncdirectiveMain" type="primary">确认</a-button>
</template>
<OrgListCom ref="directiveMainComRef" :showDirectiveMain=true :showDirectiveChoose="true"
@handleOrgDetail="handleDetail" :showDetail=true @handleOrgChoose="directiveMainFunc">
</OrgListCom>
</a-drawer>
<!-- 新增指令 -->
<a-drawer v-model:visible="newDirectiveVisible" title="新增指令" width="85vw" :footer-style="{ textAlign: 'right' }"
:bodyStyle="{ height: '80vh', display: 'flex', flexDirection: 'column', overflow: 'auto' }"
wrapClassName="org-list-modal" @cancel="handleCancelNewDirective">
<template #footer>
<a-button @click="handleCancelNewDirective" type="primary">关闭</a-button>
<!-- <a-button @click="handleAsyncNewDirective" type="primary">同步</a-button> -->
</template>
<div style="padding:0px 8px;">
<CanAddDirectiveList ref="canAddDirectiveRef" :directiveMainOrgInfo="directiveMainOrgInfo"
:existDirectiveIds="existDirectiveIds" @refreshExistIds="refreshDMExistedIds"></CanAddDirectiveList>
</div>
</a-drawer>
<!-- 指令备份 -->
<a-drawer v-model:visible="directiveBackupsOpen" title="指令备份" width="85vw" :footer-style="{ textAlign: 'right' }"
:bodyStyle="{ padding:'14px', height: '80vh', display: 'flex', flexDirection: 'column', overflow: 'auto' }"
wrapClassName="org-list-modal" @cancel="handleDirectiveBackupsClose">
<template #footer>
<a-button @click="handleDirectiveBackupsClose" type="primary">关闭</a-button>
</template>
<div style="padding:0px 8px;">
<DirectiveBkMainList ref="backupsRef"></DirectiveBkMainList>
</div>
</a-drawer>
</div>
</template>
<script setup name="synchronization-directive2" lang="ts">
import { ref, reactive, computed, onMounted, watch } from 'vue'
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
// 以下为服务指令引用:
import { list, asyncFunc, departList } from '@/views/services/serviceDirective/ConfigServiceDirective.api';
import { Pagination } from 'ant-design-vue';
import ConfigServiceDirectiveListModal from '/@/views/synchronization/directive/serviceDirective/ConfigServiceDirectiveListModal.vue';
import SyncStepListModal from '/@/views/synchronization/directive/syncStep/SyncStepListModal.vue';
//机构信息
import { getOrgInfo } from '/@/views/admin/orgapplyinfo/OrgApplyInfo.api';
//机构列表
import OrgListCom from '/@/views/synchronization/directive/orgCom/OrgListCom.vue'
//可新增指令
import CanAddDirectiveList from '/@/views/synchronization/directive/canadddirective/CanAddDirectiveList.vue'
import { useMessage } from '/@/hooks/web/useMessage';
import AsyncListComponent from '@/components/dataAsync/AsyncMainList0731.vue'
import { getDirectiveMain, changeDirectiveMain } from '/@/api/common/api'
import { idListByDS } from '/@/views/synchronization/directive/serviceDirective/ConfigServiceDirective.api';
import { nextTick } from 'process';
import DirectiveBkMainList from '/@/views/services/directivebk/DirectiveBkMainList.vue'
const { createMessage } = useMessage()
const canAddDirectiveRef = ref()
const newDirectiveVisible = ref(false)
const directiveMainComRef = ref();
const newDirectiveRef = ref()
const logsRef = ref()
const formRef = ref();
const configServiceDirectiveListModal = ref();
const syncStepListModal = ref();
const orgTableList = ref<any>([]);
const queryParam = reactive<any>({});
const pageParams = ref({ pageNo: 1, pageSize: 8 })
const orgListComRef = ref()
const logsVisible = ref(false)
const directiveMainVisible = ref(false)
const { createConfirm } = useMessage();
const existDirectiveIds = ref([])//指令库已存在指令id
const directiveMainOrgInfo = ref()
const directiveBackupsOpen = ref(false)
const backupsRef = ref()//指令备份
const labelCol = reactive({
xs: 24,
sm: 4,
xl: 6,
xxl: 4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
/**
* 镜像
*/
function handleJingxiang() {
syncStepListModal.value.init(null);
syncStepListModal.value.disableSubmit = true;
}
/**
* 详情
* @param record
*/
function handleDetail(record) {
configServiceDirectiveListModal.value.init(record);
configServiceDirectiveListModal.value.disableSubmit = true;
}
/**
* 查询
*/
function searchQuery() {
orgListComRef.value?.reload();
}
function reload() {
//刷新数据
queryParam.pageSize = pageParams.value.pageSize;
queryParam.pageNo = pageParams.value.pageNo;
getOrgInfo(queryParam).then(res => {
orgTableList.value = res;
});
}
/**
* 重置
*/
function searchReset() {
queryParam.title = null
orgListComRef.value?.searchReset()
}
/**
* 日志
*/
function handleViewLogs() {
logsVisible.value = true
handleRefreshLogs()
}
function handleLookNewDirectives() {
newDirectiveVisible.value = true
refreshDMExistedIds(directiveMainOrgInfo.value, true)
}
//关闭日志模态框
function handleCancelLogs() {
logsVisible.value = false
}
//刷新日志
function handleRefreshLogs() {
logsRef.value?.searchQuery()
}
/**
* 关闭新增指令
*/
function handleCancelNewDirective() {
newDirectiveVisible.value = false
}
/**
* 同步新增指令
*/
function handleAsyncNewDirective() {
// newDirectiveRef
}
/**
* 打开指令库
*/
function handleDirectiveMainFunc() {
directiveMainVisible.value = true
directiveMainComRef.value?.reload();
}
/**
* 关闭指令库
*/
function handleCanceldirectiveMain() {
directiveMainVisible.value = false
}
//刷新已有指令库
function refreshDMExistedIds(dmOrgInfo, izReset = false, izQuery = true) {
idListByDS({ dataSourceCode: dmOrgInfo.orgCode }).then(res => {
existDirectiveIds.value = res.records
if (izReset) {
canAddDirectiveRef.value?.searchReset()
} else {
canAddDirectiveRef.value?.reload()
}
})
}
/**
* 查看指令备份
*/
function handleDirectiveBackups() {
directiveBackupsOpen.value = true
}
/**
* 关闭指令备份
*/
function handleDirectiveBackupsClose() {
directiveBackupsOpen.value = false
}
watch(directiveMainOrgInfo, (newValue, oldValue) => {
refreshDMExistedIds(newValue)
}, { deep: true })
const tempDM = ref()
/**
* 指令库对应机构信息
*/
function directiveMainFunc(orgInfo_) {
tempDM.value = orgInfo_
}
/**
* 确认指令库
*/
function handleAsyncdirectiveMain() {
// createConfirm({
// iconType: 'warning',
// title: '指令库变更提醒',
// content: '是否变更指令库为:' + tempDM.value.departName,
// okText: '确认',
// cancelText: '取消',
// onOk: () => {
directiveMainOrgInfo.value = tempDM.value
changeDirectiveMain(directiveMainOrgInfo.value.orgCode).then(() => {
createMessage.success('标准指令库已变更')
handleCanceldirectiveMain()
canAddDirectiveRef.value?.reload()
orgListComRef.value?.reload()
}).catch(() => {
createMessage.error('指令库变更失败,请稍后再试')
})
// }
// });
}
//获取指令库机构信息
function getDirectiveMainOrgInfo() {
getDirectiveMain().then(res => {
directiveMainOrgInfo.value = res
})
}
// 自动请求并暴露内部方法
onMounted(() => {
reload();
getDirectiveMainOrgInfo()
orgListComRef.value?.reload();
});
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
margin-bottom: 18px;
.table-page-search-submitButtons {
display: block;
margin-bottom: 0px;
white-space: nowrap;
}
.query-group-cust {
min-width: 100px !important;
}
.query-group-split-cust {
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help) {
margin-bottom: 18px;
height: 32px;
}
:deep(.ant-picker),
:deep(.ant-input-number) {
width: 100%;
}
}
.cardTitle {
background: #1ea0fa;
width: 100%;
margin: -28px -24px;
padding-top: 15px;
border-radius: 5px 5px 0px 0px;
color: white;
height: 55px;
display: block;
position: absolute;
}
.zxClass {
font-size: 12px;
background: linear-gradient(to right, #1ea0fa, #017de9);
border-radius: 8px;
height: 25px;
color: white;
line-height: 25px;
}
.lxClass {
font-size: 14px;
background: linear-gradient(to right, #cccccc, #cccccc);
border-radius: 8px;
height: 35px;
color: white;
line-height: 35px;
}
.tbClass {
background: #f6f6f6;
padding: 8px;
border-radius: 5px;
}
.antTitle {
margin-top: 10px;
display: block;
font-size: 12px;
}
.ellipsis-one-lines {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
/* 限制文本为2行 */
overflow: hidden;
text-overflow: ellipsis;
}
.content-refresh-btn {
position: absolute;
top: 60px;
right: 20px;
z-index: 1;
}
</style>