feat(员工信息): 新增查看功能并优化附件展示
refactor(异常管理): 重构异常记录表格布局和保存逻辑 feat(库存管理): 新增CRM卷材库存视图和分组筛选功能
This commit is contained in:
@@ -55,28 +55,37 @@
|
||||
<div class="exception-section">
|
||||
<div class="section-header">
|
||||
<h4 class="section-title">异常记录</h4>
|
||||
<el-button type="default" icon="el-icon-refresh" plain size="mini" @click="refreshAbnormalList"
|
||||
:loading="abnormalLoading">
|
||||
刷新
|
||||
</el-button>
|
||||
<div>
|
||||
<el-button type="primary" size="mini" @click="handleSave">保存</el-button>
|
||||
<el-button type="default" icon="el-icon-refresh" plain size="mini" @click="refreshAbnormalList"
|
||||
:loading="abnormalLoading">
|
||||
刷新
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="abnormalList" style="width: 100%" border>
|
||||
<el-table-column label="开始位置" prop="startPosition" width="80">
|
||||
<el-table :data="abnormalList" style="width: 100%" border stripe>
|
||||
<el-table-column label="序号" type="index" width="50" />
|
||||
<el-table-column label="缺陷描述" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.remark" placeholder="请输入缺陷描述" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="开始位置" prop="startPosition" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input :controls="false" v-model="scope.row.startPosition" placeholder="请输入开始位置" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束位置" prop="endPosition" width="80">
|
||||
<el-table-column label="结束位置" prop="endPosition" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input :controls="false" v-model="scope.row.endPosition" placeholder="请输入结束位置" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="长度" prop="length" width="80">
|
||||
<el-table-column label="长度" prop="length" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.endPosition - scope.row.startPosition }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上下版面" prop="plateSurface">
|
||||
<el-table-column label="上下版面" prop="plateSurface" width="180">
|
||||
<template slot-scope="scope">
|
||||
<muti-select v-model="scope.row.plateSurface" :options="[
|
||||
{ label: '上板面', value: '上' },
|
||||
@@ -88,7 +97,7 @@
|
||||
</el-checkbox-group> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="断面位置" prop="position">
|
||||
<el-table-column label="断面位置" prop="position" width="240">
|
||||
<template slot-scope="scope">
|
||||
<muti-select v-model="scope.row.position" :options="dict.type.coil_abnormal_position" type="checkbox">
|
||||
</muti-select>
|
||||
@@ -97,41 +106,53 @@
|
||||
</el-checkbox-group> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="缺陷代码" prop="defectCode">
|
||||
<template slot-scope="scope">
|
||||
<div class="radio-single">
|
||||
<el-radio-group v-model="scope.row.defectCode">
|
||||
<el-radio v-for="dict in dict.type.coil_abnormal_code" :key="dict.value" :label="dict.value" @click.native="handleRadioClick(scope.row.defectCode, dict.value, 'defectCode', scope.row)">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="程度" prop="degree">
|
||||
<template slot-scope="scope">
|
||||
<div class="radio-single">
|
||||
<el-radio-group v-model="scope.row.degree">
|
||||
<el-radio v-for="dict in dict.type.coil_abnormal_degree" :key="dict.value" :label="dict.value" @click.native="handleRadioClick(scope.row.degree, dict.value, 'degree', scope.row)">
|
||||
{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.abnormalId" type="text" size="mini" @click="handleDelete(scope.row)" style="color: #f56c6c;">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button v-else type="text" size="mini" @click="clearRowData(scope.row)">
|
||||
清空
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="主缺陷" prop="mainMark" width="60">
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row.mainMark" :true-label="1" :false-label="0"></el-checkbox>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="缺陷代码" prop="defectCode">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.defectCode" placeholder="请选择缺陷代码">
|
||||
<el-option v-for="dict in dict.type.coil_abnormal_code" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="程度" prop="degree">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.degree" placeholder="请选择程度">
|
||||
<el-option v-for="dict in dict.type.coil_abnormal_degree" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产线" prop="productionLine">
|
||||
<!-- <el-table-column label="产线" prop="productionLine">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.productionLine" placeholder="请选择产线">
|
||||
<el-option v-for="dict in dict.type.sys_lines" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.remark" placeholder="请输入备注" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180">
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column label="操作" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="!scope.row.abnormalId" type="primary" plain size="mini" :loading="buttonLoading"
|
||||
@click="handleSave(scope.row)">新增</el-button>
|
||||
@@ -142,7 +163,7 @@
|
||||
@click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
@@ -285,63 +306,77 @@ export default {
|
||||
}
|
||||
return emptyRows
|
||||
},
|
||||
handleSave(row) {
|
||||
// 验证数据
|
||||
if (!row.startPosition || !row.endPosition) {
|
||||
this.$message.error('请填写开始位置和结束位置')
|
||||
return
|
||||
handleSave() {
|
||||
// 过滤出非空行
|
||||
const nonEmptyRows = this.abnormalList.filter(row => {
|
||||
return row.startPosition || row.endPosition || row.position || row.plateSurface || row.defectCode || row.degree || row.remark
|
||||
})
|
||||
|
||||
// 批量校验
|
||||
for (let i = 0; i < nonEmptyRows.length; i++) {
|
||||
const row = nonEmptyRows[i]
|
||||
const rowIndex = this.abnormalList.indexOf(row) + 1 // 行号从1开始
|
||||
|
||||
if (!row.startPosition || !row.endPosition) {
|
||||
this.$message.error(`第${rowIndex}行:请填写开始位置和结束位置`)
|
||||
return
|
||||
}
|
||||
if (row.startPosition > row.endPosition) {
|
||||
this.$message.error(`第${rowIndex}行:开始位置必须小于结束位置`)
|
||||
return
|
||||
}
|
||||
if (!row.position || row.position.length === 0) {
|
||||
this.$message.error(`第${rowIndex}行:请选择断面位置`)
|
||||
return
|
||||
}
|
||||
if (!row.plateSurface || row.plateSurface.length === 0) {
|
||||
this.$message.error(`第${rowIndex}行:请选择上下板面`)
|
||||
return
|
||||
}
|
||||
if (!row.defectCode) {
|
||||
this.$message.error(`第${rowIndex}行:请选择缺陷代码`)
|
||||
return
|
||||
}
|
||||
if (!row.degree) {
|
||||
this.$message.error(`第${rowIndex}行:请选择程度`)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (row.startPosition > row.endPosition) {
|
||||
this.$message.error('开始位置必须小于结束位置')
|
||||
return
|
||||
}
|
||||
if (!row.position || row.position.length === 0) {
|
||||
this.$message.error('请选择断面位置')
|
||||
return
|
||||
}
|
||||
if (!row.plateSurface || row.plateSurface.length === 0) {
|
||||
this.$message.error('请选择上下板面')
|
||||
return
|
||||
}
|
||||
if (!row.defectCode) {
|
||||
this.$message.error('请选择缺陷代码')
|
||||
return
|
||||
}
|
||||
if (!row.degree) {
|
||||
this.$message.error('请选择程度')
|
||||
|
||||
if (nonEmptyRows.length === 0) {
|
||||
this.$message.info('没有需要保存的数据')
|
||||
return
|
||||
}
|
||||
|
||||
this.buttonLoading = true
|
||||
const saveData = {
|
||||
...row,
|
||||
// length: row.endPosition - row.startPosition,
|
||||
coilId: this.coilId
|
||||
}
|
||||
|
||||
if (row.abnormalId) {
|
||||
// 调用修改接口
|
||||
updateCoilAbnormal(saveData).then(response => {
|
||||
this.$message.success('异常记录更新成功')
|
||||
}).catch(error => {
|
||||
console.error('异常记录更新失败:', error)
|
||||
this.$message.error('异常记录更新失败: ' + (error.message || error))
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
} else {
|
||||
// 调用新增接口
|
||||
addCoilAbnormal(saveData).then(response => {
|
||||
this.$message.success('异常记录添加成功')
|
||||
// 重新加载列表以获取新的 abnormalId
|
||||
this.loadAbnormalList()
|
||||
}).catch(error => {
|
||||
console.error('异常记录添加失败:', error)
|
||||
this.$message.error('异常记录添加失败: ' + (error.message || error))
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
}
|
||||
// 批量请求
|
||||
const requests = nonEmptyRows.map(row => {
|
||||
const saveData = {
|
||||
...row,
|
||||
coilId: this.coilId
|
||||
}
|
||||
|
||||
if (row.abnormalId) {
|
||||
// 更新操作
|
||||
return updateCoilAbnormal(saveData)
|
||||
} else {
|
||||
// 新增操作
|
||||
return addCoilAbnormal(saveData)
|
||||
}
|
||||
})
|
||||
|
||||
// 执行所有请求
|
||||
Promise.all(requests).then(responses => {
|
||||
this.$message.success('批量保存成功')
|
||||
// 刷新列表
|
||||
this.loadAbnormalList()
|
||||
}).catch(error => {
|
||||
console.error('批量保存失败:', error)
|
||||
this.$message.error('批量保存失败: ' + (error.message || error))
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (!row.abnormalId) {
|
||||
@@ -394,6 +429,45 @@ export default {
|
||||
}).finally(() => {
|
||||
this.coilInfoLoading = false
|
||||
})
|
||||
},
|
||||
handleSingleCheckboxChange(val, value, field, row) {
|
||||
if (val) {
|
||||
// 选中状态,设置值
|
||||
row[field] = value
|
||||
} else {
|
||||
// 取消选中状态,清空值
|
||||
if (row[field] === value) {
|
||||
row[field] = null
|
||||
}
|
||||
}
|
||||
},
|
||||
handleSingleCheckboxClick(value, field, row) {
|
||||
// 实现排他单选:如果点击的是当前选中的值,则取消选中;否则选中新值
|
||||
if (row[field] === value) {
|
||||
row[field] = null
|
||||
} else {
|
||||
row[field] = value
|
||||
}
|
||||
},
|
||||
handleRadioClick(currentValue, value, field, row) {
|
||||
// 实现 radio 的取消选择功能:如果点击的是当前选中的值,则取消选中
|
||||
if (currentValue === value) {
|
||||
// 使用 $nextTick 确保在 radio 组件更新后再清空值
|
||||
this.$nextTick(() => {
|
||||
row[field] = null
|
||||
})
|
||||
}
|
||||
},
|
||||
clearRowData(row) {
|
||||
// 清空一行的所有数据
|
||||
row.remark = null
|
||||
row.startPosition = 0
|
||||
row.endPosition = 0
|
||||
row.position = ''
|
||||
row.plateSurface = ''
|
||||
row.mainMark = 0
|
||||
row.defectCode = null
|
||||
row.degree = null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,4 +532,19 @@ export default {
|
||||
margin-right: -16px;
|
||||
margin-bottom: -16px;
|
||||
}
|
||||
|
||||
.radio-single {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.radio-single .el-radio {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.radio-single .el-button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -23,17 +23,20 @@
|
||||
<current-coil-no :current-coil-no="scope.row.currentCoilNo"></current-coil-no>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
|
||||
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" />
|
||||
|
||||
<!-- <el-table-column label="逻辑库位" align="center" prop="warehouseName" />
|
||||
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" /> -->
|
||||
<el-table-column label="产品类型" align="center" width="180">
|
||||
<template slot-scope="scope">
|
||||
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
|
||||
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="异常数量" align="center" prop="abnormalCount"></el-table-column>
|
||||
<!-- <el-table-column label="异常数量" align="center" prop="abnormalCount"></el-table-column> -->
|
||||
<el-table-column label="净重" align="center" prop="netWeight" />
|
||||
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" />
|
||||
<el-table-column label="更新人" align="center" prop="updateByName" />
|
||||
<el-table-column label="更新人" align="center" prop="updateBy" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleCheck(scope.row)">修正</el-button>
|
||||
|
||||
Reference in New Issue
Block a user