update 基本完成质量管理和基础资料

This commit is contained in:
2022-08-18 09:01:06 +08:00
parent a15e78dcaf
commit 93b401071a
4 changed files with 76 additions and 29 deletions

View File

@@ -6,8 +6,8 @@
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button @click="test()">test</el-button>
<el-button v-if="$hasPermission('monitoring:equipment:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button @click="exportHandle()">导出</el-button>
</el-form-item>
</el-form>
@@ -163,7 +163,7 @@ const addOrUpdateConfigs = {
{ prop: 'createTime', name: '创建时间' },
{ prop: 'attrName', name: '属性名称', formField: true },
{ prop: 'attrValue', name: '属性值', formField: true },
{ prop: 'operate', name: '操作', options: ['edit', 'delete'] }
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
]
},
operations: [
@@ -272,31 +272,54 @@ export default {
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
// 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)
}
},
test() {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init()
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) {
addOrUpdateHandle(id, isdetail = false) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
this.$refs.addOrUpdate.init(id, isdetail)
})
// this.$router.push({
// name: 'monitoring-equipmentAdd',