You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
4.3 KiB
175 lines
4.3 KiB
3 years ago
|
<template>
|
||
|
<el-dialog
|
||
|
title="请选择设备"
|
||
|
append-to-body
|
||
|
:visible.sync="dialogVisible"
|
||
|
destroy-on-close
|
||
|
width="1000px"
|
||
|
@close="close"
|
||
|
@open="open"
|
||
|
>
|
||
|
<el-row style="margin-bottom: 10px;">
|
||
|
<el-col :span="22">
|
||
|
<el-form :inline="true" class="demo-form-inline">
|
||
|
<el-form-item :inline="true" label="模糊搜索:">
|
||
|
<el-input v-model="query.search" placeholder="请输入编码、名称" />
|
||
|
</el-form-item>
|
||
|
<rrOperation />
|
||
|
</el-form>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
<!--表格渲染-->
|
||
|
<el-table
|
||
|
ref="table"
|
||
|
v-loading="crud.loading"
|
||
|
:data="crud.data"
|
||
|
style="width: 100%;"
|
||
|
size="mini"
|
||
|
border
|
||
|
:cell-style="{'text-align':'center'}"
|
||
|
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
|
||
|
@select="handleSelectionChange"
|
||
|
@select-all="onSelectAll"
|
||
|
@current-change="clickChange"
|
||
|
>
|
||
|
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||
|
<el-table-column v-if="isSingle" label="选择" width="55">
|
||
|
<template slot-scope="scope">
|
||
|
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
|
||
|
</template>
|
||
|
</el-table-column>
|
||
|
|
||
|
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip />
|
||
|
<el-table-column prop="device_name" label="设备名称" show-overflow-tooltip />
|
||
|
<el-table-column prop="device_model" label="设备型号" show-overflow-tooltip />
|
||
|
<el-table-column prop="device_model" label="设备型号" show-overflow-tooltip />
|
||
|
<el-table-column prop="extend_code" label="外部编码" show-overflow-tooltip />
|
||
|
</el-table>
|
||
|
<!--分页组件-->
|
||
|
<pagination />
|
||
|
<span slot="footer" class="dialog-footer">
|
||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||
|
</span>
|
||
|
|
||
|
</el-dialog>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
|
||
|
import CRUD, { header, presenter } from '@crud/crud'
|
||
|
import rrOperation from '@crud/RR.operation'
|
||
|
import pagination from '@crud/Pagination'
|
||
|
import crudDevice from '@/api/wms/pdm/device'
|
||
|
|
||
|
export default {
|
||
|
name: 'EndPointDialog',
|
||
|
components: { rrOperation, pagination },
|
||
|
cruds() {
|
||
|
return CRUD({ title: '设备', url: 'api/device', crudMethod: { ...crudDevice }, optShow: {}})
|
||
|
},
|
||
|
mixins: [presenter(), header()],
|
||
|
props: {
|
||
|
dialogShow: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
},
|
||
|
isSingle: {
|
||
|
type: Boolean,
|
||
|
default: true
|
||
|
},
|
||
|
openParam: {
|
||
|
type: Object,
|
||
|
default: null
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
formInline: {
|
||
|
search: ''
|
||
|
},
|
||
|
tableRadio: '',
|
||
|
tableData: [],
|
||
|
dialogVisible: false,
|
||
|
material: {}
|
||
|
}
|
||
|
},
|
||
|
watch: {
|
||
|
dialogShow: {
|
||
|
handler(newValue, oldValue) {
|
||
|
this.dialogVisible = newValue
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
handleClose(done) {
|
||
|
this.$confirm('确认关闭?')
|
||
|
.then(_ => {
|
||
|
done()
|
||
|
})
|
||
|
.catch(_ => {
|
||
|
})
|
||
|
},
|
||
|
open() {
|
||
|
debugger
|
||
|
this.query.region_id = this.openParam
|
||
|
this.crud.toQuery()
|
||
|
},
|
||
|
close() {
|
||
|
this.crud.resetQuery(false)
|
||
|
this.$emit('update:dialogShow', false)
|
||
|
},
|
||
|
submit() {
|
||
|
// 处理单选
|
||
|
if (this.isSingle && this.tableRadio) {
|
||
|
this.$emit('update:dialogShow', false)
|
||
|
this.$emit('tableChanged', this.tableRadio)
|
||
|
return
|
||
|
}
|
||
|
this.rows = this.$refs.table.selection
|
||
|
if (this.rows.length <= 0) {
|
||
|
this.$message('请选择设备')
|
||
|
return
|
||
|
}
|
||
|
this.crud.resetQuery(false)
|
||
|
this.$emit('update:dialogShow', false)
|
||
|
this.$emit('tableChanged', this.rows)
|
||
|
},
|
||
|
handleSelectionChange(val, row) {
|
||
|
if (val.length > 1) {
|
||
|
this.$refs.table.clearSelection()
|
||
|
this.$refs.table.toggleRowSelection(val.pop())
|
||
|
} else {
|
||
|
this.checkrow = row
|
||
|
}
|
||
|
},
|
||
|
onSelectAll() {
|
||
|
this.$refs.table.clearSelection()
|
||
|
},
|
||
|
clickChange(item) {
|
||
|
this.tableRadio = item
|
||
|
},
|
||
|
hand(value) {
|
||
|
this.crud.toQuery()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
.crud-opts2 {
|
||
|
padding: 4px 0;
|
||
|
display: -webkit-flex;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
}
|
||
|
|
||
|
.crud-opts2 .crud-opts-right2 {
|
||
|
margin-left: auto;
|
||
|
}
|
||
|
|
||
|
.el-table_body tr.current-row>td {
|
||
|
background-color: #e9e500;
|
||
|
}
|
||
|
</style>
|