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') { %> <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script> <script>
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.65:8080'; window.SITE_CONFIG['apiURL'] = 'http://192.168.1.28:8080';
</script> </script>
<% } %> <% } %>
<!-- 集成测试环境 --> <!-- 集成测试环境 -->

View File

@ -6,7 +6,8 @@
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button @click="getDataList()">查询</el-button> <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-item>
</el-form> </el-form>
@ -49,82 +50,37 @@ const CategoryList = {
} }
}, },
mounted() { mounted() {
console.log(this.injectData)
this.pickedId = this.injectData[this.injectData.head.prop] this.pickedId = this.injectData[this.injectData.head.prop]
console.log('picked id : ', this.pickedId)
}, },
methods: { methods: {
handleChange(id) { handleChange(id) {
this.pickedId = 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) { render: function(h) {
const childOptions = [] const childOptions = []
this.injectData.head.options?.forEach(item => { this.injectData.head.options?.forEach(item => {
console.log('item', item) console.log('item', item.value)
childOptions.push(h('el-option', { props: { label: item.label, value: item.value } }, null)) // TODO<=== 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 = { const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/equipmentPlcConnect', infoUrl: '/monitoring/reportSheet',
fields: [ fields: [{ name: 'fileName', label: '报表名称', required: true, span: 24 }],
{ name: 'equipmentId', label: '设备', required: true, type: 'select', options: [] },
{ name: 'plcId', label: 'PLC名称', required: true, type: 'select', options: [] }
],
operations: [ operations: [
{ name: 'cancel', url: true, showAlways: true }, { name: 'cancel', url: true, showAlways: true },
{ name: 'save', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: false }, { name: 'save', url: '/monitoring/reportSheet', permission: '', showOnEdit: false },
{ name: 'update', url: '/monitoring/equipmentPlcConnect', permission: '', showOnEdit: true } { name: 'update', url: '/monitoring/reportSheet', 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: '启用' }
] ]
},
{ 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 { export default {
@ -149,46 +105,66 @@ export default {
BaseTable BaseTable
}, },
activated() { activated() {
this.dataList.splice(0)
this.getAllCategories() this.getAllCategories()
this.getDataList() this.getDataList()
}, },
computed: { computed: {},
trueTableConfigs() {}
},
methods: { methods: {
getAllCategories() { getAllCategories() {
axios.get(axios.adornUrl('/monitoring/reportSheetCategory/page')).then(({ data: res }) => { axios.get(axios.adornUrl('/monitoring/reportSheetCategory/page')).then(({ data: res }) => {
if (res.data && res.data.list) { if (res.data && res.data.list) {
const categories = res.data.list.map(item => ({ label: item.name, value: item.id })) const categories = res.data.list.map(item => ({ label: item.name, value: item.id }))
console.log('categories', categories)
this.tableConfigs = [ this.tableConfigs = [
{ type: 'index', name: '序号' }, { type: 'index', name: '序号' },
{ prop: 'createTime', name: '创建时间', width: 200 },
{ prop: 'fileName', name: '报表名称' }, { prop: 'fileName', name: '报表名称' },
{ prop: 'category', name: '报表分类', subcomponent: CategoryList, options: categories }, { 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) { switch (type) {
case 'change-category':
return this.updateCategory(data)
case 'edit': case 'edit':
return this.addOrUpdateHandle(id) return this.addOrUpdateHandle(id)
case 'delete': case 'delete':
return this.deleteHandle(id) 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() { getDataList() {
this.dataListLoading = true this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/reportSheet/page'), const queries = {
method: 'get',
params: this.$http.adornParams({
page: this.pageIndex, page: this.pageIndex,
limit: this.pageSize, limit: this.pageSize,
key: this.dataForm.key 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 }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.data.list this.dataList = data.data.list
@ -215,8 +191,14 @@ export default {
selectionChangeHandle(val) { selectionChangeHandle(val) {
this.dataListSelections = val this.dataListSelections = val
}, },
// / // -
handleAdd() {
this.$router.push({
name: 'monitoring-reportDesign'
})
},
addOrUpdateHandle(id) { addOrUpdateHandle(id) {
console.log('edit:', id)
this.addOrUpdateVisible = true this.addOrUpdateVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id) this.$refs.addOrUpdate.init(id)

View File

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