This commit is contained in:
朱文强 2024-12-13 12:56:40 +08:00
parent 8ad8e3a5b4
commit 77259329d9
22 changed files with 869 additions and 62 deletions

View File

@ -52,3 +52,12 @@ export function exportRawCostStatisticsHisExcel(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }
// 获得成本首页 -获取首页数据
export function getData(query) {
return request({
url: '/monitoring/cost-homepage/getData',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 获得环保数据历史分页
export function getCostEnviHisPage(query) {
return request({
url: '/monitoring/cost-envi-his/page',
method: 'get',
params: query
})
}

BIN
src/assets/img/home-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

View File

@ -76,7 +76,7 @@ export const constantRoutes = [
children: [ children: [
{ {
path: "index", path: "index",
component: (resolve) => require(["@/views/cost/raw/costMaterial/index"], resolve), component: (resolve) => require(["@/views/cost/index"], resolve),
name: "首页", name: "首页",
meta: { title: "首页", icon: "dashboard", affix: true }, meta: { title: "首页", icon: "dashboard", affix: true },
hidden: true hidden: true

View File

@ -0,0 +1,125 @@
<!--
* @Author: zwq
* @Date: 2024-11-13 14:01:16
* @LastEditors: zwq
* @LastEditTime: 2024-11-13 15:36:35
* @Description:
-->
<template>
<div>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH" />
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</div>
</template>
<script>
import basicPage from '@/mixins/basic-page';
import { getCostEnviHisPage } from '@/api/environmental/environmentalLog';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recTime',
label: '记录时间',
filter: parseTime,
minWidth: 150,
},
{
prop: 'remark',
label: '备注',
},
{
prop: 'envi1',
label: '二氧化硫mg/Nm3',
},
{
prop: 'envi2',
label: '氮氧化物mg/Nm3',
},
{
prop: 'envi3',
label: '粉尘mg/Nm3',
},
];
export default {
name: '',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getCostEnviHisPage,
},
formConfig: [
{
type: 'datePicker',
label: '时间',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
width: 350,
param: 'searchTime',
clearable: false,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
tableProps,
tableData: [],
};
},
components: {},
created() {
const end = new Date();
const start = new Date();
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig[0].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig[0].endPlaceholder = parseTime(end).substr(0, 10);
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.statisticType = 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime ? val.searchTime[1] : null;
this.getDataList();
break;
default:
console.log(val);
}
},
},
};
</script>
<style lang="scss"></style>

View File

@ -65,7 +65,7 @@ const tableProps = [
}, },
{ {
prop: 'price', prop: 'price',
label: '单价(元/)', label: '单价(元/千克)',
align: 'right', align: 'right',
}, },
{ {

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -334,6 +334,13 @@ export default {
this.otherMethods(val); this.otherMethods(val);
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
let exportURL, title; let exportURL, title;

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -90,6 +90,10 @@ const tableProps = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'energyTypeName', prop: 'energyTypeName',
label: '能源类型', label: '能源类型',
@ -115,6 +119,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'energyTypeName', prop: 'energyTypeName',
label: '能源类型', label: '能源类型',
@ -329,6 +337,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
if (this.listQuery.startTime) { if (this.listQuery.startTime) {

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -91,6 +91,10 @@ const tableProps = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'otherCostName', prop: 'otherCostName',
label: '成本名称', label: '成本名称',
@ -102,6 +106,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'otherCostName', prop: 'otherCostName',
label: '成本名称', label: '成本名称',
@ -304,6 +312,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
getRawOthercostSunPage(this.listQuery).then((response) => { getRawOthercostSunPage(this.listQuery).then((response) => {

View File

@ -52,7 +52,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -89,6 +89,10 @@ const tableProps = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'productionLineName', prop: 'productionLineName',
label: '产线', label: '产线',
@ -117,6 +121,10 @@ const tableProps2 = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'productionLineName', prop: 'productionLineName',
label: '产线', label: '产线',
@ -309,6 +317,13 @@ export default {
this.otherMethods(val); this.otherMethods(val);
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
successSubmit() { successSubmit() {
this.handleCancel(); this.handleCancel();
const val = this.activeName === 'his' ? '产线良品率' : 'now'; const val = this.activeName === 'his' ? '产线良品率' : 'now';

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -91,6 +91,10 @@ const tableProps = [
label: '时间', label: '时间',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'bindObjectName', prop: 'bindObjectName',
label: '产线', label: '产线',
@ -129,6 +133,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'bindObjectName', prop: 'bindObjectName',
label: '产线', label: '产线',
@ -355,6 +363,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
if (this.listQuery.startTime) { if (this.listQuery.startTime) {

410
src/views/cost/index.vue Normal file
View File

@ -0,0 +1,410 @@
<template>
<div class="home-page">
<div class="date-tabs">
<el-tabs v-model="activeName" @tab-click="handleClick" :stretch="true">
<el-tab-pane
:label="'\u2002\u2002日\u2002\u2002'"
name="日"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002周\u2002\u2002'"
name="周"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002月\u2002\u2002'"
name="月"></el-tab-pane>
<el-tab-pane
:label="'\u2002\u2002年\u2002\u2002'"
name="年"></el-tab-pane>
</el-tabs>
<div class="current-date">( {{ showTime }} )</div>
<div class="current-time">
<span style="display: inline-block; margin-right: 16px">
{{ topTime + timeZone }}
</span>
<span>{{ topDate }}</span>
</div>
</div>
<el-row class="main-top" :gutter="16">
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">生产总成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceS }}万元</div>
<div class="unit-style">总计成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.matPriceS }}万元</div>
<div class="unit-style">原料成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceS }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceS }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioS }}</div>
<div class="unit-style">综合良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceS }}</div>
<div class="unit-style">综合每平米成本</div>
</el-col>
</el-row>
</el-col>
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">原片成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceO }}万元</div>
<div class="unit-style">原片总成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.matPriceO }}万元</div>
<div class="unit-style">原料成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceO }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceO }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioO }}</div>
<div class="unit-style">原片良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceO }}</div>
<div class="unit-style">原片每平米成本</div>
</el-col>
</el-row>
</el-col>
<el-col :span="24" style="position: relative">
<div class="title">
<svg-icon icon-class="home-produce" />
<span class="title-inner">深加工成本</span>
</div>
<el-row class="box">
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.priceD }}万元</div>
<div class="unit-style">深加工总成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.energyPriceD }}万元</div>
<div class="unit-style">能源成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.otherPriceD }}万元</div>
<div class="unit-style">其他成本</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.ratioD }}</div>
<div class="unit-style">深加工良品率/%</div>
</el-col>
<el-col :span="4" class="num-box shadow">
<div class="num-style">{{ homeData.areaPriceD }}</div>
<div class="unit-style">深加工每平米成本</div>
</el-col>
</el-row>
</el-col>
</el-row>
<el-row class="main-bottom" :gutter="16" v-if="false">
<el-col :span="9">
<div class="chart-wrapper">
<line-chart :chart-data="lineChartData" />
</div>
</el-col>
<el-col :span="7">
<div class="chart-wrapper">
<pie-chart />
</div>
</el-col>
<el-col :span="8">
<div class="chart-wrapper">
<bar-chart />
</div>
</el-col>
</el-row>
<div
class="main-footer"
style="
color: #c7c7c7;
user-select: none;
font-size: 14px;
letter-spacing: 1px;
height: 30px;
display: grid;
place-content: center;
">
&copy; 中建材智能自动化研究院有限公司
</div>
</div>
</template>
<script>
import moment from 'moment';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import LineChart from '../dashboard/LineChart';
import PieChart from '../dashboard/PieChart';
import BarChart from '../dashboard/BarChart';
import PanelGroup from '../dashboard/PanelGroup';
import { getData } from '@/api/cost/allCost';
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
actualData: [120, 82, 91, 154, 162, 140, 145],
},
messages: {
expectedData: [200, 192, 120, 144, 160, 130, 140],
actualData: [180, 160, 151, 106, 145, 150, 130],
},
purchases: {
expectedData: [80, 100, 121, 104, 105, 90, 100],
actualData: [120, 90, 100, 138, 142, 130, 130],
},
shoppings: {
expectedData: [130, 140, 141, 142, 145, 150, 160],
actualData: [120, 82, 91, 154, 162, 140, 130],
},
};
export default {
name: 'Home',
mixins: [tableHeightMixin],
components: {
LineChart,
PieChart,
PanelGroup,
BarChart,
},
computed: {
gradientBackground() {
return {
'background-image':
'linear-gradient(90deg, #f0f0f0 25%, rgba(255, 255, 255, 0) 25%, rgba(255, 255, 255, 0) 50%, #f0f0f0 50%, #f0f0f0 75%, rgba(255, 255, 255, 0) 75%, rgba(255, 255, 255, 0))',
'background-size': '100px 100px', //
};
},
},
data() {
return {
activeName: '日',
topDate: '',
topTime: '',
timeZone: '',
lineChartData: lineChartData.newVisitis,
homeData: {},
startTime:
moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD') +
' 00:00:00',
endTime:
moment(new Date()).subtract(-1, 'days').format('YYYY-MM-DD') +
' 00:00:00',
};
},
created() {
this.getTime();
this.handleClick();
this.showTime = moment(new Date()).subtract(0, 'days').format('YYYY-MM-DD');
this.getData();
},
beforeDestroy() {
clearInterval(this.timer);
},
methods: {
getData() {
let listQuery = {
//
pageSize: 10,
pageNo: 1,
statisticType: ['', '日', '周', '月', '年'].indexOf(this.activeName),
startTime: this.startTime,
endTime: this.endTime,
};
getData(listQuery).then((response) => {
this.homeData = response.data;
for (let i in this.homeData) {
this.homeData[i] = Number(this.homeData[i]).toFixed(2);
}
});
},
handleClick() {
let start = Date.parse(new Date());
let end = Date.parse(new Date());
switch (this.activeName) {
case '日':
this.showTime = moment(new Date())
.subtract(0, 'days')
.format('YYYY-MM-DD');
this.lineChartData = lineChartData.newVisitis;
break;
case '周':
start = moment(new Date()).subtract(6, 'days').format('x');
this.showTime =
moment(new Date()).subtract(6, 'days').format('MM-DD') +
' ~ ' +
moment(new Date()).subtract(0, 'days').format('MM-DD');
this.lineChartData = lineChartData.messages;
break;
case '月':
start = moment(new Date()).subtract(1, 'month').format('x');
this.showTime =
moment(new Date()).subtract(1, 'month').format('MM-DD') +
' ~ ' +
moment(new Date()).subtract(0, 'days').format('MM-DD');
this.lineChartData = lineChartData.purchases;
break;
case '年':
start = moment(new Date()).subtract(1, 'year').format('x');
this.showTime =
moment(new Date()).subtract(1, 'year').format('YYYY') +
' ~ ' +
moment(new Date()).subtract(0, 'days').format('YYYY');
this.lineChartData = lineChartData.shoppings;
break;
default:
console.log(val);
}
this.getData()
},
getTime() {
let _this = this;
this.timer = setInterval(function () {
_this.topDate = moment().format('YYYY.MM.DD');
let temp = moment().format('A-hh:mm').split('-');
_this.timeZone = temp[0];
_this.topTime = temp[1];
}, 1000);
},
},
};
</script>
<style lang="scss" scoped>
.home-page::before {
background-image: url('~@/assets/img/home-bg.png');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: rotate(180deg);
}
.date-tabs {
padding-left: 40px;
padding-top: 20px;
position: relative;
}
:deep(.date-tabs) {
.el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.el-tabs__content {
overflow: visible;
}
.el-tabs__item {
font-size: 18px;
color: #fff;
padding-left: 0 !important;
padding-right: 0 !important;
line-height: 36px !important;
height: 36px;
}
.el-tabs__item.is-active {
color: #0b58ff;
}
}
.current-date {
color: #fff;
font-size: 18px;
position: absolute;
left: 260px;
top: 14px;
}
.current-time {
color: #fff;
font-size: 18px;
position: absolute;
right: 38px;
top: 14px;
}
.main-top {
width: 100%;
padding: 0 20px 0 40px;
.title {
position: absolute;
left: 34px;
top: 20px;
width: 180px;
font-size: 32px;
z-index: 10;
.title-inner {
position: absolute;
left: 42px;
top: 5px;
font-size: 24px;
}
}
.box {
background-color: #fff;
border-radius: 24px;
height: 192px;
padding: 40px 24px 32px 24px;
margin-bottom: 20px;
box-shadow: 0 8px 8px 0 gray;
.num-box {
height: 120px;
padding-top: 26px;
text-align: center;
.num-style {
color: #000;
font-size: 40px;
}
.unit-style {
color: rgba(0, 0, 0, 0.7);
font-size: 18px;
}
}
.shadow {
background: linear-gradient(90deg, #ffffff 80%, #f2f4f9 100%);
}
}
}
.main-bottom {
width: 100%;
margin-top: 20px;
.chart-wrapper {
margin-left: 10px;
height: 425px;
background: #fff;
border-radius: 5px;
box-shadow: 0 3px 3px 0 gray;
}
}
</style>
<style lang="scss">
.home-page {
.el-progress-bar__inner {
background-image: url('~@/assets/img/home-progress-bg.png');
background-size: cover;
}
}
</style>

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -90,6 +90,10 @@ const tableProps = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'energyTypeName', prop: 'energyTypeName',
label: '能源类型', label: '能源类型',
@ -115,6 +119,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'energyTypeName', prop: 'energyTypeName',
label: '能源类型', label: '能源类型',
@ -329,6 +337,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
if (this.listQuery.startTime) { if (this.listQuery.startTime) {

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -91,17 +91,21 @@ const tableProps = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'materialName', prop: 'materialName',
label: '原料名称', label: '原料名称',
}, },
{ {
prop: 'quantity', prop: 'quantity',
label: '累计使用量()', label: '累计使用量(千克)',
}, },
{ {
prop: 'matPrice', prop: 'matPrice',
label: '单价(元/)', label: '单价(元/千克)',
align: 'right', align: 'right',
}, },
{ {
@ -111,6 +115,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'materialName', prop: 'materialName',
label: '原料名称', label: '原料名称',
@ -123,11 +131,11 @@ const tableProps2 = [
}, },
{ {
prop: 'quantity', prop: 'quantity',
label: '累计使用量()', label: '累计使用量(千克)',
}, },
{ {
prop: 'materialPrice', prop: 'materialPrice',
label: '单价(元/)', label: '单价(元/千克)',
align: 'right', align: 'right',
}, },
{ {
@ -326,6 +334,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
if (this.listQuery.startTime) { if (this.listQuery.startTime) {

View File

@ -54,6 +54,10 @@ const tableProps = [
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
width:130, width:130,
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'bindObjectName', prop: 'bindObjectName',
label: '产线', label: '产线',

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -91,6 +91,10 @@ const tableProps = [
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'otherCostName', prop: 'otherCostName',
label: '成本名称', label: '成本名称',
@ -102,6 +106,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'otherCostName', prop: 'otherCostName',
label: '成本名称', label: '成本名称',
@ -297,6 +305,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
getRawOthercostSunPage(this.listQuery).then((response) => { getRawOthercostSunPage(this.listQuery).then((response) => {

View File

@ -54,7 +54,7 @@
:page.sync="listQuery.pageNo" :page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize" :limit.sync="listQuery.pageSize"
:total="listQuery.total" :total="listQuery.total"
@pagination="getDataList" /> @pagination="getNavDataList" />
<base-dialog <base-dialog
:dialogTitle="addOrEditTitle" :dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible" :dialogVisible="addOrUpdateVisible"
@ -91,6 +91,10 @@ const tableProps = [
label: '时间', label: '时间',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
}, },
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'bindObjectName', prop: 'bindObjectName',
label: '产线', label: '产线',
@ -124,6 +128,10 @@ const tableProps = [
}, },
]; ];
const tableProps2 = [ const tableProps2 = [
{
prop: 'remark',
label: '备注',
},
{ {
prop: 'bindObjectName', prop: 'bindObjectName',
label: '产线', label: '产线',
@ -354,6 +362,13 @@ export default {
this.getDataList2(); this.getDataList2();
} }
}, },
getNavDataList(){
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
},
// 2 // 2
getDataList2() { getDataList2() {
if (this.listQuery.startTime) { if (this.listQuery.startTime) {

View File

@ -74,21 +74,21 @@ export default {
} }
}], }],
series: [{ series: [{
name: 'pageA', name: '成本1',
type: 'bar', type: 'bar',
stack: 'vistors', stack: 'vistors',
barWidth: '60%', barWidth: '60%',
data: [79, 52, 200, 334, 390, 330, 220], data: [79, 52, 200, 334, 390, 330, 220],
animationDuration animationDuration
}, { }, {
name: 'pageB', name: '成本2',
type: 'bar', type: 'bar',
stack: 'vistors', stack: 'vistors',
barWidth: '60%', barWidth: '60%',
data: [80, 52, 200, 334, 390, 330, 220], data: [80, 52, 200, 334, 390, 330, 220],
animationDuration animationDuration
}, { }, {
name: 'pageC', name: '成本3',
type: 'bar', type: 'bar',
stack: 'vistors', stack: 'vistors',
barWidth: '60%', barWidth: '60%',

View File

@ -1,4 +1,4 @@
<!-- <!--
filename: index.vue filename: index.vue
author: liubin author: liubin
date: 2023-08-31 09:14:19 date: 2023-08-31 09:14:19
@ -35,27 +35,27 @@
" /> " />
</div> </div>
</div> </div>
<div v-else class="no-data-bg"> <div v-else class="no-data-bg"></div>
</div>
</div> </div>
</template> </template>
<script> <script>
import { Message } from 'element-ui';
import LocalDataManager from './utils/local-data-manager'; import LocalDataManager from './utils/local-data-manager';
// import response from './response'; // import response from './response';
import moment from 'moment'; import moment from 'moment';
import { parseTime } from '@/utils/ruoyi'
export default { export default {
name: 'EquipmentFullParams', name: 'EquipmentFullParams',
components: {}, components: {},
props: {}, props: {},
data() { data() {
const now = new Date(); // const now = new Date().getTime();
const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()]; // const [y, m, d] = [now.getFullYear(), now.getMonth(), now.getDate()];
const today = new Date(y, m, d, 0, 0, 0, 0).getTime(); const today = new Date().getTime();
const aWeekAgo = today - 3600 * 1000 * 24 * 7; const tenminAgo = new Date(today - (10 * 60 * 1000)).getTime();
return { return {
tableList: [],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
@ -74,10 +74,10 @@ export default {
{ {
type: 'datePicker', type: 'datePicker',
label: '时间段', label: '时间段',
dateType: 'daterange', // datetimerange dateType: 'datetimerange', // datetimerange
format: 'yyyy-MM-dd HH:mm:ss', format: 'yyyy-MM-dd HH:mm:ss',
// valueFormat: 'yyyy-MM-dd HH:mm:ss', // valueFormat: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'timestamp', valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始时间', startPlaceholder: '开始时间',
endPlaceholder: '结束时间', endPlaceholder: '结束时间',
@ -94,14 +94,20 @@ export default {
}, },
], ],
queryParams: { queryParams: {
id: null, equipmentId: null,
time: [new Date(aWeekAgo), new Date(today)], recordTime: [parseTime(tenminAgo), parseTime(today)],
}, },
tableList: [ tableList: [
// { // {
// key: 'base-table__key__1', // key: 'base-table__key__1',
// tableProps: [], // tableProps: [{
// list: [], // prop: 'name',
// label: 'name'
// }],
// dataManager: {dataList: [{name: '1'}]},
// list: [{
// name: '11'
// }],
// pageNo: 1, // pageNo: 1,
// pageSize: 3, // pageSize: 3,
// total: 0, // total: 0,
@ -109,35 +115,72 @@ export default {
], ],
}; };
}, },
computed: { beforeRouteEnter(to, from, next) {
id() { if (Object.keys(to.params).length > 0) {
return this.$route.params.equipmentId; next((vm) => {
}, vm.$set(vm.queryParams, 'equipmentId', to.params.equipmentId);
code() { vm.$set(
return this.$route.params.equipmentCode; vm.searchBarFormConfig[0],
}, 'defaultSelect',
name() { to.params.equipmentName
return this.$route.params.equipmentName; );
}, vm.$set(
}, vm.searchBarFormConfig[1],
mounted() { 'defaultSelect',
if (this.id) this.$set(this.queryParams, 'id', this.id); to.params.equipmentCode
if (this.code) );
this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code); vm.$set(
if (this.name) vm.searchBarFormConfig[2],
this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name); 'defaultSelect',
vm.queryParams.recordTime
);
vm.handleQuery();
});
} else {
// let timeleft = 3;
// this.handleResponse(); // const message = Message({
// type: 'warning',
// duration: 0,
// message: `, , ${timeleft} s`,
// });
// const timer = setInterval(() => {
// if (timeleft > 0) {
// timeleft--;
// message.$data.message = `, , ${timeleft} s`
// return;
// }
// message.close();
// clearInterval(timer);
// timer = null;
// }, 1000);
// next({ name: 'EquipmentStatusAndParams' });
next((vm) => {
vm.$message({
type: 'error',
message: `请先选择设备`,
});
});
}
},
beforeRouteLeave(to, from, next) {
// clean job
this.$set(this.queryParams, 'equipmentId', null);
this.$set(this.searchBarFormConfig[0], 'defaultSelect', null);
this.$set(this.searchBarFormConfig[1], 'defaultSelect', null);
this.tableList = [];
next();
}, },
methods: { methods: {
buildProps(table) { buildProps(table) {
console.log('building props', table);
// otherList props // otherList props
const { otherList } = table; const { otherList } = table;
const props = [ const props = [
{ {
// type: 'index', // type: 'index',
width: 48, width: 56,
prop: 'index', prop: 'index',
label: '序号', label: '序号',
}, },
@ -147,7 +190,7 @@ export default {
label: '时间', label: '时间',
}, },
{ {
width: 200, width: 240,
prop: 'plcCode', prop: 'plcCode',
label: 'PLC编码', label: 'PLC编码',
}, },
@ -161,7 +204,7 @@ export default {
props.push({ props.push({
label: item.name, label: item.name,
prop: item.name, prop: item.name,
width: 128, // width: 128,
}); });
firstLineData[item.name] = `${item.minValue ?? ''}-${ firstLineData[item.name] = `${item.minValue ?? ''}-${
item.maxValue ?? '' item.maxValue ?? ''
@ -237,11 +280,18 @@ export default {
async handleSearchBarBtnClick({ btnName, timeVal }) { async handleSearchBarBtnClick({ btnName, timeVal }) {
if (timeVal && timeVal.length > 0) { if (timeVal && timeVal.length > 0) {
this.queryParams.time = timeVal; console.log('nihc ', timeVal)
if (new Date(timeVal[1]).getTime() - new Date(timeVal[0]).getTime() <= 30 * 60 * 1000) {
this.queryParams.recordTime = timeVal;
await this.handleQuery();
} else {
this.$message.warning('时间范围最大30分钟限制')
}
} else { } else {
this.queryParams.time = []; this.queryParams.recordTime = [];
this.$message.warning('时间段必选!')
} }
await this.handleQuery();
}, },
handleEmitFun(table, val) { handleEmitFun(table, val) {
@ -264,9 +314,12 @@ export default {
} }
.tables { .tables {
display: grid; /* display: grid; */
grid-template-columns: 1fr 1fr; /* grid-template-columns: 1fr 1fr; */
gap: 18px; /* gap: 18px; */
display: flex;
flex-direction: column;
width: 100%;
} }
.tables >>> .baseTable { .tables >>> .baseTable {
@ -275,5 +328,6 @@ export default {
.custom-table { .custom-table {
overflow-x: hidden; overflow-x: hidden;
margin-bottom: 10px;
} }
</style> </style>

68
sync_line_sczg_aliyun.bat Normal file
View File

@ -0,0 +1,68 @@
@echo off
setlocal enabledelayedexpansion
set cmdstr=rsync
set zipfile=cwrsync.zip
set downurl=https://itefix.net/download/free/cwrsync_6.3.0_x64_free.zip
set currpath=%~dp0
set "rsynchome=%ProgramFiles%\%zipfile:~0,-4%"
set passfile=%temp%\.password
set syncdir=dist/
:: 以下需要配置同步服务器
set accountwithost=kszny@47.96.93.140::line-sczg-ui
set "password=kszny@123"
set "runcommand=%cmdstr% --port=873 -rlptvz --progress --password-file=%passfile% --exclude=google.exe --exclude=Lodap.zip %syncdir% %accountwithost%"
where %cmdstr% >nul 2>nul
::有错误输出,说明不存在该命令
if %errorlevel% neq 0 (
::还未下载安装包或未正常解压到安装目录
if not exist "%rsynchome%" (
:: 请求提升管理员权限
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\runAsAdmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\runAsAdmin.vbs"
"%temp%\runAsAdmin.vbs"
:: 需要提升管理员权限才能创建此目录
mkdir "%rsynchome%"
del "%temp%\runAsAdmin.vbs"
exit /B
)
:: 使用powershell的curl下载软件包
powershell curl -o %temp%\%zipfile% %downurl%
:: 解压
tar -xf "%temp%\%zipfile%" -C "%rsynchome%"
echo "%cmdstr%已经安装到了%rsynchome%目录下"
:: 检查路径是否存在于 PATH 中
set "found=false"
for %%I in ("%PATH:;=";"%") do (
if /I "%%~I"=="%rsynchome%\bin" (
set "found=true"
)
)
:: 未设置到path变量中添加到path变量
if "!found!"=="false" (
:: 更新注册表中的 PATH 变量通过setx方式变量值长度超过1024个字符就会被截断
reg add "HKCU\Environment" /v PATH /t REG_EXPAND_SZ /d "%PATH%;%rsynchome%\bin" /f
)
)
::当前目录下没有dist目录
if not exist "%currpath%%syncdir%" (
echo 当前目录下没有需要同步的%syncdir%目录,请把需要同步的%syncdir%目录拷贝到当前目录下!
) else (
echo !password!>%passfile%
echo 数据同步开始,请稍后...
!runcommand! && (
echo 数据同步完成!
) || (
echo !runcommand!
echo 数据同步失败请确认是否开启了VPN
)
del %passfile%
)
endlocal
pause

View File

@ -2,13 +2,13 @@
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
set cmdstr=rsync set cmdstr=rsync
set zipfile=cwrsync.zip set zipfile=cwrsync.zip
set downurl=https://itefix.net/dl/free-software/cwrsync_6.3.0_x64_free.zip set downurl=https://itefix.net/download/free/cwrsync_6.3.0_x64_free.zip
set currpath=%~dp0 set currpath=%~dp0
set "rsynchome=%ProgramFiles%\%zipfile:~0,-4%" set "rsynchome=%ProgramFiles%\%zipfile:~0,-4%"
set passfile=%temp%\.password set passfile=%temp%\.password
set syncdir=dist/ set syncdir=dist/
:: 以下需要配置同步服务器 :: 以下需要配置同步服务器
set accountwithost=kszny@47.96.93.140::line set accountwithost=kszny@100.64.0.45::line
set "password=kszny@123" set "password=kszny@123"
set "runcommand=%cmdstr% --port=873 -rlptvz --progress --password-file=%passfile% --exclude=google.exe --exclude=Lodap.zip %syncdir% %accountwithost%" set "runcommand=%cmdstr% --port=873 -rlptvz --progress --password-file=%passfile% --exclude=google.exe --exclude=Lodap.zip %syncdir% %accountwithost%"