添加web查询界面

This commit is contained in:
gongxh
2021-04-30 11:51:01 +08:00
parent c50417c206
commit f4044f46be
19 changed files with 15053 additions and 0 deletions

23
NX.ERP.Webapp/.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
NX.ERP.Webapp/README.md Normal file
View File

@@ -0,0 +1,24 @@
# app
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

635
NX.ERP.Webapp/new 7.txt Normal file
View File

@@ -0,0 +1,635 @@
<template>
<div class="hello">
<h1>统计</h1>
<div>{{ lastTime }}</div>
<!-- <ButtonGroup>
<Button type="success" to="http://10.0.0.3:8877/test.html"
>ERP与WMS库存比较</Button
>
<Button type="warning" @click="handelERPStock">ERP库存比较</Button>
</ButtonGroup> -->
<Divider orientation="right"> </Divider>
<h2>近五日出入库流量</h2>
<Table
size="small"
context-menu
show-context-menu
show-summary
border
stripe
:columns="columns"
:data="datas"
></Table>
<Divider />
<h3>效率</h3>
<echart :options="option1"> </echart>
<h4>故障</h4>
<echart :options="option2"> </echart>
</div>
</template>
<script>
import axios from "axios";
import expandRow from "./table-expand.vue";
import {
numberFormat,
dateFormatFull,
dateFormat,
edit1,
edit2,
show,
} from "@/libs/tools";
import echart from "./custom-chart.vue";
export default {
components: {
expandRow,
echart,
},
name: "HelloWorld",
props: {
msg: String,
},
computed: {
lastTime() {
return dateFormatFull(this.lastUpdate);
},
option1() {
var _xy = [];
this.datas.forEach((item) => {
_xy.push({
product: dateFormat(item.DATE),
托盘: item.tray,
品种: item.gnum,
数量: item.gnuq,
});
// item.add_time = formatTime(item.add_time);
});
return {
legend: {},
tooltip: {},
dataset: {
dimensions: ["product", "托盘", "品种", "数量"],
source: _xy,
},
xAxis: { type: "category" },
yAxis: [
{
type: "value",
name: "托盘/品种",
min: 0,
max: 300,
interval: 50,
axisLabel: {
formatter: "{value} 个",
},
},
{
type: "value",
name: "数量",
min: 0,
max: 10000,
interval: 2500,
axisLabel: {
formatter: "{value} ",
},
},
],
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{
type: "bar",
label: {
show: true,
position: "top",
},
},
{
type: "bar",
label: {
show: true,
position: "top",
},
},
{
type: "line",
yAxisIndex: 1,
label: {
show: true,
position: "top",
},
},
],
};
},
option2() {
var _xy = [];
this.datas.forEach((item) => {
_xy.push({
product: dateFormat(item.DATE),
次数: item.times,
时长: item.duration,
});
// item.add_time = formatTime(item.add_time);
});
return {
legend: {},
tooltip: {},
dataset: {
dimensions: ["product", "次数", "时长"],
source: _xy,
},
xAxis: { type: "category" },
yAxis: [
{
type: "value",
name: "次数",
min: 0,
max: 10,
interval: 1,
axisLabel: {
formatter: "{value} ",
},
},
{
type: "value",
name: "时长/h",
min: 0,
max: 3,
interval: 0.5,
axisLabel: {
formatter: "{value} ",
},
},
],
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{
type: "bar",
label: {
show: true,
position: "top",
},
},
{
type: "line",
yAxisIndex: 1,
label: {
show: true,
position: "top",
},
},
],
};
},
},
data() {
return {
date1: [],
show: false,
datas: [],
details: [],
voucherDetail: null,
showDetails: [],
tag: "",
showTitle: "",
lastUpdate: new Date(),
// cInvCode,
// cInvName,
// cInvStd: "CT-GMSB13-15"
// iQuantity: "1.0000000000"
// price: null
dataCompare: [],
// select RdRecordtype AS '单据类型' ,RdRecordnum250 as '250服务器单据个数',RdRecordnum12 as '12服务器单据个数',balanceRdRecordnum as '个数差异',
// iQuantity250 as '250服务器数量' ,iQuantity12 as '12服务器数量', balanceiQuantity as '数量差异'
// ,iPrice250 as '250服务器金额' ,iPrice12 as '12服务器金额', balanceiPrice as '金额差异'
columns: [
{
title: "日期",
key: "DATE",
render: (h, params) => {
return <div> {dateFormat(params.row.DATE)} </div>;
},
},
{
title: "故障情况",
align: "center",
children: [
{
title: "次数",
key: "times",
align: "center",
render: (h, params) => {
return h("Input", {
props: {
value: params.row.times,
},
on: {
"on-change": (event) => {
<div>
{" "}
{edit1(
dateFormat(params.row.DATE),
event.currentTarget.value
)}{" "}
</div>;
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
},
},
});
},
},
{
title: "时长/h",
key: "duration",
align: "center",
render: (h, params) => {
return h("Input", {
props: {
value: params.row.duration,
},
on: {
"on-change": (event) => {
<div>
{" "}
{edit2(
dateFormat(params.row.DATE),
event.currentTarget.value
)}{" "}
</div>;
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
},
},
});
},
},
{
title: "详情",
key: "action",
width: 150,
align: "center",
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "primary",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
"click": (event) => {
<div>
{" "}
{show(
(params.row.DATE)
)}{" "}
</div>;
},
},
},
"详情"
),
]);
},
},
],
},
{
title: "托盘",
align: "center",
children: [
{
title: "托盘总量",
align: "center",
key: "tray",
className: "demo-table-info-new",
// children: [
// {
// title: "正式服务器",
// align: "right",
// className: "demo-table-info-old",
// key: "rdRecordnum250",
// },
// {
// title: "测试服务器",
// align: "right",
// className: "demo-table-info-new",
// key: "rdRecordnum12",
// },
// // {
// // title: "差异",
// // align: "right",
// // key: "balanceRdRecordnum",
// // className: "demo-table-info-ex",
// // render: (h, params) => {
// // return (
// // <span>
// // {params.row.rdRecordnum250 - params.row.rdRecordnum12}
// // </span>
// // );
// // },
// // },
// ],
},
{
title: "托盘出库量",
align: "center",
key: "trayout",
className: "demo-table-info-old",
},
{
title: "托盘入库量",
align: "center",
key: "trayin",
className: "demo-table-info-old",
},
],
},
{
title: "品种",
align: "center",
children: [
{
title: "出入库品种总量",
align: "center",
key: "gnum",
className: "demo-table-info-new",
},
{
title: "出库品种量",
align: "center",
key: "gnumout",
className: "demo-table-info-old",
},
{
title: "入库品种量",
align: "center",
key: "gnumin",
className: "demo-table-info-old",
},
],
},
{
title: "数量",
align: "center",
children: [
{
title: "出入库总数量",
align: "center",
key: "gnuq",
className: "demo-table-info-new",
},
{
title: "出库数量",
align: "center",
key: "gnuqout",
className: "demo-table-info-old",
},
{
title: "入库数量",
align: "center",
key: "gnuqin",
className: "demo-table-info-old",
},
],
},
// {
// title: "物料数量",
// align: "center",
// children: [
// {
// title: "正式服务器",
// align: "right",
// key: "iQuantity250",
// className: "demo-table-info-old",
// render: (h, params) => {
// return <span>{numberFormat(params.row.iQuantity250)}</span>;
// },
// },
// {
// title: "测试服务器",
// align: "right",
// key: "iQuantity12",
// className: "demo-table-info-new",
// render: (h, params) => {
// return <span>{numberFormat(params.row.iQuantity12)}</span>;
// },
// },
// // {
// // title: "差异",
// // align: "right",
// // key: "balanceiQuantity",
// // className: "demo-table-info-ex",
// // render: (h, params) => {
// // return (
// // <span>
// // {numberFormat(
// // params.row.iQuantity250 - params.row.iQuantity12
// // )}
// // </span>
// // );
// // },
// // },
// ],
// },
// {
// title: "金额",
// align: "center",
// children: [
// {
// align: "right",
// title: "差异",
// key: "balanceiPrice",
// className: "demo-table-info-ex",
// render: (h, params) => {
// return (
// <span>
// {numberFormat(params.row.iPrice250 - params.row.iPrice12)}
// </span>
// );
// },
// },
// ],
// },
],
};
},
mounted() {
setInterval(() => {
this.loadData();
}, 60000);
this.loadData();
},
methods: {
sysAppIds(e) {
console.log(e);
},
onCopy(e) {
console.log(e);
},
// 复制失败
onError(e) {
alert("失败");
},
cancel() {
this.showDetails = [];
this.show = false;
},
handleClick(name) {
this.tag = name;
},
async loadData() {
if (this.loading) {
return;
}
try {
this.loading = true;
var res = await axios.get("/api/erp/wmsxl");
this.datas = res.data;
// var respDetail = await axios.get("/api/erp/detail");
// this.details = respDetail.data;
this.lastUpdate = new Date();
} finally {
this.loading = false;
}
},
rowClassName(row, index) {
if (index === 1) {
return "demo-table-info-row";
} else if (index === 3) {
return "demo-table-error-row";
}
return "";
},
},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>
{
title: "Day",
key: "Day",
align: "center",
render: (h, params) => {
return h("DatePicker", {
props: {
clearable: false,
placeholder: "请选择日期",
transfer: true,
value: params.row.times,
type: "date",
format: "yyyy-MM-dd",
size: "small",
},
on: {
"on-change": (val) => {
<div>
{" "}
{edit1(
dateFormat(params.row.DATE),
dateFormat(val)
)}{" "}
</div>;
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
},
},
});
},
},
{
title: "BeginTime",
key: "BeginTime",
align: "center",
render: (h, params) => {
return h("TimePicker", {
props: {
value: params.row.duration,
},
on: {
"on-change": (val) => {
<div>
{" "}
{edit2(
dateFormat(params.row.DATE),
val
)}{" "}
</div>;
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
},
},
});
},
},

12331
NX.ERP.Webapp/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
{
"name": "app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"dateformat": "^4.5.1",
"echarts": "^5.0.2",
"element-resize-detector": "^1.2.2",
"lodash": "^4.17.21",
"resize-detector": "^0.3.0",
"view-design": "^4.5.0",
"vue": "^2.6.11",
"vue-clipboard2": "^0.3.1",
"vue-echarts": "^6.0.0-rc.3",
"vue-router": "^3.5.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"less": "^4.1.1",
"less-loader": "^8.0.0",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

58
NX.ERP.Webapp/src/App.vue Normal file
View File

@@ -0,0 +1,58 @@
<template>
<div id="app" >
<Menu mode="horizontal" theme="dark" active-name="1">
<Submenu name="3">
<template slot="title">
<Icon type="ios-stats" />
立库运行统计
</template>
<MenuGroup title="使用">
<MenuItem to="/a" name="3-2">运行数据</MenuItem>
<MenuItem to="/b" name="3-3">故障记录</MenuItem>
</MenuGroup>
</Submenu>
</Menu>
<div class="contain" >
<router-view></router-view>
</div>
</div>
</template>
<script>
export default {
name: "App",
components: {
},
methods: {
loadData() {},
},
};
</script>
<style >
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #2c3e50;
background-color: #f8f8f9;
}
.contain
{
padding: 20px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,406 @@
<template>
<div>
<div class="hello">
<div>{{ lastTime }}</div>
<!-- <ButtonGroup>
<Button type="success" to="http://10.0.0.3:8877/test.html"
>ERP与WMS库存比较</Button
>
<Button type="warning" @click="handelERPStock">ERP库存比较</Button>
</ButtonGroup> -->
<Divider orientation="right"> </Divider>
<h2>条件</h2>
<DatePicker type="date" v-model="datecd" placeholder="日期" style="width: 120px"></DatePicker>
<TimePicker
type="time"
v-model="BeginTime"
placeholder="开始时间"
style="width: 120px"
hide-disabled-options
:disabled-hours="[0, 1, 2, 3, 4, 5]"
></TimePicker>
<TimePicker
type="time"
v-model="FinishTime"
placeholder="结束时间"
style="width: 120px"
hide-disabled-options
:disabled-hours="selecthours"
></TimePicker>
<Input v-model="FaultDes" placeholder="故障情况" style="width: 380px" />
<Input v-model="ImproveDes" placeholder="应对内容" style="width: 380px" />
<Input v-model="Opname" placeholder="责任人" style="width: 150px" />
<Button type="primary" icon="ios-search" @click="loadData2">查询</Button>
<Button type="warning" @click="Dataadd">新增</Button>
<h3>故障情况</h3>
<Table size="small" context-menu show-context-menu border stripe :columns="columns" :data="datas"></Table>
<Divider />
</div>
</div>
</template>
<script>
import axios from 'axios'
import expandRow from './table-expand.vue'
import {
numberFormat,
dateFormatFull,
dateFormat,
edit1,
edit2,
updateDay,
updateBeginTime,
updateFinishTime,
updateFaultDes,
updateImproveDes,
updateOpname,
remove,
gethours
} from '@/libs/tools'
import echart from './custom-chart.vue'
export default {
components: {
expandRow,
echart
},
name: 'HelloWorld',
props: {
msg: String
},
computed: {
lastTime() {
return dateFormatFull(this.lastUpdate)
},
selecthours() {
return gethours(this.BeginTime)
}
},
data() {
return {
date1: [],
show: false,
datas: [],
details: [],
voucherDetail: null,
showDetails: [],
datecd: new Date(),
tag: '',
showTitle: '',
BeginTime: '',
FinishTime: '',
FaultDes: '',
ImproveDes: '',
Opname: '',
lastUpdate: new Date(),
// cInvCode,
// cInvName,
// cInvStd: "CT-GMSB13-15"
// iQuantity: "1.0000000000"
// price: null
dataCompare: [],
// select RdRecordtype AS '单据类型' ,RdRecordnum250 as '250服务器单据个数',RdRecordnum12 as '12服务器单据个数',balanceRdRecordnum as '个数差异',
// iQuantity250 as '250服务器数量' ,iQuantity12 as '12服务器数量', balanceiQuantity as '数量差异'
// ,iPrice250 as '250服务器金额' ,iPrice12 as '12服务器金额', balanceiPrice as '金额差异'
columns: [
{
type: 'index',
title: '序号',
width: 60,
align: 'center',
className: 'demo-table-info-old'
},
{
title: '日期',
key: 'Day',
align: 'center',
render: (h, params) => {
return h('DatePicker', {
props: {
clearable: false,
placeholder: '请选择日期',
transfer: true,
value: params.row.Day,
type: 'date',
format: 'yyyy-MM-dd',
size: 'small'
},
on: {
'on-change': (val) => {
;<div> {updateDay(params.row.Id, dateFormat(val))} </div>
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
}
}
})
}
},
{
title: '故障开始时间',
key: 'BeginTime',
align: 'center',
render: (h, params) => {
return h('TimePicker', {
props: {
value: params.row.BeginTime,
transfer: true
},
on: {
'on-change': (val) => {
;<div>{updateBeginTime(params.row.Id, val)} </div>
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
}
}
})
}
},
{
title: '故障结束时间',
key: 'FinishTime',
align: 'center',
render: (h, params) => {
return h('TimePicker', {
props: {
value: params.row.FinishTime,
transfer: true
},
on: {
'on-change': (val) => {
;<div> {updateFinishTime(params.row.Id, val)} </div>
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
}
}
})
}
},
{
title: '故障情况',
key: 'FaultDes',
width: 400,
align: 'center',
render: (h, params) => {
return h('Input', {
props: {
value: params.row.FaultDes
},
on: {
'on-change': (event) => {
;<div> {updateFaultDes(params.row.Id, event.currentTarget.value)} </div>
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
}
}
})
}
},
{
title: '应对内容',
key: 'ImproveDes',
width: 400,
align: 'center',
render: (h, params) => {
return h('Input', {
props: {
value: params.row.ImproveDes
},
on: {
'on-change': (event) => {
;<div> {updateImproveDes(params.row.Id, event.currentTarget.value)} </div>
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
}
}
})
}
},
{
title: '责任人',
width: 160,
key: 'Opname',
align: 'center',
render: (h, params) => {
return h('Input', {
props: {
value: params.row.Opname
},
on: {
'on-change': (event) => {
;<div> {updateOpname(params.row.Id, event.currentTarget.value)} </div>
//console.log("232131")
// this.addPoint.tableData[params.index][params.column.key] =
// event.currentTarget.value; //获取编辑行的inde和编辑字段名,对表格数据进行重新赋值
}
}
})
}
},
{
title: '操作',
key: 'action',
width: 100,
align: 'center',
render: (h, params) => {
return h('div', [
h(
'Button',
{
props: {
type: 'error',
size: 'small'
},
on: {
click: () => {
remove(params.row.Id)
location.reload()
}
}
},
'Delete'
)
])
}
}
]
}
},
mounted() {
this.loadData2()
},
methods: {
sysAppIds(e) {
console.log(e)
},
onCopy(e) {
console.log(e)
},
// 复制失败
onError(e) {
alert('失败')
},
cancel() {
this.showDetails = []
this.show = false
},
handleClick(name) {
this.tag = name
},
async loadData() {
if (this.loading) {
return
}
try {
this.loading = true
var res = await axios.post('/api/Fault/get1', {})
this.datas = res.data
// var respDetail = await axios.get("/api/erp/detail");
// this.details = respDetail.data;
this.lastUpdate = new Date()
} finally {
this.loading = false
}
},
async loadData2() {
if (this.loading) {
return
}
try {
this.loading = true
var res = await axios.post('/api/Fault/get1', {
Day: dateFormat(this.datecd)
})
this.datas = res.data
// var respDetail = await axios.get("/api/erp/detail");
// this.details = respDetail.data;
this.lastUpdate = new Date()
} finally {
this.loading = false
}
},
async Dataadd() {
try {
var res = await axios.post('/api/Fault/addall', {
Day: dateFormat(this.datecd),
BeginTime: this.BeginTime,
FinishTime: this.FinishTime,
FaultDes: this.FaultDes,
ImproveDes: this.ImproveDes,
Opname: this.Opname
})
location.reload()
} finally {
}
},
rowClassName(row, index) {
if (index === 1) {
return 'demo-table-info-row'
} else if (index === 3) {
return 'demo-table-error-row'
}
return ''
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>

View File

@@ -0,0 +1,481 @@
<template>
<div class="hello">
<h1>统计</h1>
<div>{{ lastTime }}</div>
<!-- <ButtonGroup>
<Button type="success" to="http://10.0.0.3:8877/test.html"
>ERP与WMS库存比较</Button
>
<Button type="warning" @click="handelERPStock">ERP库存比较</Button>
</ButtonGroup> -->
<Divider orientation="right"> </Divider>
<h2>近五日出入库流量</h2>
<Table
size="small"
context-menu
show-context-menu
show-summary
border
stripe
:columns="columns"
:data="datas"
></Table>
<Divider />
<h3>效率</h3>
<echart :options="option1"> </echart>
<h4>故障</h4>
<echart :options="option2"> </echart>
</div>
</template>
<script>
import axios from 'axios'
import expandRow from './table-expand.vue'
import { numberFormat, dateFormatFull, dateFormat, edit1, edit2 } from '@/libs/tools'
import echart from './custom-chart.vue'
export default {
components: {
expandRow,
echart
},
name: 'HelloWorld',
props: {
msg: String
},
computed: {
lastTime() {
return dateFormatFull(this.lastUpdate)
},
option1() {
var _xy = []
this.datas.forEach((item) => {
_xy.push({
product: dateFormat(item.DATE),
托盘: item.tray,
品种: item.gnum,
数量: item.gnuq
})
// item.add_time = formatTime(item.add_time);
})
return {
legend: {},
tooltip: {},
dataset: {
dimensions: ['product', '托盘', '品种', '数量'],
source: _xy
},
xAxis: { type: 'category' },
yAxis: [
{
type: 'value',
name: '托盘/品种',
axisLabel: {
formatter: '{value} 个'
}
},
{
type: 'value',
name: '数量',
axisLabel: {
formatter: '{value} '
}
}
],
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{
type: 'bar',
label: {
show: true,
position: 'top'
}
},
{
type: 'bar',
label: {
show: true,
position: 'top'
}
},
{
type: 'line',
yAxisIndex: 1,
label: {
show: true,
position: 'top'
}
}
]
}
},
option2() {
var _xy = []
this.datas.forEach((item) => {
_xy.push({
product: dateFormat(item.DATE),
次数: item.times,
时长: item.duration
})
// item.add_time = formatTime(item.add_time);
})
return {
legend: {},
tooltip: {},
dataset: {
dimensions: ['product', '次数', '时长'],
source: _xy
},
xAxis: { type: 'category' },
yAxis: [
{
type: 'value',
name: '次数',
axisLabel: {
formatter: '{value} '
}
},
{
type: 'value',
name: '时长/min',
axisLabel: {
formatter: '{value} '
}
}
],
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{
type: 'bar',
label: {
show: true,
position: 'top'
}
},
{
type: 'line',
yAxisIndex: 1,
label: {
show: true,
position: 'top'
}
}
]
}
}
},
data() {
return {
date1: [],
show: false,
datas: [],
details: [],
voucherDetail: null,
showDetails: [],
tag: '',
showTitle: '',
lastUpdate: new Date(),
// cInvCode,
// cInvName,
// cInvStd: "CT-GMSB13-15"
// iQuantity: "1.0000000000"
// price: null
dataCompare: [],
// select RdRecordtype AS '单据类型' ,RdRecordnum250 as '250服务器单据个数',RdRecordnum12 as '12服务器单据个数',balanceRdRecordnum as '个数差异',
// iQuantity250 as '250服务器数量' ,iQuantity12 as '12服务器数量', balanceiQuantity as '数量差异'
// ,iPrice250 as '250服务器金额' ,iPrice12 as '12服务器金额', balanceiPrice as '金额差异'
columns: [
{
title: '日期',
key: 'DATE',
render: (h, params) => {
return <div> {dateFormat(params.row.DATE)} </div>
}
},
{
title: '故障情况',
align: 'center',
children: [
{
title: '次数',
align: 'center',
key: 'times',
className: 'demo-table-info-old'
},
{
title: '时长/min',
align: 'center',
key: 'duration',
className: 'demo-table-info-old'
}
]
},
{
title: '托盘',
align: 'center',
children: [
{
title: '托盘总量',
align: 'center',
key: 'tray',
className: 'demo-table-info-new'
// children: [
// {
// title: "正式服务器",
// align: "right",
// className: "demo-table-info-old",
// key: "rdRecordnum250",
// },
// {
// title: "测试服务器",
// align: "right",
// className: "demo-table-info-new",
// key: "rdRecordnum12",
// },
// // {
// // title: "差异",
// // align: "right",
// // key: "balanceRdRecordnum",
// // className: "demo-table-info-ex",
// // render: (h, params) => {
// // return (
// // <span>
// // {params.row.rdRecordnum250 - params.row.rdRecordnum12}
// // </span>
// // );
// // },
// // },
// ],
},
{
title: '托盘出库量',
align: 'center',
key: 'trayout',
className: 'demo-table-info-old'
},
{
title: '托盘入库量',
align: 'center',
key: 'trayin',
className: 'demo-table-info-old'
}
]
},
{
title: '品种',
align: 'center',
children: [
{
title: '出入库品种总量',
align: 'center',
key: 'gnum',
className: 'demo-table-info-new'
},
{
title: '出库品种量',
align: 'center',
key: 'gnumout',
className: 'demo-table-info-old'
},
{
title: '入库品种量',
align: 'center',
key: 'gnumin',
className: 'demo-table-info-old'
}
]
},
{
title: '数量',
align: 'center',
children: [
{
title: '出入库总数量',
align: 'center',
key: 'gnuq',
className: 'demo-table-info-new'
},
{
title: '出库数量',
align: 'center',
key: 'gnuqout',
className: 'demo-table-info-old'
},
{
title: '入库数量',
align: 'center',
key: 'gnuqin',
className: 'demo-table-info-old'
}
]
}
// {
// title: "物料数量",
// align: "center",
// children: [
// {
// title: "正式服务器",
// align: "right",
// key: "iQuantity250",
// className: "demo-table-info-old",
// render: (h, params) => {
// return <span>{numberFormat(params.row.iQuantity250)}</span>;
// },
// },
// {
// title: "测试服务器",
// align: "right",
// key: "iQuantity12",
// className: "demo-table-info-new",
// render: (h, params) => {
// return <span>{numberFormat(params.row.iQuantity12)}</span>;
// },
// },
// // {
// // title: "差异",
// // align: "right",
// // key: "balanceiQuantity",
// // className: "demo-table-info-ex",
// // render: (h, params) => {
// // return (
// // <span>
// // {numberFormat(
// // params.row.iQuantity250 - params.row.iQuantity12
// // )}
// // </span>
// // );
// // },
// // },
// ],
// },
// {
// title: "金额",
// align: "center",
// children: [
// {
// align: "right",
// title: "差异",
// key: "balanceiPrice",
// className: "demo-table-info-ex",
// render: (h, params) => {
// return (
// <span>
// {numberFormat(params.row.iPrice250 - params.row.iPrice12)}
// </span>
// );
// },
// },
// ],
// },
]
}
},
mounted() {
setInterval(() => {
this.loadData()
}, 60000)
this.loadData()
},
methods: {
sysAppIds(e) {
console.log(e)
},
onCopy(e) {
console.log(e)
},
// 复制失败
onError(e) {
alert('失败')
},
cancel() {
this.showDetails = []
this.show = false
},
handleClick(name) {
this.tag = name
},
async loadData() {
if (this.loading) {
return
}
try {
this.loading = true
var res = await axios.get('/api/erp/wmsxl')
this.datas = res.data
// var respDetail = await axios.get("/api/erp/detail");
// this.details = respDetail.data;
this.lastUpdate = new Date()
} finally {
this.loading = false
}
},
rowClassName(row, index) {
if (index === 1) {
return 'demo-table-info-row'
} else if (index === 3) {
return 'demo-table-error-row'
}
return ''
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style >
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.ivu-table .demo-table-info-row td {
background-color: #2db7f5;
color: #fff;
}
.ivu-table .demo-table-error-row td {
background-color: #ff6600;
color: #fff;
}
.ivu-table td.demo-table-info-old {
color: #2db7f5;
}
.ivu-table td.demo-table-info-new {
color: #ff6600;
}
.ivu-table td.demo-table-info-ex {
color: #187;
font-weight: 600;
}
body {
padding: 10px 1;
}
</style>

View File

@@ -0,0 +1,297 @@
<template>
<div class="echarts"/>
</template>
<script>
import * as echarts from 'echarts'
import tdTheme from './theme.json'
import debounce from 'lodash/debounce'
import { addListener, removeListener } from 'resize-detector'
echarts.registerTheme('tdTheme', tdTheme)
// enumerating ECharts events for now
const EVENTS = [
'legendselectchanged',
'legendselected',
'legendunselected',
'legendunscroll',
'datazoom',
'datarangeselected',
'timelinechanged',
'timelineplaychanged',
'restore',
'dataviewchanged',
'magictypechanged',
'geoselectchanged',
'geoselected',
'geounselected',
'pieselectchanged',
'pieselected',
'pieunselected',
'mapselectchanged',
'mapselected',
'mapunselected',
'axisareaselected',
'focusnodeadjacency',
'unfocusnodeadjacency',
'brush',
'brushselected',
'rendered',
'finished',
'click',
'dblclick',
'mouseover',
'mouseout',
'mousemove',
'mousedown',
'mouseup',
'globalout',
'contextmenu'
]
export default {
props: {
options: Object,
theme: {
type: [String, Object],
default: 'tdTheme'
},
initOptions: Object,
group: String,
autoResize: {
type: Boolean,
default: true
},
watchShallow: Boolean,
manualUpdate: Boolean
},
data() {
return {
lastArea: 0
}
},
watch: {
group(group) {
this.chart.group = group
}
},
methods: {
// provide a explicit merge option method
mergeOptions(options, notMerge, lazyUpdate) {
if (this.manualUpdate) {
this.manualOptions = options
}
if (!this.chart) {
this.init()
} else {
this.delegateMethod('setOption', options, notMerge, lazyUpdate)
}
},
// just delegates ECharts methods to Vue component
// use explicit params to reduce transpiled size for now
appendData(params) {
this.delegateMethod('appendData', params)
},
resize(options) {
this.delegateMethod('resize', options)
},
dispatchAction(payload) {
this.delegateMethod('dispatchAction', payload)
},
convertToPixel(finder, value) {
return this.delegateMethod('convertToPixel', finder, value)
},
convertFromPixel(finder, value) {
return this.delegateMethod('convertFromPixel', finder, value)
},
containPixel(finder, value) {
return this.delegateMethod('containPixel', finder, value)
},
showLoading(type, options) {
this.delegateMethod('showLoading', type, options)
},
hideLoading() {
this.delegateMethod('hideLoading')
},
getDataURL(options) {
return this.delegateMethod('getDataURL', options)
},
getConnectedDataURL(options) {
return this.delegateMethod('getConnectedDataURL', options)
},
clear() {
this.delegateMethod('clear')
},
dispose() {
this.delegateMethod('dispose')
},
delegateMethod(name, ...args) {
if (!this.chart) {
this.init()
}
return this.chart[name](...args)
},
delegateGet(name, method) {
if (!this.chart) {
this.init()
}
return this.chart[method]()
},
getArea() {
return this.$el.offsetWidth * this.$el.offsetHeight
},
init() {
if (this.chart) {
return
}
let chart = echarts.init(this.$el, this.theme, this.initOptions)
if (this.group) {
chart.group = this.group
}
chart.setOption(this.manualOptions || this.options || {}, true)
// expose ECharts events as custom events
EVENTS.forEach(event => {
chart.on(event, params => {
this.$emit(event, params)
})
})
if (this.autoResize) {
this.lastArea = this.getArea()
this.__resizeHandler = debounce(
() => {
if (this.lastArea === 0) {
// emulate initial render for initially hidden charts
this.mergeOptions({}, true)
this.resize()
this.mergeOptions(this.options || this.manualOptions || {}, true)
} else {
this.resize()
}
this.lastArea = this.getArea()
},
100,
{ leading: true }
)
addListener(this.$el, this.__resizeHandler)
}
Object.defineProperties(this, {
// Only recalculated when accessed from JavaScript.
// Won't update DOM on value change because getters
// don't depend on reactive values
width: {
configurable: true,
get: () => {
return this.delegateGet('width', 'getWidth')
}
},
height: {
configurable: true,
get: () => {
return this.delegateGet('height', 'getHeight')
}
},
isDisposed: {
configurable: true,
get: () => {
return !!this.delegateGet('isDisposed', 'isDisposed')
}
},
computedOptions: {
configurable: true,
get: () => {
return this.delegateGet('computedOptions', 'getOption')
}
}
})
this.chart = chart
},
destroy() {
if (this.autoResize) {
removeListener(this.$el, this.__resizeHandler)
}
this.dispose()
this.chart = null
},
refresh() {
if (this.chart) {
this.destroy()
this.init()
}
}
},
created() {
if (!this.manualUpdate) {
this.$watch(
'options',
(val, oldVal) => {
if (!this.chart && val) {
this.init()
} else {
// mutating `options` will lead to merging
// replacing it with new reference will lead to not merging
// eg.
// `this.options = Object.assign({}, this.options, { ... })`
// will trigger `this.chart.setOption(val, true)
// `this.options.title.text = 'Trends'`
// will trigger `this.chart.setOption(val, false)`
this.chart.setOption(val, val !== oldVal)
}
},
{ deep: !this.watchShallow }
)
}
let watched = [
'theme',
'initOptions',
'autoResize',
'manualUpdate',
'watchShallow'
]
watched.forEach(prop => {
this.$watch(
prop,
() => {
this.refresh()
},
{ deep: true }
)
})
},
mounted() {
// auto init if `options` is already provided
if (this.options) {
this.init()
}
},
activated() {
if (this.autoResize) {
this.chart && this.chart.resize()
}
},
beforeDestroy() {
if (!this.chart) {
return
}
this.destroy()
},
connect(group) {
if (typeof group !== 'string') {
group = group.map(chart => chart.chart)
}
echarts.connect(group)
},
disconnect(group) {
echarts.disConnect(group)
},
registerMap(mapName, geoJSON, specialAreas) {
echarts.registerMap(mapName, geoJSON, specialAreas)
},
registerTheme(name, theme) {
echarts.registerTheme(name, theme)
},
graphic: echarts.graphic
}
</script>
<style>
.echarts {
height: 300px;
}
</style>

View File

@@ -0,0 +1,42 @@
<template>
<div>
{{ row.cInvCode }}
{{ row.cInvName }}
<Row :gutter="16">
<Col span="12"
><Card :padding="0" title="正式ERP库存" icon="ios-options">
<CellGroup>
<Cell
v-for="item in row.postCounts250"
:title="item.cPosName"
:key="`item-${item.cPosName}`"
:extra="item.qty"
/>
</CellGroup> </Card
></Col>
<Col span="12">
<Card :padding="0" title="测试ERP库存" icon="ios-options">
<CellGroup>
<Cell
v-for="item in row.postCounts12"
:title="item.cPosName"
:key="`item-${item.cPosName}`"
:extra="item.qty"
/>
</CellGroup> </Card
></Col>
</Row>
</div>
</template>
<script>
export default {
props: {
row: Object,
},
};
</script>
<style>
</style>

View File

@@ -0,0 +1,490 @@
{
"color": [
"#2d8cf0",
"#19be6b",
"#ff9900",
"#E46CBB",
"#9A66E4",
"#ed3f14"
],
"backgroundColor": "rgba(0,0,0,0)",
"textStyle": {},
"title": {
"textStyle": {
"color": "#516b91"
},
"subtextStyle": {
"color": "#93b7e3"
}
},
"line": {
"itemStyle": {
"normal": {
"borderWidth": "2"
}
},
"lineStyle": {
"normal": {
"width": "2"
}
},
"symbolSize": "6",
"symbol": "emptyCircle",
"smooth": true
},
"radar": {
"itemStyle": {
"normal": {
"borderWidth": "2"
}
},
"lineStyle": {
"normal": {
"width": "2"
}
},
"symbolSize": "6",
"symbol": "emptyCircle",
"smooth": true
},
"bar": {
"itemStyle": {
"normal": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
},
"emphasis": {
"barBorderWidth": 0,
"barBorderColor": "#ccc"
}
}
},
"pie": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"scatter": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"boxplot": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"parallel": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"sankey": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"funnel": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"gauge": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
},
"emphasis": {
"borderWidth": 0,
"borderColor": "#ccc"
}
}
},
"candlestick": {
"itemStyle": {
"normal": {
"color": "#edafda",
"color0": "transparent",
"borderColor": "#d680bc",
"borderColor0": "#8fd3e8",
"borderWidth": "2"
}
}
},
"graph": {
"itemStyle": {
"normal": {
"borderWidth": 0,
"borderColor": "#ccc"
}
},
"lineStyle": {
"normal": {
"width": 1,
"color": "#aaa"
}
},
"symbolSize": "6",
"symbol": "emptyCircle",
"smooth": true,
"color": [
"#2d8cf0",
"#19be6b",
"#f5ae4a",
"#9189d5",
"#56cae2",
"#cbb0e3"
],
"label": {
"normal": {
"textStyle": {
"color": "#eee"
}
}
}
},
"map": {
"itemStyle": {
"normal": {
"areaColor": "#f3f3f3",
"borderColor": "#516b91",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "rgba(165,231,240,1)",
"borderColor": "#516b91",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#000"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(81,107,145)"
}
}
}
},
"geo": {
"itemStyle": {
"normal": {
"areaColor": "#f3f3f3",
"borderColor": "#516b91",
"borderWidth": 0.5
},
"emphasis": {
"areaColor": "rgba(165,231,240,1)",
"borderColor": "#516b91",
"borderWidth": 1
}
},
"label": {
"normal": {
"textStyle": {
"color": "#000"
}
},
"emphasis": {
"textStyle": {
"color": "rgb(81,107,145)"
}
}
}
},
"categoryAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"valueAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"logAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"timeAxis": {
"axisLine": {
"show": true,
"lineStyle": {
"color": "#cccccc"
}
},
"axisTick": {
"show": false,
"lineStyle": {
"color": "#333"
}
},
"axisLabel": {
"show": true,
"textStyle": {
"color": "#999999"
}
},
"splitLine": {
"show": true,
"lineStyle": {
"color": [
"#eeeeee"
]
}
},
"splitArea": {
"show": false,
"areaStyle": {
"color": [
"rgba(250,250,250,0.05)",
"rgba(200,200,200,0.02)"
]
}
}
},
"toolbox": {
"iconStyle": {
"normal": {
"borderColor": "#999"
},
"emphasis": {
"borderColor": "#666"
}
}
},
"legend": {
"textStyle": {
"color": "#999999"
}
},
"tooltip": {
"axisPointer": {
"lineStyle": {
"color": "#ccc",
"width": 1
},
"crossStyle": {
"color": "#ccc",
"width": 1
}
}
},
"timeline": {
"lineStyle": {
"color": "#8fd3e8",
"width": 1
},
"itemStyle": {
"normal": {
"color": "#8fd3e8",
"borderWidth": 1
},
"emphasis": {
"color": "#8fd3e8"
}
},
"controlStyle": {
"normal": {
"color": "#8fd3e8",
"borderColor": "#8fd3e8",
"borderWidth": 0.5
},
"emphasis": {
"color": "#8fd3e8",
"borderColor": "#8fd3e8",
"borderWidth": 0.5
}
},
"checkpointStyle": {
"color": "#8fd3e8",
"borderColor": "rgba(138,124,168,0.37)"
},
"label": {
"normal": {
"textStyle": {
"color": "#8fd3e8"
}
},
"emphasis": {
"textStyle": {
"color": "#8fd3e8"
}
}
}
},
"visualMap": {
"color": [
"#516b91",
"#59c4e6",
"#a5e7f0"
]
},
"dataZoom": {
"backgroundColor": "rgba(0,0,0,0)",
"dataBackgroundColor": "rgba(255,255,255,0.3)",
"fillerColor": "rgba(167,183,204,0.4)",
"handleColor": "#a7b7cc",
"handleSize": "100%",
"textStyle": {
"color": "#333"
}
},
"markPoint": {
"label": {
"normal": {
"textStyle": {
"color": "#eee"
}
},
"emphasis": {
"textStyle": {
"color": "#eee"
}
}
}
}
}

View File

@@ -0,0 +1,91 @@
import formatDate from "dateformat"
import axios from "axios"
export const dateFormat = (date) => {
return formatDate(date, 'yyyy-mm-dd')
}
export const dateFormatFull = (date) => {
return formatDate(date, 'yyyy-mm-dd HH:MM:ss')
}
export const numberFormat = (data) => {
if (data != null) {
return data.toFixed(2).replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
} else {
return ''
}
}
export const edit2 = (k,data) => {
var aa =axios.post("/api/erp/wmsgz1",{date: k,duration:data});
return aa
}
export const edit1 = (k,data) => {
var aa =axios.post("/api/erp/wmsgz2",{date: k,times:data});
return aa
}
export const updateDay = (k,data) => {
var aa =axios.post("/api/Fault/updateDay",{Id:k,Day:data});
return aa
}
export const updateBeginTime = (k,data) => {
var aa =axios.post("/api/Fault/updateBeginTime",{Id: k,BeginTime:data});
return aa
}
export const updateFinishTime = (k,data) => {
var aa =axios.post("/api/Fault/updateFinishTime",{Id: k,FinishTime:data});
return aa
}
export const updateFaultDes = (k,data) => {
var aa =axios.post("/api/Fault/updateFaultDes",{Id: k,FaultDes:data});
return aa
}
export const updateImproveDes = (k,data) => {
var aa =axios.post("/api/Fault/updateImproveDes",{Id: k,ImproveDes:data});
return aa
}
export const updateOpname = (k,data) => {
var aa =axios.post("/api/Fault/updateOpname",{Id: k,Opname:data});
return aa
}
export const remove = (k) => {
var aa =axios.post("/api/Fault/updatedelete",{Id: k});
return aa
}
export const gethours = (k) => {
var allHours=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23];
let ar = allHours.filter(function(elem) {
return elem < Number(k.split(":")[0]);
});
return ar
}
export const pageingData = (data, pagesize, index) => {
if (!data) return []
let pageNo = 1
if (typeof index === 'function') {
let _index = date.findIndex(index)
pageNo = index > 0 ? 1 : Math.ceil(_index / pagesize)
} else if (typeof index === 'number') {
pageNo = index
}
var offset = (pageNo - 1) * pagesize
return offset + pagesize >= data.length ? data.slice(offset, data.length) : data.slice(offset, offset + pagesize)
}

32
NX.ERP.Webapp/src/main.js Normal file
View File

@@ -0,0 +1,32 @@
import Vue from "vue";
import App from "./App.vue";
import ViewUI from "view-design";
import "view-design/dist/styles/iview.css";
import VueClipboard from "vue-clipboard2";
import HelloWorld from "./components/HelloWorld.vue";
import Fault from './components/Fault.vue'
import VueRouter from "vue-router";
const routes=[
{
path: '/',
name: '_home',
redirect: '/a'
},
{ path: '/a', component: HelloWorld },
{ path: '/b', component: Fault }
]
Vue.use(VueRouter);
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
})
Vue.config.productionTip = false;
Vue.use(ViewUI);
Vue.use(VueClipboard);
new Vue({ router, render: (h) => h(App) }).$mount("#app");

View File

View File

@@ -0,0 +1,67 @@
const path = require('path')
const resolve = dir => {
return path.join(__dirname, dir)
}
// 项目部署基础
// 默认情况下,我们假设你的应用将被部署在域的根目录下,
// 例如:https://www.my-app.com/
// 默认:'/'
// 如果您的应用程序部署在子路径中,则需要在这指定子路径
// 例如:https://www.foobar.com/my-app/
// 需要将它改为'/my-app/'
const BASE_URL = process.env.NODE_ENV === 'production' ? '/' : '/'
// const webPath = "../publish/wwwroot";
// const webPath = './dist'
const webPath = '../publish/wwwroot'
module.exports = {
transpileDependencies: ['resize-detector'],
// Project deployment base
// By default we assume your app will be deployed at the root of a domain,
// e.g. https://www.my-app.com/
// If your app is deployed at a sub-path, you will need to specify that
// sub-path here. For example, if your app is deployed at
// https://www.foobar.com/my-app/
// then change this to '/my-app/'
publicPath: BASE_URL,
outputDir: webPath,
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// 如果你不需要使用eslint,把lintOnSave设为false即可
lintOnSave: true,
chainWebpack: config => {
config.resolve.alias
.set('_api', resolve('src/api'))
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set('_c', resolve('src/components'))
.set('_conf', resolve('config'))
.set('_v', resolve('src/view'))
config.module
.rule('ivuew')
.test(/ivuew.src.*?js$/)
.use('bable')
.loader('bable-loader')
.end()
// config.externals({
// vue: 'vue',
// vuex: 'vuex',
// 'vue-router': "'vue-router'",
// 'element-ui': "'element-ui'"
// })
},
// 打包时不生成.map文件
productionSourceMap: false,
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
devServer: {
disableHostCheck: true,
proxy: {
'/api': {
target: 'http://localhost:5000', // 接口域名
changeOrigin: true, // 是否跨域
pathRewrite: {}
}
}
}
}