diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 3c71bd9..9d8177e 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 = { @@ -147,13 +148,6 @@ export default { components: { AttrForm }, props: { configs: { - /** - * TODO: 定义及使用方式,应改用README.md文件记录 - * type: 'dialog' | 'drawer' | 'page' - * fields: Array - * - fields.object: { name, type: 'number'|'textarea'|'select'|'date'|.., required: boolean, validator: boolean(是否需要验证), [options]: any[], api: string(自动获取数据的接口,一般为getcode接口)} - * operations: Array[object], 操作名和对应的接口地址,还有permission(如,sys:dict:update) - */ type: Object, default: () => ({}) // 此处省去类型检查,使用者自行注意就好 } @@ -280,7 +274,8 @@ export default { const requiredRule = { required: true, message: i18n.t('validate.required'), - trigger: 'change' + // trigger: 'change' + trigger: 'blur' } /** 检查是否已经存在该字段的规则 */ const exists = this.dataFormRules[item.name] || null @@ -351,6 +346,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 @@ -399,9 +399,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 = {} @@ -533,7 +534,7 @@ export default { } break case 'cancel': - this.visible = false + this.handleClose() // add more.. } }, diff --git a/src/i18n/en.js b/src/i18n/en.js index c90a580..5a42fed 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -35,6 +35,7 @@ t.routes['报表设计'] = 'Report Design' t.routes['报表预览'] = 'Report Preview' t.routes['质量检测基础数据'] = 'Quality Inspection Basic Data' t.routes['当前检测数据'] = 'Current Inspection Data' +t.routes['检测统计数据'] = 'Statistics Data' t.routes['质量检查信息记录'] = 'Quality Inspection Records' t.routes['用户管理'] = 'User Management' t.routes['部门管理'] = 'Department Management' @@ -232,7 +233,7 @@ t.inspect.typetotal = 'Total Inspection Types' t.inspect.typename = 'Inspection Type' t.inspect.typecode = 'Inspection Code' t.inspect.ioTotal = 'Data of input/output and total inspections' -t.inspect.plTotal = 'Inspection types per line' +t.inspect.plTotal = 'Inspection contents in each line' t.inspect.inTotal = 'Up Sum' t.inspect.outTotal = 'Down Sum' t.inspect.checkTotal = 'Total Inspections' diff --git a/src/i18n/zh-CN.js b/src/i18n/zh-CN.js index 402ecce..4cbf1a4 100644 --- a/src/i18n/zh-CN.js +++ b/src/i18n/zh-CN.js @@ -36,6 +36,7 @@ t.routes['报表设计'] = '报表设计' t.routes['报表预览'] = '报表预览' t.routes['质量检测基础数据'] = '质量检测基础数据' t.routes['当前检测数据'] = '当前检测数据' +t.routes['检测统计数据'] = '检测统计数据' t.routes['质量检查信息记录'] = '质量检查信息记录' t.routes['用户管理'] = '用户管理' t.routes['部门管理'] = '部门管理' @@ -234,7 +235,7 @@ t.inspect.typetotal = '检测类型总数' t.inspect.typename = '检测类型名称' t.inspect.typecode = '检测类型编码' t.inspect.ioTotal = '上下片及检测总数统计' -t.inspect.plTotal = '各产线检测类型统计' +t.inspect.plTotal = '各产线检测内容统计' t.inspect.inTotal = '上片总数' t.inspect.outTotal = '下片总数' t.inspect.checkTotal = '检测总数' 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/main-navbar.vue b/src/views/main-navbar.vue index 7215699..442f231 100644 --- a/src/views/main-navbar.vue +++ b/src/views/main-navbar.vue @@ -1,36 +1,20 @@