Files
wms_base/mes/qd/src/views/wms/pdm/device/AddDtl.vue
2022-06-27 19:25:41 +08:00

135 lines
3.4 KiB
Vue

<template>
<el-dialog
title="选择设备扩展项"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
width="1000px"
@close="close"
@open="open"
>
<el-input
v-model="query.search"
clearable
placeholder="请输入项点编码或名称"
style="width: 185px;"
class="filter-item"
/>
<rrOperation :crud="crud" />
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;margin-top: 18px"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="item_code" label="项点编码"/>
<el-table-column show-overflow-tooltip prop="item_name" label="项点名称" />
<el-table-column show-overflow-tooltip prop="order_seq" label="顺序号" />
<el-table-column show-overflow-tooltip prop="default_value" label="默认值">
<template slot-scope="scope">
{{ is_or_no(scope.row.default_value, scope.row.data_type) }}
</template>
</el-table-column>
<el-table-column prop="data_type" label="默认值数据类型">
<template slot-scope="scope">
{{ dict.label.ITEM_VALUE_TYPE[scope.row.data_type] }}
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="remark" label="备注"/>
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" 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'
export default {
name: 'AddDtl',
components: { rrOperation, pagination },
dicts: ['ITEM_VALUE_TYPE'],
cruds() {
return CRUD({ title: '项点', idField: 'item_id', url: 'api/deviceitem',
optShow: {
add: false,
edit: false,
del: false,
reset: true,
download: false
}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
}
},
data() {
return {
dialogVisible: false,
opendtlParam: '',
rows: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openParam: {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
}
},
methods: {
is_or_no(val, type) {
if (type === '01' && val === '1') {
return '是'
} else if (type === '01' && val === '0') {
return '否'
} else {
return val
}
},
open() {
this.crud.toQuery()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
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)
}
}
}
</script>