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 # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2023-10-16 09:22:52 # @LastEditTime: 2024-09-10 14:43:39
# @LastEditors: DY # @LastEditors: zwq
# @Description: # @Description:
### ###
# 开发环境配置 # 开发环境配置
ENV = 'development' 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.49:48080'
# VUE_APP_BASE_API = 'http://192.168.1.8:48080' VUE_APP_BASE_API = 'http://line.kszny.picaiba.com'
VUE_APP_BASE_API = 'http://192.168.0.33:48080' # VUE_APP_BASE_API = 'http://192.168.1.40:48080'
# VUE_APP_BASE_API = 'http://192.168.1.188: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' 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://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' VUE_APP_APP_NAME ='yudao-admin'

View File

@ -6,9 +6,9 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"local": "vue-cli-service serve --mode local", "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", "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:stage": "vue-cli-service build --mode stage",
"build:dev": "vue-cli-service build --mode dev", "build:dev": "vue-cli-service build --mode dev",
"build:static": "vue-cli-service build --mode static", "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' import request from '@/utils/request'
// 获得所有工厂产线列表 // 获得所有工厂产线列表
export function getLineAll() { export function getLineAll() {
@ -5,4 +12,12 @@ export function getLineAll() {
url: '/base/production-line/listAll', url: '/base/production-line/listAll',
method: 'get' 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 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 * @Author: zwq
* @Date: 2024-04-18 16:53:17 * @Date: 2024-04-18 16:53:17
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:51:14 * @LastEditTime: 2024-09-06 15:19:24
* @Description: * @Description:
*/ */
@ -32,3 +32,23 @@ export function getEnergyRealtimePage(query) {
params: 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 * @Author: zwq
* @Date: 2024-04-18 16:53:17 * @Date: 2024-04-18 16:53:17
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:12:14 * @LastEditTime: 2024-09-05 13:55:30
* @Description: * @Description:
*/ */
@ -32,3 +32,23 @@ export function getMaterialRealtimePage(query) {
params: 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 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 * @Author: zwq
* @Date: 2024-04-18 16:53:17 * @Date: 2024-04-18 16:53:17
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-22 15:15:18 * @LastEditTime: 2024-09-06 15:13:20
* @Description: * @Description:
*/ */
@ -32,3 +32,22 @@ export function getRawOthercostSunPage(query) {
params: 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 * @Author: zwq
* @Date: 2024-04-15 17:01:20 * @Date: 2024-04-15 17:01:20
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-18 15:40:27 * @LastEditTime: 2024-09-06 14:12:09
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -53,7 +53,7 @@ export function getRawOthercostLogPage(query) {
// 导出原片其他成本-记录 Excel // 导出原片其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) { export function exportRawOthercostLogExcel(query) {
return request({ return request({
url: '/monitoring/cost-othercost-log/export-excel', url: '/monitoring/cost-othercost-log/export-log-excel',
method: 'get', method: 'get',
params: query, params: query,
responseType: 'blob' responseType: 'blob'

View File

@ -53,7 +53,7 @@ export function getRawOthercostLogPage(query) {
// 导出深加工其他成本-记录 Excel // 导出深加工其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) { export function exportRawOthercostLogExcel(query) {
return request({ return request({
url: '/monitoring/cost-deep-othercost-log/export-excel', url: '/monitoring/cost-deep-othercost-log/export-log-excel',
method: 'get', method: 'get',
params: query, params: query,
responseType: 'blob' 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 * @Date: 2020-12-29 16:49:28
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2023-12-07 10:00:51 * @LastEditTime: 2024-09-10 15:15:21
* @FilePath: \basic-admin\src\filters\basicData\index.js * @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description: * @Description:
*/ */
@ -47,7 +47,7 @@ export function parseTime(time, pattern) {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time) time = parseInt(time)
} else if (typeof time === 'string') { } else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),''); time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm), '');
} }
if ((typeof time === 'number') && (time.toString().length === 10)) { if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000 time = time * 1000
@ -61,14 +61,25 @@ export function parseTime(time, pattern) {
h: date.getHours(), h: date.getHours(),
i: date.getMinutes(), i: date.getMinutes(),
s: date.getSeconds(), 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] let value = formatObj[key]
// Note: getDay() returns 0 on Sunday // Note: getDay() returns 0 on Sunday
if (key === 'a') { if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value] 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) { if (result.length > 0 && value < 10) {
value = '0' + value value = '0' + value
} }

View File

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

View File

@ -1,8 +1,8 @@
<!-- <!--
filename: EquipmentDrawer.vue filename: EquipmentDrawer.vue
author: liubin author: liubin
date: 2023-08-22 14:38:56 date: 2023-08-22 14:38:56
description: description:
--> -->
<template> <template>
@ -320,7 +320,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息'); if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentGroupId: this.dataId, equipmentGroupId: this.dataId,

View File

@ -1,8 +1,8 @@
<!-- <!--
filename: EquipmentDrawer.vue filename: EquipmentDrawer.vue
author: liubin author: liubin
date: 2023-08-22 14:38:56 date: 2023-08-22 14:38:56
description: description:
--> -->
<template> <template>
@ -320,7 +320,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备分组信息'); if (!this.dataId) return this.$message.warning('请先创建设备分组信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentGroupId: this.dataId, equipmentGroupId: this.dataId,

View File

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

@ -1,8 +1,8 @@
<!-- <!--
filename: EquipmentDrawer.vue filename: EquipmentDrawer.vue
author: liubin author: liubin
date: 2023-08-22 14:38:56 date: 2023-08-22 14:38:56
description: description:
--> -->
<template> <template>
@ -12,7 +12,7 @@
:wrapper-closable="false" :wrapper-closable="false"
class="drawer" class="drawer"
custom-class="mes-drawer" custom-class="mes-drawer"
size="60%" :size="size || '50%'"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title"> <SmallTitle slot="title">
{{ {{
@ -29,29 +29,107 @@
<section v-for="(section, index) in sections" :key="section.key"> <section v-for="(section, index) in sections" :key="section.key">
<SmallTitle v-if="index != 0">{{ section.name }}</SmallTitle> <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 /> <el-skeleton v-if="!showForm" animated />
<BaseInfoForm <!-- <BaseInfoForm
key="drawer-dialog-form" key="drawer-dialog-form"
v-if="showForm" v-if="showForm"
ref="form" ref="form"
:disabled="mode.includes('detail')" :disabled="mode.includes('detail')"
v-model="form" 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>
<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 <base-table
v-loading="attrListLoading" v-loading="attrListLoading"
:table-props="section.props" :table-props="section.props"
:page="attrQuery?.params.pageNo || 1" :page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10" :limit="attrQuery?.params.pageSize || 10"
:table-data="list" :table-data="list"
:add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" -->
<method-btn <method-btn
v-if="section.tableBtn" v-if="section.tableBtn && !mode.includes('detail')"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@ -71,17 +149,12 @@
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit"> <el-button
编辑 type="primary"
v-if="!mode.includes('detail')"
@click="handleSave">
保存
</el-button> </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>
</div> </div>
@ -96,10 +169,10 @@
@close="closeAttrForm" @close="closeAttrForm"
@cancel="closeAttrForm" @cancel="closeAttrForm"
@confirm="submitAttrForm"> @confirm="submitAttrForm">
<!-- :disabled="mode.includes('detail')" -->
<DialogForm <DialogForm
v-if="attrFormVisible" v-if="attrFormVisible"
ref="attrForm" ref="attrForm"
:disabled="mode.includes('detail')"
v-model="attrForm" v-model="attrForm"
:rows="attrRows" /> :rows="attrRows" />
</base-dialog> </base-dialog>
@ -136,7 +209,7 @@ const SmallTitle = {
export default { export default {
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm }, components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'infoData'], props: ['sections', 'defaultMode', 'infoData', 'size'],
data() { data() {
return { return {
mode: '', mode: '',
@ -145,6 +218,8 @@ export default {
total: 0, total: 0,
form: {}, form: {},
list: [], list: [],
eqList: [],
plcList: [],
attrTitle: '', attrTitle: '',
attrForm: { attrForm: {
id: null, id: null,
@ -166,13 +241,17 @@ export default {
input: true, input: true,
label: '参数列名', label: '参数列名',
prop: 'plcParamName', prop: 'plcParamName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
label: '参数名称', label: '参数名称',
prop: 'name', prop: 'name',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '参数名称不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -181,7 +260,6 @@ export default {
label: '单位', label: '单位',
prop: 'unit', prop: 'unit',
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT), options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
// rules: [{ required: true, message: '', trigger: 'blur' }],
}, },
{ {
switch: true, 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, input: true,
@ -222,7 +341,6 @@ export default {
transform: (val) => Number(val), transform: (val) => Number(val),
}, },
], ],
// rules: [{ required: true, message: '', trigger: 'blur' }],
}, },
], ],
[ [
@ -230,13 +348,11 @@ export default {
input: true, input: true,
label: '标准值', label: '标准值',
prop: 'defaultValue', prop: 'defaultValue',
// rules: [{ required: true, message: '', trigger: 'blur' }],
}, },
{ {
input: true, input: true,
label: '描述', label: '描述',
prop: 'description', prop: 'description',
// rules: [{ required: true, message: '', trigger: 'blur' }],
}, },
], ],
[ [
@ -244,7 +360,6 @@ export default {
input: true, input: true,
label: '备注', label: '备注',
prop: 'remark', prop: 'remark',
// rules: [{ required: true, message: '', trigger: 'blur' }],
}, },
], ],
], ],
@ -257,6 +372,7 @@ export default {
infoQuery: null, // infoQuery: null, //
attrFormSubmitting: false, attrFormSubmitting: false,
attrListLoading: false, attrListLoading: false,
shouldRefreshPageView: false,
}; };
}, },
computed: { computed: {
@ -275,11 +391,24 @@ export default {
}); });
}, },
tableBtn() { tableBtn() {
return this.mode == 'detail' ? [] : this.sections[1].tableBtn; return this.sections[1].tableBtn;
// return this.mode == 'detail' ? [] : this.sections[1].tableBtn;
}, },
}, },
mounted() { mounted() {
this.shouldRefreshPageView = false;
this.mode = this.defaultMode || 'detail'; 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) { for (const section of this.sections) {
// //
if ('url' in section) { if ('url' in section) {
@ -341,7 +470,7 @@ export default {
handleSave() { handleSave() {
this.$refs['form'][0].validate(async (valid) => { this.$refs['form'][0].validate(async (valid) => {
if (valid) { if (valid) {
const isEdit = this.mode == 'edit'; const isEdit = !this.mode.includes('detail');
await this.$axios({ await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post', method: isEdit ? 'put' : 'post',
@ -355,6 +484,9 @@ export default {
}, },
handleCancel() { handleCancel() {
if (this.shouldRefreshPageView) {
this.$emit('refreshDataList');
}
this.visible = false; this.visible = false;
}, },
@ -376,9 +508,11 @@ export default {
defaultValue: '', defaultValue: '',
description: '', description: '',
remark: '', remark: '',
equipmentParamType: '',
productionParamType: '',
alarmContent: '', alarmContent: '',
}; };
this.attrTitle = '添加设备绑定信息'; this.attrTitle = '添加参数绑定信息';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },
@ -391,14 +525,14 @@ export default {
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; this.attrForm = res.data;
this.attrTitle = '编辑设备绑定信息'; this.attrTitle = '编辑参数绑定信息';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
}, },
// //
handleDeleteAttr(attrId) { handleDeleteAttr(attrId) {
this.$confirm('确定删除该分组报警?', '提示', { this.$confirm('确定删除该参数?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
@ -410,6 +544,7 @@ export default {
params: { id: attrId }, params: { id: attrId },
}); });
if (res.code == 0) { if (res.code == 0) {
this.shouldRefreshPageView = true;
this.$message({ this.$message({
message: '删除成功', message: '删除成功',
type: 'success', type: 'success',
@ -424,35 +559,37 @@ export default {
}, },
// //
async submitAttrForm() { submitAttrForm() {
this.$refs['attrForm'].validate((valid) => { this.$refs['attrForm'].validate(async (valid) => {
if (!valid) { if (!valid) {
return; return;
} }
});
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) { const isEdit = this.attrForm.id != null;
this.closeAttrForm(); this.attrFormSubmitting = true;
this.$message({ const res = await this.$axios({
message: `${isEdit ? '更新' : '创建'}成功`, url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
type: 'success', method: isEdit ? 'put' : 'post',
duration: 1500, data: {
onClose: () => { ...this.attrForm,
this.getAttrList(); connectId: this.infoData.id,
}, },
}); });
}
this.attrFormSubmitting = false; if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
this.shouldRefreshPageView = true;
},
});
}
this.attrFormSubmitting = false;
});
}, },
closeAttrForm() { closeAttrForm() {
@ -461,7 +598,7 @@ export default {
handleClick(raw) { handleClick(raw) {
if (raw.type === 'delete') { if (raw.type === 'delete') {
this.$confirm(`确定删除该报警?`, '提示', { this.$confirm(`确定删除该参数?`, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', 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> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
@ -12,7 +19,8 @@
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:table-data="list" :table-data="list"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun"
:max-height="tableH">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
@ -34,17 +42,21 @@
<base-dialog <base-dialog
:dialogTitle="title" :dialogTitle="title"
:dialogVisible="open" :dialogVisible="open"
width="700px" width="30%"
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @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> </base-dialog>
<!-- 抽屉 详情 --> <!-- 抽屉 详情 -->
<BasicDrawer <BasicDrawer
v-if="editVisible" v-if="editVisible"
ref="drawer" ref="drawer"
size="45%"
:default-mode="editMode" :default-mode="editMode"
:info-data="alarmForm" :info-data="alarmForm"
:sections="[ :sections="[
@ -52,9 +64,13 @@
name: '基本信息', name: '基本信息',
key: 'base', key: 'base',
rows: drawerBaseInfoRows, 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', key: 'attrs',
props: drawerListProps, props: drawerListProps,
url: '/base/equipment-plc-param/page', url: '/base/equipment-plc-param/page',
@ -68,18 +84,26 @@
pageSize: 10, pageSize: 10,
}, },
tableBtn: [ tableBtn: [
this.$auth.hasPermi('base:equipment-plc-param:update') {
? { type: 'edit',
type: 'edit', btnName: '修改',
btnName: '修改', },
} {
: undefined, type: 'delete',
this.$auth.hasPermi('base:equipment-plc-param:delete') btnName: '删除',
? { },
type: 'delete', // this.$auth.hasPermi('equipment:collection-config-param:update')
btnName: '删除', // ? {
} // type: 'edit',
: undefined, // btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:collection-config-param:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v), ].filter((v) => v),
allowAdd: true, allowAdd: true,
}, },
@ -99,67 +123,60 @@ import {
getEquipmentPlcConnectPage, getEquipmentPlcConnectPage,
exportEquipmentPlcConnectExcel, exportEquipmentPlcConnectExcel,
} from '@/api/base/equipmentPlcConnect'; } from '@/api/base/equipmentPlcConnect';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import './http'; // import './http';
import BasicDrawer from './components/BasicDrawer.vue'; import BasicDrawer from './components/BasicDrawer.vue';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './add-or-updata';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
export default { export default {
name: 'EquipmentPlcConnect', name: 'EquipmentPlcConnect',
mixins: [basicPageMixin], mixins: [basicPageMixin, tableHeightMixin],
components: { BasicDrawer }, components: { BasicDrawer, AddOrUpdate },
data() { data() {
return { return {
searchBarKeys: ['equipmentId', 'plcId'], searchBarKeys: ['equipmentId', 'plcId'],
// tableBtn: [ // 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), // ].filter((v) => v),
tableBtn: [ tableBtn: [
{ this.$auth.hasPermiAnd([
type: 'detail', 'base:equipment-plc-connect:query',
btnName: '参数绑定', 'base:equipment-plc-param:query'
}, ])
{ ? {
type: 'edit', type: 'detail',
btnName: '修改', btnName: '参数绑定',
}, } : undefined,
// { this.$auth.hasPermiAnd([
// type: 'params-bind', 'base:equipment-plc-connect:update',
// btnName: '', 'base:equipment-plc-connect:query',
// }, 'base:equipment-plc-param:create',
{ 'base:equipment-plc-param:update',
type: 'delete', 'base:equipment-plc-param:delete',
btnName: '删除', 'base:equipment-plc-param:query'
}, ])
], ? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('base:equipment-plc-connect:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [ tableProps: [
// { { prop: 'productionLine', label: '产线', minWidth: 120, showOverflowtooltip: true },
// prop: 'createTime', { prop: 'workshopSection', label: '工段', minWidth: 120, showOverflowtooltip: true },
// label: '', { prop: 'equipmentName', label: '设备名', minWidth: 120, showOverflowtooltip: true },
// fixed: true, { prop: 'equipmentCode', label: '设备编码', minWidth: 200, showOverflowtooltip: true },
// width: 180, { prop: 'plcCode', label: '关联表编码', minWidth: 220, showOverflowtooltip: true },
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), { prop: 'plcTableName', label: '关联表名', minWidth: 150, showOverflowtooltip: true },
// }, { prop: 'plcName', label: '标识名称', minWidth: 150, showOverflowtooltip: true },
{ prop: 'productionLine', label: '产线' }, { prop: 'bindingParameters', label: '绑定参数数量', minWidth: 120, showOverflowtooltip: true },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipmentName', label: '设备名' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'plcCode', label: '关联表编码' },
{ prop: 'plcTableName', label: '关联表名' },
{ prop: 'plcName', label: '标识名称' },
{ prop: 'bindingParameters', label: '绑定参数数量' },
// { // {
// _action: 'params-bind', // _action: 'params-bind',
// label: '', // label: '',
@ -194,13 +211,15 @@ export default {
placeholder: '请选择设备', placeholder: '请选择设备',
param: 'equipmentId', param: 'equipmentId',
selectOptions: [], selectOptions: [],
filterable: true,
}, },
{ {
type: 'select', type: 'select',
label: '编码', label: '关联表编码',
placeholder: '请选择编码', placeholder: '请选择关联表编码',
param: 'plcId', param: 'plcId',
selectOptions: [], selectOptions: [],
filterable: true,
}, },
{ {
type: 'button', type: 'button',
@ -209,20 +228,21 @@ export default {
color: 'primary', color: 'primary',
}, },
{ {
type: 'separate', type: this.$auth.hasPermi('base:equipment-plc-connect:create')
? 'separate' : '',
}, },
{ {
// type: this.$auth.hasPermi('base:equipment-plc:create') type: this.$auth.hasPermi('base:equipment-plc-connect:create')
// ? 'button' ? 'button'
// : '', : '',
type: 'button', // type: 'button',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
plain: true, plain: true,
color: 'success', color: 'success',
}, },
// { // {
// type: this.$auth.hasPermi('base:equipment-plc:export') ? 'button' : '', // type: this.$auth.hasPermi('equipment:collection-config:export') ? 'button' : '',
// btnName: '', // btnName: '',
// name: 'export', // name: 'export',
// color: 'warning', // color: 'warning',
@ -236,7 +256,9 @@ export default {
prop: 'plcId', prop: 'plcId',
labelKey: `plcTableName`, labelKey: `plcTableName`,
url: '/base/equipment-plc/listAll', url: '/base/equipment-plc/listAll',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '关联表名不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@ -247,8 +269,10 @@ export default {
select: true, select: true,
label: '设备', label: '设备',
prop: 'equipmentId', prop: 'equipmentId',
url: '/base/equipment/page?pageNo=1&pageSize=99', url: '/base/core-equipment/page?pageNo=1&pageSize=99',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
bind: { bind: {
filterable: true, filterable: true,
}, },
@ -259,7 +283,7 @@ export default {
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 20,
plcId: null, plcId: null,
equipmentId: null, equipmentId: null,
}, },
@ -274,7 +298,9 @@ export default {
input: true, input: true,
label: '设备名', label: '设备名',
prop: 'equipmentName', prop: 'equipmentName',
rules: [{ required: true, message: '不能为空', trigger: 'blur' }], rules: [
{ required: true, message: '设备名不能为空', trigger: 'blur' },
],
// bind: { // bind: {
// disabled: this.editMode == 'detail', // some condition, like detail mode... // disabled: this.editMode == 'detail', // some condition, like detail mode...
// } // }
@ -283,7 +309,7 @@ export default {
input: true, input: true,
label: '关联表名', label: '关联表名',
prop: 'plcTableName', prop: 'plcTableName',
// url: '/base/equipment/getCode', // url: '/base/core-equipment/getCode',
}, },
], ],
], ],
@ -295,6 +321,23 @@ export default {
label: '单位', label: '单位',
filter: publicFormatter('unit_dict'), filter: publicFormatter('unit_dict'),
}, },
{
prop: 'equipmentParamType',
label: '设备参数类型',
filter: (val) =>
val != null
? ['', '一般参数', '工艺参数', '报警参数', ''][val]
: '-',
},
{
prop: 'productionParamType',
label: '生产参数类型',
filter: (val) =>
val != null
? // ? ['', '', '', '', '', ''][val]
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
: '-',
},
{ {
prop: 'collection', prop: 'collection',
label: '是否采集', label: '是否采集',
@ -318,6 +361,10 @@ export default {
this.initSearchOptions(); this.initSearchOptions();
}, },
methods: { methods: {
successSubmit() {
this.cancel()
this.getList()
},
async getEquipmentOptions() { async getEquipmentOptions() {
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment/listAll', url: '/base/equipment/listAll',
@ -325,7 +372,6 @@ export default {
}); });
return res.data; return res.data;
}, },
async getPlcOptions() { async getPlcOptions() {
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment-plc/listAll', url: '/base/equipment-plc/listAll',
@ -346,7 +392,7 @@ export default {
}); });
this.searchBarFormConfig[1].selectOptions = plcList.map((item) => { this.searchBarFormConfig[1].selectOptions = plcList.map((item) => {
return { return {
name: item.name, name: item.code,
id: item.id, id: item.id,
}; };
}); });
@ -403,6 +449,19 @@ export default {
}; };
this.resetForm('form'); 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() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
@ -417,7 +476,10 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = '添加设备与实时采集关系表(一对多)'; this.title = '添加设备采集配置';
this.$nextTick(() => {
this.$refs.addOrUpdate.init()
})
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -426,35 +488,16 @@ export default {
getEquipmentPlcConnect(id).then((response) => { getEquipmentPlcConnect(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = '修改设备与实时采集关系表(一对多)'; this.title = '修改设备采集配置';
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs.addOrUpdate.dataFormSubmit()
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) { handleDetail(row, mode = 'detail') {
// debugger; // debugger;
const { const {
id, id,
@ -470,7 +513,7 @@ export default {
workshopSection, workshopSection,
} = row; } = row;
// //
this.editMode = 'detail'; this.editMode = mode;
this.alarmForm.id = id; this.alarmForm.id = id;
this.alarmForm.plcTableName = plcTableName; // this.alarmForm.plcTableName = plcTableName; //
this.alarmForm.equipmentName = equipmentName; this.alarmForm.equipmentName = equipmentName;

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
<!-- <!--
filename: AssetsUpload.vue filename: AssetsUpload.vue
author: liubin author: liubin
date: 2023-10-12 16:40:14 date: 2023-10-12 16:40:14
@ -217,7 +217,7 @@ export default {
response.data == null || response.data == null ||
response.data.trim() == '' response.data.trim() == ''
) { ) {
this.$message.error('上传出错了!'); this.$message.warning('上传出错了!');
return; return;
} }
this.files.push({ this.files.push({

View File

@ -1,8 +1,8 @@
<!-- <!--
filename: EquipmentDrawer.vue filename: EquipmentDrawer.vue
author: liubin author: liubin
date: 2023-08-22 14:38:56 date: 2023-08-22 14:38:56
description: description:
--> -->
<template> <template>
@ -361,7 +361,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.error('请先创建设备信息'); if (!this.dataId) return this.$message.warning('请先创建设备信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentId: this.dataId, equipmentId: this.dataId,

View File

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

View File

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

View File

@ -3,7 +3,7 @@
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-16 15:10:42 * @LastEditTime: 2023-10-16 15:10:42
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
<template> <template>
<div class="app-container"> <div class="app-container">
@ -197,8 +197,7 @@ export default {
type: 'button', type: 'button',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'warning',
plain: true
} }
], ],
}; };
@ -257,7 +256,7 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.showData = this.tableData this.showData = this.tableData
}, 600) }, 600)
}, },
exportXlsx() { exportXlsx() {
this.exportECL() this.exportECL()

View File

@ -3,7 +3,7 @@
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-16 15:18:23 * @LastEditTime: 2023-10-16 15:18:23
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
<template> <template>
<div class="app-container"> <div class="app-container">
@ -147,8 +147,7 @@ export default {
type: 'button', type: 'button',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'warning',
plain: true
} }
], ],
}; };
@ -237,7 +236,7 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.showData = this.tableData this.showData = this.tableData
}, 600) }, 600)
}, },
exportXlsx() { exportXlsx() {
this.exportECL() this.exportECL()

View File

@ -3,7 +3,7 @@
* @Date: 2023-08-29 14:59:29 * @Date: 2023-08-29 14:59:29
* @LastEditTime: 2023-10-16 15:19:04 * @LastEditTime: 2023-10-16 15:19:04
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
--> -->
<template> <template>
<div class="app-container"> <div class="app-container">
@ -190,8 +190,7 @@ export default {
type: 'button', type: 'button',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'warning',
plain: true
} }
], ],
}; };
@ -275,7 +274,7 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.showData = this.tableData this.showData = this.tableData
}, 600) }, 600)
}, },
exportXlsx() { exportXlsx() {
this.exportECL() this.exportECL()

View File

@ -142,8 +142,7 @@ export default {
type: 'button', type: 'button',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'warning',
plain: true
} }
], ],
}; };
@ -258,7 +257,7 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.showData = this.tableData this.showData = this.tableData
}, 600) }, 600)
}, },
exportXlsx() { exportXlsx() {
this.exportECL() this.exportECL()

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

View File

@ -1,64 +1,72 @@
<template> <template>
<div class="app-container energyOverlimitLog"> <div>
<div v-show="activeName === 'his'"> <div style="background: #f2f4f9; height: 40px; width: 100%">
<!-- 搜索工作栏 --> <ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<search-bar <template v-slot:tab1>
:formConfigs="formConfig" <div>历史成本</div>
ref="searchBarForm" </template>
@headBtnClick="buttonClick" /> <template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div> </div>
<div v-show="activeName === 'now'"> <div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 --> <div v-show="activeName === 'his'">
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig2" <search-bar
ref="searchBarForm2" :formConfigs="formConfig"
@headBtnClick="buttonClick" /> 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>
<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> </div>
</template> </template>
@ -66,9 +74,16 @@
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page'; import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType'; 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 { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [ const tableProps = [
{ {
prop: 'recTime', prop: 'recTime',
@ -170,6 +185,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
formConfig2: [ formConfig2: [
{ {
@ -197,6 +221,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
listQuery: { listQuery: {
statisticType: 1, statisticType: 1,
@ -218,6 +251,7 @@ export default {
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
ButtonNav,
}, },
created() { created() {
const params = { const params = {
@ -231,6 +265,8 @@ export default {
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
@ -253,7 +289,8 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; 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.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59' ? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -264,7 +301,8 @@ export default {
console.log(val); console.log(val);
} }
}, },
toggleTab() { currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') { if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery.name = null; this.listQuery.name = null;
@ -275,9 +313,14 @@ export default {
this.getDataList(); this.getDataList();
} else { } else {
this.$refs.searchBarForm2.resetForm(); 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.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.getDataList2(); this.getDataList2();
} }
@ -305,6 +348,30 @@ export default {
this.otherMethods(val); 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> </script>

View File

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

View File

@ -1,65 +1,73 @@
<template> <template>
<div class="app-container energyOverlimitLog"> <div>
<div v-show="activeName === 'his'"> <div style="background: #f2f4f9; height: 40px; width: 100%">
<!-- 搜索工作栏 --> <ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<search-bar <template v-slot:tab1>
:formConfigs="formConfig" <div>历史成本</div>
ref="searchBarForm" </template>
@headBtnClick="buttonClick" /> <template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div> </div>
<div v-show="activeName === 'now'"> <div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 --> <div v-show="activeName === 'his'">
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig2" <search-bar
ref="searchBarForm2" :formConfigs="formConfig"
@headBtnClick="buttonClick" /> 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"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div> </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"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div> </div>
</template> </template>
@ -70,9 +78,13 @@ import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
import { import {
getRawOthercostHisPage, getRawOthercostHisPage,
getRawOthercostSunPage, getRawOthercostSunPage,
exportRawOthercostSunExcel,
exportRawOthercostHisExcel
} from '@/api/cost/costOthercostHisDeep'; } from '@/api/cost/costOthercostHisDeep';
import { parseTime } from '@/filter/code-filter'; import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [ const tableProps = [
{ {
prop: 'recTime', prop: 'recTime',
@ -147,6 +159,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
formConfig2: [ formConfig2: [
{ {
@ -175,6 +196,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
listQuery: { listQuery: {
statisticType: 1, statisticType: 1,
@ -196,6 +226,7 @@ export default {
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
ButtonNav,
}, },
created() { created() {
const params = { const params = {
@ -209,6 +240,8 @@ export default {
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
@ -231,7 +264,8 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; 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.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59' ? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -242,7 +276,8 @@ export default {
console.log(val); console.log(val);
} }
}, },
toggleTab() { currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') { if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery.name = null; this.listQuery.name = null;
@ -253,9 +288,14 @@ export default {
this.getDataList(); this.getDataList();
} else { } else {
this.$refs.searchBarForm2.resetForm(); 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.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.getDataList2(); this.getDataList2();
} }
@ -279,6 +319,30 @@ export default {
this.otherMethods(val); 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> </script>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:59:49 * @LastEditTime: 2024-09-05 15:35:07
* @Description: * @Description:
--> -->
<template> <template>
@ -11,6 +11,7 @@
:rules="dataRule" :rules="dataRule"
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px"> label-width="80px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <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:create') ? 'separate' : '',
// }, // },
// { {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:export') ? 'button' : '', type: 'button',
// btnName: '', btnName: '导出',
// name: 'export', name: 'export',
// color: 'warning', color: 'warning',
// }, },
], ],
}; };
}, },
@ -181,8 +181,11 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.name = val.name; this.listQuery.name = val.name||null;
this.listQuery.recTime = val.searchTime; 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(); this.handleExport();
break; break;
default: default:
@ -203,6 +206,24 @@ export default {
this.otherMethods(val) 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(() => {});
},
}, },
}; };
</script> </script>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-01 13:52:10 * @Date: 2023-08-01 13:52:10
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:56:17 * @LastEditTime: 2024-09-03 14:52:51
* @Description: * @Description:
--> -->
<template> <template>
@ -17,7 +17,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="成本名称" prop="label"> <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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -49,7 +49,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="three"> <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 <el-input-number
:min="0" :min="0"
style="width: 80%" 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 * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:45:32 * @LastEditTime: 2024-09-05 15:34:14
* @Description: * @Description:
--> -->
<template> <template>
@ -11,6 +11,7 @@
:rules="dataRule" :rules="dataRule"
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px"> label-width="80px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
@ -28,10 +29,30 @@
type="date" type="date"
value-format="timestamp" value-format="timestamp"
:style="{ width: '100%' }" :style="{ width: '100%' }"
readonly disabled
placeholder="选择日期"></el-date-picker> placeholder="选择日期"></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </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-col :span="12">
<el-form-item label="总价" prop="price"> <el-form-item label="总价" prop="price">
<el-input-number <el-input-number
@ -43,16 +64,6 @@
() ()
</el-form-item> </el-form-item>
</el-col> </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-row>
</el-form> </el-form>
</template> </template>
@ -74,6 +85,7 @@ export default {
quantity: undefined, quantity: undefined,
energyTypeName: undefined, energyTypeName: undefined,
recTime: undefined, recTime: undefined,
showName: undefined
}, },
dataRule: { dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }], price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
@ -90,6 +102,11 @@ export default {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val)); this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType; this.dataForm.statisticType = statisticType;
if(this.dataForm.bindObjectName){
this.dataForm.showName = this.dataForm.bindObjectName
}else{
this.dataForm.showName = this.dataForm.meterName
}
}); });
}, },
// //

View File

@ -1,64 +1,72 @@
<template> <template>
<div class="app-container energyOverlimitLog"> <div>
<div v-show="activeName === 'his'"> <div style="background: #f2f4f9; height: 40px; width: 100%">
<!-- 搜索工作栏 --> <ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<search-bar <template v-slot:tab1>
:formConfigs="formConfig" <div>历史成本</div>
ref="searchBarForm" </template>
@headBtnClick="buttonClick" /> <template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div> </div>
<div v-show="activeName === 'now'"> <div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 --> <div v-show="activeName === 'his'">
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig2" <search-bar
ref="searchBarForm2" :formConfigs="formConfig"
@headBtnClick="buttonClick" /> 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>
<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> </div>
</template> </template>
@ -66,9 +74,16 @@
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page'; import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType'; 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 { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [ const tableProps = [
{ {
prop: 'recTime', prop: 'recTime',
@ -170,6 +185,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
formConfig2: [ formConfig2: [
{ {
@ -197,6 +221,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
listQuery: { listQuery: {
statisticType: 1, statisticType: 1,
@ -218,6 +251,7 @@ export default {
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
ButtonNav,
}, },
created() { created() {
const params = { const params = {
@ -231,6 +265,8 @@ export default {
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
@ -253,7 +289,8 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; 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.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59' ? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -264,7 +301,8 @@ export default {
console.log(val); console.log(val);
} }
}, },
toggleTab() { currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') { if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery.name = null; this.listQuery.name = null;
@ -275,9 +313,14 @@ export default {
this.getDataList(); this.getDataList();
} else { } else {
this.$refs.searchBarForm2.resetForm(); 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.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.getDataList2(); this.getDataList2();
} }
@ -305,6 +348,30 @@ export default {
this.otherMethods(val); 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> </script>

View File

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

View File

@ -1,64 +1,72 @@
<template> <template>
<div class="app-container energyOverlimitLog"> <div>
<div v-show="activeName === 'his'"> <div style="background: #f2f4f9; height: 40px; width: 100%">
<!-- 搜索工作栏 --> <ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<search-bar <template v-slot:tab1>
:formConfigs="formConfig" <div>历史成本</div>
ref="searchBarForm" </template>
@headBtnClick="buttonClick" /> <template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div> </div>
<div v-show="activeName === 'now'"> <div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 --> <div v-show="activeName === 'his'">
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig2" <search-bar
ref="searchBarForm2" :formConfigs="formConfig"
@headBtnClick="buttonClick" /> 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>
<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> </div>
</template> </template>
@ -69,10 +77,14 @@ import { getMaterialPage } from '@/api/base/material';
import { import {
getMaterialHisPage, getMaterialHisPage,
getMaterialRealtimePage, getMaterialRealtimePage,
exportMaterialRealtimeExcel,
exportMaterialHisExcel,
} from '@/api/cost/costMaterial'; } from '@/api/cost/costMaterial';
import { parseTime } from '@/filter/code-filter'; import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule'; import typeRule from './typeRule';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [ const tableProps = [
{ {
prop: 'recTime', prop: 'recTime',
@ -83,15 +95,15 @@ const tableProps = [
prop: 'materialName', prop: 'materialName',
label: '原料名称', label: '原料名称',
}, },
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{ {
prop: 'matPrice', prop: 'matPrice',
label: '单价(元/吨)', label: '单价(元/吨)',
align: 'right', align: 'right',
}, },
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{ {
prop: 'price', prop: 'price',
label: '总价(元)', label: '总价(元)',
@ -103,20 +115,21 @@ const tableProps2 = [
prop: 'materialName', prop: 'materialName',
label: '原料名称', label: '原料名称',
}, },
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{ {
prop: 'time', prop: 'time',
label: '单价生效时间', label: '单价生效时间',
subcomponent: typeRule, subcomponent: typeRule,
width: 300,
}, },
{ {
prop: 'quantity', prop: 'quantity',
label: '累计使用量(吨)', label: '累计使用量(吨)',
}, },
{
prop: 'materialPrice',
label: '单价(元/吨)',
align: 'right',
},
{ {
prop: 'price', prop: 'price',
label: '总价(元)', label: '总价(元)',
@ -169,6 +182,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
formConfig2: [ formConfig2: [
{ {
@ -196,6 +218,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
listQuery: { listQuery: {
statisticType: 1, statisticType: 1,
@ -217,6 +248,7 @@ export default {
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
ButtonNav,
}, },
created() { created() {
const params = { const params = {
@ -230,6 +262,8 @@ export default {
}, },
methods: { methods: {
buttonClick(val) { buttonClick(val) {
this.formConfig2[1].startPlaceholder = '开始时间';
this.formConfig2[1].endPlaceholder = '结束时间';
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
@ -252,7 +286,8 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; 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.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59' ? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -263,7 +298,8 @@ export default {
console.log(val); console.log(val);
} }
}, },
toggleTab() { currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') { if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery.name = null; this.listQuery.name = null;
@ -274,9 +310,14 @@ export default {
this.getDataList(); this.getDataList();
} else { } else {
this.$refs.searchBarForm2.resetForm(); 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.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.getDataList2(); this.getDataList2();
} }
@ -304,6 +345,30 @@ export default {
this.otherMethods(val); 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> </script>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-22 11:12:58 * @LastEditTime: 2024-09-05 15:33:16
* @Description: * @Description:
--> -->
<template> <template>
@ -11,6 +11,7 @@
:rules="dataRule" :rules="dataRule"
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px"> label-width="80px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
@ -18,70 +19,7 @@
<el-input <el-input
style="width: 100%" style="width: 100%"
v-model="dataForm.bindObjectName" v-model="dataForm.bindObjectName"
readonly /> disabled />
</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="请输入良品率" />
(%)
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -91,10 +29,73 @@
type="date" type="date"
value-format="timestamp" value-format="timestamp"
:style="{ width: '100%' }" :style="{ width: '100%' }"
readonly disabled
placeholder="选择所属日期"></el-date-picker> placeholder="选择所属日期"></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </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-row>
</el-form> </el-form>
</template> </template>

View File

@ -43,8 +43,8 @@
<script> <script>
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page'; import basicPage from '@/mixins/basic-page';
import { getLineAll } from '@/api/base/productionLine'; import { getLinePage } from '@/api/base/productionLine';
import { getcostOriginRatioHisPage } from '@/api/cost/costOriginRatioHis'; import { getcostOriginRatioHisPage,exportcostOriginRatioHisExcel } from '@/api/cost/costOriginRatioHis';
import { parseTime } from '@/filter/code-filter'; import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
@ -52,10 +52,12 @@ const tableProps = [
prop: 'recTime', prop: 'recTime',
label: '日期', label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'), filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
width:130,
}, },
{ {
prop: 'bindObjectName', prop: 'bindObjectName',
label: '产线', label: '产线',
width:145,
}, },
{ {
prop: 'thick', prop: 'thick',
@ -128,6 +130,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
listQuery: { listQuery: {
statisticType: 1, statisticType: 1,
@ -148,8 +159,13 @@ export default {
AddOrUpdate, AddOrUpdate,
}, },
created() { created() {
getLineAll().then((response) => { const params ={
this.formConfig[1].selectOptions = response.data; pageNo: 1,
pageSize: 100,
pdType: 1
}
getLinePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
}); });
}, },
methods: { methods: {
@ -172,7 +188,8 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; 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.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59' ? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -195,6 +212,25 @@ export default {
this.otherMethods(val); 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> </script>

View File

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

View File

@ -1,65 +1,73 @@
<template> <template>
<div class="app-container energyOverlimitLog"> <div>
<div v-show="activeName === 'his'"> <div style="background: #f2f4f9; height: 40px; width: 100%">
<!-- 搜索工作栏 --> <ButtonNav :menus="['历史成本', '成本查询']" @change="currentMenu">
<search-bar <template v-slot:tab1>
:formConfigs="formConfig" <div>历史成本</div>
ref="searchBarForm" </template>
@headBtnClick="buttonClick" /> <template v-slot:tab2>
<div>成本查询</div>
</template>
</ButtonNav>
</div> </div>
<div v-show="activeName === 'now'"> <div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 --> <div v-show="activeName === 'his'">
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig2" <search-bar
ref="searchBarForm2" :formConfigs="formConfig"
@headBtnClick="buttonClick" /> 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"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div> </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"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div> </div>
</template> </template>
@ -70,9 +78,13 @@ import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
import { import {
getRawOthercostHisPage, getRawOthercostHisPage,
getRawOthercostSunPage, getRawOthercostSunPage,
exportRawOthercostSunExcel,
exportRawOthercostHisExcel
} from '@/api/cost/costOthercostHis'; } from '@/api/cost/costOthercostHis';
import { parseTime } from '@/filter/code-filter'; import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin'; import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import ButtonNav from '@/components/ButtonNav';
const tableProps = [ const tableProps = [
{ {
prop: 'recTime', prop: 'recTime',
@ -147,6 +159,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
formConfig2: [ formConfig2: [
{ {
@ -175,6 +196,15 @@ export default {
name: 'search', name: 'search',
color: 'primary', color: 'primary',
}, },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
], ],
listQuery: { listQuery: {
statisticType: 1, statisticType: 1,
@ -196,6 +226,7 @@ export default {
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
ButtonNav,
}, },
created() { created() {
const params = { const params = {
@ -231,7 +262,8 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; 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.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59' ? val.searchTime[1].substr(0, 10) + ' 23:59:59'
@ -242,7 +274,8 @@ export default {
console.log(val); console.log(val);
} }
}, },
toggleTab() { currentMenu(val) {
this.activeName = val === '历史成本' ? 'his' : 'now';
if (this.activeName === 'his') { if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery.name = null; this.listQuery.name = null;
@ -279,6 +312,30 @@ export default {
this.otherMethods(val); 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> </script>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-18 16:32:56 * @LastEditTime: 2024-09-05 15:33:48
* @Description: * @Description:
--> -->
<template> <template>
@ -11,6 +11,7 @@
:rules="dataRule" :rules="dataRule"
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-position="top"
label-width="80px"> label-width="80px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <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:create') ? 'separate' : '',
// }, // },
// { {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:export') ? 'button' : '', type: 'button',
// btnName: '', btnName: '导出',
// name: 'export', name: 'export',
// color: 'warning', color: 'warning',
// }, },
], ],
}; };
}, },
@ -181,8 +181,11 @@ export default {
case 'export': case 'export':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.name = val.name; this.listQuery.name = val.name||null;
this.listQuery.recTime = val.searchTime; 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(); this.handleExport();
break; break;
default: default:
@ -203,6 +206,24 @@ export default {
this.otherMethods(val) 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(() => {});
},
}, },
}; };
</script> </script>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-01 13:52:10 * @Date: 2023-08-01 13:52:10
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-17 16:59:58 * @LastEditTime: 2024-09-03 14:53:54
* @Description: * @Description:
--> -->
<template> <template>
@ -17,7 +17,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="成本名称" prop="label"> <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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -49,7 +49,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="three"> <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 <el-input-number
:min="0" :min="0"
style="width: 80%" 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' : '', type: this.$auth.hasPermi('base:energy-quantity-realtime:export') ? 'button' : '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'primary', color: 'warning',
plain: true
} }
], ],
tableProps, tableProps,

View File

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

View File

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

View File

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

View File

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

View File

@ -95,8 +95,7 @@ export default {
type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '', type: this.$auth.hasPermi('base:group-team:create') ? 'button' : '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'success', color: 'warning',
plain: true
} }
], ],
tableProps, tableProps,
@ -144,4 +143,4 @@ export default {
.box { .box {
padding: 0 32px; padding: 0 32px;
} }
</style> </style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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