From 37df2abcc58f57517feae231dc20e7e84e008f66 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Fri, 19 Aug 2022 17:02:38 +0800 Subject: [PATCH] update --- src/views/modules/monitoring/reportDetail.vue | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/src/views/modules/monitoring/reportDetail.vue b/src/views/modules/monitoring/reportDetail.vue index 9a3dd82..ceb0b4d 100644 --- a/src/views/modules/monitoring/reportDetail.vue +++ b/src/views/modules/monitoring/reportDetail.vue @@ -32,46 +32,42 @@ import AddOrUpdate from '@/components/base-dialog/addOrUpdate' import BaseTable from '@/components/base-table' import TableOperateComponent from '@/components/base-table/components/operationComponent' +import axios from '@/utils/request' const CategoryList = { - name: 'Category List', + name: 'CategoryList', props: { - options: { - type: Array, - default: () => [] + injectData: { + type: Object, + required: true, + default: () => ({}) } }, + data() { + return { + pickedId: null + } + }, + mounted() { + 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 }) } }, render: function(h) { const childOptions = [] - this.options.forEach(item => { - childOptions.push(h('el-option', { props: { label: item.label, value: item.value } }, null)) + this.injectData.head.options?.forEach(item => { + console.log('item', item) + childOptions.push(h('el-option', { props: { label: item.label, value: item.value } }, null)) // TODO:<=== 去他妈的 }) return h('el-select', { on: { change: this.handleChange } }, childOptions) } } -const tableConfigs = [ - { type: 'index', name: '序号' }, - { prop: 'lineName', name: '产线' }, - { prop: 'sectionName', name: '工段' }, - { prop: 'equName', name: '设备' }, - { prop: 'equCode', name: '设备编码' }, - { prop: 'plcCode', name: 'PLC编码' }, - { prop: 'plcName', name: 'PLC名称' }, - { prop: 'plcIp', name: 'PLC IP' }, - { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } -] - -const UnitDictTypeId = '1557173812109242370' -const getUnitList = function() { - const dl = JSON.parse(localStorage.getItem('dictList'))[UnitDictTypeId] || [] - return dl.map(item => ({ label: item.dictLabel, value: item.dictValue })) -} const addOrUpdateConfigs = { type: 'dialog', infoUrl: '/monitoring/equipmentPlcConnect', @@ -135,7 +131,7 @@ export default { data() { return { addOrUpdateConfigs, - tableConfigs, + tableConfigs: [], dataForm: { key: '' }, @@ -153,9 +149,27 @@ export default { BaseTable }, activated() { + this.getAllCategories() this.getDataList() }, + computed: { + trueTableConfigs() {} + }, 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: 'fileName', name: '报表名称' }, + { prop: 'category', name: '报表分类', subcomponent: CategoryList, options: categories }, + { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } + ] + } + }) + }, handleOperations({ type, data: id }) { switch (type) { case 'edit':