This commit is contained in:
g7hoo 2022-10-09 11:31:54 +08:00
parent 5a08d8c1dd
commit 1047dd78ec
8 changed files with 40 additions and 12 deletions

View File

@ -113,6 +113,7 @@
import CKEditor from 'ckeditor4-vue' import CKEditor from 'ckeditor4-vue'
import AttrForm from '../AttrForm' import AttrForm from '../AttrForm'
import { pick } from 'lodash/object' import { pick } from 'lodash/object'
import { pick as __pick } from '@/utils/filters'
import i18n from '@/i18n' import i18n from '@/i18n'
// for i18n // for i18n
const title = { const title = {
@ -344,6 +345,11 @@ export default {
}, },
getPlaceholder(n, c) { getPlaceholder(n, c) {
if (this.isDetail) {
/** 如果是详情,就不展示 提示文本 */
return ''
}
const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]
if (opt) { if (opt) {
// if opt is valid // if opt is valid
@ -392,9 +398,10 @@ export default {
}).then(({ data: res }) => { }).then(({ data: res }) => {
if (res && res.code === 0) { if (res && res.code === 0) {
const dataFormKeys = Object.keys(this.dataForm) const dataFormKeys = Object.keys(this.dataForm)
// console.log('keys ===> ', dataFormKeys)
// console.log('data form keys: ', dataFormKeys, pick(res.data, 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 // LABEL: FILE_RELATED
/** 对文件下载进行分流 */ /** 对文件下载进行分流 */
this.fileList = {} this.fileList = {}

View File

@ -10,3 +10,15 @@ export const dictFilter = dictTypeId => {
export const timeFilter = (val) => { export const timeFilter = (val) => {
return moment(val).format('YYYY-MM-DD HH:mm:ss') 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
}

View File

@ -120,6 +120,7 @@ const addOrUpdateConfigs = {
{ {
name: 'sort', name: 'sort',
label: i18n.t('ws.sort'), label: i18n.t('ws.sort'),
type: 'number',
rules: [{ type: 'number', message: i18n.t('hints.number'), trigger: 'blur', transform: val => Number(val) }] rules: [{ type: 'number', message: i18n.t('hints.number'), trigger: 'blur', transform: val => Number(val) }]
}, },
{ {
@ -307,8 +308,8 @@ export default {
// destroy dialog // destroy dialog
handleDestroyDialog() { handleDestroyDialog() {
setTimeout(() => { setTimeout(() => {
this.addOrUpdateVisible= false this.addOrUpdateVisible = false
}, /** after dialog animated */ 200); }, /** after dialog animated */ 200)
}, },
// 线 // 线
getPlList() { getPlList() {

View File

@ -78,7 +78,7 @@ const tableConfigStatic = [
] ]
const tableConfigDynamic = [ const tableConfigDynamic = [
{ type: 'index', width: 100, name: i18n.t('index') }, { type: 'index', width: 100, name: i18n.t('index') },
{ name: i18n.t('inspect.type'), prop: 'inspectionContent' }, { name: i18n.t('inspect.det'), prop: 'inspectionContent' },
/** dynamic */ /** dynamic */
{ name: i18n.t('inspect.typetotal'), prop: '' }, { name: i18n.t('inspect.typetotal'), prop: '' },
{ name: i18n.t('inspect.rate'), prop: '' } { name: i18n.t('inspect.rate'), prop: '' }
@ -282,7 +282,7 @@ export default {
this.tableConfigDynamic = [ this.tableConfigDynamic = [
{ type: 'index', width: 100, name: i18n.t('index') }, { type: 'index', width: 100, name: i18n.t('index') },
{ name: i18n.t('inspect.type'), prop: 'inspectionContent' }, { name: i18n.t('inspect.det'), prop: 'inspectionContent' },
...subProps, ...subProps,
{ name: i18n.t('inspect.typetotal'), prop: 'sumInput' }, { name: i18n.t('inspect.typetotal'), prop: 'sumInput' },
{ name: i18n.t('inspect.rate'), prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') } { name: i18n.t('inspect.rate'), prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') }

View File

@ -55,7 +55,7 @@ const addOrUpdateConfigs = {
fields: [ fields: [
{ name: 'typeId', label: i18n.t('inspect.type'), required: true, type: 'select', options: [] }, { name: 'typeId', label: i18n.t('inspect.type'), required: true, type: 'select', options: [] },
{ name: 'content', label: i18n.t('inspect.det'), required: true }, { 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' 'remark'
], ],
operations: [ operations: [

View File

@ -42,7 +42,15 @@
<!-- <el-button type="text" v-if="!showAttrForm" @click="addEq">{{ $t('add') }}</el-button> --> <!-- <el-button type="text" v-if="!showAttrForm" @click="addEq">{{ $t('add') }}</el-button> -->
</h3> </h3>
<div class="table" v-if="!showAttrForm"> <div class="table" v-if="!showAttrForm">
<base-table :page="page" :size="limit" :data="eqList" :table-head-configs="tableProps" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="page"
:size="limit"
:data="eqList"
:table-head-configs="tableProps"
:max-height="calcMaxHeight(8)"
@operate-event="handleOperations"
@refreshDataList="getDataList"
/>
<el-pagination <el-pagination
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@current-change="currentChangeHandle" @current-change="currentChangeHandle"
@ -78,7 +86,7 @@ const tableProps = [
name: i18n.t('index') name: i18n.t('index')
}, },
{ name: i18n.t('eq.name'), prop: 'equipmentName' }, { name: i18n.t('eq.name'), prop: 'equipmentName' },
{ name: i18n.t('dept.sort'), prop: 'sort' }, { name: i18n.t('dept.sort'), prop: 'sort' }
// { // {
// name: i18n.t('handle'), // name: i18n.t('handle'),
// prop: 'operations', // prop: 'operations',