<template>
|
<el-dialog
|
width="80%"
|
title="检测标准"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<el-row>
|
<el-col :span="12">
|
<ttable
|
:table="table"
|
@handleSelectionChange="handleSelectionChange"
|
@currentChange="handleCurrentChange"
|
:uploadInfo="uploadInfo"
|
:prelang="prelang"
|
:options="options"
|
:ajaxFun="ajaxFun"
|
:paramObj="paramTemplateObj"
|
:selColValArr="paramTemplateSelArr"
|
:selCol="paramTemplateSelCol"
|
:fixedHeight="500"
|
ref="operationParamTemplateTable"
|
>
|
<template #toolbar></template>
|
</ttable>
|
</el-col>
|
<el-col :span="12" style="padding-left: 10px">
|
<el-table
|
:data="testStandardParams"
|
id="testStandardParamTable"
|
ref="testStandardParam"
|
:default-sort="{ prop: 'index' }"
|
highlight-current-row
|
height="500"
|
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"
|
/>
|
<el-table-column
|
label="参数格式"
|
prop="parameterFormat"
|
align="center"
|
/>
|
<el-table-column label="通道" prop="aisle" align="center" />
|
<el-table-column label="部位" prop="position" align="center" />
|
<el-table-column label="单位" prop="unit" align="center" />
|
</el-table>
|
</el-col>
|
</el-row>
|
<div slot="footer" class="dialog-footer">
|
<el-button v-if="isShowButton" @click="innerVisible = false"
|
>取 消</el-button
|
>
|
<el-button v-if="isShowButton" type="primary" @click="saveSelectRow"
|
>确 定</el-button
|
>
|
</div>
|
</el-dialog>
|
</template>
|
<script>
|
import {
|
fetchListTestStandard,
|
getTestStandardParams
|
} from '@/api/quality/teststandard'
|
import ttable from '@/views/common/ztt-table.vue'
|
import { remote } from '@/api/admin/dict'
|
import { mapGetters } from 'vuex'
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
multiSelect: {
|
type: Boolean,
|
default: false
|
},
|
paramTemplateObj: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
// 默认选中字段的值数组
|
paramTemplateSelArr: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
},
|
// 默认选中字段
|
paramTemplateSelCol: {
|
type: String
|
},
|
// 是否默认选中显示某条记录
|
isDefaultSelect: {
|
type: Boolean,
|
default: false
|
},
|
// 是否显示按钮
|
isShowButton: {
|
type: Boolean,
|
default: true
|
}
|
},
|
data() {
|
return {
|
testStandardParams: [],
|
ajaxFun: fetchListTestStandard,
|
currentRow: null,
|
innerVisible: false,
|
multipleSelection: [],
|
isShowQuery: false,
|
uploadInfo: {
|
// 是否展示上传EXCEL以及对应的url
|
isShow: false,
|
url: ''
|
},
|
prelang: 'operationParamTemplate',
|
options: {
|
height: 300, // 默认高度-为了表头固定
|
stripe: true, // 是否为斑马纹 table
|
highlightCurrentRow: false, // 是否要高亮当前行
|
border: true, // 是否有纵向边框
|
lazy: false, // 是否需要懒加载
|
fit: true, // 列的宽度是否自撑开
|
multiSelect: false, //
|
seqNo: true,
|
isShowHide: true, // 是否显示显影按钮
|
isSearch: true, // 高级查询按钮
|
defaultOrderBy: { column: 'standardNo', direction: 'desc' }
|
},
|
table: {
|
total: 0,
|
currentPage: 1,
|
pageSize: 20,
|
data: [],
|
// 标题
|
column: [
|
{
|
minWidth: 'code',
|
prop: 'standardNo',
|
label: '标准编号',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
},
|
{
|
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: 'remark',
|
label: '备注',
|
sort: true,
|
isTrue: true,
|
isSearch: true,
|
searchInfoType: 'text'
|
}
|
]
|
},
|
inspectionTypeOptions: []
|
}
|
},
|
components: {
|
ttable
|
},
|
watch: {
|
currshowlist() {
|
const _that = this
|
_that.innerVisible = _that.currshowlist
|
if (_that.currshowlist) {
|
_that.$nextTick(() => {
|
_that.getData().then((message) => {
|
// 获取检查标准表格数据,并将第一条默认点击选中
|
if (_that.isDefaultSelect) {
|
const tableData = _that.$refs.operationParamTemplateTable.getTableData()
|
if (tableData.length > 0) {
|
_that.$refs.operationParamTemplateTable.clickTable(tableData[0])
|
}
|
}
|
})
|
})
|
}
|
}
|
},
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
created() {
|
this.initDirInspectionType()
|
},
|
methods: {
|
// 获取数据列表
|
getData() {
|
return this.$refs.operationParamTemplateTable.getDataList()
|
},
|
saveSelectRow() {
|
this.$emit('listenToSelectTestStandardEvent', this.currentRow)
|
this.innerVisible = false
|
},
|
handleCurrentChange(row) {
|
this.testStandardParams = []
|
this.currentRow = row
|
if (row && row.id) {
|
this.getTestStandardParamData(row.id)
|
}
|
},
|
// 获取关联的检测标准参数信息
|
getTestStandardParamData(testStandardId) {
|
getTestStandardParams(
|
Object.assign({
|
testStandardId: testStandardId
|
})
|
).then((response) => {
|
this.testStandardParams = response.data.data
|
})
|
},
|
handleSelectionChange(val) {
|
// 多行选中
|
this.multipleSelection = val
|
},
|
// 检测类型中文格式化
|
formatInspectionType(row, column, cellValue) {
|
this.inspectionTypeOptions.forEach((obj) => {
|
if (obj.value === cellValue) {
|
cellValue = obj.label
|
}
|
})
|
return cellValue
|
},
|
getInspectionTypeOptionList() {
|
return this.inspectionTypeOptions
|
},
|
initDirInspectionType() {
|
remote('apply_report_type').then((response) => {
|
if (response.data.code === 0) {
|
this.inspectionTypeOptions = response.data.data
|
}
|
})
|
}
|
}
|
}
|
</script>
|