forked from mt-fe-group/mt-yd-ui
update 质量检测信息记录
This commit is contained in:
parent
6063b664a6
commit
8943eb56b3
@ -27,6 +27,7 @@
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
clearable
|
||||
@change="emitSelectChange(configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name, $event)"
|
||||
>
|
||||
<el-option v-for="opt in configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].options" :key="opt.label" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
@ -41,6 +42,7 @@
|
||||
<el-date-picker
|
||||
v-if="getType(n, c) === 'date'"
|
||||
v-bind="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].props"
|
||||
:placeholder="getPlaceholder(n, c)"
|
||||
v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
@ -207,6 +209,16 @@ export default {
|
||||
/** 动态设置dataForm字段 */
|
||||
this.configs.fields.forEach(item => {
|
||||
this.$set(this.dataForm, [item.name], '')
|
||||
|
||||
/** select 的默认值设置 */
|
||||
if (item.type === 'select') {
|
||||
const opts = item.options || []
|
||||
const dft = opts.find(item => item.default || false)
|
||||
if (dft) {
|
||||
this.$set(this.dataForm, [item.name], dft.value)
|
||||
}
|
||||
}
|
||||
|
||||
if (item.api) {
|
||||
/** 自动请求并填充 */
|
||||
// or this.shouldWaitPool = []
|
||||
@ -395,6 +407,10 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
emitSelectChange(name, id) {
|
||||
this.$emit('select-change', { name, id })
|
||||
},
|
||||
|
||||
handleEditorReady(val) {
|
||||
console.log('editor rready..', val)
|
||||
},
|
||||
|
@ -9,34 +9,9 @@
|
||||
<el-button v-if="$hasPermission('monitoring:qualityinspectionrecord:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
|
||||
<el-table-column prop="inspectionDetId" header-align="center" align="center" label="检测内容id"> </el-table-column>
|
||||
<el-table-column prop="inspectionDetContent" header-align="center" align="center" label="检测内容(设备推送消息时,可能无对应id,只填这个字段)"> </el-table-column>
|
||||
<el-table-column prop="productionId" header-align="center" align="center" label="产线id"> </el-table-column>
|
||||
<el-table-column prop="sectionId" header-align="center" align="center" label="工段id"> </el-table-column>
|
||||
<el-table-column prop="checkPerson" header-align="center" align="center" label="检测人员,可以多个"> </el-table-column>
|
||||
<el-table-column prop="checkTime" header-align="center" align="center" label="检测时间"> </el-table-column>
|
||||
<el-table-column prop="source" header-align="center" align="center" label="来源 1,手动(默认) 2,自动"> </el-table-column>
|
||||
<el-table-column prop="explainText" header-align="center" align="center" label="描述"> </el-table-column>
|
||||
<el-table-column prop="remark" header-align="center" align="center" label="备注"> </el-table-column>
|
||||
<el-table-column prop="valid" header-align="center" align="center" label="删除标志,是否有效:1 可用 0不可用"> </el-table-column>
|
||||
<el-table-column prop="creatorId" header-align="center" align="center" label="创建人"> </el-table-column>
|
||||
<el-table-column prop="creatorName" header-align="center" align="center" label="创建人姓名"> </el-table-column>
|
||||
<el-table-column prop="createTime" header-align="center" align="center" label="创建时间"> </el-table-column>
|
||||
<el-table-column prop="updaterId" header-align="center" align="center" label="更新人"> </el-table-column>
|
||||
<el-table-column prop="updaterName" header-align="center" align="center" label="更新人姓名"> </el-table-column>
|
||||
<el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"> </el-table-column>
|
||||
<el-table-column prop="version" header-align="center" align="center" label="版本号"> </el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table> -->
|
||||
|
||||
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
|
||||
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
@ -47,8 +22,16 @@
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
>
|
||||
</el-pagination>
|
||||
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
|
||||
<add-or-update
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
:configs="addOrUpdateConfigs"
|
||||
@refreshDataList="getDataList"
|
||||
@destory-dialog="addOrUpdateVisible = false"
|
||||
@select-change="handleSelectChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -71,7 +54,7 @@ const tableConfigs = [
|
||||
{ prop: 'sectionId', name: '工段id' },
|
||||
{ prop: 'checkPerson', name: '检测人员' },
|
||||
// { prop: 'checkPerson', name: '检测人员,可以多个' },
|
||||
{ prop: 'source', name: '来源' },
|
||||
{ prop: 'source', name: '来源', filter: val => ({ 1: '手动', 2: '自动' }[val]) },
|
||||
// { prop: 'source', name: '来源 1,手动(默认) 2,自动' },
|
||||
{ prop: 'explainText', name: '描述' },
|
||||
{ prop: 'remark', name: '备注' },
|
||||
@ -82,7 +65,27 @@ const addOrUpdateConfigs = {
|
||||
type: 'dialog',
|
||||
infoUrl: '/monitoring/qualityInspectionRecord',
|
||||
fields: [
|
||||
{name: '', label: '检测类型', type: 'select', options: []}
|
||||
{ name: 'checkTime', label: '检测时间', type: 'date', props: { style: 'width: 100%', type: 'datetime' }, placeholder: '请选择检测时间' },
|
||||
{ name: 'productionId', label: '产线', type: 'select', options: [] },
|
||||
{ name: 'sectionId', label: '工段', type: 'select', options: [] },
|
||||
{
|
||||
name: 'source',
|
||||
label: '来源',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ value: 1, label: '手动', default: true },
|
||||
{ value: 2, label: '自动' }
|
||||
]
|
||||
},
|
||||
{ name: 'inspectionDetId', label: '检测内容', type: 'select', options: [] },
|
||||
{ name: 'checkPerson', label: '检测人员' },
|
||||
{ name: 'explainText', label: '描述' },
|
||||
'remark'
|
||||
],
|
||||
operations: [
|
||||
{ name: 'cancel', showAlways: true },
|
||||
{ name: 'save', url: '/monitoring/qualityInspectionRecord', permission: '', showOnEdit: false },
|
||||
{ name: 'update', url: '/monitoring/qualityInspectionRecord', permission: '', showOnEdit: true }
|
||||
]
|
||||
}
|
||||
|
||||
@ -109,8 +112,78 @@ export default {
|
||||
},
|
||||
activated() {
|
||||
this.getDataList()
|
||||
this.getInspectionDet()
|
||||
this.getWorkSections()
|
||||
this.getProductLines()
|
||||
},
|
||||
methods: {
|
||||
// handle
|
||||
async handleSelectChange({ name, id }) {
|
||||
if (name === 'productionId') {
|
||||
// 如果选择了产线,就依据此更新工单的选项
|
||||
await this.getWorkSections(id)
|
||||
}
|
||||
},
|
||||
// 获取检测内容
|
||||
getInspectionDet() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityInspectionDet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({ data: res }) => {
|
||||
console.log('insdet:', res)
|
||||
const insDetOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'inspectionDetId')
|
||||
if (insDetOpt) {
|
||||
insDetOpt.options = res.data.list.map(item => ({ value: item.id, label: item.content })) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取产线
|
||||
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
|
||||
})
|
||||
}).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 })) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取工段
|
||||
getWorkSections(lineId) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopSection/page'),
|
||||
method: 'get',
|
||||
params: lineId
|
||||
? this.$http.adornParams({
|
||||
// page: this.pageIndex,
|
||||
// limit: this.pageSize,
|
||||
// key: this.dataForm.key
|
||||
lineId
|
||||
})
|
||||
: {}
|
||||
}).then(({ data: res }) => {
|
||||
if (res.data.total === 0) {
|
||||
this.$message.error('该产线没有工段')
|
||||
} else {
|
||||
this.$message.success(`该产线有 ${res.data.total} 条工段`)
|
||||
}
|
||||
const wsOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId')
|
||||
if (wsOpt) {
|
||||
wsOpt.options = res.data.list.map(item => ({ value: item.id, label: item.name })) || []
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取数据列表
|
||||
getDataList() {
|
||||
this.addOrUpdateVisible = false
|
||||
|
Loading…
Reference in New Issue
Block a user