<!--
|
* @Descripttion:
|
* @version:
|
* @Author: zt_lc
|
* @Date: 2022-07-01 15:15:54
|
* @LastEditors: zt_lc
|
* @LastEditTime: 2022-07-04 18:25:28
|
-->
|
<template>
|
<div>
|
<div style="display:flex;justify-content:space-around;">
|
<div style="width:32%">
|
<el-card class="document-params-template">
|
<div slot="header">
|
<span>检测标准</span>
|
</div>
|
<el-table
|
ref="operationTestStandardTable"
|
:data="operationTestStandardList"
|
class="l-mes"
|
highlight-current-row
|
@row-click="testStandardRowClick"
|
height="400px"
|
>
|
<el-table-column
|
label="标准编号"
|
prop="standardNo"
|
align="center"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
label="标准名称"
|
prop="standardName"
|
align="center"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
label="检测类型"
|
prop="inspectionType"
|
align="center"
|
:formatter="inspectionTypeFomat"
|
/>
|
</el-table>
|
</el-card>
|
</div>
|
<div style="width:64%">
|
<el-card class="document-template-rule">
|
<div slot="header">
|
<span>标准参数</span>
|
</div>
|
<el-table
|
:data="operationTestStandardParamList"
|
id="testStandardParamTable"
|
ref="testStandardParam"
|
:default-sort="{ prop: 'index' }"
|
highlight-current-row
|
height="400px"
|
style="width: 100%"
|
>
|
<el-table-column
|
prop="index"
|
label="序号"
|
align="center"
|
width="50"
|
/>
|
<el-table-column label="线芯" prop="wireCore" align="center" />
|
<el-table-column label="参数编号" prop="code" align="center" />
|
<el-table-column
|
label="参数项"
|
prop="parameterItem"
|
align="center"
|
/>
|
<el-table-column
|
label="检测范围"
|
prop="referenceValue"
|
align="center"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
<el-input
|
:ref="'reference_' + scope.$index"
|
v-model="scope.row.referenceValue"
|
@keyup.enter.native="nextFocus(scope.$index)"
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="检测类型" prop="paramType" align="center">
|
<template slot-scope="scope">
|
<span>{{
|
scope.row.paramType
|
? paramTypeOptions.find((item) => {
|
return item.value === scope.row.paramType
|
}).label
|
: ''
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="参数格式"
|
prop="parameterFormat"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column label="通道" prop="aisle" align="center">
|
</el-table-column>
|
<el-table-column label="部位" prop="position" align="center">
|
</el-table-column>
|
<el-table-column label="单位" prop="unit" align="center" />
|
</el-table>
|
</el-card>
|
</div>
|
</div>
|
</div>
|
</template>
|
<style lang="scss" scoped>
|
.document-params-template >>> .el-card__body {
|
padding: 0px 0px 5px;
|
}
|
.document-template-rule >>> .el-card__body {
|
padding: 0px 0px 5px;
|
}
|
.red-but.is-disabled {
|
color: #fab6b6;
|
}
|
|
.red-but {
|
color: red;
|
}
|
</style>
|
<script>
|
import {
|
getRoutingTestStandardList,
|
getOperationTestStandardParam,
|
getTestStandardParams,
|
qryDocTestStandard,
|
qryDocTestStandardDetailsByStandardId
|
} from '@/api/oa/technologyDocument'
|
export default {
|
props: {
|
editable: {
|
type: Boolean,
|
default: false
|
},
|
dataFormId: {
|
type: Number,
|
default: 0
|
},
|
routingOperationId: {
|
type: Number,
|
default: 0
|
},
|
paramTypeOptions: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
},
|
// operationTestStandardList: {
|
// type: Array,
|
// default: () => {
|
// return []
|
// }
|
// },
|
bomRoutingId: {
|
type: Number,
|
default: 0
|
},
|
everyBomRoutingId: {
|
type: Number,
|
default: 0
|
},
|
operationId: {
|
type: Number,
|
default: 0
|
},
|
operationName: {
|
type: String,
|
default: ''
|
}
|
},
|
data() {
|
return {
|
addCustomizeTestStandardVisible: false,
|
operationTestStandardParamList: [],
|
currentOperationTestStandardId: 0,
|
paramSelArr: [],
|
paramSelCol: 'code',
|
showParam: false,
|
insertIndex: null,
|
last: true,
|
editOrderParamVisible: false,
|
multiSelect: true,
|
paramObj: {
|
state: '02accepted'
|
},
|
operationTestStandardList: [],
|
isExecuteCreate: false
|
}
|
},
|
components: {},
|
mounted() {
|
// this.rowDrop()
|
},
|
created() {
|
if (
|
this.everyBomRoutingId != null &&
|
this.everyBomRoutingId != 0 &&
|
this.bomRoutingId != null &&
|
this.bomRoutingId != 0 &&
|
this.everyBomRoutingId === this.bomRoutingId
|
) {
|
this.isExecuteCreate = true
|
} else {
|
this.isExecuteCreate = false
|
}
|
},
|
methods: {
|
selectLastTestStandard() {
|
if (
|
this.operationTestStandardList &&
|
this.operationTestStandardList.length > 0
|
) {
|
const lastTestStandard = this.operationTestStandardList[
|
this.operationTestStandardList.length - 1
|
]
|
this.$refs.operationTestStandardTable.setCurrentRow(lastTestStandard)
|
this.getOperationTestStandardParam(lastTestStandard.id)
|
}
|
},
|
// 根据制造订单id和工艺工序id查询检测标准
|
getRoutingTestStandard(param) {
|
getRoutingTestStandardList(param).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.currentOperationTestStandardId = 0
|
this.operationTestStandardList = resData.data
|
if (this.operationTestStandardList) {
|
this.$refs.operationTestStandardTable.setCurrentRow(
|
this.operationTestStandardList[0]
|
)
|
this.testStandardRowClick(this.operationTestStandardList[0])
|
}
|
this.operationTestStandardParamList = []
|
} else {
|
this.currentOperationTestStandardId = 0
|
this.operationTestStandardList = []
|
this.operationTestStandardParamList = []
|
this.$message.error('检测标准请求异常')
|
}
|
})
|
},
|
// 检测标准点击事件,显示检测标准参数
|
testStandardRowClick(row) {
|
this.getSonList(row.id)
|
},
|
// 根据工艺工序id、模板id去获取模板下的参数
|
getOperationTestStandardParam(standardId) {
|
this.currentOperationTestStandardId = standardId
|
getTestStandardParams(
|
Object.assign({
|
testStandardId: standardId
|
})
|
).then((response) => {
|
this.operationTestStandardParamList = response.data.data
|
})
|
},
|
|
rowDrop() {
|
const that = this
|
const tbody = document.querySelector(
|
'#testStandardParamTable .el-table__body-wrapper tbody'
|
)
|
Sortable.create(tbody, {
|
// 结束拖拽
|
onEnd({ newIndex, oldIndex }) {
|
if (newIndex > oldIndex) {
|
// 下移
|
that.operationTestStandardParamList
|
.filter((e) => e.index === oldIndex + 1)
|
.forEach((e) => (e.index = 'x'))
|
that.operationTestStandardParamList
|
.filter((e) => e.index > oldIndex + 1 && e.index <= newIndex + 1)
|
.forEach((e) => (e.index = e.index - 1))
|
that.operationTestStandardParamList
|
.filter((e) => e.index === 'x')
|
.forEach((e) => (e.index = newIndex + 1))
|
} else if (oldIndex > newIndex) {
|
// 上移
|
that.operationTestStandardParamList
|
.filter((e) => e.index === oldIndex + 1)
|
.forEach((e) => (e.index = 'x'))
|
that.operationTestStandardParamList
|
.filter((e) => e.index < oldIndex + 1 && e.index >= newIndex + 1)
|
.forEach((e) => (e.index = e.index + 1))
|
that.operationTestStandardParamList
|
.filter((e) => e.index === 'x')
|
.forEach((e) => (e.index = newIndex + 1))
|
}
|
}
|
})
|
},
|
editTestStandardParam(row) {
|
this.editOrderParamVisible = true
|
this.$nextTick(() => {
|
this.$refs.editOrderParam.init(row)
|
})
|
},
|
deleteTestStandardParam(row) {
|
this.$confirm('是否确认删除参数编号为:' + row.code, {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then((data) => {
|
this.operationTestStandardParamList.splice(
|
this.operationTestStandardParamList.findIndex(
|
(item) => item.index === row.index
|
),
|
1
|
)
|
this.operationTestStandardParamList
|
.filter((e) => e.index >= row.index)
|
.forEach((e) => (e.index = e.index - 1))
|
this.$message.success('删除参数成功')
|
})
|
},
|
// 选择基础参数(添加)
|
relateOperationParam() {
|
if (this.currentOperationTestStandardId !== 0) {
|
this.selectedParamCode()
|
this.showParam = true
|
} else {
|
this.$message.error('请选择检测标准')
|
}
|
},
|
// 选择基础参数(插入)
|
insertOperationParam(row) {
|
this.selectedParamCode()
|
this.showParam = true
|
this.last = false
|
this.insertIndex = row.index
|
},
|
selectedParamCode() {
|
// 筛选出当前页面已有的参数
|
this.paramSelArr = []
|
if (this.operationTestStandardParamList.length > 0) {
|
this.operationTestStandardParamList.forEach((ele) => {
|
if (ele.code != null && ele.code !== '') {
|
this.paramSelArr.push(ele.code)
|
}
|
})
|
}
|
},
|
refreshOrderParamList() {
|
getOperationTestStandardParam(
|
Object.assign({
|
moTestStandardId: this.currentOperationTestStandardId
|
})
|
).then((response) => {
|
this.operationTestStandardParamList = response.data.data
|
})
|
},
|
// 选中的基础参数信息
|
getJoinData(param) {
|
const newDataList = this.operationTestStandardParamList
|
this.operationTestStandardParamList = []
|
this.$nextTick(() => {
|
this.operationTestStandardParamList = newDataList
|
for (let i = 0, len = param.length; i < len; i++) {
|
if (this.last) {
|
this.operationTestStandardParamList.push(
|
Object.assign({
|
moTestStandardId: this.currentOperationTestStandardId,
|
code: param[i].code,
|
parameterItem: param[i].parameterItem,
|
type: param[i].type,
|
unit: param[i].unit,
|
parameterFormat: param[i].parameterFormat,
|
referenceValue: null,
|
index: this.operationTestStandardParamList.length + 1
|
})
|
)
|
} else {
|
this.operationTestStandardParamList
|
.filter((e) => e.index >= this.insertIndex)
|
.forEach((e) => (e.index = e.index + 1))
|
this.operationTestStandardParamList.push(
|
Object.assign({
|
moTestStandardId: this.currentOperationTestStandardId,
|
code: param[i].code,
|
parameterItem: param[i].parameterItem,
|
type: param[i].type,
|
unit: param[i].unit,
|
parameterFormat: param[i].parameterFormat,
|
referenceValue: null,
|
index: this.insertIndex
|
})
|
)
|
}
|
}
|
})
|
},
|
// 输入enter键,下一行自动聚焦并选中‘要求范围’字段的input
|
nextFocus(index) {
|
let nextRef
|
if (index + 1 >= this.operationTestStandardParamList.length) {
|
nextRef = 'reference_0'
|
} else {
|
nextRef = 'reference_' + (index + 1)
|
}
|
this.$refs[nextRef].focus()
|
this.$refs[nextRef].select()
|
},
|
getMainList() {
|
var obj = {
|
docBomId: this.bomRoutingId,
|
routingOperationId: this.routingOperationId
|
}
|
qryDocTestStandard(obj).then((res) => {
|
this.operationTestStandardList = res.data.data
|
})
|
},
|
getSonList(standardId) {
|
this.currentOperationTestStandardId = standardId
|
qryDocTestStandardDetailsByStandardId(
|
Object.assign({
|
standardId: standardId
|
})
|
).then((response) => {
|
this.operationTestStandardParamList = response.data.data
|
})
|
},
|
inspectionTypeFomat(row, column) {
|
if (row.inspectionType != null) {
|
if (row.inspectionType === '08process') {
|
return '工序检'
|
} else if (row.inspectionType === '00outputfirst') {
|
return '产出首检'
|
} else if (row.inspectionType === '01output') {
|
return '产出尾检'
|
} else if (row.inspectionType === '06finishedproduct') {
|
return '成品检'
|
} else if (row.inspectionType === '02stock') {
|
return '库存报检'
|
} else if (row.inspectionType === '03erp') {
|
return 'erp库存报检'
|
} else if (row.inspectionType === '04onsite') {
|
return '巡检'
|
} else if (row.inspectionType === '05back') {
|
return '退货报检'
|
} else if (row.inspectionType === '07batchfirst') {
|
return '批次首检'
|
} else if (row.inspectionType === '04firstInsp') {
|
return '上机检'
|
} else if (row.inspectionType === '05lastInsp') {
|
return '下机检'
|
}
|
} else {
|
return ''
|
}
|
}
|
},
|
watch: {
|
// operationTestStandardList: {
|
// handler(newValue, oldValue) {
|
// // this.operationTestStandardParamList = []
|
// },
|
// deep: true
|
// }
|
routingOperationId: {
|
handler(newValue, oldValue) {
|
if (newValue) {
|
if (
|
this.everyBomRoutingId != null &&
|
this.everyBomRoutingId != 0 &&
|
this.bomRoutingId != null &&
|
this.bomRoutingId != 0 &&
|
this.everyBomRoutingId === this.bomRoutingId
|
) {
|
this.getMainList()
|
}
|
}
|
},
|
immediate: true
|
}
|
}
|
}
|
</script>
|