|
@@ -3,32 +3,52 @@
|
|
|
<Navbar title="数据归档" :is-go-back="false" />
|
|
<Navbar title="数据归档" :is-go-back="false" />
|
|
|
<label>业务名称:</label>
|
|
<label>业务名称:</label>
|
|
|
<a-select
|
|
<a-select
|
|
|
- v-model:value="value1"
|
|
|
|
|
|
|
+ v-model:value="selectValue"
|
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
|
:options="businessNames"
|
|
:options="businessNames"
|
|
|
@change="nameChange"
|
|
@change="nameChange"
|
|
|
/>
|
|
/>
|
|
|
<a-divider />
|
|
<a-divider />
|
|
|
</header>
|
|
</header>
|
|
|
- <div class="content">
|
|
|
|
|
- <label>开始时间:</label>
|
|
|
|
|
- <a-date-picker
|
|
|
|
|
- show-time
|
|
|
|
|
- :locale="locale"
|
|
|
|
|
- style="width: 200px"
|
|
|
|
|
- placeholder="归档开始日期"
|
|
|
|
|
- @change="startDateChange"
|
|
|
|
|
- />
|
|
|
|
|
- <label class="params">结束时间:</label>
|
|
|
|
|
- <a-date-picker
|
|
|
|
|
- show-time
|
|
|
|
|
- :locale="locale"
|
|
|
|
|
- style="width: 200px"
|
|
|
|
|
- placeholder="归档结束日期"
|
|
|
|
|
- @change="endDateChange"
|
|
|
|
|
- />
|
|
|
|
|
- <label class="params">文件行数:</label>
|
|
|
|
|
- <a-input-number v-model:value="linCount" :min="0" style="width: 200px" />
|
|
|
|
|
|
|
+ <div v-if="selectValue">
|
|
|
|
|
+ <div class="queryParams">
|
|
|
|
|
+ <ul class="ulStyle">
|
|
|
|
|
+ <li v-for="(item, index) in allParams" :key="index" class="liStyle">
|
|
|
|
|
+ <label> {{ item.viewName }}:</label>
|
|
|
|
|
+ <span v-if="item.displayType == 'DateTimeBoxEditor'">
|
|
|
|
|
+ <a-date-picker
|
|
|
|
|
+ v-model:value="item.dateValue"
|
|
|
|
|
+ show-time
|
|
|
|
|
+ :locale="locale"
|
|
|
|
|
+ class="commonWidth"
|
|
|
|
|
+ @change="
|
|
|
|
|
+ (_, dateString) => dateChange(_, dateString, item.paramName)
|
|
|
|
|
+ "
|
|
|
|
|
+ />
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-if="item.displayType == 'TextEditor'">
|
|
|
|
|
+ <a-input
|
|
|
|
|
+ v-model:value="item.defaultValue"
|
|
|
|
|
+ class="commonWidth"
|
|
|
|
|
+ @change="(e) => textChange(e, item.paramName)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-if="item.displayType == 'NumberEditor'">
|
|
|
|
|
+ <a-input-number
|
|
|
|
|
+ v-model:value="item.defaultValue"
|
|
|
|
|
+ class="commonWidth"
|
|
|
|
|
+ @change="(value) => numberChange(value, item.paramName)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </span>
|
|
|
|
|
+ <span v-if="item.displayType == 'CheckBoxEditor'">
|
|
|
|
|
+ <a-checkbox
|
|
|
|
|
+ v-model:checked="item.defaultValue"
|
|
|
|
|
+ @change="(e) => checkChange(e, item.paramName)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </li>
|
|
|
|
|
+ </ul>
|
|
|
|
|
+ </div>
|
|
|
<a-divider />
|
|
<a-divider />
|
|
|
<a-button type="primary" @click="startArchive">执行归档</a-button>
|
|
<a-button type="primary" @click="startArchive">执行归档</a-button>
|
|
|
<a-result
|
|
<a-result
|
|
@@ -38,11 +58,11 @@
|
|
|
>
|
|
>
|
|
|
<template #subTitle>
|
|
<template #subTitle>
|
|
|
<div>共创建了{{ createCount }}个可视数据</div>
|
|
<div>共创建了{{ createCount }}个可视数据</div>
|
|
|
- <div v-for="(item, index) in tableMessages" :key="index">
|
|
|
|
|
- <div>
|
|
|
|
|
|
|
+ <div style="text-align: left;margin-left: 36%;">
|
|
|
|
|
+ <div v-for="(item, index) in tableMessages" :key="index">
|
|
|
{{ index + 1 }}、{{ item.tableName }}表成功归档{{
|
|
{{ index + 1 }}、{{ item.tableName }}表成功归档{{
|
|
|
- item.successExporterData
|
|
|
|
|
- }}条,删除{{ item.deleteSuccess }}条
|
|
|
|
|
|
|
+ item.successExporterCount
|
|
|
|
|
+ }}条,删除{{ item.deleteSuccessCount }}条
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -51,102 +71,147 @@
|
|
|
<a-button @click="checkData">查看归档数据</a-button>
|
|
<a-button @click="checkData">查看归档数据</a-button>
|
|
|
</template>
|
|
</template>
|
|
|
</a-result>
|
|
</a-result>
|
|
|
|
|
+ <Loading v-if="loading" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
import 'dayjs/locale/zh-cn';
|
|
import 'dayjs/locale/zh-cn';
|
|
|
-import { ref, onMounted } from 'vue';
|
|
|
|
|
|
|
+import { ref, reactive, onMounted } from 'vue';
|
|
|
import Common from '../common/Common';
|
|
import Common from '../common/Common';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
-import { getBusinessName, execute } from './config';
|
|
|
|
|
|
|
+import { getBusinessName, getBusinessParams, execute } from './config';
|
|
|
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
|
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
|
|
|
|
|
|
|
|
dayjs.locale('zh-cn');
|
|
dayjs.locale('zh-cn');
|
|
|
|
|
+const selectValue = ref('');
|
|
|
const businessName = ref(''); //业务名
|
|
const businessName = ref(''); //业务名
|
|
|
-const startDate = ref(''); // 开始时间
|
|
|
|
|
-const endDate = ref(''); // 结束时间
|
|
|
|
|
-const linCount = ref(null); // 文件行数
|
|
|
|
|
-const filePath = ref(''); //下载路径
|
|
|
|
|
|
|
+const archiveLogId = ref(''); //下载路径
|
|
|
const isShow = ref(false);
|
|
const isShow = ref(false);
|
|
|
const tableMessages = ref([]); //表
|
|
const tableMessages = ref([]); //表
|
|
|
const createCount = ref(''); //创建的可视数据个数
|
|
const createCount = ref(''); //创建的可视数据个数
|
|
|
const businessNames = ref([]); // 业务名数据
|
|
const businessNames = ref([]); // 业务名数据
|
|
|
|
|
+const allParams = ref([]);
|
|
|
|
|
+const archiveParams = reactive({});
|
|
|
|
|
+const loading = ref(false);
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getName();
|
|
getName();
|
|
|
});
|
|
});
|
|
|
-// 获取业务名
|
|
|
|
|
-const nameChange = (_, { name }) => {
|
|
|
|
|
- businessName.value = name;
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 获取时间类型值
|
|
|
|
|
+const dateChange = (_, dateString, paramName) => {
|
|
|
|
|
+ archiveParams[paramName] = dateString;
|
|
|
};
|
|
};
|
|
|
-// 获取开始时间
|
|
|
|
|
-const startDateChange = (_, dateString) => {
|
|
|
|
|
- startDate.value = dateString;
|
|
|
|
|
|
|
+// 获取文本框类型值
|
|
|
|
|
+const textChange = (e, paramName) => {
|
|
|
|
|
+ archiveParams[paramName] = e.target.value;
|
|
|
};
|
|
};
|
|
|
-// 获取结束时间
|
|
|
|
|
-const endDateChange = (_, dateString) => {
|
|
|
|
|
- endDate.value = dateString;
|
|
|
|
|
|
|
+// 获取数字框类型值
|
|
|
|
|
+const numberChange = (value, paramName) => {
|
|
|
|
|
+ archiveParams[paramName] = value;
|
|
|
|
|
+};
|
|
|
|
|
+// 获取Boolean类型值
|
|
|
|
|
+const checkChange = (e, paramName) => {
|
|
|
|
|
+ archiveParams[paramName] = e.target.checked;
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
// 获取业务名
|
|
// 获取业务名
|
|
|
const getName = () => {
|
|
const getName = () => {
|
|
|
|
|
+ loading.value = true;
|
|
|
getBusinessName().then(
|
|
getBusinessName().then(
|
|
|
success => {
|
|
success => {
|
|
|
|
|
+ loading.value = false;
|
|
|
if (success.errorCode == 0) {
|
|
if (success.errorCode == 0) {
|
|
|
- if (success.data) {
|
|
|
|
|
- success.data.forEach(item => {
|
|
|
|
|
- item.value = item.id;
|
|
|
|
|
|
|
+ if (success.datas) {
|
|
|
|
|
+ success.datas.forEach(item => {
|
|
|
|
|
+ item.value = item.name;
|
|
|
item.label = item.name;
|
|
item.label = item.name;
|
|
|
});
|
|
});
|
|
|
|
|
+ businessNames.value = success.datas;
|
|
|
}
|
|
}
|
|
|
- businessNames.value = success.data;
|
|
|
|
|
} else {
|
|
} else {
|
|
|
message.error(success.errorMessage);
|
|
message.error(success.errorMessage);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
error => {
|
|
error => {
|
|
|
|
|
+ loading.value = false;
|
|
|
Common.processException(error);
|
|
Common.processException(error);
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
+// 获取业务参数
|
|
|
|
|
+const nameChange = (_, { name }) => {
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ businessName.value = name;
|
|
|
|
|
+ getBusinessParams(name).then(
|
|
|
|
|
+ ({ errorCode, datas, errorMessage }) => {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ if (errorCode == 0) {
|
|
|
|
|
+ if (datas) {
|
|
|
|
|
+ datas.forEach(item => {
|
|
|
|
|
+ if (item.displayType == 'DateTimeBoxEditor') {
|
|
|
|
|
+ item.dateValue = dayjs(item.defaultValue, 'YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
+ }
|
|
|
|
|
+ archiveParams[item.paramName] = item.defaultValue;
|
|
|
|
|
+ });
|
|
|
|
|
+ allParams.value = datas;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ message.error(errorMessage);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error => {
|
|
|
|
|
+ loading.value = false;
|
|
|
|
|
+ Common.processException(error);
|
|
|
|
|
+ },
|
|
|
|
|
+ );
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 开始执行
|
|
// 开始执行
|
|
|
const startArchive = () => {
|
|
const startArchive = () => {
|
|
|
|
|
+ loading.value = true;
|
|
|
const params = {
|
|
const params = {
|
|
|
businessName: businessName.value,
|
|
businessName: businessName.value,
|
|
|
- startTime: startDate.value,
|
|
|
|
|
- endTime: endDate.value,
|
|
|
|
|
- maxLines: linCount.value,
|
|
|
|
|
|
|
+ archiveParams,
|
|
|
};
|
|
};
|
|
|
execute(params).then(
|
|
execute(params).then(
|
|
|
success => {
|
|
success => {
|
|
|
|
|
+ loading.value = false;
|
|
|
if (success.errorCode == 0) {
|
|
if (success.errorCode == 0) {
|
|
|
if (success.data) {
|
|
if (success.data) {
|
|
|
isShow.value = true;
|
|
isShow.value = true;
|
|
|
- filePath.value = success.data.visualizationFilePath;
|
|
|
|
|
- tableMessages.value = success.data.tableMessage;
|
|
|
|
|
- createCount.value = success.data.visualizationFileNames.length;
|
|
|
|
|
|
|
+ archiveLogId.value = success.data.archiveLogId;
|
|
|
|
|
+ tableMessages.value = success.data.archiveParams.tableMessages;
|
|
|
|
|
+ createCount.value =
|
|
|
|
|
+ success.data.archiveParams.visualizationFileNames.length;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
message.error(success.errorMessage);
|
|
message.error(success.errorMessage);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
error => {
|
|
error => {
|
|
|
|
|
+ loading.value = false;
|
|
|
Common.processException(error);
|
|
Common.processException(error);
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
// 查看归档数据
|
|
// 查看归档数据
|
|
|
const checkData = () => {
|
|
const checkData = () => {
|
|
|
- const fileUrl = encodeURIComponent(filePath.value);
|
|
|
|
|
|
|
+ loading.value = true;
|
|
|
|
|
+ const fileUrl = encodeURIComponent(archiveLogId.value);
|
|
|
const xhr = new XMLHttpRequest();
|
|
const xhr = new XMLHttpRequest();
|
|
|
- xhr.open('get', `api/IArchiveResource/download?xlsxPath=${fileUrl}`, true);
|
|
|
|
|
|
|
+ xhr.open(
|
|
|
|
|
+ 'get',
|
|
|
|
|
+ `api/ArchivesResource/download?archiveLogId=${fileUrl}`,
|
|
|
|
|
+ true,
|
|
|
|
|
+ );
|
|
|
const token = localStorage.getItem('#token');
|
|
const token = localStorage.getItem('#token');
|
|
|
xhr.setRequestHeader('token', token);
|
|
xhr.setRequestHeader('token', token);
|
|
|
xhr.setRequestHeader('Content-type', 'application/json');
|
|
xhr.setRequestHeader('Content-type', 'application/json');
|
|
|
xhr.responseType = 'blob';
|
|
xhr.responseType = 'blob';
|
|
|
xhr.onreadystatechange = function () {
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
|
|
|
|
+ loading.value = false;
|
|
|
let res = xhr.response;
|
|
let res = xhr.response;
|
|
|
let blob = new Blob([res]);
|
|
let blob = new Blob([res]);
|
|
|
const blobUrl = URL.createObjectURL(blob);
|
|
const blobUrl = URL.createObjectURL(blob);
|
|
@@ -166,10 +231,20 @@ const checkData = () => {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
-:deep(.ant-divider) {
|
|
|
|
|
- margin: 8px 0;
|
|
|
|
|
|
|
+:deep(.ant-divider.ant-divider-horizontal) {
|
|
|
|
|
+ margin: 8px 0 !important;
|
|
|
|
|
+}
|
|
|
|
|
+.commonWidth {
|
|
|
|
|
+ width: 200px;
|
|
|
|
|
+}
|
|
|
|
|
+.ulStyle {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: row;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
}
|
|
}
|
|
|
-.params {
|
|
|
|
|
- margin-left: 8px;
|
|
|
|
|
|
|
+.liStyle {
|
|
|
|
|
+ width: 25%;
|
|
|
|
|
+ margin-top: 8px;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|