This commit is contained in:
g7hoo 2022-10-09 16:45:03 +08:00
parent 089a6517d3
commit b9ac64ab13
10 changed files with 137 additions and 67 deletions

View File

@ -274,7 +274,8 @@ export default {
const requiredRule = { const requiredRule = {
required: true, required: true,
message: i18n.t('validate.required'), message: i18n.t('validate.required'),
trigger: 'change' // trigger: 'change'
trigger: 'blur'
} }
/** 检查是否已经存在该字段的规则 */ /** 检查是否已经存在该字段的规则 */
const exists = this.dataFormRules[item.name] || null const exists = this.dataFormRules[item.name] || null
@ -398,10 +399,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('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)) console.log('pick(res.data, dataFormKeys) ===> ', __pick(res.data, dataFormKeys))
// LABEL: FILE_RELATED // LABEL: FILE_RELATED
/** 对文件下载进行分流 */ /** 对文件下载进行分流 */
this.fileList = {} this.fileList = {}

View File

@ -92,7 +92,7 @@ const addOrUpdateConfigs = {
infoUrl: '/monitoring/equipment', infoUrl: '/monitoring/equipment',
fields: [ fields: [
{ name: 'name', label: i18n.t('eq.name'), required: true }, { name: 'name', label: i18n.t('eq.name'), required: true },
{ name: 'code', label: i18n.t('eq.code'), api: '/monitoring/equipment/getCode' }, { name: 'code', label: i18n.t('eq.code'), required: true, api: '/monitoring/equipment/getCode' },
{ name: 'enName', label: i18n.t('enname') }, { name: 'enName', label: i18n.t('enname') },
{ name: 'abbr', label: i18n.t('abbr') }, { name: 'abbr', label: i18n.t('abbr') },
{ {

View File

@ -10,7 +10,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
: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"
@ -52,7 +60,7 @@ const tableConfigs = [
const addOrUpdateConfigs = { const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/equipmentGroup', infoUrl: '/monitoring/equipmentGroup',
fields: [{ name: 'name', label: i18n.t('eq.groupname') }, { name: 'code', label: i18n.t('eq.groupcode') }, 'remark'], fields: [{ name: 'name', required: true, label: i18n.t('eq.groupname') }, { name: 'code', required: true, label: i18n.t('eq.groupcode') }, 'remark'],
operations: [ operations: [
{ name: 'cancel', showAlways: true }, { name: 'cancel', showAlways: true },
{ name: 'save', url: '/monitoring/equipmentGroup', permission: 'monitoring:equipmentgroup:save', showOnEdit: false }, { name: 'save', url: '/monitoring/equipmentGroup', permission: 'monitoring:equipmentgroup:save', showOnEdit: false },
@ -89,8 +97,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)
}, },
// //
getDataList() { getDataList() {

View File

@ -10,7 +10,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
: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"
@ -52,8 +60,8 @@ const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/equipmentType', infoUrl: '/monitoring/equipmentType',
fields: [ fields: [
{ name: 'name', label: i18n.t('eq.type') }, { name: 'name', required: true, label: i18n.t('eq.type') },
{ name: 'code', label: i18n.t('eq.typecode'), api: '/monitoring/equipmentType/getCode' }, { name: 'code', required: true, label: i18n.t('eq.typecode'), api: '/monitoring/equipmentType/getCode' },
{ name: 'parentId', label: i18n.t('eq.parent'), type: 'cascader', props: { label: 'name', value: 'id', checkStrictly: true, emitPath: false }, options: [] }, { name: 'parentId', label: i18n.t('eq.parent'), type: 'cascader', props: { label: 'name', value: 'id', checkStrictly: true, emitPath: false }, options: [] },
'remark' 'remark'
], ],
@ -109,8 +117,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)
}, },
// //
getTreeEquipmentType() { getTreeEquipmentType() {

View File

@ -10,7 +10,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
: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"
@ -53,9 +61,10 @@ const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/factory', infoUrl: '/monitoring/factory',
fields: [ fields: [
'name', { name: 'name', required: true },
{ {
name: 'code', name: 'code',
required: true,
api: '/monitoring/factory/getCode' api: '/monitoring/factory/getCode'
}, },
{ {
@ -102,8 +111,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)
}, },
// //
getDataList() { getDataList() {

View File

@ -69,11 +69,13 @@ const addOrUpdateConfigs = {
fields: [ fields: [
// 'name', // 'name',
{ {
name: 'name' name: 'name',
required: true
// label: i18n.t('pl.name') // label: i18n.t('pl.name')
}, },
{ {
name: 'code', name: 'code',
required: true,
// label: i18n.t('pl.code'), // label: i18n.t('pl.code'),
api: '/monitoring/product/getCode' api: '/monitoring/product/getCode'
}, },
@ -183,7 +185,7 @@ export default {
handleDestroyDialog() { handleDestroyDialog() {
setTimeout(() => { setTimeout(() => {
this.showbasedialog = false this.showbasedialog = false
}, /** after dialog animated */ 200); }, /** after dialog animated */ 200)
}, },
addOrEdit(id) { addOrEdit(id) {
this.showbasedialog = true this.showbasedialog = true

View File

@ -10,7 +10,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
: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"
@ -55,8 +63,8 @@ const addOrUpdateConfigs = {
infoUrl: '/monitoring/productionLine', infoUrl: '/monitoring/productionLine',
fields: [ fields: [
// 'name', // 'name',
{ name: 'name', label: i18n.t('pl.name') }, { name: 'name', label: i18n.t('pl.name'), required: true },
{ name: 'code', label: i18n.t('pl.code'), api: '/monitoring/productionLine/getCode' }, { name: 'code', label: i18n.t('pl.code'), required: true, api: '/monitoring/productionLine/getCode' },
{ {
name: 'factoryId', name: 'factoryId',
required: true, required: true,
@ -114,8 +122,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)
}, },
// //
getFactoryList() { getFactoryList() {

View File

@ -1,16 +1,29 @@
<template> <template>
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="currentChangeHandle(1)"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="currentChangeHandle(1)">
<!-- <el-form-item> <el-form-item>
<el-input v-model="dataForm.key" :placeholder="$t('parameter')" clearable></el-input> <el-select v-model="dataForm.lineId" :placeholder="$t('pl.title')" clearable filterable>
</el-form-item> --> <el-option v-for="pl in plList" :key="pl.value" :value="pl.value" :label="pl.label" />
</el-select>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.key" :placeholder="$t('inspect.det')" clearable></el-input>
</el-form-item>
<el-form-item> <el-form-item>
<el-button @click="currentChangeHandle(1)">{{ $t('query') }}</el-button> <el-button @click="currentChangeHandle(1)">{{ $t('query') }}</el-button>
<el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> <el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
:max-height="calcMaxHeight(8)"
@operate-event="handleOperations"
@refreshDataList="getDataList"
/>
<el-pagination <el-pagination
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@ -71,9 +84,9 @@ const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/qualityInspectionRecord', infoUrl: '/monitoring/qualityInspectionRecord',
fields: [ fields: [
{ name: 'checkTime', label: i18n.t('inspect.time'), type: 'date', props: { style: 'width: 100%', type: 'datetime' }, placeholder: i18n.t('hints.checktime') }, { name: 'checkTime', required: true, label: i18n.t('inspect.time'), type: 'date', props: { style: 'width: 100%', type: 'datetime' }, placeholder: i18n.t('hints.checktime') },
{ name: 'productionId', label: i18n.t('pl.title'), type: 'select', options: [] }, { name: 'productionId', required: true, label: i18n.t('pl.title'), type: 'select', options: [] },
{ name: 'sectionId', label: i18n.t('ws.title'), type: 'select', options: [] }, { name: 'sectionId', required: true, label: i18n.t('ws.title'), type: 'select', options: [] },
{ {
name: 'source', name: 'source',
label: i18n.t('source'), label: i18n.t('source'),
@ -83,7 +96,7 @@ const addOrUpdateConfigs = {
{ value: 2, label: i18n.t('auto') } { value: 2, label: i18n.t('auto') }
] ]
}, },
{ name: 'inspectionDetId', label: i18n.t('inspect.det'), type: 'select', options: [] }, { name: 'inspectionDetId', required: true, label: i18n.t('inspect.det'), type: 'select', options: [] },
{ name: 'checkPerson', label: i18n.t('inspect.people') }, { name: 'checkPerson', label: i18n.t('inspect.people') },
{ name: 'explainText', label: i18n.t('desc') }, { name: 'explainText', label: i18n.t('desc') },
'remark' 'remark'
@ -102,8 +115,10 @@ export default {
addOrUpdateConfigs, addOrUpdateConfigs,
tableConfigs, tableConfigs,
dataForm: { dataForm: {
key: '' key: '',
lineId: ''
}, },
plList: [],
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
@ -127,8 +142,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)
}, },
// handle // handle
async handleSelectChange({ name, id }) { async handleSelectChange({ name, id }) {
@ -158,18 +173,14 @@ export default {
// 线 // 线
getProductLines() { getProductLines() {
this.$http({ this.$http({
url: this.$http.adornUrl('/monitoring/productionLine/page'), url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get', method: 'get'
params: this.$http.adornParams({
// page: this.pageIndex,
// limit: this.pageSize,
// key: this.dataForm.key
})
}).then(({ data: res }) => { }).then(({ data: res }) => {
const plOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'productionId') const plOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'productionId')
if (plOpt) { if (plOpt) {
plOpt.options = res.data.list.map(item => ({ value: item.id, label: item.name })) || [] plOpt.options = res.data.map(item => ({ value: item.id, label: item.name })) || []
} }
this.plList = res.data.map(item => ({ value: item.id, label: item.name })) || []
}) })
}, },
// //
@ -203,14 +214,22 @@ export default {
getDataList() { getDataList() {
this.addOrUpdateVisible = false this.addOrUpdateVisible = false
this.dataListLoading = true this.dataListLoading = true
const queryParams = {
page: this.pageIndex,
limit: this.pageSize
}
if (this.dataForm.key) {
queryParams['key'] = this.dataForm.key
}
if (this.dataForm.lineId) {
queryParams['lineId'] = this.dataForm.lineId
}
this.$http({ this.$http({
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/page'), url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/page'),
method: 'get', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams(queryParams)
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
})
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.data.list this.dataList = data.data.list

View File

@ -10,7 +10,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> <base-table
:page="pageIndex"
:size="pageSize"
:data="dataList"
:table-head-configs="tableConfigs"
: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"
@ -54,8 +62,8 @@ const addOrUpdateConfigs = {
type: 'dialog', type: 'dialog',
infoUrl: '/monitoring/workshopSection', infoUrl: '/monitoring/workshopSection',
fields: [ fields: [
{ name: 'name', label: i18n.t('ws.name') }, { name: 'name', required: true, label: i18n.t('ws.name') },
{ name: 'code', label: i18n.t('ws.code'), api: '/monitoring/workshopSection/getCode' }, { name: 'code', required: true, label: i18n.t('ws.code'), api: '/monitoring/workshopSection/getCode' },
{ name: 'productionLineId', label: i18n.t('ws.belong'), type: 'select', options: [] }, { name: 'productionLineId', label: i18n.t('ws.belong'), type: 'select', options: [] },
'description', 'description',
'remark' 'remark'
@ -99,8 +107,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)
}, },
// 线 // 线
getProductLine() { getProductLine() {

View File

@ -122,9 +122,12 @@ export default {
// //
remark: '' remark: ''
}, },
dataFormRules: {
name: [{ required: true, message: i18n.t('validate.required'), trigger: 'blur' }],
code: [{ required: true, message: i18n.t('validate.required'), trigger: 'blur' }]
},
limit: 5, limit: 5,
page: 1, page: 1,
dataFormRules: {},
showAttrForm: false showAttrForm: false
} }
}, },
@ -287,20 +290,24 @@ export default {
} }
}, },
handleCreateOrUpdate() { handleCreateOrUpdate() {
this.$http({ this.$refs['dataForm'].validate(valid => {
url: this.$http.adornUrl('/monitoring/workshopSection'), if (valid) {
method: this.dataForm.id ? 'put' : 'post', this.$http({
data: { url: this.$http.adornUrl('/monitoring/workshopSection'),
...this.dataForm method: this.dataForm.id ? 'put' : 'post',
data: {
...this.dataForm
}
}).then(({ data: res }) => {
this.$message.success({
message: i18n.t('prompt.success'),
onClose: () => {
this.$emit('refreshDataList')
this.visible = false
}
})
})
} }
}).then(({ data: res }) => {
this.$message.success({
message: i18n.t('prompt.success'),
onClose: () => {
this.$emit('refreshDataList')
this.visible = false
}
})
}) })
} }
} }