fzq #31
@ -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>
|
||||
<% } %>
|
||||
<!-- 集成测试环境 -->
|
||||
|
@ -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: 'plc连接表ID' },
|
||||
{ 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'] }
|
||||
]
|
||||
}
|
||||
{ name: 'save', url: '/monitoring/reportSheet', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/reportSheet', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
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({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
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)
|
||||
|
@ -44,12 +44,12 @@ export default {
|
||||
method: 'get',
|
||||
params: {}
|
||||
}).then(({ data: res }) => {
|
||||
this.allNum = 0
|
||||
this.allNum = 0
|
||||
if (res.data) {
|
||||
this.dataList = res.data
|
||||
res.data.forEach(item => {
|
||||
this.allNum += item.quantity
|
||||
})
|
||||
res.data.forEach(item => {
|
||||
this.allNum += item.quantity
|
||||
})
|
||||
} else this.dataList.splice(0)
|
||||
})
|
||||
},
|
||||
@ -58,7 +58,7 @@ export default {
|
||||
this.$router.push({
|
||||
name: 'monitoring-reportDetail',
|
||||
query: {
|
||||
sortId: id
|
||||
category: id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user