Compare commits

...

9 Commits

Author SHA1 Message Date
Fanzink
e5eb49a7b6 Merge branch 'develop' into fzq 2022-12-02 16:20:45 +08:00
Fanzink
35d5d91c23 '样式修改-登录/中英文' 2022-12-02 16:19:14 +08:00
f3a7e38d13 Merge pull request 'lb' (#10) from lb into develop
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #10
2022-11-25 11:06:50 +08:00
5d36eb676c update 小修改“ 2022-11-10 15:12:23 +08:00
14b933fb0c update 安灯检测盒 2022-11-02 13:34:11 +08:00
92f52ab553 update productLine 2022-10-28 14:50:09 +08:00
15210c2f12 update 2022-10-18 14:42:48 +08:00
8447b8f7ab Merge branch 'lb' of http://git.picaiba.com/mt-fe-group/mt-yd-ui into lb 2022-10-17 16:59:11 +08:00
ca7fda73e3 update i18n 2022-10-17 16:52:07 +08:00
21 changed files with 1058 additions and 205 deletions

BIN
src/assets/img/cnbm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
src/assets/img/login.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

View File

@ -0,0 +1,62 @@
<template>
<div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
<svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
<use :xlink:href="iconName" />
</svg>
</template>
<script>
// doc: https://panjiachen.github.io/vue-element-admin-site/feature/component/svg-icon.html#usage
import { isExternal } from '@/utils/validate'
export default {
name: 'SvgIcon',
props: {
iconClass: {
type: String,
required: true
},
className: {
type: String,
default: ''
}
},
computed: {
isExternal() {
return isExternal(this.iconClass)
},
iconName() {
return `#icon-${this.iconClass}`
},
svgClass() {
if (this.className) {
return 'svg-icon ' + this.className
} else {
return 'svg-icon'
}
},
styleExternalIcon() {
return {
mask: `url(${this.iconClass}) no-repeat 50% 50%`,
'-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`
}
}
}
}
</script>
<style scoped>
.svg-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
.svg-external-icon {
background-color: currentColor;
mask-size: cover!important;
display: inline-block;
}
</style>

View File

@ -47,6 +47,7 @@
:options="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].options"
:props="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].props"
:disabled="isDetail"
clearable
/>
<el-time-select v-if="getType(n, c) === 'time'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" :disabled="isDetail" />
<el-date-picker

View File

@ -4,8 +4,8 @@ t.loading = 'Loading...'
t.createTime = 'Create Time'
t.brand = {}
t.brand.lg = 'Monitoring System'
t.brand.mini = 'PMS'
t.brand.lg = 'Deep Processing SCADA Platform'
t.brand.mini = 'SCADA'
t.routes = {}
t.routes['产品池'] = 'Products Pool'
@ -62,9 +62,13 @@ t.routes['设备分组报警信息'] = 'Equipment Group Alarm'
t.routes['设备历史参数'] = 'Equipment Historical Parameters'
t.routes['质量检测类型'] = 'Quality Inpection Types'
t.routes['质量检测信息'] = 'Quality Inpection Details'
t.routes['安灯检测盒'] = 'Andeng inspection box'
t.andeng = {}
t.andeng.inspectContent = 'Inspection Content'
t.andeng.btnVal = 'Button Value'
t.andeng.btnBoxModel = 'Button Box Model'
t.dictValueList = 'View Details'
@ -162,6 +166,10 @@ t.all = 'All'
t.reset = 'Reset'
t.preview = 'Preview'
t.design = 'Design'
t.timetype = 'Time Type'
t.reftimerange = 'By time range'
t.refdate = 'By date'
t.hour = 'Hour(s)'
t.errors = {}
t.errors.nosection = 'There is no sections on this product line.'
@ -174,6 +182,7 @@ t.hints.select = 'Please select '
t.hints.date = 'Please select date'
t.hints.checktime = 'Please select inspection time'
t.hints.number = 'Please input correct number'
t.hints.integer = 'Please input correct integer'
t.hints.addr = 'Please input address'
t.hints.upload2m = 'File size cannot be larger than 2MB (2048KB)'
t.hints.upload2mPic = 'Image files only. File size cannot be larger than 2MB (2048KB)'
@ -214,6 +223,9 @@ t.alarm.content = 'Alarm Content'
t.alarm.source = 'Alarm Source'
t.alarm.det = 'Alarm Details'
t.alarm.externalCode = 'External Code'
t.alarm.description = 'Description'
t.alarm.remark = 'Remark'
t.report = {}
t.report.name = 'Report Name'
@ -252,17 +264,17 @@ t.realtime.num = 'scrap quantity'
t.realtime.rate = 'scrap rate'
t.realtime.total = 'total production'
t.realtime.goodrate = 'Passed Rate'
t.realtime.runState = '是否运行'
t.realtime.state = '状态'
t.realtime.hasFault = '是否故障'
t.realtime.recentParamValue = '参数近期值'
t.realtime.view = '查看'
t.realtime.input = '投入数'
t.realtime.output = '产出数'
t.realtime.eqName = '设备名称'
t.realtime.eqCode = '设备编码'
t.realtime.productionSnapshotTime = '生产量记录时间'
t.realtime.statusSnapshotTime = '状态记录时间'
t.realtime.runState = 'running state'
t.realtime.state = 'status'
t.realtime.hasFault = 'malfunction'
t.realtime.recentParamValue = 'recent parameters'
t.realtime.view = 'view'
t.realtime.input = 'input' //'投入数'
t.realtime.output = 'output' //'产出数'
t.realtime.eqName = 'Equipment name'
t.realtime.eqCode = 'Equipment cdoe'
t.realtime.productionSnapshotTime = 'production recording time' // '生产量记录时间'
t.realtime.statusSnapshotTime = 'status recording time' // '状态记录时间'
t.realtime.refresh = 'Refresh data...'
@ -316,6 +328,40 @@ t.eq.port = 'Port'
t.eq.type = 'Type'
t.eq.typecode = 'Type Code'
t.eq.parent = 'Parent'
t.eq.mtbf = 'Mean time between failures[MTBF] (h)'
t.eq.mttr = 'Mean time to repair[MTTR] (h)'
t.eq.efficienttimeh = 'Working time(h)'
t.eq.shutdowntimeh = 'Off time(h)'
t.eq.worktimeh = 'Working time(h)'
t.eq.downtimeh = 'Malfunction duration(h)'
t.eq.stoptimeh = 'Halt duration(h)'
t.eq.worktime = 'Functioning duration'
t.eq.stoptime = 'Halt duration'
t.eq.downtime = 'Malfunction duration'
t.eq.downcount = 'Malfunction counts'
t.eq.downrate = 'Malfunction rates'
t.eq.stoplost = 'Lost'
t.eq.ratio = 'percentage'
t.eq.time = 'time'
t.eq.timetrend = 'trend'
t.eq.nogap = 'no interval'
t.eq.monthgap = 'by month'
t.eq.daygap = 'by day'
t.eq.weekgap = 'by week'
t.eq.hourgap = 'by hour'
t.eq.workdurationratio = 'Functioning duration ratio' // '工作时长比率'
t.eq.stopdurationratio = 'Halt duration ratio' // '停机时长比率'
t.eq.stopratio = 'Halt ratio' // '停机比率'
t.eq.downdurationratio = 'Malfunction duration ratio' // '故障时长比率'
t.eq.speedefficiency = 'Speed launch rate' //'速度开动率'
t.eq.speedlost = 'Speed lost'
t.eq.timeefficiency = 'Time launch rate' //'时间开动率'
t.eq.year = 'year'
t.eq.month = 'month'
t.eq.realyield = 'Actual processing speed'
t.eq.designyield = 'Theoretical processing speed'
t.eq.viewtrend = 'View Trends'
t.pl = {}
@ -328,6 +374,7 @@ t.pl.belong = 'Product Line'
t.pl.tvalue = 'TT Value'
t.pl.factoryHints = 'Please select a factory'
t.prompt = {}
t.prompt.title = 'Prompt'
t.prompt.info = 'Are you sure to {handle}?'
@ -335,6 +382,7 @@ t.prompt.sure = 'Are you sure to delete this record?'
t.prompt.success = 'success'
t.prompt.failed = 'failed'
t.prompt.deleteBatch = 'Please choose items to delete.'
t.prompt.month = 'Please choose month'
t.validate = {}
t.validate.required = 'This is required.'
@ -350,6 +398,8 @@ t.datePicker = {}
t.datePicker.range = 'to'
t.datePicker.start = 'Start Time'
t.datePicker.end = 'End Time'
t.datePicker.starttime = 'Start Time'
t.datePicker.endtime = 'End Time'
t.fullscreen = {}
t.fullscreen.prompt = 'This operation is not supported by your browser.'
@ -381,6 +431,7 @@ t.login.password = 'Password'
t.login.captcha = 'Captcha'
t.login.demo = 'Demo'
t.login.copyright = 'Copyright @Intelligent Automation Research Institute Co., Ltd Version: 1.0'
t.login.warning = 'Already Login!'
t.schedule = {}
t.schedule.beanName = 'Bean Name'

View File

@ -4,8 +4,8 @@ t.loading = '加载中...'
t.createTime = '添加时间'
t.brand = {}
t.brand.lg = '生产监控系统'
t.brand.mini = '监控'
t.brand.lg = '深加工SCADA平台'
t.brand.mini = 'SCADA'
t.routes = {}
// 一级
@ -63,8 +63,12 @@ t.routes['设备分组报警信息'] = '设备分组报警信息'
t.routes['设备历史参数'] = '设备历史参数'
t.routes['质量检测类型'] = '质量检测类型'
t.routes['质量检测信息'] = '质量检测信息'
t.routes['安灯检测盒'] = '安灯检测盒'
t.andeng = {}
t.andeng.inspectContent = '检测内容'
t.andeng.btnVal = '按钮值'
t.andeng.btnBoxModel = '按钮盒模式'
t.dictValueList = '查看值列表'
@ -163,6 +167,10 @@ t.all = '全部'
t.reset = '重置'
t.preview = '预览'
t.design = '设计'
t.timetype = '时间类型'
t.reftimerange = '按时间段'
t.refdate = '按日期'
t.hour = '小时'
t.errors = {}
t.errors.nosection = '该产线没有工段'
@ -175,6 +183,7 @@ t.hints.select = '请选择'
t.hints.date = '请选择日期'
t.hints.checktime = '请选择检测时间'
t.hints.number = '请输入正确的数值'
t.hints.integer = '请输入正确的整数'
t.hints.addr = '请输入地址'
t.hints.upload2m = '上传文件大小不要超过 2MB (2048KB)'
t.hints.upload2mPic = '上传图片文件,且大小不要超过 2MB (2048KB)'
@ -216,6 +225,8 @@ t.alarm.content = '报警内容'
t.alarm.source = '报警来源'
t.alarm.det = '报警详细内容'
t.alarm.externalCode = '外部编码'
t.alarm.description = '描述'
t.alarm.remark = '备注'
t.report = {}
t.report.name = '报表名称'
@ -318,6 +329,39 @@ t.eq.port = '端口'
t.eq.type = '类型名称'
t.eq.typecode = '类型编码'
t.eq.parent = '父类'
t.eq.mtbf = '平均故障间隔时间[MTBF] (h)'
t.eq.mttr = '平均维修时间[MTTR] (h)'
t.eq.efficienttimeh = '有效时间(h)'
t.eq.shutdowntimeh = '关机时间(h)'
t.eq.worktimeh = '工作时长(h)'
t.eq.downtimeh = '故障时长(h)'
t.eq.stoptimeh = '停机时长(h)'
t.eq.worktime = '工作时长'
t.eq.stoptime = '停机时长'
t.eq.downtime = '故障时长'
t.eq.downcount = '故障次数'
t.eq.downrate = '故障比率'
t.eq.stoplost = '中断损失'
t.eq.ratio = '百分比'
t.eq.time = '时间'
t.eq.timetrend = '时间区间走势'
t.eq.nogap = '无间隔'
t.eq.monthgap = '按月'
t.eq.daygap = '按天'
t.eq.weekgap = '按周'
t.eq.hourgap = '按小时'
t.eq.workdurationratio = '工作时长比率'
t.eq.stopdurationratio = '停机时长比率'
t.eq.stopratio = '停机比率'
t.eq.downdurationratio = '故障时长比率'
t.eq.speedefficiency = '速度开动率'
t.eq.speedlost = '速度损失'
t.eq.timeefficiency = '时间开动率'
t.eq.year='年'
t.eq.month='月'
t.eq.realyield = '实际加工速度'
t.eq.designyield = '理论加工速度'
t.eq.viewtrend = '查看趋势'
t.pl = {}
@ -337,6 +381,7 @@ t.prompt.sure = '确定删除这条记录吗?'
t.prompt.success = '操作成功'
t.prompt.failed = '操作失败'
t.prompt.deleteBatch = '请选择删除项'
t.prompt.month = '请选择月份'
t.validate = {}
t.validate.required = '必填项不能为空'
@ -352,6 +397,8 @@ t.datePicker = {}
t.datePicker.range = '至'
t.datePicker.start = '开始日期'
t.datePicker.end = '结束日期'
t.datePicker.starttime = '开始时间'
t.datePicker.endtime = '结束时间'
t.fullscreen = {}
t.fullscreen.prompt = '您的浏览器不支持此操作'
@ -383,6 +430,7 @@ t.login.password = '密码'
t.login.captcha = '验证码'
t.login.demo = '在线演示'
t.login.copyright = '版权所有:中建材智能自动化研究院有限公司 版本: 1.0'
t.login.warning = '已经登录过了'
t.schedule = {}
t.schedule.beanName = 'bean名称'

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,21 @@
import './iconfont'
import Vue from 'vue'
import SvgIcon from '@/components/SvgIcon'// svg component
// register globally
Vue.component('svg-icon', SvgIcon)
const req = require.context('./svg', false, /\.svg$/)
const requireAll = requireContext => requireContext.keys().map(requireContext)
requireAll(req)
const svgFiles = require.context('./svg', true, /\.svg$/)
svgFiles.keys().map(item => svgFiles(item))
export default {
// 获取图标icon-(*).svg名称列表, 例如[shouye, xitong, zhedie, ...]
getNameList() {
return requireAll(req).map(item => item.default.id.replace('icon-', ''))
}
}

View File

@ -0,0 +1 @@
<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="128" height="128"><defs><style/></defs><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085zm0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334zm0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333zm0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

1
src/icons/svg/eye.svg Normal file
View File

@ -0,0 +1 @@
<svg width="128" height="64" xmlns="http://www.w3.org/2000/svg"><path d="M127.072 7.994c1.37-2.208.914-5.152-.914-6.87-2.056-1.717-4.797-1.226-6.396.982-.229.245-25.586 32.382-55.74 32.382-29.24 0-55.74-32.382-55.968-32.627-1.6-1.963-4.57-2.208-6.397-.49C-.17 3.086-.399 6.275 1.2 8.238c.457.736 5.94 7.36 14.62 14.72L4.17 35.96c-1.828 1.963-1.6 5.152.228 6.87.457.98 1.6 1.471 2.742 1.471s2.284-.49 3.198-1.472l12.564-13.983c5.94 4.416 13.021 8.587 20.788 11.53l-4.797 17.418c-.685 2.699.686 5.397 3.198 6.133h1.37c2.057 0 3.884-1.472 4.341-3.68L52.6 42.83c3.655.736 7.538 1.227 11.422 1.227 3.883 0 7.767-.49 11.422-1.227l4.797 17.173c.457 2.208 2.513 3.68 4.34 3.68.457 0 .914 0 1.143-.246 2.513-.736 3.883-3.434 3.198-6.133l-4.797-17.172c7.767-2.944 14.848-7.114 20.788-11.53l12.336 13.738c.913.981 2.056 1.472 3.198 1.472s2.284-.49 3.198-1.472c1.828-1.963 1.828-4.906.228-6.87l-11.65-13.001c9.366-7.36 14.849-14.474 14.849-14.474z"/></svg>

After

Width:  |  Height:  |  Size: 944 B

View File

@ -30,7 +30,7 @@ export const pageRoutes = [
meta: { title: '登录' },
beforeEnter(to, from, next) {
if (Cookies.get('token')) {
Vue.prototype.$message({ message: '已经登录过了', type: 'error' })
Vue.prototype.$message({ message: $t('login.warning'), type: 'error' })
next(false)
} else {
next()

View File

@ -1,3 +1,11 @@
/*
* @Descripttion:
* @version:
* @Author: fzq
* @Date: 2022-11-25 09:51:46
* @LastEditors: fzq
* @LastEditTime: 2022-11-30 15:09:05
*/
/**
* 邮箱
* @param {*} s
@ -29,3 +37,11 @@ export function isPhone (s) {
export function isURL (s) {
return /^http[s]?:\/\/.*/.test(s)
}
/**
* @param {string} path
* @returns {Boolean}
*/
export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path)
}

View File

@ -53,6 +53,7 @@ export default {
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
window.addEventListener(
'resize',
//
debounce(() => {
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
}, 150)

View File

@ -5,33 +5,39 @@
<!-- 工厂 -->
<el-form-item>
<!-- <el-select v-model="dataForm.factoryId" :placeholder="$t('eq.name') + ' / ' + $t('eq.code')" clearable></el-select> -->
<el-select v-model="dataForm.ftId" :placeholder="'工厂'" clearable @change="handleFactoryChange">
<el-select v-model="dataForm.ftId" :placeholder="$t('factory.title')" clearable>
<el-option v-for="factory in factoryList" :key="factory.id" :value="factory.id" :label="factory.name" />
</el-select>
</el-form-item>
<!-- 产线 -->
<el-form-item>
<el-select v-model="dataForm.productlines" :placeholder="'产线'" multiple clearable>
<el-option v-for="productLine in productLineList" :key="productLine.id" :value="productLine.id"
:label="productLine.name" />
<el-select v-model="dataForm.productlines" :placeholder="$t('pl.title')" multiple clearable>
<el-option v-for="productLine in productLineList" :key="productLine.id" :value="productLine.id" :label="productLine.name" />
</el-select>
</el-form-item>
<!-- 时间类型 -->
<!-- 按时间段 -->
<el-form-item>
<el-select v-model="timeType" :placeholder="'时间类型'" clearable>
<el-option value="range" label="按时间段" />
<el-option value="date" label="按日期" />
<el-select v-model="timeType" :placeholder="$t('timetype')" clearable>
<el-option value="range" :label="$t('reftimerange')" />
<el-option value="date" :label="$t('refdate')" />
</el-select>
</el-form-item>
<!-- 日期选择 -->
<el-form-item v-if="timeType === 'date'">
<el-date-picker key="range-picker" v-model="rawTime" type="date" :placeholder="'请选择日期'" format="yyyy-MM-dd" />
<el-date-picker key="range-picker" v-model="rawTime" type="date" :placeholder="$t('hints.date')" format="yyyy-MM-dd" />
</el-form-item>
<!-- 时间段选择 -->
<el-form-item v-else>
<el-date-picker key="time-picker" v-model="rawTime" type="daterange" :range-separator="'至'"
:start-placeholder="'开始时间'" :end-placeholder="'结束时间'" format="yyyy-MM-dd" />
<el-date-picker
key="time-picker"
v-model="rawTime"
type="daterange"
:range-separator="$t('datePicker.range')"
:start-placeholder="$t('datePicker.starttime')"
:end-placeholder="$t('datePicker.endtime')"
format="yyyy-MM-dd"
/>
</el-form-item>
<!-- 按钮 -->
<el-form-item>
@ -76,39 +82,39 @@ const tableConfigs = [
{
// name: i18n.t('createTime'),
prop: 'factoryName',
name: '工厂'
name: i18n.t('factory.title')
},
{ prop: 'pdName', name: '产线' },
{ prop: 'wsName', name: '工段' },
{ prop: 'eqName', name: '设备' },
{ prop: 'pdName', name: i18n.t('pl.title') },
{ prop: 'wsName', name: i18n.t('ws.title') },
{ prop: 'eqName', name: i18n.t('eq.title') },
{
name: '有效时间(h)',
name: i18n.t('eq.efficienttimeh'),
children: [
{ prop: 'workTime', name: '工作时长(h)', width: 120, filter: val => `${val} 小时` },
{ prop: 'workRate', name: '工作时长比率', width: 120, filter: val => (val * 100).toFixed(2) + '%' }
{ prop: 'workTime', name: i18n.t('eq.worktimeh'), width: 120, filter: val => `${val} `+i18n.t('hour') },
{ prop: 'workRate', name: i18n.t('eq.workdurationratio'), width: 120, filter: val => (val * 100).toFixed(2) + '%' }
]
},
{
name: '关机时间(h)',
name: i18n.t('eq.shutdowntimeh'),
children: [
{ prop: 'stopTime', name: '停机时长(h)', width: 120, filter: val => `${val} 小时` },
{ prop: 'stopRate', name: '停机比率', width: 120, filter: val => (val * 100).toFixed(2) + '%' }
{ prop: 'stopTime', name: i18n.t('eq.stoptimeh'), width: 120, filter: val => `${val} `+i18n.t('hour') },
{ prop: 'stopRate', name: i18n.t('eq.stopratio'), width: 120, filter: val => (val * 100).toFixed(2) + '%' }
]
},
{
name: '中断损失',
name: i18n.t('eq.stoplost'),
children: [
{ prop: 'downTime', name: '故障时长(h)', width: 120, filter: val => `${val} 小时` },
{ prop: 'downRate', name: '故障比率', width: 120, filter: val => (val * 100).toFixed(2) + '%' },
{ prop: 'timeEfficiency', name: '时间开动率', width: 120, filter: val => (val * 100).toFixed(2) + '%' }
{ prop: 'downTime', name: i18n.t('eq.downtimeh'), width: 120, filter: val => `${val} `+i18n.t('hour') },
{ prop: 'downRate', name: i18n.t('eq.downrate'), width: 120, filter: val => (val * 100).toFixed(2) + '%' },
{ prop: 'timeEfficiency', name: i18n.t('eq.timeefficiency'), width: 120, filter: val => (val * 100).toFixed(2) + '%' }
]
},
{
name: '速度损失',
name: i18n.t('eq.speedlost'),
children: [
{ prop: 'realYield', name: '实际加工速度', width: 120, filter: val => `${val} 小时` },
{ prop: 'designYield', name: '理论加工速度', width: 120, filter: val => `${val} 小时` },
{ prop: 'peEfficiency', name: '速度开动率', width: 120, filter: val => (val * 100).toFixed(2) + '%' }
{ prop: 'realYield', name: i18n.t('eq.realyield'), width: 120, filter: val => `${val} `+i18n.t('hour') },
{ prop: 'designYield', name: i18n.t('eq.designyield'), width: 120, filter: val => `${val} `+i18n.t('hour') },
{ prop: 'peEfficiency', name: i18n.t('eq.speedefficiency'), width: 120, filter: val => (val * 100).toFixed(2) + '%' }
]
},
{
@ -129,7 +135,7 @@ const tableConfigs = [
subcomponent: TableTextComponent,
// options: ['edit', 'delete']
// options: ['view-trend'] //
buttonContent: '查看趋势',
buttonContent: i18n.t('eq.viewtrend'),
actionName: 'view-trend',
emitFullData: true
}

View File

@ -17,8 +17,8 @@
<div class="close-row">
<el-radio-group v-model="dataType" class="head-radio-group" size="small" @change="setLegend">
<el-radio-button label="百分比" />
<el-radio-button label="时间" />
<el-radio-button :label="$t('eq.ratio')" />
<el-radio-button :label="$t('eq.time')" />
</el-radio-group>
<el-radio-group v-if="1" v-model="searchType" class="head-radio-group" style="margin-left: 8px;" size="small" @change="handleRadioGroupChanged">
@ -34,12 +34,13 @@
import * as echarts from 'echarts'
import moment from 'moment'
import { pick } from 'lodash/object'
import i18n from '../../../i18n'
class EchartConfigs {
constructor() {
this.color = ['#e91e63', '#4caf50', '#3f51b5', '#ffc107', '#607d8b']
this.title = {
text: '时间区间走势',
text: i18n.t('eq.timetrend'),
top: 0,
left: 'center',
textStyle: {
@ -113,10 +114,10 @@ export default {
props: {},
data() {
return {
searchType: '无间隔',
searchRadioOptions: ['无间隔', '按月', '按周', '按天'],
dataType: '时间',
dataRadioOptions: ['时间', '百分比'],
searchType: i18n.t('eq.nogap'),
searchRadioOptions: [i18n.t('eq.nogap'), i18n.t('eq.monthgap'), i18n.t('eq.weekgap'), i18n.t('eq.daygap')],
dataType: i18n.t('eq.time'),
dataRadioOptions: [i18n.t('eq.time'), i18n.t('eq.ratio')],
config: new EchartConfigs(),
chart: null,
rateList: [], //
@ -127,7 +128,7 @@ export default {
},
methods: {
async initChart() {
this.config.setTitle(this.injectData.equipmentName + '时间区间走势')
this.config.setTitle(this.injectData.equipmentName + i18n.t('eq.timetrend'))
await this.getList()
this.setLegend()
},
@ -146,11 +147,11 @@ export default {
makeQuerys() {
const searchTypeMap = {
无间隔: 1,
按月: 2,
按周: 3,
按天: 4,
按小时: 5
[i18n.t('eq.nogap')]: 1,
[i18n.t('eq.monthgap')]: 2,
[i18n.t('eq.weekgap')]: 3,
[i18n.t('eq.daygap')]: 4,
[i18n.t('eq.hourgap')]: 5
}
return {
@ -189,11 +190,11 @@ export default {
//
datalist.map(item => {
const time = moment(item.time)
if (this.searchType === '按月') {
this.xAxis.push(`${time.year()}${time.month() + 1}`)
} else if (this.searchType === '按周') {
if (this.searchType === i18n.t('eq.monthgap')) {
this.xAxis.push(`${time.year()}${i18n.t('eq.year')}${time.month() + 1}${i18n.t('eq.month')}`)
} else if (this.searchType === i18n.t('eq.weekgap')) {
this.xAxis.push(`${time.format('YYYY-MM-DD')}`)
} else if (this.searchType === '按天') {
} else if (this.searchType === i18n.t('eq.daygap')) {
this.xAxis.push(`${time.format('YY-M-D')}`)
} else {
this.xAxis.push(`${time.format('YYYY-MM-DD')}`)
@ -218,8 +219,16 @@ export default {
setLegend() {
// legend
const legendMap = {
百分比: ['工作时长比率', '停机时长比率', '故障时长比率', '速度开动率', '时间开动率', 'OEE', 'TEEP'],
时间: ['工作时长', '停机时长', '故障时长']
[i18n.t('eq.ratio')]: [
i18n.t('eq.workdurationratio'),
i18n.t('eq.stopdurationratio'),
i18n.t('eq.downdurationratio'),
i18n.t('eq.speedefficiency'),
i18n.t('eq.timeefficiency'),
'OEE',
'TEEP'
],
[i18n.t('eq.time')]: [i18n.t('eq.worktime'), i18n.t('eq.stoptime'), i18n.t('eq.downtime')]
}
this.config.setLegend(legendMap[this.dataType])
this.setData()
@ -228,7 +237,7 @@ export default {
},
setData() {
if (this.dataType === '时间') {
if (this.dataType === i18n.t('eq.time')) {
const workTimeList = []
const stopTimeList = []
const downTimeList = []
@ -238,9 +247,9 @@ export default {
downTimeList.push(item.downTime)
})
this.config.setSeries([
{ name: '工作时长', type: 'bar', data: workTimeList },
{ name: '停机时长', type: 'bar', data: stopTimeList },
{ name: '故障时长', type: 'bar', data: downTimeList }
{ name: i18n.t('eq.worktime'), type: 'bar', data: workTimeList },
{ name: i18n.t('eq.stoptime'), type: 'bar', data: stopTimeList },
{ name: i18n.t('eq.downtime'), type: 'bar', data: downTimeList }
])
} else {
//
@ -261,11 +270,11 @@ export default {
teepList.push(item.teep)
})
this.config.setSeries([
{ name: '工作时长比率', type: 'bar', data: workRateList },
{ name: '停机时长比率', type: 'bar', data: stopRateList },
{ name: '故障时长比率', type: 'bar', data: downRateList },
{ name: '速度开动率', type: 'bar', data: peEfficiencyList },
{ name: '时间开动率', type: 'bar', data: timeEfficiencyList },
{ name: i18n.t('eq.workdurationratio'), type: 'bar', data: workRateList },
{ name: i18n.t('eq.stopdurationratio'), type: 'bar', data: stopRateList },
{ name: i18n.t('eq.downdurationratio'), type: 'bar', data: downRateList },
{ name: i18n.t('eq.speedefficiency'), type: 'bar', data: peEfficiencyList },
{ name: i18n.t('eq.timeefficiency'), type: 'bar', data: timeEfficiencyList },
{ name: 'OEE', type: 'bar', data: oeeList },
{ name: 'TEEP', type: 'bar', data: teepList }
])
@ -278,8 +287,8 @@ export default {
this.$nextTick(() => {
// this.chart.setOption(this.config)
this.chart.setOption(this.config, {
notMerge: true
})
notMerge: true
})
})
}
}

View File

@ -4,11 +4,11 @@
<el-form :inline="true" :model="dataForm" @keyup.enter.native="currentChangeHandle(1)">
<!-- 月份 -->
<el-form-item>
<el-date-picker key="month-picker" v-model="rawTime" type="month" :placeholder="'请选择月份'" format="yyyy-MM" />
<el-date-picker key="month-picker" v-model="rawTime" type="month" :placeholder="$t('prompt.month')" format="yyyy-MM" />
</el-form-item>
<!-- 产线 -->
<el-form-item>
<el-select v-model="dataForm.productlines" :placeholder="'产线'" multiple clearable>
<el-select v-model="dataForm.productlines" :placeholder="$t('pl.title')" multiple clearable>
<el-option v-for="productLine in productLineList" :key="productLine.id" :value="productLine.id" :label="productLine.name" />
</el-select>
</el-form-item>
@ -49,14 +49,14 @@ const tableConfigs = [
name: i18n.t('index')
},
// { prop: 'time', name: '', filter: timeFilter },
{ prop: 'pdName', name: '产线名称' },
{ prop: 'wsName', name: '工序' },
{ prop: 'eqName', name: '设备' },
{ prop: 'mtbf', name: '平均故障间隔时间[MTBF] (h)', width: 220 },
{ prop: 'mttr', name: '平均维修时间[MTTR] (h)', width: 190 },
{ prop: 'workTime', name: '工作时长 (h)' },
{ prop: 'downTime', name: '故障时长 (h)' },
{ prop: 'downCount', name: '故障次数' },
{ prop: 'pdName', name: i18n.t('pl.name') },
{ prop: 'wsName', name: i18n.t('ws.title') },
{ prop: 'eqName', name: i18n.t('eq.title') },
{ prop: 'mtbf', name: i18n.t('eq.mtbf'), width: 220 },
{ prop: 'mttr', name: i18n.t('eq.mttr'), width: 190 },
{ prop: 'workTime', name: i18n.t('eq.worktimeh') },
{ prop: 'downTime', name: i18n.t('eq.downtimeh') },
{ prop: 'downCount', name: i18n.t('eq.downcount') }
// {
// prop: 'operations',
// name: i18n.t('handle'),

View File

@ -76,7 +76,9 @@ const tableConfigs = [
{ prop: 'typeDictValue', name: i18n.t('alarm.type'), filter: dictFilter(dictEntries.alarmType.value) },
{ prop: 'gradeDictValue', name: i18n.t('alarm.level'), filter: dictFilter(dictEntries.alarmLevel.value) },
{ prop: 'alarmContent', name: i18n.t('alarm.content') },
{ prop: 'externalCode', name: i18n.t('alarm.externalCode') },
// { prop: 'externalCode', name: i18n.t('alarm.externalCode') },
{ prop: 'description', name: i18n.t('alarm.description') },
{ prop: 'remark', name: i18n.t('alarm.remark') },
{ prop: 'operations', name: i18n.t('handle'), fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
]
@ -88,7 +90,9 @@ const addOrUpdateConfigs = {
{ name: 'typeDictValue', label: i18n.t('alarm.type'), type: 'select', options: [] },
{ name: 'gradeDictValue', label: i18n.t('alarm.level'), type: 'select', options: [] },
{ name: 'alarmContent', label: i18n.t('alarm.content'), required: true },
{ name: 'externalCode', label: i18n.t('alarm.externalCode') }
{ name: 'description', label: i18n.t('alarm.description') },
{ name: 'remark', label: i18n.t('alarm.remark') }
// { name: 'externalCode', label: i18n.t('alarm.externalCode') }
],
operations: [
{ name: 'cancel', showAlways: true },

View File

@ -52,7 +52,7 @@ const tableConfigs = [
{ prop: 'factoryName', name: i18n.t('factory.title') },
{ prop: 'name', name: i18n.t('pl.name') },
{ prop: 'code', name: i18n.t('pl.code') },
{ prop: 'status', name: i18n.t('pl.status') },
{ prop: 'status', name: i18n.t('pl.status'), filter: val => (val === 0 || val === 1 || val === 2) && ['停止', '运行', '未知'][val] },
{ prop: 'description', name: i18n.t('desc') },
{ prop: 'remark', name: i18n.t('remark') },
{ prop: 'operations', name: i18n.t('handle'), fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }

View File

@ -0,0 +1,368 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="currentChangeHandle(1)">
<!-- <el-form-item> -->
<!-- <el-input v-model="dataForm.key" :placeholder="$t('eq.name') + ' / ' + $t('eq.code')" clearable></el-input>
</el-form-item> -->
<el-form-item>
<el-button @click="currentChangeHandle(1)">{{ $t('search') }}</el-button>
<el-button v-if="$hasPermission('monitoring:qualityInspectionBoxBtn:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
<!-- <el-button v-if="$hasPermission('monitoring:equipment:export')" @click="exportHandle()">{{ $t('export') }}</el-button> -->
</el-form-item>
</el-form>
<base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
:max-height="calcMaxHeight(8)"
@operate-event="handleOperations"
@refreshDataList="getDataList"
/>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:configs="addOrUpdateConfigs"
@refreshDataList="getDataList"
@select-change="handleDialogSelectChange"
@destory-dialog="handleDestroyDialog"
/>
</div>
</template>
<script>
import i18n from '@/i18n'
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
// import AddOrUpdate from './equipment-add-or-update'
import BaseTable from '@/components/base-table'
import TableOperateComponent from '@/components/base-table/components/operationComponent'
// import TableTextComponent from '@/components/base-table/components/detailComponent'
// import CKEditor from 'ckeditor4-vue'
import { calcMaxHeight } from '@/utils'
import { timeFilter } from '@/utils/filters'
// import Cookies from 'js-cookie'
const tableConfigs = [
{
type: 'index',
name: i18n.t('index')
},
{
prop: 'createTime',
name: i18n.t('createTime'),
filter: timeFilter
},
{ prop: 'inspectionDetContent', name: i18n.t('andeng.inspectContent') }, // name: '' },
{ prop: 'keyValue', name: i18n.t('andeng.btnVal') }, // name: '' },
{ prop: 'model', name: i18n.t('andeng.btnBoxModel') }, // name: '' },
{
prop: 'operations',
name: i18n.t('handle'),
fixed: 'right',
width: 180,
subcomponent: TableOperateComponent,
options: ['edit', 'delete']
}
]
const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/qualityInspectionBoxBtn',
fields: [
// { name: 'productionId', label: i18n.t('eq.name'), required: true },
{ name: 'productionId', label: i18n.t('pl.title'), required: true, type: 'select', options: [], relatedField: 'sectionId' },
{ name: 'sectionId', label: i18n.t('ws.title'), required: true, type: 'select', options: [] },
{ name: 'model', label: i18n.t('andeng.btnBoxModel') },
{
name: 'keyValue',
label: i18n.t('andeng.btnVal'),
required: true,
rules: [{ type: 'integer', trigger: 'blur', message: i18n.t('hints.integer'), transform: val => Number(val) }]
},
{
name: 'inspectionDetContent',
label: i18n.t('andeng.inspectContent')
}
],
operations: [
{ name: 'cancel', showAlways: true },
{
name: 'save',
url: '/monitoring/qualityInspectionBoxBtn',
permission: 'monitoring:qualityInspectionBoxBtn:save',
showOnEdit: false
},
{
name: 'update',
url: '/monitoring/qualityInspectionBoxBtn',
permission: 'monitoring:qualityInspectionBoxBtn:update',
showOnEdit: true
}
]
}
export default {
data() {
return {
calcMaxHeight,
tableConfigs,
addOrUpdateConfigs,
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate,
BaseTable
},
activated() {
this.getDataList()
this.getPlList()
this.getWsList()
},
methods: {
// destroy dialog
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200)
},
// 线
getPlList() {
this.$http({
url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get'
}).then(({ data: res }) => {
const plConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'productionId')
plConfig.options =
res.data?.map(item => ({
value: item.id,
label: item.name
})) || []
})
},
//
getWsList(id) {
let params = {
page: 1,
limit: 999
}
if (id) {
params.lineId = id
}
this.$http({
url: this.$http.adornUrl('/monitoring/workshopSection/page'),
method: 'get',
params: this.$http.adornParams(params)
}).then(({ data: res }) => {
const wsConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId')
wsConfig.options =
res.data?.list?.map(item => ({
value: item.id,
label: item.name
})) || []
})
},
//
getTypeList() {
this.$http({
url: this.$http.adornUrl('/monitoring/equipmentType/page'),
method: 'get',
params: this.$http.adornParams({
// page: this.pageIndex,
// limit: this.pageSize,
// key: this.dataForm.key
})
}).then(({ data }) => {
const eqTypeConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'equipmentTypeId')
eqTypeConfig.options =
data.data?.list?.map(item => ({
value: item.id,
label: item.name
})) || []
})
},
//
getGroupList() {
this.$http({
url: this.$http.adornUrl('/monitoring/equipmentGroup/page'),
method: 'get',
params: this.$http.adornParams({
// page: this.pageIndex,
// limit: this.pageSize,
// key: this.dataForm.key
})
}).then(({ data }) => {
const groupConfig = this.addOrUpdateConfigs.fields.find(item => item.name === 'groupId')
groupConfig.options =
data.data?.list?.map(item => ({
value: item.id,
label: item.name
})) || []
})
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/qualityInspectionBoxBtn/page'),
method: 'get',
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize
// key: this.dataForm.key
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.data.list
// this.dataList = new Array(20).fill('1')
// console.log('data list', this.dataList)
this.totalPage = data.data.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle(val) {
this.dataListSelections = val
},
//
handleDialogSelectChange({ name, id }) {
switch (name) {
case 'productionId':
this.getWsList(id)
}
},
handleOperations({ type, data: id }) {
switch (type) {
case 'view-detail':
// const { name, code } = this.dataList.find(item => item.id === id)
// this.$router.push({
// name: 'monitoring-equipmentAdd',
// params: {
// isdetail: true,
// equipmentId: id
// }
// })
// break
return this.addOrUpdateHandle(id, true)
case 'edit':
return this.addOrUpdateHandle(id)
case 'delete':
return this.deleteHandle(id)
}
},
exportHandle() {
// this.$http.get(this.$http.adornUrl('/monitoring/equipment/export')).then(({ data: res }) => {
this.$http({
url: this.$http.adornUrl('/monitoring/equipment/export'),
method: 'get',
responseType: 'blob'
}).then(res => {
let fileName = 'equipment-list.xls'
if (res.headers['content-disposition']) {
const contentDisposition = res.headers['content-disposition']
fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9)
}
fileName = decodeURIComponent(fileName)
const blob = new Blob([res.data])
if ('download' in document.createElement('a')) {
const alink = document.createElement('a')
alink.download = fileName
alink.style.display = 'none'
alink.target = '_blank'
alink.href = URL.createObjectURL(blob)
document.body.appendChild(alink)
alink.click()
URL.revokeObjectURL(alink.href)
document.body.removeChild(alink)
} else {
navigator.msSaveBlob(blob, fileName)
}
})
},
// /
addOrUpdateHandle(id, isdetail = false) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, isdetail)
})
// this.$router.push({
// name: 'monitoring-equipmentAdd',
// params: {
// equipmentId: id
// }
// })
},
//
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`${i18n.t('prompt.info', { handle: id ? i18n.t('delete').toLowerCase() : i18n.t('deleteBatch').toLowerCase() })}`, i18n.t('prompt.title'), {
confirmButtonText: i18n.t('confirm'),
cancelButtonText: i18n.t('cancel'),
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/monitoring/qualityInspectionBoxBtn'),
method: 'delete',
data: this.$http.adornData(ids, false, 'raw')
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: i18n.t('prompt.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@ -1,69 +1,116 @@
<template>
<div class="aui-wrapper aui-page__login">
<div class="aui-content__wrapper">
<main class="aui-content">
<div class="login-header">
<h2 class="login-brand">{{ $t('brand.lg') }}</h2>
</div>
<div class="login-body">
<h3 class="login-title">{{ $t('login.title') }}</h3>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" status-icon>
<el-form-item prop="username">
<el-input v-model="dataForm.username" :placeholder="$t('login.username')">
<span slot="prefix" class="el-input__icon">
<svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-user"></use></svg>
</span>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="dataForm.password" type="password" :placeholder="$t('login.password')">
<span slot="prefix" class="el-input__icon">
<svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-lock"></use></svg>
</span>
</el-input>
</el-form-item>
<!-- <el-form-item prop="captcha">
<el-row :gutter="20">
<el-col :span="14">
<el-input v-model="dataForm.captcha" :placeholder="$t('login.captcha')">
<span slot="prefix" class="el-input__icon">
<svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-safetycertificate"></use></svg>
</span>
</el-input>
</el-col>
<el-col :span="10" class="login-captcha">
<img :src="captchaPath" @click="getCaptcha()">
</el-col>
</el-row>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="dataFormSubmitHandle()" class="w-percent-100">{{ $t('login.title') }}</el-button>
</el-form-item>
</el-form>
</div>
<div class="login-footer">
<p style="background: #ececec99; border-radius: 8px;">
<el-button style="background: none; color: #fff; border: unset; outline: unset; cursor: pointer;" @click="chLang('zh')">中文</el-button> |
<el-button style="background: none; color: #fff; border: unset; outline: unset; cursor: pointer;" @click="chLang('en')">English</el-button>
</p>
<div class="login-container">
<div class="login-background" :style="{backgroundImage: 'url(' + (coverImgUrl ? coverImgUrl : baseImg) + ')', backgroundSize:'100% 100%', backgroundRepeat: 'no-repeat'}">
<div class="login-background-container">
<div class="back-title">
Wel<span>come</span>
<p><span class="back-title-point" />{{ $t('brand.lg') }}</p>
</div>
<img :src="require('../../assets/img/login.gif')" style="width: 90%; margin-left: 5%" alt="">
</div>
</div>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" class="login-form" autocomplete="on" label-position="left" @keyup.enter.native="dataFormSubmitHandle()">
<p>
{{ $t('login.copyright') }}
</p>
</div>
</main>
</div>
</div>
<div class="title-container">
<h3 class="title" :title="$t('brand.lg')">
<img src="../../assets/img/cnbm.png" style="width: 1em; height: 1em; position: relative; top: 0em; margin-right: 12px" alt="">
{{ $t('brand.lg') }}
</h3>
</div>
<el-form-item prop="username" style="margin: 0px 8.3%">
<el-input
ref="username"
v-model="dataForm.username"
:placeholder="$t('login.username')"
name="username"
type="text"
tabindex="1"
autocomplete="on"
/>
</el-form-item>
<el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
<el-form-item prop="password" style="margin: 8px 8.3%">
<el-input
:key="passwordType"
ref="password"
v-model="dataForm.password"
:type="passwordType"
:placeholder="$t('login.password')"
name="password"
tabindex="2"
autocomplete="on"
@keyup.native="checkCapslock"
@blur="capsTooltip = false"
@keyup.enter.native="dataFormSubmitHandle()"
/>
<span class="show-pwd" @click="showPwd">
<svg-icon :icon-class="passwordType === 'password' ? 'eye-open' : 'eye'" />
</span>
</el-form-item>
</el-tooltip>
<!-- <lang-select class="login-language" /> -->
<el-button :loading="loading" type="primary" style="width: 83.4%; height: 6vh; background-color: #0B58FF; margin: 0px 8.3%; margin-top: 5vh" @click="dataFormSubmitHandle()">
{{ $t('login.title') }}
</el-button>
<el-row class="login-footer">
<el-row class="login-language">
<el-col
:span="2"
:offset="8"
:class="['login-language-box', this.$root.$i18n.locale === 'zh-CN' ? 'isActive' : '']"
@click.native="chLang('zh')"
>
中文
</el-col>
<el-col :span="1" :offset="1" style="color: #DCDFE6">|</el-col>
<el-col
:span="2"
:offset="1"
:class="['login-language-box', this.$root.$i18n.locale === 'en' ? 'isActive' : '']"
@click.native="chLang('en')"
>
English
</el-col>
</el-row>
<el-row class="login-copyright">
{{ $t('login.copyright') }}
</el-row>
</el-row>
<!-- <div style="position:relative">
<div class="tips">
<span>Username : admin</span>
<span>Password : any</span>
</div>
<div class="tips">
<span style="margin-right:18px;">Username : editor</span>
<span>Password : any</span>
</div>
</div> -->
</el-form>
</div>
</template>
<script>
// import { downLoadBGP } from '@/api/user'
// import { mapGetters } from 'vuex'
import Cookies from 'js-cookie'
import debounce from 'lodash/debounce'
// import { getUUID } from '@/utils'
export default {
data() {
return {
baseImg: require('../../assets/img/login-back.png'),
coverImgUrl: '',
captchaPath: '',
passwordType: 'password',
capsTooltip: false,
loading: false,
dataForm: {
username: 'admin',
password: 'admin',
@ -73,6 +120,7 @@ export default {
}
},
computed: {
// ...mapGetters(['language']),
dataRule() {
return {
username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
@ -87,70 +135,282 @@ export default {
// this.getCaptcha()
},
methods: {
chLang(lang) {
switch (lang) {
case 'zh':
this.$root.$i18n.locale = 'zh-CN'
// location.reload()
break
case 'en':
this.$root.$i18n.locale = 'en'
location.reload()
break
}
},
//
getCaptcha() {
this.dataForm.uuid = getUUID()
// this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
// this.captchaPath = (process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor') + `/captcha?uuid=${this.dataForm.uuid}`
this.captchaPath = `/api/captcha?uuid=${this.dataForm.uuid}`
},
//
dataFormSubmitHandle: debounce(
function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) {
return false
}
this.$http
.post(this.$http.adornUrl('/login'), this.dataForm)
.then(({ data: res }) => {
checkCapslock(e) {
const { key } = e
this.capsTooltip = key && key.length === 1 && (key >= 'A' && key <= 'Z')
},
showPwd() {
if (this.passwordType === 'password') {
this.passwordType = ''
} else {
this.passwordType = 'password'
}
this.$nextTick(() => {
this.$refs.password.focus()
})
},
chLang(lang) {
switch (lang) {
case 'zh':
this.$root.$i18n.locale = 'zh-CN'
// location.reload()
break
case 'en':
this.$root.$i18n.locale = 'en'
location.reload()
break
}
},
//
getCaptcha() {
this.dataForm.uuid = getUUID()
// this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
// this.captchaPath = (process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor') + `/captcha?uuid=${this.dataForm.uuid}`
this.captchaPath = `/api/captcha?uuid=${this.dataForm.uuid}`
},
//
dataFormSubmitHandle: debounce(
function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) {
return false
}
this.$http
.post(this.$http.adornUrl('/login'), this.dataForm)
.then(({ data: res }) => {
console.log('res', res)
if (res.code !== 0) {
console.log('res', res)
if (res.code !== 0) {
console.log('res', res)
// this.getCaptcha()
return this.$message.error(res.msg)
// this.getCaptcha()
return this.$message.error(res.msg)
}
Cookies.set('token', res.data.token)
/** 保存dictlist */
this.$http.get(this.$http.adornUrl('/sys/dict/data/getAll')).then(({ data: res }) => {
if (res && res.code === 0) {
localStorage.setItem('dictList', JSON.stringify(res.data))
} else {
this.$message({
message: '数据字典拉取失败,请检查!',
type: 'error',
duration: 2000
})
}
Cookies.set('token', res.data.token)
/** 保存dictlist */
this.$http.get(this.$http.adornUrl('/sys/dict/data/getAll')).then(({ data: res }) => {
if (res && res.code === 0) {
localStorage.setItem('dictList', JSON.stringify(res.data))
} else {
this.$message({
message: '数据字典拉取失败,请检查!',
type: 'error',
duration: 2000
})
}
})
this.$router.replace({ name: 'home' })
})
.catch(err => {
this.$message({
message: err.message,
type: 'error',
duration: 2000
})
this.$router.replace({ name: 'home' })
})
.catch(err => {
this.$message({
message: err.message,
type: 'error',
duration: 2000
})
})
},
1000,
{ leading: true, trailing: false }
)
})
})
},
1000,
{ leading: true, trailing: false }
)
}
}
</script>
<style lang="scss">
/* 修复input 背景不协调 和光标变色 */
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
// $bg:#283443;
$light_gray:#fff;
$cursor: #161616;
@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
.login-container .el-input input {
color: $cursor;
height: 6vh !important;
}
}
/* reset element-ui css */
.login-container {
.el-input {
display: inline-block;
height: 47px;
width: 85%;
input {
background: transparent;
border: 0px;
-webkit-appearance: none;
border-radius: 0px;
padding: 12px 5px 12px 15px;
}
}
.el-form-item {
border: 1px solid #D7D8D9;
border-radius: 5px;
color: #454545;
height: 6vh;
.el-form-item__content {
height: calc(6vh - 2px);
line-height: 6vh;
.el-input {
height: calc(6vh - 2px);
}
}
}
}
</style>
<style lang="scss" scoped>
// $bg:#2d3a4b;
$dark_gray:#889aa4;
$light_gray:#eee;
$cursor: #161616;
.login-container {
min-height: 100%;
width: 100%;
background-size: cover;
// background-color: $bg;
overflow: hidden;
.login-background{
position: absolute;
width: 60%;
top: 0;
left: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
.login-background-container{
width: 95%;
.back-title{
color: #26B9DE;
font-size: 88px;
margin-left: 17%;
span {
color: #fff;
}
p {
font-size: 22px;
letter-spacing: 1px;
.back-title-point {
display: inline-block;
width: 16px;
height: 16px;
border-radius: 8px;
background-color: #26B9DE;
margin-right: 14px;
}
}
}
}
}
.login-form {
position: absolute;
width: 40%;
max-width: 100%;
top: 0;
right: 0;
bottom: 0;
padding: 0 6.67%;
margin: 0 auto;
overflow: hidden;
background: rgba($color: #fff, $alpha: 1);
backdrop-filter: blur(10px);
box-shadow: 5px 5px 5px rgba($color: #000000, $alpha: .1);
.login-footer{
position: absolute;
bottom: 0;
right: 0;
left: 0;
margin-bottom: 5vh;
}
.login-language{
font-size: 15px;
text-align: center;
color: $cursor;
margin-bottom: 12px;
.login-language-box {
cursor: pointer;
}
.isActive {
color: #0B58FF;
cursor: auto;
}
}
.login-copyright{
text-align: center;
color: #C7C7C7;
font-size: 15px;
line-height: 28px;
padding: 0 16%;
}
}
.tips {
font-size: 14px;
color: #fff;
margin-bottom: 10px;
span {
&:first-of-type {
margin-right: 16px;
}
}
}
.svg-container {
padding: 6px 5px 6px 15px;
color: #000;
vertical-align: middle;
width: 30px;
display: inline-block;
}
.title-container {
position: relative;
margin-top: 18vh;
.title {
font-size: 34px;
line-height: 6vh;
margin: 0px auto 40px auto;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
letter-spacing: 2px;
}
}
.show-pwd {
position: absolute;
right: 10px;
top: 0;
font-size: 16px;
color: $dark_gray;
cursor: pointer;
user-select: none;
}
.thirdparty-button {
position: absolute;
right: 0;
bottom: 6px;
}
@media only screen and (max-width: 470px) {
.thirdparty-button {
display: none;
}
}
}
</style>