This commit is contained in:
朱文强 2024-09-10 15:19:44 +08:00
parent 09cce6c613
commit e237737830
99 changed files with 14597 additions and 9267 deletions

View File

@ -1,20 +1,20 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-10-16 09:22:52
# @LastEditors: DY
# @LastEditTime: 2024-09-10 14:43:39
# @LastEditors: zwq
# @Description:
###
# 开发环境配置
ENV = 'development'
# 页面标题
VUE_APP_TITLE = 产线监控系统
VUE_APP_TITLE = 成本管理系统
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://192.168.1.49:48080'
# VUE_APP_BASE_API = 'http://192.168.1.8:48080'
VUE_APP_BASE_API = 'http://192.168.0.33:48080'
VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
# VUE_APP_BASE_API = 'http://192.168.1.40:48080'
# VUE_APP_BASE_API = 'http://192.168.1.188:48080'
# 路由懒加载

View File

@ -1,15 +1,24 @@
###
# @Author: zwq
# @Date: 2024-03-27 15:49:55
# @LastEditors: zwq
# @LastEditTime: 2024-09-10 15:19:19
# @Description:
###
# 生产环境配置
ENV = 'production'
# 页面标题
VUE_APP_TITLE = 产线监控系统
VUE_APP_TITLE = 成本管理系统
# 芋道管理系统/生产环境
VUE_APP_BASE_API = '/prod-api'
# VUE_APP_BASE_API = '/prod-api'
VUE_APP_BASE_API = ''
# 根据服务器或域名修改
# PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/'
PUBLIC_PATH = 'http://192.168.0.33:8888/'
# PUBLIC_PATH = 'http://192.168.0.33:8888/'
PUBLIC_PATH = ''
# 二级部署路径
VUE_APP_APP_NAME ='yudao-admin'

View File

@ -6,9 +6,9 @@
"license": "MIT",
"scripts": {
"local": "vue-cli-service serve --mode local",
"dev": "vue-cli-service serve --mode dev",
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --mode dev",
"front": "vue-cli-service serve --mode front",
"build:prod": "vue-cli-service build --mode prod",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode prod",
"build:stage": "vue-cli-service build --mode stage",
"build:dev": "vue-cli-service build --mode dev",
"build:static": "vue-cli-service build --mode static",

View File

@ -0,0 +1,53 @@
/*
* @Author: Do not edit
* @Date: 2024-02-21 13:43:02
* @LastEditTime: 2024-04-30 10:07:59
* @LastEditors: zwq
* @Description:
*/
import request from '@/utils/request'
// 获得关联表名
export function getplcAllList(query) {
return request({
url: '/base/equipment-plc/listAll',
method: 'get',
params: query
})
}
// 获得设备
export function getEquipmentList(query) {
return request({
url: '/base/core-equipment/page',
method: 'get',
params: query
})
}
// 根据产线获得工段
export function listByParentId(query) {
return request({
url: '/base/core-workshop-section/listByParentId',
method: 'get',
params: query
})
}
// 获得产线工段设备树形结构
export function getTree(query) {
return request({
url: '/base/factory/getTree',
method: 'get',
params: query
})
}
// 获得设备分组列表
export function getgroupAllList(query) {
return request({
url: '/base/equipment-group/listAll',
method: 'get',
params: query
})
}

View File

@ -1,3 +1,10 @@
/*
* @Author: zwq
* @Date: 2024-03-27 15:49:55
* @LastEditors: zwq
* @LastEditTime: 2024-09-10 14:36:19
* @Description:
*/
import request from '@/utils/request'
// 获得所有工厂产线列表
export function getLineAll() {
@ -6,3 +13,11 @@ export function getLineAll() {
method: 'get'
})
}
// 获得产线分页
export function getLinePage(query) {
return request({
url: '/base/production-line/page',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,55 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 15:00:09
* @Description:
*/
import request from '@/utils/request'
// 更新深加工良品率
export function updateDeepRatioHis(data) {
return request({
url: '/monitoring/cost-deep-ratio-his/update',
method: 'put',
data: data
})
}
// 获得深加工产线良品率
export function getDeepPDRatioHisPage(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/page-pd',
method: 'get',
params: query
})
}
// 获得深加工工段良品率
export function getDeepWSRatioHisPage(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/page-ws',
method: 'get',
params: query
})
}
// 导出深加工工段良品率 Excel
export function exportDeepWSRatioHisExcel(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/export-excel-ws',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工产线良品率 Excel
export function exportDeepPDRatioHisExcel(query) {
return request({
url: '/monitoring/cost-deep-ratio-his/export-excel-pd',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -32,3 +32,22 @@ export function getEnergyRealtimePage(query) {
params: query
})
}
// 导出能源成本成本查询 Excel
export function exportEnergyRealtimeExcel(query) {
return request({
url: '/monitoring/cost-energy-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出能源成本历史 Excel
export function exportEnergyHisExcel(query) {
return request({
url: '/monitoring/cost-energy-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:51:14
* @LastEditTime: 2024-09-06 15:19:24
* @Description:
*/
@ -32,3 +32,23 @@ export function getEnergyRealtimePage(query) {
params: query
})
}
// 导出深加工能源成本成本查询 Excel
export function exportEnergyRealtimeExcel(query) {
return request({
url: '/monitoring/cost-deep-energy-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工能源成本历史 Excel
export function exportEnergyHisExcel(query) {
return request({
url: '/monitoring/cost-deep-energy-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:12:14
* @LastEditTime: 2024-09-05 13:55:30
* @Description:
*/
@ -32,3 +32,23 @@ export function getMaterialRealtimePage(query) {
params: query
})
}
// 导出原料成本成本查询 Excel
export function exportMaterialRealtimeExcel(query) {
return request({
url: '/monitoring/cost-material-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原料成本历史 Excel
export function exportMaterialHisExcel(query) {
return request({
url: '/monitoring/cost-material-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -24,3 +24,13 @@ export function getcostOriginRatioHisPage(query) {
})
}
// 导出原片良品率 Excel
export function exportcostOriginRatioHisExcel(query) {
return request({
url: '/monitoring/cost-origin-ratio-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -32,3 +32,22 @@ export function getRawOthercostSunPage(query) {
params: query
})
}
// 导出原片其他成本-成本查询 Excel
export function exportRawOthercostSunExcel(query) {
return request({
url: '/monitoring/cost-othercost-log/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原片其他成本-历史 Excel
export function exportRawOthercostHisExcel(query) {
return request({
url: '/monitoring/cost-othercost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 15:15:18
* @LastEditTime: 2024-09-06 15:13:20
* @Description:
*/
@ -32,3 +32,22 @@ export function getRawOthercostSunPage(query) {
params: query
})
}
// 导出深加工其他成本-成本查询 Excel
export function exportRawOthercostSunExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工其他成本-历史 Excel
export function exportRawOthercostHisExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-18 15:40:27
* @LastEditTime: 2024-09-06 14:12:09
* @Description:
*/
import request from '@/utils/request'
@ -53,7 +53,7 @@ export function getRawOthercostLogPage(query) {
// 导出原片其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) {
return request({
url: '/monitoring/cost-othercost-log/export-excel',
url: '/monitoring/cost-othercost-log/export-log-excel',
method: 'get',
params: query,
responseType: 'blob'

View File

@ -53,7 +53,7 @@ export function getRawOthercostLogPage(query) {
// 导出深加工其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/export-excel',
url: '/monitoring/cost-deep-othercost-log/export-log-excel',
method: 'get',
params: query,
responseType: 'blob'

View File

@ -0,0 +1,53 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-02 14:43:30
* @Description:
*/
import request from '@/utils/request'
// 获得深加工成本分页
export function getDeepCostStatisticsPage(query) {
return request({
url: '/monitoring/cost-deep-cost-his/page',
method: 'get',
params: query
})
}
// 更新深加工成本-历史
export function updateDeepCostStatistics(data) {
return request({
url: '/monitoring/cost-deep-cost-his/update',
method: 'put',
data: data
})
}
// 获得深加工成本统计成本查询分页
export function getDeepCostStatisticsRealtimePage(query) {
return request({
url: '/monitoring/cost-deep-cost-realtime/page',
method: 'get',
params: query
})
}
// 导出深加工成本统计成本查询 Excel
export function exportDeepStatisticsRealtimeExcel(query) {
return request({
url: '/monitoring/cost-deep-cost-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出深加工成本统计-历史成本 Excel
export function exportDeepCostStatisticsHisExcel(query) {
return request({
url: '/monitoring/cost-deep-cost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,54 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-09-06 14:35:13
* @Description:
*/
import request from '@/utils/request'
// 获得原片成本分页
export function getRawCostStatisticsPage(query) {
return request({
url: '/monitoring/cost-origincost-his/page',
method: 'get',
params: query
})
}
// 更新原片成本-历史
export function updateRawCostStatistics(data) {
return request({
url: '/monitoring/cost-origincost-his/update',
method: 'put',
data: data
})
}
// 获得原片成本统计成本查询分页
export function getRawCostStatisticsRealtimePage(query) {
return request({
url: '/monitoring/cost-origin-cost-realtime/page',
method: 'get',
params: query
})
}
// 导出原片成本统计成本查询 Excel
export function exportRawStatisticsRealtimeExcel(query) {
return request({
url: '/monitoring/cost-origin-cost-realtime/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 导出原片成本统计-历史成本 Excel
export function exportRawCostStatisticsHisExcel(query) {
return request({
url: '/monitoring/cost-origincost-his/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -0,0 +1,132 @@
<!--
filename: index.vue
author: liubin
date: 2024-04-02 09:49:36
description:
-->
<template>
<!-- 按钮切换 -->
<div v-if="buttonMode" class="button-nav">
<button
v-for="m in menus"
:key="m"
@click="currentMenu = m"
:data-text="m"
:class="[m === currentMenu ? 'active' : '']"
></button>
</div>
<!-- 标签切换 -->
<div v-else class="custom-tabs" style="height: 100%; width: 100%">
<el-tabs class="tag-nav" v-model="currentMenu" style="height: 100%">
<el-tab-pane
v-for="(m, idx) in menus"
:key="m"
:label="idx == 0 ? `\u2002${m}\u2002` : `\u3000${m}\u3000`"
:name="m"
>
<slot :name="`tab${idx + 1}`"></slot>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
export default {
name: "ButtonNav",
props: {
menus: {
type: Array,
required: true,
default: () => [],
validator: (val) => {
return val.length > 0;
},
},
buttonMode: {
type: Boolean,
default: true,
},
},
data() {
return {
currentMenu: "",
};
},
created() {
this.currentMenu = this.menus[0];
},
watch: {
currentMenu(val) {
this.$emit("change", val);
},
},
};
</script>
<style scoped lang="scss">
.button-nav {
width: 100%;
display: flex;
gap: 12px;
* {
user-select: none;
}
button {
cursor: pointer;
appearance: none;
outline: none;
border: none;
background: #fff;
border-radius: 8px;
padding: 15px;
color: #888;
letter-spacing: 2px;
flex: 1;
box-sizing: padding-box;
position: relative;
&::after {
content: attr(data-text);
position: absolute;
top: 5px;
left: 50%;
font-size: 16px;
font-weight: 500;
transform: translate(-50%);
}
&.active {
color: #111;
//border-bottom: 2px solid #0b58ff;
box-shadow: 0px 2px 1px 1px #0b58ff;
}
}
}
</style>
<style scoped>
.custom-tabs >>> .el-tabs__header {
margin-bottom: 8px;
display: inline-block;
/* transform: translateY(-12px); */
}
.custom-tabs >>> .el-tabs__item {
padding-left: 0px !important;
padding-right: 0px !important;
line-height: 36px !important;
height: 36px;
}
.custom-tabs >>> .el-tabs__content {
height: calc(100% - 42px);
}
.custom-tabs >>> .el-tab-pane {
box-sizing: border-box;
height: 100%;
padding: 20px;
border: 10px solid #f002;
}
</style>

View File

@ -2,7 +2,7 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: zwq
* @LastEditTime: 2023-12-07 10:00:51
* @LastEditTime: 2024-09-10 15:15:21
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
@ -61,14 +61,25 @@ export function parseTime(time, pattern) {
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
a: date.getDay(),
w: '',
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
const time_str = format.replace(/{([ymdhisaw])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (key === 'w') {
const current = new Date(time);
current.setHours(0, 0, 0);
current.setDate(current.getDate() + 4 - (current.getDay() || 7));
const firstThursday = new Date(current.getFullYear(), 0, 4);
firstThursday.setDate(firstThursday.getDate() + 4 - (firstThursday.getDay() || 7));
const time1 = current.getTime() - firstThursday.getTime();
const weeks = Math.ceil(time1 / (7 * 24 * 3600 * 1000));
return (weeks + 1)
}
if (result.length > 0 && value < 10) {
value = '0' + value
}

View File

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

View File

@ -320,7 +320,7 @@ export default {
//
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息');
if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = {
id: null,
equipmentGroupId: this.dataId,

View File

@ -320,7 +320,7 @@ export default {
//
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息');
if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = {
id: null,
equipmentGroupId: this.dataId,

View File

@ -280,7 +280,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
if (this.queryParams.equipmentGroupId == null)
return this.$message.error('没有检测到设备分组信息');
return this.$message.warning('没有检测到设备分组信息');
this.reset();
this.open = true;
this.title = '添加设备分组报警明细';

View File

@ -0,0 +1,388 @@
<!--
filename: TableConfig.vue
author: liubin
date: 2023-10-30 10:09:03
description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
ref="pageTable"
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="700px"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</div>
</template>
<script>
import {
createEquipmentPlc,
updateEquipmentPlc,
deleteEquipmentPlc,
getEquipmentPlc,
getEquipmentPlcPage,
exportEquipmentPlcExcel,
} from '@/api/base/equipmentPlc';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const switchBtn = {
name: 'SwitchBtn',
props: ['injectData'],
data() {
return {};
},
computed: {
active() {
return +this.injectData[this.injectData.prop] == 1 ? true : false;
},
},
methods: {},
render: function (h) {
return h(
'el-switch',
{
props: {
value: this.active,
},
on: {
change: (newVal) => {
this.$emit('emitData', {
action: 'update-collect',
payload: {
...this.injectData,
collection: newVal ? 1 : 0,
},
});
},
},
},
null
);
},
};
export default {
name: 'EquipmentPlc',
mixins: [basicPageMixin, tableHeightMixin],
components: {},
data() {
return {
tableKey: Math.random(),
searchBarKeys: ['name', 'plcTableName'],
tableBtn: [
this.$auth.hasPermiAnd([
'base:equipment-plc:update',
'base:equipment-plc:query'
])
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'code', label: '编码', width: 180, showOverflowtooltip: true },
{ prop: 'plcTableName', label: '关联表名', width: 150, showOverflowtooltip: true },
{ prop: 'name', label: '标识名称', width: 150, showOverflowtooltip: true },
{ prop: 'enName', label: '英文名称', width: 150, showOverflowtooltip: true },
{
prop: 'collection',
label: '是否采集',
subcomponent: switchBtn,
},
{ prop: 'description', label: '描述', minWidth: 150, showOverflowtooltip: true },
],
searchBarFormConfig: [
{
type: 'input',
label: '表名',
placeholder: '请输入表名',
param: 'plcTableName',
},
{
type: 'input',
label: '标识',
placeholder: '请输入标识',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('base:equipment-plc:create')
? 'separate' : '',
},
{
type: this.$auth.hasPermi('base:equipment-plc:create')
? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('equipment:realtime-table-config:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '关联表名',
prop: 'plcTableName',
rules: [{ required: true, message: '关联表名不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
{
input: true,
label: '编码',
prop: 'code',
url: '/base/energy-plc/getCode',
rules: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '标识',
prop: 'name',
rules: [{ required: true, message: '标识不能为空', trigger: 'blur' }],
// bind: {
// disabled: true, // some condition, like detail mode...
// }
},
{
input: true,
label: '英文名',
prop: 'enName',
},
],
[
{
switch: true,
label: '是否采集', // 0 , 1
prop: 'collection',
bind: {
'active-value': 1,
'inactive-value': 0,
value: 1,
},
},
],
[
{
textarea: true,
label: '描述',
prop: 'description',
bind: {
placeholder: '请输入备注',
},
},
],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
plcTableName: null,
name: null,
},
//
form: {},
};
},
created() {
this.getList();
},
methods: {
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, payload }) {
switch (action) {
case 'update-collect':
this.reset();
const tempForm = {};
Object.keys(this.form).forEach((key) => {
tempForm[key] = payload[key];
});
updateEquipmentPlc(tempForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
break;
}
},
/** 查询列表 */
getList() {
this.loading = true;
//
getEquipmentPlcPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
// this.tableKey = Math.random(); // method 1
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
plcTableName: undefined,
code: undefined,
name: undefined,
enName: undefined,
description: undefined,
collection: 1,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加实时数据采集配置';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getEquipmentPlc(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改实时数据采集配置';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlc(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlc(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除该配置?')
.then(function () {
return deleteEquipmentPlc(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有实时数据采集配置数据项?')
.then(() => {
this.exportLoading = true;
return exportEquipmentPlcExcel(params);
})
.then((response) => {
this.$download.excel(response, '实时数据采集配置.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,151 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-30 10:01:41
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px">
<el-form-item label="设备" prop="equipmentId">
<el-cascader
placeholder="请选择设备"
v-model="dataForm.equipmentId"
:options="plLineList"
:props="{value: 'id', label: 'name', children: 'children'}"
style="width: 100%"
filterable />
</el-form-item>
<el-form-item label="关联表名" prop="plcId">
<el-select
v-model="dataForm.plcId"
filterable
placeholder="请选择关联表"
style="width: 100%">
<el-option
v-for="dict in plcList"
:key="dict.id"
:label="dict.plcTableName"
:value="dict.id" />
</el-select>
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from './components/basic-add';
import { createEquipmentPlcConnect, updateEquipmentPlcConnect } from '@/api/base/equipmentPlcConnect';
import { getplcAllList, getTree } from "@/api/base/equipmentConfig";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createEquipmentPlcConnect,
updateURL: updateEquipmentPlcConnect,
},
dataForm: {
id: undefined,
equipmentId: undefined,
plcId: undefined
},
plcList: [],
plLineList: [],
dataRule: {
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }],
plcId: [{ required: true, message: "关联表名不能为空", trigger: "blur" }]
},
options: [{
value: 'zhinan',
label: '指南',
children: [{
value: 'shejiyuanze',
label: '设计原则',
children: [{
value: 'yizhi',
label: '一致'
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '导航'
}]
}]
};
},
created() {
this.getDict()
},
methods: {
init() {
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
},
async getDict() {
//
const res = await getplcAllList();
this.plcList = res.data;
//
const res1 = await getTree();
this.plLineList = res1.data;
// const res1 = await getCorePLList();
// this.plLineList = res1.data;
// this.plLineList.forEach(item => {
// listByParentId({ id: item.id }).then(resp => {
// if (resp.data.length > 0) {
// // item.children = resp.data
// this.$set(item, 'children', resp.data)
// // this.$forceUpdate()
// }
// })
// })
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
updateEquipmentPlcConnect({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId[this.dataForm.equipmentId.length],
plcId: this.dataForm.plcId
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
createEquipmentPlcConnect({
id: this.dataForm.id,
equipmentId: this.dataForm.equipmentId[this.dataForm.equipmentId.length - 1],
plcId: this.dataForm.plcId
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>

View File

@ -0,0 +1,574 @@
<!--
filename: EquipmentDrawer.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">
{{
mode.includes('detail')
? '详情'
: mode.includes('edit')
? '编辑'
: '新增'
}}
</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div class="form-part" v-if="section.key == 'base'">
<el-skeleton v-if="!showForm" animated />
<BaseInfoForm
key="drawer-dialog-form"
v-if="showForm"
ref="form"
:disabled="mode.includes('detail')"
v-model="form"
:rows="formRows" />
</div>
<div v-if="section.key == 'attrs'" style="margin-top: 12px">
<base-table
v-loading="attrListLoading"
:table-props="section.props"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="list"
:add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr"
@emitFun="handleEmitFun">
<method-btn
v-if="section.tableBtn"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</section>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
</el-button>
<el-button v-else type="primary" @click="handleCancel">确定</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
v-if="sections[1].allowAdd"
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="45%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
:disabled="mode.includes('detail')"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import BaseInfoForm from '@/components/DialogForm';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'infoData'],
data() {
return {
mode: '',
visible: false,
showForm: false,
total: 0,
form: {},
list: [],
attrTitle: '',
attrForm: {
id: null,
name: '',
plcParamName: '',
unit: '',
collection: 1,
minValue: '',
maxValue: '',
defaultValue: '',
description: '',
remark: '',
alarmContent: '',
equipmentParamType: '',
productionParamType: '',
},
attrFormVisible: false,
attrRows: [
[
{
input: true,
label: '参数列名',
prop: 'plcParamName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
{
input: true,
label: '参数名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
},
],
[
{
select: true,
label: '单位',
prop: 'unit',
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
switch: true,
label: '是否采集',
prop: 'collection',
bind: {
'active-value': 1,
'inactive-value': 0,
},
},
],
[
{
select: true,
label: '设备参数类型',
prop: 'equipmentParamType',
options: [
{ label: '一般参数', value: 1 },
{ label: '工艺参数', value: 2 },
{ label: '报警参数', value: 3 },
],
rules: [
{
required: true,
message: '设备参数类型不能为空',
trigger: 'blur',
},
],
},
{
select: true,
label: '生产参数类型',
prop: 'productionParamType',
options: [
// { label: '', value: 1 },
// { label: '', value: 2 },
// { label: '', value: 3 },
// { label: '', value: 4 },
{ label: '进口计数', value: 1 },
{ label: '出口计数', value: 2 },
{ label: '损耗计数', value: 3 },
{ label: '无类型', value: 4 },
],
rules: [
{
required: true,
message: '生产参数类型不能为空',
trigger: 'blur',
},
],
},
],
[
{
input: true,
label: '最小值',
prop: 'minValue',
rules: [
{
type: 'number',
message: '请输入正确的数字',
trigger: 'change',
transform: (val) => Number(val),
},
],
},
{
input: true,
label: '最大值',
prop: 'maxValue',
rules: [
{
required: false,
},
{
type: 'number',
message: '请输入正确的数字',
trigger: 'change',
transform: (val) => Number(val),
},
],
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
{
input: true,
label: '标准值',
prop: 'defaultValue',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
input: true,
label: '描述',
prop: 'description',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
},
}, //
infoQuery: null, //
attrFormSubmitting: false,
attrListLoading: false,
};
},
computed: {
formRows() {
return this.sections[0].rows.map((row) => {
return row.map((col) => {
return {
...col,
bind: {
//
// disabled: this.mode == 'detail',
disabled: true,
},
};
});
});
},
tableBtn() {
return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
},
},
mounted() {
this.mode = this.defaultMode || 'detail';
for (const section of this.sections) {
//
if ('url' in section) {
const query = {
url: section.url,
method: section.method || 'get',
params: section.queryParams || null,
data: section.data || null,
};
// debugger;
this.$axios(query).then(({ data }) => {
if (section.key == 'base') {
this.form = data;
this.showForm = true;
this.infoQuery = query;
} else if (section.key == 'attrs') {
this.attrQuery = query;
this.list = data.list;
this.total = data.total;
}
});
} else if (section.key == 'base') {
this.form = this.infoData;
this.showForm = true;
}
}
},
methods: {
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init() {
this.visible = true;
},
async getAttrList() {
this.attrListLoading = true;
const res = await this.$axios(this.attrQuery);
if (res.code == 0) {
this.list = res.data.list;
this.total = res.data.total;
}
this.attrListLoading = false;
},
//
handleSave() {
this.$refs['form'][0].validate(async (valid) => {
if (valid) {
const isEdit = this.mode == 'edit';
await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post',
data: this.form,
});
this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
this.visible = false;
this.$emit('refreshDataList');
}
});
},
handleCancel() {
this.visible = false;
},
//
toggleEdit() {
this.mode = 'edit';
},
//
handleAddAttr() {
this.attrForm = {
id: null,
name: '',
plcParamName: '',
unit: '',
collection: 1,
minValue: '',
maxValue: '',
defaultValue: '',
description: '',
remark: '',
alarmContent: '',
};
this.attrTitle = '添加设备绑定信息';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: this.sections[1].urlDetail,
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备绑定信息';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该分组报警?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: this.sections[1].urlDelete,
method: 'delete',
params: { id: attrId },
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
async submitAttrForm() {
this.$refs['attrForm'].validate((valid) => {
if (!valid) {
return false;
}
});
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
method: isEdit ? 'put' : 'post',
data: {
...this.attrForm,
connectId: this.infoData.id
},
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
},
closeAttrForm() {
this.attrFormVisible = false;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`确定删除该报警?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -12,7 +12,7 @@
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
:size="size || '50%'"
@closed="$emit('destroy')">
<SmallTitle slot="title">
{{
@ -29,29 +29,107 @@
<section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle>
<div class="form-part" v-if="section.key == 'base'">
<div
class="form-part"
v-if="section.key == 'base'"
style="border-bottom: 1px solid #dfdfdf; margin-bottom: 24px">
<el-skeleton v-if="!showForm" animated />
<BaseInfoForm
<!-- <BaseInfoForm
key="drawer-dialog-form"
v-if="showForm"
ref="form"
:disabled="mode.includes('detail')"
v-model="form"
:rows="formRows" />
:rows="formRows" /> -->
<!-- if -->
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8">
<div
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
设备名
</div>
<div class="value" style="font-size: 14px">
{{ form.equipmentName }}
</div>
</el-col>
<el-col :span="8">
<div
class="title"
style="font-weight: 700; font-size: 16px; margin: 8px 0">
关联表名
</div>
<div class="value" style="font-size: 14px">
{{ form.plcName }}
</div>
</el-col>
</el-row>
<!-- else -->
<el-row v-else style="margin-bottom: 24px" :gutter="20">
<el-form ref="form" :model="form">
<el-col :span="8">
<el-form-item
class="title"
label="设备名"
style="font-size: 16px; margin: 8px 0">
<el-select
v-model="form.equipmentId"
filterable
clearable
placeholder="请选择设备">
<el-option
v-for="eq in eqList"
:key="eq.id"
:label="eq.name"
:value="eq.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
class="title"
label="设备关联表名"
style="font-size: 16px; margin: 8px 0">
<el-select
v-model="form.plcId"
filterable
clearable
placeholder="请选择关联表">
<el-option
v-for="plc in plcList"
:key="plc.id"
:label="plc.plcTableName"
:value="plc.id"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
</div>
<div v-if="section.key == 'attrs'" style="margin-top: 12px">
<div
v-if="section.key == 'attrs'"
style="position: relative; margin-top: 12px">
<div
v-if="!mode.includes('detail')"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加参数
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="section.props"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="list"
:add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr"
@emitFun="handleEmitFun">
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" -->
<method-btn
v-if="section.tableBtn"
v-if="section.tableBtn && !mode.includes('detail')"
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@ -71,17 +149,12 @@
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
</el-button>
<el-button v-else type="primary" @click="handleCancel">确定</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
<el-button
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
v-if="!mode.includes('detail')"
@click="handleSave">
保存
</el-button>
</div>
</div>
@ -96,10 +169,10 @@
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<!-- :disabled="mode.includes('detail')" -->
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
:disabled="mode.includes('detail')"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
@ -136,7 +209,7 @@ const SmallTitle = {
export default {
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'infoData'],
props: ['sections', 'defaultMode', 'infoData', 'size'],
data() {
return {
mode: '',
@ -145,6 +218,8 @@ export default {
total: 0,
form: {},
list: [],
eqList: [],
plcList: [],
attrTitle: '',
attrForm: {
id: null,
@ -166,13 +241,17 @@ export default {
input: true,
label: '参数列名',
prop: 'plcParamName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '参数名称',
prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '参数名称不能为空', trigger: 'blur' },
],
},
],
[
@ -181,7 +260,6 @@ export default {
label: '单位',
prop: 'unit',
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
switch: true,
@ -193,6 +271,47 @@ export default {
},
},
],
[
{
select: true,
label: '设备参数类型',
prop: 'equipmentParamType',
options: [
{ label: '一般参数', value: 1 },
{ label: '工艺参数', value: 2 },
{ label: '报警参数', value: 3 },
],
rules: [
{
required: true,
message: '设备参数类型不能为空',
trigger: 'blur',
},
],
},
{
select: true,
label: '生产参数类型',
prop: 'productionParamType',
options: [
// { label: '', value: 1 },
// { label: '', value: 2 },
// { label: '', value: 3 },
// { label: '', value: 4 },
{ label: '进口计数', value: 1 },
{ label: '出口计数', value: 2 },
{ label: '损耗计数', value: 3 },
{ label: '无类型', value: 4 },
],
rules: [
{
required: true,
message: '生产参数类型不能为空',
trigger: 'blur',
},
],
},
],
[
{
input: true,
@ -222,7 +341,6 @@ export default {
transform: (val) => Number(val),
},
],
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
@ -230,13 +348,11 @@ export default {
input: true,
label: '标准值',
prop: 'defaultValue',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
{
input: true,
label: '描述',
prop: 'description',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
[
@ -244,7 +360,6 @@ export default {
input: true,
label: '备注',
prop: 'remark',
// rules: [{ required: true, message: '', trigger: 'blur' }],
},
],
],
@ -257,6 +372,7 @@ export default {
infoQuery: null, //
attrFormSubmitting: false,
attrListLoading: false,
shouldRefreshPageView: false,
};
},
computed: {
@ -275,11 +391,24 @@ export default {
});
},
tableBtn() {
return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
return this.sections[1].tableBtn;
// return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
},
},
mounted() {
this.shouldRefreshPageView = false;
this.mode = this.defaultMode || 'detail';
if (this.mode != 'detail') {
this.$axios('/base/equipment/listAll').then(({ code, data }) => {
this.eqList = data;
});
this.$axios({
url: '/base/equipment-plc/listAll',
}).then(({ code, data }) => {
this.plcList = data;
});
}
for (const section of this.sections) {
//
if ('url' in section) {
@ -341,7 +470,7 @@ export default {
handleSave() {
this.$refs['form'][0].validate(async (valid) => {
if (valid) {
const isEdit = this.mode == 'edit';
const isEdit = !this.mode.includes('detail');
await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post',
@ -355,6 +484,9 @@ export default {
},
handleCancel() {
if (this.shouldRefreshPageView) {
this.$emit('refreshDataList');
}
this.visible = false;
},
@ -376,9 +508,11 @@ export default {
defaultValue: '',
description: '',
remark: '',
equipmentParamType: '',
productionParamType: '',
alarmContent: '',
};
this.attrTitle = '添加设备绑定信息';
this.attrTitle = '添加参数绑定信息';
this.attrFormVisible = true;
},
@ -391,14 +525,14 @@ export default {
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备绑定信息';
this.attrTitle = '编辑参数绑定信息';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该分组报警?', '提示', {
this.$confirm('确定删除该参数?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@ -410,6 +544,7 @@ export default {
params: { id: attrId },
});
if (res.code == 0) {
this.shouldRefreshPageView = true;
this.$message({
message: '删除成功',
type: 'success',
@ -424,12 +559,12 @@ export default {
},
//
async submitAttrForm() {
this.$refs['attrForm'].validate((valid) => {
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
});
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
@ -437,7 +572,7 @@ export default {
method: isEdit ? 'put' : 'post',
data: {
...this.attrForm,
connectId: this.infoData.id
connectId: this.infoData.id,
},
});
@ -449,10 +584,12 @@ export default {
duration: 1500,
onClose: () => {
this.getAttrList();
this.shouldRefreshPageView = true;
},
});
}
this.attrFormSubmitting = false;
});
},
closeAttrForm() {
@ -461,7 +598,7 @@ export default {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`确定删除该报警?`, '提示', {
this.$confirm(`确定删除该参数?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',

View File

@ -0,0 +1,100 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zhp
* @LastEditTime: 2023-12-13 15:52:53
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '',
updateURL: '',
infoURL: '',
codeURL: '',
getOption: false,
isGetCode: false,
optionArrUrl: [],
optionArr: {}
},
visible: false,
setData: false
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
if (this.setData) {
this.setDataForm()
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
formClear() {
this.$refs.dataForm.resetFields()
}
}
}

View File

@ -0,0 +1,535 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="700px"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
<!-- 抽屉 详情 -->
<BasicDrawer
v-if="editVisible"
ref="drawer"
:default-mode="editMode"
:info-data="alarmForm"
:sections="[
{
name: '基本信息',
key: 'base',
rows: drawerBaseInfoRows,
},
{
name: '属性列表',
key: 'attrs',
props: drawerListProps,
url: '/base/equipment-plc-param/page',
urlCreate: '/base/equipment-plc-param/create',
urlUpdate: '/base/equipment-plc-param/update',
urlDelete: '/base/equipment-plc-param/delete',
urlDetail: '/base/equipment-plc-param/get',
queryParams: {
connectId: alarmForm.id,
pageNo: 1,
pageSize: 10,
},
tableBtn: [
this.$auth.hasPermi('base:equipment-plc-param:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-param:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
allowAdd: true,
},
]"
@refreshDataList="getList"
@cancel="editVisible = false"
@destroy="editVisible = false" />
</div>
</template>
<script>
import {
createEquipmentPlcConnect,
updateEquipmentPlcConnect,
deleteEquipmentPlcConnect,
getEquipmentPlcConnect,
getEquipmentPlcConnectPage,
exportEquipmentPlcConnectExcel,
} from '@/api/base/equipmentPlcConnect';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import './http';
import BasicDrawer from './components/BasicDrawer.vue';
import { publicFormatter } from '@/utils/dict';
export default {
name: 'EquipmentPlcConnect',
mixins: [basicPageMixin],
components: { BasicDrawer },
data() {
return {
searchBarKeys: ['equipmentId', 'plcId'],
// tableBtn: [
// this.$auth.hasPermi('base:equipment-plc:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-plc:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableBtn: [
{
type: 'detail',
btnName: '参数绑定',
},
{
type: 'edit',
btnName: '修改',
},
// {
// type: 'params-bind',
// btnName: '',
// },
{
type: 'delete',
btnName: '删除',
},
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipmentName', label: '设备名' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'plcCode', label: '关联表编码' },
{ prop: 'plcTableName', label: '关联表名' },
{ prop: 'plcName', label: '标识名称' },
{ prop: 'bindingParameters', label: '绑定参数数量' },
// {
// _action: 'params-bind',
// label: '',
// subcomponent: {
// props: ['injectData'],
// render: function (h) {
// const _this = this;
// return h(
// 'el-button',
// {
// props: { type: 'text' },
// on: {
// click: function () {
// console.log('inejctdata', _this.injectData);
// _this.$emit('emitData', {
// action: _this.injectData._action,
// payload: _this.injectData,
// });
// },
// },
// },
// ''
// );
// },
// },
// },
],
searchBarFormConfig: [
{
type: 'select',
label: '设备名',
placeholder: '请选择设备',
param: 'equipmentId',
selectOptions: [],
},
{
type: 'select',
label: '编码',
placeholder: '请选择编码',
param: 'plcId',
selectOptions: [],
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
// type: this.$auth.hasPermi('base:equipment-plc:create')
// ? 'button'
// : '',
type: 'button',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:equipment-plc:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
select: true,
label: '关联表名',
prop: 'plcId',
labelKey: `plcTableName`,
url: '/base/equipment-plc/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
],
[
{
select: true,
label: '设备',
prop: 'equipmentId',
url: '/base/equipment/page?pageNo=1&pageSize=99',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
],
],
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
plcId: null,
equipmentId: null,
},
//
form: {},
//
editVisible: false,
editMode: '',
drawerBaseInfoRows: [
[
{
input: true,
label: '设备名',
prop: 'equipmentName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
// bind: {
// disabled: this.editMode == 'detail', // some condition, like detail mode...
// }
},
{
input: true,
label: '关联表名',
prop: 'plcTableName',
// url: '/base/equipment/getCode',
},
],
],
drawerListProps: [
{ prop: 'plcParamName', label: '参数列名' },
{ prop: 'name', label: '参数名称' },
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'equipmentParamType',
label: '设备参数类型',
filter: (val) =>
val != null
? ['', '一般参数', '工艺参数', '报警参数', ''][val]
: '-',
},
{
prop: 'productionParamType',
label: '生产参数类型',
filter: (val) =>
val != null
? // ? ['', '', '', '', '', ''][val]
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
: '-',
},
{
prop: 'collection',
label: '是否采集',
filter: (val) => (val != null ? ['否', '是'][val] : '-'),
},
{ prop: 'minValue', label: '最小值' },
{ prop: 'maxValue', label: '最大值' },
{ prop: 'defaultValue', label: '标准值' },
{ prop: 'description', label: '描述' },
{ prop: 'remark', label: '备注' },
],
alarmForm: {
id: undefined,
equipmentName: undefined,
plcTableName: undefined,
},
};
},
created() {
this.getList();
this.initSearchOptions();
},
methods: {
async getEquipmentOptions() {
const res = await this.$axios({
url: '/base/equipment/listAll',
method: 'get',
});
return res.data;
},
async getPlcOptions() {
const res = await this.$axios({
url: '/base/equipment-plc/listAll',
method: 'get',
});
return res.data;
},
/** 初始化查询条件 */
async initSearchOptions() {
Promise.all([this.getEquipmentOptions(), this.getPlcOptions()]).then(
([eqList, plcList]) => {
this.searchBarFormConfig[0].selectOptions = eqList.map((item) => {
return {
name: item.name,
id: item.id,
};
});
this.searchBarFormConfig[1].selectOptions = plcList.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
);
},
/** 覆盖 handleEmitFun 的默认实现 */
handleEmitFun({ action, payload }) {
switch (action) {
case 'params-bind':
this.reset();
const {
id,
equipmentName,
equipmentId,
plcId,
plcName,
plcTableName,
} = payload;
// console.log('Cha', id, equipmentName, plcTableName);
this.$router.push({
name: 'EquipmentPlcParam',
params: {
id,
equipmentName,
plcTableName,
},
});
break;
}
},
/** 查询列表 */
getList() {
this.loading = true;
//
getEquipmentPlcConnectPage(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
plcId: undefined,
equipmentId: undefined,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加设备与实时采集关系表(一对多)';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getEquipmentPlcConnect(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改设备与实时采集关系表(一对多)';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
//
handleDetail(row) {
// debugger;
const {
id,
bindingParameters,
equipmentCode,
equipmentId,
equipmentName,
plcCode,
plcId,
plcName,
plcTableName,
productionLine,
workshopSection,
} = row;
//
this.editMode = 'detail';
this.alarmForm.id = id;
this.alarmForm.plcTableName = plcTableName; //
this.alarmForm.equipmentName = equipmentName;
this.editVisible = true;
this.$nextTick(() => {
this.$refs['drawer'].init();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否删除该配置?')
.then(function () {
return deleteEquipmentPlcConnect(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有设备与实时采集关系表(一对多)数据项?')
.then(() => {
this.exportLoading = true;
return exportEquipmentPlcConnectExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备与实时采集关系表(一对多).xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,3 +1,10 @@
<!--
filename: CollectionConfig.vue
author: liubin
date: 2023-10-30 10:09:03
description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
@ -12,7 +19,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -34,17 +42,21 @@
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="700px"
width="30%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
<!-- <DialogForm v-if="open" ref="form" v-model="form" :rows="rows" /> -->
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit" />
</base-dialog>
<!-- 抽屉 详情 -->
<BasicDrawer
v-if="editVisible"
ref="drawer"
size="45%"
:default-mode="editMode"
:info-data="alarmForm"
:sections="[
@ -52,9 +64,13 @@
name: '基本信息',
key: 'base',
rows: drawerBaseInfoRows,
url: '/base/equipment-plc-connect/get',
urlUpdate: '/base/equipment-plc-connect/update',
urlCreate: '/base/equipment-plc-connect/create',
queryParams: { id: alarmForm.id },
},
{
name: '属性列表',
name: '采集参数',
key: 'attrs',
props: drawerListProps,
url: '/base/equipment-plc-param/page',
@ -68,18 +84,26 @@
pageSize: 10,
},
tableBtn: [
this.$auth.hasPermi('base:equipment-plc-param:update')
? {
{
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-param:delete')
? {
},
{
type: 'delete',
btnName: '删除',
}
: undefined,
},
// this.$auth.hasPermi('equipment:collection-config-param:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:collection-config-param:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v),
allowAdd: true,
},
@ -99,67 +123,60 @@ import {
getEquipmentPlcConnectPage,
exportEquipmentPlcConnectExcel,
} from '@/api/base/equipmentPlcConnect';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import './http';
import BasicDrawer from './components/BasicDrawer.vue';
import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './add-or-updata';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default {
name: 'EquipmentPlcConnect',
mixins: [basicPageMixin],
components: { BasicDrawer },
mixins: [basicPageMixin, tableHeightMixin],
components: { BasicDrawer, AddOrUpdate },
data() {
return {
searchBarKeys: ['equipmentId', 'plcId'],
// tableBtn: [
// this.$auth.hasPermi('base:equipment-plc:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('base:equipment-plc:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
// ].filter((v) => v),
tableBtn: [
{
this.$auth.hasPermiAnd([
'base:equipment-plc-connect:query',
'base:equipment-plc-param:query'
])
? {
type: 'detail',
btnName: '参数绑定',
},
{
} : undefined,
this.$auth.hasPermiAnd([
'base:equipment-plc-connect:update',
'base:equipment-plc-connect:query',
'base:equipment-plc-param:create',
'base:equipment-plc-param:update',
'base:equipment-plc-param:delete',
'base:equipment-plc-param:query'
])
? {
type: 'edit',
btnName: '修改',
},
// {
// type: 'params-bind',
// btnName: '',
// },
{
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-connect:delete')
? {
type: 'delete',
btnName: '删除',
},
],
}
: undefined,
].filter((v) => v),
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipmentName', label: '设备名' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'plcCode', label: '关联表编码' },
{ prop: 'plcTableName', label: '关联表名' },
{ prop: 'plcName', label: '标识名称' },
{ prop: 'bindingParameters', label: '绑定参数数量' },
{ prop: 'productionLine', label: '产线', minWidth: 120, showOverflowtooltip: true },
{ prop: 'workshopSection', label: '工段', minWidth: 120, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名', minWidth: 120, showOverflowtooltip: true },
{ prop: 'equipmentCode', label: '设备编码', minWidth: 200, showOverflowtooltip: true },
{ prop: 'plcCode', label: '关联表编码', minWidth: 220, showOverflowtooltip: true },
{ prop: 'plcTableName', label: '关联表名', minWidth: 150, showOverflowtooltip: true },
{ prop: 'plcName', label: '标识名称', minWidth: 150, showOverflowtooltip: true },
{ prop: 'bindingParameters', label: '绑定参数数量', minWidth: 120, showOverflowtooltip: true },
// {
// _action: 'params-bind',
// label: '',
@ -194,13 +211,15 @@ export default {
placeholder: '请选择设备',
param: 'equipmentId',
selectOptions: [],
filterable: true,
},
{
type: 'select',
label: '编码',
placeholder: '请选择编码',
label: '关联表编码',
placeholder: '请选择关联表编码',
param: 'plcId',
selectOptions: [],
filterable: true,
},
{
type: 'button',
@ -209,20 +228,21 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('base:equipment-plc-connect:create')
? 'separate' : '',
},
{
// type: this.$auth.hasPermi('base:equipment-plc:create')
// ? 'button'
// : '',
type: 'button',
type: this.$auth.hasPermi('base:equipment-plc-connect:create')
? 'button'
: '',
// type: 'button',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:equipment-plc:export') ? 'button' : '',
// type: this.$auth.hasPermi('equipment:collection-config:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
@ -236,7 +256,9 @@ export default {
prop: 'plcId',
labelKey: `plcTableName`,
url: '/base/equipment-plc/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '关联表名不能为空', trigger: 'blur' },
],
bind: {
filterable: true,
},
@ -247,8 +269,10 @@ export default {
select: true,
label: '设备',
prop: 'equipmentId',
url: '/base/equipment/page?pageNo=1&pageSize=99',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
url: '/base/core-equipment/page?pageNo=1&pageSize=99',
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
bind: {
filterable: true,
},
@ -259,7 +283,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
plcId: null,
equipmentId: null,
},
@ -274,7 +298,9 @@ export default {
input: true,
label: '设备名',
prop: 'equipmentName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
rules: [
{ required: true, message: '设备名不能为空', trigger: 'blur' },
],
// bind: {
// disabled: this.editMode == 'detail', // some condition, like detail mode...
// }
@ -283,7 +309,7 @@ export default {
input: true,
label: '关联表名',
prop: 'plcTableName',
// url: '/base/equipment/getCode',
// url: '/base/core-equipment/getCode',
},
],
],
@ -295,6 +321,23 @@ export default {
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'equipmentParamType',
label: '设备参数类型',
filter: (val) =>
val != null
? ['', '一般参数', '工艺参数', '报警参数', ''][val]
: '-',
},
{
prop: 'productionParamType',
label: '生产参数类型',
filter: (val) =>
val != null
? // ? ['', '', '', '', '', ''][val]
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
: '-',
},
{
prop: 'collection',
label: '是否采集',
@ -318,6 +361,10 @@ export default {
this.initSearchOptions();
},
methods: {
successSubmit() {
this.cancel()
this.getList()
},
async getEquipmentOptions() {
const res = await this.$axios({
url: '/base/equipment/listAll',
@ -325,7 +372,6 @@ export default {
});
return res.data;
},
async getPlcOptions() {
const res = await this.$axios({
url: '/base/equipment-plc/listAll',
@ -346,7 +392,7 @@ export default {
});
this.searchBarFormConfig[1].selectOptions = plcList.map((item) => {
return {
name: item.name,
name: item.code,
id: item.id,
};
});
@ -403,6 +449,19 @@ export default {
};
this.resetForm('form');
},
handleTableBtnClick({ data, type }) {
switch (type) {
case 'edit':
this.handleDetail(data, 'edit');
break;
case 'delete':
this.handleDelete(data);
break;
case 'detail':
this.handleDetail(data);
break;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
@ -417,7 +476,10 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = '添加设备与实时采集关系表(一对多)';
this.title = '添加设备采集配置';
this.$nextTick(() => {
this.$refs.addOrUpdate.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -426,35 +488,16 @@ export default {
getEquipmentPlcConnect(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改设备与实时采集关系表(一对多)';
this.title = '修改设备采集配置';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
updateEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
createEquipmentPlcConnect(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
this.$refs.addOrUpdate.dataFormSubmit()
},
//
handleDetail(row) {
handleDetail(row, mode = 'detail') {
// debugger;
const {
id,
@ -470,7 +513,7 @@ export default {
workshopSection,
} = row;
//
this.editMode = 'detail';
this.editMode = mode;
this.alarmForm.id = id;
this.alarmForm.plcTableName = plcTableName; //
this.alarmForm.equipmentName = equipmentName;

View File

@ -299,7 +299,7 @@ export default {
}
})
clipboard.on('error', e => {
this.$message.error('代码复制失败')
this.$message.warning('代码复制失败')
})
},
created() {

View File

@ -42,7 +42,7 @@ export default {
created() {
this.leaveId = this.id || this.$route.query.id;
if (!this.leaveId) {
this.$message.error('未传递 id 参数,无法查看 OA 请假信息');
this.$message.warning('未传递 id 参数,无法查看 OA 请假信息');
return;
}
this.getDetail();

View File

@ -167,7 +167,7 @@ export default {
created() {
this.id = this.$route.query.id;
if (!this.id) {
this.$message.error('未传递 id 参数,无法查看流程信息');
this.$message.warning('未传递 id 参数,无法查看流程信息');
return;
}
this.getDetail();
@ -185,7 +185,7 @@ export default {
this.processInstanceLoading = true;
getProcessInstance(this.id).then(response => {
if (!response.data) {
this.$message.error('查询不到流程信息!');
this.$message.warning('查询不到流程信息!');
return;
}
//

View File

@ -217,7 +217,7 @@ export default {
response.data == null ||
response.data.trim() == ''
) {
this.$message.error('上传出错了!');
this.$message.warning('上传出错了!');
return;
}
this.files.push({

View File

@ -361,7 +361,7 @@ export default {
//
handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备信息');
if (!this.dataId) return this.$message.warning('请先创建设备信息');
this.attrForm = {
id: null,
equipmentId: this.dataId,

View File

@ -215,8 +215,7 @@ export default {
type: this.$auth.hasPermi('base:equipment:export') ? 'button' : '',
btnName: '导出',
name: 'export',
plain: true,
color: 'primary',
color: 'warning',
},
{
type: this.$auth.hasPermi('base:equipment:create') ? 'button' : '',

View File

@ -69,7 +69,7 @@ export default {
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
return this.$message.warning(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({

View File

@ -197,8 +197,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};

View File

@ -147,8 +147,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};

View File

@ -190,8 +190,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};

View File

@ -142,8 +142,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
};

View File

View File

@ -0,0 +1,114 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:59:45
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="materialName">
<el-input
v-model="dataForm.materialName"
disabled
placeholder="请输入原料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="matPrice">
<el-input
v-model="dataForm.matPrice"
disabled
style="width: 70%"
placeholder="请输入单价" />
(/)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateMaterialHis } from '@/api/cost/costMaterial';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateMaterialHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
matPrice: undefined,
materialName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,346 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getMaterialPage } from '@/api/base/material';
import {
getMaterialHisPage,
getMaterialRealtimePage,
} from '@/api/cost/costMaterial';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'materialName',
label: '原料名称',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'materialName',
label: '原料名称',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'time',
label: '单价生效时间',
subcomponent: typeRule,
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costMaterial',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getMaterialHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getMaterialPage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.materialId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
toggleTab() {
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getMaterialRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,23 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>{{ parseTime(injectData.startTime,'{y}年{m}月{d}日') + '-' + (parseTime(injectData.endTime)?parseTime(injectData.endTime,'{y}年{m}月{d}日'):'永久') }}</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -0,0 +1,104 @@
<template>
<div class="app-container">
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLog';
import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableData: [],
};
},
components: {
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:51:30
* @LastEditTime: 2024-09-05 15:34:49
* @Description:
-->
<template>
@ -11,6 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">

View File

@ -1,4 +1,15 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
@ -14,10 +25,6 @@
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
@ -60,15 +67,23 @@
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import { getEnergyHisPage, getEnergyRealtimePage } from '@/api/cost/costEnergyDeep';
import {
getEnergyHisPage,
getEnergyRealtimePage,
exportEnergyRealtimeExcel,
exportEnergyHisExcel,
} from '@/api/cost/costEnergyDeep';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
@ -170,6 +185,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
@ -197,6 +221,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@ -218,6 +251,7 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
@ -231,6 +265,8 @@ export default {
},
methods: {
buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
@ -253,7 +289,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -264,7 +301,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@ -275,9 +313,14 @@ export default {
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
@ -305,6 +348,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportEnergyHisExcel;
title = '深加工能源成本-历史成本';
} else {
exportURL = exportEnergyRealtimeExcel;
title = '深加工能源成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:29:30
* @LastEditTime: 2024-09-05 15:36:49
* @Description:
-->
<template>
@ -46,7 +46,7 @@
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
disabled
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>

View File

@ -1,4 +1,15 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
@ -14,10 +25,6 @@
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
@ -61,6 +68,7 @@
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
@ -70,9 +78,13 @@ import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
import {
getRawOthercostHisPage,
getRawOthercostSunPage,
exportRawOthercostSunExcel,
exportRawOthercostHisExcel
} from '@/api/cost/costOthercostHisDeep';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
@ -147,6 +159,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
@ -175,6 +196,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@ -196,6 +226,7 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
@ -209,6 +240,8 @@ export default {
},
methods: {
buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
@ -231,7 +264,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.name = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -242,7 +276,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@ -253,9 +288,14 @@ export default {
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
@ -279,6 +319,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportRawOthercostHisExcel;
title = '深加工其它成本-历史成本';
} else {
exportURL = exportRawOthercostSunExcel;
title = '深加工其它成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:59:49
* @LastEditTime: 2024-09-05 15:35:07
* @Description:
-->
<template>
@ -11,6 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">

View File

@ -141,12 +141,12 @@ export default {
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
};
},
@ -181,8 +181,11 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
@ -202,6 +205,24 @@ export default {
} else {
this.otherMethods(val)
}
},
/** 导出按钮操作 */
handleExport() {
let title;
title = '深加工其它成本-成本记录';
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return this.urlOptions.exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:56:17
* @LastEditTime: 2024-09-03 14:52:51
* @Description:
-->
<template>
@ -17,7 +17,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="label">
<el-input v-model="dataForm.label" clearable readonly />
<el-input v-model="dataForm.label" clearable disabled />
</el-form-item>
</el-col>
<el-col :span="12">
@ -49,7 +49,7 @@
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="three">
<el-form-item label="折旧率" prop="ratio">
<el-form-item label="折旧率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"

View File

@ -0,0 +1,132 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-05 15:35:29
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="productionLineName">
<el-input
style="width: 100%"
v-model="dataForm.productionLineName"
disabled />
</el-form-item>
</el-col>
<el-col :span="12" v-if="activeName==='now'">
<el-form-item label="工段" prop="workshopSectionName">
<el-input
style="width: 100%"
v-model="dataForm.workshopSectionName"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="activeName==='his'?'上片数量':'进片数量'" prop="innum">
<el-input-number
:min="0"
style="width: 90%"
v-model="dataForm.innum"
clearable
placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="activeName==='his'?'下片数量':'出片数量'" prop="outnum">
<el-input-number
:min="0"
style="width: 90%"
v-model="dataForm.outnum"
clearable
placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 90%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateDeepRatioHis } from '@/api/cost/costDeepRatioHis';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updateDeepRatioHis,
},
dataForm: {
id: undefined,
productionLineName: undefined,
innum: undefined,
outnum: undefined,
ratio: undefined,
},
dataRule: {},
activeName: 'his'
};
},
methods: {
init(val, statisticType, activeName) {
this.activeName = activeName
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const udata = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
modifyInnum: this.dataForm.innum,
modifyOutnum: this.dataForm.outnum,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
};
//
this.urlOptions.updateURL(udata).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,376 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['产线良品率', '工段良品率']" @change="currentMenu">
<template v-slot:tab1>
<div>产线良品率</div>
</template>
<template v-slot:tab2>
<div>工段良品率</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLinePage } from '@/api/base/productionLine';
import {
getDeepPDRatioHisPage,
getDeepWSRatioHisPage,
exportDeepWSRatioHisExcel,
exportDeepPDRatioHisExcel,
} from '@/api/cost/costDeepRatioHis';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'productionLineName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'innum',
label: '上片数量',
},
{
prop: 'outnum',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
];
const tableProps2 = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'productionLineName',
label: '产线',
},
{
prop: 'workshopSectionName',
label: '工段',
},
{
prop: 'innum',
label: '进片数量',
},
{
prop: 'outnum',
label: '出片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
];
export default {
name: 'costDeepRatioHis',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getDeepPDRatioHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-ratio-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params ={
pageNo: 1,
pageSize: 100,
pdType: 0
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.productionLineId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '产线良品率' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.productionLineId = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm.resetForm();
this.listQuery.productionLineId = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
getDeepWSRatioHisPage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(
val.data,
this.listQuery.statisticType,
this.activeName
);
});
} else {
this.otherMethods(val);
}
},
successSubmit() {
this.handleCancel();
const val = this.activeName === 'his' ? '产线良品率' : 'now';
this.currentMenu(val);
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportDeepPDRatioHisExcel;
title = '深加工-产线良品率';
} else {
exportURL = exportDeepWSRatioHisExcel;
title = '深加工-工段良品率';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,160 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-02 15:54:20
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="bindObjectName">
<el-input
v-model="dataForm.bindObjectName"
disabled
placeholder="产线" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上片数量" prop="inCount">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.inCount"
clearable
placeholder="请输入上片数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片数量" prop="outCount">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.outCount"
clearable
placeholder="请输入下片数量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="深加工成本" prop="costSum">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costSum"
clearable
placeholder="请输入深加工成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单片成本" prop="costPiece">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costPiece"
clearable
placeholder="请输入单片成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="每平米成本" prop="costArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costArea"
clearable
placeholder="请输入每平米成本" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateDeepCostStatistics } from '@/api/cost/deepCostStatistics';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateDeepCostStatistics,
},
dataForm: {
id: undefined,
bindObjectName: undefined,
inCount: undefined,
ratio: undefined,
costPiece: undefined,
costArea: undefined,
costSum: undefined,
outCount: undefined,
},
dataRule: {
costSum: [
{ required: true, message: '深加工成本不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const data = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
bindObjectName: this.dataForm.bindObjectName,
modifyInCount: this.dataForm.inCount,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
modifyCostPiece: this.dataForm.costPiece,
modifyCostArea: this.dataForm.costArea,
modifyCostSum: this.dataForm.costSum,
modifyOutCount: this.dataForm.outCount,
};
//
this.urlOptions.updateURL(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,440 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLinePage } from '@/api/base/productionLine';
import {
getDeepCostStatisticsPage,
getDeepCostStatisticsRealtimePage,
exportDeepStatisticsRealtimeExcel,
exportDeepCostStatisticsHisExcel,
} from '@/api/cost/deepCostStatistics';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '时间',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'inCount',
label: '上片数量',
},
{
prop: 'outCount',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
{
prop: 'costSum',
label: '深加工成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '单片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'inCount',
label: '上片数量',
},
{
prop: 'outCount',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
{
prop: 'costSum',
label: '深加工成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '单片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
export default {
name: 'costMaterial',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getDeepCostStatisticsPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params ={
pageNo: 1,
pageSize: 100,
pdType: 0
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[1].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
this.formConfig2[0].startPlaceholder = '开始时间';
this.formConfig2[0].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[0].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[0].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getDeepCostStatisticsRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportDeepCostStatisticsHisExcel;
title = '深加工成本统计-历史成本';
} else {
exportURL = exportDeepStatisticsRealtimeExcel;
title = '深加工成本统计-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,23 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>{{ parseTime(injectData.startTime,'{y}年{m}月{d}日') + '-' + (parseTime(injectData.endTime)?parseTime(injectData.endTime,'{y}年{m}月{d}日'):'永久') }}</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -0,0 +1,104 @@
<template>
<div class="app-container">
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</div>
</template>
<script>
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLog';
import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableData: [],
};
},
components: {
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.handleExport();
break;
default:
console.log(val);
}
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:45:32
* @LastEditTime: 2024-09-05 15:34:14
* @Description:
-->
<template>
@ -11,6 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
@ -28,10 +29,30 @@
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
disabled
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="dataForm.bindObjectName ? '监控对象' : '抄表名'"
prop="showName">
<el-input
v-model="dataForm.showName"
disabled
:placeholder="dataForm.bindObjectName ? '监控对象' : '抄表名'" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
@ -43,16 +64,6 @@
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
@ -74,6 +85,7 @@ export default {
quantity: undefined,
energyTypeName: undefined,
recTime: undefined,
showName: undefined
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
@ -90,6 +102,11 @@ export default {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
if(this.dataForm.bindObjectName){
this.dataForm.showName = this.dataForm.bindObjectName
}else{
this.dataForm.showName = this.dataForm.meterName
}
});
},
//

View File

@ -1,4 +1,15 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
@ -14,10 +25,6 @@
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
@ -60,15 +67,23 @@
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import { getEnergyHisPage, getEnergyRealtimePage } from '@/api/cost/costEnergy';
import {
getEnergyHisPage,
getEnergyRealtimePage,
exportEnergyRealtimeExcel,
exportEnergyHisExcel,
} from '@/api/cost/costEnergy';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
@ -170,6 +185,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
@ -197,6 +221,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@ -218,6 +251,7 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
@ -231,6 +265,8 @@ export default {
},
methods: {
buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
@ -253,7 +289,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -264,7 +301,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@ -275,9 +313,14 @@ export default {
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
@ -305,6 +348,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportEnergyHisExcel;
title = '能源成本-历史成本';
} else {
exportURL = exportEnergyRealtimeExcel;
title = '能源成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:59:45
* @LastEditTime: 2024-09-05 15:34:28
* @Description:
-->
<template>
@ -11,6 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
@ -31,17 +32,6 @@
(/)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
@ -53,6 +43,17 @@
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>

View File

@ -1,4 +1,15 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
@ -14,10 +25,6 @@
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
@ -60,6 +67,7 @@
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
@ -69,10 +77,14 @@ import { getMaterialPage } from '@/api/base/material';
import {
getMaterialHisPage,
getMaterialRealtimePage,
exportMaterialRealtimeExcel,
exportMaterialHisExcel,
} from '@/api/cost/costMaterial';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
@ -83,15 +95,15 @@ const tableProps = [
prop: 'materialName',
label: '原料名称',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'price',
label: '总价(元)',
@ -103,20 +115,21 @@ const tableProps2 = [
prop: 'materialName',
label: '原料名称',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'time',
label: '单价生效时间',
subcomponent: typeRule,
width: 300,
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'materialPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'price',
label: '总价(元)',
@ -169,6 +182,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
@ -196,6 +218,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@ -217,6 +248,7 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
@ -230,6 +262,8 @@ export default {
},
methods: {
buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
@ -252,7 +286,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.materialId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -263,7 +298,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@ -274,9 +310,14 @@ export default {
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[1].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[1].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
@ -304,6 +345,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportMaterialHisExcel;
title = '原料成本-历史成本';
} else {
exportURL = exportMaterialRealtimeExcel;
title = '原料成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 11:12:58
* @LastEditTime: 2024-09-05 15:33:16
* @Description:
-->
<template>
@ -11,6 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
@ -18,70 +19,7 @@
<el-input
style="width: 100%"
v-model="dataForm.bindObjectName"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厚度" prop="thick">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.thick"
clearable
placeholder="请输入厚度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="在线速度" prop="speed">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.speed"
clearable
placeholder="请输入在线速度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="掰边宽度" prop="width">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.width"
clearable
placeholder="请输入掰边宽度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="拉引量" prop="inArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.inArea"
clearable
placeholder="请输入拉引量" />
(/m²)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片面积" prop="outArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.outArea"
clearable
placeholder="请输入下片面积" />
(/m²)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
disabled />
</el-form-item>
</el-col>
<el-col :span="12">
@ -91,10 +29,73 @@
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
disabled
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厚度" prop="thick">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.thick"
clearable
placeholder="请输入厚度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="在线速度" prop="speed">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.speed"
clearable
placeholder="请输入在线速度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="掰边宽度" prop="width">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.width"
clearable
placeholder="请输入掰边宽度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="拉引量" prop="inArea">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.inArea"
clearable
placeholder="请输入拉引量" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片面积" prop="outArea">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.outArea"
clearable
placeholder="请输入下片面积" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>

View File

@ -43,8 +43,8 @@
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLineAll } from '@/api/base/productionLine';
import { getcostOriginRatioHisPage } from '@/api/cost/costOriginRatioHis';
import { getLinePage } from '@/api/base/productionLine';
import { getcostOriginRatioHisPage,exportcostOriginRatioHisExcel } from '@/api/cost/costOriginRatioHis';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
@ -52,10 +52,12 @@ const tableProps = [
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
width:130,
},
{
prop: 'bindObjectName',
label: '产线',
width:145,
},
{
prop: 'thick',
@ -128,6 +130,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@ -148,8 +159,13 @@ export default {
AddOrUpdate,
},
created() {
getLineAll().then((response) => {
this.formConfig[1].selectOptions = response.data;
const params ={
pageNo: 1,
pageSize: 100,
pdType: 1
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
});
},
methods: {
@ -172,7 +188,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -195,6 +212,25 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
exportURL = exportcostOriginRatioHisExcel;
title = '原片成本-原片良品率';
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:29:30
* @LastEditTime: 2024-09-05 15:36:45
* @Description:
-->
<template>
@ -46,7 +46,7 @@
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
disabled
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>

View File

@ -1,4 +1,15 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
@ -14,10 +25,6 @@
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
@ -61,6 +68,7 @@
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
@ -70,9 +78,13 @@ import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
import {
getRawOthercostHisPage,
getRawOthercostSunPage,
exportRawOthercostSunExcel,
exportRawOthercostHisExcel
} from '@/api/cost/costOthercostHis';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
@ -147,6 +159,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
@ -175,6 +196,15 @@ export default {
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
@ -196,6 +226,7 @@ export default {
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params = {
@ -231,7 +262,8 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.name = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -242,7 +274,8 @@ export default {
console.log(val);
}
},
toggleTab() {
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
@ -279,6 +312,30 @@ export default {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportRawOthercostHisExcel;
title = '原片其它成本-历史成本';
} else {
exportURL = exportRawOthercostSunExcel;
title = '原片其它成本-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-18 16:32:56
* @LastEditTime: 2024-09-05 15:33:48
* @Description:
-->
<template>
@ -11,6 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">

View File

@ -141,12 +141,12 @@ export default {
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
};
},
@ -181,8 +181,11 @@ export default {
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
@ -202,6 +205,24 @@ export default {
} else {
this.otherMethods(val)
}
},
/** 导出按钮操作 */
handleExport() {
let title;
title = '原片其它成本-成本记录';
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return this.urlOptions.exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-04-17 16:59:58
* @LastEditTime: 2024-09-03 14:53:54
* @Description:
-->
<template>
@ -17,7 +17,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="label">
<el-input v-model="dataForm.label" clearable readonly />
<el-input v-model="dataForm.label" clearable disabled />
</el-form-item>
</el-col>
<el-col :span="12">
@ -49,7 +49,7 @@
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="three">
<el-form-item label="折旧率" prop="ratio">
<el-form-item label="折旧率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"

View File

@ -0,0 +1,149 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-09-02 16:34:35
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="bindObjectName">
<el-input
v-model="dataForm.bindObjectName"
disabled
placeholder="产线" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="拉引量" prop="inArea">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.inArea"
clearable
placeholder="请输入拉引量" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片面积" prop="outArea">
<el-input-number
:min="0"
style="width: 85%"
v-model="dataForm.outArea"
clearable
placeholder="请输入下片面积" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原片成本" prop="costSum">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costSum"
clearable
placeholder="请输入原片成本" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="每平米成本" prop="costArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.costArea"
clearable
placeholder="请输入每平米成本" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateRawCostStatistics } from '@/api/cost/rawCostStatistics';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateRawCostStatistics,
},
dataForm: {
id: undefined,
bindObjectName: undefined,
inArea: undefined,
outArea: undefined,
ratio: undefined,
costArea: undefined,
costSum: undefined,
},
dataRule: {
costSum: [
{ required: true, message: '原片成本成本不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const data = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
bindObjectName: this.dataForm.bindObjectName,
modifyInArea: this.dataForm.inArea,
modifyOutArea: this.dataForm.outArea,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
modifyCostArea: this.dataForm.costArea,
modifyCostSum: this.dataForm.costSum,
};
//
this.urlOptions.updateURL(data).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,439 @@
<template>
<div>
<div style="background: #f2f4f9; height: 40px; width: 100%">
<ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<template v-slot:tab1>
<div>历史成本</div>
</template>
<template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLinePage } from '@/api/base/productionLine';
import {
getRawCostStatisticsPage,
getRawCostStatisticsRealtimePage,
exportRawStatisticsRealtimeExcel,
exportRawCostStatisticsHisExcel
} from '@/api/cost/rawCostStatistics';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [
{
prop: 'recTime',
label: '时间',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'thick',
label: '厚度',
},
{
prop: 'inArea',
label: '拉引量/m²',
},
{
prop: 'outArea',
label: '下片面积/m²',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
{
prop: 'costSum',
label: '原片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'spec',
label: '规格',
},
{
prop: 'inArea',
label: '拉引量/m²',
},
{
prop: 'outArea',
label: '下片面积/m²',
},
{
prop: 'outCount',
label: '下片数量',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
{
prop: 'costSum',
label: '原片成本/元',
align: 'right',
},
{
prop: 'costPiece',
label: '单片成本/元',
align: 'right',
},
{
prop: 'costArea',
label: '每平米成本/元',
align: 'right',
},
];
export default {
name: 'costMaterial',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawCostStatisticsPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig2: [
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
ButtonNav,
},
created() {
const params ={
pageNo: 1,
pageSize: 100,
pdType: 1
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[1].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
this.formConfig2[0].startPlaceholder = '开始时间';
this.formConfig2[0].endPlaceholder = '结束时间';
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
this.listQuery.startTime = parseTime(start).substr(0, 10) + ' 00:00:00';
this.listQuery.endTime = parseTime(end).substr(0, 10) + ' 23:59:59';
this.formConfig2[0].startPlaceholder = parseTime(start).substr(0, 10);
this.formConfig2[0].endPlaceholder = parseTime(end).substr(0, 10);
this.listQuery.name = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getRawCostStatisticsRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
/** 导出按钮操作 */
handleExport() {
let exportURL, title;
if (this.activeName === 'his') {
exportURL = exportRawCostStatisticsHisExcel;
title = '原片成本统计-历史成本';
} else {
exportURL = exportRawStatisticsRealtimeExcel;
title = '原片成本统计-成本查询';
}
//
let params = { ...this.listQuery };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
return exportURL(params);
})
.then((response) => {
this.$download.excel(response, title + '报表.xls');
})
.catch(() => {});
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,23 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>{{ parseTime(injectData.startTime,'{y}年{m}月{d}日') + '-' + (parseTime(injectData.endTime)?parseTime(injectData.endTime,'{y}年{m}月{d}日'):'永久') }}</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -99,8 +99,7 @@ export default {
type: this.$auth.hasPermi('base:energy-quantity-realtime:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true
color: 'warning',
}
],
tableProps,

View File

@ -116,8 +116,7 @@ export default {
type: this.$auth.hasPermi('monitoring:energy-report:export') ? 'button' : '',
btnName: '导出',
name: 'add',
color: 'primary',
plain: true
color: 'warning',
}
],
tableProps,

View File

@ -95,8 +95,7 @@ export default {
type: this.$auth.hasPermi('monitoring:energy-report-search:export') ? 'button' : '',
btnName: '导出',
name: 'add',
color: 'primary',
plain: true
color: 'warning',
}
],
tableProps,

View File

@ -268,7 +268,7 @@ export default {
switch (btnName) {
case 'search':
if (!payload.recordTime || payload.recordTime.length <= 0) {
this.$message.error('请选择时间段');
this.$message.warning('请选择时间段');
return;
}
this.startTime = new Date(payload.recordTime).getTime();
@ -491,7 +491,7 @@ export default {
if (code == 0) {
const newEqlist = this.objectToArray(data);
if (!newEqlist || newEqlist.length == 0) {
this.$message.error('该设备没有产量数据');
this.$message.warning('该设备没有产量数据');
return;
}
this.graphList.push(...newEqlist);

View File

@ -298,7 +298,7 @@ export default {
switch (btnName) {
case 'search':
if (!payload.recordTime || payload.recordTime.length <= 0) {
this.$message.error('请选择时间段');
this.$message.warning('请选择时间段');
return;
}
@ -333,7 +333,7 @@ export default {
async submitForm() {
if (this.existingEquipments.indexOf(this.queryParams.equipmentId) >= 0) {
this.$message.error('该设备已存在');
this.$message.warning('该设备已存在');
return;
}
const { code, data } = await this.$axios({
@ -344,7 +344,7 @@ export default {
if (code == 0) {
const newEqlist = this.objectToArray(data);
if (!newEqlist || newEqlist.length == 0) {
this.$message.error('该设备没有状态数据');
this.$message.warning('该设备没有状态数据');
return;
}
this.graphList.push(newEqlist[0]);

View File

@ -95,8 +95,7 @@ export default {
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'success',
plain: true
color: 'warning',
}
],
tableProps,

View File

@ -143,7 +143,7 @@ export default {
}
})
clipboard.on('error', e => {
this.$message.error('代码复制失败')
this.$message.warning('代码复制失败')
})
},
beforeDestroy() {
@ -239,10 +239,10 @@ export default {
location.origin
)
} else {
this.$message.error('请使用export default')
this.$message.warning('请使用export default')
}
} catch (err) {
this.$message.error(`js错误${err}`)
this.$message.warning(`js错误${err}`)
console.error(err)
}
},

View File

@ -61,7 +61,7 @@ export default {
}
})
clipboard.on('error', e => {
this.$message.error('代码复制失败')
this.$message.warning('代码复制失败')
})
},
beforeDestroy() {

View File

@ -264,7 +264,7 @@ export default {
}
})
clipboard.on('error', e => {
this.$message.error('代码复制失败')
this.$message.warning('代码复制失败')
})
},
methods: {

View File

@ -370,7 +370,7 @@ export default {
});
}
//
this.captchaEnable = getCaptchaEnable();
this.captchaEnable = false;
//
this.redirect = this.$route.query.redirect
? decodeURIComponent(this.$route.query.redirect)

View File

@ -230,7 +230,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询自动回复')
this.$message.warning('未选中公众号,无法查询自动回复')
return false
}

View File

@ -135,7 +135,7 @@ export default {
//
quill.setSelection(length + 1)
} else {
this.$message.error('图片插入失败')
this.$message.warning('图片插入失败')
}
// loading
this.quillUpdateImg = false;
@ -144,7 +144,7 @@ export default {
uploadError() {
// loading
this.quillUpdateImg = false;
this.$message.error("图片插入失败");
this.$message.warning("图片插入失败");
}
}
}

View File

@ -238,12 +238,12 @@ export default {
|| file.type === 'image/bmp'
|| file.type === 'image/jpg';
if (!isType) {
this.$message.error('上传图片格式不对!');
this.$message.warning('上传图片格式不对!');
return false;
}
const isLt = file.size / 1024 / 1024 < 2;
if (!isLt) {
this.$message.error('上传图片大小不能超过 2M!');
this.$message.warning('上传图片大小不能超过 2M!');
return false;
}
this.uploadData.accountId = this.objData.accountId;
@ -257,13 +257,13 @@ export default {
|| file.type === 'audio/wav'
|| file.type === 'audio/amr';
if (!isType) {
this.$message.error('上传语音格式不对!' + file.type);
this.$message.warning('上传语音格式不对!' + file.type);
return false;
}
//
const isLt = file.size / 1024 / 1024 < 2;
if (!isLt) {
this.$message.error('上传语音大小不能超过 2M!');
this.$message.warning('上传语音大小不能超过 2M!');
return false;
}
this.uploadData.accountId = this.objData.accountId;
@ -277,13 +277,13 @@ export default {
|| file.type === 'image/bmp'
|| file.type === 'image/jpg';
if (!isType) {
this.$message.error('上传图片格式不对!');
this.$message.warning('上传图片格式不对!');
return false;
}
//
const isLt = file.size / 1024 / 1024 < 2;
if (!isLt) {
this.$message.error('上传图片大小不能超过 2M!');
this.$message.warning('上传图片大小不能超过 2M!');
return false;
}
this.uploadData.accountId = this.objData.accountId;
@ -293,13 +293,13 @@ export default {
//
const isType = file.type === 'video/mp4';
if (!isType) {
this.$message.error('上传视频格式不对!');
this.$message.warning('上传视频格式不对!');
return false;
}
//
const isLt = file.size / 1024 / 1024 < 10;
if (!isLt) {
this.$message.error('上传视频大小不能超过 10M!');
this.$message.warning('上传视频大小不能超过 10M!');
return false;
}
this.uploadData.accountId = this.objData.accountId;
@ -307,7 +307,7 @@ export default {
},
handleUploadSuccess(response, file, fileList) {
if (response.code !== 0) {
this.$message.error('上传出错:' + response.msg)
this.$message.warning('上传出错:' + response.msg)
return false;
}

View File

@ -234,7 +234,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询草稿箱')
this.$message.warning('未选中公众号,无法查询草稿箱')
return false
}
@ -390,13 +390,13 @@ export default {
|| file.type === 'image/bmp'
|| file.type === 'image/jpg';
if (!isType) {
this.$message.error('上传图片格式不对!')
this.$message.warning('上传图片格式不对!')
this.addMaterialLoading = false
return false;
}
const isLt = file.size / 1024 / 1024 < 2
if (!isLt) {
this.$message.error('上传图片大小不能超过 2M!')
this.$message.warning('上传图片大小不能超过 2M!')
this.addMaterialLoading = false
return false;
}
@ -406,7 +406,7 @@ export default {
handleUploadSuccess(response, file, fileList) {
this.addMaterialLoading = false // loading
if (response.code !== 0) {
this.$message.error('上传出错:' + response.msg)
this.$message.warning('上传出错:' + response.msg)
return false;
}

View File

@ -105,7 +105,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询已发表图文')
this.$message.warning('未选中公众号,无法查询已发表图文')
return false
}

View File

@ -244,7 +244,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询草稿箱')
this.$message.warning('未选中公众号,无法查询草稿箱')
return false
}
@ -292,12 +292,12 @@ export default {
|| file.type === 'image/bmp'
|| file.type === 'image/jpg';
if (!isType) {
this.$message.error('上传图片格式不对!')
this.$message.warning('上传图片格式不对!')
return false;
}
const isLt = file.size / 1024 / 1024 < 2
if (!isLt) {
this.$message.error('上传图片大小不能超过 2M!')
this.$message.warning('上传图片大小不能超过 2M!')
return false;
}
this.loading = true
@ -310,11 +310,11 @@ export default {
|| file.type === 'audio/amr';
const isLt = file.size / 1024 / 1024 < 2
if (!isType) {
this.$message.error('上传语音格式不对!')
this.$message.warning('上传语音格式不对!')
return false;
}
if (!isLt) {
this.$message.error('上传语音大小不能超过 2M!')
this.$message.warning('上传语音大小不能超过 2M!')
return false;
}
this.loading = true
@ -323,12 +323,12 @@ export default {
beforeVideoUpload(file){
const isType = file.type === 'video/mp4'
if (!isType) {
this.$message.error('上传视频格式不对!')
this.$message.warning('上传视频格式不对!')
return false;
}
const isLt = file.size / 1024 / 1024 < 10
if (!isLt) {
this.$message.error('上传视频大小不能超过 10M!')
this.$message.warning('上传视频大小不能超过 10M!')
return false
}
this.addMaterialLoading = true
@ -338,7 +338,7 @@ export default {
this.loading = false
this.addMaterialLoading = false
if (response.code !== 0) {
this.$message.error('上传出错:' + response.msg)
this.$message.warning('上传出错:' + response.msg)
return false;
}

View File

@ -203,7 +203,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询消息')
this.$message.warning('未选中公众号,无法查询消息')
return false
}

View File

@ -250,12 +250,12 @@ export default {
getSummary() {
//
if (!this.accountId) {
this.$message.error('未选中公众号,无法统计数据')
this.$message.warning('未选中公众号,无法统计数据')
return false
}
// 7 7
if (betweenDay(this.date[0], this.date[1]) >= 7) {
this.$message.error('时间间隔 7 天以内,请重新选择')
this.$message.warning('时间间隔 7 天以内,请重新选择')
return false
}
this.xAxisDate = []

View File

@ -136,7 +136,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询标签')
this.$message.warning('未选中公众号,无法查询标签')
return false
}

View File

@ -152,7 +152,7 @@ export default {
getList() {
//
if (!this.queryParams.accountId) {
this.$message.error('未选中公众号,无法查询用户')
this.$message.warning('未选中公众号,无法查询用户')
return false
}

View File

@ -318,12 +318,12 @@ export default {
fileBeforeUpload(file) {
let format = '.' + file.name.split(".")[1];
if (format !== this.fileAccept) {
this.$message.error('请上传指定格式"' + this.fileAccept + '"文件');
this.$message.warning('请上传指定格式"' + this.fileAccept + '"文件');
return false;
}
let isRightSize = file.size / 1024 / 1024 < 2
if (!isRightSize) {
this.$message.error('文件大小超过 2MB')
this.$message.warning('文件大小超过 2MB')
}
return isRightSize
},

View File

@ -267,12 +267,12 @@ export default {
pemFileBeforeUpload(file) {
let format = '.' + file.name.split(".")[1];
if (format !== this.fileAccept) {
this.$message.error('请上传指定格式"' + this.fileAccept + '"文件');
this.$message.warning('请上传指定格式"' + this.fileAccept + '"文件');
return false;
}
let isRightSize = file.size / 1024 / 1024 < 2
if (!isRightSize) {
this.$message.error('文件大小超过 2MB')
this.$message.warning('文件大小超过 2MB')
}
return isRightSize
},

View File

@ -332,7 +332,7 @@ export default {
let minDateTime = new Date(this.queryParams.createTime[0]).getTime();
let maxDateTime = new Date(this.queryParams.createTime[1]).getTime()
if (maxDateTime - minDateTime > oneMonthTime) {
this.$message.error('时间范围最大为 31 天!');
this.$message.warning('时间范围最大为 31 天!');
return false;
}
}

View File

@ -164,20 +164,20 @@ export default {
getDetail() {
// 1.1
if (!this.id) {
this.$message.error('未传递支付单号,无法查看对应的支付信息');
this.$message.warning('未传递支付单号,无法查看对应的支付信息');
this.goBackToList();
return;
}
getOrder(this.id).then(response => {
// 1.2
if (!response.data) {
this.$message.error('支付订单不存在,请检查!');
this.$message.warning('支付订单不存在,请检查!');
this.goBackToList();
return;
}
// 1.3
if (response.data.status !== PayOrderStatusEnum.WAITING.status) {
this.$message.error('支付订单不处于待支付状态,请检查!');
this.$message.warning('支付订单不处于待支付状态,请检查!');
this.goBackToList();
return;
}
@ -347,7 +347,7 @@ export default {
//
if (response.data.status === PayOrderStatusEnum.CLOSED.status) {
this.clearQueryInterval();
this.$message.error('支付已关闭!');
this.$message.warning('支付已关闭!');
this.goBackToList();
}
})

View File

@ -349,7 +349,7 @@ export default {
let minDateTime = new Date(this.queryParams.createTime[0]).getTime();
let maxDateTime = new Date(this.queryParams.createTime[1]).getTime()
if (maxDateTime - minDateTime > oneMonthTime) {
this.$message.error('时间范围最大为 31 天!');
this.$message.warning('时间范围最大为 31 天!');
return false;
}
}

68
sync_line.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/dl/free-software/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
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

17082
yarn.lock

File diff suppressed because it is too large Load Diff