This commit is contained in:
caoqianming 2024-07-24 15:02:11 +08:00
commit 2cca7d8c14
53 changed files with 12037 additions and 8349 deletions

View File

@ -3,10 +3,10 @@ NODE_ENV = development
# 标题
# VUE_APP_TITLE = '曲阳金隅安全智能管控平台'
# VUE_APP_TITLE = '托克逊能源管理平台'
VUE_APP_TITLE = '托克逊能源管理平台'
# VUE_APP_TITLE = '中建材光子科技有限公司'
VUE_APP_TITLE = '超低排放系统'
VUE_APP_PJ = 'pf'
# VUE_APP_TITLE = '超低排放系统'
VUE_APP_PJ = 'gx'
# 接口地址
#VUE_APP_API_BASEURL = http://1.203.161.103:2800/api
@ -16,10 +16,10 @@ VUE_APP_PJ = 'pf'
# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
#测试环境
# VUE_APP_API_BASEURL = http://49.232.14.174:2226/api
VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
# VUE_APP_BASEURL = http://49.232.14.174:2226
VUE_APP_BASEURL = http://127.0.0.1:2226
VUE_APP_API_BASEURL = http://49.232.14.174:2226/api
# VUE_APP_API_BASEURL = http://127.0.0.1:2226/api
VUE_APP_BASEURL = http://49.232.14.174:2226
# VUE_APP_BASEURL = http://127.0.0.1:2226
# #光子
# VUE_APP_API_BASEURL = http://49.232.14.174:2250/api

View File

@ -1,167 +1,152 @@
import config from "@/config"
import http from "@/utils/request"
import config from "@/config";
import http from "@/utils/request";
export default {
//质量分析报告
getQuastat: {
url: `${config.API_URL}/qm/quastat/`,
name: "质量报告分析",
get: async function(data={}){
get: async function (data = {}) {
return await http.get(this.url, data);
}
},
},
//质量分析报告更新
updateQuastat: {
name: "质量报告分析",
req: async function(id,data){
return await http.put(
`${config.API_URL}/qm/quastat/${id}/`,
data
);
}
req: async function (id, data) {
return await http.put(`${config.API_URL}/qm/quastat/${id}/`, data);
},
},
//班组记录添加质量分析
createQuastat: {
url: `${config.API_URL}/qm/quastat/`,
name: "质量报告分析",
post: async function(data={}){
post: async function (data = {}) {
return await http.post(this.url, data);
}
},
},
//质检项目
getTestItem: {
url: `${config.API_URL}/qm/testitem/`,
name: "质检项目",
get: async function(data={}){
get: async function (data = {}) {
return await http.get(this.url, data);
}
},
},
//获取不合格项
getNotOk: {
url: `${config.API_URL}/qm/notok_option/`,
name: "不合格项",
get: async function (data = {}) {
return await http.get(this.url, data);
},
},
ftest: {
list: {
name: "首件检验列表",
req: async function(data){
return await http.get(
`${config.API_URL}/qm/ftest/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/qm/ftest/`, data);
},
},
item: {
name: "首件检验",
req: async function(id){
return await http.get(
`${config.API_URL}/qm/ftest/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/qm/ftest/${id}/`);
},
},
update: {
name: "更新首件检验",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/qm/ftest/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建首件检验",
req: async function(data){
return await http.post(
`${config.API_URL}/qm/ftest/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/qm/ftest/`, data);
},
},
delete: {
name: "删除首件检验",
req: async function(id){
return await http.delete(
`${config.API_URL}/qm/ftest/${id}/`);
}
}
req: async function (id) {
return await http.delete(`${config.API_URL}/qm/ftest/${id}/`);
},
},
},
ptest: {
list: {
name: "检验列表",
req: async function(data){
return await http.get(
`${config.API_URL}/qm/ptest/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/qm/ptest/`, data);
},
},
item: {
name: "检验",
req: async function(id){
return await http.get(
`${config.API_URL}/qm/ptest/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/qm/ptest/${id}/`);
},
},
update: {
name: "更新检验",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/qm/ptest/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建检验",
req: async function(data){
return await http.post(
`${config.API_URL}/qm/ptest/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/qm/ptest/`, data);
},
},
delete: {
name: "删除检验",
req: async function(id){
return await http.delete(
`${config.API_URL}/qm/ptest/${id}/`);
}
}
req: async function (id) {
return await http.delete(`${config.API_URL}/qm/ptest/${id}/`);
},
},
},
ftestwork: {
list: {
name: "列表",
req: async function(data){
return await http.get(
`${config.API_URL}/qm/ftestwork/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/qm/ftestwork/`, data);
},
},
item: {
name: "检验",
req: async function(id){
return await http.get(
`${config.API_URL}/qm/ftestwork/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/qm/ftestwork/${id}/`);
},
},
update: {
name: "更新",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/qm/ftestwork/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/qm/ftestwork/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/qm/ftestwork/`, data);
},
},
delete: {
name: "删除",
req: async function(id){
req: async function (id) {
return await http.delete(
`${config.API_URL}/qm/ftestwork/${id}/`);
}
}
`${config.API_URL}/qm/ftestwork/${id}/`
);
},
},
},
}
};

View File

@ -1,337 +1,375 @@
import config from "@/config"
import http from "@/utils/request"
import config from "@/config";
import http from "@/utils/request";
/*EM接口*/
export default {
//值班记录
sflog: {
list: {
name: "值班记录列表",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/sflog/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/sflog/`, data);
},
},
item: {
name: "获取详情",
req: async function(id){
return await http.get(
`${config.API_URL}/wpm/sflog/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/wpm/sflog/${id}/`);
},
},
update: {
name: "更新",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/sflog/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/wpm/sflog/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/sflog/`, data);
},
},
delete: {
name: "删除",
req: async function(id){
return await http.delete(
`${config.API_URL}/wpm/sflog/${id}/`);
}
req: async function (id) {
return await http.delete(`${config.API_URL}/wpm/sflog/${id}/`);
},
},
deletes: {
name: "批量删除",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/sflog/deletes/`,
data);
}
data
);
},
},
cquery: {
name: "复杂查询",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/sflog/cquery/`,
data);
}
data
);
},
},
deleteHard: {
name: "批量物理删除",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/sflog/deletes_hard/`,
data);
}
data
);
},
},
init_test: {
name: "初始化检测录入",
req: async function(id){
req: async function (id) {
return await http.get(
`${config.API_URL}/wpm/sflog/${id}/init_test/`
);
}
},
},
},
//异常记录
stlog: {
list: {
name: "异常记录列表",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/stlog/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/stlog/`, data);
},
},
item: {
name: "获取详情",
req: async function(id){
return await http.get(
`${config.API_URL}/wpm/stlog/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/wpm/stlog/${id}/`);
},
},
update: {
name: "更新",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/stlog/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/wpm/stlog/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/stlog/`, data);
},
},
delete: {
name: "删除",
req: async function(id){
return await http.delete(
`${config.API_URL}/wpm/sflog/${id}/`);
}
req: async function (id) {
return await http.delete(`${config.API_URL}/wpm/stlog/${id}/`);
},
},
},
sflogexp: {
list: {
name: "值班记录列表",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/sflogexp/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/sflogexp/`, data);
},
},
update: {
name: "更新",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/sflogexp/${id}/`,
data);
}
},
},
mlog:{
list: {
name: "值班记录列表",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/mlog/`,
data
);
}
},
},
},
mlog: {
list: {
name: "值班记录列表",
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/mlog/`, data);
},
},
item: {
name: "获取详情",
req: async function(id){
return await http.get(
`${config.API_URL}/wpm/mlog/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/wpm/mlog/${id}/`);
},
},
cquery: {
name: "复杂查询",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/mlog/cquery/`,
data);
}
data
);
},
},
update: {
name: "更新",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/mlog/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/wpm/mlog/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/mlog/`, data);
},
},
delete: {
name: "删除",
req: async function(id){
return await http.delete(
`${config.API_URL}/wpm/mlog/${id}/`);
}
req: async function (id) {
return await http.delete(`${config.API_URL}/wpm/mlog/${id}/`);
},
},
relatedFirst:{
relatedFirst: {
name: "获取相关任务的第一道工序日志",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/mlog/related_first/`,
data);
}
},
submit:{
name: "提交",
req: async function(id){
return await http.post(
`${config.API_URL}/wpm/mlog/${id}/submit/`,
data
);
}
},
},
revert:{
submit: {
name: "提交",
req: async function (id) {
return await http.post(
`${config.API_URL}/wpm/mlog/${id}/submit/`
);
},
},
revert: {
name: "撤回",
req: async function(id, data){
req: async function (id, data) {
return await http.post(
`${config.API_URL}/wpm/mlog/${id}/revert/`,
data
);
}
}
},
handover:{
list: {
name: "值班记录列表",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/handover/`,
},
},
init: {
name: "初始化",
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/mlog/init/`,
data
);
}
},
},
change: {
name: "修改日志",
req: async function (id, data) {
return await http.post(
`${config.API_URL}/wpm/mlog/${id}/change/`,
data
);
},
},
},
mlogb: {
list: {
name: "列表",
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/mlogb/`, data);
},
},
in: {
name: "创建",
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/mlogb/in/`, data);
},
},
updateIn: {
name: "更新",
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/mlogb/in/${id}/`,
data
);
},
},
delIn: {
name: "删除",
req: async function (id) {
return await http.delete(
`${config.API_URL}/wpm/mlogb/in/${id}/`
);
},
},
updateOut: {
name: "更新",
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/mlogb/out/${id}/`,
data
);
},
},
},
handover: {
list: {
name: "值班记录列表",
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/handover/`, data);
},
},
item: {
name: "获取详情",
req: async function(id){
return await http.get(
`${config.API_URL}/wpm/handover/${id}/`
);
}
req: async function (id) {
return await http.get(`${config.API_URL}/wpm/handover/${id}/`);
},
},
cquery: {
name: "复杂查询",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/handover/cquery/`,
data);
}
data
);
},
},
update: {
name: "更新",
req: async function(id, data){
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/handover/${id}/`,
data);
}
data
);
},
},
create: {
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/wpm/handover/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/handover/`, data);
},
},
delete: {
name: "删除",
req: async function(id){
req: async function (id) {
return await http.delete(
`${config.API_URL}/wpm/handover/${id}/`);
}
`${config.API_URL}/wpm/handover/${id}/`
);
},
},
genByMlogs:{
genByMlogs: {
name: "从生产日志生成交接记录",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/handover/gen_by_mlogs/`,
data);
}
data
);
},
},
genByWm:{
genByWm: {
name: "从车间库存生成交接记录",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/handover/gen_by_wm/`,
data);
}
data
);
},
},
submit: {
name: "提交",
req: async function(id){
req: async function (id) {
return await http.post(
`${config.API_URL}/wpm/handover/${id}/submit/`,
);
}
}
`${config.API_URL}/wpm/handover/${id}/submit/`
);
},
},
},
//车间库存
wmaterial: {
list: {
name: "车间库存",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/wmaterial/`,
data
);
}
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/wmaterial/`, data);
},
},
batchs: {
name: "获取车间出现过的批次号",
req: async function(data){
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/wmaterial/batchs/`,
data);
}
}
},
otherlog:{
list: {
name: "其他生产日志",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/otherlog/`,
data
);
}
},
},
},
otherlog: {
list: {
name: "其他生产日志",
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/otherlog/`, data);
},
},
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/wpm/otherlog/`,
data);
}
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/otherlog/`, data);
},
},
delete: {
name: "删除",
req: async function(id){
req: async function (id) {
return await http.delete(
`${config.API_URL}/wpm/otherlog/${id}/`);
}
`${config.API_URL}/wpm/otherlog/${id}/`
);
},
},
}
}
},
prints: {
name: "打印",
req: async function (data) {
return await http.post(`${config.API_URL}/print/`, data);
},
},
};

View File

@ -69,6 +69,17 @@ const routes = [
},
component: "home/enp_home",
},
{
name: "dashboard_ly",
path: "/dashboard_ly",
meta: {
title: "控制台",
icon: "el-icon-monitor",
affix: true,
perms: ["dashboard_ly"],
},
component: "home/enm_home",
},
{
path: "/track",
name: "track",
@ -975,6 +986,16 @@ const routes = [
},
component: "mtm/materials",
},
{
name: "process",
path: "/mtm/process",
meta: {
title: "工序管理",
icon: "el-icon-grid",
perms: ["process"],
},
component: "mtm/process",
},
{
name: "mgruops",
path: "/mtm/mgruops",
@ -1078,7 +1099,7 @@ const routes = [
meta: {
title: "车间任务",
icon: "el-icon-cellphone",
perms: ["pm"],
perms: ["utask_gx"],
},
component: "pm/utask",
},
@ -1202,6 +1223,129 @@ const routes = [
},
],
},
//光芯生产执行 wpm_gx
{
name: "wpm_gx",
path: "/wpm_gx",
meta: {
title: "生产执行gx",
icon: "el-icon-grid",
type: "menu",
perms: ["wpm_gx"],
},
children: [
// {
// name: "chart",
// path: "/wpm_gx/chart",
// meta: {
// title: "chart",
// icon: "el-icon-files",
// perms: ["wpm_gx"],
// },
// component: "wpm_gx/chart",
// },
// {
// name: "printTest",
// path: "/wpm_gx/print",
// meta: {
// title: "打印测试",
// icon: "el-icon-files",
// perms: ["wpm_gx"],
// },
// component: "wpm_gx/print",
// },
{
name: "qiepian",
path: "/wpm_gx/qiepian",
meta: {
title: "切片",
icon: "el-icon-files",
perms: ["wpm_gx"],
},
component: "wpm_gx/qiepian",
},
{
name: "huohua",
path: "/wpm_gx/huohua",
meta: {
title: "活化",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/huohua",
},
{
name: "heihua",
path: "/wpm_gx/heihua",
meta: {
title: "黑化",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/heihua",
},
{
name: "shaojie",
path: "/wpm_gx/shaojie",
meta: {
title: "烧结",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/shaojie",
},
{
name: "jianbo",
path: "/wpm_gx/jianbo",
meta: {
title: "减薄",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/jianbo",
},
{
name: "jingdiao",
path: "/wpm_gx/jingdiao",
meta: {
title: "精雕",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/jingdiao",
},
{
name: "mopao",
path: "/wpm_gx/mopao",
meta: {
title: "磨抛",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/mopao",
},
{
name: "daojiao",
path: "/wpm_gx/daojiao",
meta: {
title: "倒角",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/daojiao",
},
{
name: "chaoxi",
path: "/wpm_gx/chaoxi",
meta: {
title: "超洗",
icon: "el-icon-cellphone",
perms: ["wpm_gx"],
},
component: "wpm_gx/chaoxi",
},
],
},
//检验管理 qm
{
name: "qm",

View File

@ -1,27 +1,29 @@
//数据表格配置
import tool from '@/utils/tool'
import tool from "@/utils/tool";
export default {
successCode: 200, //请求完成代码
pageSize: 20, //表格每一页条数
pageSizes: [1, 10, 20, 30, 40, 50,100,200], //表格可设置的一页条数
paginationLayout: "total, sizes, prev, pager, next, jumper", //表格分页布局,可设置"total, sizes, prev, pager, next, jumper"
parseData: function (res) { //数据分析
successCode: 200, //请求完成代码
pageSize: 20, //表格每一页条数
pageSizes: [1, 10, 20, 30, 40, 50, 100, 200, 500, 1000], //表格可设置的一页条数
paginationLayout: "total, sizes, prev, pager, next, jumper", //表格分页布局,可设置"total, sizes, prev, pager, next, jumper"
parseData: function (res) {
//数据分析
return {
data: res, //分析无分页的数据字段结构
rows: res.results, //分析行数据字段结构
total: res.count, //分析总数字段结构
summary: res.summary, //分析合计行字段结构
data: res, //分析无分页的数据字段结构
rows: res.results, //分析行数据字段结构
total: res.count, //分析总数字段结构
summary: res.summary, //分析合计行字段结构
// msg: res.err_msg, //分析描述字段结构
// code: res.err_code //分析状态字段结构
}
};
},
request: { //请求规定字段
page: 'page', //规定当前分页字段
pageSize: 'page_size', //规定一页条数字段
prop: 'prop', //规定排序字段名字段
order: 'ordering' //规定排序规格字段
request: {
//请求规定字段
page: "page", //规定当前分页字段
pageSize: "page_size", //规定一页条数字段
prop: "prop", //规定排序字段名字段
order: "ordering", //规定排序规格字段
},
/**
* 自定义列保存处理
@ -30,12 +32,12 @@ export default {
*/
columnSettingSave: function (tableName, column) {
return new Promise((resolve) => {
setTimeout(()=>{
setTimeout(() => {
//这里为了演示使用了session和setTimeout演示开发时应用数据请求
tool.session.set(tableName, column)
resolve(true)
},1000)
})
tool.session.set(tableName, column);
resolve(true);
}, 1000);
});
},
/**
* 获取自定义列
@ -45,13 +47,13 @@ export default {
columnSettingGet: function (tableName, column) {
return new Promise((resolve) => {
//这里为了演示使用了session和setTimeout演示开发时应用数据请求
const userColumn = tool.session.get(tableName)
if(userColumn){
resolve(userColumn)
}else{
resolve(column)
const userColumn = tool.session.get(tableName);
if (userColumn) {
resolve(userColumn);
} else {
resolve(column);
}
})
});
},
/**
* 重置自定义列
@ -61,10 +63,10 @@ export default {
columnSettingReset: function (tableName, column) {
return new Promise((resolve) => {
//这里为了演示使用了session和setTimeout演示开发时应用数据请求
setTimeout(()=>{
tool.session.remove(tableName)
resolve(column)
},1000)
})
}
}
setTimeout(() => {
tool.session.remove(tableName);
resolve(column);
}, 1000);
});
},
};

View File

@ -1,20 +1,22 @@
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import scui from './scui'
import ehsui from './ehs'
import i18n from './locales'
import router from './router'
import store from './store'
import App from './App.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import preventReClick from './utils/preventReClick'
import Print from './utils/print2'
import Xlsx from './utils/xlsx'
import DataVVue3 from '@kjgl77/datav-vue3'
import * as Cesium from 'cesium'
import { createApp } from "vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import "element-plus/theme-chalk/display.css";
import scui from "./scui";
import ehsui from "./ehs";
import i18n from "./locales";
import router from "./router";
import store from "./store";
import App from "./App.vue";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import preventReClick from "./utils/preventReClick";
import Print from "./utils/print2";
import Xlsx from "./utils/xlsx";
import jsBarCode from "./utils/jsBarCode";
import DataVVue3 from "@kjgl77/datav-vue3";
import htmlToPdf from "./utils/htmlToPdf";
import * as Cesium from "cesium";
const app = createApp(App);
@ -28,13 +30,14 @@ app.use(ehsui);
app.use(preventReClick);
app.use(Print);
app.use(Xlsx);
app.use(htmlToPdf);
app.use(jsBarCode);
app.use(DataVVue3);
//挂载app
app.mount('#app');
app.mount("#app");
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
app.component(key, component);
}
const debounce = (fn, delay) => {
@ -60,4 +63,4 @@ window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
callback = debounce(callback, 16);
super(callback);
}
};
};

45
src/utils/htmlToPdf.js Normal file
View File

@ -0,0 +1,45 @@
import html2Canvas from "html2canvas";
import JsPDF from "jspdf";
/**
*
* @param {*} reportName 下载时候的标题
* @param {*} isDownload 是否下载默认为下载传false不下载
*/
const getPdf = function (reportName, isDownload = true) {
return new Promise((resolve, reject) => {
var title = reportName;
html2Canvas(document.querySelector("#pdfDom"), {
allowTaint: true,
useCORS: true,
}).then((canvas) => {
const contentWidth = canvas.width;
const contentHeight = canvas.height;
console.log("contentWidth", contentWidth);
console.log("contentHeight", contentHeight);
//页面偏移
let position = 5;
//a4纸的尺寸[595.28,841.89]html页面生成的canvas在pdf中图片的宽高
const imgWidth = contentWidth - 20;
const imgHeight = contentHeight - 20;
let pageData = canvas.toDataURL("image/jpeg", 1.0);
let PDF = new JsPDF("p", "px", [210, 270]);
//有两个高度需要区分一个是html页面的实际高度和生成pdf的页面高度(841.89)
//当内容未超过pdf一页显示的范围无需分页
PDF.addImage(pageData, "JPEG", 10, 10, imgWidth, imgHeight);
PDF.save(title + ".pdf");
if (isDownload) {
PDF.save(title + ".pdf");
}
// 删除本地存储的base64字段
var pdfData = PDF.output("datauristring"); //获取base64Pdf
let blobData = new Blob([PDF], {
type: "application/pdf",
});
console.log("blobData", blobData);
resolve(blobData);
});
});
};
export default getPdf;

4095
src/utils/jsBarCode.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +0,0 @@
<template>
<div id="mars3dContainer" class="mars3d-container"></div>
</template>
<script>
// import * as mars3d from "mars3d";
const Cesium = mars3d.Cesium;
const point1 = [117.083458,31.655321,42]
const point2 = [116.027392, 36.413562, 42]
const point3 = mars3d.PointUtil.getOnLinePointByLen(
mars3d.LngLatPoint.toCartesian(point1),
mars3d.LngLatPoint.toCartesian(point2),
40
)
export default {
name: 'cesium',
data() {
return {
viewer: null
}
},
created() {
const scriptInfo = document.createElement("script");
scriptInfo.setAttribute("data-callType", "callScript");
scriptInfo.src = "http://mars3d.cn/lib/Cesium/Cesium.js";
document.head.appendChild(scriptInfo);
},
mounted() {
const map = new mars3d.Map("mars3dContainer", {
scene: {
center: { lat: 30.054604, lng: 108.885436, alt: 100, heading: 316, pitch: 10},
},
})
map.fixedLight = true // gltf
let tilesetLayer = new mars3d.layer.TilesetLayer({
type: "3dtiles",
name:'超低排放',
url: "/3dtiles/tileset.json",
popup: "all",
scale: 1,
// rotation: {x:0, y:1,z: 0 }, // Z沿Z45
highlight: { type: "click", color: "#00ffff" },
flyTo: true, //
heading: 0, // Z
pitch: -5, //
roll: 10 // Y
});
map.addLayer(tilesetLayer);
map.on(mars3d.EventType.click, function (event) {
let feature = event.pickedObject;
//event.graphic.attr
console.log("feature", feature);
console.log("Cesium.Cesium3DTileFeature", Cesium.Cesium3DTileFeature);
console.log(feature instanceof Cesium.Cesium3DTileFeature)
if (feature instanceof Cesium.Cesium3DTileFeature) {
// let propertyNames = feature.getPropertyNames();
// let length = propertyNames.length;
// for (var i = 0; i < length; ++i) {
// let propertyName = propertyNames[i];
// console.log(propertyName + ': ' + feature.getProperty(propertyName));
// }
}
})
//
let GraphicLayer = new mars3d.layer.GraphicLayer({
name: "墙",
show: true,
//
strokestyle: "#3388ff",
strokewidth: 2,
fill: true,
fillcolor: "#00ffff",
opacity: 0.5,
//
style: {
//
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 200000),
//
},
semicolon: true
})
map.addLayer(GraphicLayer);
//
let wallGraphic = new mars3d.graphic.WallEntity({
positions: [point1, point2],
// @param [options.allowDrillPick] - 穿
allowDrillPick: true,
style: {
//
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 20000),
//
diffHeight:15 ,
materialType: mars3d.MaterialType.Text,
materialOptions: {
text: "显示文本",
font_family: "楷体",
color: "#00ffff"
}
},
flyTo:true,
attr: { remark: "test" }
})
GraphicLayer.addGraphic(wallGraphic);
// [idattridid]
const graphic = new mars3d.graphic.FontBillboardEntity({
position: new mars3d.LngLatPoint(117.084699, 31.65172, 6),
style: {
image: "img/enp_blue/ball.png",
color: "#00ffff",
cale: 0.5,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
label: {
text: "设备名称",
font_size: 20,
color: "#ff0000",
pixelOffsetY: -120,
distanceDisplayCondition: true,
distanceDisplayCondition_far: 50000,
distanceDisplayCondition_near: 0
}
},
attr: { remark: "设备id" }
})
// Popup
// const inthtml = `<table style="width: auto;">
// <tr>
// <th scope="col" colspan="2" style="text-align:center;font-size:15px;">graphicPopup </th>
// </tr>
// <tr>
// <td></td>
// <td>html</td>
// </tr>
// </table>`
// graphic.bindPopup(inthtml).openPopup()
GraphicLayer.addGraphic(graphic);
// GraphicLayer.on(mars3d.EventType.click, function (event) {
// console.log("layer", event)
// })
function bindLayerPopup() {
GraphicLayer.bindPopup(function (event) {
console.log("监听layer绑定popup", event)
const attr = event.graphic.attr || {}
attr["类型"] = event.graphic.type
attr["来源"] = "我是layer上绑定的Popup"
attr["备注"] = "我支持鼠标交互"
return mars3d.Util.getTemplateHtml({ title: "矢量图层", template: "all", attr })
})
}
bindLayerPopup();
// const graphic2 = new mars3d.graphic.BillboardEntity({
// position: [117.084699, 31.65172, 6],
// style: {
// image: "img/enp_blue/ball.png",
// scale: 1.0,
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
// verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
// clampToGround: true
// },
// attr: { remark: "1" }
// })
// GraphicLayer.addGraphic(graphic2);
},
mothods: {
},
onUnload() {
map.destroy()
}
}
</script>
<style></style>

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
<div class="container">
<header class="pageHeader">
<span class="top-line top-line-left"></span>
凌源特种水泥数智化管控平台
{{ bigScreenName }}
<span class="top-line top-line-right"></span>
</header>
<div id="model" class="model">
@ -19,7 +19,7 @@
<div class="totalNumContnier">
<div class="totalNumWrap totalNum_orange">
<img class="" src="img/number_bg_orange.png" />
<span class="totalNumText">熟料产量</span>
<span class="totalNumText">产量</span>
<div class="totalNumber">
{{ totalData.total_production }}
</div>
@ -33,7 +33,7 @@
</div>
<div class="totalNumWrap totalNum_blue">
<img src="img/number_bg_blue.png" />
<span class="totalNumText">吨熟料综合电耗</span>
<span class="totalNumText">综合电耗</span>
<div class="totalNumber">
{{ totalData.celec_consume_unit }}
</div>
@ -75,7 +75,7 @@
<div class="flexItem">
<div class="itemTitle">
<div class="itemTitleIcon"></div>
<div>熟料产量</div>
<div>产量</div>
</div>
<div class="itemBody" id="line1"></div>
</div>
@ -215,14 +215,14 @@
<div class="itemTitle">
<div class="itemTitleIcon"></div>
<div>质量分析</div>
<el-radio-group v-model="deptName">
<!-- <el-radio-group v-model="deptName">
<el-radio label="入窑生料" class="elRadio"
>入窑生料</el-radio
>
<el-radio label="出磨熟料" class="elRadio"
>出磨熟料</el-radio
>
</el-radio-group>
</el-radio-group> -->
</div>
<div class="itemBody" id="line3"></div>
</div>
@ -252,7 +252,7 @@
</div>
<div class="elecItem">
<div class="elecItem_wrap">
<span>吨熟料发电量</span>
<span>发电量</span>
<p class="elec_number">
{{ hotData.production_elec_unit }}
<span class="elec_unit">kwh</span>
@ -630,7 +630,8 @@ export default {
},
mounted() {
let that = this;
that.factoryName = that.$TOOL.data.get("BASE_INFO").base.base_name;
that.bigScreenName =
that.$TOOL.data.get("BASE_INFO").base.bigScreen_name;
that.showTime();
that.addListener();
//
@ -744,30 +745,30 @@ export default {
let chartDom = document.getElementById("line1");
let myChart = echarts.init(chartDom);
option1.legend.data = [
{
name: "熟料",
textStyle: {
color: "#fff",
},
borderRadius: 2,
itemStyle: {
color: that.linearGradientColors[0],
},
},
{
name: "特种熟料",
textStyle: {
color: "#fff",
},
borderRadius: 2,
itemStyle: {
color: that.linearGradientColors[1],
},
},
// {
// name: "",
// textStyle: {
// color: "#fff",
// },
// borderRadius: 2,
// itemStyle: {
// color: that.linearGradientColors[0],
// },
// },
// {
// name: "",
// textStyle: {
// color: "#fff",
// },
// borderRadius: 2,
// itemStyle: {
// color: that.linearGradientColors[1],
// },
// },
];
option1.series = [
{
name: "熟料",
name: "",
type: "line",
stack: "Total",
smooth: true,
@ -785,7 +786,7 @@ export default {
data: seriesData,
},
{
name: "特种熟料",
name: "",
type: "line",
stack: "Total",
smooth: true,
@ -1484,7 +1485,7 @@ export default {
value: res[0].run_rate,
},
{
label: "吨熟料发电量(kwh/t)",
label: "发电量(kwh/t)",
field: "production_elec_unit",
value: res[0].production_elec_unit
? res[0].production_elec_unit

View File

@ -1,937 +0,0 @@
<template>
<div class="dashboard">
<header>
<div class="headerImg">水泥有限公司</div>
<div style="position: absolute;top:0.9vh;left: 8px;height: 6.5vh;">
<div style="display: flex;padding-top: 1.4vh;margin-left: 1vw;">
<div :class="bindClass(0)" @click="menuClick(0)">
<div class="menuItem">首页</div>
</div>
<div :class="bindClass(1)">
<div class="menuItem">
<el-dropdown class="dropdown" trigger="click" @command="handleClick">
<span class="el-dropdown-link">
有组织排放管理
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="paikou">排放口清单</el-dropdown-item>
<el-dropdown-item command="CEMS">CEMS监测清单</el-dropdown-item>
<el-dropdown-item>CEMS监测预警</el-dropdown-item>
<el-dropdown-item>CEMS报表导出</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
<div :class="bindClass(2)">
<div class="menuItem">
<el-dropdown class="dropdown" trigger="click" @command="handleClick2">
<span class="el-dropdown-link">
无组织排放管理
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="wuran">污染源管控制</el-dropdown-item>
<el-dropdown-item>智能治理</el-dropdown-item>
<el-dropdown-item>设备清单</el-dropdown-item>
<el-dropdown-item>环境质量</el-dropdown-item>
<el-dropdown-item>台账管理</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
</div>
</div>
<div style="position: absolute;top:0.9vh;right: 8px;height: 65px;">
<div style="display: flex;padding-top: 1.4vh;padding-right: 1vw;justify-content: flex-end;">
<div :class="bindClass(3)">
<div class="menuItem">
<el-dropdown class="dropdown" trigger="click" @command="handleClick3">
<span class="el-dropdown-link">
运输清洁
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="changwai">场外运输</el-dropdown-item>
<el-dropdown-item command="inner">场内清洁</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
<div class="menuItem">运输清洁</div>
</div>
<div :class="bindClass(4)">
<div class="menuItem">环保管理</div>
</div>
<div :class="bindClass(5)">
<div class="menuItem">台账管理</div>
</div>
<div class="wraning_icon"></div>
<div class="user_icon"></div>
</div>
</div>
</header>
<el-main style="padding:0;overflow: hidden;">
<div v-show="activeIndex==0" class="model">
<div id="loadingScreen">
<el-progress type="circle" :percentage="loadedPercent" :width=220 status="warning">
<template #default="{ percentage }">
<div style="font-size: 30px; color: white; font-weight: bold">{{ percentage }}%</div>
<div style="font-size: 18px; color: white; margin-top: 10px">工厂模型加载中</div>
</template>
</el-progress>
</div>
<canvas id="renderCanvas"></canvas>
</div>
<div v-show="activeIndex==0" class="left_other animate__animated animate__backInLeft">
<div class="panel">
<div class="chart" id="chart1">
<img src="img/ignore/left1.png" style="width: 100%;height: 100%;">
</div>
</div>
<div class="panel">
<div class="chart" id="chart2">
<img src="img/ignore/left2.png" style="width: 100%;height: 100%;">
</div>
</div>
<div class="panel">
<div class="chart" id="chart3">
<img src="img/ignore/left3.png" style="width: 100%;height: 100%;">
</div>
</div>
</div>
<div v-show="activeIndex==0" class="right_other animate__animated animate__backInRight">
<div class="panel">
<div class="chart" id="chart4">
<img src="img/ignore/right1.png" style="width: 100%;height: 100%;">
</div>
</div>
<div class="panel">
<div class="chart" id="chart5">
<img src="img/ignore/right2.png" style="width: 100%;height: 100%;">
</div>
</div>
</div>
<div v-show="activeIndex==0" class="left_border"></div>
<div v-show="activeIndex==0" class="right_border"></div>
<div v-show="activeIndex==0" class="btns_enp"></div>
<div v-show="activeIndex==0" class="bottom_enp"></div>
<!-- -->
<div v-if="activeIndex!=0" class="container">
<div class="sysName">智能环保一体化管控平台</div>
<img v-show="activePage==1" src="img/ignore/emission.jpg" @click="pageClick(101)" class="pageClass">
<img v-show="activePage==2" src="img/ignore/CEMS.jpg" @click="pageClick(201)" class="pageClass">
<img v-show="activePage==3" src="img/ignore/wuran.jpg" @click="pageClick(301)" class="pageClass">
<img v-show="activePage==4" src="img/ignore/car.jpg" class="pageClass">
<img v-show="activePage==5" src="img/ignore/transportation.jpg" class="pageClass">
<img v-show="activePage==101" src="img/ignore/emission_detail.jpg" @click="pageClick(1)" class="pageClass">
<img v-show="activePage==201" src="img/ignore/CEMS_detail.jpg" @click="pageClick(2)" class="pageClass">
<img v-show="activePage==301" src="img/ignore/wuran_detail.jpg" @click="pageClick(3)" class="pageClass">
</div>
</el-main>
</div>
</template>
<script>
import * as echarts from "echarts";
import * as BABYLON from "babylonjs"
import * as BABYLON_GUI from "babylonjs-gui"
import * as BABYLON_GRID from "@/utils/gridMaterial"
import * as BABYLON_MATERIAL from "@/utils/babylonMaterial"
import 'babylonjs-loaders';
import 'animate.css';
export default {
data() {
return {
isCollapse:false,
nowDay: 1,
initialAlpha: -Math.PI / 0.89,
initialBeta: Math.PI / 3.3,
initialRadius: 18,
initialTarget: null,
scene: null,
myui: null,
is_mainviewpoint: false,
resizeTimeout: null,
engine: null,
loadedPercent: 0,
sectionNames: {
"干渣库_primitive0": "电石渣",
"原料磨及废气处理_primitive0": "原料磨",
"窑": "回转窑",
"煤粉制备_primitive1": "煤磨",
"水泥磨房_primitive0": "水泥磨",
"水泥储存及散装库_primitive2": "水泥包装",
// "": ""
},
showKgcet: true,
currentLightMesh: null,
activePage:0,
activeIndex: 0,
activeSection: 2,
activeSectionName: '回转窑',
updateTime: '2023-08-17 16:00:00',
basicOption: {
backgroundColor: '',
series: [
{
name: '销量',
type: 'bar',
barwidth: 10,
label: {
show: true,
position: 'top'
},
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#83bff6' },
{ offset: 0.5, color: '#188df0' },
{ offset: 1, color: '#188df0' }
])
},
emphasis: {
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#2378f7' },
{ offset: 0.7, color: '#2378f7' },
{ offset: 1, color: '#83bff6' }
])
}
},
data: []
}
],
grid: { //
top: "10%",
left: "12%",
right: "0px",
bottom: "15%"
}
},
chart1Option: {},
seriesData1: [0, 0, 0, 0, 0, 0],
ws: null,
mgroupValues: {
电石渣: { total: '0', elec: '0' },
原料磨: { total: '0', elec: '0' },
煤磨: { total: '0', elec: '0' },
回转窑: { total: '0', elec: '0' },
水泥磨: { total: '0', elec: '0' },
水泥包装: { total: '0', elec: '0' }
},
}
},
mounted() {
let that= this;
this.addListener();
this.initDomStyle();
this.$nextTick(() => {
setTimeout(function () {
that.initFactory();
}, 1000);
});
},
beforeUnmount() {
//
const canvas = document.getElementById('renderCanvas');
if (canvas) {
canvas.parentNode.removeChild(canvas);
}
},
methods: {
initDomStyle() {
//
var windowHeight = window.innerHeight;
var windowWidth = window.innerWidth;
//
var dashboard = document.getElementsByClassName('dashboard')[0];
var left_other = document.getElementsByClassName('left_other')[0];
var right_other = document.getElementsByClassName('right_other')[0];
var model = document.getElementsByClassName('model')[0];
if (windowWidth > 960) {
dashboard.style.overflow = 'hidden';
//
left_other.style.position = 'absolute';
left_other.style.width = '20%';
right_other.style.position = 'absolute';
right_other.style.width = '20%';
model.style.position = 'absolute';
model.style.height = (windowHeight - 4) + 'px';
model.style.top = 0;
var chartHeight1 = (100-18) *0.31 + 'vh';
var chartHeight2 = (100-18) *0.37 + 'vh';
var chartHeight3 = (100-17) *0.28 + 'vh';
var chartHeight4 = (100-17) *0.715 + 'vh';
var charts = document.getElementsByClassName('chart')
for (var i = 0; i < charts.length; i++) {
var chart = charts[i]
switch (i) {
case 0:
chart.style.height = chartHeight1;
break;
case 1:
chart.style.height = chartHeight1;
break;
case 2:
chart.style.height = chartHeight2;
break;
case 3:
chart.style.height = chartHeight3;
break;
case 4:
chart.style.height = chartHeight4;
break;
}
chart.style.height = chartHeight;
}
}
else {
dashboard.style.overflow = 'auto';
var chartHeight = windowWidth * 0.6;
left_other.style.position = 'static';
left_other.style.width = '100%';
right_other.style.position = 'static';
right_other.style.width = '100%';
model.style.position = 'relative';
model.style.height = chartHeight;
var charts = document.getElementsByClassName('chart')
for (var i = 0; i < charts.length; i++) {
var chart = charts[i]
chart.style.height = chartHeight;
}
}
if (this.engine != null) {
this.engine.resize();
}
},
// Class
bindClass(index) {
let that = this;
let classInfo = {menuWrap: true, menuWrap1: false, menuWrap2: false,menuWrapActive: false};
if(index==that.activeIndex){
classInfo.menuWrapActive = true;
}
if (index == 1 ||index == 2) {
classInfo.menuWrap2 = true;
}else{
classInfo.menuWrap1 = true;
}
return classInfo
},
menuClick(){
this.activeIndex = 0;
},
handleClick(command){
this.activeIndex = 1;
if(command == "paikou"){
this.activePage = 1;
}else if(command == "CEMS"){
this.activePage = 2;
}
},
handleClick2(command){
this.activeIndex = 2;
if(command == "wuran"){
this.activePage = 3;
}
},
handleClick3(command){
this.activeIndex = 3;
if(command == "changwai"){
this.activePage = 5;
}else if(command=='inner'){
this.activePage = 4;
}
},
pageClick(page){
this.activePage = page;
},
getMessage(msg) {
console.log(msg);
},
close() {
if (this.ws) {
this.ws.close();
this.ws = null;
console.log("socket已经关闭");
}
},
compare(property) {
return function (a, b) {
return a[property] - b[property];
}
},
initCharts() {
let that = this;
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
//
that.basicOption.xAxis.data = that.xAxisData;
that.chart1Option = deepCopy(that.basicOption)
that.chart1Option.series = [
{
name: '电耗',
type: 'bar',
barWidth: 15,
label: {
show: true,
position: 'top'
},
emphasis: {
focus: 'series'
},
data: that.seriesData1
}]
that.setChart('chart1', that.chart1Option);
},
addListener() {
var that = this;
window.addEventListener('resize', function () {
// resizeTimeout
if (this.resizeTimeout) {
clearTimeout(this.resizeTimeout);
}
// resizeTimeout
this.resizeTimeout = setTimeout(function () {
that.initDomStyle()
}, 300); // 300
});
},
resizeChart(name) {
// name resize chart
var myChart = echarts.getInstanceByDom(document.getElementById(name));
if (myChart != undefined) {
// console.log(name + ' :resize')
myChart.resize();
}
},
setChart(name, option = null) {
// name , optionoption
var myChart = echarts.getInstanceByDom(document.getElementById(name));
if (myChart == undefined) {
myChart = echarts.init(document.getElementById(name), 'dark', { renderer: 'svg' });
}
if (option == null) {
option = Object.assign({}, this.basicOption)
}
setTimeout(() => {
try {
myChart.setOption(option);
} catch (error) { }
}, 500)
},
initFactory() {
var that = this;
const canvas = document.getElementById("renderCanvas"); // Get the canvas element
const engine = new BABYLON.Engine(canvas, true); // Generate the BABYLON 3D engine
BABYLON.DefaultLoadingScreen.prototype.displayLoadingUI = function () {
}
BABYLON.DefaultLoadingScreen.prototype.hideLoadingUI = function () {
document.getElementById("loadingScreen").style.display = "none";
}
engine.displayLoadingUI();
// Add your code here matching the playground format
const createScene = function () {
const scene = new BABYLON.Scene(engine);
scene.clearColor = BABYLON.Color3.Black(); //BABYLON.Color3(1, 0, 1);
const ground = BABYLON.MeshBuilder.CreateGround("ground", { width: 100, height: 100 });
const groundMaterial = new BABYLON_GRID.GridMaterial("groundMaterial", scene);
groundMaterial.majorUnitFrequency = 5;
groundMaterial.minorUnitVisibility = 0.5;
groundMaterial.gridRatio = 2;
// groundMaterial.opacity = 0.99;
ground.material = groundMaterial;
ground.position.y = -0.1
//
const backgroundImage = new BABYLON.Layer('', 'img/ignore/backgroundEnp.jpg', scene, true);
const camera = new BABYLON.ArcRotateCamera("camera", that.initialAlpha, that.initialBeta, that.initialRadius, new BABYLON.Vector3(0, 0, 1.2));
that.initialTarget = camera.getTarget();
camera.upperBetaLimit = Math.PI / 2.3; //
camera.attachControl(canvas, true);
camera.maxZ = 1000; //
//
camera.lowerRadiusLimit = 6;
camera.upperRadiusLimit = 18;
//
const light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0));
light.intensity = 1.6;
// GUI
const advancedTexture = BABYLON_GUI.AdvancedDynamicTexture.CreateFullscreenUI("myUI");
that.myui = advancedTexture;
//
const highlightLayer = new BABYLON.HighlightLayer('highlightLayer', scene);
//
var control_main = new BABYLON_GUI.StackPanel();
control_main.isVertical = false
control_main.top = '-40%';
control_main.left = '-20%';
advancedTexture.addControl(control_main);
var button_main = BABYLON_GUI.Button.CreateSimpleButton("button_main", "主视角");
button_main.width = "80px"
button_main.height = "30px";
button_main.color = "white";
button_main.cornerRadius = 20;
button_main.background = "green";
control_main.addControl(button_main)
button_main.onPointerClickObservable.add(() => {
if (camera.alpha != that.initialAlpha || camera.beta != that.initialBeta || camera.radius != that.initialRadius) {
var cameraPosition = new BABYLON.Vector3(
0 + that.initialRadius * Math.sin(that.initialBeta) * Math.cos(that.initialAlpha),
0 + that.initialRadius * Math.cos(that.initialBeta),
0 + that.initialRadius * Math.sin(that.initialBeta) * Math.sin(that.initialAlpha)
);
var ease = new BABYLON.CubicEase();
ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
BABYLON.Animation.CreateAndStartAnimation('at6', camera, 'position', 45, 200, camera.position, cameraPosition, 0, ease);
BABYLON.Animation.CreateAndStartAnimation('at61', camera, 'target', 45, 200, camera.target, that.initialTarget, 0, ease);
}
})
// mesh
const mesh_rect = new BABYLON_GUI.Rectangle('mesh_rect');
mesh_rect.width = "100px";
mesh_rect.height = "25px";
mesh_rect.background = 'orange';
mesh_rect.alpha = 0.6;
mesh_rect.isVisible = false;
advancedTexture.addControl(mesh_rect);
var mesh_name = new BABYLON_GUI.TextBlock('mesh_name');
mesh_name.text = "";
mesh_name.color = 'white';
mesh_name.fontSize = '14px';
mesh_rect.addControl(mesh_name);
var remoteGlbUrl = config.HOST_URL + "/media/model/factory.glb";
// var remoteGlbUrl = process.env.VUE_APP_BASEURL + "/media/model/factory.glb";
BABYLON.SceneLoader.Append(remoteGlbUrl, "", scene, function (scene) {
for (let key in that.sectionNames) {
const value = that.sectionNames[key];
const mesh = scene.getMeshByName(key);
if (mesh) {
const img = new BABYLON_GUI.Image('img', 'img/ignore/qm_enp.png');
img.width = '50px';
img.height = '50px';
img.top = '50%';
img.left = '50%';
img.horizontalAlignment = 10;
img.verticalAlignment = 10;
//
const rect1 = new BABYLON_GUI.Rectangle(value + '_rect');
rect1.width = "60px";
rect1.height = "30px";
rect1.cornerRadius = 4;
rect1.color = "Orange";
rect1.thickness = 2;
rect1.background = "green";
rect1.isPointerBlocker = true; // 穿
advancedTexture.addControl(img);
var label = new BABYLON_GUI.TextBlock(value + '_label');
label.text = value;
label.color = 'white';
label.fontSize = '14px';
img.linkWithMesh(mesh);
rect1.onPointerDownObservable.add(() => {
const mesh = rect1.linkedMesh;
if (camera.target != mesh.position) {
// console.log('fly to')
//
let position = mesh._parentNode._position
if (mesh._parentNode.id == '__root__') {
position = mesh.position
}
const cameraPosition = new BABYLON.Vector3(
mesh.position.x + 9 * Math.sin(camera.beta) * Math.cos(Math.PI),
mesh.position.y + 9 * Math.cos(camera.beta),
mesh.position.z + 9 * Math.sin(camera.beta) * Math.sin(Math.PI)
);
var ease = new BABYLON.CubicEase();
ease.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEINOUT);
BABYLON.Animation.CreateAndStartAnimation('at5', camera, 'position', 45, 200, camera.position, cameraPosition, 0, ease);
BABYLON.Animation.CreateAndStartAnimation('at51', camera, 'target', 45, 200, camera.target, position, 0, ease);
}
let dataViewName = rect1.name.split('_')[0] + '_data_view';
that.activeSectionName = dataViewName;
that.activeSection = 2;
let dataView = advancedTexture.getControlByName(dataViewName);
if (dataView) {
// //
dataView.isVisible = false;
}
});
// ,StackPanel
const data_view = new BABYLON_GUI.StackPanel(value + '_data_view');
data_view.width = '200px'; // StackPanel
data_view.height = '140px';
data_view.thickness = 1;
data_view.background = 'rgba(0, 34, 51, 0.5)';//
let mgroupName = new BABYLON_GUI.TextBlock(value + '_label');
mgroupName.height = "30px";
mgroupName.width = "120px";
mgroupName.color = "white";
mgroupName.text = value;
mgroupName.shadowColor = '#66b1ff';
mgroupName.shadowBlur = 5;
mgroupName.shadowOffsetX = -2;
mgroupName.shadowOffsetY = 2;
data_view.addControl(mgroupName);
const mgroup = new BABYLON_GUI.Rectangle('mgroup');
mgroup.height = "3px";
mgroup.width = "160px";
mgroup.thickness = 0;
mgroup.background = 'rgba(44, 237, 255, 0.45)';
data_view.addControl(mgroup);
var grid = new BABYLON_GUI.Grid("grid");
grid.width = '200px';
grid.height = '70px';
grid.paddingLeft = 1;
var wd = 2;
var hd = 2;
for (let i = 0; i < wd; i++) {
grid.addRowDefinition(1 / wd);
}
for (let j = 0; j < hd; j++) {
grid.addColumnDefinition(1 / hd);
}
// for (let i = 0; i < wd; i++) {
// for (let j = 0; j < hd; j++) {
// var rc = new BABYLON_GUI.TextBlock("rc" + i + j);
// rc.width = "100%";
// // rc.height = "100%";
// rc.thickness = 0;
// if (j == 0 && i == 0) {
// rc.width = "120px";
// rc.text = "";
// rc.color = "white";
// rc.fontSize = '16px';
// } else if (j == 0 && i == 1) {
// rc.width = "120px";
// rc.color = "white";
// rc.fontSize = '16px';
// rc.text = "";
// } else if (j == 1 && i == 0) {
// // rc.text = that.mgroupValues[value].total;
// rc.text = "123";
// rc.width = "80px";
// rc.fontSize = '18px';
// rc.color = "rgb(44,237,255)";
// } else if (j == 1 && i == 1) {
// // rc.text = that.mgroupValues[value].total;
// rc.text = "456";
// rc.width = "80px";
// rc.fontSize = '18px';
// rc.color = "rgb(44,237,255)";
// }
// grid.addControl(rc, i, j);
// }
// }
data_view.addControl(grid);
var mgroup_close = BABYLON_GUI.Button.CreateSimpleButton("mgroup_close" + value, '关闭');
mgroup_close.width = "70px"
mgroup_close.height = "25px";
mgroup_close.color = "white";
mgroup_close.cornerRadius = 15;
mgroup_close.fontSize = '12px';
mgroup_close.background = 'rgb(44,237,255,.5)';
mgroup_close.HORIZONTAL_ALIGNMENT_RIGHT = 5;
mgroup_close.onPointerClickObservable.add(() => {
console.log('data_view', data_view)
data_view.isVisible = false;
})
// data_view.addControl(mgroup_close);
// StackPanelGUI
// advancedTexture.addControl(data_view);
data_view.linkWithMesh(mesh);
data_view.linkOffsetY = -120;
if (value == '电石渣') {
data_view.linkOffsetY = -290;
}
}
}
engine.hideLoadingUI()
},
function (evt) {
var loadedPercent = 0;
if (evt.lengthComputable) {
loadedPercent = parseInt(evt.loaded * 100 / evt.total);
} else {
var dlCount = evt.loaded / (1024 * 1024);
loadedPercent = Math.floor(dlCount * 100.0) / 100.0;
}
that.loadedPercent = loadedPercent;
})
// checkbox
var checkbox = new BABYLON_GUI.Checkbox();
checkbox.width = "20px";
checkbox.height = "20px";
checkbox.isChecked = false;
checkbox.marginLeft = '16px'
checkbox.color = "green";
checkbox.onIsCheckedChangedObservable.add(function (value) {
if (value) {
camera.useAutoRotationBehavior = true;
} else {
camera.useAutoRotationBehavior = false;
}
});
control_main.addControl(checkbox);
var header = new BABYLON_GUI.TextBlock();
header.text = "自动旋转";
header.width = "80px";
header.textHorizontalAlignment = BABYLON_GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
header.color = "white";
control_main.addControl(header);
// checkbox
// var checkbox1 = new BABYLON_GUI.Checkbox();
// checkbox1.width = "20px";
// checkbox1.height = "20px";
// checkbox1.isChecked = true;
// checkbox1.marginLeft = '16px'
// checkbox1.color = "green";
// checkbox1.onIsCheckedChangedObservable.add(function (value) {
// if (value) {
// for (let key in that.sectionNames) {
// let name = that.sectionNames[key] + '_data_view';
// console.log(name)
// let dataView = advancedTexture.getControlByName(name);
// dataView.isVisible = true;
// }
// } else {
// for (let key in that.sectionNames) {
// let name = that.sectionNames[key] + '_data_view';
// console.log(name)
// let dataView = advancedTexture.getControlByName(name);
// dataView.isVisible = false;
// }
// }
// });
// control_main.addControl(checkbox1);
// var header1 = new BABYLON_GUI.TextBlock();
// header1.text = "";
// header1.width = "80px";
// header1.textHorizontalAlignment = BABYLON_GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;
// header1.color = "white";
// control_main.addControl(header1);
//
canvas.addEventListener('mousemove', (event) => {
// 使 scene.pick
const pickResult = scene.pick(scene.pointerX, scene.pointerY);
if (that.currentLightMesh) {
mesh_rect.isVisible = false;
highlightLayer.removeAllMeshes();
}
if (pickResult.hit) {
const mesh = pickResult.pickedMesh;
highlightLayer.removeAllMeshes();
if (/.*[\u4e00-\u9fa5]+.*$/.test(mesh.name) && mesh.name !== '地面1' && mesh.name !== '绿地' && mesh.name !== '停车场') {
// mesh
highlightLayer.addMesh(mesh, new BABYLON.Color3(1, 1, 0.5));
that.currentLightMesh = mesh;
mesh_rect.linkWithMesh(mesh);
let name = mesh.name.split('_')[0];
mesh_name.text = name;
mesh_rect.isVisible = true;
}
}
});
// checkbox.isChecked = true; //
return scene;
};
const scene = createScene();
// scene.debugLayer.show()
engine.runRenderLoop(function () {
scene.render();
});
this.engine = engine;
this.scene = scene;
window.addEventListener("resize", function () {
engine.resize();
});
},
},
unmounted() {
this.close();
},
}
</script>
<style scoped>
.container{
width: 100%;
position: absolute;
height: 100vh;
top: 0vh;
z-index: 0;
padding-top: 8vh;
box-sizing: border-box;
background-image: url('/public/img/ignore/backgroundEnp.jpg');
background-size: cover;
}
.dashboard {
background-color: black;
font-family: Inter, "-apple-system", BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "noto sans", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
header {
z-index: 10;
display: flex;
position: relative;
align-items: center;
box-sizing: border-box;
padding: 1.3vh 0.4vw 0 0.4vw;
justify-content: space-between;
}
.headerImg{
width: 100%;
height: 6vh;
line-height: 6vh;
color: #ffffff;
font-size: 1.8vw;
text-align: center;
background-size: 100% 100%;
background-position: center;
background-image: url('/public/img/ignore/header_enp.png');
}
.sysName{
color: #ffffff;
padding-left: 1vw;
font-size: 2vh;
}
.btns_enp{
bottom: 7vh;
left:28.7vw;
width: 42.6vw;
height: 4.3vh;
position: absolute;
background-size: 100% 100%;
background-position: center;
background-image: url('/public/img/ignore/btns_enp.png');
}
.bottom_enp{
left: 0;
bottom: 0;
width: 100%;
height: 5vh;
position: absolute;
background-size: 100% 100%;
background-position: center;
background-image: url('/public/img/ignore/bottom_enp.png');
}
.menuWrap{
height: 4vh;
margin-right: 1vw;
}
.menuWrap1{
width: 4.4vw;
background-image: url('/public/img/ignore/enp_menu_img1.png');
background-size: cover;
}
.menuWrap1:hover,.menuWrapActive.menuWrap1{
background-image: url('/public/img/ignore/enp_menu_img_active1.png');
background-size: cover;
}
.menuWrap2{
width: 7vw;
background-image: url('/public/img/ignore/enp_menu_img2.png');
background-size: cover;
}
.menuWrap2:hover,.menuWrapActive.menuWrap2{
color: #ffffff;
background-image: url('/public/img/ignore/enp_menu_img_active2.png');
}
.menuItem{
color: #ffffff;
line-height: 4vh;
font-size: 1.5vh;
text-align: center;
}
.dropdown{
color: #ffffff;
line-height: 4vh;
font-size: 1.4vh;
}
.wraning_icon{
width: 2vh;
height: 2.3vh;
margin-top: 0.9vh;
background-size: cover;
background-image: url('/public/img/ignore/warning_enp.png');
}
.user_icon{
width: 2.3vh;
height: 2.3vh;
margin-top: 0.9vh;
margin-left: 2vh;
background-size: cover;
background-image: url('/public/img/ignore/user_enp.png');
}
.model {
top: 0;
left: 0;
width: 100%;
background-image: url('/public/img/ignore/backgroundEnp.jpg');
background-size: cover;
}
#renderCanvas {
width: 100%;
height: 100%
}
#loadingScreen {
position: absolute;
width: 100%;
top: 260px;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 30px;
}
.left_other,
.right_other {
position: absolute;
top: 8vh;
width: 20%;
padding: 10px;
}
.right_other {
right: 0
}
.panel {
margin-top: 1.5vh;
}
.chart {
width: 100%;
height: 220px;
}
.left_border{
width: 1vh;
height: 70vh;
position: absolute;
left: 21%;
top: 15vh;
background-size: cover;
background-image: url('/public/img/ignore/left_border.png');
}
.right_border{
width: 1vh;
height: 70vh;
position: absolute;
right: 21%;
top: 15vh;
background-size: cover;
background-image: url('/public/img/ignore/right_border.png');
}
.pageClass{
width: 100%;
height: 89vh;
position: absolute;
bottom: 0;
left: 0;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -238,6 +238,7 @@ export default {
["煤磨排风机主电机", "", "KW·h/t", "", "", ""],
["煤磨主电机", "", "KW·h/t", "", "", ""],
],
tableData: [],
modelValue: true,
type: "hour_s",
title: "煤磨工段",
@ -346,148 +347,42 @@ export default {
},
],
},
mpoints: [],
};
},
mounted() {
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
let month = myDate.getMonth() + 1;
let days = myDate.getDate();
let hours = myDate.getHours();
let timeDate = myDate.getTime();
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
month_d = lastDate.getMonth() + 1;
days_d = lastDate.getDate();
}
//
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
this.$API.mtm.mgroup.list
.req({ page: 0, search: "煤磨" })
.then((res) => {
console.log("煤磨", res);
that.query.mgroup = res[0].id;
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = that.query.mgroup;
that.$API.enm.enstat
.req(params2)
.then((res2) => {
if (res2.length > 0) {
let hourProduct = (that.allValMonth =
res2[0].total_production); //
params2.mpoint__ep_monitored__power_kw__gte = 100;
that.$API.enm.mpoint.stat
.req(params2)
.then((res) => {
let data2 = res;
for (let i = 0; i < data2.length; i++) {
that.tableDatas[i] = [];
that.tableDatas[i][0] =
data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
hourProduct == 0
? "/"
: (
data2[i].val /
hourProduct
).toFixed(2);
that.tableDatas[i][5] = val;
that.tableDatas[i][6] = data2[i].mpoint;
}
});
}
})
.then((res2) => {
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = that.query.mgroup;
that.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let hourProduct = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
that.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
hourProduct == 0
? "/"
: (
data3[j].val /
hourProduct
).toFixed(2);
that.tableDatas[j][4] = val;
}
});
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_s";
params4.mgroup = that.query.mgroup;
that.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
that.$API.enm.mpoint.stat
.req(params4)
.then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val =
hourProduct == 0
? "/"
: (
data4[k].val /
hourProduct
).toFixed(2);
that.tableDatas[k][3] = val;
}
});
}
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
});
that.year = myDate.getFullYear();
that.month = myDate.getMonth() + 1;
that.days = myDate.getDate();
that.hours = myDate.getHours();
that.getMpoints();
that.getTableHourData();
that.getHourData(that.year, that.month, that.days);
that.getDayData(that.year, that.month);
that.getMonthData(that.year);
},
methods: {
getMpoints() {
let that = this;
let obj = {};
obj.mgroup__name = "煤磨";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
console.log("mpoints", res);
let arr = [];
res.forEach((item) => {
arr.push(item.nickname);
});
console.log("arr", arr);
that.mpoints = arr;
});
},
typeRadioChange() {
this.searchDate = "";
},
@ -505,39 +400,154 @@ export default {
} else {
this.getMonthData(val);
}
this.searchDate;
},
getTableHourData() {
let that = this;
that.tableDatas = [];
let timeDate = new Date().getTime();
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
let minutes = hourDate.getMinutes();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
if (hours_h > 5) {
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
} else {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
let obj = {};
obj.type = "hour_s";
obj.year = year_h;
obj.month = month_h;
obj.day = days_h;
obj.hour = hours_h;
obj.mgroup__name = "煤磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
that.tableData = res;
console.log("getTableHourData", res);
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[4] = 0;
obj[5] = 0;
obj[6] = item.mpoint;
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
let year_h = ystDate.getFullYear();
let month_h = ystDate.getMonth() + 1;
let days_h = ystDate.getDate();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
let obj_d = {};
obj_d.type = "day_s";
obj_d.year_s = year_h;
obj_d.month_s = month_h;
obj_d.day_s = days_h;
obj_d.mgroup__name = "煤磨";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_d = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_d]) {
that.tableDatas[index_d][3] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
obj_m.type = "month_s";
obj_m.year_s = that.year;
obj_m.month_s = that.month;
obj_m.mgroup__name = "煤磨";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_m = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_m]) {
that.tableDatas[index_m][4] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[5] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
})
.then(() => {});
},
//
getHourData() {
getHourData(year, month, days) {
let that = this;
let query = {};
query.page = 0;
query.year_s = that.year;
query.month_s = that.month;
query.day_s = that.days;
query.type = "hour_s";
query.mgroup = that.query.mgroup;
query.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(query).then((response) => {
let seriesData0 = [],
seriesData1 = [];
let obj = {};
obj.type = "hour_s";
obj.year_s = year;
obj.month_s = month;
obj.day_s = days;
obj.mgroup__name = "煤磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).toFixed(2);
}
if (item.equip_name == "煤磨排风机主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "煤磨主电机") {
seriesData1[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.hour; //xAxis
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option1 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let hourXAxis = [];
for (let i = 0; i < 24; i++) {
let item = i + "时";
@ -548,39 +558,40 @@ export default {
});
},
//
getDayData() {
getDayData(year, month) {
let that = this;
let query1 = {};
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
query1.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [],
seriesData1 = [];
let obj = {};
obj.type = "day_s";
obj.year_s = year;
obj.month_s = month;
obj.mgroup__name = "煤磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
// debugger;
let ind = item.day_s;
let val = 0;
if (that.allValDays == 0) {
val = "";
} else {
val = (item.val / that.allValDays).toFixed(2);
}
if (item.equip_name == "煤磨排风机主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "煤磨主电机") {
seriesData1[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.day_s - 1;
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日";
dayXAxis.push(item);
}
@ -589,37 +600,38 @@ export default {
});
},
//
getMonthData() {
getMonthData(year) {
let that = this;
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
query2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query2).then((response) => {
let seriesData0 = [],
seriesData1 = [];
let obj = {};
obj.type = "month_s";
obj.year_s = year;
obj.mgroup__name = "煤磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s;
let val = 0;
if (that.allValMonth == 0) {
val = "";
} else {
val = (item.val / that.allValMonth).toFixed(2);
}
if (item.equip_name == "煤磨排风机主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "煤磨主电机") {
seriesData1[ind] = val;
}
let ind = item.month_s - 1;
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option3 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
for (let i = 1; i < 13; i++) {
let item = i + "月";
monthXAxis.push(item);
}

View File

@ -249,6 +249,7 @@ export default {
["高温风机", "", "KW·h/t", "", "", ""],
["窑主电机", "", "KW·h/t", "", "", ""],
],
tableData: [],
modelValue: true,
type: "hour_s",
title: "回转窑工段",
@ -460,148 +461,43 @@ export default {
},
],
},
mpoints: [],
};
},
mounted() {
//
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
let month = myDate.getMonth() + 1;
let days = myDate.getDate();
let hours = myDate.getHours();
let timeDate = myDate.getTime();
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
month_d = lastDate.getMonth() + 1;
days_d = lastDate.getDate();
}
//
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
that.$API.mtm.mgroup.list
.req({ page: 0, search: "回转窑" })
.then((res) => {
console.log("回转窑", res);
that.query.mgroup = res[0].id;
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat
.req(params2)
.then((res2) => {
if (res2.length > 0) {
let allValMonth = (that.allValMonth =
res2[0].total_production); //
params2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params2)
.then((res) => {
let data2 = res;
for (let i = 0; i < data2.length; i++) {
that.tableDatas[i] = [];
that.tableDatas[i][0] =
data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
allValMonth == 0
? "/"
: (
data2[i].val /
allValMonth
).toFixed(2);
that.tableDatas[i][5] = val;
that.tableDatas[i][6] = data2[i].mpoint;
}
});
}
})
.then((res2) => {
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let allValDays = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
allValDays == 0
? "/"
: (
data3[j].val /
allValDays
).toFixed(2);
that.tableDatas[j][4] = val;
}
});
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params4)
.then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val =
hourProduct == 0
? "/"
: (
data4[k].val /
hourProduct
).toFixed(2);
that.tableDatas[k][3] = val;
}
});
}
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
});
that.year = myDate.getFullYear();
that.month = myDate.getMonth() + 1;
that.days = myDate.getDate();
that.hours = myDate.getHours();
that.getMpoints();
that.getTableHourData();
that.getHourData(that.year, that.month, that.days);
that.getDayData(that.year, that.month);
that.getMonthData(that.year);
},
methods: {
getMpoints() {
let that = this;
let obj = {};
obj.mgroup__name = "回转窑";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
console.log("mpoints", res);
let arr = [];
res.forEach((item) => {
arr.push(item.nickname);
});
console.log("arr", arr);
that.mpoints = arr;
});
},
typeRadioChange() {
this.searchDate = "";
},
@ -621,66 +517,152 @@ export default {
}
this.searchDate;
},
//
getHourData() {
getTableHourData() {
let that = this;
let query = {};
query.page = 0;
query.year_s = that.year;
query.month_s = that.month;
query.day_s = that.days;
query.type = "hour_s";
query.mgroup = that.query.mgroup;
query.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(query).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [],
seriesData7 = [];
that.tableDatas = [];
let timeDate = new Date().getTime();
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
let minutes = hourDate.getMinutes();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
if (hours_h > 5) {
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
} else {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
let obj = {};
obj.type = "hour_s";
obj.year = year_h;
obj.month = month_h;
obj.day = days_h;
obj.hour = hours_h;
obj.mgroup__name = "回转窑";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
that.tableData = res;
console.log("getTableHourData", res);
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[4] = 0;
obj[5] = 0;
obj[6] = item.mpoint;
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
let year_h = ystDate.getFullYear();
let month_h = ystDate.getMonth() + 1;
let days_h = ystDate.getDate();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
let obj_d = {};
obj_d.type = "day_s";
obj_d.year_s = year_h;
obj_d.month_s = month_h;
obj_d.day_s = days_h;
obj_d.mgroup__name = "回转窑";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_d = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_d]) {
that.tableDatas[index_d][3] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
obj_m.type = "month_s";
obj_m.year_s = that.year;
obj_m.month_s = that.month;
obj_m.mgroup__name = "回转窑";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_m = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_m]) {
that.tableDatas[index_m][4] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[5] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
})
.then(() => {});
},
//
getHourData(year, month, days) {
let that = this;
let obj = {};
obj.type = "hour_s";
obj.year_s = year;
obj.month_s = month;
obj.day_s = days;
obj.mgroup__name = "回转窑";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).toFixed(2);
}
if (item.equip_name == "高温风机") {
seriesData0[ind] = val;
} else if (item.equip_name == "窑主电机") {
seriesData1[ind] = val;
} else if (item.equip_name == "篦冷机一室风机电机") {
seriesData2[ind] = val;
} else if (item.equip_name == "篦冷机二室风机电机") {
seriesData3[ind] = val;
} else if (item.equip_name == "篦冷机三室风机电机") {
seriesData4[ind] = val;
} else if (item.equip_name == "窑头排风机主电机") {
seriesData5[ind] = val;
} else if (
item.equip_name == "篦冷机一室充气梁风机(左)电机"
) {
seriesData6[ind] = val;
} else if (
item.equip_name == "篦冷机一室充气梁风机(右)电机"
) {
seriesData7[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.hour; //xAxis
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option1 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
options.series[5].data = seriesData4;
options.series[6].data = seriesData4;
options.series[7].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let hourXAxis = [];
for (let i = 0; i < 24; i++) {
let item = i + "时";
@ -691,67 +673,40 @@ export default {
});
},
//
getDayData() {
getDayData(year, month) {
let that = this;
let query1 = {};
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
query1.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [],
seriesData7 = [];
let obj = {};
obj.type = "day_s";
obj.year_s = year;
obj.month_s = month;
obj.mgroup__name = "回转窑";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
// debugger;
let ind = item.day_s;
let val = 0;
if (that.allValDays == 0) {
val = "";
} else {
val = (item.val / that.allValDays).toFixed(2);
}
if (item.equip_name == "高温风机") {
seriesData0[ind] = val;
} else if (item.equip_name == "窑主电机") {
seriesData1[ind] = val;
} else if (item.equip_name == "篦冷机一室风机电机") {
seriesData2[ind] = val;
} else if (item.equip_name == "篦冷机二室风机电机") {
seriesData3[ind] = val;
} else if (item.equip_name == "篦冷机三室风机电机") {
seriesData4[ind] = val;
} else if (item.equip_name == "窑头排风机主电机") {
seriesData5[ind] = val;
} else if (
item.equip_name == "篦冷机一室充气梁风机(左)电机"
) {
seriesData6[ind] = val;
} else if (
item.equip_name == "篦冷机一室充气梁风机(右)电机"
) {
seriesData7[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.day_s - 1;
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
options.series[5].data = seriesData4;
options.series[6].data = seriesData4;
options.series[7].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日";
dayXAxis.push(item);
}
@ -760,65 +715,38 @@ export default {
});
},
//
getMonthData() {
getMonthData(year) {
let that = this;
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
query2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query2).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [],
seriesData7 = [];
let obj = {};
obj.type = "month_s";
obj.year_s = year;
obj.mgroup__name = "回转窑";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s;
let val = 0;
if (that.allValMonth == 0) {
val = "";
} else {
val = (item.val / that.allValMonth).toFixed(2);
}
if (item.equip_name == "高温风机") {
seriesData0[ind] = val;
} else if (item.equip_name == "窑主电机") {
seriesData1[ind] = val;
} else if (item.equip_name == "篦冷机一室风机电机") {
seriesData2[ind] = val;
} else if (item.equip_name == "篦冷机二室风机电机") {
seriesData3[ind] = val;
} else if (item.equip_name == "篦冷机三室风机电机") {
seriesData4[ind] = val;
} else if (item.equip_name == "窑头排风机主电机") {
seriesData5[ind] = val;
} else if (
item.equip_name == "篦冷机一室充气梁风机(左)电机"
) {
seriesData6[ind] = val;
} else if (
item.equip_name == "篦冷机一室充气梁风机(右)电机"
) {
seriesData7[ind] = val;
}
let ind = item.month_s - 1;
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option3 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
options.series[5].data = seriesData4;
options.series[6].data = seriesData4;
options.series[7].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
for (let i = 1; i < 13; i++) {
let item = i + "月";
monthXAxis.push(item);
}

View File

@ -247,6 +247,7 @@ export default {
["循环风机1906", "", "KW·h/t", "", "", ""],
["系统风机", "", "KW·h/t", "", "", ""],
],
tableData: [],
modelValue: true,
type: "hour_s",
title: "水泥磨工段",
@ -258,6 +259,7 @@ export default {
allValHour: 0,
allValDays: 0,
allValMonth: 0,
mpoints: [],
option1: {
color: colors,
tooltip: tooltip,
@ -420,148 +422,39 @@ export default {
};
},
mounted() {
//
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
let month = myDate.getMonth() + 1;
let days = myDate.getDate();
let hours = myDate.getHours();
let timeDate = myDate.getTime();
that.timeStamp = timeDate;
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
month_d = lastDate.getMonth() + 1;
days_d = lastDate.getDate();
}
//
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
this.$API.mtm.mgroup.list
.req({ page: 0, search: "水泥磨" })
.then((res) => {
console.log("水泥磨", res);
that.query.mgroup = res[0].id;
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat
.req(params2)
.then((res2) => {
if (res2.length > 0) {
let allValMonth = (that.allValMonth =
res2[0].total_production); //
params2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params2)
.then((res) => {
let data2 = res;
for (let i = 0; i < data2.length; i++) {
that.tableDatas[i] = [];
that.tableDatas[i][0] =
data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
allValMonth == 0
? "/"
: (
data2[i].val /
allValMonth
).toFixed(2);
that.tableDatas[i][5] = val;
that.tableDatas[i][6] = data2[i].mpoint;
}
debugger;
console.log(that.tableDatas);
});
}
})
.then((res2) => {
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let allValDays = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
allValDays == 0
? "/"
: (
data3[j].val /
allValDays
).toFixed(2);
that.tableDatas[j][4] = val;
}
});
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params4)
.then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val =
hourProduct == 0
? "/"
: (
data4[k].val /
hourProduct
).toFixed(2);
that.tableDatas[k][3] = val;
}
});
}
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
});
that.year = myDate.getFullYear();
that.month = myDate.getMonth() + 1;
that.days = myDate.getDate();
that.hours = myDate.getHours();
that.getMpoints();
that.getTableHourData();
that.getHourData(that.year, that.month, that.days);
that.getDayData(that.year, that.month);
that.getMonthData(that.year);
},
methods: {
getMpoints() {
let that = this;
let obj = {};
obj.mgroup__name = "水泥磨";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
console.log("mpoints", res);
let arr = [];
res.forEach((item) => {
arr.push(item.nickname);
});
console.log("arr", arr);
that.mpoints = arr;
});
},
typeRadioChange() {
this.searchDate = "";
},
@ -581,58 +474,152 @@ export default {
}
this.searchDate;
},
//
getHourData() {
getTableHourData() {
let that = this;
let query = {};
query.page = 0;
query.year_s = that.year;
query.month_s = that.month;
query.day_s = that.days;
query.type = "hour_s";
query.mgroup = that.query.mgroup;
query.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(query).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [];
that.tableDatas = [];
let timeDate = new Date().getTime();
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
let minutes = hourDate.getMinutes();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
if (hours_h > 5) {
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
} else {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
let obj = {};
obj.type = "hour_s";
obj.year = year_h;
obj.month = month_h;
obj.day = days_h;
obj.hour = hours_h;
obj.mgroup__name = "水泥磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
that.tableData = res;
console.log("getTableHourData", res);
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[4] = 0;
obj[5] = 0;
obj[6] = item.mpoint;
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
let year_h = ystDate.getFullYear();
let month_h = ystDate.getMonth() + 1;
let days_h = ystDate.getDate();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
let obj_d = {};
obj_d.type = "day_s";
obj_d.year_s = year_h;
obj_d.month_s = month_h;
obj_d.day_s = days_h;
obj_d.mgroup__name = "水泥磨";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_d = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_d]) {
that.tableDatas[index_d][3] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
obj_m.type = "month_s";
obj_m.year_s = that.year;
obj_m.month_s = that.month;
obj_m.mgroup__name = "水泥磨";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_m = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_m]) {
that.tableDatas[index_m][4] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[5] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
})
.then(() => {});
},
//
getHourData(year, month, days) {
let that = this;
let obj = {};
obj.type = "hour_s";
obj.year_s = year;
obj.month_s = month;
obj.day_s = days;
obj.mgroup__name = "水泥磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).toFixed(2);
}
if (item.equip_name == "循环风机1906") {
seriesData0[ind] = val;
} else if (item.equip_name == "系统风机") {
seriesData1[ind] = val;
} else if (item.equip_name == "水平涡流选粉机") {
seriesData2[ind] = val;
} else if (item.equip_name == "水泥磨主电机") {
seriesData3[ind] = val;
} else if (item.equip_name == "辊压机动辊电机") {
seriesData4[ind] = val;
} else if (item.equip_name == "辊压机定辊电机") {
seriesData5[ind] = val;
} else if (item.equip_name == "新增磨尾风机") {
seriesData6[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.hour; //xAxis
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option1 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
options.series[5].data = seriesData4;
options.series[6].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let hourXAxis = [];
for (let i = 0; i < 24; i++) {
let item = i + "时";
@ -643,59 +630,40 @@ export default {
});
},
//
getDayData() {
getDayData(year, month) {
let that = this;
let query1 = {};
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
query1.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [];
let obj = {};
obj.type = "day_s";
obj.year_s = year;
obj.month_s = month;
obj.mgroup__name = "水泥磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
// debugger;
let ind = item.day_s;
let val = 0;
if (that.allValDays == 0) {
val = "";
} else {
val = (item.val / that.allValDays).toFixed(2);
}
if (item.equip_name == "循环风机1906") {
seriesData0[ind] = val;
} else if (item.equip_name == "系统风机") {
seriesData1[ind] = val;
} else if (item.equip_name == "水平涡流选粉机") {
seriesData2[ind] = val;
} else if (item.equip_name == "水泥磨主电机") {
seriesData3[ind] = val;
} else if (item.equip_name == "辊压机动辊电机") {
seriesData4[ind] = val;
} else if (item.equip_name == "辊压机定辊电机") {
seriesData5[ind] = val;
} else if (item.equip_name == "新增磨尾风机") {
seriesData6[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.day_s - 1;
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
options.series[5].data = seriesData4;
options.series[6].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日";
dayXAxis.push(item);
}
@ -704,57 +672,38 @@ export default {
});
},
//
getMonthData() {
getMonthData(year) {
let that = this;
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
query2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query2).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [];
let obj = {};
obj.type = "month_s";
obj.year_s = year;
obj.mgroup__name = "水泥磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s;
let val = 0;
if (that.allValMonth == 0) {
val = "";
} else {
val = (item.val / that.allValMonth).toFixed(2);
}
if (item.equip_name == "循环风机1906") {
seriesData0[ind] = val;
} else if (item.equip_name == "系统风机") {
seriesData1[ind] = val;
} else if (item.equip_name == "水平涡流选粉机") {
seriesData2[ind] = val;
} else if (item.equip_name == "水泥磨主电机") {
seriesData3[ind] = val;
} else if (item.equip_name == "辊压机动辊电机") {
seriesData4[ind] = val;
} else if (item.equip_name == "辊压机定辊电机") {
seriesData5[ind] = val;
} else if (item.equip_name == "新增磨尾风机") {
seriesData6[ind] = val;
}
let ind = item.month_s - 1;
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option3 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
options.series[5].data = seriesData4;
options.series[6].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
for (let i = 1; i < 13; i++) {
let item = i + "月";
monthXAxis.push(item);
}

View File

@ -1,7 +1,7 @@
<template>
<el-container>
<el-main class="nopadding">
<el-card style="margin: 6px; position: relative">
<el-main id="elMain" class="nopadding">
<el-card id="logDetail" style="margin: 6px; position: relative">
<el-descriptions title="日志信息" :column="3">
<el-descriptions-item label="所属工段:">
<span>{{ form.mgroup_name }}</span>
@ -31,6 +31,7 @@
>新增异常</el-button
>
<el-tabs
ref="infoTabd"
v-model="activeName"
class="demo-tabs"
@tab-click="handleClick"
@ -129,7 +130,7 @@
row-key="id"
stripe
hideSetting
:height="300"
:height="heightTable"
highlightCurrentRow
>
<el-table-column type="index" width="50" />
@ -392,7 +393,19 @@
<el-tab-pane label="异常" name="fourth">
<el-row :gutter="20">
<el-col :span="14">
<el-table
<scTable
ref="stlogTable"
:apiObj="apiObjStlog"
:query="querystlog"
:params="querystlog"
row-key="id"
stripe
hideSetting
:height="heightTable"
@row-click="stlogRowClick"
highlightCurrentRow
>
<!-- <el-table
ref="stlogTable"
:data="stlogList"
row-key="id"
@ -400,7 +413,7 @@
@row-click="stlogRowClick"
:height="300"
highlightCurrentRow
>
> -->
<el-table-column type="index" width="50" />
<el-table-column
label="异常类别"
@ -467,15 +480,16 @@
>
</template>
</el-table-column>
</el-table>
</scTable>
</el-col>
<el-col :span="10">
<el-table
<scTable
ref="expTable"
:data="sflogexpList"
row-key="id"
stripe
:height="300"
:height="heightTable"
hidePagination
highlightCurrentRow
>
<el-table-column type="index" width="50" />
@ -529,7 +543,7 @@
>
</template>
</el-table-column>
</el-table>
</scTable>
</el-col>
</el-row>
<!-- <el-row :gutter="20" v-if="sflogExpVisiable"> -->
@ -745,6 +759,7 @@ export default {
mpoint__type: 30,
has_create_by: 1,
},
querystlog: { mgroup: "" },
sflogExpVisiable: false,
checkList: [],
stlogList: [],
@ -753,22 +768,32 @@ export default {
sflogexpList: [],
mpointOptions: [],
apiObj: null,
apiObjStlog: null,
heightTable: null,
};
},
mounted() {
this.deptId = this.$route.query.deptId;
this.mgroupId = this.$route.query.mgroupId;
this.querymplogX.mgroup = this.mgroupId;
this.querystlog.mgroup = this.mgroupId;
this.apiObj = this.$API.enm.mpoint.stat;
this.apiObjStlog = this.$API.wpm.stlog.list;
let form = this.$TOOL.data.get("sflogItem");
this.form = JSON.parse(form);
if (this.form.mgroup_name == "石灰石破碎") {
this.getMpoint();
this.getMpointStat();
}
console.log(this.form);
this.getTeam();
this.getStlog();
let height = document.getElementById("elMain").clientHeight;
let heightdetail = document.getElementById("logDetail").clientHeight;
let heightTabs = height - heightdetail - 40;
this.heightTable = heightTabs - 45 + "px";
this.$nextTick(() => {
this.$refs.infoTabd.$el.style.height = heightTabs + "px";
});
},
methods: {
handleClick(e) {

View File

@ -241,7 +241,7 @@ export default {
// ['','','KW·h/t','','',''],
// ['','','KW·h/t','','',''],
],
tableData: [],
modelValue: true,
type: "hour_s",
title: "原料磨工段",
@ -395,148 +395,43 @@ export default {
},
],
},
mpoints: [],
};
},
mounted() {
//
let that = this;
var myDate = new Date();
let year = (that.year = myDate.getFullYear());
let month = (that.month = myDate.getMonth() + 1);
let days = (that.days = myDate.getDate());
let hours = (that.hours = myDate.getHours());
let timeDate = myDate.getTime();
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
month_d = lastDate.getMonth() + 1;
days_d = lastDate.getDate();
}
//
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
this.$API.mtm.mgroup.list
.req({ page: 0, search: "原料磨" })
.then((res) => {
console.log("原料磨", res);
that.query.mgroup = res[0].id;
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat
.req(params2)
.then((res2) => {
if (res2.length > 0) {
let hourProduct = (that.allValMonth =
res2[0].total_production); //
params2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params2)
.then((res) => {
let data2 = res;
for (let i = 0; i < data2.length; i++) {
that.tableDatas[i] = [];
that.tableDatas[i][0] =
data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
hourProduct == 0
? "/"
: (
data2[i].val /
hourProduct
).toFixed(2);
that.tableDatas[i][5] = val;
that.tableDatas[i][6] = data2[i].mpoint;
}
});
}
})
.then((res2) => {
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let hourProduct = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
hourProduct == 0
? "/"
: (
data3[j].val /
hourProduct
).toFixed(2);
that.tableDatas[j][4] = val;
}
});
}
});
//
let params4 = {};
params4.page = 0;
params4.year_s = year_h;
params4.month_s = month_h;
params4.day_s = days_h;
params4.hour_s = hours_h;
params4.type = "hour_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params4)
.then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val =
hourProduct == 0
? "/"
: (
data4[k].val /
hourProduct
).toFixed(2);
that.tableDatas[k][3] = val;
}
});
}
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
});
that.year = myDate.getFullYear();
that.month = myDate.getMonth() + 1;
that.days = myDate.getDate();
that.hours = myDate.getHours();
that.getMpoints();
that.getTableHourData();
that.getHourData(that.year, that.month, that.days);
that.getDayData(that.year, that.month);
that.getMonthData(that.year);
},
methods: {
getMpoints() {
let that = this;
let obj = {};
obj.mgroup__name = "原料磨";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
console.log("mpoints", res);
let arr = [];
res.forEach((item) => {
arr.push(item.nickname);
});
console.log("arr", arr);
that.mpoints = arr;
});
},
typeRadioChange() {
this.searchDate = "";
},
@ -554,51 +449,154 @@ export default {
} else {
this.getMonthData(val);
}
this.searchDate;
},
getTableHourData() {
let that = this;
that.tableDatas = [];
let timeDate = new Date().getTime();
let hourTime = timeDate - 3600000;
let hourDate = new Date(hourTime);
let year_h = hourDate.getFullYear();
let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate();
let hours_h = hourDate.getHours();
let minutes = hourDate.getMinutes();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
if (hours_h > 5) {
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
} else {
hours_h = hours_h - 1;
hours_h = hours_h > 9 ? hours_h : "0" + hours_h;
}
let obj = {};
obj.type = "hour_s";
obj.year = year_h;
obj.month = month_h;
obj.day = days_h;
obj.hour = hours_h;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
that.tableData = res;
console.log("getTableHourData", res);
res.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname);
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[4] = 0;
obj[5] = 0;
obj[6] = item.mpoint;
that.tableDatas[index] = obj;
});
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
let year_h = ystDate.getFullYear();
let month_h = ystDate.getMonth() + 1;
let days_h = ystDate.getDate();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
let obj_d = {};
obj_d.type = "day_s";
obj_d.year_s = year_h;
obj_d.month_s = month_h;
obj_d.day_s = days_h;
obj_d.mgroup__name = "原料磨";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_d = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_d]) {
that.tableDatas[index_d][3] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let obj_m = {};
obj_m.type = "month_s";
obj_m.year_s = that.year;
obj_m.month_s = that.month;
obj_m.mgroup__name = "原料磨";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_m = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_m]) {
that.tableDatas[index_m][4] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[5] = item.elec_consume_unit;
obj[6] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
})
.then(() => {});
},
//
getHourData() {
getHourData(year, month, days) {
let that = this;
let query = {};
query.page = 0;
query.year_s = that.year;
query.month_s = that.month;
query.day_s = that.days;
query.type = "hour_s";
query.mgroup = that.query.mgroup;
query.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(query).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
let obj = {};
obj.type = "hour_s";
obj.year_s = year;
obj.month_s = month;
obj.day_s = days;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = "";
} else {
val = (item.val / that.allValHour).toFixed(2);
}
if (item.equip_name == "立磨主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "循环风机") {
seriesData1[ind] = val;
} else if (item.equip_name == "烘干破主") {
seriesData2[ind] = val;
} else if (item.equip_name == "废气风机") {
seriesData3[ind] = val;
} else if (item.equip_name == "尾排风机") {
seriesData4[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.hour; //xAxis
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option1 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let hourXAxis = [];
for (let i = 0; i < 24; i++) {
let item = i + "时";
@ -609,50 +607,40 @@ export default {
});
},
//
getDayData() {
getDayData(year, month) {
let that = this;
let query1 = {};
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
query1.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
let obj = {};
obj.type = "day_s";
obj.year_s = year;
obj.month_s = month;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.day_s;
let val = 0;
if (that.allValDays == 0) {
val = "";
} else {
val = (item.val / that.allValDays).toFixed(2);
}
if (item.equip_name == "立磨主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "循环风机") {
seriesData1[ind] = val;
} else if (item.equip_name == "烘干破主") {
seriesData2[ind] = val;
} else if (item.equip_name == "废气风机") {
seriesData3[ind] = val;
} else if (item.equip_name == "尾排风机") {
seriesData4[ind] = val;
}
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.day_s - 1;
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日";
dayXAxis.push(item);
}
@ -661,49 +649,38 @@ export default {
});
},
//
getMonthData() {
getMonthData(year) {
let that = this;
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
query2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query2).then((response) => {
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
let obj = {};
obj.type = "month_s";
obj.year_s = year;
obj.mgroup__name = "原料磨";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s;
let val = 0;
if (that.allValMonth == 0) {
val = "";
} else {
val = (item.val / that.allValMonth).toFixed(2);
}
if (item.equip_name == "立磨主电机") {
seriesData0[ind] = val;
} else if (item.equip_name == "循环风机") {
seriesData1[ind] = val;
} else if (item.equip_name == "烘干破主") {
seriesData2[ind] = val;
} else if (item.equip_name == "废气风机") {
seriesData3[ind] = val;
} else if (item.equip_name == "尾排风机") {
seriesData4[ind] = val;
}
let ind = item.month_s - 1;
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option3 };
options.series[0].data = seriesData0;
options.series[1].data = seriesData1;
options.series[2].data = seriesData2;
options.series[3].data = seriesData3;
options.series[4].data = seriesData4;
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
for (let i = 1; i < 13; i++) {
let item = i + "月";
monthXAxis.push(item);
}

View File

@ -189,18 +189,21 @@ export default {
exportLoading: false,
chartShow: false,
myOption: null,
timeStamp: null,
optionDay: {},
optionMonth: {},
year: 2023,
month: 1,
days: 1,
query: {
mgroup: "",
},
mpoint: "",
tableName: "主要设备100KW以上单位产品电耗数据表",
tableDatas: [["烘干破主电机", "", "kw.h/t", "", "", ""]],
tableData: [],
modelValue: true,
type: "hour_s",
type: "day_s",
title: "电石渣工段",
cate: "",
apiObj: this.$API.enm.mpoint.stat,
@ -209,7 +212,7 @@ export default {
asynDialog: false,
allValDays: 0,
allValMonth: 0,
option1: {
option2: {
color: colors,
tooltip: tooltip,
grid: grid,
@ -230,7 +233,7 @@ export default {
data: [],
},
},
option2: {
option3: {
color: colors,
tooltip: tooltip,
grid: grid,
@ -264,156 +267,176 @@ export default {
data: [],
},
},
mpoints: [],
};
},
mounted() {
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
let month = myDate.getMonth() + 1;
let days = myDate.getDate();
let hours = myDate.getHours();
let timeDate = myDate.getTime();
this.timeStamp = timeDate;
this.year = year;
this.month = month;
this.days = days;
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
month_d = lastDate.getMonth() + 1;
days_d = lastDate.getDate();
}
this.$API.mtm.mgroup.list
.req({ page: 0, search: "电石渣" })
.then((res) => {
console.log("电石渣", res);
that.query.mgroup = res[0].id;
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat
.req(params2)
.then((res2) => {
if (res2.length > 0) {
let allValMonth = (that.allValMonth =
res2[0].total_production); //
params2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params2)
.then((res) => {
let data2 = res;
for (let i = 0; i < data2.length; i++) {
that.tableDatas[i] = [];
that.tableDatas[i][0] =
data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
allValMonth == 0
? "/"
: (
data2[i].val /
allValMonth
).toFixed(2);
that.tableDatas[i][4] = val;
that.tableDatas[i][5] = data2[i].mpoint;
}
});
}
})
.then((res2) => {
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let allValDays = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
allValDays == 0
? "/"
: (
data3[j].val /
allValDays
).toFixed(2);
that.tableDatas[j][3] = val;
}
});
}
});
});
that.getDayData();
that.getMonthData();
that.year = myDate.getFullYear();
that.month = myDate.getMonth() + 1;
that.days = myDate.getDate();
that.getMpoints();
that.getTableHourData();
that.getDayData(that.year, that.month);
that.getMonthData(that.year);
let obj = {};
obj.mgroup__name = "电石渣";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
console.log("mpoints", res);
let arr = [];
res.forEach((item) => {
arr.push(item.nickname);
});
console.log("arr", arr);
that.mpoints = arr;
});
},
methods: {
getMpoints() {
let that = this;
let obj = {};
obj.mgroup__name = "电石渣";
obj.page = 0;
obj.enabled = 1;
obj.need_display = 1;
obj.ordering = "report_sortstr";
obj.material__code__in = "elec,elec_0";
this.$API.enm.mpoint.list.req(obj).then((res) => {
console.log("mpoints", res);
let arr = [];
res.forEach((item) => {
arr.push(item.nickname);
});
console.log("arr", arr);
that.mpoints = arr;
});
},
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (this.typeRadio == "month") {
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
this.searchDate;
},
//
getDayData() {
getTableHourData() {
let that = this;
let query1 = {};
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
query1.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [];
let data = response;
data.forEach((item) => {
let ind = item.day_s;
let val = 0;
if (that.allValDays == 0) {
val = "";
that.tableDatas = [];
let timeDate = new Date().getTime();
let yetTime = timeDate - 3600000 * 24;
let ystDate = new Date(yetTime);
let year_h = ystDate.getFullYear();
let month_h = ystDate.getMonth() + 1;
let days_h = ystDate.getDate();
month_h = month_h > 9 ? month_h : "0" + month_h;
days_h = days_h > 9 ? days_h : "0" + days_h;
let obj_d = {};
obj_d.type = "day_s";
obj_d.year_s = year_h;
obj_d.month_s = month_h;
obj_d.day_s = days_h;
obj_d.mgroup__name = "电石渣";
obj_d.mpoint__material__code__in = "elec,elec_0";
obj_d.mpoint__need_display = 1;
obj_d.page = 0;
this.$API.enm.mpoint.stat.req(obj_d).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_d = that.mpoints.indexOf(item.mpoint_nickname);
if (that.tableDatas[index_d]) {
that.tableDatas[index_d][3] = item.elec_consume_unit;
} else {
val = (item.val / that.allValDays).toFixed(2);
}
if (item.equip_name == "烘干破主电机") {
seriesData0[ind] = val;
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[3] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas[index_d] = obj;
}
});
let options = { ...that.option1 };
options.series.data = seriesData0;
let obj_m = {};
obj_m.type = "month_s";
obj_m.year_s = that.year;
obj_m.month_s = that.month;
obj_m.mgroup__name = "电石渣";
obj_m.mpoint__material__code__in = "elec,elec_0";
obj_m.mpoint__need_display = 1;
obj_m.page = 0;
this.$API.enm.mpoint.stat.req(obj_m).then((res) => {
console.log("getTableHourData", res);
res.forEach((item, index) => {
let index_m = that.mpoints.indexOf(
item.mpoint_nickname
);
if (that.tableDatas[index_m]) {
that.tableDatas[index_m][4] =
item.elec_consume_unit;
} else {
let obj = [];
obj[0] = item.mpoint_nickname;
obj[1] = item.ep_monitored_number;
obj[2] = "KW·h/t";
obj[4] = item.elec_consume_unit;
obj[5] = item.mpoint;
that.tableDatas[index_m] = obj;
}
});
});
});
},
//
getDayData(year, month) {
let that = this;
let obj = {};
obj.type = "day_s";
obj.year_s = year;
obj.month_s = month;
obj.mgroup__name = "电石渣";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
let ind = item.day_s - 1;
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日";
dayXAxis.push(item);
}
@ -422,31 +445,42 @@ export default {
});
},
//
getMonthData() {
getMonthData(year) {
let that = this;
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
query2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query2).then((response) => {
let seriesData0 = [];
let obj = {};
obj.type = "month_s";
obj.year_s = year;
obj.mgroup__name = "电石渣";
obj.mpoint__material__code__in = "elec,elec_0";
obj.mpoint__ep_monitored__isnull = 0;
obj.mpoint__need_display = 1;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((response) => {
let seriesData = [];
for (let i = 0; i < that.mpoints.length; i++) {
seriesData.push([]);
}
let data = response;
data.forEach((item) => {
let ind = item.month_s;
let val = 0;
if (that.allValMonth == 0) {
val = "";
} else {
val = (item.val / that.allValMonth).toFixed(2);
}
if (item.equip_name == "烘干破主电机") {
seriesData0[ind] = val;
}
let ind = item.month_s - 1;
let index = that.mpoints.indexOf(item.mpoint_nickname); //mpoint
seriesData[index][ind] = item.elec_consume_unit;
});
let options = { ...that.option2 };
options.series.data = seriesData0;
let options = { ...that.option3 };
for (let j = 0; j < that.mpoints.length; j++) {
let chartItem = {};
chartItem.name = that.mpoints[j];
chartItem.type = "bar";
chartItem.data = seriesData[j];
options.series.push(chartItem);
}
options.legend.data = that.mpoints;
let monthXAxis = [];
for (let i = 1; i < 13; i++) {
let item = i + "月";
monthXAxis.push(item);
}
options.xAxis.data = monthXAxis;
that.optionMonth = options;
});
},

View File

@ -30,6 +30,7 @@
row-key="id"
:params="query"
hidePagination
@row-click="rowClick"
>
<el-table-column
label="#"
@ -94,7 +95,7 @@
<el-button
link
size="small"
@click="table_equip(scope.row)"
@click.stop="table_equip(scope.row)"
v-auth="'drain.update'"
type="primary"
>设备</el-button
@ -103,26 +104,20 @@
<el-button
link
size="small"
@click="table_edit(scope.row)"
@click.stop="table_edit(scope.row)"
v-auth="'drain.update'"
type="primary"
>编辑</el-button
>
<el-divider direction="vertical"></el-divider>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row, scope.$index)"
<el-button
link
size="small"
@click.stop="table_del(scope.row)"
v-auth="'drain.update'"
type="danger"
>删除</el-button
>
<template #reference>
<el-button
link
size="small"
v-auth="'drain.delete'"
type="danger"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
@ -183,6 +178,15 @@
</el-main>
</el-container>
</el-drawer>
<el-drawer
title="排放口及关联设备信息"
v-model="visibleEquipDetail"
:size="'90%'"
destroy-on-close
@closed="visibleEquipDetail = false"
>
<detail-drawer :detailItem="detailItem"></detail-drawer>
</el-drawer>
<el-dialog title="排放口设备" v-model="visible">
<el-main style="padding: 0 20px 20px 20px">
<el-form
@ -233,12 +237,14 @@
</el-dialog>
</template>
<script>
import detailDrawer from "./pfk_detail.vue";
import saveDialog from "./pfk_form.vue";
import { drainTypeEnum } from "@/utils/enum.js";
export default {
name: "dept",
components: {
saveDialog,
detailDrawer,
},
data() {
return {
@ -265,6 +271,7 @@ export default {
visible: false,
options: [],
visibleEquip: false,
visibleEquipDetail: false,
};
},
mounted() {
@ -294,14 +301,18 @@ export default {
},
//
async table_del(row) {
var id = row.id;
var res = await this.$API.enp.drain.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.enp.drain.delete.req(row.id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
});
});
},
//
handleQuery() {
@ -357,6 +368,11 @@ export default {
}
});
},
rowClick(row) {
console.log(row);
this.detailItem = row;
this.visibleEquipDetail = true;
},
},
};
</script>

View File

@ -0,0 +1,709 @@
<template>
<el-container>
<el-aside style="width: 35%">
<el-container>
<!-- <el-header style="height: 3vh">
<div class="pageTitle">排放口及关联设备静态信息</div>
</el-header> -->
<el-main>
<div>
<div class="pageTitle">排放口及关联设备静态信息</div>
<div class="typeLine">
<div class="greenBlock">
<div class="greenBlockInner"></div>
</div>
<span>生产设备</span>
</div>
<div class="infoLine">
<span
:class="[
eqs.state == 10
? 'greenCircle'
: 'redCircle',
'circles',
]"
></span>
<span>{{ eqs.name }}</span>
</div>
<el-row class="infoLine">
<el-col :span="12">
<div>
<span class="infotitle">设备类型</span
>主要生产设备
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">电机功率</span>
<span v-if="eqs.power_kw"
>{{ eqs.power_kw }}kw</span
>
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">生产能力</span>
<span
v-if="
eqs.parameter_json &&
eqs.parameter_json.生产能力
"
>{{ eqs.parameter_json.生产能力 }}</span
>
</div>
</el-col>
</el-row>
<div class="typeLine">
<div class="greenBlock">
<div class="greenBlockInner"></div>
</div>
<span>治理设备</span>
</div>
<div class="infoLine">
<span
:class="[
eqz.state == 10
? 'greenCircle'
: 'redCircle',
'circles',
]"
></span>
<span>{{ eqz.name }}</span>
</div>
<el-row class="infoLine">
<el-col :span="12">
<div>
<span class="infotitle">风量</span>
<span
v-if="
eqz.parameter_json &&
eqz.parameter_json.风量
"
>{{ eqz.parameter_json.风量 }}/h</span
>
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">过滤面积</span>
<span
v-if="
eqz.parameter_json &&
eqz.parameter_json.过滤面积
"
>{{
eqz.parameter_json.过滤面积
}}
</span
>
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">布袋材质</span>
<span
v-if="
eqz.parameter_json &&
eqz.parameter_json.布袋材质
"
>{{ eqz.parameter_json.布袋材质 }}
</span>
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">过滤风速</span>
<span
v-if="
eqz.parameter_json &&
eqz.parameter_json.过滤风速
"
>{{
eqz.parameter_json.过滤风速
}} </span
>m/min
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">额定功率</span>
<span
v-if="
eqz.parameter_json &&
eqz.parameter_json.额定功率
"
>{{ eqz.parameter_json.额定功率 }}
</span>
Kw
</div>
</el-col>
</el-row>
<div class="typeLine">
<div class="greenBlock">
<div class="greenBlockInner"></div>
</div>
<span>排放口</span>
</div>
<div class="infoLine">
<span
:class="[
detailItem.state == 10
? 'greenCircle'
: 'redCircle',
'circles',
]"
></span>
<span>{{ detailItem.name }}</span>
</div>
<el-row class="infoLine">
<el-col :span="12">
<div>
<span class="infotitle">排气筒高度</span
>{{ detailItem.height }} m
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">废气处理量</span>
{{ detailItem.treatment_capacity }} /h
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle"
>PM超低排放限值
</span>
{{ detailItem.pm_limit }} mg/Nm³
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">治理措施 </span
>{{ detailItem.measure }}
</div>
</el-col>
</el-row>
<div class="typeLine">
<div class="greenBlock">
<div class="greenBlockInner"></div>
</div>
<span>监测设备</span>
</div>
<div class="infoLine">
<span
:class="[
eqc.state == 10
? 'greenCircle'
: 'redCircle',
'circles',
]"
></span>
<span>{{ eqc.name }}</span>
</div>
<el-row class="infoLine">
<el-col :span="24">
<div>
<span class="infotitle"
>颗粒物实测值</span
>0.218 mg/
<span class="infotitle">折算值</span
>0.208 mg/
</div>
</el-col>
<el-col :span="24">
<div>
<span class="infotitle"
>SO2实测值</span
>1.018 mg/
<span class="infotitle">折算值</span
>1.118 mg/
</div>
</el-col>
<el-col :span="24">
<div>
<span class="infotitle"
>NOX实测值</span
>1.523 mg/
<span class="infotitle">折算值</span
>1.503 mg/
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">流量</span>
0.000 /h
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">温度</span>
0.000
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">湿度</span>
0.000 %
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">压力</span>
0.000 MPa
</div>
</el-col>
<el-col :span="12">
<div>
<span class="infotitle">含氧量</span>
0.000 %
</div>
</el-col>
</el-row>
</div>
</el-main>
</el-container>
</el-aside>
<el-main style="padding: 0">
<el-container>
<!-- <el-header style="height: 3vh">
<div class="pageTitle">排放口及关联设备动态信息</div>
</el-header> -->
<el-main>
<div class="pageTitle">排放口及关联设备动态信息</div>
<div
id="dataChart"
style="
width: 100%;
height: 35vh;
margin-top: 4px;
padding: 4px;
"
></div>
<div style="height: 4px"></div>
<div
id="dataChart2"
style="width: 100%; height: 25vh; padding: 4px"
></div>
<div style="height: 4px"></div>
<div
id="dataChart3"
style="width: 100%; height: 25vh; padding: 4px"
></div>
</el-main>
</el-container>
</el-main>
</el-container>
</template>
<script>
import * as echarts from "echarts";
export default {
props: {
detailItem: {
type: Boolean,
default: () => {
return false;
},
},
},
data() {
return {
count: 0,
apiObj: this.$API.enp.drain.list,
params: { type: 10 },
options: [
{ value: "10", label: "主要排放口" },
{ value: "20", label: "一般排放口" },
],
query: {
search: "",
},
searchInputStyle: {
color: "#fff",
},
level_: {
10: "主要排放口",
20: "一般排放口",
},
pfkdetail: false,
detailForm: {
day: 18,
year: 2024,
month: 1,
},
biquery: {
end_time: "2024-02-01",
start_time: "2024-01-29",
time_bucket: "1 minute",
equipment_id: "",
},
// 3508113475543248896
basicOption: {
title: {
text: "设备名称",
left: 0,
top: "top",
textStyle: {
// color: "#fff",
},
},
legend: {
top: "8%",
textStyle: {
// color: "#fff",
},
},
tooltip: {
trigger: "axis",
confine: true,
textStyle: {
fontSize: 10,
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
dataZoom: [
{
type: "inside",
start: 0,
end: 20,
},
{
start: 0,
end: 20,
},
],
dataset: {
source: [],
},
xAxis: { type: "category" },
yAxis: {},
series: [{ type: "line" }],
},
eqs: {},
eqc: {},
eqz: {},
};
},
mounted() {
let that = this;
that.getEquipments(that.detailItem.equipments);
},
methods: {
initTimeNow() {
var now = new Date();
let year = now.getFullYear(); //
let month = now.getMonth() + 1; //
let day = now.getDate(); //
this.detailForm.year = year;
this.detailForm.month = month;
this.detailForm.day = day;
},
getEquipments(ids) {
let that = this;
let reqs = [];
ids.forEach((id) => {
reqs.push(
that.$API.em.equipment.item.req(id).then((res) => {
if (res.type == 10) {
that.eqs = res;
} else if (res.type == 40) {
that.biquery.equipment_id = id;
that.eqc = res;
console.log("that.eqc", res);
} else if (res.type == 30) {
that.eqz = res;
}
})
);
});
const promise = Promise.all(reqs);
promise.then(() => {
this.getDetailData();
this.getTSPData();
});
},
getDetailData() {
var now = new Date();
var start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24);
var that = this;
var chartDom = document.getElementById("dataChart");
var chartDom2 = document.getElementById("dataChart2");
var chartDom3 = document.getElementById("dataChart3");
var myChart = echarts.init(chartDom);
var myChart2 = echarts.init(chartDom2);
var myChart3 = echarts.init(chartDom3);
echarts.connect([myChart, myChart2, myChart3]);
let params = {
query: that.biquery,
// raise_exception: true
};
params.query["start_time"] = this.$TOOL.dateFormat(
start,
"yyyy-MM-dd hh:mm:00"
);
params.query["end_time"] = this.$TOOL.dateFormat(
now,
"yyyy-MM-dd hh:mm:00"
);
console.log(this.eqc);
// params.query['equipment_id'] = this.eqc.id
myChart.showLoading();
myChart2.showLoading();
this.$API.bi.dataset.exec
.req("enp_edata2", params)
.then((res) => {
let newOption = Object.assign({}, this.basicOption);
newOption.series = [
{
type: "line",
encode: {
y: "颗粒物折算值",
seriesName: ["颗粒物折算值"],
},
},
{
type: "line",
encode: {
y: "so2折算值",
seriesName: ["so2折算值"],
},
},
{
type: "line",
encode: {
y: "nox折算值",
seriesName: ["nox折算值"],
},
},
{
type: "line",
encode: { y: "温度", seriesName: ["温度"] },
},
{
type: "line",
encode: { y: "压力", seriesName: ["压力"] },
},
{
type: "line",
encode: { y: "流速", seriesName: ["流速"] },
},
{
type: "line",
encode: { y: "湿度", seriesName: ["湿度"] },
},
{
type: "line",
encode: { y: "流量", seriesName: ["流量"] },
},
];
newOption.dataset.source = res.data.ds0;
newOption.dataZoom.startValue = that.biquery.start_time;
newOption.title.text = that.eqc.name;
myChart.hideLoading();
myChart.setOption(newOption);
// myChart2.setOption(newOption);
// echarts.connect([myChart, myChart2])
})
.then(() => {
params["equipment_id"] = this.eqs.id;
that.$API.bi.dataset.exec
.req("enp_eq_rs", params)
.then((res2) => {
let newOption2 = Object.assign(
{},
this.basicOption
);
newOption2.yAxis.minInterval = 1;
newOption2.dataset.source = res2.data.ds0;
newOption2.dataZoom.startValue =
that.biquery.start_time;
newOption2.title.text = that.eqs.name;
myChart2.setOption(newOption2);
myChart2.hideLoading();
});
})
.then(() => {
params["equipment_id"] = this.eqz.id;
that.$API.bi.dataset.exec
.req("enp_eq_rs", params)
.then((res3) => {
let newOption3 = Object.assign(
{},
this.basicOption
);
newOption3.yAxis.minInterval = 1;
newOption3.dataset.source = res3.data.ds0;
newOption3.dataZoom.startValue =
that.biquery.start_time;
newOption3.title.text = that.eqz.name;
myChart3.setOption(newOption3);
myChart3.hideLoading();
});
});
},
getTSPData() {
let that = this;
let now = new Date();
let start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24);
let params = {
query: that.biquery,
};
params.query["time_bucket"] = "1 day";
params.query["start_time"] = this.$TOOL.dateFormat(
start,
"yyyy-MM-dd hh:mm:00"
);
params.query["end_time"] = this.$TOOL.dateFormat(
now,
"yyyy-MM-dd hh:mm:00"
);
this.$API.bi.dataset.exec.req("enp_edata2", params).then((res) => {
console.log("enp_edata2", res);
that.eqc = res;
});
},
},
};
</script>
<style>
.tableBg {
width: 100%;
height: 88vh;
background-image: url("/public/img/enp_blue/bigtableBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.leftCard {
height: 80vh;
flex: 1;
color: #ffffff;
font-size: 0.75vw;
background-image: url("/public/img/enp_blue/smallTableBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
margin-right: 1vw;
}
.rightCard {
flex: 2;
height: 80vh;
color: #ffffff;
background-image: url("/public/img/enp_blue/tableBg.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.totalWrap {
display: flex;
justify-content: space-between;
color: #ffffff;
font-size: 1.6vh;
padding: 0 0.5vw;
height: 3vh;
line-height: 3vh;
}
.totalNumber {
color: #64d2ff;
font-size: 2vh;
font-weight: bold;
}
.searchBtn {
width: 4.7vw;
height: 3vh;
background-size: 100% 100%;
background-image: url("/public/img/enp_blue/search.png");
}
.backMap {
height: 25px;
line-height: 25px;
position: absolute;
right: 1vw;
top: 15px;
font-size: 1vh;
width: -moz-fit-content;
width: fit-content;
color: #ffffff;
padding: 0 0.5vw;
background-image: url("/public/img/enp_blue/back.png");
}
.pageTitle {
height: 2vh;
line-height: 2vh;
/* color: #ffffff; */
font-size: 1.5vh;
padding-left: 1vw;
}
/* */
.headerTitle {
color: #ffffff;
height: 4vh;
line-height: 4vh;
font-size: 2vh;
position: relative;
}
.greenBlock {
width: 1vh;
height: 1vh;
background-image: url("/public/img/enp_blue/greenBlock.png");
background-size: 100% 100%;
display: inline-block;
vertical-align: middle;
margin-right: 0.5vw;
}
.circles {
width: 10px;
height: 10px;
border-radius: 5px;
background: #aaaaaa;
display: inline-block;
margin: auto 0.5vw auto 0;
}
.greenCircle {
background: #0ed877;
}
.redCircle {
background: orange;
}
.linesWrap {
padding: 1vh 0.5vw;
height: 93%;
overflow: scroll;
font-weight: bold;
line-height: 3.5vh;
}
.typeLine {
height: 3.5vh;
line-height: 4vh;
font-weight: bold;
font-size: 1.3vh;
}
.infoLine {
line-height: 3vh;
padding-left: 0.5vw;
display: flex;
font-size: 1.2vh;
}
.infotitle {
font-weight: normal;
color: #333333;
}
</style>

View File

@ -240,7 +240,7 @@ export default {
},
getOrderOptions() {
this.$API.sam.order.list
.req({ page: 0, type__in: "20,30" })
.req({ page: 0, state__in: "20,30" })
.then((res) => {
this.orderOptions = res;
});

View File

@ -31,7 +31,7 @@
<el-descriptions-item
label="采购订单"
v-if="mioObj.type == 'pur_in'"
>{{ mioObj.order_number }}</el-descriptions-item
>{{ mioObj.pu_order_number }}</el-descriptions-item
>
<el-descriptions-item
label="供应商"
@ -41,7 +41,7 @@
<el-descriptions-item
label="销售订单"
v-if="mioObj.type == 'sale_out'"
>{{ mioObj.pu_order_number }}</el-descriptions-item
>{{ mioObj.order_number }}</el-descriptions-item
>
<el-descriptions-item
label="客户"

View File

@ -46,11 +46,11 @@
prop="cate"
min-width="150"
></el-table-column>
<el-table-column
<!-- <el-table-column
label="车间"
prop="belong_dept_name"
min-width="60"
></el-table-column>
></el-table-column> -->
<el-table-column label="交接到工段" min-width="60">
<template #default="scope">
<el-icon v-if="scope.row.into_wm_mgroup" color="green">
@ -58,6 +58,13 @@
</el-icon>
</template>
</el-table-column>
<el-table-column label="不合格品是否入库" min-width="60">
<template #default="scope">
<el-icon v-if="scope.row.store_notok" color="green">
<CircleCheckFilled />
</el-icon>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"

View File

@ -156,6 +156,11 @@
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="绑定工序">
<el-switch v-model="form.batch_bind" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
@ -174,6 +179,7 @@ const defaultForm = {
process: null,
sort: 1,
out_rate: 100,
batch_bind: true,
is_autotask: true,
is_count_utask: false,
};

View File

@ -128,7 +128,7 @@
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
@closed="saveClose"
>
</save-dialog>
<show-dialog
@ -219,7 +219,10 @@ export default {
this.$refs.showDialog.open().setData(row);
});
},
saveClose() {
this.$refs.table.refresh();
this.dialog.save = false;
},
//
permission() {
this.dialog.permission = true;
@ -229,7 +232,7 @@ export default {
},
//
async table_del(row) {
this.$API.rpm.rpj.delete
this.$API.mtm.routepack.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功");

View File

@ -48,11 +48,12 @@
<el-select
v-model="form.material"
style="width: 100%"
filterable
>
<el-option
v-for="item in materials"
:key="item.id"
:label="item.name"
:label="item.full_name"
:value="item.id"
/>
</el-select>
@ -311,10 +312,8 @@ export default {
.then((res) => {
that.tLoading = false;
that.$message.success("提交成功");
that.$router.push({
name: "",
query: {},
});
that.$emit("close");
that.visible = false;
})
.catch((e) => {
that.tLoading = false;

View File

@ -1,121 +1,175 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'supplier.create'">新增</el-button>
</div>
<div class="right-panel">
<el-input v-model="query.search" placeholder="名称" clearable style="margin-right: 5px;"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query">
<el-table-column type="index" width="50" />
<el-table-column label="供应商名称" prop="name" show-overflow-tooltip>
</el-table-column>
<el-table-column label="联系人" prop="contact">
</el-table-column>
<el-table-column label="联系方式" prop="contact_phone">
</el-table-column>
<el-table-column label="地址" prop="address" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="120px">
<template #default="scope">
<el-button link type="primary" @click="table_edit(scope.row)" v-auth="'supplier.update'">
编辑
</el-button>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row)" v-auth="'supplier.delete'">
<template #reference>
<el-button link type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="add"
v-auth="'supplier.create'"
>新增</el-button
>
</div>
<div class="right-panel">
<el-input
v-model="query.search"
placeholder="名称"
clearable
style="margin-right: 5px"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query"
>
<el-table-column type="index" width="50" />
<el-table-column
label="供应商名称"
prop="name"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="联系人" prop="contact">
</el-table-column>
<el-table-column label="联系方式" prop="contact_phone">
</el-table-column>
<el-table-column
label="地址"
prop="address"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="是否外协" prop="can_outsource">
<template #default="scope">
<el-tag v-if="scope.row.can_outsource" type="success"
></el-tag
>
<el-tag v-else type="waring"></el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120px"
>
<template #default="scope">
<el-button
link
type="primary"
@click="table_edit(scope.row)"
v-auth="'supplier.update'"
>
编辑
</el-button>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row)"
v-auth="'supplier.delete'"
>
<template #reference>
<el-button link type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</template>
<script>
import saveDialog from "./supplier_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
apiObj: this.$API.pum.supplier.list,
query: {
page: 1,
page_size: 20,
type: 10
},
selection: [],
state_: {
10: '完好',
20: '限用',
30: '在修',
40: '禁用',
},
};
},
methods: {
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$API.pum.supplier.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
})
.catch((err) => {
return err;
});
},
name: "rparty",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
apiObj: this.$API.pum.supplier.list,
query: {
page: 1,
page_size: 20,
type: 10,
},
selection: [],
state_: {
10: "完好",
20: "限用",
30: "在修",
40: "禁用",
},
};
},
methods: {
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$API.pum.supplier.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
})
.catch((err) => {
return err;
});
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
},
};
</script>
</script>

View File

@ -49,6 +49,12 @@
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="是否外协">
<el-switch v-model="form.can_outsource">
</el-switch>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>

View File

@ -1,98 +1,155 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
</div>
<div class="right-panel">
<el-date-picker v-model="query.test_date" type="date" placeholder="选择日期" value-format="YYYY-MM-DD" />
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="params" :query="query">
<el-table-column type="index" width="50" />
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip min-width="100">
</el-table-column>
<el-table-column label="编号" prop="batch" show-overflow-tooltip min-width="100">
</el-table-column>
<el-table-column label="抽样数量" prop="count">
</el-table-column>
<el-table-column label="合格数">
<template #default="scope">
{{ scope.row.count - scope.row.count_notok }}
</template>
</el-table-column>
<el-table-column label="不合格数" prop="count_notok">
</el-table-column>
<el-table-column label="不合格原因" align="center">
<el-table-column label="炸纹" prop="count_n_zw">
</el-table-column>
<el-table-column label="条纹" prop="count_n_tw">
</el-table-column>
<el-table-column label="气泡" prop="count_n_qp">
</el-table-column>
<el-table-column label="弯曲" prop="count_n_wq">
</el-table-column>
<el-table-column label="断裂" prop="count_n_dl">
</el-table-column>
<el-table-column label="偏壁" prop="count_n_pb">
</el-table-column>
<el-table-column label="大小头" prop="count_n_dxt">
</el-table-column>
<el-table-column label="气线" prop="count_n_qx">
</el-table-column>
<el-table-column label="结石" prop="count_n_js">
</el-table-column>
<el-table-column label="其他" prop="count_n_qt">
</el-table-column>
</el-table-column>
<el-table-column label="检测结果" prop="is_testok">
<template #default="scope">
<el-tag type="success" v-if="scope.row.is_testok">合格</el-tag>
<el-tag type="danger" v-else>不合格</el-tag>
</template>
</el-table-column>
<el-table-column label="检测时间" prop="test_date">
</el-table-column>
<el-table-column label="检测人" prop="test_user_name">
</el-table-column>
</scTable>
</el-main>
</el-container>
<el-container>
<el-header>
<div class="left-panel"></div>
<div class="right-panel">
<el-date-picker
v-model="query.test_date"
type="date"
placeholder="选择日期"
value-format="YYYY-MM-DD"
/>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
>查询</el-button
>
<el-button
type="primary"
icon="el-icon-download"
@click="tableExport"
v-loading="exportLoading"
>导出</el-button
>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
id="myTable"
:params="params"
:query="query"
>
<el-table-column type="index" width="50" />
<el-table-column
label="物料名称"
prop="material_name"
show-overflow-tooltip
min-width="100"
>
</el-table-column>
<el-table-column
label="编号"
prop="batch"
show-overflow-tooltip
min-width="100"
>
<template #default="scope">
{{ scope.row.batch }}
</template>
</el-table-column>
<el-table-column label="抽样数量" prop="count">
</el-table-column>
<el-table-column label="合格数">
<template #default="scope">
{{ scope.row.count - scope.row.count_notok }}
</template>
</el-table-column>
<el-table-column label="不合格数" prop="count_notok">
</el-table-column>
<el-table-column label="不合格原因" align="center">
<el-table-column label="炸纹" prop="count_n_zw">
</el-table-column>
<el-table-column label="条纹" prop="count_n_tw">
</el-table-column>
<el-table-column label="气泡" prop="count_n_qp">
</el-table-column>
<el-table-column label="弯曲" prop="count_n_wq">
</el-table-column>
<el-table-column label="断裂" prop="count_n_dl">
</el-table-column>
<el-table-column label="偏壁" prop="count_n_pb">
</el-table-column>
<el-table-column label="大小头" prop="count_n_dxt">
</el-table-column>
<el-table-column label="气线" prop="count_n_qx">
</el-table-column>
<el-table-column label="结石" prop="count_n_js">
</el-table-column>
<el-table-column label="杂质" prop="count_n_zz">
</el-table-column>
<el-table-column label="颜色青" prop="count_n_ysq">
</el-table-column>
<el-table-column label="划伤" prop="count_n_hs">
</el-table-column>
<el-table-column label="扁" prop="count_n_b">
</el-table-column>
<el-table-column label="其他" prop="count_n_qt">
</el-table-column>
</el-table-column>
<el-table-column label="检测结果" prop="is_testok">
<template #default="scope">
<el-tag type="success" v-if="scope.row.is_testok"
>合格</el-tag
>
<el-tag type="danger" v-else>不合格</el-tag>
</template>
</el-table-column>
<el-table-column label="检测时间" prop="test_date">
</el-table-column>
<el-table-column label="检测人" prop="test_user_name">
</el-table-column>
<el-table-column label="物料id">
<template #default="scope">
{{ scope.row.material }}
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
export default {
name: "rparty",
data() {
return {
apiObj: this.$API.inm.mioitem.list,
query: {
page: 1,
page_size: 20
},
params: {
page: 1,
page_size: 20,
mio__state: 20,
mio__type: 'do_in',
test_date__isnull:0
},
selection: [],
state_: {
10: '',
20: '',
},
};
},
mounted() {
},
methods: {
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
},
name: "rparty",
data() {
return {
apiObj: this.$API.inm.mioitem.list,
query: {
page: 1,
page_size: 20,
},
params: {
page: 1,
page_size: 20,
mio__state: 20,
mio__type: "do_in",
test_date__isnull: 0,
},
selection: [],
state_: {
10: "",
20: "",
},
exportLoading: false,
};
},
mounted() {},
methods: {
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
tableExport() {
this.exportLoading = true;
this.$XLSX("#myTable", "库存检验记录");
this.exportLoading = false;
},
},
};
</script>
</script>

View File

@ -52,7 +52,7 @@
>
<template #default="scope">
<span v-if="scope.row.material_">
{{ scope.row.material_.name }}</span
{{ scope.row.material_.full_name }}</span
>
</template>
</el-table-column>
@ -81,14 +81,14 @@
width="100px"
>
<template #default="scope">
<el-link
<!-- <el-link
type="primary"
@click="table_edit(scope.row)"
v-auth="'order.update'"
>
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
</el-link> -->
<!-- <el-divider direction="vertical"></el-divider> -->
<el-link
type="danger"
@click="table_del(scope.row)"
@ -186,6 +186,7 @@ export default {
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
})
.catch((err) => {

View File

@ -1,107 +1,137 @@
<template>
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="110px">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="所需产品" prop="material">
<el-select v-model="form.material" placeholder="所需产品" clearable style="width:100%">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="所需数量">
<el-input-number v-model="form.count" :precision="0" :min="1" controls-position="right" placeholder="所需数量"
style="width:100%" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="110px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="所需产品" prop="material">
<el-select
v-model="form.material"
placeholder="所需产品"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.full_name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="所需数量">
<el-input-number
v-model="form.count"
:precision="0"
:min="1"
controls-position="right"
placeholder="所需数量"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
orderId: { type: String, default: '' },
},
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增订单详情",
edit: "编辑订单详情",
show: "查看订单详情",
},
form: {},
rules: {
material: [{ required: true, message: "请选择所需产品", trigger: "blur" }],
},
visible: false,
isSaveing: false,
options: [],
setFiltersVisible: false,
};
},
mounted() {
this.getList();
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
getList() {
this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => {
this.options = res;
})
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
this.form.order = this.orderId;
try {
var res;
if (this.mode == "add") {
res = await this.$API.sam.orderitem.create.req(this.form);
} else if (this.mode == "edit") {
res = await this.$API.sam.orderitem.update.req(this.form.id, this.form);
}
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
emits: ["success", "closed"],
props: {
orderId: { type: String, default: "" },
},
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增订单详情",
edit: "编辑订单详情",
show: "查看订单详情",
},
form: {},
rules: {
material: [
{
required: true,
message: "请选择所需产品",
trigger: "blur",
},
],
},
visible: false,
isSaveing: false,
options: [],
setFiltersVisible: false,
};
},
mounted() {
this.getList();
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
getList() {
this.$API.mtm.material.list
.req({ page: 0, type: 10 })
.then((res) => {
this.options = res;
});
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
this.form.order = this.orderId;
this.$API.sam.orderitem.create
.req(this.form)
.then((res) => {
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
});
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -78,16 +78,12 @@
</el-table-column>
</el-table-column>
<el-table-column label="8号">
<!-- 仓库库存加车间未退火数 -->
<el-table-column
label="仓库库存"
label="库存"
prop="仓库库存"
>
</el-table-column>
<el-table-column
label="未退火"
prop="未退火"
>
</el-table-column>
<el-table-column label="退火" prop="退火">
</el-table-column>
</el-table-column>
@ -287,7 +283,6 @@ export default {
规格: "",
合格数: 0,
仓库库存: 0,
未退火: 0,
退火: 0,
库存: 0,
开槽: 0,
@ -311,7 +306,7 @@ export default {
item5.车间 == "8车间" &&
item5.工序 == "管料成型"
) {
key = "未退火";
key = "仓库库存";
} else if (
item5.车间 == "8车间" &&
item5.工序 == "管料退火"
@ -338,12 +333,11 @@ export default {
) {
key = "配棒";
}
obj[key] = item5.数量;
obj[key] = obj[key] + item5.数量;
});
obj.合计 =
obj.合格数 +
obj.仓库库存 +
obj.未退火 +
obj.退火 +
obj.库存 +
obj.开槽 +

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "超洗",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

273
src/views/wpm_gx/chart.vue Normal file
View File

@ -0,0 +1,273 @@
<template>
<el-main>
<el-card>
<div id="main" style="width: 1000px; height: 600px"></div>
<div
id="mains"
style="
width: 1000px;
height: 600px;
position: absolute;
top: 185px;
"
></div>
</el-card>
</el-main>
</template>
<script>
import * as echarts from "echarts";
const updateFrequency = 2000;
const dimension = 0;
const countryColors = {
低碳水泥碳减排: "rgb(244,192,0)",
替代燃料碳减排: "rgb(242,119,36)",
清洁能源电力碳减排: "rgb(103,169,59)",
能效提升技术碳减排: "rgb(77,148,211)",
CCUS碳减排: "rgb(159,159,159)",
};
const years = [2021, 2025, 2030, 2040, 2050, 2060];
export default {
name: "chart",
data() {
return {};
},
mounted() {
//
var chartDom = document.getElementById("main");
var myChart = echarts.init(chartDom);
var option;
let startIndex = 0;
let data = [
["Income", "Life Expectancy", "Population", "Country", "Year"],
[0, 34.05, 0, "低碳水泥碳减排", 2021],
[0, 39, 0, "替代燃料碳减排", 2021],
[0, 32, 0, "清洁能源电力碳减排", 2021],
[0, 32.2, 0, "能效提升技术碳减排", 2021],
[0, 36.57, 0, "CCUS碳减排", 2021],
[6, 34.05, 6, "低碳水泥碳减排", 2025],
[14, 39, 14, "替代燃料碳减排", 2025],
[6, 32, 6, "清洁能源电力碳减排", 2025],
[8, 32.2, 8, "能效提升技术碳减排", 2025],
[3, 36.5, 4, "CCUS碳减排", 2025],
[33, 34.05, 33, "低碳水泥碳减排", 2030],
[16, 39, 26, "替代燃料碳减排", 2030],
[10, 32, 10, "清洁能源电力碳减排", 2030],
[18, 32.2, 18, "能效提升技术碳减排", 2030],
[7, 36.57, 9, "CCUS碳减排", 2030],
[118, 34.05, 78, "低碳水泥碳减排", 2040],
[68, 39, 68, "替代燃料碳减排", 2040],
[17, 32, 17, "清洁能源电力碳减排", 2040],
[18, 32.2, 18, "能效提升技术碳减排", 2040],
[14, 36.57, 19, "CCUS碳减排", 2040],
[157, 34.05, 118, "低碳水泥碳减排", 2050],
[111, 39, 111, "替代燃料碳减排", 2050],
[23, 32, 23, "清洁能源电力碳减排", 2050],
[16, 32.2, 16, "能效提升技术碳减排", 2050],
[41, 36.57, 57, "CCUS碳减排", 2050],
[196, 34.05, 118, "低碳水泥碳减排", 2060],
[177, 39, 117, "替代燃料碳减排", 2060],
[26, 32, 26, "清洁能源电力碳减排", 2060],
[16, 32.2, 16, "能效提升技术碳减排", 2060],
[184, 36.57, 254, "CCUS碳减排", 2060],
];
let startYear = years[startIndex];
option = {
grid: {
top: 50,
bottom: 30,
left: 150,
right: 80,
},
xAxis: {
max: "dataMax",
position: "top",
axisLabel: {
formatter: function (n) {
return Math.round(n) + "";
},
},
},
dataset: {
source: data.slice(1).filter(function (d) {
return d[4] === startYear;
}),
},
yAxis: {
type: "category",
inverse: true,
max: 10,
axisLabel: {
show: true,
fontSize: 14,
// formatter: function (value) {
// },
rich: {
flag: {
fontSize: 25,
padding: 5,
},
},
},
animationDuration: 300,
animationDurationUpdate: 300,
},
series: [
{
realtimeSort: true,
seriesLayoutBy: "column",
type: "bar",
itemStyle: {
color: function (param) {
return countryColors[param.value[3]] || "#5470c6";
},
},
encode: {
x: dimension,
y: 3,
},
label: {
show: true,
precision: 1,
position: "right",
valueAnimation: true,
fontFamily: "monospace",
},
},
],
animationDuration: 0,
animationDurationUpdate: updateFrequency,
animationEasing: "linear",
animationEasingUpdate: "linear",
graphic: {
elements: [
{
type: "text",
right: 160,
bottom: 60,
style: {
text: startYear,
font: "bolder 80px monospace",
fill: "rgba(100, 100, 100, 0.25)",
},
z: 100,
},
],
},
};
myChart.setOption(option);
for (let i = startIndex; i < years.length - 1; ++i) {
(function (i) {
setTimeout(function () {
updateYear(years[i + 1]);
}, (i - startIndex) * updateFrequency);
})(i);
}
function updateYear(year) {
let source = data.slice(1).filter(function (d) {
return d[4] === year;
});
option.series[0].data = source;
option.graphic.elements[0].style.text = year;
myChart.setOption(option);
}
//线
let countries = ["水泥碳排放"];
let datasetWithFilters = [];
let seriesList = [];
let _rawData = [
["Income", "Country", "Year"],
[575, "水泥碳排放", 2021],
[559, "水泥碳排放", 2025],
[523, "水泥碳排放", 2030],
[386, "水泥碳排放", 2040],
[273, "水泥碳排放", 2050],
[23, "水泥碳排放", 2060],
];
var chartDoms = document.getElementById("mains");
var myCharts = echarts.init(chartDoms);
datasetWithFilters.push({
id: "dataset_水泥碳排放",
fromDatasetId: "dataset_raw",
transform: {
type: "filter",
config: {
and: [
{ dimension: "Year", gte: 1950 },
{ dimension: "Country", "=": "水泥碳排放" },
],
},
},
});
seriesList.push({
type: "line",
datasetId: "dataset_水泥碳排放",
showSymbol: false,
name: "水泥碳排放",
endLabel: {
show: true,
formatter: function (params) {
return params.value[1] + ": " + params.value[0];
},
},
lineStyle: {
width: 5,
},
emphasis: {
focus: "series",
},
// color: "#43fb43",//绿
color: "#000000",
encode: {
x: "Year",
y: "Income",
label: ["Country", "Income"],
itemName: "Year",
tooltip: ["Income"],
},
});
let options = {
animationDuration: 10000,
dataset: [
{
id: "dataset_raw",
source: _rawData,
},
...datasetWithFilters,
],
xAxis: {
type: "category",
nameLocation: "middle",
// show: false, // 线线
axisTick: {
show: false, // 线
},
axisLine: {
show: false, // 线
},
axisLabel: {
show: false, //
},
splitLine: {
show: false, // 线
},
},
yAxis: {
position: "right",
name: "",
},
grid: {
left: 140,
},
series: seriesList,
};
myCharts.setOption(options);
},
};
</script>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "倒角",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

View File

@ -0,0 +1,284 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add(10)"
v-auth="'mgroup.create'"
>新增</el-button
>
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add(20)"
v-auth="'mgroup.create'"
>返工</el-button
>
</div>
<div class="right-panel">
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
v-if="values == '交送'"
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params_sender"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="物料"
prop="material_name"
min-width="120"
></el-table-column>
<el-table-column label="批次" prop="batch" min-width="100">
</el-table-column>
<el-table-column label="数量" prop="count"></el-table-column>
<el-table-column
label="交送人"
prop="send_user_name"
></el-table-column>
<el-table-column
label="接收人"
prop="recive_user_name"
></el-table-column>
<el-table-column
label="交接日期"
prop="send_date"
width="120"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link
size="small"
@click="table_edit(scope.row)"
v-auth="'mgroup.update'"
type="primary"
>编辑</el-button
>
<el-divider direction="vertical"></el-divider>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row, scope.$index)"
>
<template #reference>
<el-button
link
size="small"
v-auth="'mgroup.delete'"
type="danger"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
<scTable
v-if="values == '接收'"
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params_recive"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="物料"
prop="material_name"
min-width="120"
></el-table-column>
<el-table-column label="批次" prop="batch" min-width="100">
</el-table-column>
<el-table-column label="数量" prop="count"></el-table-column>
<el-table-column
label="交送人"
prop="send_user_name"
></el-table-column>
<el-table-column
label="接收人"
prop="recive_user_name"
></el-table-column>
<el-table-column
label="交接日期"
prop="send_date"
width="120"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link
size="small"
@click="table_edit(scope.row)"
v-auth="'mgroup.update'"
type="primary"
>编辑</el-button
>
<el-divider direction="vertical"></el-divider>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row, scope.$index)"
>
<template #reference>
<el-button
link
size="small"
v-auth="'mgroup.delete'"
type="danger"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:type="type"
:mgroupId="mgroupId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
</template>
<script>
import saveDialog from "./handover_form.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
name: "handover",
components: {
saveDialog,
},
data() {
return {
apiObj: null,
query: {},
dialog: {
save: false,
permission: false,
},
params_sender: { send_mgroup: "" },
params_recive: { recive_mgroup: "" },
options: ["交送", "接收"],
tableData: [],
selection: [],
values: "交送",
mtask: "",
mlogId: "",
processId: "",
processCate: "",
};
},
mounted() {
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, search: that.mgroupName })
.then((res) => {
that.mgroupId = res[0].id;
that.processId = res[0].process;
that.processCate = res[0].process_cate;
that.params_sender.send_mgroup = that.mgroupId;
that.params_recive.recive_mgroup = that.mgroupId;
that.apiObj = that.$API.wpm.handover.list;
});
},
methods: {
//
table_add(type) {
this.dialog.save = true;
this.type = type;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
async table_del(row) {
var id = row.id;
var res = await this.$API.mtm.mgroup.delete.req(id);
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped>
.treeMain {
width: 100%;
height: 280px;
overflow: auto;
border: 1px solid #dcdfe6;
margin-bottom: 10px;
}
</style>

View File

@ -0,0 +1,333 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
width="1000px"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="交接物料" prop="wm">
<el-select
v-model="form.wm"
placeholder="交接物料"
clearable
style="width: 100%"
@change="materialChange"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<span>{{ item.batch }}</span>
<span v-if="item.notok_sign !== null"
>-{{ item.notok_sign }}</span
>
<span>-[{{ item.count }}]</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="交送日期" prop="send_date">
<el-date-picker
v-model="form.send_date"
type="date"
placeholder="选择时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="交接数量" width="100">
<el-input-number
v-model="form.count"
controls-position="right"
:min="0"
step="1"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
>
</el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="交送人" prop="send_user">
<el-select
v-model="form.send_user"
placeholder="交送人"
clearable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="接收工段" prop="recive_mgroup">
<el-select
v-model="form.recive_mgroup"
placeholder="接收工段"
clearable
style="width: 100%"
>
<el-option
v-for="item in mgroupOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="接收人" prop="recive_user">
<el-select
v-model="form.recive_user"
placeholder="接收人"
clearable
style="width: 100%"
>
<el-option
v-for="item in userList2"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer>
<el-button type="primary" v-loading="isSaveing" @click="submit"
>确定</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
props: {
type: {
type: Number,
default: 10,
},
mgroupId: {
type: String,
default: "",
},
},
data() {
return {
yseorno: ["是", "否"],
loading: false,
mode: "add",
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
handle_user: [],
form: {
batch: "",
count: 0, //
wm: "",
send_date: "",
send_user: "",
send_mgroup: "",
recive_user: "",
recive_mgroup: "",
},
rules: {
batch: [
{
required: true,
message: "请输入批次号",
trigger: "blur",
},
],
wm: {
required: true,
message: "请选择物料",
trigger: "blur",
},
send_date: [
{
required: true,
message: "请选择送料日期",
trigger: "blur",
},
],
send_user: [
{
required: true,
message: "请选择交送人",
trigger: "blur",
},
],
send_mgroup: [
{
required: true,
message: "请选择交送工段",
trigger: "blur",
},
],
recive_user: [
{
required: true,
message: "请选择接收人",
trigger: "blur",
},
],
recive_mgroup: [
{
required: true,
message: "请选择接收工段",
trigger: "blur",
},
],
},
userList: [],
userList2: [],
mgroupOptions: [],
materialOptions: [],
visible: false,
isSaveing: false,
setFiltersVisible: false,
};
},
mounted() {
this.form.type = this.type;
let materialObj = this.$TOOL.data.get("MATERIAL_OBJECT");
this.materialObj = materialObj;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
this.form.handle_date = year + "-" + month + "-" + day;
this.form.send_mgroup = this.mgroupId;
this.getMaterial();
this.getUserList();
this.getMgroupOptions();
},
methods: {
//
getMgroupOptions() {
this.$API.mtm.mgroup.list
.req({ page: 0, type__in: "dept" })
.then((res) => {
this.mgroupOptions = res;
});
},
//
getMaterial() {
let that = this;
this.$API.wpm.wmaterial.list
.req({ mgroup: that.mgroupId, page: 0 })
.then((res) => {
that.materialOptions = res;
});
},
//
getUserList() {
let that = this;
this.$API.system.user.list
.req({ mgroup__name: "切片", page: 0 })
.then((res) => {
that.userList2 = res;
});
this.$API.system.user.list
.req({ mgroup__name: "活化", page: 0 })
.then((res) => {
that.userList = res;
});
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
materialChange(val) {
let data = this.materialOptions.filter((item) => {
return item.id == val;
});
this.form.batch = data[0].batch;
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
if (this.mode == "add") {
this.$API.wpm.handover.create
.req(this.form)
.then((res) => {
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
})
.catch((err) => {
//
this.isSaveing = false;
return err;
});
} else if (this.mode == "edit") {
this.$API.wpm.handover.update
.req(this.form.id, this.form)
.then((res) => {
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
})
.catch((err) => {
//
this.isSaveing = false;
return err;
});
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style scoped>
.formTitle {
margin-bottom: 10px;
font-weight: 600;
}
</style>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "黑化",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "活化",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

184
src/views/wpm_gx/inm.vue Normal file
View File

@ -0,0 +1,184 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio" v-auth="'mio.do'"
>领料</el-button
>
<el-button type="primary" @click="tomio" v-auth="'mio.do'"
>入库</el-button
>
</div>
<div class="right-panel">
<!-- <el-button type="primary" @click="materialsChoses('wm')"
>选择物料</el-button
> -->
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
hidePagination
:params="params"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="物料名称"
prop="material_name"
min-width="100"
></el-table-column>
<el-table-column
label="批次号"
prop="batch"
min-width="100"
></el-table-column>
<el-table-column
label="所属部门"
prop="belong_dept_name"
min-width="150"
></el-table-column>
<el-table-column
label="数量"
prop="count"
min-width="80"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
min-width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="180"
>
<template #default="scope">
<el-button
link
size="small"
@click="table_edit(scope.row)"
v-auth="'mgroup.update'"
type="primary"
>编辑</el-button
>
<el-divider direction="vertical"></el-divider>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row, scope.$index)"
>
<template #reference>
<el-button
link
size="small"
v-auth="'mgroup.delete'"
type="danger"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
style="height: 500px"
:materialType="materialType"
ref="materialsChose"
@choseChange="choseChange"
></materials>
</el-dialog>
</el-container>
</template>
<script>
import materials from "./../mtm/materials.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
components: {
materials,
},
name: "wmaterial",
data() {
return {
apiObj: null,
params: {
mgroupx: "",
},
query: {},
dialog: {
save: false,
permission: false,
},
tableData: [],
selection: [],
queryWm: {
search: "",
material: "",
},
materialType: "wm",
visibleDrawer: false,
};
},
mounted() {
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, search: that.mgroupName })
.then((res) => {
that.mgroupId = res[0].id;
that.params.mgroupx = res[0].id;
that.apiObj = that.$API.wpm.wmaterial.list;
});
},
methods: {
materialsChoses(str) {
this.materialType = str;
this.materialsVisible = true;
},
choseChange(data) {
this.queryWm.material = data;
this.$refs.table_wm.queryData(this.queryWm);
this.materialsVisible = false;
},
tomio() {
this.$router.push({ name: "halfgood_mio" });
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped></style>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "减薄",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "精雕",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

View File

@ -0,0 +1,432 @@
<template>
<el-drawer
title="日志详情"
v-model="visible"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<div>
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-descriptions>
<el-descriptions-item label="工艺路线">{{
mlogItem.material_out_name
}}</el-descriptions-item>
<el-descriptions-item label="工段名称">{{
mlogItem.mgroup_name
}}</el-descriptions-item>
<el-descriptions-item label="生产设备">{{
mlogItem.equipment_name
}}</el-descriptions-item>
<el-descriptions-item label="预计工时">{{
mlogItem.hour_work
}}</el-descriptions-item>
<el-descriptions-item label="部门/车间">{{
mlogItem.belong_dept_name
}}</el-descriptions-item>
<el-descriptions-item label="处理人">{{
mlogItem.handle_user_name
}}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{
mlogItem.work_start_time
}}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{
mlogItem.create_time
}}</el-descriptions-item>
</el-descriptions>
<div
style="
padding: 5px 10px;
display: flex;
justify-content: end;
"
>
<el-button
type="primary"
v-if="mlogItem.submit_time == null"
@click="mlogUpdate"
v-auth="'mlog.update'"
>
编辑
</el-button>
<el-button
type="primary"
v-if="mlogItem.submit_time == null"
:loading="isSaveing"
@click="mlogSubmit"
>提交</el-button
>
</div>
</el-card>
<el-card
style="width: 100%; margin: 1vh 0"
header="物料消耗"
shadow="never"
>
<div>
<el-button
type="primary"
v-if="mlogItem.submit_time == null"
icon="el-icon-plus"
@click="table_add"
>新增</el-button
>
</div>
<scTable
ref="tableIn"
:apiObj="apiObj"
row-key="id"
stripe
:params="paramsIn"
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column
label="物料"
prop="material_in_name"
show-overflow-tooltip
></el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="领用数量" prop="count_use">
</el-table-column>
<el-table-column label="破碎数量" prop="count_break">
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="100px"
>
<template #default="scope">
<el-button
link
type="primary"
@click="table_in_edit(scope.row)"
:disabled="mlogItem.submit_time !== null"
>
编辑
</el-button>
<el-button
link
:disabled="mlogItem.submit_time !== null"
type="danger"
@click="table_in_del(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<el-card style="width: 100%" header="产出物料" shadow="never">
<scTable
ref="tableOut"
:apiObj="apiObj"
row-key="id"
stripe
:params="paramsOut"
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column
label="产出物料"
prop="material_out_name"
show-overflow-tooltip
></el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="数量" prop="count_real">
</el-table-column>
<el-table-column label="不合格数量" prop="count_notok">
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="100px"
>
<template #default="scope">
<el-button
link
type="primary"
:disabled="mlogItem.submit_time !== null"
@click="table_out_check(scope.row)"
>
检验
</el-button>
<el-button
link
type="danger"
@click="check_reSet(scope.row)"
:disabled="
mlogItem.submit_time !== null &&
scope.row.test_date !== null
"
>
撤回
</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:mlog="mlogId"
:mgroup="mgroup"
:materialIn="materialIn"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<check-dialog
v-if="dialog.check"
ref="checkDialog"
@success="handleCheckSuccess"
@closed="dialog.check = false"
>
</check-dialog>
<el-dialog v-model="saveInDialog" title="新增/编辑">
<el-form
:model="saveInForm"
:rules="rules"
label-width="100px"
ref="saveInForm"
>
<el-row>
<el-col :span="23">
<el-form-item label="领取数量" prop="count_use">
<el-input-number
v-model="saveInForm.count_use"
:min="1"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="破碎数量" prop="count_break">
<el-input-number
v-model="saveInForm.count_break"
:min="0"
style="width: 100%"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button
type="primary"
:loading="isSaveing"
@click="saveInSubmit()"
> </el-button
>
</template>
</el-dialog>
<edit-dialog
v-if="dialog.edit"
ref="editDialog"
@success="handleEditSuccess"
@closed="dialog.edit = false"
>
</edit-dialog>
</div>
</el-drawer>
</template>
<script>
import editDialog from "./mlog_form.vue";
import saveDialog from "./mlogb_form.vue";
import checkDialog from "./mlogb_check.vue";
export default {
props: {
mlogId: {
type: String,
default: "",
},
},
components: {
editDialog,
saveDialog,
checkDialog,
},
emits: ["success", "closed"],
data() {
return {
loading: false,
//
form: {},
dialog: {
save: false,
edit: false,
check: false,
},
apiObj: null,
paramsIn: {
page: 0,
mlog: "",
material_in__isnull: 0,
},
paramsOut: {
page: 0,
mlog: "",
material_out__isnull: 0,
},
mgroup: "",
mlogItem: {},
saveInForm: {
count_use: 0,
count_break: 0,
},
visible: false,
isSaveing: false,
options: [],
saveInDialog: false,
setFiltersVisible: false,
rules: {
count_use: [
{
required: true,
message: "请输入领取数量",
trigger: "blur",
},
],
count_break: [
{
required: true,
message: "请输入破碎数量",
trigger: "blur",
},
],
},
};
},
mounted() {
this.getMlogItem();
this.paramsIn.mlog = this.mlogId;
this.paramsOut.mlog = this.mlogId;
this.apiObj = this.$API.wpm.mlogb.list;
},
methods: {
open() {
this.visible = true;
},
getMlogItem() {
let that = this;
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
that.mlogItem = res;
that.mgroup = res.mgroup;
that.materialIn = res.material_in;
that.belongDeptId = res.belong_dept;
});
},
//
setData(data) {
Object.assign(this.form, data);
this.getRoute(data.id);
},
//
mlogUpdate() {
this.dialog.edit = true;
this.$nextTick(() => {
this.$refs.editDialog.open("edit").setData(this.mlogItem);
});
},
// mlogUpdate(data) {
// this.$refs.editDialog.open().setData(data);
// },
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open();
});
},
//
table_in_edit(row) {
this.saveInForm = row;
this.saveInDialog = true;
},
//
saveInSubmit() {
let that = this;
that.$refs.saveInForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.count_use = that.saveInForm.count_use;
obj.count_break = that.saveInForm.count_break;
that.$API.wpm.mlogb.updateIn
.req(that.saveInForm.id, obj)
.then((res) => {
that.isSaveing = false;
that.$message.success("操作成功");
that.saveInDialog = false;
that.$refs.tableIn.refresh();
that.$refs.tableOut.refresh();
})
.catch(() => {
that.isSaveing = false;
});
}
});
},
table_in_del(row) {
let that = this;
that.$confirm("确定删除吗?").then(() => {
that.$API.wpm.mlogb.delIn.req(row.id).then((res) => {
that.$message.success("操作成功");
that.$refs.tableIn.refresh();
that.$refs.tableOut.refresh();
//inout
});
});
},
table_out_check(row) {
this.dialog.check = true;
this.$nextTick(() => {
this.$refs.checkDialog.open(row);
});
},
//
mlogSubmit() {
let that = this;
that.$API.wpm.mlog.submit.req(that.mlogItem.id).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
});
},
handleSaveSuccess() {
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
handleCheckSuccess() {
this.$refs.tableOut.refresh();
},
handleEditSuccess() {},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,322 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item
label="开始时间"
prop="work_start_time"
>
<el-date-picker
:disabled="mode == 'edit'"
v-model="form.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间" prop="work_end_time">
<el-date-picker
v-model="form.work_end_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="间隔提醒">
<el-input-number
v-model="form.reminder_interval_list[0]"
:min="1"
:disabled="mode == 'edit'"
style="width: 25%"
controls-position="right"
/>
<el-input-number
v-model="form.reminder_interval_list[1]"
:min="1"
:disabled="mode == 'edit'"
style="width: 25%"
controls-position="right"
/>
<el-input-number
v-model="form.reminder_interval_list[2]"
:min="1"
:disabled="mode == 'edit'"
style="width: 25%"
controls-position="right"
/>
<el-input-number
v-model="form.reminder_interval_list[3]"
:min="1"
:disabled="mode == 'edit'"
style="width: 25%"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="生产路线" prop="route">
<el-select
v-model="form.route"
placeholder="生产路线"
clearable
style="width: 100%"
:disabled="mode == 'edit'"
>
<el-option
v-for="item in routeOptions"
:key="item.id"
:label="item.process_name"
:value="item.id"
>
<span
>{{ item.routepack_name }}-{{
item.process_name
}}</span
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="生产设备">
<el-select
v-model="form.equipment"
placeholder="生产设备"
clearable
:disabled="mode == 'edit'"
style="width: 100%"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="操作人">
<el-select
v-model="form.handle_user"
placeholder="操作人"
clearable
style="width: 100%"
>
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="生产类型" prop="mtype">
<el-select
v-model="form.mtype"
placeholder="生产类型"
clearable
:disabled="mode == 'edit'"
style="width: 100%"
>
<el-option
label="自产"
value="10"
></el-option>
<el-option
label="外协"
value="20"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input
v-model="form.note"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
note: "",
route: "",
equipment: "",
handle_user: "",
work_start_time: "",
reminder_interval_list: [],
};
export default {
props: {
process: {
type: String,
default: "",
},
mgroup: {
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增",
edit: "编辑",
show: "查看",
},
//
form: defaultForm,
//
rules: {
work_start_time: [
{
required: true,
message: "请选择生产开始时间",
trigger: "blur",
},
],
route: [
{
required: true,
message: "请选择生产路线",
trigger: "blur",
},
],
mtype: [
{
required: true,
message: "请选择生产类型",
trigger: "blur",
},
],
},
visible: false,
isSaveing: false,
options: [],
routeOptions: [],
userOptions: [],
setFiltersVisible: false,
};
},
mounted() {
this.getRoute();
this.getUser();
this.getEquipment();
},
methods: {
//
getUser() {
this.$API.system.user.list.req().then((res) => {
this.userOptions = res.results;
});
},
getEquipment() {
this.$API.em.equipment.list
.req({ page: 0, type: 10 })
.then((res) => {
this.options = res;
});
},
getRoute(id) {
let that = this;
that.$API.mtm.route.list
.req({ process: that.process, page: 0 })
.then((res) => {
that.routeOptions = res;
});
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
setData(data) {
console.log("data", data);
Object.assign(this.form, data);
this.getRoute(data.id);
},
setMgroup(id) {
this.form.mgroup = id;
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mgroup = that.mgroup;
if (that.mode === "add") {
that.$API.wpm.mlog.init.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
} else {
let obj = {};
obj.work_end_time = that.form.work_end_time;
obj.handle_user = that.form.handle_user;
obj.note = that.form.note;
that.$API.wpm.mlog.change
.req(that.form.id, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
});
}
}
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,214 @@
<template>
<el-dialog
title="过程检验"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="100px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="批次号" prop="batch">
<el-input
v-model="form.batch"
:disabled="batchDisabled"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="实际生产数">
<el-input-number
v-model="form.count_real"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格数量">
<el-input-number
v-model="form.count_ok"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
v-model="form.count_notok"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
v-model="form.count_n_hs"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="气泡">
<el-input-number
v-model="form.count_n_qp"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="水纹">
<el-input-number
v-model="form.count_n_swen"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="崩边">
<el-input-number
v-model="form.count_n_bb"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="雾面">
<el-input-number
v-model="form.count_n_wm"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="麻点">
<el-input-number
v-model="form.count_n_md"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="线痕">
<el-input-number
v-model="form.count_n_xh"
:min="0"
class="width-100"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
//
form: {},
//
rules: {
batch: [
{
required: true,
message: "请填写批次号",
trigger: "blur",
},
],
count_use: [
{
required: true,
message: "请填写领用数量",
trigger: "blur",
},
],
},
options: [],
materialOptions: [],
visible: false,
isSaveing: false,
batchDisabled: false,
};
},
mounted() {
if (this.form.batch != null) {
this.batchDisabled = true;
}
},
methods: {
open(data) {
this.visible = true;
Object.assign(this.form, data);
console.log(this.form);
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mlog = that.mlog;
that.$API.wpm.mlogb.updateOut
.req(that.form.id, that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
that.isSaveing = false;
});
}
});
},
},
};
</script>
<style scoped>
.width-100 {
width: 100%;
}
</style>

View File

@ -0,0 +1,197 @@
<template>
<el-dialog
title="添加日志详情"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px"
>
<el-form-item label="关联任务">
<el-select
v-model="form.mtask"
placeholder="关联任务"
clearable
style="width: 100%"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
>
<!-- <span>{{ item.material_out_name }}</span>/ -->
</el-option>
</el-select>
</el-form-item>
<el-form-item label="批次号" prop="wm_in">
<el-select
v-model="form.wm_in"
placeholder="交接物料"
clearable
style="width: 100%"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<div
style="
display: flex;
justify-content: space-between;
"
>
<span>{{ item.batch }}</span
><span>{{ item.count }}</span>
</div>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="领用数量">
<el-input-number
v-model="form.count_use"
:min="1"
controls-position="right"
/>
</el-form-item>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
mlog: "",
mtask: "",
batch: "",
count_use: "",
};
export default {
props: {
mlog: {
type: String,
default: "",
},
mgroup: {
type: String,
default: "",
},
materialIn: {
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增",
edit: "编辑",
},
//
form: defaultForm,
//
rules: {
wm_in: [
{
required: true,
message: "请填写批次号",
trigger: "blur",
},
],
count_use: [
{
required: true,
message: "请填写领用数量",
trigger: "blur",
},
],
},
options: [],
materialOptions: [],
visible: false,
isSaveing: false,
setFiltersVisible: false,
};
},
mounted() {
this.getMtask();
this.getMaterial();
},
methods: {
open() {
this.visible = true;
},
getMtask() {
let that = this;
this.$API.pm.mtask.list
.req({ page: 0, mgroup: that.mgroup })
.then((res) => {
that.options = res;
});
},
//
getMaterial() {
let that = this;
this.$API.wpm.wmaterial.list
.req({
mgroupx: that.mgroup,
material: that.materialIn,
page: 0,
})
.then((res) => {
that.materialOptions = res;
});
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in
.req(that.form)
.then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
})
.catch((err) => {
that.isSaveing = false;
});
}
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

241
src/views/wpm_gx/mlogs.vue Normal file
View File

@ -0,0 +1,241 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add"
v-auth="'mgroup.create'"
>新增</el-button
>
</div>
<div class="right-panel">
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="params"
@row-click="table_detail"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="生产路线"
prop="material_out_name"
min-width="100"
>
</el-table-column>
<el-table-column
label="预计工时"
prop="hour_work"
></el-table-column>
<el-table-column
label="工段名称"
prop="mgroup_name"
min-width="100"
></el-table-column>
<el-table-column
label="生产设备"
prop="equipment_name"
min-width="150"
></el-table-column>
<el-table-column
label="所属部门"
prop="belong_dept_name"
></el-table-column>
<el-table-column
label="处理人"
prop="handle_user_name"
></el-table-column>
<el-table-column
label="开始时间"
prop="work_start_time"
></el-table-column>
<el-table-column
label="结束时间"
prop="work_end_time"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="180"
>
<template #default="scope">
<el-button
link
size="small"
v-auth="'mlog.update'"
v-if="scope.row.submit_time == null"
type="primary"
@click.stop="table_edit(scope.row)"
>编辑</el-button
>
<el-divider
direction="vertical"
v-if="scope.row.submit_time == null"
></el-divider>
<el-button
link
size="small"
@click="table_detail(scope.row)"
type="primary"
>详情</el-button
>
<el-divider direction="vertical"></el-divider>
<el-button
link
size="small"
v-auth="'mgroup.delete'"
type="danger"
@click.stop="table_del(scope.row, scope.$index)"
>删除</el-button
>
</template>
</el-table-column>
</scTable>
</el-main>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:process="processId"
:mgroup="mgroupId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<detail-drawer
v-if="dialog.detail"
ref="detailDialog"
:mlogId="mlogId"
:mtask="mtask"
@closed="dialog.detail = false"
>
</detail-drawer>
</el-container>
</template>
<script>
import saveDialog from "./mlog_form.vue";
import detailDrawer from "./mlog_detail.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
name: "mlog",
components: {
saveDialog,
detailDrawer,
},
data() {
return {
apiObj: null,
params: { mgroup: "" },
query: {},
dialog: {
save: false,
detail: false,
},
tableData: [],
selection: [],
mtask: "",
mlogId: "",
processId: "",
processCate: "",
};
},
mounted() {
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, search: that.mgroupName })
.then((res) => {
that.mgroupId = res[0].id;
that.processId = res[0].process;
that.processCate = res[0].process_cate;
that.params.mgroup = res[0].id;
that.apiObj = that.$API.wpm.mlog.list;
});
},
methods: {
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
table_detail(row) {
this.mlogId = row.id;
this.dialog.detail = true;
this.$nextTick(() => {
this.$refs.detailDialog.open();
});
},
//
table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
var id = row.id;
this.$API.wpm.mlog.delete.req(id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
});
});
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped></style>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "磨抛",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

143
src/views/wpm_gx/mtask.vue Normal file
View File

@ -0,0 +1,143 @@
<template>
<el-container>
<el-header>
<h2>任务列表</h2>
</el-header>
<el-main>
<scTable
ref="table"
:apiObj="apiObj"
:query="params"
row-key="id"
:params="params"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="产品名称"
prop="material_out_name"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="型号规格">
<template #default="scope">
<span v-if="scope.row.material_out_"
>{{ scope.row.material_out_.specification }}|{{
scope.row.material_out_.model
}}</span
>
</template>
</el-table-column>
<el-table-column
label="任务编号"
prop="number"
width="140"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="任务量" prop="count"> </el-table-column>
<el-table-column label="开始时间" prop="start_date">
</el-table-column>
<el-table-column label="结束时间" prop="end_date">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="状态" prop="state">
<template #default="scope">
<el-tag :type="elTagType(scope.row.state)">
{{ state_[scope.row.state] }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="60">
<template #default="scope">
<el-link
type="primary"
@click="mtask_submit(scope.row)"
v-auth="'mtask.submit'"
v-if="
scope.row.state != 40 && scope.row.state != 34
"
>提交
</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</template>
<script>
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
name: "mtask",
data() {
return {
apiObj: null,
params: { mgroup: "" },
query: {},
tableData: [],
selection: [],
cates_: {
section: "工序",
other: "其他",
},
type_: {
10: "primary",
20: "primary",
30: "primary",
34: "danger",
40: "success",
},
state_: {
10: "创建中",
20: "已下达",
30: "生产中",
34: "已终止",
40: "已提交",
},
};
},
mounted() {
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, search: that.mgroupName })
.then((res) => {
that.mgroupId = res[0].id;
that.processId = res[0].process;
that.processCate = res[0].process_cate;
that.params.mgroup = res[0].id;
that.apiObj = this.$API.pm.mtask.list;
console.log("mgroupId", res[0].id);
});
},
methods: {
elTagType(state) {
return this.type_[state];
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped></style>

140
src/views/wpm_gx/print.vue Normal file
View File

@ -0,0 +1,140 @@
<template>
<div>
<div id="pdfDom" class="container" ref="pdfContent">
<div class="title">
<span>光芯科技</span>
<span>交接单</span>
</div>
<canvas id="barcode"></canvas>
<p class="lineStyle">物料{{ name }}</p>
<p class="lineStyle">批次号{{ batch }}</p>
<p class="lineStyle">数量{{ count }}</p>
</div>
<el-button type="primary" @click="toGetPdf1">打印 </el-button>
</div>
</template>
<script>
import axios from "axios";
import config from "@/config";
import http from "@/utils/request";
import getPdf from "@/utils/htmlToPdf";
import PdfLoader from "@/utils/html2pdf";
import html2canvas from "html2canvas";
export default {
data() {
return {
material_name: "玻璃片",
batch: "20240723_001",
count: "1000",
date: "2023-01-01",
sender: "切片-石小静",
resave: "活化-白海军",
visible: false,
};
},
mounted() {
var canvas = document.getElementById("barcode");
var context = canvas.getContext("2d");
context.clearRect(0, 0, 210, 270);
JsBarcode("#barcode", "9780199532179", {
format: "CODE128",
displayValue: true,
fontSize: 24,
lineColor: "#000000",
});
},
methods: {
toGetPdf(val = false, download = false) {
let that = this;
this.$nextTick(() => {
setTimeout(() => {
let title = "交接单";
getPdf(title, download).then((res) => {
console.log("res", res);
// FormData
let formData = new FormData();
formData.append("file", res, "document.pdf"); // FormData
formData.append("printer_name", "GP-3150TN"); //
// POST
http.post("http://localhost:8080/print/", formData)
.then((response) => {
console.log("postRes", response);
})
.catch((error) => {
console.error("postError", error);
});
});
}, 1000);
});
},
/* 将base64转换为文件,接收2个参数第一是base64第二个是文件名字 最后返回文件对象 */
dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(","),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime });
},
toGetPdf1() {
let str = [
"SIZE 70 mm,90 mm",
"GAP 2 mm,0 mm",
"CLS",
"WINTEXT 100,80,36,0,0,0,Simhei,光芯科技——交接单",
'BARCODE 100,140,"128",108,0,0,2,4,"' + this.batch + '"',
"WINTEXT 100,280,36,0,0,0,Simhei,物料:" + this.material_name,
"WINTEXT 100,340,36,0,0,0,Simhei,批次:" + this.batch,
"WINTEXT 100,400,36,0,0,0,Simhei,数量:" + this.count,
"WINTEXT 100,460,36,0,0,0,Simhei,日期:" + this.date,
"WINTEXT 100,520,36,0,0,0,Simhei,送料:" + this.sender,
"WINTEXT 100,580,36,0,0,0,Simhei,收料:" + this.resave,
"PRINT 1",
];
// -
// -
let obj = {};
obj.printer_commands = str;
obj.printer_name = "GP-3150TNS";
http.post("http://localhost:8080/prints/", obj)
// http.post("http://192.168.1.242:8080/prints/", obj)
.then((response) => {
console.log("postRes", response);
})
.catch((error) => {
console.error("postError", error);
});
},
},
};
</script>
<style scoped>
.container {
width: 210px;
height: 270px;
padding: 10px 5px;
border: 1px solid #dddddd;
background-color: #ffffff;
}
.title {
/* display: flex;
justify-content: space-between; */
font-size: 18px;
}
#barcode {
/* position: absolute; */
width: 200px;
height: 100px;
}
.lineStyle {
font-size: 14px;
margin-bottom: 5px;
}
</style>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "切片",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>

View File

@ -0,0 +1,62 @@
<template>
<el-container>
<el-header>
<el-segmented
v-model="values"
:options="options"
size="default"
></el-segmented>
</el-header>
<el-main id="elMain" class="nopadding">
<!-- 日志 -->
<mlogs
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mlogs>
<mtask
v-if="values == '日志'"
:mgroupName="mgroupName"
style="height: 50%"
></mtask>
<!-- 交接记录 -->
<handover
v-else-if="values == '交接记录'"
:mgroupName="mgroupName"
></handover>
<!-- 库存 -->
<inm v-else :mgroupName="mgroupName"></inm>
</el-main>
</el-container>
</template>
<script>
import inm from "./inm.vue";
import mlogs from "./mlogs.vue";
import mtask from "./mtask.vue";
import handover from "./handover.vue";
export default {
components: { inm, mlogs, mtask, handover },
data() {
return {
tableHieght: 200,
options: ["日志", "交接记录", "库存"],
values: "日志",
mgroupName: "烧结",
mgroupId: "",
};
},
created() {},
mounted() {
let that = this;
let height = document.getElementById("elMain").clintHeight / 2;
that.tableHieght = height;
},
methods: {
handleChange(value) {
this.value = value;
console.log("Selected value:", value);
},
},
};
</script>