| | |
| | | |
| | | <!-- table区域-begin --> |
| | | <div> |
| | | <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{ y: 300 }" :columns="columns" |
| | | <a-table ref="table" size="middle" bordered rowKey="equipmentid" :scroll="{ y: 300 }" :columns="columns" |
| | | :dataSource="dataSource" :pagination="ipagination" :loading="loading" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" |
| | | @change="handleTableChange"> |
| | | @change="handleTableChange" :customRow="customRow"> |
| | | </a-table> |
| | | </div> |
| | | <!-- table区域-end --> |
| | |
| | | import Tooltip from 'ant-design-vue/es/tooltip' |
| | | import JDate from '@/components/jeecg/JDate' |
| | | import moment from 'moment' |
| | | import { filterObj } from '@/utils/util'; |
| | | import { filterObj } from '@/utils/util' |
| | | |
| | | export default { |
| | | name: 'DeviceListModel', |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | title:'', |
| | | title: '', |
| | | visible: false, |
| | | disableMixinCreated: true, |
| | | queryParam: {}, |
| | | columns: [{ |
| | | title: '统一编码', |
| | | align: 'center', |
| | | dataIndex: 'equipmentid', |
| | | dataIndex: 'equipmentid' |
| | | }, |
| | | { |
| | | title: '设备名称', |
| | | align: 'center', |
| | | dataIndex: 'equipmentname', |
| | | dataIndex: 'equipmentname' |
| | | }, |
| | | { |
| | | title: '设备型号', |
| | | align: 'center', |
| | | dataIndex: 'equipmentmodel', |
| | | dataIndex: 'equipmentmodel' |
| | | }, |
| | | // { |
| | | // title: '设备类型', |
| | |
| | | { |
| | | title: '机床IP', |
| | | align: 'center', |
| | | dataIndex: 'equipmentip', |
| | | dataIndex: 'equipmentip' |
| | | }, |
| | | { |
| | | title: '驱动类型', |
| | | align: 'center', |
| | | dataIndex: 'drivetype', |
| | | dataIndex: 'drivetype' |
| | | }, |
| | | { |
| | | title: '端口', |
| | | align: 'center', |
| | | dataIndex: 'dataport', |
| | | dataIndex: 'dataport' |
| | | }, |
| | | { |
| | | title: '数控系统', |
| | | align: 'center', |
| | | dataIndex: 'controlsystem', |
| | | dataIndex: 'controlsystem' |
| | | } |
| | | ], |
| | | url: { |
| | | list: '/mdc/equipment/list', |
| | | }, |
| | | list: '/mdc/equipment/list' |
| | | } |
| | | |
| | | } |
| | | }, |
| | |
| | | openPage() { |
| | | this.visible = true |
| | | this.onClearSelected() |
| | | this.dataSource = []; |
| | | this.dataSource = [] |
| | | // this.queryParam = { |
| | | // status: this.status |
| | | // }; |
| | | this.loadData(); |
| | | this.loadData() |
| | | }, |
| | | getQueryParams() { |
| | | //获取查询条件 |
| | | let sqp = {} |
| | | if(this.superQueryParams){ |
| | | sqp['superQueryParams']=encodeURI(this.superQueryParams) |
| | | if (this.superQueryParams) { |
| | | sqp['superQueryParams'] = encodeURI(this.superQueryParams) |
| | | sqp['superQueryMatchType'] = this.superQueryMatchType |
| | | } |
| | | var param = Object.assign(sqp, this.queryParam); |
| | | var param = Object.assign(sqp, this.queryParam) |
| | | // param.field = this.getQueryField(); |
| | | param.pageNo = this.ipagination.current; |
| | | param.pageSize = this.ipagination.pageSize; |
| | | param.pageNo = this.ipagination.current |
| | | param.pageSize = this.ipagination.pageSize |
| | | //获取用户定制的参数属性 |
| | | // if (this.getCustomQueryParams) { |
| | | // param = this.getCustomQueryParams(param); |
| | |
| | | // } |
| | | // } |
| | | |
| | | return filterObj(param); |
| | | return filterObj(param) |
| | | }, |
| | | loadData(arg) { |
| | | if(!this.url.list){ |
| | | this.$message.error("请设置url.list属性!") |
| | | if (!this.url.list) { |
| | | this.$message.error('请设置url.list属性!') |
| | | return |
| | | } |
| | | //加载数据 若传入参数1则加载第一页的内容 |
| | | if (arg === 1) { |
| | | this.ipagination.current = 1; |
| | | this.ipagination.current = 1 |
| | | } |
| | | var params = this.getQueryParams();//查询条件 |
| | | var params = this.getQueryParams()//查询条件 |
| | | |
| | | if(!params){ |
| | | return false; |
| | | if (!params) { |
| | | return false |
| | | } |
| | | |
| | | this.loading = true; |
| | | this.loading = true |
| | | getAction(this.url.list, params).then((res) => { |
| | | if (res.success) { |
| | | // console.log(res) |
| | | //update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
| | | this.dataSource = res.result.records||res.result; |
| | | if(res.result.total) |
| | | { |
| | | this.ipagination.total = res.result.total; |
| | | }else{ |
| | | this.ipagination.total = 0; |
| | | this.dataSource = res.result.records || res.result |
| | | if (res.result.total) { |
| | | this.ipagination.total = res.result.total |
| | | } else { |
| | | this.ipagination.total = 0 |
| | | } |
| | | //update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------ |
| | | }else{ |
| | | } else { |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message:'消息', |
| | | description:res.message |
| | | }); |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | |
| | | // }); |
| | | // return str; |
| | | }, |
| | | customRow(record) { |
| | | return { |
| | | style: { |
| | | cursor: 'pointer' |
| | | }, |
| | | on: { |
| | | click: () => { |
| | | console.log('触发点击') |
| | | this.onSelectChange([record.equipmentid], [record]) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | modalFormOk(val) { |
| | | // 新增/修改 成功时,重载列表 |
| | | this.loadData(); |
| | | this.selectedRowKeys = [val.id]; |
| | | this.loadData() |
| | | this.selectedRowKeys = [val.id] |
| | | }, |
| | | searchQuery() { |
| | | this.loadData(); |
| | | this.loadData() |
| | | this.onClearSelected() |
| | | }, |
| | | searchReset() { |
| | | this.queryParam = {} |
| | | this.loadData(); |
| | | this.loadData() |
| | | this.onClearSelected() |
| | | }, |
| | | close() { |
| | |
| | | handleOk() { |
| | | this.$emit('sendSelectionRows', this.selectionRows[0]) |
| | | this.close() |
| | | }, |
| | | }, |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style> |