From 1047dd78ec44111315c95b4e26cd40b60d2fa8a7 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Sun, 9 Oct 2022 11:31:54 +0800 Subject: [PATCH] update --- src/components/base-dialog/addOrUpdate/index.vue | 11 +++++++++-- src/utils/filters.js | 12 ++++++++++++ src/views/modules/monitoring/equipment.vue | 5 +++-- .../monitoring/qualityInspectionCurrent.vue | 4 ++-- .../modules/monitoring/qualityInspectionDet.vue | 2 +- .../monitoring/reportSheet-add-or-update.vue | 2 +- .../reportSheetCategory-add-or-update.vue | 2 +- .../modules/monitoring/workshopSectionDialog.vue | 14 +++++++++++--- 8 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 4663338..c6a8ea0 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -113,6 +113,7 @@ import CKEditor from 'ckeditor4-vue' import AttrForm from '../AttrForm' import { pick } from 'lodash/object' +import { pick as __pick } from '@/utils/filters' import i18n from '@/i18n' // 标题 for i18n const title = { @@ -344,6 +345,11 @@ export default { }, getPlaceholder(n, c) { + if (this.isDetail) { + /** 如果是详情,就不展示 提示文本 */ + return '' + } + const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] if (opt) { // if opt is valid @@ -392,9 +398,10 @@ export default { }).then(({ data: res }) => { if (res && res.code === 0) { const dataFormKeys = Object.keys(this.dataForm) + // console.log('keys ===> ', dataFormKeys) // console.log('data form keys: ', dataFormKeys, pick(res.data, dataFormKeys)) - this.dataForm = pick(res.data, dataFormKeys) - + this.dataForm = __pick(res.data, dataFormKeys) + // console.log('pick(res.data, dataFormKeys) ===> ', __pick(res.data, dataFormKeys)) // LABEL: FILE_RELATED /** 对文件下载进行分流 */ this.fileList = {} diff --git a/src/utils/filters.js b/src/utils/filters.js index a41e535..e7f1c28 100644 --- a/src/utils/filters.js +++ b/src/utils/filters.js @@ -10,3 +10,15 @@ export const dictFilter = dictTypeId => { export const timeFilter = (val) => { return moment(val).format('YYYY-MM-DD HH:mm:ss') } + +export const pick = (obj, paths) => { + let result = {} + paths.forEach(key => { + if (obj.hasOwnProperty(key)) { + result[key] = obj[key]; + } else { + result[key] = null + } + }) + return result +} \ No newline at end of file diff --git a/src/views/modules/monitoring/equipment.vue b/src/views/modules/monitoring/equipment.vue index 359407e..24384b7 100644 --- a/src/views/modules/monitoring/equipment.vue +++ b/src/views/modules/monitoring/equipment.vue @@ -120,6 +120,7 @@ const addOrUpdateConfigs = { { name: 'sort', label: i18n.t('ws.sort'), + type: 'number', rules: [{ type: 'number', message: i18n.t('hints.number'), trigger: 'blur', transform: val => Number(val) }] }, { @@ -307,8 +308,8 @@ export default { // destroy dialog handleDestroyDialog() { setTimeout(() => { - this.addOrUpdateVisible= false - }, /** after dialog animated */ 200); + this.addOrUpdateVisible = false + }, /** after dialog animated */ 200) }, // 获取产线列表,用于刷新工段列表 getPlList() { diff --git a/src/views/modules/monitoring/qualityInspectionCurrent.vue b/src/views/modules/monitoring/qualityInspectionCurrent.vue index 82458fd..97e8599 100644 --- a/src/views/modules/monitoring/qualityInspectionCurrent.vue +++ b/src/views/modules/monitoring/qualityInspectionCurrent.vue @@ -78,7 +78,7 @@ const tableConfigStatic = [ ] const tableConfigDynamic = [ { type: 'index', width: 100, name: i18n.t('index') }, - { name: i18n.t('inspect.type'), prop: 'inspectionContent' }, + { name: i18n.t('inspect.det'), prop: 'inspectionContent' }, /** dynamic */ { name: i18n.t('inspect.typetotal'), prop: '' }, { name: i18n.t('inspect.rate'), prop: '' } @@ -282,7 +282,7 @@ export default { this.tableConfigDynamic = [ { type: 'index', width: 100, name: i18n.t('index') }, - { name: i18n.t('inspect.type'), prop: 'inspectionContent' }, + { name: i18n.t('inspect.det'), prop: 'inspectionContent' }, ...subProps, { name: i18n.t('inspect.typetotal'), prop: 'sumInput' }, { name: i18n.t('inspect.rate'), prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') } diff --git a/src/views/modules/monitoring/qualityInspectionDet.vue b/src/views/modules/monitoring/qualityInspectionDet.vue index f0241e7..42efbb0 100644 --- a/src/views/modules/monitoring/qualityInspectionDet.vue +++ b/src/views/modules/monitoring/qualityInspectionDet.vue @@ -55,7 +55,7 @@ const addOrUpdateConfigs = { fields: [ { name: 'typeId', label: i18n.t('inspect.type'), required: true, type: 'select', options: [] }, { name: 'content', label: i18n.t('inspect.det'), required: true }, - { name: 'code', label: i18n.t('inspect.detcode'), api: '/monitoring/qualityInspectionDet/getCode' }, + { name: 'code', label: i18n.t('inspect.code'), api: '/monitoring/qualityInspectionDet/getCode' }, 'remark' ], operations: [ diff --git a/src/views/modules/monitoring/reportSheet-add-or-update.vue b/src/views/modules/monitoring/reportSheet-add-or-update.vue index 4e63342..49d46d6 100644 --- a/src/views/modules/monitoring/reportSheet-add-or-update.vue +++ b/src/views/modules/monitoring/reportSheet-add-or-update.vue @@ -106,7 +106,7 @@ export default { } } }, - methods: { + methods: { init(id) { this.dataForm.id = id || 0 this.visible = true diff --git a/src/views/modules/monitoring/reportSheetCategory-add-or-update.vue b/src/views/modules/monitoring/reportSheetCategory-add-or-update.vue index a1e0800..718ef16 100644 --- a/src/views/modules/monitoring/reportSheetCategory-add-or-update.vue +++ b/src/views/modules/monitoring/reportSheetCategory-add-or-update.vue @@ -91,7 +91,7 @@ export default { } } }, - methods: { + methods: { init(id) { this.dataForm.id = id || 0 this.visible = true diff --git a/src/views/modules/monitoring/workshopSectionDialog.vue b/src/views/modules/monitoring/workshopSectionDialog.vue index 28adf40..b4b11d0 100644 --- a/src/views/modules/monitoring/workshopSectionDialog.vue +++ b/src/views/modules/monitoring/workshopSectionDialog.vue @@ -42,7 +42,15 @@
- +