<template>
|
<el-dialog
|
width="60%"
|
title="检测工序"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<el-table
|
border
|
v-loading="listLoading"
|
:data="dataList"
|
height="300px"
|
@row-dblclick="doubleClick"
|
@row-click="rowClick"
|
highlight-current-row
|
@current-change="handleCurrentChange"
|
>
|
<el-table-column align="center" width="55" label="单选">
|
<template slot-scope="scope">
|
<el-checkbox
|
class="detail-ifs-location-table-single-checkbox"
|
v-model="scope.row.rowChecked"
|
></el-checkbox>
|
</template>
|
</el-table-column>
|
<el-table-column prop="operationName" label="工序名称"></el-table-column>
|
<el-table-column prop="operationNo" label="工序编号"></el-table-column>
|
</el-table>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取消</el-button>
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
</span>
|
</el-dialog>
|
</template>
|
|
<script>
|
import { getObj } from '@/api/technology/document'
|
import { getObj as getTechnologyDetail } from '@/api/technology/routing'
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
multiSelect: {
|
type: Boolean,
|
default: false
|
},
|
dataFormId: {
|
type: Number
|
}
|
},
|
data() {
|
return {
|
dataList: [],
|
listLoading: false,
|
currentRow: null,
|
multipleSelection: [],
|
innerVisible: false,
|
visible: false,
|
dataRule: {}
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.getData()
|
}
|
},
|
innerVisible: {
|
handler(newValue, oldValue) {
|
if (newValue) {
|
this.dataList = []
|
}
|
},
|
immediate: true
|
}
|
},
|
methods: {
|
getData() {
|
getTechnologyDetail(this.dataFormId).then((response) => {
|
const res = response.data
|
if (res.code === 0) {
|
this.dataList = res.data.operations
|
console.log(this.dataList)
|
}
|
})
|
},
|
doubleClick() {
|
this.dataFormSubmit()
|
},
|
rowClick(row) {
|
this.currentRow = row
|
this.dataFormId.forEach((item) => {
|
if (row.id !== item.id) {
|
this.$set(item, 'rowChecked', false)
|
} else {
|
this.$set(item, 'rowChecked', true)
|
}
|
})
|
},
|
handleCurrentChange(row) {
|
if (row != null) {
|
this.dataList.forEach((item) => {
|
// 排他,每次选择时把其他选项都清除
|
if (item.id !== row.id) {
|
item.rowChecked = false
|
} else {
|
item.rowChecked = true
|
}
|
})
|
} else {
|
this.dataList.forEach((item) => {
|
// 选项都清除
|
item.rowChecked = false
|
})
|
}
|
this.currentRow = row
|
},
|
dataFormSubmit() {
|
if (this.currentRow == null) {
|
this.$message.error('请选择数据')
|
return
|
}
|
// if (this.multiSelect) {
|
// this.$emit('handleSelectionChange', this.multipleSelection)
|
// } else {
|
this.$emit('listenToPartEvent', this.currentRow)
|
// }
|
this.innerVisible = false
|
}
|
}
|
}
|
</script>
|