Compare commits
4 Commits
8447b8f7ab
...
5d36eb676c
Author | SHA1 | Date | |
---|---|---|---|
5d36eb676c | |||
14b933fb0c | |||
92f52ab553 | |||
15210c2f12 |
@ -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
|
||||
|
@ -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'
|
||||
@ -178,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)'
|
||||
@ -218,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'
|
||||
@ -256,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...'
|
||||
|
||||
|
||||
@ -320,39 +328,39 @@ t.eq.port = 'Port'
|
||||
t.eq.type = 'Type'
|
||||
t.eq.typecode = 'Type Code'
|
||||
t.eq.parent = '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.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'
|
||||
|
||||
|
||||
|
||||
|
@ -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 = '查看值列表'
|
||||
@ -179,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)'
|
||||
@ -220,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 = '报表名称'
|
||||
|
@ -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 },
|
||||
|
@ -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'] }
|
||||
|
368
src/views/modules/monitoring/qualityInspectionBoxBtn.vue
Normal file
368
src/views/modules/monitoring/qualityInspectionBoxBtn.vue
Normal 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>
|
Loading…
Reference in New Issue
Block a user