数据同步信息维护

master
hongtianzai 3 years ago
parent f60b263786
commit e121775242

959
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -33,6 +33,7 @@
"@vue/test-utils": "^1.0.0-beta.16",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"sass": "^1.45.1",
"sass-loader": "^7.0.1",
"vue-template-compiler": "^2.5.16"
},

@ -1,3 +1,4 @@
{
"BASE_URL":"https://www.udims.com/UDIC_UDI_Server"
"BASE_URL":"http://localhost:9995/",
"Download_URL": "http://localhost:9994/"
}

@ -0,0 +1,9 @@
import request from "@/utils/request";
export function getFileList(param){
return request({
url:"/file/getlist",
method:"post",
data:param
})
}

@ -0,0 +1,17 @@
import request from "@/utils/request";
export function logList(param){
return request({
url: "/jobLog/list",
method: "post",
data: param
});
}
export function downloadByDay(day){
return request({
url: "/udidl/device/dlByDay",
method: "get",
params:{day:day}
})
}

@ -14,7 +14,8 @@ import IconSvg from "./components/common/IconSvg.vue"; // svg组件
import { BASE_URL } from "./config/app"
import axios from "axios";
import "../public/config.json";
import myReq from "./utils/axios"
import myReq from "./utils/axios";
import request from "@/utils/request";
// 注册全局组件register global
Vue.component("icon-svg", IconSvg);
axios.defaults.withCredentials = true
@ -31,7 +32,7 @@ let startApp = function () {
// 基础地址
getUrl = res.data.BASE_URL;
myReq.defaults.baseURL = getUrl;
request.defaults.baseURL = res.data.Download_URL;
new Vue({
router,
store,

@ -47,8 +47,8 @@ import UnitRelevance from "../views/product/UnitRelevance.vue";
import customerCodeContrast from "../views/sale/customerCodeContrast.vue";
import codecontrast from "../views/sale/codeContrast.vue";
import udiTrace from "../views/warehouse/udiTrace.vue";
import jobLog from"../views/UDIDownload/jobLog"
import fileInfo from "../views/UDIDownload/fielInfo"
import mipsOrder from "../views/manuorder/manuOrder.vue"
import manuDetail from "../views/manuorder/manuOrderDetail.vue"
@ -577,5 +577,37 @@ export const asyncRouterMap = [
]
},
{
path: "/UDIDownload",
component: Home,
redirect: "/UDIDownload/jobLog",
icon: "tongyong",
name: "数据同步信息",
noDropdown: false,
hidden: false,
meta: {
authRule: ["UDIDownload"]
},
children: [
{
name: "同步日志",
path: "jobLog",
component: jobLog,
meta: {
authRule: ["UDIDownload/jobLog"]
},
},
{
name: "同步文件",
path: "fileInfo",
component: fileInfo,
meta: {
authRule: ["UDIDownload/fileInfo"]
},
}
]
}
];

@ -0,0 +1,26 @@
import axios from 'axios'
import {Message} from 'element-ui'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL:'',
// 超时
timeout: 30000
})
service.interceptors.response.use(res=>{
const status = Number(res.status) || 200;
console.log(res);
if (status !== 200) {
Message({
message: res.statusText,
type: 'error'
})
return Promise.reject(new Error(res.statusText))
} else {
console.log(res.data);
return res.data
}
})
export default service

@ -0,0 +1,153 @@
<template>
<div>
<el-card class="el-card">
<el-form :inline="true">
<el-form-item>
<span style="color: #000; margin-left: 10px; margin-right: 6px"
>日期:</span
>
<el-date-picker
:picker-options="pickerOptions"
v-model="dateRange"
type="daterange"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="search" @click="download()"
>重新下载
</el-button
>
<el-button>刷新</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableData" border stripe>
<el-table-column label="文件名" align="center" prop="fileName">
<template slot-scope="scope">
<a :href="'/files/'+scope.row.fileName" :download="scope.row.fileName">{{ scope.row.fileName }}</a>
</template>
</el-table-column>
<el-table-column label="行数" align="center" prop="count" :show-overflow-tooltip="true"/>
<el-table-column label="文件大小" align="center" prop="fileSize" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ getFileSize(scope.row.fileSize) }}
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
</el-table>
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="queryParams.page"
:page-sizes="[100, 200, 300, 400]"
:page-size="queryParams.limit"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</el-card>
</div>
</template>
<script>
import {getFileList} from "@/api/UDIDownload/fileInfo";
export default {
name: "fileInfo",
data() {
return {
tableData: [],
loading: true,
total: 0,
dateRange:[],
queryParams: {
page: 1,
limit: 15
},
pickerOptions: {
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
},
},
],
}
}
},
created() {
this.getList();
},
methods: {
handleSizeChange(val) {
console.log(`每页 ${val}`);
this.getList();
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.getList();
this.page++;
},
getList() {
getFileList(this.queryParams).then(res => {
this.tableData = res.data.list;
this.total = res.data.total;
this.loading = false;
})
},
/**
* 重新下载文件
*/
download(){
},
getFileSize(size) {
let res = "";
if (size > 0) {
if (size > 1000 * 1000)
res = (size / (1000 * 1000)).toFixed(2) + "M";
else if (size > 1000)
res = (size / 1000).toFixed(2) + "k";
else
res = size + "byte";
}
return res;
}
}
}
</script>
<style scoped>
a {
text-decoration: none;
color: #3683be;
}
</style>

@ -0,0 +1,263 @@
<template>
<div>
<el-card class="el-card">
<el-form
:inline="true"
:model="queryParams"
size="mini"
>
<el-form-item class="query-form-item" label="类型">
<el-select
v-model="queryParams.type"
placeholder="类型"
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<span style="color: #000; margin-left: 10px; margin-right: 6px"
>创建日期:</span
>
<el-date-picker
:picker-options="pickerOptions"
v-model="dateRange"
type="daterange"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button
type="primary"
icon="el-icon-refresh"
@click="onReset"
></el-button>
<el-button type="primary" icon="search" @click="onSubmit"
>查询
</el-button
>
</el-button-group>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="list"
style="width: 100%"
>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="类型" prop="type">
<template slot-scope="scope">
<span>{{ getType(scope.row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="日期" prop="downloadDate"/>
<el-table-column label="提示行数" prop="totalCount"/>
<el-table-column label="实际行数" prop="realCount"/>
<el-table-column label="插入行数" prop="insertCount"/>
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
<el-table-column label="操作" fixed="right" width="130">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.s.stop="downloadData(scope.row.downloadDate)">
重新下载
</el-button>
<el-button
type="text"
size="small"
@click.native.stop="showContent(scope.row)"
>详情
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-size="queryParams.limit"
@current-change="handleCurrentChange"
layout="prev, pager, next"
:total="total"
></el-pagination>
</el-card>
<el-dialog
title="提示"
:visible.sync="dialog.visible"
width="70%">
<span>类型</span><span>{{dialog.type}}</span>
<el-divider></el-divider>
<span>消息</span><span>{{dialog.msg}}</span>
<el-divider></el-divider>
<span>详情</span><span>{{ dialog.content }}</span>
</el-dialog>
</div>
</template>
<script>
import {logList,downloadByDay} from "@/api/UDIDownload/jobLog"
export default {
name: "jobLog",
data() {
return {
dateRange: [],
typeOptions: [{value: "", label: "全部"}, {value: "error", label: "错误信息"}, {
value: "warning",
label: "警告信息"
}, {value: "info", label: "正常信息"}],
queryParams: {
page: 1,
limit: 10,
type: ""
},
loading: false,
list: [],
total: 0,
dialog: {
visible: false,
type:"",
msg:"",
content: ""
},
pickerOptions: {
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
},
},
],
},
}
},
created() {
this.getList();
},
methods: {
getList() {
logList(this.addDateRange(this.queryParams, this.dateRange)).then(res => {
this.loading = false;
this.list = res.data.list || [];
this.total = res.data.total || 0;
})
},
handleCurrentChange(val) {
this.queryParams.page = val;
this.getList();
},
onReset() {
this.$router.push({
path: "",
});
this.queryParams = {
page: 1,
limit: 10,
type: ""
};
this.dateRange = [];
this.getList();
},
onSubmit() {
this.getList();
},
getType(type) {
for (let i = 0; i < this.typeOptions.length; i++) {
if (this.typeOptions[i].value == type)
return this.typeOptions[i].label;
}
return "未知";
},
showContent(row) {
console.log(JSON.stringify(row));
this.dialog.type = row.type;
this.dialog.msg = row.msg;
this.dialog.content = row.content;
this.dialog.visible = true;
},
downloadData(fdate) {
if(fdate == null || fdate == "")
{
this.$message.error("日期为空,无法下载!");
return;
}
let _this=this;
this.$confirm("是否重新下载日期:"+fdate+"的数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
downloadByDay(fdate).then(res=>{
let msg='已发送下载指令,请稍等查看日志,防止同时下载!';
//_this.$message.info(msg);
_this.$message({
type: 'info',
message:msg
});
});
})
.catch(() => {
_this.$message({
type: 'error',
message:"发生错误!"
});
});
},
//
addDateRange(params, dateRange) {
let search = params;
search.startDate = null
search.endDate = null;
if (null != dateRange && '' != dateRange) {
search.startDate = dateRange[0];
search.endDate = dateRange[1];
}
return search;
}
}
}
</script>
<style scoped>
</style>

@ -280,10 +280,10 @@ export default {
this.getList();
},
onSubmit() {
this.$router.push({
/* this.$router.push({
path: "",
query: this.query,
});
});*/
this.getList();
},
handleCurrentChange(val) {

Loading…
Cancel
Save