update report-detail

This commit is contained in:
g7hoo 2022-08-22 10:28:58 +08:00
parent 37df2abcc5
commit a30e2e1ae2
3 changed files with 59 additions and 77 deletions

View File

@ -31,7 +31,7 @@
<!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.65:8080';
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.28:8080';
</script>
<% } %>
<!-- 集成测试环境 -->

View File

@ -6,7 +6,8 @@
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="$hasPermission('')" type="primary" @click="addOrUpdateHandle()">新增(跳到设计)</el-button>
<!-- <el-button v-if="$hasPermission('')" type="primary" @click="addOrUpdateHandle()">新增(跳到设计)</el-button> -->
<el-button type="primary" @click="handleAdd()">新增</el-button>
</el-form-item>
</el-form>
@ -49,82 +50,37 @@ const CategoryList = {
}
},
mounted() {
console.log(this.injectData)
this.pickedId = this.injectData[this.injectData.head.prop]
console.log('picked id : ', this.pickedId)
},
methods: {
handleChange(id) {
this.pickedId = id
this.$emit('emit-data', { id })
this.$emit('emit-data', {
type: 'change-category',
data: { id: this.injectData.id, fileName: this.injectData.fileName, name: this.injectData.name, url: this.injectData.url, categoryId: id }
})
}
},
render: function(h) {
const childOptions = []
this.injectData.head.options?.forEach(item => {
console.log('item', item)
childOptions.push(h('el-option', { props: { label: item.label, value: item.value } }, null)) // TODO<===
console.log('item', item.value)
childOptions.push(h('el-option', { props: { label: item.label, value: item.value } }, null))
})
return h('el-select', { on: { change: this.handleChange } }, childOptions)
return h('el-select', { props: { value: this.pickedId }, on: { change: this.handleChange } }, childOptions)
}
}
const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/equipmentPlcConnect',
fields: [
{ name: 'equipmentId', label: '设备', required: true, type: 'select', options: [] },
{ name: 'plcId', label: 'PLC名称', required: true, type: 'select', options: [] }
],
infoUrl: '/monitoring/reportSheet',
fields: [{ name: 'fileName', label: '报表名称', required: true, span: 24 }],
operations: [
{ name: 'cancel', url: true, showAlways: true },
{ name: 'save', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: false },
{ name: 'update', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: true }
],
subtable: {
title: 'PLC采集参数',
url: '/monitoring/equipmentPlcParam',
relatedField: 'plcConId',
tableConfigs: [
{ type: 'index', name: '序号' },
// { prop: 'plcConId', name: 'plcID' },
{ prop: 'paramCode', name: '参数编码', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
{ prop: 'paramName', name: '参数名称', formField: true, rules: [{ required: true, message: '必填', trigger: 'blur' }] },
{ prop: 'paramAddress', name: '参数地址', formField: true },
{ prop: 'description', name: '描述', formField: true },
{
prop: 'enabled',
name: '启用状态',
filter: val => ['停用', '启用'][+val],
// filter: val => ({0:'', 1:''}[+val]),
rules: [{ required: true, message: '必填', trigger: 'blur' }],
formField: true,
formType: 'select',
formOptions: [
{ value: 0, label: '停用' },
{ value: 1, label: '启用' }
{ name: 'save', url: '/monitoring/reportSheet', permission: '', showOnEdit: false },
{ name: 'update', url: '/monitoring/reportSheet', permission: '', showOnEdit: true }
]
},
{ prop: 'remark', name: '备注', formField: true },
// { prop: 'createTime', name: '' },
{
prop: 'collection',
name: '是否采集',
filter: val => ['不采集', '采集'][+val],
rules: [{ required: true, message: '必填', trigger: 'blur' }],
formField: true,
formType: 'select',
formOptions: [
{ value: 0, label: '不采集' },
{ value: 1, label: '采集' }
]
},
// { prop: 'collectionCycle', name: 's 使' },
// { prop: 'reportingCycle', name: 's 使' },
// { prop: 'reportingMethod', name: ' 使' },
// { prop: 'reportingCode', name: ' 使' },
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
]
}
}
export default {
@ -149,46 +105,66 @@ export default {
BaseTable
},
activated() {
this.dataList.splice(0)
this.getAllCategories()
this.getDataList()
},
computed: {
trueTableConfigs() {}
},
computed: {},
methods: {
getAllCategories() {
axios.get(axios.adornUrl('/monitoring/reportSheetCategory/page')).then(({ data: res }) => {
if (res.data && res.data.list) {
const categories = res.data.list.map(item => ({ label: item.name, value: item.id }))
console.log('categories', categories)
this.tableConfigs = [
{ type: 'index', name: '序号' },
{ prop: 'createTime', name: '创建时间', width: 200 },
{ prop: 'fileName', name: '报表名称' },
{ prop: 'category', name: '报表分类', subcomponent: CategoryList, options: categories },
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['preview', 'design', 'edit', 'delete'] }
]
}
})
},
handleOperations({ type, data: id }) {
handleOperations({ type, data }) {
let id = data
switch (type) {
case 'change-category':
return this.updateCategory(data)
case 'edit':
return this.addOrUpdateHandle(id)
case 'delete':
return this.deleteHandle(id)
}
},
updateCategory({ id, fileName, categoryId }) {
this.$http({
url: this.$http.adornUrl('/monitoring/reportSheet'),
method: 'put',
data: {
id,
fileName,
category: categoryId
}
}).then(({ data: res }) => {
this.$message.success('修改成功!')
})
},
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/reportSheet/page'),
method: 'get',
params: this.$http.adornParams({
const queries = {
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
})
}
if (this.$route.query.category) {
queries['category'] = this.$route.query.category
}
this.$http({
url: this.$http.adornUrl('/monitoring/reportSheet/page'),
method: 'get',
params: this.$http.adornParams(queries)
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.data.list
@ -215,8 +191,14 @@ export default {
selectionChangeHandle(val) {
this.dataListSelections = val
},
// /
// -
handleAdd() {
this.$router.push({
name: 'monitoring-reportDesign'
})
},
addOrUpdateHandle(id) {
console.log('edit:', id)
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)

View File

@ -58,7 +58,7 @@ export default {
this.$router.push({
name: 'monitoring-reportDetail',
query: {
sortId: id
category: id
}
})
}