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

View File

@ -92,7 +92,7 @@ const addOrUpdateConfigs = {
infoUrl: '/monitoring/equipment',
fields: [
{ 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: 'abbr', label: i18n.t('abbr') },
{

View File

@ -10,7 +10,15 @@
</el-form-item>
</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
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@ -52,7 +60,7 @@ const tableConfigs = [
const addOrUpdateConfigs = {
type: 'dialog',
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: [
{ name: 'cancel', showAlways: true },
{ name: 'save', url: '/monitoring/equipmentGroup', permission: 'monitoring:equipmentgroup:save', showOnEdit: false },
@ -90,7 +98,7 @@ export default {
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200);
}, /** after dialog animated */ 200)
},
//
getDataList() {

View File

@ -10,7 +10,15 @@
</el-form-item>
</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
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@ -52,8 +60,8 @@ const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/equipmentType',
fields: [
{ name: 'name', label: i18n.t('eq.type') },
{ name: 'code', label: i18n.t('eq.typecode'), api: '/monitoring/equipmentType/getCode' },
{ name: 'name', required: true, label: i18n.t('eq.type') },
{ 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: [] },
'remark'
],
@ -110,7 +118,7 @@ export default {
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200);
}, /** after dialog animated */ 200)
},
//
getTreeEquipmentType() {

View File

@ -10,7 +10,15 @@
</el-form-item>
</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
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@ -53,9 +61,10 @@ const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/factory',
fields: [
'name',
{ name: 'name', required: true },
{
name: 'code',
required: true,
api: '/monitoring/factory/getCode'
},
{
@ -103,7 +112,7 @@ export default {
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200);
}, /** after dialog animated */ 200)
},
//
getDataList() {

View File

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

View File

@ -10,7 +10,15 @@
</el-form-item>
</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
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@ -55,8 +63,8 @@ const addOrUpdateConfigs = {
infoUrl: '/monitoring/productionLine',
fields: [
// 'name',
{ name: 'name', label: i18n.t('pl.name') },
{ name: 'code', label: i18n.t('pl.code'), api: '/monitoring/productionLine/getCode' },
{ name: 'name', label: i18n.t('pl.name'), required: true },
{ name: 'code', label: i18n.t('pl.code'), required: true, api: '/monitoring/productionLine/getCode' },
{
name: 'factoryId',
required: true,
@ -115,7 +123,7 @@ export default {
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200);
}, /** after dialog animated */ 200)
},
//
getFactoryList() {

View File

@ -1,16 +1,29 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="currentChangeHandle(1)">
<!-- <el-form-item>
<el-input v-model="dataForm.key" :placeholder="$t('parameter')" clearable></el-input>
</el-form-item> -->
<el-form-item>
<el-select v-model="dataForm.lineId" :placeholder="$t('pl.title')" clearable filterable>
<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-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-form-item>
</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
@size-change="sizeChangeHandle"
@ -71,9 +84,9 @@ const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/qualityInspectionRecord',
fields: [
{ name: 'checkTime', 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: 'sectionId', label: i18n.t('ws.title'), type: 'select', options: [] },
{ name: 'checkTime', required: true, label: i18n.t('inspect.time'), type: 'date', props: { style: 'width: 100%', type: 'datetime' }, placeholder: i18n.t('hints.checktime') },
{ name: 'productionId', required: true, label: i18n.t('pl.title'), type: 'select', options: [] },
{ name: 'sectionId', required: true, label: i18n.t('ws.title'), type: 'select', options: [] },
{
name: 'source',
label: i18n.t('source'),
@ -83,7 +96,7 @@ const addOrUpdateConfigs = {
{ 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: 'explainText', label: i18n.t('desc') },
'remark'
@ -102,8 +115,10 @@ export default {
addOrUpdateConfigs,
tableConfigs,
dataForm: {
key: ''
key: '',
lineId: ''
},
plList: [],
dataList: [],
pageIndex: 1,
pageSize: 10,
@ -128,7 +143,7 @@ export default {
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200);
}, /** after dialog animated */ 200)
},
// handle
async handleSelectChange({ name, id }) {
@ -158,18 +173,14 @@ export default {
// 线
getProductLines() {
this.$http({
url: this.$http.adornUrl('/monitoring/productionLine/page'),
method: 'get',
params: this.$http.adornParams({
// page: this.pageIndex,
// limit: this.pageSize,
// key: this.dataForm.key
})
url: this.$http.adornUrl('/monitoring/productionLine/list'),
method: 'get'
}).then(({ data: res }) => {
const plOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'productionId')
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() {
this.addOrUpdateVisible = false
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({
url: this.$http.adornUrl('/monitoring/qualityInspectionRecord/page'),
method: 'get',
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
})
params: this.$http.adornParams(queryParams)
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.data.list

View File

@ -10,7 +10,15 @@
</el-form-item>
</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
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@ -54,8 +62,8 @@ const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/workshopSection',
fields: [
{ name: 'name', label: i18n.t('ws.name') },
{ name: 'code', label: i18n.t('ws.code'), api: '/monitoring/workshopSection/getCode' },
{ name: 'name', required: true, label: i18n.t('ws.name') },
{ name: 'code', required: true, label: i18n.t('ws.code'), api: '/monitoring/workshopSection/getCode' },
{ name: 'productionLineId', label: i18n.t('ws.belong'), type: 'select', options: [] },
'description',
'remark'
@ -100,7 +108,7 @@ export default {
handleDestroyDialog() {
setTimeout(() => {
this.addOrUpdateVisible = false
}, /** after dialog animated */ 200);
}, /** after dialog animated */ 200)
},
// 线
getProductLine() {

View File

@ -122,9 +122,12 @@ export default {
//
remark: ''
},
dataFormRules: {
name: [{ required: true, message: i18n.t('validate.required'), trigger: 'blur' }],
code: [{ required: true, message: i18n.t('validate.required'), trigger: 'blur' }]
},
limit: 5,
page: 1,
dataFormRules: {},
showAttrForm: false
}
},
@ -287,6 +290,8 @@ export default {
}
},
handleCreateOrUpdate() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/monitoring/workshopSection'),
method: this.dataForm.id ? 'put' : 'post',
@ -303,6 +308,8 @@ export default {
})
})
}
})
}
}
}
</script>