diff --git a/src/mixins/lb/basicPageMixin.js b/src/mixins/lb/basicPageMixin.js index ca1ed6e6..cfe12de6 100644 --- a/src/mixins/lb/basicPageMixin.js +++ b/src/mixins/lb/basicPageMixin.js @@ -138,7 +138,7 @@ export default { } }, handleEmitFun(val) { - console.log('emit unf', val); + console.log('[basicPageMixin handleEmitFun]', val); switch (val.action) { // 查看详情 case 'show-detail': diff --git a/src/views/specialEquipment/maintain/Record--detail.vue b/src/views/specialEquipment/maintain/Record--detail.vue new file mode 100644 index 00000000..ebfff0f8 --- /dev/null +++ b/src/views/specialEquipment/maintain/Record--detail.vue @@ -0,0 +1,421 @@ + + + + + + + diff --git a/src/views/specialEquipment/maintain/Record.vue b/src/views/specialEquipment/maintain/Record.vue index be4d1309..19dff47f 100644 --- a/src/views/specialEquipment/maintain/Record.vue +++ b/src/views/specialEquipment/maintain/Record.vue @@ -11,7 +11,6 @@ @@ -22,13 +21,13 @@ :limit="queryParams.pageSize" :table-data="list" @emitFun="handleEmitFun"> - + @clickBtn="handleTableBtnClick" /> --> @@ -60,6 +59,11 @@ + + @@ -72,21 +76,47 @@ import { deleteEqMaintainLog, exportMaintainLogExcel, } from '@/api/equipment/base/maintain/record'; +import RecordDetail from './Record--detail.vue'; const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); +const btn = { + name: 'tableBtn', + props: ['injectData'], + data() { + return {}; + }, + methods: { + handleClick() { + this.$emit('emitData', { + action: this.injectData.label, + value: this.injectData, + }); + }, + }, + render: function (h) { + return ( + + {this.injectData.name} + + ); + }, +}; + export default { name: 'SpecialEquipmentMaintainRecord', - components: { DialogForm }, + components: { DialogForm, RecordDetail }, mixins: [basicPageMixin], data() { return { + recordDetailVisible: false, searchBarKeys: [ 'maintainPlanId', 'startTime', - 'relatePlan', - 'equipmentId', - 'specialType', + 'special', + // 'relatePlan', + // 'equipmentId', + // 'specialType', ], tableBtn: [ this.$auth.hasPermi('equipment:maintain-record:update') @@ -122,99 +152,146 @@ export default { width: 110, showOverflowtooltip: true, }, + { + prop: 'planName', + label: '保养计划名称', + width: 110, + showOverflowtooltip: true, + }, + { + prop: 'departmentName', + label: '部门', + width: 110, + showOverflowtooltip: true, + }, + { + prop: 'lineName', + label: '产线名', + width: 110, + showOverflowtooltip: true, + }, + { + prop: 'planStartTime', + label: '计划开始时间', + filter: timeFilter, + minWidth: 150, + showOverflowtooltip: true, + }, + { + prop: 'planEndTime', + label: '计划结束时间', + filter: timeFilter, + minWidth: 150, + showOverflowtooltip: true, + }, { prop: 'startTime', - label: '开始时间', + label: '实际开始时间', filter: timeFilter, minWidth: 150, showOverflowtooltip: true, }, { prop: 'endTime', - label: '结束时间', + label: '实际结束时间', filter: timeFilter, minWidth: 150, showOverflowtooltip: true, }, { - prop: 'equipmentCategory', - label: '设备大类', + prop: 'relatePlan', + label: '保养计划类型', minWidth: 100, showOverflowtooltip: true, filter: (val) => - val != null ? ['-', '安全设备', '消防设备', '特种设备'][val] : '-', + val != null ? ['-', '计划型', '非计划型'][val] : '-', }, { - prop: 'equipmentName', - label: '设备名称', - minWidth: 100, - showOverflowtooltip: true, - }, - { - prop: 'maintainWorker', - label: '保养人员', - minWidth: 100, - showOverflowtooltip: true, - }, - { - prop: 'relatePlan', - label: '是否计划保养', - width: 120, - filter: (v) => (v != null ? ['', '是', '否'][v] : ''), - }, - { - prop: 'planName', - label: '保养计划名称', - minWidth: 120, - showOverflowtooltip: true, - }, - { - prop: 'maintainDuration', - label: '计划保养用时(h)', - minWidth: 130, - showOverflowtooltip: true, - }, - { prop: 'timeUsed', label: '实际保养用时(h)', minWidth: 130 }, - { - prop: 'remark', - label: '备注', - minWidth: 100, - showOverflowtooltip: true, + prop: '_detail', + label: '详情', + name: '详情', + minWidth: 60, + subcomponent: btn, }, + // { + // prop: 'equipmentCategory', + // label: '设备大类', + // minWidth: 100, + // showOverflowtooltip: true, + // filter: (val) => + // val != null ? ['-', '安全设备', '消防设备', '特种设备'][val] : '-', + // }, + // { + // prop: 'equipmentName', + // label: '设备名称', + // minWidth: 100, + // showOverflowtooltip: true, + // }, + // { + // prop: 'maintainWorker', + // label: '保养人员', + // minWidth: 100, + // showOverflowtooltip: true, + // }, + // { + // prop: 'relatePlan', + // label: '是否计划保养', + // width: 120, + // filter: (v) => (v != null ? ['', '是', '否'][v] : ''), + // }, + // { + // prop: 'planName', + // label: '保养计划名称', + // minWidth: 120, + // showOverflowtooltip: true, + // }, + // { + // prop: 'maintainDuration', + // label: '计划保养用时(h)', + // minWidth: 130, + // showOverflowtooltip: true, + // }, + // { prop: 'timeUsed', label: '实际保养用时(h)', minWidth: 130 }, + // { + // prop: 'remark', + // label: '备注', + // minWidth: 100, + // showOverflowtooltip: true, + // }, ], searchBarFormConfig: [ + // { + // type: 'select', + // label: '设备大类', + // placeholder: '请选择设备大类', + // param: 'specialType', + // onchange: true, + // selectOptions: [ + // { id: 1, name: '安全设备' }, + // { id: 2, name: '消防设备' }, + // { id: 3, name: '特种设备' }, + // ], + // filterable: true, + // defaultSelect: null + // }, + // { + // type: 'select', + // label: '设备', + // placeholder: '请选择设备', + // param: 'equipmentId', + // defaultSelect: null + // }, { type: 'select', - label: '设备大类', - placeholder: '请选择设备大类', - param: 'specialType', - onchange: true, - selectOptions: [ - { id: 1, name: '安全设备' }, - { id: 2, name: '消防设备' }, - { id: 3, name: '特种设备' }, - ], - filterable: true, - defaultSelect: null - }, - { - type: 'select', - label: '设备', - placeholder: '请选择设备', - param: 'equipmentId', - defaultSelect: null - }, - { - type: 'select', - label: '计划名称', - placeholder: '请选择计划名称', + label: '保养计划名称', + placeholder: '请选择保养计划名称', param: 'maintainPlanId', - defaultSelect: null + defaultSelect: null, }, // 开始结束时间 { type: 'datePicker', - label: '保养开始时间', + label: '实际开始时间', dateType: 'daterange', // datetimerange format: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd HH:mm:ss', @@ -223,19 +300,19 @@ export default { endPlaceholder: '结束日期', defaultTime: ['00:00:00', '23:59:59'], param: 'startTime', - defaultSelect: null + defaultSelect: null, // width: 350, }, - { - type: 'select', - label: '是否计划保养', - selectOptions: [ - { name: '是', id: 1 }, - { name: '否', id: 2 }, - ], - defaultSelect: null, - param: 'relatePlan', - }, + // { + // type: 'select', + // label: '是否计划保养', + // selectOptions: [ + // { name: '是', id: 1 }, + // { name: '否', id: 2 }, + // ], + // defaultSelect: null, + // param: 'relatePlan', + // }, { type: 'button', btnName: '查询', @@ -254,15 +331,15 @@ export default { plain: true, color: 'primary', }, - { - type: this.$auth.hasPermi('equipment:maintain-record:create') - ? 'button' - : '', - btnName: '新增', - name: 'add', - plain: true, - color: 'success', - }, + // { + // type: this.$auth.hasPermi('equipment:maintain-record:create') + // ? 'button' + // : '', + // btnName: '新增', + // name: 'add', + // plain: true, + // color: 'success', + // }, ], rows: [ [ @@ -422,12 +499,11 @@ export default { pageNo: 1, pageSize: 10, maintainPlanId: null, - maintainPlanId: null, startTime: null, - relatePlan: null, - equipmentId: null, + // relatePlan: null, + // equipmentId: null, special: true, - specialType: null, + // specialType: null, }, // 表单参数 form: {}, @@ -438,32 +514,47 @@ export default { }, created() { this.initSearchBar(); - if (this.$route.query) { - this.queryParams.specialType = - this.$route.query?.specialType ?? undefined; - this.queryParams.equipmentId = - this.$route.query?.equipmentId ?? undefined; - this.queryParams.maintainPlanId = - this.$route.query?.maintainPlanId ?? undefined; - this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined; - this.queryParams.startTime = this.$route.query?.createTime ?? undefined; - this.searchBarFormConfig[0].defaultSelect = - this.$route.query.specialType ?? undefined; - this.searchBarFormConfig[1].defaultSelect = - this.$route.query.equipmentId ?? undefined; - this.searchBarFormConfig[2].defaultSelect = - this.$route.query.maintainPlanId ?? undefined; - this.searchBarFormConfig[3].defaultSelect = - this.$route.query?.createTime ?? undefined; - this.searchBarFormConfig[4].defaultSelect = - Number(this.$route.query.relatePlan) ?? undefined; - } + // if (this.$route.query) { + // this.queryParams.specialType = + // this.$route.query?.specialType ?? undefined; + // this.queryParams.equipmentId = + // this.$route.query?.equipmentId ?? undefined; + // this.queryParams.maintainPlanId = + // this.$route.query?.maintainPlanId ?? undefined; + // this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined; + // this.queryParams.startTime = this.$route.query?.createTime ?? undefined; + // this.searchBarFormConfig[0].defaultSelect = + // this.$route.query.specialType ?? undefined; + // this.searchBarFormConfig[1].defaultSelect = + // this.$route.query.equipmentId ?? undefined; + // this.searchBarFormConfig[2].defaultSelect = + // this.$route.query.maintainPlanId ?? undefined; + // this.searchBarFormConfig[3].defaultSelect = + // this.$route.query?.createTime ?? undefined; + // this.searchBarFormConfig[4].defaultSelect = + // Number(this.$route.query.relatePlan) ?? undefined; + // } this.getList(); - if (this.$route.query.addRecord) { - this.handleAdd(); - } + // if (this.$route.query.addRecord) { + // this.handleAdd(); + // } }, methods: { + handleEmitFun({ action, value }) { + switch (action) { + case '详情': + this.recordDetailVisible = true; + this.$nextTick(() => { + this.$refs.recordDetailDrawer.show({ + id: value.id, + planMaintainWorker: value.planMaintainWorker, + maintainWorker: value.maintainWorker, + }); + }); + break; + } + }, + handleSearchBarChange({ param, value }) { if ('specialType' === param) { if (!value) { @@ -475,28 +566,29 @@ export default { ); } }, - setSearchBarEquipmentList(eqList) { - this.$set( - this.searchBarFormConfig[1], - 'selectOptions', - eqList.map((item) => ({ - name: item.name, - id: item.id, - })) - ); - }, + // setSearchBarEquipmentList(eqList) { + // this.$set( + // this.searchBarFormConfig[1], + // 'selectOptions', + // eqList.map((item) => ({ + // name: item.name, + // id: item.id, + // })) + // ); + // }, initSearchBar() { - this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { - this.allSpecialEquipments = data.filter((item) => item.special); - this.setSearchBarEquipmentList(data.filter((item) => item.special)); - }); + // this.http('/base/core-equipment/listAll', 'get').then(({ data }) => { + // this.allSpecialEquipments = data.filter((item) => item.special); + // this.setSearchBarEquipmentList(data.filter((item) => item.special)); + // }); this.http('/base/equipment-maintain-plan/page', 'get', { pageNo: 1, pageSize: 100, special: true, }).then(({ data }) => { this.$set( - this.searchBarFormConfig[2], + this.searchBarFormConfig[0], + // this.searchBarFormConfig[2], 'selectOptions', (data?.list || []).map((item) => ({ name: item.name, @@ -509,8 +601,21 @@ export default { getList() { this.loading = true; // 执行查询 - this.recv(this.queryParams).then((response) => { - this.list = response.data.list; + this.recv({ ...this.queryParams, special: true }).then((response) => { + this.list = [ + { + id: 213, + maintainOrderNumber: 123, + planName: 'hhh', + departmentName: 'asdf', + lineName: 456, + planStartTime: '2024-01-01', + planEndTime: '2024-01-01', + startTime: '2024-01-01', + endTime: '2024-01-01', + relatePlan: 1, + }, + ]; // response.data.list; this.total = response.data.total; this.loading = false; });