parent
e32bcb366c
commit
5ae250f947
35 changed files with 2558 additions and 607 deletions
@ -0,0 +1,259 @@ |
||||
<template> |
||||
<el-dialog |
||||
:title="title" |
||||
append-to-body |
||||
:modelValue="openShow" |
||||
width="70%" |
||||
@close="closeDialog()" |
||||
> |
||||
<div style="margin-bottom: 12px" v-if="moldAddMore"> |
||||
<el-button type="primary" @click="addTable">插入一行</el-button> |
||||
<el-button type="danger" @click="delTable">删除选中行</el-button> |
||||
</div> |
||||
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px"> |
||||
<!-- 全局错误提示 --> |
||||
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px"> |
||||
{{ formError }} |
||||
</div> |
||||
<el-table :data="form.tableData" @select="selectChange" border> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column label="虚拟子件号" prop="subPartCode" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>虚拟子件号</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].subPartCode`" :rules="formRules.subPartCode"> |
||||
<el-input v-model="scope.row.subPartCode"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="提醒颜色" prop="remindColor" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>提醒颜色</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].remindColor`" :rules="formRules.remindColor"> |
||||
<el-input v-model="scope.row.remindColor"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="显示颜色" prop="showColor" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>显示颜色</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].showColor`" :rules="formRules.showColor"> |
||||
<el-color-picker v-model="scope.row.showColor" show-alpha color-format="rgb" style="width:99%;"></el-color-picker> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-form> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog()">取 消</el-button> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getPqList,saveRemind,editRemind } from "@/api/qualityManagement/remindRedeem/remindRedeem" |
||||
export default { |
||||
props:{ |
||||
showDialog:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
moldAddMore:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
title:{ |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
checkRow:{ |
||||
type: Object, |
||||
default: () => { |
||||
return {} |
||||
} |
||||
} |
||||
}, |
||||
data(){ |
||||
return{ |
||||
openShow:false, |
||||
formError:"", |
||||
form:{ |
||||
tableData:[] |
||||
}, |
||||
formRules:{ |
||||
// 表格数据数组的整体校验(可选:如最少1行数据) |
||||
tableData: [ |
||||
{ |
||||
required: true, |
||||
message: '请至少添加一行数据', |
||||
trigger: 'submit', |
||||
type: 'array', // 明确类型为数组 |
||||
}, |
||||
{ |
||||
validator: (rule, value, callback) => { |
||||
if (value.length === 0) { |
||||
callback(new Error('请至少添加一行数据')); |
||||
} else { |
||||
callback(); |
||||
} |
||||
}, |
||||
trigger: 'submit', |
||||
}, |
||||
], |
||||
// 数组中每一项的 plate 字段校验 |
||||
subPartCode: [{ required: true, message: '请输入虚拟子件号', trigger: ['change', 'submit'] }], |
||||
remindColor:[{ required: true, message: '请输入提醒颜色', trigger: ['change', 'submit'] }], |
||||
showColor:[{ required: true, message: '请选择显示颜色', trigger: ['change', 'submit'] }] |
||||
}, |
||||
rowDetail:{} |
||||
} |
||||
}, |
||||
created(){ |
||||
this.openShow = this.showDialog |
||||
if(this.title == '新增'){ |
||||
// 初始添加一行(可选) |
||||
if (this.moldAddMore && this.form.tableData.length === 0) { |
||||
this.addTable(); |
||||
} |
||||
}else{ |
||||
this.rowDetail = JSON.parse(JSON.stringify(this.checkRow)) |
||||
this.form.tableData = [] |
||||
this.form.tableData.push(this.rowDetail) |
||||
} |
||||
}, |
||||
methods:{ |
||||
closeDialog(val){ |
||||
console.log('val-----------',val) |
||||
this.$emit('closeDialog',val) |
||||
}, |
||||
selectChange(list, row) { |
||||
row._select = !row._select; |
||||
}, |
||||
// 新增一行(直接push到表单模型的 tableData 中) |
||||
addTable() { |
||||
this.form.tableData.push({ |
||||
_select: false, // 选择状态 |
||||
subPartCode: '', |
||||
remindColor: '', |
||||
showColor:null, |
||||
}); |
||||
}, |
||||
// 删除选中行 |
||||
delTable() { |
||||
this.form.tableData = this.form.tableData.filter(row => !row._select); |
||||
}, |
||||
submitForm(){ |
||||
this.formError = ''; |
||||
// 调用单个 Form 的校验方法 |
||||
this.$refs.tableForm.validate((isValid, invalidFields) => { |
||||
if (!isValid) { |
||||
// 校验失败:显示提示并滚动到第一个错误字段 |
||||
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
||||
|
||||
this.$nextTick(() => { |
||||
// 找到第一个错误字段并滚动到视图 |
||||
const firstError = document.querySelector('.el-form-item.is-error'); |
||||
if (firstError) { |
||||
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
||||
} |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
// --- 新增:虚拟子件号判重逻辑开始 --- |
||||
const subPartCodeSet = new Set(); |
||||
let duplicateCode = null; |
||||
|
||||
for (const row of this.form.tableData) { |
||||
const code = row.subPartCode; |
||||
// 如果子件号为空,跳过(虽然前面必填校验已过,但作为保护) |
||||
if (!code) continue; |
||||
|
||||
if (subPartCodeSet.has(code)) { |
||||
duplicateCode = code; |
||||
break; // 发现重复立即跳出 |
||||
} |
||||
subPartCodeSet.add(code); |
||||
} |
||||
|
||||
if (duplicateCode) { |
||||
this.formError = `数据重复:虚拟子件号【${duplicateCode}】已存在,请检查并修改。`; |
||||
// 可选:使用 Message 组件额外提示 |
||||
this.$message.warning(this.formError); |
||||
return; |
||||
} |
||||
|
||||
// 校验通过:准备提交数据(过滤无用字段) |
||||
const submitData = this.form.tableData.map(row => { |
||||
const { _select, ...validData } = row; // 剔除选择状态字段 |
||||
return validData; |
||||
}); |
||||
console.log('submitData---------',submitData) |
||||
submitData.map(item =>{ |
||||
item.remindMsgType = 2 |
||||
}) |
||||
if(this.title == '新增'){ |
||||
saveRemind(submitData).then(res => { |
||||
if(res.data.code == 200){ |
||||
this.$message.success('新增成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
}else{ |
||||
editRemind(submitData[0]).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('修改成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
// 优化表单字段样式 |
||||
:deep(.el-table .el-form-item) { |
||||
margin-bottom: 0; // 去掉默认边距 |
||||
} |
||||
|
||||
// 错误提示样式优化 |
||||
:deep(.el-form-item__error) { |
||||
font-size: 12px; |
||||
white-space: nowrap; |
||||
z-index: 10; |
||||
background: #fff; |
||||
padding: 2px 4px; |
||||
border: 1px solid #f56c6c; |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
// 表格行高适配 textarea |
||||
.el-table__row { |
||||
height: 80px !important; |
||||
} |
||||
|
||||
.el-table__cell { |
||||
vertical-align: middle !important; |
||||
} |
||||
|
||||
.error-message { |
||||
font-size: 14px; |
||||
line-height: 1.5; |
||||
} |
||||
:deep(.el-table .el-table__cell) { |
||||
height: 50px !important; |
||||
padding: 0 !important; |
||||
line-height: 50px !important; |
||||
} |
||||
</style> |
||||
@ -0,0 +1,260 @@ |
||||
<template> |
||||
<el-dialog |
||||
:title="title" |
||||
append-to-body |
||||
:modelValue="openShow" |
||||
width="70%" |
||||
@close="closeDialog()" |
||||
> |
||||
<div style="margin-bottom: 12px" v-if="moldAddMore"> |
||||
<el-button type="primary" @click="addTable">插入一行</el-button> |
||||
<el-button type="danger" @click="delTable">删除选中行</el-button> |
||||
</div> |
||||
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px"> |
||||
<!-- 全局错误提示 --> |
||||
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px"> |
||||
{{ formError }} |
||||
</div> |
||||
<el-table :data="form.tableData" @select="selectChange" border> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column label="程式编号" prop="formula" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>程式编号</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].formula`" :rules="formRules.formula"> |
||||
<el-input v-model="scope.row.formula"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="材料" prop="material" align="center"> |
||||
<template #header> |
||||
<el-tooltip class="item" effect="dark" content="存在多个材料时,请以【、】分割" placement="top"> |
||||
<div> |
||||
<i style="color: red;margin:0px 5px;">*</i> |
||||
<el-icon><InfoFilled /></el-icon> |
||||
<span style="margin-left: 2px;">材料</span> |
||||
</div> |
||||
</el-tooltip> |
||||
|
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].material`" :rules="formRules.material"> |
||||
<el-input v-model="scope.row.material"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-form> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog()">取 消</el-button> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getPqList,saveRemind,editRemind } from "@/api/qualityManagement/remindRedeem/remindRedeem" |
||||
export default { |
||||
props:{ |
||||
showDialog:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
moldAddMore:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
title:{ |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
checkRow:{ |
||||
type: Object, |
||||
default: () => { |
||||
return {} |
||||
} |
||||
} |
||||
}, |
||||
data(){ |
||||
return{ |
||||
openShow:false, |
||||
formError:"", |
||||
form:{ |
||||
tableData:[] |
||||
}, |
||||
rowDetail:{}, |
||||
formRules:{ |
||||
// 表格数据数组的整体校验(可选:如最少1行数据) |
||||
tableData: [ |
||||
{ |
||||
required: true, |
||||
message: '请至少添加一行数据', |
||||
trigger: 'submit', |
||||
type: 'array', // 明确类型为数组 |
||||
}, |
||||
{ |
||||
validator: (rule, value, callback) => { |
||||
if (value.length === 0) { |
||||
callback(new Error('请至少添加一行数据')); |
||||
} else { |
||||
callback(); |
||||
} |
||||
}, |
||||
trigger: 'submit', |
||||
}, |
||||
], |
||||
// 数组中每一项的 plate 字段校验 |
||||
formula: [{ required: true, message: '请输入程式编号', trigger: ['change', 'submit'] }], |
||||
material:[{ required: true, message: '请输入材料', trigger: ['change', 'submit'] }] |
||||
} |
||||
} |
||||
}, |
||||
created(){ |
||||
this.openShow = this.showDialog |
||||
if(this.title == '新增'){ |
||||
// 初始添加一行(可选) |
||||
if (this.moldAddMore && this.form.tableData.length === 0) { |
||||
this.addTable(); |
||||
} |
||||
}else{ |
||||
this.rowDetail = JSON.parse(JSON.stringify(this.checkRow)) |
||||
this.form.tableData = [] |
||||
this.form.tableData.push(this.rowDetail) |
||||
} |
||||
}, |
||||
methods:{ |
||||
closeDialog(val){ |
||||
this.$emit('closeDialog',val) |
||||
}, |
||||
selectChange(list, row) { |
||||
row._select = !row._select; |
||||
}, |
||||
// 新增一行(直接push到表单模型的 tableData 中) |
||||
addTable() { |
||||
this.form.tableData.push({ |
||||
_select: false, // 选择状态 |
||||
formula: '', |
||||
material: '', |
||||
}); |
||||
}, |
||||
// 删除选中行 |
||||
delTable() { |
||||
this.form.tableData = this.form.tableData.filter(row => !row._select); |
||||
}, |
||||
submitForm(){ |
||||
this.formError = ''; |
||||
// 调用单个 Form 的校验方法 |
||||
this.$refs.tableForm.validate((isValid, invalidFields) => { |
||||
if (!isValid) { |
||||
// 校验失败:显示提示并滚动到第一个错误字段 |
||||
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
||||
|
||||
this.$nextTick(() => { |
||||
// 找到第一个错误字段并滚动到视图 |
||||
const firstError = document.querySelector('.el-form-item.is-error'); |
||||
if (firstError) { |
||||
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
||||
} |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
// 2. 自定义校验:检查程式编号是否重复 |
||||
const programNumbers = this.form.tableData.map(row => row.formula); |
||||
const duplicates = []; |
||||
const seen = new Set(); |
||||
|
||||
// 找出所有重复的值 |
||||
programNumbers.forEach(num => { |
||||
if (seen.has(num)) { |
||||
if (!duplicates.includes(num)) { |
||||
duplicates.push(num); |
||||
} |
||||
} else { |
||||
seen.add(num); |
||||
} |
||||
}); |
||||
|
||||
if (duplicates.length > 0) { |
||||
this.formError = `程式编号 【${duplicates.join(', ')}】存在重复,请检查`; |
||||
|
||||
// // 可选:尝试定位到第一个重复的输入框并聚焦/滚动 |
||||
// this.$nextTick(() => { |
||||
// // 这里简单处理,滚动到顶部或第一个错误提示处 |
||||
// // 如果需要更精确的定位,需要给 el-input 添加 ref 或通过 DOM 查找特定值的输入框 |
||||
// const firstError = document.querySelector('.error-message'); |
||||
// if (firstError) { |
||||
// firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
||||
// } |
||||
// }); |
||||
return; |
||||
} |
||||
|
||||
// 校验通过:准备提交数据(过滤无用字段) |
||||
const submitData = this.form.tableData.map(row => { |
||||
const { _select, ...validData } = row; // 剔除选择状态字段 |
||||
return validData; |
||||
}); |
||||
submitData.map(item =>{ |
||||
item.remindMsgType = 3 |
||||
}) |
||||
if(this.title == '新增'){ |
||||
saveRemind(submitData).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('新增成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
}else{ |
||||
editRemind(submitData[0]).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('修改成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
// 优化表单字段样式 |
||||
:deep(.el-table .el-form-item) { |
||||
margin-bottom: 0; // 去掉默认边距 |
||||
} |
||||
|
||||
// 错误提示样式优化 |
||||
:deep(.el-form-item__error) { |
||||
font-size: 12px; |
||||
white-space: nowrap; |
||||
z-index: 10; |
||||
background: #fff; |
||||
padding: 2px 4px; |
||||
border: 1px solid #f56c6c; |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
// 表格行高适配 textarea |
||||
.el-table__row { |
||||
height: 80px !important; |
||||
} |
||||
|
||||
.el-table__cell { |
||||
vertical-align: middle !important; |
||||
} |
||||
|
||||
.error-message { |
||||
font-size: 14px; |
||||
line-height: 1.5; |
||||
} |
||||
:deep(.el-table .el-table__cell) { |
||||
height: 50px !important; |
||||
padding: 0 !important; |
||||
line-height: 50px !important; |
||||
} |
||||
</style> |
||||
@ -0,0 +1,267 @@ |
||||
<template> |
||||
<el-dialog |
||||
:title="title" |
||||
append-to-body |
||||
:modelValue="openShow" |
||||
width="70%" |
||||
@close="closeDialog()" |
||||
> |
||||
<div style="margin-bottom: 12px" v-if="moldAddMore"> |
||||
<el-button type="primary" @click="addTable">插入一行</el-button> |
||||
<el-button type="danger" @click="delTable">删除选中行</el-button> |
||||
</div> |
||||
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px"> |
||||
<!-- 全局错误提示 --> |
||||
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px"> |
||||
{{ formError }} |
||||
</div> |
||||
<el-table :data="form.tableData" @select="selectChange" border> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column label="零件号" prop="partCode" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>零件号</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].partCode`" :rules="formRules.partCode"> |
||||
<el-input v-model="scope.row.partCode"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="生产标识" prop="qualityLevel" align="center"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].qualityLevel`" :rules="formRules.qualityLevel"> |
||||
<!-- <el-input v-model="scope.row.qualityLevel"></el-input> --> |
||||
<el-select v-model="scope.row.qualityLevel" clearable> |
||||
<el-option v-for="item in productionList" :key="item.id" :label="item.name" :value="item.name"></el-option>" |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="提醒内容" prop="remindContent" align="center"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].remindContent`" :rules="formRules.remindContent"> |
||||
<el-input v-model="scope.row.remindContent"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="热处理检验" prop="isHeatTreatment" align="center"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].isHeatTreatment`" :rules="formRules.isHeatTreatment"> |
||||
<el-switch |
||||
style="margin:0 auto;" |
||||
v-model="scope.row.isHeatTreatment" |
||||
> |
||||
</el-switch> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="镀后检验" prop="isAfterPlating" align="center"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].isAfterPlating`" :rules="formRules.isAfterPlating"> |
||||
<el-switch |
||||
style="margin:0 auto;" |
||||
v-model="scope.row.isAfterPlating" |
||||
> |
||||
</el-switch> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-form> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog()">取 消</el-button> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getPqList,saveRemind,editRemind } from "@/api/qualityManagement/remindRedeem/remindRedeem" |
||||
export default { |
||||
props:{ |
||||
showDialog:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
moldAddMore:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
title:{ |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
checkRow:{ |
||||
type: Object, |
||||
default: () => { |
||||
return {} |
||||
} |
||||
} |
||||
}, |
||||
data(){ |
||||
return{ |
||||
openShow:false, |
||||
formError:"", |
||||
form:{ |
||||
tableData:[] |
||||
}, |
||||
rowDetail:{}, |
||||
productionList:[], |
||||
formRules:{ |
||||
// 表格数据数组的整体校验(可选:如最少1行数据) |
||||
tableData: [ |
||||
{ |
||||
required: true, |
||||
message: '请至少添加一行数据', |
||||
trigger: 'submit', |
||||
type: 'array', // 明确类型为数组 |
||||
}, |
||||
{ |
||||
validator: (rule, value, callback) => { |
||||
if (value.length === 0) { |
||||
callback(new Error('请至少添加一行数据')); |
||||
} else { |
||||
callback(); |
||||
} |
||||
}, |
||||
trigger: 'submit', |
||||
}, |
||||
], |
||||
// 数组中每一项的 plate 字段校验 |
||||
partCode: [{ required: true, message: '请输入程式编号', trigger: ['change', 'submit'] }], |
||||
} |
||||
} |
||||
}, |
||||
created(){ |
||||
this.openShow = this.showDialog |
||||
this.getPqList() |
||||
if(this.title == '新增'){ |
||||
// 初始添加一行(可选) |
||||
if (this.moldAddMore && this.form.tableData.length === 0) { |
||||
this.addTable(); |
||||
} |
||||
}else{ |
||||
this.rowDetail = JSON.parse(JSON.stringify(this.checkRow)) |
||||
this.rowDetail.isHeatTreatment = this.rowDetail.isHeatTreatment == 1 ? true : false |
||||
this.rowDetail.isAfterPlating = this.rowDetail.isAfterPlating == 1 ? true : false |
||||
this.form.tableData = [] |
||||
this.form.tableData.push(this.rowDetail) |
||||
} |
||||
}, |
||||
methods:{ |
||||
getPqList(){ |
||||
getPqList().then(res =>{ |
||||
this.productionList = res.data.data |
||||
}) |
||||
}, |
||||
closeDialog(val){ |
||||
this.$emit('closeDialog',val) |
||||
}, |
||||
selectChange(list, row) { |
||||
row._select = !row._select; |
||||
}, |
||||
// 新增一行(直接push到表单模型的 tableData 中) |
||||
addTable() { |
||||
this.form.tableData.push({ |
||||
_select: false, // 选择状态 |
||||
partCode: '', |
||||
qualityLevel: '', |
||||
remindContent:'', |
||||
isHeatTreatment:false, |
||||
isAfterPlating:false |
||||
}); |
||||
}, |
||||
// 删除选中行 |
||||
delTable() { |
||||
this.form.tableData = this.form.tableData.filter(row => !row._select); |
||||
}, |
||||
submitForm(){ |
||||
this.formError = ''; |
||||
// 调用单个 Form 的校验方法 |
||||
this.$refs.tableForm.validate((isValid, invalidFields) => { |
||||
if (!isValid) { |
||||
// 校验失败:显示提示并滚动到第一个错误字段 |
||||
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
||||
|
||||
this.$nextTick(() => { |
||||
// 找到第一个错误字段并滚动到视图 |
||||
const firstError = document.querySelector('.el-form-item.is-error'); |
||||
if (firstError) { |
||||
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
||||
} |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
|
||||
// 校验通过:准备提交数据(过滤无用字段) |
||||
const submitData = this.form.tableData.map(row => { |
||||
const { _select, ...validData } = row; // 剔除选择状态字段 |
||||
return validData; |
||||
}); |
||||
submitData.map(item =>{ |
||||
item.remindMsgType = 0 |
||||
item.isHeatTreatment = item.isHeatTreatment ? 1 : 0, |
||||
item.isAfterPlating = item.isAfterPlating ? 1 : 0, |
||||
item.qualityLevel = item.qualityLevel ? item.qualityLevel : '' |
||||
}) |
||||
console.log('submitData---------------',submitData) |
||||
if(this.title == '新增'){ |
||||
saveRemind(submitData).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('新增成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
}else{ |
||||
editRemind(submitData[0]).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('修改成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
} |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
// 优化表单字段样式 |
||||
:deep(.el-table .el-form-item) { |
||||
margin-bottom: 0; // 去掉默认边距 |
||||
} |
||||
|
||||
// 错误提示样式优化 |
||||
:deep(.el-form-item__error) { |
||||
font-size: 12px; |
||||
white-space: nowrap; |
||||
z-index: 10; |
||||
background: #fff; |
||||
padding: 2px 4px; |
||||
border: 1px solid #f56c6c; |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
// 表格行高适配 textarea |
||||
.el-table__row { |
||||
height: 80px !important; |
||||
} |
||||
|
||||
.el-table__cell { |
||||
vertical-align: middle !important; |
||||
} |
||||
|
||||
.error-message { |
||||
font-size: 14px; |
||||
line-height: 1.5; |
||||
} |
||||
:deep(.el-table .el-table__cell) { |
||||
height: 50px !important; |
||||
padding: 0 !important; |
||||
line-height: 50px !important; |
||||
} |
||||
</style> |
||||
@ -0,0 +1,339 @@ |
||||
<template> |
||||
<el-dialog |
||||
:title="title" |
||||
append-to-body |
||||
:modelValue="openShow" |
||||
width="70%" |
||||
@close="closeDialog()" |
||||
> |
||||
<div style="margin-bottom: 12px" v-if="moldAddMore"> |
||||
<el-button type="primary" @click="addTable">插入一行</el-button> |
||||
<el-button type="danger" @click="delTable">删除选中行</el-button> |
||||
</div> |
||||
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px"> |
||||
<!-- 全局错误提示 --> |
||||
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px"> |
||||
{{ formError }} |
||||
</div> |
||||
<el-table :data="form.tableData" @select="selectChange" border> |
||||
<el-table-column type="selection" width="55" align="center"></el-table-column> |
||||
<el-table-column label="镀种信息" prop="plateing" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>镀种信息</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].plateing`" :rules="formRules.plateing"> |
||||
<el-input v-model="scope.row.plateing"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="生产标识" prop="qualityLevel" align="center"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].qualityLevel`" :rules="formRules.qualityLevel"> |
||||
<!-- <el-input v-model="scope.row.qualityLevel"></el-input> --> |
||||
<el-select v-model="scope.row.qualityLevel" clearable> |
||||
<el-option v-for="item in productionList" :key="item.id" :label="item.name" :value="item.name"></el-option>" |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="参数1下限" prop="param1Down" align="center"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>参数1下限</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].param1Down`" :rules="formRules.param1Down"> |
||||
<el-input-number v-model="scope.row.param1Down" style="width:99%;" :controls="false" :min="0"></el-input-number> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="参数1上限" prop="param1Up" align="center"> |
||||
<!-- <template #header> |
||||
<span><i style="color: red">*</i>参数1上限</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].param1Up`" :rules="formRules.param1Up"> |
||||
<el-input-number v-model="scope.row.param1Up" style="width:99%;" :controls="false" :min="0"></el-input-number> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="参数2下限" prop="param2Down" align="center"> |
||||
<!-- <template #header> |
||||
<span><i style="color: red">*</i>参数2下限</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].param2Down`" :rules="formRules.param2Down"> |
||||
<el-input-number v-model="scope.row.param2Down" style="width:99%;" :controls="false" :min="0"></el-input-number> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="参数2上限" prop="param2Up" align="center"> |
||||
<!-- <template #header> |
||||
<span><i style="color: red">*</i>参数2上限</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].param2Up`" :rules="formRules.param2Up"> |
||||
<el-input-number v-model="scope.row.param2Up" style="width:99%;" :controls="false" :min="0"></el-input-number> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="参数3下限" prop="param3Down" align="center"> |
||||
<!-- <template #header> |
||||
<span><i style="color: red">*</i>参数3下限</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].param3Down`" :rules="formRules.param3Down"> |
||||
<el-input-number v-model="scope.row.param3Down" style="width:99%;" :controls="false" :min="0"></el-input-number> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="参数3上限" prop="param3Up" align="center"> |
||||
<!-- <template #header> |
||||
<span><i style="color: red">*</i>参数3上限</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].param3Up`" :rules="formRules.param3Up"> |
||||
<el-input-number v-model="scope.row.param3Up" style="width:99%;" :controls="false" :min="0"></el-input-number> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-form> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog()">取 消</el-button> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getPqList,saveRemind,editRemind } from "@/api/qualityManagement/remindRedeem/remindRedeem" |
||||
export default { |
||||
props:{ |
||||
showDialog:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
moldAddMore:{ |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
title:{ |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
checkRow:{ |
||||
type: Object, |
||||
default: () => { |
||||
return {} |
||||
} |
||||
} |
||||
}, |
||||
data(){ |
||||
return{ |
||||
openShow:false, |
||||
formError:"", |
||||
form:{ |
||||
tableData:[] |
||||
}, |
||||
productionList:[], |
||||
formRules:{ |
||||
// 表格数据数组的整体校验(可选:如最少1行数据) |
||||
tableData: [ |
||||
{ |
||||
required: true, |
||||
message: '请至少添加一行数据', |
||||
trigger: 'submit', |
||||
type: 'array', // 明确类型为数组 |
||||
}, |
||||
{ |
||||
validator: (rule, value, callback) => { |
||||
if (value.length === 0) { |
||||
callback(new Error('请至少添加一行数据')); |
||||
} else { |
||||
callback(); |
||||
} |
||||
}, |
||||
trigger: 'submit', |
||||
}, |
||||
], |
||||
// 数组中每一项的 plateing 字段校验 |
||||
plateing: [{ required: true, message: '请输入镀种信息', trigger: ['change', 'submit'] }], |
||||
param1Down:[{ required: true, message: '请输入参数1下限', trigger: ['change', 'submit'] }] |
||||
}, |
||||
rowDetail:{} |
||||
} |
||||
}, |
||||
created(){ |
||||
this.openShow = this.showDialog |
||||
this.getPqList() |
||||
if (this.title == '新增') { |
||||
// 初始添加一行(可选) |
||||
if (this.moldAddMore && this.form.tableData.length === 0) { |
||||
this.addTable(); |
||||
} |
||||
}else{ |
||||
this.form.tableData = [] |
||||
this.rowDetail = JSON.parse(JSON.stringify(this.checkRow)) |
||||
this.rowDetail.param1Down = this.rowDetail.param1Down != -1 ? this.rowDetail.param1Down : null |
||||
this.rowDetail.param1Up = this.rowDetail.param1Up != -1 ? this.rowDetail.param1Up : null |
||||
this.rowDetail.param2Down = this.rowDetail.param2Down != -1 ? this.rowDetail.param2Down : null |
||||
this.rowDetail.param2Up = this.rowDetail.param2Up != -1 ? this.rowDetail.param2Up : null |
||||
this.rowDetail.param3Down = this.rowDetail.param3Down != -1 ? this.rowDetail.param3Down : null |
||||
this.rowDetail.param3Up = this.rowDetail.param3Up != -1 ? this.rowDetail.param3Up : null |
||||
this.form.tableData.push(this.rowDetail) |
||||
} |
||||
console.log('table----------',this.form.tableData) |
||||
}, |
||||
methods:{ |
||||
getPqList(){ |
||||
getPqList().then(res =>{ |
||||
this.productionList = res.data.data |
||||
}) |
||||
}, |
||||
closeDialog(val){ |
||||
this.$emit('closeDialog',val) |
||||
}, |
||||
selectChange(list, row) { |
||||
row._select = !row._select; |
||||
}, |
||||
// 新增一行(直接push到表单模型的 tableData 中) |
||||
addTable() { |
||||
this.form.tableData.push({ |
||||
_select: false, // 选择状态 |
||||
plateing: '', // 作业中心ID |
||||
qualityLevel: '', // 槽号/检查项 |
||||
param1Down: null, // 维护内容 |
||||
param1Up: null, |
||||
param2Down: null, |
||||
param2Up: null, // 默认当前值 |
||||
param3Down: null, // 默认当前值 |
||||
param3Up: null, // 默认当前值 |
||||
}); |
||||
}, |
||||
// 删除选中行 |
||||
delTable() { |
||||
this.form.tableData = this.form.tableData.filter(row => !row._select); |
||||
}, |
||||
// 辅助方法:根据ID获取生产标识名称 |
||||
getProductionName(id) { |
||||
if (!id) return ''; |
||||
const item = this.productionList.find(p => p.id === id); |
||||
return item ? item.name : id; |
||||
}, |
||||
submitForm(){ |
||||
this.formError = ''; |
||||
// 调用单个 Form 的校验方法 |
||||
this.$refs.tableForm.validate((isValid, invalidFields) => { |
||||
if (!isValid) { |
||||
// 校验失败:显示提示并滚动到第一个错误字段 |
||||
this.formError = '存在未完善的字段,请检查表格中的红色提示'; |
||||
|
||||
this.$nextTick(() => { |
||||
// 找到第一个错误字段并滚动到视图 |
||||
const firstError = document.querySelector('.el-form-item.is-error'); |
||||
if (firstError) { |
||||
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' }); |
||||
} |
||||
}); |
||||
return; |
||||
} |
||||
|
||||
// --- 新增:镀种与生产标识判重逻辑开始 --- |
||||
const uniqueKeys = new Set(); |
||||
let duplicateInfo = null; |
||||
|
||||
for (const row of this.form.tableData) { |
||||
// 构建唯一键:镀种信息_生产标识 |
||||
// 注意:确保 qualityLevel 有值,如果允许为空需特殊处理,这里假设必填 |
||||
const key = `${row.plateing}_${row.qualityLevel}`; |
||||
|
||||
if (uniqueKeys.has(key)) { |
||||
duplicateInfo = row; |
||||
break; // 发现重复立即跳出 |
||||
} |
||||
uniqueKeys.add(key); |
||||
} |
||||
|
||||
if (duplicateInfo) { |
||||
this.formError = `数据重复:镀种信息【${duplicateInfo.plateing}】与生产标识【${duplicateInfo.qualityLevel}】已存在,请检查表格数据。`; |
||||
// 可选:滚动到错误位置或聚焦 |
||||
return; |
||||
} |
||||
|
||||
// 校验通过:准备提交数据(过滤无用字段) |
||||
const submitData = this.form.tableData.map(row => { |
||||
const { _select, ...validData } = row; // 剔除选择状态字段 |
||||
return validData; |
||||
}); |
||||
submitData.map(item =>{ |
||||
item.remindMsgType = 1 |
||||
item.param1Down = item.param1Down ? item.param1Down : '' |
||||
item.param1Up = item.param1Up ? item.param1Up : '' |
||||
item.param2Down = item.param2Down ? item.param2Down : '' |
||||
item.param2Up = item.param2Up ? item.param2Up : '' |
||||
item.param3Down = item.param3Down ? item.param3Down : '' |
||||
item.param3Up = item.param3Up ? item.param3Up : '' |
||||
item.qualityLevel = item.qualityLevel ? item.qualityLevel : '' |
||||
}) |
||||
console.log('submitData----------',submitData) |
||||
if(this.title == '新增'){ |
||||
saveRemind(submitData).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('新增成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
}else{ |
||||
editRemind({...submitData[0]}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('修改成功') |
||||
this.closeDialog(true) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
// 优化表单字段样式 |
||||
:deep(.el-table .el-form-item) { |
||||
margin-bottom: 0; // 去掉默认边距 |
||||
} |
||||
|
||||
// 错误提示样式优化 |
||||
:deep(.el-form-item__error) { |
||||
font-size: 12px; |
||||
white-space: nowrap; |
||||
z-index: 10; |
||||
background: #fff; |
||||
padding: 2px 4px; |
||||
border: 1px solid #f56c6c; |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
// 表格行高适配 textarea |
||||
.el-table__row { |
||||
height: 80px !important; |
||||
} |
||||
|
||||
.el-table__cell { |
||||
vertical-align: middle !important; |
||||
} |
||||
|
||||
.error-message { |
||||
font-size: 14px; |
||||
line-height: 1.5; |
||||
} |
||||
:deep(.el-table .el-table__cell) { |
||||
height: 50px !important; |
||||
padding: 0 !important; |
||||
line-height: 50px !important; |
||||
} |
||||
</style> |
||||
@ -0,0 +1,295 @@ |
||||
<template> |
||||
<!-- 镀层提醒 --> |
||||
<div> |
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@selection-change="selectionChange" |
||||
@on-load="onLoad" |
||||
> |
||||
<template #menu="scope"> |
||||
<el-button type="text" @click="editRow(scope.row)">修改</el-button> |
||||
<el-button type="text" @click="rowDel(scope.row)">删除</el-button> |
||||
</template> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu-right> |
||||
<el-button type="primary" @click="handleImport()">导入</el-button> |
||||
</template> |
||||
<!-- <template #parameter1="scope"> |
||||
<span v-if="scope.row.param1Down && scope.row.param1Down != '' && !scope.row.param1Up">{{'>' + scope.row.param1Down}}</span> |
||||
<span v-if="scope.row.param1Up && scope.row.param1Up != '' && !scope.row.param1Down">{{'<' + scope.row.param1Up}}</span> |
||||
<span v-if="scope.row.param1Down && scope.row.param1Down != '' && scope.row.param1Up && scope.row.param1Up != ''">{{scope.row.param1Down}} ~ {{scope.row.param1Up}}</span> |
||||
</template> |
||||
<template #parameter2="scope"> |
||||
<span v-if="scope.row.param2Down && scope.row.param2Down != '' && !scope.row.param2Up">{{'>' + scope.row.param2Down}}</span> |
||||
<span v-if="scope.row.param2Up && scope.row.param2Up != '' && !scope.row.param2Down">{{'<' + scope.row.param2Up}}</span> |
||||
<span v-if="scope.row.param2Down && scope.row.param2Down != '' && scope.row.param2Up && scope.row.param2Up != ''">{{scope.row.param2Down}} ~ {{scope.row.param2Up}}</span> |
||||
</template> |
||||
<template #parameter3="scope"> |
||||
<span v-if="scope.row.param3Down && scope.row.param3Down != '' && !scope.row.param3Up">{{'>' + scope.row.param3Down}}</span> |
||||
<span v-if="scope.row.param3Up && scope.row.param3Up != '' && !scope.row.param3Down">{{'<' + scope.row.param3Up}}</span> |
||||
<span v-if="scope.row.param3Down && scope.row.param3Down != '' && scope.row.param3Up && scope.row.param3Up != ''">{{scope.row.param3Down}} ~ {{scope.row.param3Up}}</span> |
||||
</template> --> |
||||
</avue-crud> |
||||
<batchAddPlate |
||||
v-if="showDialog" |
||||
:show-Dialog="showDialog" |
||||
:moldAddMore="moldAddMore" |
||||
:title="title" |
||||
:checkRow="checkRow" |
||||
@closeDialog="closeDialog" |
||||
></batchAddPlate> |
||||
<!-- 导入 --> |
||||
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" |
||||
templateUrl="/blade-desk/QA/RemindMsg/downloadExcelTemplatePlate" |
||||
templateName="镀层提醒维护模板.xls" |
||||
importUrl="/blade-desk/QA/RemindMsg/importExcelPlate" |
||||
@closeDialog="closeDialog"></basic-import> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getRemindList,deleteRemind} from '@/api/qualityManagement/remindRedeem/remindRedeem' |
||||
import batchAddPlate from "./batchAddPlate.vue" |
||||
import basicImport from '@/components/basic-import/main.vue' |
||||
export default { |
||||
components:{ |
||||
batchAddPlate, |
||||
basicImport |
||||
}, |
||||
data(){ |
||||
return{ |
||||
loading:false, |
||||
form:{}, |
||||
page:{ |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
query:{}, |
||||
data:[], |
||||
showDialog:false, |
||||
moldAddMore:false, |
||||
title:"新增", |
||||
selectionList:[], |
||||
checkRow:{}, |
||||
isShowImport:false, |
||||
option:{ |
||||
height: 'auto', |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
tip: false, |
||||
simplePage: true, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: true, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
addBtn: false, |
||||
editBtn: false, |
||||
editBtnText: '修改', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
viewBtnText: '详情', |
||||
labelWidth: 120, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 100, |
||||
dialogWidth: '35%', |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: false, |
||||
filterBtn: true, |
||||
searchShowBtn: false, |
||||
columnSort: true, |
||||
excelBtn: true, |
||||
columnSort: true, |
||||
showOverflowTooltip: true, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
searchMenuPosition: 'right', |
||||
column: [ |
||||
{ |
||||
label: '镀种信息', |
||||
prop: 'plateing', |
||||
// search: true, |
||||
// sortable: true, |
||||
overHidden: true, |
||||
// headerAlign: 'center', |
||||
// align: 'left', |
||||
// searchLabelWidth: 80, |
||||
span:24, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入镀种信息', |
||||
trigger: 'blur', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label:"生产标识", |
||||
prop:"qualityLevel", |
||||
span:24, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label:"参数1", |
||||
prop:"param1", |
||||
span:24, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label:"参数2", |
||||
prop:"param2", |
||||
span:24, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label:"参数3", |
||||
prop:"param3", |
||||
span:24, |
||||
overHidden: true, |
||||
}, |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
created(){ |
||||
|
||||
}, |
||||
methods:{ |
||||
// 点击导入按钮 |
||||
handleImport() { |
||||
this.isShowImport = true |
||||
}, |
||||
searchChange(params, done){ |
||||
this.query = params; |
||||
this.onLoad() |
||||
done(); |
||||
}, |
||||
searchReset(){ |
||||
this.query = {}; |
||||
this.onLoad() |
||||
}, |
||||
currentChange(currentPage){ |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize){ |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange(){ |
||||
this.onLoad() |
||||
}, |
||||
selectionChange(list){ |
||||
this.selectionList = list; |
||||
}, |
||||
handleDelete(){ |
||||
if(this.selectionList.length == 0){ |
||||
this.$message.error('请至少选择一条数据!') |
||||
return |
||||
} |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() =>{ |
||||
deleteRemind({ids:this.selectionList.map(item => item.id).join(',')}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
rowDel(row){ |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() =>{ |
||||
deleteRemind({ids:row.id}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
handleAdd(){ |
||||
this.title = "新增" |
||||
this.moldAddMore = true |
||||
this.showDialog = true |
||||
}, |
||||
editRow(row){ |
||||
this.moldAddMore = false |
||||
this.checkRow = row |
||||
this.title = '编辑' |
||||
this.showDialog = true |
||||
}, |
||||
closeDialog(val){ |
||||
this.showDialog = false |
||||
this.isShowImport = false |
||||
if(val){ |
||||
this.onLoad() |
||||
} |
||||
}, |
||||
onLoad(){ |
||||
this.loading = true |
||||
getRemindList({ |
||||
remindMsgType:1, |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...this.query, |
||||
}).then(res =>{ |
||||
console.log('res--------------',res) |
||||
this.data = res.data.data.records |
||||
this.page.total = res.data.data.total |
||||
this.loading = false |
||||
}) |
||||
// this.data = [ |
||||
// { |
||||
// plate:"P001", |
||||
// production:"生产标识", |
||||
// // parameter1:"参数1", |
||||
// // parameter2:"参数2", |
||||
// // parameter3:"参数3", |
||||
// param1Down:'0.5', |
||||
// param1Up:'1.25', |
||||
// param2Down:'0.5', |
||||
// param2Up:'1.25', |
||||
// param3Down:'0.5', |
||||
// param3Up:'', |
||||
// } |
||||
// ]; |
||||
// this.page.total = this.data.length |
||||
// this.loading = false |
||||
} |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style> |
||||
</style> |
||||
@ -0,0 +1,255 @@ |
||||
<template> |
||||
<!-- 颜色提醒 --> |
||||
<div> |
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@selection-change="selectionChange" |
||||
@on-load="onLoad" |
||||
> |
||||
<template #showColor="scope"> |
||||
<div style="width:90%;height:25px;margin:0 auto;" |
||||
:style="{ backgroundColor: scope.row.showColor || '#fff' }"></div> |
||||
</template> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu-right> |
||||
<el-button type="primary" @click="handleImport()">导入</el-button> |
||||
</template> |
||||
<template #menu="scope"> |
||||
<el-button type="text" @click="editRow(scope.row)">修改</el-button> |
||||
<el-button type="text" @click="rowDel(scope.row)">删除</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<batchAddColor |
||||
v-if="showDialog" |
||||
:showDialog="showDialog" |
||||
:title="title" |
||||
:moldAddMore="moldAddMore" |
||||
:checkRow="checkRow" |
||||
@closeDialog="closeDialog" |
||||
></batchAddColor> |
||||
<!-- 导入 --> |
||||
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" |
||||
templateUrl="/blade-desk/QA/RemindMsg/downloadExcelTemplateColor" |
||||
templateName="颜色提醒维护模板.xls" |
||||
importUrl="/blade-desk/QA/RemindMsg/importExcelColor" |
||||
@closeDialog="closeDialog"></basic-import> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getRemindList,deleteRemind} from '@/api/qualityManagement/remindRedeem/remindRedeem' |
||||
import batchAddColor from './batchAddColor.vue' |
||||
import basicImport from '@/components/basic-import/main.vue' |
||||
export default { |
||||
components:{ |
||||
batchAddColor, |
||||
basicImport |
||||
}, |
||||
data(){ |
||||
return{ |
||||
loading:false, |
||||
form:{}, |
||||
page:{ |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
query:{}, |
||||
data:[], |
||||
selectionList:[], |
||||
isShowImport:false, |
||||
showDialog:false, |
||||
title:'', |
||||
moldAddMore:false, |
||||
checkRow:false, |
||||
option:{ |
||||
height: 'auto', |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
tip: false, |
||||
simplePage: true, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: true, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
addBtn: false, |
||||
editBtn: false, |
||||
editBtnText: '修改', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
viewBtnText: '详情', |
||||
labelWidth: 120, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 100, |
||||
dialogWidth: '35%', |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: false, |
||||
filterBtn: true, |
||||
searchShowBtn: false, |
||||
columnSort: true, |
||||
excelBtn: true, |
||||
columnSort: true, |
||||
showOverflowTooltip: true, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
searchMenuPosition: 'right', |
||||
column: [ |
||||
{ |
||||
label:"虚拟子件号", |
||||
prop:"subPartCode", |
||||
overHidden: true, |
||||
span:24, |
||||
}, |
||||
{ |
||||
label:"提醒颜色", |
||||
prop:"remindColor", |
||||
overHidden: true, |
||||
span:24, |
||||
}, |
||||
{ |
||||
label:"显示颜色", |
||||
prop:"showColor", |
||||
overHidden: true, |
||||
span:24, |
||||
}, |
||||
|
||||
] |
||||
} |
||||
} |
||||
}, |
||||
created(){ |
||||
|
||||
}, |
||||
methods:{ |
||||
// 点击导入按钮 |
||||
handleImport() { |
||||
this.isShowImport = true |
||||
}, |
||||
searchChange(params, done){ |
||||
this.query = params; |
||||
this.onLoad() |
||||
done(); |
||||
}, |
||||
searchReset(){ |
||||
this.query = {}; |
||||
this.onLoad() |
||||
}, |
||||
currentChange(currentPage){ |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize){ |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange(){ |
||||
this.onLoad() |
||||
}, |
||||
selectionChange(list){ |
||||
this.selectionList = list; |
||||
}, |
||||
handleDelete(){ |
||||
if(this.selectionList.length == 0){ |
||||
this.$message.error('请至少选择一条数据!') |
||||
return |
||||
} |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() =>{ |
||||
deleteRemind({ids:this.selectionList.map(item => item.id).join(',')}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
rowDel(row){ |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() =>{ |
||||
deleteRemind({ids:row.id}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
handleAdd(){ |
||||
this.title = "新增" |
||||
this.moldAddMore = true |
||||
this.showDialog = true |
||||
}, |
||||
editRow(row){ |
||||
this.checkRow = row |
||||
this.moldAddMore = false |
||||
this.title = '编辑' |
||||
this.showDialog = true |
||||
}, |
||||
closeDialog(val){ |
||||
this.showDialog = false |
||||
this.moldAddMore = false |
||||
this.isShowImport = false |
||||
if(val){ |
||||
this.onLoad() |
||||
} |
||||
}, |
||||
onLoad(){ |
||||
this.loading = true |
||||
getRemindList({ |
||||
remindMsgType:2, |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...this.query, |
||||
}).then(res =>{ |
||||
console.log('res--------------',res) |
||||
this.data = res.data.data.records |
||||
this.page.total = res.data.data.total |
||||
this.loading = false |
||||
}) |
||||
// this.data = [ |
||||
// { |
||||
// subPart:"0001", |
||||
// color:'黑色', |
||||
// displayColor:'rgb(0, 0, 0)' |
||||
// } |
||||
// ] |
||||
// this.page.total = this.data.length |
||||
// this.loading = false |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
|
||||
</style> |
||||
@ -0,0 +1,231 @@ |
||||
<template> |
||||
<div> |
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@selection-change="selectionChange" |
||||
@on-load="onLoad" |
||||
> |
||||
<template #menu="scope"> |
||||
<el-button type="text" @click="editRow(scope.row)">修改</el-button> |
||||
<el-button type="text" @click="rowDel(scope.row)">删除</el-button> |
||||
</template> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu-right> |
||||
<el-button type="primary" @click="handleImport()">导入</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<batchAddMaterials |
||||
v-if="showDialog" |
||||
:showDialog="showDialog" |
||||
:title="title" |
||||
:moldAddMore="moldAddMore" |
||||
:checkRow="checkRow" |
||||
@closeDialog="closeDialog" |
||||
></batchAddMaterials> |
||||
<!-- 导入 --> |
||||
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" |
||||
templateUrl="/blade-desk/QA/RemindMsg/downloadExcelTemplateMaterial" |
||||
templateName="材料提醒维护模板.xls" |
||||
importUrl="/blade-desk/QA/RemindMsg/importExcelMaterial" |
||||
@closeDialog="closeDialog"></basic-import> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getRemindList,deleteRemind} from '@/api/qualityManagement/remindRedeem/remindRedeem' |
||||
import batchAddMaterials from './batchAddMaterials.vue'; |
||||
import basicImport from '@/components/basic-import/main.vue' |
||||
export default { |
||||
components: { batchAddMaterials,basicImport }, |
||||
data() { |
||||
return { |
||||
loading: false, |
||||
form: {}, |
||||
page: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
query: {}, |
||||
data: [], |
||||
selectionList: [], |
||||
showDialog: false, |
||||
title: '', |
||||
moldAddMore: false, |
||||
checkRow: false, |
||||
isShowImport:false, |
||||
option: { |
||||
height: 'auto', |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
tip: false, |
||||
simplePage: true, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: true, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
addBtn: false, |
||||
editBtn: false, |
||||
editBtnText: '修改', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
viewBtnText: '详情', |
||||
labelWidth: 120, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 100, |
||||
dialogWidth: '35%', |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: false, |
||||
filterBtn: true, |
||||
searchShowBtn: false, |
||||
columnSort: true, |
||||
excelBtn: true, |
||||
columnSort: true, |
||||
showOverflowTooltip: true, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
searchMenuPosition: 'right', |
||||
column: [ |
||||
{ |
||||
label: '程式编号', |
||||
prop: 'formula', |
||||
overHidden: true, |
||||
span: 24, |
||||
}, |
||||
{ |
||||
label: '材料', |
||||
prop: 'material', |
||||
overHidden: true, |
||||
span: 24, |
||||
}, |
||||
], |
||||
}, |
||||
}; |
||||
}, |
||||
created() {}, |
||||
methods: { |
||||
// 点击导入按钮 |
||||
handleImport() { |
||||
this.isShowImport = true |
||||
}, |
||||
searchChange(params, done) { |
||||
this.query = params; |
||||
this.onLoad(); |
||||
done(); |
||||
}, |
||||
searchReset() { |
||||
this.query = {}; |
||||
this.onLoad(); |
||||
}, |
||||
currentChange(currentPage) { |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange() { |
||||
this.onLoad(); |
||||
}, |
||||
selectionChange(list) { |
||||
this.selectionList = list; |
||||
}, |
||||
handleDelete() { |
||||
if (this.selectionList.length == 0) { |
||||
this.$message.error('请至少选择一条数据!'); |
||||
return; |
||||
} |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
deleteRemind({ids:this.selectionList.map(item => item.id).join(',')}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}); |
||||
}, |
||||
rowDel(row) { |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
deleteRemind({ids:row.id}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}); |
||||
}, |
||||
closeDialog(val) { |
||||
this.showDialog = false; |
||||
this.moldAddMore = false; |
||||
this.isShowImport = false; |
||||
if (val) { |
||||
this.onLoad(); |
||||
} |
||||
}, |
||||
handleAdd() { |
||||
this.title = '新增'; |
||||
this.moldAddMore = true; |
||||
this.showDialog = true; |
||||
}, |
||||
editRow(row){ |
||||
this.title = '修改'; |
||||
this.moldAddMore = false; |
||||
this.checkRow = row; |
||||
this.showDialog = true; |
||||
}, |
||||
onLoad() { |
||||
this.loading = true; |
||||
getRemindList({ |
||||
remindMsgType:3, |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...this.query, |
||||
}).then(res =>{ |
||||
console.log('res--------------',res) |
||||
this.data = res.data.data.records |
||||
this.page.total = res.data.data.total |
||||
this.loading = false |
||||
}) |
||||
// this.data = [{ programNumber: '1', materials: '1' }]; |
||||
// this.page.total = this.data.length; |
||||
// this.loading = false; |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style> |
||||
</style> |
||||
@ -0,0 +1,295 @@ |
||||
<template> |
||||
<div> |
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@selection-change="selectionChange" |
||||
@on-load="onLoad" |
||||
> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu="scope"> |
||||
<el-button text @click="editRow(scope.row)">修改</el-button> |
||||
<el-button text @click="rowDel(scope.row)">删除</el-button> |
||||
</template> |
||||
<template #menu-right> |
||||
<el-button type="primary" @click="handleImport()">导入</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<batchAddPart |
||||
v-if="showDialog" |
||||
:showDialog="showDialog" |
||||
:title="title" |
||||
:moldAddMore="moldAddMore" |
||||
:checkRow="checkRow" |
||||
@closeDialog="closeDialog" |
||||
></batchAddPart> |
||||
<!-- 导入 --> |
||||
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" |
||||
templateUrl="/blade-desk/QA/RemindMsg/downloadExcelTemplate" |
||||
templateName="零件号提醒维护模板.xls" |
||||
importUrl="/blade-desk/QA/RemindMsg/importExcel" |
||||
@closeDialog="closeDialog"></basic-import> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getRemindList,deleteRemind} from '@/api/qualityManagement/remindRedeem/remindRedeem' |
||||
import batchAddPart from "./batchAddPart.vue" |
||||
import basicImport from '@/components/basic-import/main.vue' |
||||
export default { |
||||
components:{ |
||||
batchAddPart, |
||||
basicImport |
||||
}, |
||||
data() { |
||||
return { |
||||
loading:false, |
||||
form:{}, |
||||
showDialog:false, |
||||
title:"", |
||||
moldAddMore:false, |
||||
checkRow:{}, |
||||
page:{ |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
query:{}, |
||||
data:[], |
||||
selectionList:[], |
||||
isShowImport:false, |
||||
option:{ |
||||
height: 'auto', |
||||
align: 'center', |
||||
calcHeight: 32, |
||||
tip: false, |
||||
simplePage: true, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: true, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
addBtn: false, |
||||
editBtn: false, |
||||
editBtnText: '修改', |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
viewBtnText: '详情', |
||||
labelWidth: 120, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 100, |
||||
dialogWidth: '35%', |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: false, |
||||
filterBtn: true, |
||||
searchShowBtn: false, |
||||
columnSort: true, |
||||
excelBtn: true, |
||||
columnSort: true, |
||||
showOverflowTooltip: true, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
searchMenuPosition: 'right', |
||||
column: [ |
||||
{ |
||||
label: '零件号', |
||||
prop: 'partCode', |
||||
// search: true, |
||||
// sortable: true, |
||||
overHidden: true, |
||||
// headerAlign: 'center', |
||||
// align: 'left', |
||||
// searchLabelWidth: 80, |
||||
span:24, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入零件号', |
||||
trigger: 'blur', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label:"生产标识", |
||||
prop:"qualityLevel", |
||||
span:24, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label:"提醒内容", |
||||
prop:"remindContent", |
||||
type:"textarea", |
||||
span:24, |
||||
overHidden: true, |
||||
}, |
||||
{ |
||||
label:"热处理检验", |
||||
prop:"isHeatTreatment", |
||||
overHidden: true, |
||||
span:24, |
||||
type:"switch", |
||||
dicData:[ |
||||
{ |
||||
label:"否", |
||||
value:"0" |
||||
}, |
||||
{ |
||||
label:"是", |
||||
value:"1" |
||||
}, |
||||
] |
||||
}, |
||||
{ |
||||
label:"镀后检验", |
||||
prop:"isAfterPlating", |
||||
overHidden: true, |
||||
span:24, |
||||
type:"switch", |
||||
dicData:[ |
||||
{ |
||||
label:"否", |
||||
value:"0" |
||||
}, |
||||
{ |
||||
label:"是", |
||||
value:"1" |
||||
}, |
||||
] |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
created() { |
||||
}, |
||||
methods:{ |
||||
handleImport(){ |
||||
this.isShowImport = true |
||||
}, |
||||
searchChange(params, done){ |
||||
this.query = params; |
||||
this.onLoad() |
||||
done(); |
||||
}, |
||||
searchReset(){ |
||||
this.query = {}; |
||||
this.onLoad() |
||||
}, |
||||
currentChange(currentPage){ |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize){ |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange(){ |
||||
this.onLoad() |
||||
}, |
||||
selectionChange(list){ |
||||
this.selectionList = list; |
||||
}, |
||||
handleAdd(){ |
||||
this.title = '新增' |
||||
this.showDialog = true |
||||
this.moldAddMore = true |
||||
}, |
||||
editRow(row){ |
||||
this.checkRow = row |
||||
this.title = '编辑' |
||||
this.moldAddMore = false |
||||
this.showDialog = true |
||||
}, |
||||
closeDialog(val){ |
||||
this.showDialog = false |
||||
this.moldAddMore = false |
||||
this.isShowImport = false |
||||
if(val){ |
||||
this.onLoad() |
||||
} |
||||
}, |
||||
handleDelete(){ |
||||
if(this.selectionList.length == 0){ |
||||
this.$message.error('请至少选择一条数据!') |
||||
return |
||||
} |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() =>{ |
||||
deleteRemind({ids:this.selectionList.map(item => item.id).join(',')}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
rowDel(row){ |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() =>{ |
||||
deleteRemind({ids:row.id}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
onLoad(){ |
||||
this.loading = true; |
||||
getRemindList({ |
||||
remindMsgType:0, |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...this.query, |
||||
}).then(res =>{ |
||||
this.data = res.data.data.records; |
||||
this.page.total = res.data.data.total |
||||
this.loading = false; |
||||
}) |
||||
// this.data = [ |
||||
// { |
||||
// partCode:"P001", |
||||
// productionMark:"生产标识", |
||||
// content:"内容", |
||||
// heatTreatment:"1", |
||||
// afterPlating:"1" |
||||
// } |
||||
// ]; |
||||
// this.page.total = this.data.length; |
||||
// this.loading = false; |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
|
||||
</style> |
||||
@ -1,557 +1,39 @@ |
||||
<template> |
||||
<basic-container> |
||||
|
||||
<avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" |
||||
v-model:page="page" ref="crud" |
||||
v-model:search="searchParams" |
||||
@row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" |
||||
@row-update="rowUpdate" |
||||
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
||||
@refresh-change="refreshChange" @on-load="onLoad" |
||||
:beforeOpen="beforeOpen"> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleAdd()">新增</el-button> |
||||
<el-button type="danger" @click="batchDel()">删除</el-button> |
||||
</template> |
||||
<template #menu-right> |
||||
<el-button type="primary" @click="handleImport()">导入</el-button> |
||||
</template> |
||||
<template #menu="{ row }"> |
||||
|
||||
</template> |
||||
<template #partCode-form="{type}"> |
||||
<el-select v-if="type == 'edit'" remote filterable :remote-method="queryPart" |
||||
:loading="partLoading" placeholder="请选择零件" v-model="form.partId" |
||||
@change="changePart"> |
||||
<el-option v-for="item in partData" :key="item.id" :label="item.partCode" :value="item.id"></el-option> |
||||
</el-select> |
||||
</template> |
||||
<template #partCode-search="{ disabled, size }"> |
||||
<el-select remote filterable :remote-method="queryPart" |
||||
:loading="partLoading" placeholder="请选择零件" v-model="searchParams.partId" |
||||
> |
||||
<el-option v-for="item in partData" :key="item.id" :label="item.partCode" :value="item.id"></el-option> |
||||
</el-select> |
||||
</template> |
||||
|
||||
<!-- <template #heatTreat="scope"> |
||||
<el-tag v-if="scope.row.afterPlating" type="success">是</el-tag> |
||||
<el-tag v-else type="warning">否</el-tag> |
||||
</template> --> |
||||
|
||||
</avue-crud> |
||||
|
||||
<!-- 导入 --> |
||||
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" |
||||
templateUrl="/blade-desk/QA/RemindMsg/downloadExcelTemplate" |
||||
templateName="提醒信息维护模板.xls" |
||||
importUrl="/blade-desk/QA/RemindMsg/importExcel" |
||||
@closeDialog="closeDialog"></basic-import> |
||||
|
||||
<batch-add v-if="showDialog" :show-dialog="showDialog" @closeDialog="closeDialog"></batch-add> |
||||
</basic-container> |
||||
<basic-container> |
||||
<!-- 消息提醒维护 --> |
||||
<el-tabs v-model="tabPosition"> |
||||
<el-tab-pane label="零件号提醒" name="partCode"></el-tab-pane> |
||||
<el-tab-pane label="镀层提醒" name="cladLayer"></el-tab-pane> |
||||
<el-tab-pane label="颜色提醒" name="color"></el-tab-pane> |
||||
<el-tab-pane label="材料提醒" name="materials"></el-tab-pane> |
||||
</el-tabs> |
||||
<partReminder v-if="tabPosition == 'partCode'"></partReminder> |
||||
<cladLayer v-if="tabPosition == 'cladLayer'"></cladLayer> |
||||
<colorReminder v-if="tabPosition == 'color'"></colorReminder> |
||||
<materialsReminder v-if="tabPosition == 'materials'"></materialsReminder> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { |
||||
add, |
||||
getRole, |
||||
getRoleAlias, |
||||
getRoleTreeById, |
||||
grant, |
||||
grantTree, |
||||
remove, |
||||
update, |
||||
} from '@/api/system/role'; |
||||
import {getList,deleteRemind,editRemind,getPartList,getSubPartList} from '@/api/qualityManagement/remindRedeem/remindRedeem' |
||||
import { mapGetters } from 'vuex'; |
||||
import { validatenull } from '@/utils/validate'; |
||||
import basicImport from '@/components/basic-import/main.vue' |
||||
import batchAdd from './components/batchAdd.vue'; |
||||
|
||||
import partReminder from './components/partReminder.vue' |
||||
import cladLayer from './components/cladLayer.vue' |
||||
import colorReminder from "./components/colorReminder.vue" |
||||
import materialsReminder from "./components/materialsReminder.vue" |
||||
export default { |
||||
components: { |
||||
basicImport, |
||||
batchAdd |
||||
partReminder, |
||||
cladLayer, |
||||
colorReminder, |
||||
materialsReminder |
||||
}, |
||||
data() { |
||||
return { |
||||
partData:[], |
||||
partLoading:false, |
||||
isShowImport:false, |
||||
inBatchesOpen: false, |
||||
platingSmallOpen: false, |
||||
planOrderArr: [], |
||||
isOpen: false, |
||||
rowItem: {}, |
||||
poId: null, |
||||
form: {}, |
||||
box: false, |
||||
props: { |
||||
label: 'title', |
||||
value: 'key', |
||||
}, |
||||
menuGrantList: [], |
||||
dataScopeGrantList: [], |
||||
apiScopeGrantList: [], |
||||
apiGrantList: [], |
||||
menuTreeObj: [], |
||||
dataScopeTreeObj: [], |
||||
apiScopeTreeObj: [], |
||||
selectionList: [], |
||||
query: {}, |
||||
loading: true, |
||||
page: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
showDialog:false, |
||||
searchParams:{}, |
||||
option: { |
||||
columnSort: true, |
||||
tip: false, |
||||
height: 'auto', |
||||
calcHeight: 32, |
||||
simplePage: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: true, |
||||
selection: true, |
||||
addBtn: false, |
||||
editBtn: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtnText: '修改', |
||||
labelWidth: 120, |
||||
menuWidth: 80, |
||||
dialogWidth: 900, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: false, |
||||
filterBtn: true, |
||||
searchShowBtn: false, |
||||
excelBtn: true, |
||||
index: false, |
||||
showOverflowTooltip: true, |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
gridBtn: false, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: 'left', |
||||
gridBtn: false, |
||||
searchMenuPosition: 'right', |
||||
align: 'center', |
||||
column: [ |
||||
{ |
||||
label: '零件号', |
||||
prop: 'partCode', |
||||
// bind: 'dsPart.partCode', |
||||
search: true, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
type:'select', |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请选择零件号', |
||||
trigger: 'blur', |
||||
}, |
||||
], |
||||
// dicUrl:'/api/blade-desk/dsPart/getPartList', |
||||
// dicUrl:"/api/blade-desk/dsPart/list?current=1&size=100", |
||||
// props:{ |
||||
// label: 'partCode', |
||||
// value:'id', |
||||
// res:'res.records' |
||||
// }, |
||||
// onChange:val =>{ |
||||
// console.log('val-------------',val) |
||||
// this.form.partName = val && val.item && val.item.partName |
||||
// getSubPartList({ |
||||
// partCode:val && val.item && val.item.partCode |
||||
// }).then(res =>{ |
||||
// console.log('option--------',this.option) |
||||
// this.option.column[6].dicData = res.data.data |
||||
// // this.form.tableData[index].subList = res.data.data |
||||
// }) |
||||
// } |
||||
}, |
||||
{ |
||||
label: '零件名称', |
||||
prop: 'partName', |
||||
// bind: 'dsPart.partName', |
||||
search: true, |
||||
sortable: true, |
||||
width: 150, |
||||
editDisabled:true, |
||||
span: 12, |
||||
}, |
||||
{ |
||||
label: '生产标识', |
||||
prop: 'prodFlagText', |
||||
search: true, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
type:'select', |
||||
dicUrl:'/api/blade-desk/BA/ProdMark/listForSelect', |
||||
props:{ |
||||
label:'name', |
||||
value:'id' |
||||
} |
||||
}, |
||||
{ |
||||
label: '材料', |
||||
prop: 'material', |
||||
bind: 'dsPart.material', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
display: false, |
||||
}, |
||||
{ |
||||
label: '镀种', |
||||
prop: 'plate', |
||||
bind: 'dsPart.plate', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
display: false, |
||||
}, |
||||
{ |
||||
label: '工艺一级路线', |
||||
prop: 'craftWay', |
||||
bind: 'dsPart.craftWay', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
display: false, |
||||
}, |
||||
{ |
||||
label: '子件编码', |
||||
prop: 'subPartCode', |
||||
type:'select', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
type:'select', |
||||
dicData:[], |
||||
props:{ |
||||
label:"partCode", |
||||
value:"id" |
||||
} |
||||
}, |
||||
{ |
||||
label: '提醒内容', |
||||
prop: 'remindContent', |
||||
search: false, |
||||
type: 'textarea', |
||||
rows: 2, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
}, |
||||
{ |
||||
label: '参数1名称', |
||||
prop: 'param1', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
display: false, |
||||
}, |
||||
{ |
||||
label: '镀金检测', |
||||
prop: 'testAu', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
display: false, |
||||
}, |
||||
{ |
||||
label: '镀银检测', |
||||
prop: 'testAg', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
display: false, |
||||
}, |
||||
{ |
||||
label: '热处理', |
||||
prop: 'isHeatTreatment', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
type: 'switch', |
||||
dicData: [ |
||||
{ label: '关', value: '0' }, |
||||
{ label: '开', value: '1' } |
||||
], |
||||
}, |
||||
{ |
||||
label: '镀后检验', |
||||
prop: 'isAfterPlating', |
||||
search: false, |
||||
sortable: true, |
||||
width: 150, |
||||
span: 12, |
||||
type: 'switch', |
||||
dicData: [ |
||||
{ label: '关', value: '0' }, |
||||
{ label: '开', value: '1' } |
||||
], |
||||
}, |
||||
], |
||||
}, |
||||
|
||||
data: [], |
||||
isRushOpen: false,//加急弹框 |
||||
isBatchOpen: false,//分批处理 |
||||
}; |
||||
}, |
||||
mounted() { |
||||
// this.getPartList() |
||||
}, |
||||
return { |
||||
tabPosition: 'partCode' |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
methods: { |
||||
changePart(val){ |
||||
let tmp = this.partData.find(item => item.id == val) |
||||
this.form.partName = tmp && tmp.partName |
||||
getSubPartList({ |
||||
partCode:val && val.item && val.item.partCode |
||||
}).then(res =>{ |
||||
console.log('option--------',this.option) |
||||
this.form.subPartCode = '' |
||||
this.option.column[6].dicData = res.data.data |
||||
// this.form.tableData[index].subList = res.data.data |
||||
}) |
||||
}, |
||||
getPartList(){ |
||||
getPartList({ |
||||
current:1, |
||||
size:50 |
||||
}).then(res =>{ |
||||
console.log('partData--------',res) |
||||
this.partData = res.data.data.records |
||||
}) |
||||
}, |
||||
queryPart(query){ |
||||
this.partLoading = true |
||||
console.log('form----------',this.form) |
||||
if(query){ |
||||
getPartList({ |
||||
current:1, |
||||
size:50, |
||||
partCode:query |
||||
}).then(res =>{ |
||||
this.partData = res.data.data.records |
||||
this.partLoading = false |
||||
}) |
||||
}else{ |
||||
getPartList({ |
||||
current:1, |
||||
size:50 |
||||
}).then(res =>{ |
||||
console.log('partData--------',res) |
||||
this.partData = res.data.data.records |
||||
let tmp = this.partData.find(item => item.id == this.form.partId) |
||||
if(!tmp){ |
||||
getPartList({ |
||||
current:1, |
||||
size:50, |
||||
partCode:this.form.partCode |
||||
}).then(res =>{ |
||||
this.partData = [...this.partData,...res.data.data.records] |
||||
this.partLoading = false |
||||
}) |
||||
}else{ |
||||
this.partLoading = false |
||||
} |
||||
}) |
||||
} |
||||
}, |
||||
// 点击新增按钮 |
||||
handleAdd(){ |
||||
console.log('111111111111111') |
||||
this.showDialog = true |
||||
}, |
||||
// 点击导入按钮 |
||||
handleImport() { |
||||
this.isShowImport = true |
||||
}, |
||||
// 批量关闭 |
||||
batchDel() { |
||||
if(this.selectionList.length == 0){ |
||||
this.$message.error('请至少选择一条数据') |
||||
return |
||||
} |
||||
this.$confirm('确定将选择数据批量删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
deleteRemind({ |
||||
ids:this.selectionList.map(item => item.id).join(',') |
||||
}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
closeDialog(val) { |
||||
this.isRushOpen = false |
||||
this.isBatchOpen = false |
||||
this.showDialog = false |
||||
this.isShowImport = false |
||||
if(val){ |
||||
this.onLoad() |
||||
} |
||||
}, |
||||
initData(roleId) { |
||||
getRoleTreeById(roleId).then(res => { |
||||
const column = this.findObject(this.option.column, 'parentId'); |
||||
column.dicData = res.data.data; |
||||
}); |
||||
}, |
||||
submit() { |
||||
const menuList = this.$refs.treeMenu.getCheckedKeys(); |
||||
const dataScopeList = this.$refs.treeDataScope.getCheckedKeys(); |
||||
const apiScopeList = this.$refs.treeApiScope.getCheckedKeys(); |
||||
grant(this.idsArray, menuList, dataScopeList, apiScopeList).then(() => { |
||||
this.box = false; |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
this.selectionList = []; |
||||
this.onLoad(this.page); |
||||
}); |
||||
}, |
||||
rowSave(row, done, loading) { |
||||
add(row).then( |
||||
() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
done(); |
||||
}, |
||||
error => { |
||||
window.console.log(error); |
||||
loading(); |
||||
} |
||||
); |
||||
}, |
||||
rowUpdate( row, index, done, loading){ |
||||
editRemind(row).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('修改成功') |
||||
this.onLoad() |
||||
done() |
||||
} |
||||
}) |
||||
}, |
||||
rowDel(row) { |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
deleteRemind({ |
||||
ids:row.id |
||||
}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
}, |
||||
<style> |
||||
|
||||
searchReset() { |
||||
this.searchParams = {} |
||||
this.query = {}; |
||||
this.onLoad(this.page); |
||||
}, |
||||
searchChange(params, done) { |
||||
console.log('params-------------',params) |
||||
this.query = params; |
||||
this.page.currentPage = 1; |
||||
this.onLoad(this.page, params); |
||||
done(); |
||||
}, |
||||
selectionChange(list) { |
||||
this.selectionList = list; |
||||
}, |
||||
selectionClear() { |
||||
this.selectionList = []; |
||||
this.$refs.crud.toggleSelection(); |
||||
}, |
||||
beforeOpen(done, type) { |
||||
if(type == 'edit'){ |
||||
if(this.form.partCode && this.form.partCode != ''){ |
||||
getPartList({ |
||||
current:1, |
||||
size:10, |
||||
partCode:this.form.partCode |
||||
}).then(res =>{ |
||||
this.partData = [...this.partData,...res.data.data.records] |
||||
done() |
||||
}) |
||||
}else{ |
||||
done() |
||||
} |
||||
} |
||||
}, |
||||
currentChange(currentPage) { |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
refreshChange() { |
||||
this.onLoad(); |
||||
}, |
||||
onLoad(page, params = {}) { |
||||
this.loading = true; |
||||
getList({ |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...this.query |
||||
}).then(res =>{ |
||||
this.data = res.data.data.records |
||||
this.page.total = res.data.data.total |
||||
this.loading = false |
||||
}).catch(err =>{ |
||||
console.log('err00000000000',err) |
||||
this.loading = false |
||||
this.data = [] |
||||
this.page.total = 0 |
||||
}) |
||||
}, |
||||
}, |
||||
|
||||
}; |
||||
</script> |
||||
</style> |
||||
Loading…
Reference in new issue