<template>
|
<div class="mod-config">
|
<basic-container>
|
<el-row>
|
<el-col :span="11">
|
<ttable
|
:table="table"
|
@handleSelectionChange="handleCurrentChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:ajaxFun="ajaxFun"
|
@dbClickRow="handleDbClickRow"
|
ref="testStandardTable"
|
>
|
<template #toolbar></template>
|
</ttable>
|
</el-col>
|
<el-col :span="13" style="padding-left: 10px">
|
<el-card>
|
<div slot="header">
|
<el-row>
|
<el-col :span="8">
|
<span>标准参数</span>
|
</el-col>
|
<el-col :span="8" :offset="4">
|
<el-button
|
style="float: right; padding: 3px 0"
|
type="text"
|
@click="beginItemLayOut"
|
>
|
布局
|
</el-button>
|
</el-col>
|
<el-col :span="2">
|
<el-button
|
style="float: right; padding: 3px 0"
|
type="text"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormTestStandardParam`"
|
v-if="editable"
|
>保存
|
</el-button>
|
</el-col>
|
<el-col :span="2">
|
<el-button
|
style="float: right; padding: 3px 0"
|
type="text"
|
@click="relateOperationParam()"
|
v-if="editable"
|
>添加
|
</el-button>
|
</el-col>
|
</el-row>
|
<el-row>
|
<span style="font-weight:500" v-if="testNo.length > 0"
|
>您当前选择的检测标准编号是:<span style="color:#066EFF">{{
|
testNo
|
}}</span></span
|
>
|
</el-row>
|
</div>
|
<el-table
|
:data="testStandardParams"
|
id="testStandardParamTable"
|
ref="testStandardParam"
|
:default-sort="{ prop: 'index' }"
|
highlight-current-row
|
height="700"
|
style="width: 100%"
|
class="l-mes-table"
|
border
|
stripe
|
>
|
<el-table-column
|
prop="index"
|
label="序号"
|
align="center"
|
width="50"
|
/>
|
<el-table-column
|
label="是否引用工艺参数"
|
prop="isReference"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-select
|
v-model="scope.row.isReference"
|
placeholder="请选择"
|
style="width: 100%;"
|
>
|
<el-option
|
v-for="(item, index) in referenceOptions"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column label="是否抽检" prop="isCheck" align="center">
|
<template slot-scope="scope">
|
<el-select
|
v-model="scope.row.isCheck"
|
placeholder="请选择"
|
style="width: 100%;"
|
>
|
<el-option
|
v-for="(item, index) in isCheckOptions"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="线芯"
|
prop="wireCore"
|
align="center"
|
width="60"
|
>
|
<template slot-scope="scope">
|
<el-input v-model="scope.row.wireCore"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="参数编号" prop="code" align="center" />
|
<el-table-column
|
label="参数项"
|
prop="parameterItem"
|
align="center"
|
/>
|
<el-table-column
|
label="要求范围"
|
prop="referenceValue"
|
align="center"
|
>
|
<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="defaultValue"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-input
|
:ref="'defaultValue_' + scope.$index"
|
v-model="scope.row.defaultValue"
|
@keyup.enter.native="nextFocus2(scope.$index)"
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="参数项类型"
|
prop="paramType"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<el-select
|
v-model="scope.row.paramType"
|
placeholder="请选择"
|
style="width: 100%;"
|
>
|
<el-option
|
v-for="(item, index) in paramTypeOptions"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="参数格式"
|
prop="parameterFormat"
|
align="center"
|
width="80"
|
>
|
<template slot-scope="scope">
|
<el-input v-model="scope.row.parameterFormat"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="通道"
|
prop="aisle"
|
align="center"
|
width="80"
|
>
|
<template slot-scope="scope">
|
<el-input v-model="scope.row.aisle"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="部位"
|
prop="position"
|
align="center"
|
width="80"
|
>
|
<template slot-scope="scope">
|
<el-input v-model="scope.row.position"></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="单位" prop="unit" align="center" />
|
<!--<el-table-column label="参数类型" prop="type" align="center" :formatter="getParam"/>-->
|
<el-table-column label="操作" align="center">
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="insertOperationParam(scope.row)"
|
v-if="editable"
|
>插入
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="editTestStandardParam(scope.row)"
|
v-if="editable && scope.row.id != null"
|
>公式
|
</el-button>
|
<el-button
|
type="text"
|
size="mini"
|
@click.stop="deleteTestStandardParam(scope.row)"
|
v-if="editable"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</el-col>
|
</el-row>
|
<!-- 弹窗, 新增 / 修改 -->
|
<standard-form
|
:editable="editable"
|
v-if="addOrUpdateVisible"
|
ref="addOrUpdate"
|
@refreshDataList="getData"
|
></standard-form>
|
<standard-param-form
|
v-if="standardParamVisible"
|
ref="addOrUpdateStandardParam"
|
@refreshDataList="refreshJoinData"
|
></standard-param-form>
|
<!-- 弹窗, 基础参数选择 -->
|
<ParamDialog
|
:currshowlist.sync="showParam"
|
@handleSelectionChange="getJoinData"
|
:paramSelArr="paramSelArr"
|
:paramSelCol="paramSelCol"
|
></ParamDialog>
|
<edit-param-form
|
v-if="editParamVisible"
|
ref="editParam"
|
@refreshParamList="refreshParamList"
|
></edit-param-form>
|
<itemLayout
|
:currshowlist.sync="showItemLayout"
|
:currentTestStandard="currentTestStandard"
|
/>
|
</basic-container>
|
</div>
|
</template>
|
<script>
|
import {
|
fetchListTestStandard,
|
delTestStandard,
|
getTestStandardParams,
|
addTestStandardParam,
|
changeState
|
} from '@/api/quality/teststandard'
|
import StandardForm from './standard-form'
|
import StandardParamForm from './standard-param-form'
|
import ttable from '@/views/common/ztt-table'
|
import { remote } from '@/api/admin/dict'
|
import ParamDialog from '@/views/common/param.vue'
|
import { copyTestStandard } from '../../../api/quality/teststandard'
|
import EditParamForm from './edit-param-form'
|
import itemLayout from './item-layout'
|
export default {
|
data() {
|
return {
|
paramTypeOptions: [],
|
currentTestStandard: null,
|
testStandardId: 0,
|
testStandardParams: [],
|
standardParamVisible: false,
|
ajaxFun: fetchListTestStandard,
|
typeOptions: [],
|
multipleSelection: [],
|
isShowQuery: false,
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: true,
|
url: '/mes/testStandard/upload'
|
},
|
prelang: 'operation',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: true, //
|
seqNo: true,
|
isRefresh: true, // 是否显示刷新按钮
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: false, // 高级查询按钮
|
defaultOrderBy: { column: 'standardNo', direction: 'desc' }
|
},
|
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
minWidth: '120',
|
prop: 'standardNo',
|
label: '标准编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text',
|
render: { fun: this.addOrUpdateHandle }
|
},
|
{
|
minWidth: '120',
|
prop: 'standardName',
|
label: '标准名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'inspectionType',
|
label: '检测类型',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
formatter: this.formatInspectionType,
|
optList: () => {
|
return this.getInspectionTypeOptionList()
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'operationName',
|
label: '工序名称',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
minWidth: '120',
|
prop: 'state',
|
label: '状态',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'select',
|
optList: () => {
|
return this.getStateOptionList()
|
},
|
formatter: (row, column, cellValue) => {
|
var formatVal
|
if (cellValue === '01draft') {
|
formatVal = '草稿'
|
} else if (cellValue === '02accepted') {
|
formatVal = '已接受'
|
} else if (cellValue === '03cancelled') {
|
formatVal = '已拒绝'
|
} else if (cellValue === '04disabled') {
|
formatVal = '失效'
|
}
|
return formatVal
|
}
|
},
|
{
|
minWidth: '120',
|
prop: 'remark',
|
label: '备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
],
|
toolbar: [
|
{
|
text: '新增',
|
type: 'primary',
|
fun: this.addOrUpdateHandle
|
},
|
{
|
text: '复制',
|
type: 'primary',
|
fun: this.copy
|
},
|
{
|
text: '批准',
|
fun: () => {
|
this.changeState('accept')
|
},
|
disabled: false,
|
permitArr: []
|
},
|
{
|
text: '拒绝',
|
fun: () => {
|
this.changeState('reject')
|
},
|
disabled: false,
|
permitArr: []
|
},
|
{
|
text: '撤销',
|
fun: () => {
|
this.changeState('cancel')
|
},
|
disabled: false,
|
permitArr: []
|
},
|
{
|
text: '失效',
|
fun: () => {
|
this.changeState('disabled')
|
},
|
disabled: false,
|
permitArr: []
|
},
|
{
|
text: '删除',
|
fun: () => {
|
this.deleteAll()
|
},
|
disabled: false,
|
permitArr: []
|
}
|
],
|
operator: [
|
{
|
text: '删除',
|
icon: 'el-icon-delete',
|
type: 'text',
|
size: 'small',
|
fun: this.deleteHandle
|
// show: {
|
// val: ['01draft'],
|
// key: 'state'
|
// }
|
}
|
],
|
operatorConfig: {
|
fixed: 'right',
|
label: '操作',
|
width: 70,
|
minWidth: 70
|
}
|
},
|
stateOptionList: [
|
{
|
value: '01draft',
|
label: '草稿'
|
},
|
{
|
value: '02accepted',
|
label: '已接受'
|
},
|
{
|
value: '03cancelled',
|
label: '已拒绝'
|
},
|
{
|
value: '04disabled',
|
label: '失效'
|
}
|
],
|
addOrUpdateVisible: false,
|
editParamVisible: false,
|
paramSelArr: [],
|
paramSelCol: 'code',
|
showParam: false,
|
insertIndex: null,
|
last: true,
|
editParamShow: false,
|
inspectionTypeOptions: [],
|
isSubmit: false,
|
testNo: '',
|
showItemLayout: false,
|
referenceOptions: [
|
{
|
label: '是',
|
value: true
|
},
|
{
|
label: '否',
|
value: false
|
}
|
],
|
isCheckOptions: [
|
{
|
label: '是',
|
value: true
|
},
|
{
|
label: '否',
|
value: false
|
}
|
]
|
}
|
},
|
components: {
|
ttable,
|
StandardForm,
|
StandardParamForm,
|
ParamDialog,
|
EditParamForm,
|
itemLayout
|
},
|
computed: {
|
editable: function() {
|
if (!this.currentTestStandard) {
|
return true
|
}
|
if (
|
this.currentTestStandard.id &&
|
this.currentTestStandard.state === '01draft'
|
) {
|
return true
|
}
|
return false
|
}
|
},
|
mounted() {
|
this.getParamType()
|
this.rowDrop()
|
},
|
created() {
|
this.initDirParamType()
|
this.initDirInspectionType()
|
},
|
methods: {
|
// 输入enter键,下一行自动聚焦并选中‘要求范围’字段的input
|
nextFocus(index) {
|
let nextRef
|
if (index + 1 >= this.testStandardParams.length) {
|
nextRef = 'reference_0'
|
} else {
|
nextRef = 'reference_' + (index + 1)
|
}
|
this.$refs[nextRef].focus()
|
this.$refs[nextRef].select()
|
},
|
nextFocus2(index) {
|
let nextRef
|
if (index + 1 >= this.testStandardParams.length) {
|
nextRef = 'defaultValue_0'
|
} else {
|
nextRef = 'defaultValue_' + (index + 1)
|
}
|
this.$refs[nextRef].focus()
|
this.$refs[nextRef].select()
|
},
|
initDirParamType() {
|
remote('quality_param_type').then((response) => {
|
if (response.data.code === 0) {
|
this.paramTypeOptions = response.data.data
|
}
|
})
|
},
|
initDirInspectionType() {
|
remote('apply_report_type').then((response) => {
|
if (response.data.code === 0) {
|
this.inspectionTypeOptions = response.data.data
|
}
|
})
|
},
|
// 检测标准(批准/退回/撤销/失效)
|
changeState(event) {
|
if (this.multipleSelection.length > 0) {
|
const ids = this.multipleSelection.map((item) => {
|
return item.id
|
})
|
changeState(ids, event).then((response) => {
|
this.$message.success('状态更新成功')
|
this.getData()
|
this.clearCurrentChange()
|
})
|
} else {
|
this.$message.warning('请选择检测标准')
|
}
|
|
// if (this.testStandardId) {
|
// changeState(this.testStandardId, event).then((response) => {
|
// this.$message.success('状态更新成功')
|
// this.getData()
|
// this.clearCurrentChange()
|
// })
|
// } else {
|
// this.$message.warning('请选择检测标准')
|
// }
|
},
|
// 复制检测标准
|
copy() {
|
if (this.multipleSelection.length == 1) {
|
const testId = this.multipleSelection[0].id
|
copyTestStandard(testId).then((response) => {
|
// eslint-disable-next-line eqeqeq
|
if (response.data.data.code == 0) {
|
this.$message.success('检测标准复制成功')
|
this.getData()
|
this.clearCurrentChange()
|
} else {
|
this.$message.warning('检测标准复制失败')
|
}
|
})
|
} else {
|
this.$message.warning('请选择一条检测标准进行操作!')
|
}
|
// if (this.testStandardId != 0) {
|
// copyTestStandard(this.testStandardId).then((response) => {
|
// // eslint-disable-next-line eqeqeq
|
// if (response.data.data.code == 0) {
|
// this.$message.success('检测标准复制成功')
|
// this.getData()
|
// this.clearCurrentChange()
|
// } else {
|
// this.$message.warning('检测标准复制失败')
|
// }
|
// })
|
// } else {
|
// this.$message.warning('请选择检测标准')
|
// }
|
},
|
// 获取数据列表
|
getData() {
|
this.$refs.testStandardTable.refreshData()
|
},
|
// 新增 / 修改
|
addOrUpdateHandle(row) {
|
this.addOrUpdateVisible = true
|
this.$nextTick(() => {
|
this.$refs.addOrUpdate.init(row == null ? null : row.id)
|
})
|
},
|
getStateOptionList() {
|
return this.stateOptionList
|
},
|
getInspectionTypeOptionList() {
|
return this.inspectionTypeOptions
|
},
|
// 删除
|
deleteHandle(row) {
|
this.$confirm('是否确认删除检测标准编号为' + row.standardNo, '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(function() {
|
const ids = []
|
ids.push(row.id)
|
return delTestStandard(ids)
|
})
|
.then((data) => {
|
this.$message.success('删除成功')
|
this.getData()
|
})
|
},
|
deleteAll() {
|
const that = this
|
if (this.multipleSelection.length > 0) {
|
this.$confirm('是否确认删除', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
closeOnClickModal: false
|
})
|
.then(function() {
|
const ids = that.multipleSelection.map((item) => {
|
return item.id
|
})
|
return delTestStandard(ids)
|
})
|
.then((response) => {
|
var data = response.data
|
if (data.code === 0) {
|
this.$message.success('删除成功')
|
} else {
|
this.$message.error('删除失败')
|
}
|
this.getData()
|
})
|
} else {
|
this.$message.error('请选择需要删除的对象')
|
}
|
},
|
clearCurrentChange() {
|
this.testStandardId = 0
|
this.currentTestStandard = null
|
},
|
handleCurrentChange(val) {
|
this.multipleSelection = val
|
// this.testStandardParams = []
|
// this.clearCurrentChange()
|
// if (val && val.id) {
|
// this.testStandardId = val.id
|
// this.currentTestStandard = val
|
// this.getTestStandardParamData()
|
// }
|
},
|
handleDbClickRow(val) {
|
this.testStandardParams = []
|
this.testNo = ''
|
this.clearCurrentChange()
|
if (val && val.row && val.row.id) {
|
this.testStandardId = val.row.id
|
this.currentTestStandard = val.row
|
this.testNo = val.row.standardNo
|
this.getTestStandardParamData()
|
}
|
},
|
// 获取关联的检测标准参数信息
|
getTestStandardParamData() {
|
getTestStandardParams(
|
Object.assign({
|
testStandardId: this.testStandardId
|
})
|
).then((response) => {
|
this.testStandardParams = 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.testStandardParams
|
.filter((e) => e.index === oldIndex + 1)
|
.forEach((e) => {
|
e.index = 'x'
|
})
|
that.testStandardParams
|
.filter((e) => e.index > oldIndex + 1 && e.index <= newIndex + 1)
|
.forEach((e) => {
|
e.index = e.index - 1
|
})
|
that.testStandardParams
|
.filter((e) => e.index === 'x')
|
.forEach((e) => {
|
e.index = newIndex + 1
|
})
|
} else if (oldIndex > newIndex) {
|
// 上移
|
that.testStandardParams
|
.filter((e) => e.index === oldIndex + 1)
|
.forEach((e) => (e.index = 'x'))
|
that.testStandardParams
|
.filter((e) => e.index < oldIndex + 1 && e.index >= newIndex + 1)
|
.forEach((e) => (e.index = e.index + 1))
|
that.testStandardParams
|
.filter((e) => e.index === 'x')
|
.forEach((e) => (e.index = newIndex + 1))
|
}
|
}
|
})
|
},
|
// 自定义添加
|
addTestStandardParam(row, index) {
|
if (this.testStandardId !== 0) {
|
this.standardParamVisible = true
|
this.$nextTick(() => {
|
this.$refs.addOrUpdateStandardParam.init(row, index)
|
})
|
} else {
|
this.$message.warning('请选择检测标准')
|
}
|
},
|
// 选择基础参数(添加)
|
relateOperationParam() {
|
if (this.testStandardId !== 0) {
|
this.selectedParamCode()
|
this.showParam = true
|
this.last = true
|
} else {
|
this.$message.error('请先双击选择检测标准')
|
}
|
},
|
// 选择基础参数(插入)
|
insertOperationParam(row) {
|
this.selectedParamCode()
|
this.showParam = true
|
this.last = false
|
this.insertIndex = row.index
|
},
|
// 弹出参数编辑框
|
editTestStandardParam(row) {
|
this.editParamVisible = true
|
this.$nextTick(() => {
|
this.$refs.editParam.init(row, this.testStandardParams)
|
})
|
},
|
selectedParamCode() {
|
// 筛选出当前页面已有的参数
|
/* this.paramSelArr = []
|
if (this.testStandardParams.length > 0) {
|
this.testStandardParams.forEach((ele) => {
|
if (ele.code != null && ele.code !== '') {
|
this.paramSelArr.push(ele.code)
|
}
|
})
|
} */
|
},
|
// 提交检测标准参数
|
dataFormTestStandardParam() {
|
this.isSubmit = true
|
if (this.testStandardParams.length > 0) {
|
addTestStandardParam(this.testStandardParams)
|
.then((response) => {
|
this.$message.success('检测标准参数保存成功')
|
this.testStandardParams = []
|
this.getTestStandardParamData()
|
this.isSubmit = false
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
} else {
|
this.isSubmit = false
|
this.$message.warning('请先添加参数')
|
}
|
},
|
// 添加/插入操作后更新参数信息
|
refreshJoinData(param) {
|
const newDataList = this.testStandardParams
|
this.testStandardParams = []
|
this.$nextTick(() => {
|
this.testStandardParams = newDataList
|
this.testStandardParams
|
.filter((e) => e.index >= param.index)
|
.forEach((e) => (e.index = e.index + 1))
|
this.testStandardParams.push(
|
Object.assign(
|
{
|
testStandardId: this.testStandardId,
|
isCheck: false
|
},
|
param
|
)
|
)
|
})
|
},
|
// 选中的基础参数信息
|
getJoinData(param) {
|
const newDataList = this.testStandardParams
|
this.testStandardParams = []
|
this.$nextTick(() => {
|
this.testStandardParams = newDataList
|
for (let i = 0, len = param.length; i < len; i++) {
|
if (this.last) {
|
this.testStandardParams.push(
|
Object.assign({
|
testStandardId: this.testStandardId,
|
code: param[i].code,
|
parameterItem: param[i].parameterItem,
|
type: param[i].type,
|
parameterFormat: param[i].parameterFormat,
|
unit: param[i].unit,
|
aisle: null,
|
position: null,
|
index: this.testStandardParams.length + 1,
|
wireCore: null,
|
isCheck: false
|
})
|
)
|
} else {
|
this.testStandardParams
|
.filter((e) => e.index >= this.insertIndex)
|
.forEach((e) => (e.index = e.index + 1))
|
this.testStandardParams.push(
|
Object.assign({
|
testStandardId: this.testStandardId,
|
code: param[i].code,
|
parameterItem: param[i].parameterItem,
|
type: param[i].type,
|
parameterFormat: param[i].parameterFormat,
|
unit: param[i].unit,
|
aisle: null,
|
position: null,
|
index: this.insertIndex,
|
wireCore: null,
|
isCheck: false
|
})
|
)
|
}
|
}
|
})
|
},
|
deleteTestStandardParam(row) {
|
this.$confirm('是否确认删除参数编号为:' + row.code, {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then((data) => {
|
const newDataList = this.testStandardParams
|
this.testStandardParams = []
|
this.$nextTick(() => {
|
this.testStandardParams = newDataList
|
this.testStandardParams.splice(
|
this.testStandardParams.findIndex(
|
(item) => item.index === row.index
|
),
|
1
|
)
|
this.testStandardParams
|
.filter((e) => e.index >= row.index)
|
.forEach((e) => (e.index = e.index - 1))
|
this.$message.success('删除参数成功')
|
})
|
})
|
},
|
// 新增公式后,刷新参数列表
|
refreshParamList() {
|
this.getTestStandardParamData()
|
},
|
// 获取工序参数类型
|
getParamType() {
|
remote('technology_param').then((response) => {
|
if (response.data.code === 0) {
|
this.typeOptions = response.data.data
|
} else {
|
this.typeOptions = []
|
}
|
})
|
},
|
// 表格字段格式化
|
getParam(row, column, cellValue) {
|
for (let i = 0, len = this.typeOptions.length; i < len; i++) {
|
if (cellValue === this.typeOptions[i].value) {
|
return this.typeOptions[i].label
|
}
|
}
|
},
|
// 弹出布局窗口
|
beginItemLayOut() {
|
if (this.currentTestStandard != null) {
|
this.showItemLayout = true
|
} else {
|
this.$message.error('请先双击选择检测标准')
|
}
|
},
|
// 检测类型中文格式化
|
formatInspectionType(row, column, cellValue) {
|
this.inspectionTypeOptions.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
}
|
}
|
}
|
</script>
|