¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="device_list"> |
| | | <a-row> |
| | | <a-col :md="leftColMd" :sm="24"> |
| | | <a-card :bordered="false"> |
| | | |
| | | <!-- æä½æé®åºå --> |
| | | <div class="table-operator"> |
| | | <a-button @click="handleAddTier" type="primary" icon="plus">æ°å¢é¨é¨ |
| | | </a-button> |
| | | <!--<a-button @click="handleAdd" type="primary" icon="plus">æ°å¢äººå--> |
| | | <!--</a-button>--> |
| | | <!--<a-button @click="handleEdit" v-if="selectedRowKeys.length ==1" icon="edit">ç¼è¾--> |
| | | <!--</a-button>--> |
| | | <a-button @click="deviceSearch" v-if="selectedRowKeys.length ==1" type="primary" icon="search">éæ©è®¾å¤ |
| | | </a-button> |
| | | <!--<a-button @click="batchDelll" v-if="selectedRowKeys.length >0" icon="delete">å é¤--> |
| | | <!--</a-button>--> |
| | | </div> |
| | | <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
| | | <i class="anticon anticon-info-circle ant-alert-icon"> |
| | | </i> 已鿩 <a><b>{{ selectedRowKeys.length }}</b></a>项 |
| | | <a style="margin-left: 24px" @click="onClearSelected">æ¸
空</a> |
| | | </div> |
| | | |
| | | <!-- tableåºå-begin --> |
| | | <div> |
| | | <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns" |
| | | :scroll="{x: 400}" :dataSource="dataSource" :pagination="ipagination" :loading="loading" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" |
| | | @change="handleTableChange"> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a @click="handleEdit(record)">ç¼è¾</a> |
| | | <a-divider type="vertical"/> |
| | | <a-popconfirm title="ç¡®å®å é¤å?" @confirm="() => handleDelete(record.id)"> |
| | | <a>å é¤</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | |
| | | <!--å符串è¶
é¿æªåçç¥å·æ¾ç¤º--> |
| | | <span slot="num" slot-scope="text" style="font-weight: bold"> |
| | | <j-ellipsis :value="text" :length="8"/> |
| | | </span> |
| | | <span slot="name" slot-scope="text" style="font-weight: bold"> |
| | | <j-ellipsis :value="text" :length="8"/> |
| | | </span> |
| | | <span slot="model" slot-scope="text" style="font-weight: bold"> |
| | | <j-ellipsis :value="text" :length="8"/> |
| | | </span> |
| | | </a-table> |
| | | </div> |
| | | <!-- tableåºå-end --> |
| | | <depart-model ref="modalForm" @ok="modalFormOk"></depart-model> |
| | | <tier-model ref="tierModalForm" @ok="modalFormOk"></tier-model> |
| | | <depart-list-seach-list ref="seachModalForm" @ok="modalFormOk" @sendSelectionRows="getDeviceRows"></depart-list-seach-list> |
| | | </a-card> |
| | | </a-col> |
| | | <a-col :md="rightColMd" :sm="24" v-if="selectedRowKeys.length == 1"> |
| | | <a-table |
| | | ref="table2" |
| | | bordered |
| | | size="middle" |
| | | rowKey="id" |
| | | :columns="columns2" |
| | | :dataSource="dataSource2" |
| | | :pagination="ipagination2" |
| | | :loading="loading2" |
| | | @change="handleTableChange2"> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <!--<a @click="handleEdit(record)">ç¼è¾</a>--> |
| | | <!--<a-divider type="vertical"/>--> |
| | | <a-popconfirm title="ç¡®å®ç§»é¤å?" @confirm="() => handleDeleteZi(record.id)"> |
| | | <a>ç§»é¤</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | </a-table> |
| | | |
| | | </a-col> |
| | | </a-row> |
| | | </div> |
| | | |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import JDictSelectTag from '@/components/dict/JDictSelectTag' |
| | | import { |
| | | requestPut, |
| | | deleteAction, |
| | | getAction, |
| | | postAction, |
| | | putAction |
| | | } from '@/api/manage' |
| | | import DepartModel from './DepartModel' |
| | | import TierModel from './TierModel' |
| | | import { |
| | | JeecgListMixin |
| | | } from '@/mixins/JeecgListMixin' |
| | | import JInput from '@/components/jeecg/JInput' |
| | | import JEllipsis from '@/components/jeecg/JEllipsis' |
| | | import Tooltip from 'ant-design-vue/es/tooltip' |
| | | import DepartListSeachList from './DepartListSeachList' |
| | | import { filterObj } from '@/utils/util' |
| | | export default { |
| | | name: 'DepartList', |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | Tooltip, |
| | | DepartModel, |
| | | TierModel, |
| | | DepartListSeachList, |
| | | JDictSelectTag, |
| | | JInput, |
| | | JEllipsis |
| | | }, |
| | | props: { node: '' }, |
| | | data() { |
| | | return { |
| | | sectionId:"", |
| | | queryParam: {}, |
| | | dataStartsoucre:[], |
| | | columns: [ |
| | | // { |
| | | // title: 'å±çº§ç¼ç ', |
| | | // align: 'center', |
| | | // dataIndex: 'sectionNumber' |
| | | // }, |
| | | { |
| | | title: 'åç§°', |
| | | align: 'center', |
| | | dataIndex: 'sectionName' |
| | | }, |
| | | // { |
| | | // title: 'ç¶çº§', |
| | | // align: 'center', |
| | | // dataIndex: 'parentId' |
| | | // }, |
| | | // { |
| | | // title: 'å±çº§', |
| | | // align: 'center', |
| | | // dataIndex: 'sectionRank' |
| | | // }, |
| | | { |
| | | title: 'æåº', |
| | | align: 'center', |
| | | dataIndex: 'sortNo' |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | | scopedSlots: {customRender: 'action'}, |
| | | align: "center", |
| | | width: 150 |
| | | } |
| | | ], |
| | | dataSource2:[], |
| | | ipagination2: { |
| | | current: 1, |
| | | pageSize: 10, |
| | | pageSizeOptions: ['10', '20', '30'], |
| | | showTotal: (total, range) => { |
| | | return range[0] + '-' + range[1] + ' å
±' + total + 'æ¡' |
| | | }, |
| | | showQuickJumper: true, |
| | | showSizeChanger: true, |
| | | total: 0 |
| | | }, |
| | | isorter2: { |
| | | column: 'createTime', |
| | | order: 'desc' |
| | | }, |
| | | filters2: {}, |
| | | loading2: false, |
| | | columns2: [ |
| | | { |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | width: 60, |
| | | align: "center", |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1; |
| | | } |
| | | },{ |
| | | |
| | | title: 'ç»ä¸ç¼ç ', |
| | | align: 'center', |
| | | dataIndex: 'equipmentId', |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | align: 'center', |
| | | dataIndex: 'equipmentName', |
| | | }, |
| | | { |
| | | title: '驱å¨ç±»å', |
| | | align: 'center', |
| | | dataIndex: 'driveType' |
| | | }, |
| | | // { |
| | | // title: '设å¤åå·', |
| | | // align: 'center', |
| | | // dataIndex: 'equipmentModel' |
| | | // }, |
| | | { |
| | | title: '设å¤ç±»å', |
| | | align: 'center', |
| | | dataIndex: 'equipmentType_dictText' |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | | scopedSlots: {customRender: 'action'}, |
| | | align: "center", |
| | | width: 150 |
| | | } |
| | | ], |
| | | url: { |
| | | list: '/mdc/sectionEquipment/pageList', |
| | | delete: '/mdc/sectionEquipment/deleteBatch', |
| | | list2: '/mdc/mdcequipment/pageListEquipments', |
| | | updateEquipment:'/mdc/sectionEquipment/updateEquipment', |
| | | updateBatchSection:'/mdc/mdcequipment/updateBatchSection' |
| | | }, |
| | | mapDateList:{} |
| | | } |
| | | }, |
| | | watch:{ |
| | | node(val) { |
| | | // console.log(val); |
| | | this.selectedRowKeys = []; |
| | | if (val.entity) { |
| | | |
| | | // if(val.entity.id == "1528990384565837826"){ |
| | | // this.columns = this.columns1 |
| | | // }else{ |
| | | // this.columns = this.columns2 |
| | | // } |
| | | // this.$set(this.queryParams, 'equipmentName', val.entity.equipmentName) |
| | | // this.$set(this.queryParams, 'equipmentId', val.entity.equipmentId) |
| | | // this.equipment = val.entity |
| | | |
| | | } else { |
| | | // this.initEquipment(val.entity.id) |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | leftColMd() { |
| | | return this.selectedRowKeys.length === 0 ? 24 : 8 |
| | | }, |
| | | rightColMd() { |
| | | return this.selectedRowKeys.length === 0 ? 0 : 16 |
| | | } |
| | | }, |
| | | methods: { |
| | | deviceSearch() { |
| | | // console.log(this.selectionRows) |
| | | // console.log(this.selectionRows.id) |
| | | // console.log(this.selectedRowKeys) |
| | | this.$refs.seachModalForm.openPage(this.selectedRowKeys) |
| | | this.$refs.seachModalForm.title = 'éæ©è®¾å¤' |
| | | this.$refs.seachModalForm.disableSubmit = false |
| | | }, |
| | | getDeviceRows(val) { |
| | | // console.log(val) |
| | | // let map = {} |
| | | // val.forEach(item => { |
| | | // let key = item.equipmentId; |
| | | // if(!map[key]){ |
| | | // let list = []; |
| | | // list.push(item); |
| | | // map[key] = list; |
| | | // }else { |
| | | // map[key].push(item); |
| | | // } |
| | | // }); |
| | | // this.mapDateList = map; |
| | | // console.log(this.mapDateList); |
| | | var equipmentIds; |
| | | for(var i = 0;i<val.length;i++){ |
| | | if (i == 0) { |
| | | equipmentIds = val[i].equipmentId; |
| | | } else { |
| | | equipmentIds = equipmentIds + "," + val[i].equipmentId; |
| | | } |
| | | } |
| | | let obj = { |
| | | id:this.sectionId, |
| | | equipmentId:equipmentIds |
| | | } |
| | | var param = Object.assign(obj) |
| | | putAction(this.url.updateEquipment,param).then(res=>{ |
| | | // console.log(res); |
| | | if(res.success){ |
| | | this.loadData2(); |
| | | } |
| | | }) |
| | | // console.log("========",equipmentIds); |
| | | // this.form.setFieldsValue({ |
| | | // equipmentId: equipmentIds, |
| | | // }) |
| | | }, |
| | | onClearSelected() { |
| | | this.selectedRowKeys = [] |
| | | this.selectionRows = [] |
| | | }, |
| | | loadData(arg) { |
| | | if(!this.url.list){ |
| | | this.$message.error("请设置url.list屿§!") |
| | | return |
| | | } |
| | | //å è½½æ°æ® è¥ä¼ å
¥åæ°1åå 载第ä¸é¡µçå
容 |
| | | if (arg === 1) { |
| | | this.ipagination.current = 1; |
| | | } |
| | | var params = this.getQueryParams();//æ¥è¯¢æ¡ä»¶ |
| | | |
| | | if(!params){ |
| | | return false; |
| | | } |
| | | this.loading = true; |
| | | console.log(params); |
| | | getAction(this.url.list, params).then((res) => { |
| | | if (res.success) { |
| | | this.dataSource = res.result.records; |
| | | //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; |
| | | } |
| | | //update-end---author:zhangyafei Date:20201118 forï¼éé
ä¸åé¡µçæ°æ®å表------------ |
| | | }else{ |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | batchDelll: function () { |
| | | if(!this.url.deleteBatch){ |
| | | this.$message.error("请设置url.deleteBatch屿§!") |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length <= 0) { |
| | | // this.$message.warning('è¯·éæ©ä¸æ¡è®°å½ï¼'); |
| | | this.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:"è¯·éæ©ä¸æ¡è®°å½" |
| | | }); |
| | | return; |
| | | } else { |
| | | var ids = ""; |
| | | for (var a = 0; a < this.selectedRowKeys.length; a++) { |
| | | ids += this.selectedRowKeys[a] + ","; |
| | | } |
| | | var that = this; |
| | | this.$confirm({ |
| | | title: "确认å é¤", |
| | | content: "æ¯å¦å é¤é䏿°æ®?", |
| | | onOk: function () { |
| | | that.loading = true; |
| | | deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => { |
| | | if (res.success) { |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(that.selectedRowKeys.length) |
| | | // that.$message.success(res.message); |
| | | that.$notification.success({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | that.loadData(); |
| | | that.onClearSelected(); |
| | | that.$emit('delectTree','') |
| | | } else { |
| | | // that.$message.warning(res.message); |
| | | that.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | } |
| | | }).finally(() => { |
| | | that.loading = false; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | handleDelete: function (id) { |
| | | if(!this.url.delete){ |
| | | this.$message.error("请设置url.delete屿§!") |
| | | return |
| | | } |
| | | var that = this; |
| | | deleteAction(that.url.delete, {ids: id}).then((res) => { |
| | | if (res.success) { |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(1) |
| | | // that.$message.success(res.message); |
| | | that.$notification.success({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | that.loadData(); |
| | | that.onClearSelected(); |
| | | that.$emit('delectTree','') |
| | | } else { |
| | | // that.$message.warning(res.message); |
| | | that.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | handleDeleteZi: function (id) { |
| | | if(!this.url.delete){ |
| | | this.$message.error("请设置url.delete屿§!") |
| | | return |
| | | } |
| | | let that = this; |
| | | getAction(that.url.updateBatchSection, {ids: id}).then((res) => { |
| | | if (res.success) { |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(1) |
| | | // that.$message.success(res.message); |
| | | that.$notification.success({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | that.loadData2(); |
| | | // that.onClearSelected(); |
| | | // that.$emit('delectTree','') |
| | | } else { |
| | | // that.$message.warning(res.message); |
| | | that.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | getQueryParams2() { |
| | | //è·åæ¥è¯¢æ¡ä»¶ |
| | | let sqp = {} |
| | | if (this.superQueryParams2) { |
| | | sqp['superQueryParams'] = encodeURI(this.superQueryParams2) |
| | | sqp['superQueryMatchType'] = this.superQueryMatchType2 |
| | | } |
| | | var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2) |
| | | param.field = this.getQueryField2() |
| | | param.pageNo = this.ipagination2.current |
| | | param.pageSize = this.ipagination2.pageSize |
| | | param.sectionId = this.sectionId |
| | | return filterObj(param) |
| | | }, |
| | | loadData2(arg) { |
| | | if (!this.url.list2) { |
| | | this.$message.error('请设置url.list2屿§!') |
| | | return |
| | | } |
| | | //å è½½æ°æ® è¥ä¼ å
¥åæ°1åå 载第ä¸é¡µçå
容 |
| | | if (arg === 1) { |
| | | this.ipagination2.current = 1 |
| | | } |
| | | if (this.currentRoleId === '') return |
| | | let params = this.getQueryParams2()//æ¥è¯¢æ¡ä»¶ |
| | | params.roleId = this.currentRoleId |
| | | this.loading2 = true |
| | | getAction(this.url.list2, params).then((res) => { |
| | | if (res.success) { |
| | | this.dataSource2 = res.result.records |
| | | this.ipagination2.total = res.result.total |
| | | |
| | | } |
| | | this.loading2 = false |
| | | }) |
| | | |
| | | }, |
| | | getQueryField2() { |
| | | //TODO åæ®µæéæ§å¶ |
| | | var str = 'id,' |
| | | this.columns2.forEach(function(value) { |
| | | str += ',' + value.dataIndex |
| | | }) |
| | | return str |
| | | }, |
| | | handleTableChange2(pagination, filters, sorter) { |
| | | //å页ãæåºãçéååæ¶è§¦å |
| | | //TODO çé |
| | | if (Object.keys(sorter).length > 0) { |
| | | this.isorter2.column = sorter.field |
| | | this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc' |
| | | } |
| | | this.ipagination2 = pagination |
| | | this.loadData2() |
| | | }, |
| | | modalFormOk(val) { |
| | | // æ°å¢/ä¿®æ¹ æåæ¶ï¼éè½½å表 |
| | | this.loadData(); |
| | | this.loadData2() |
| | | this.$emit('openBasetree','') |
| | | this.selectedRowKeys = [] |
| | | }, |
| | | handleEdit: function (record) { |
| | | if (record.id) { |
| | | this.$refs.modalForm.title = 'ç¼è¾' |
| | | this.$refs.modalForm.disableSubmit = false |
| | | this.$refs.modalForm.edit(record) |
| | | } else { |
| | | this.$refs.tierModalForm.title = 'ç¼è¾' |
| | | this.$refs.tierModalForm.disableSubmit = false |
| | | this.$refs.tierModalForm.edit(record) |
| | | } |
| | | }, |
| | | // handleEdit() { |
| | | // this.selectionRows = this.dataSource.filter(item => this.selectedRowKeys[0] == item.id) |
| | | // let row = this.selectionRows[0] |
| | | // if (row.equipmentId) { |
| | | // this.$refs.modalForm.title = 'ç¼è¾è®¾å¤' |
| | | // this.$refs.modalForm.disableSubmit = false |
| | | // this.$refs.modalForm.edit(row) |
| | | // } else { |
| | | // this.$refs.tierModalForm.title = 'ç¼è¾å±çº§' |
| | | // this.$refs.tierModalForm.disableSubmit = false |
| | | // this.$refs.tierModalForm.edit(row) |
| | | // } |
| | | // }, |
| | | handleAdd() { |
| | | if (this.node && JSON.stringify(this.node) != '{}') { |
| | | // // console.log(this.node); |
| | | // if(this.node.entity.equipmentId != null){ |
| | | // // alert('ä¸å¯å¨æ¤å±çº§ä¸å¢å 设å¤') |
| | | // this.$message.warning('ä¸å¯å¨æ¤å±çº§ä¸å¢å 设å¤ï¼') |
| | | // }else{ |
| | | this.$refs.modalForm.add(this.node) |
| | | this.$refs.modalForm.title = 'æ°å¢äººå' |
| | | this.$refs.modalForm.disableSubmit = false |
| | | // } |
| | | } else { |
| | | this.$message.warning('è¯·éæ©æå±å±çº§ï¼') |
| | | } |
| | | }, |
| | | handleAddTier() { |
| | | // if (this.node && JSON.stringify(this.node) != '{}') { |
| | | // if(this.node.entity.equipmentId != null){ |
| | | // // alert('ä¸å¯å¨æ¤å±çº§ä¸å¢å å±çº§') |
| | | // this.$message.warning('ä¸å¯å¨æ¤å±çº§ä¸å¢å å±çº§ï¼') |
| | | // }else{ |
| | | this.$refs.tierModalForm.add(this.node) |
| | | this.$refs.tierModalForm.title = 'æ°å¢é¨é¨' |
| | | this.$refs.tierModalForm.disableSubmit = false |
| | | // } |
| | | // }else{ |
| | | // this.$refs.tierModalForm.add(this.node) |
| | | // this.$refs.tierModalForm.title = 'æ°å¢é¨é¨' |
| | | // this.$refs.tierModalForm.disableSubmit = false |
| | | // } |
| | | }, |
| | | pQuery(parentId) { |
| | | this.queryParam.parentId = parentId[0] |
| | | if(this.selectedRowKeys.length >= 1) { |
| | | this.selectedRowKeys.length = 0 |
| | | } |
| | | this.loadData() |
| | | }, |
| | | onSelectChange(selectedRowKeys, selectionRows) { |
| | | this.selectedRowKeys = selectedRowKeys; |
| | | this.selectionRows = selectionRows; |
| | | // console.log(this.selectedRowKeys) |
| | | this.sectionId = this.selectedRowKeys[0] |
| | | // console.log(this.sectionId) |
| | | // this.ipagination2.current = 1 |
| | | this.loadData2(1) |
| | | }, |
| | | }, |
| | | created() { |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | @import '~@assets/less/common.less'; |
| | | |
| | | @media screen and (min-width: 1920px){ |
| | | .device_list{ |
| | | height: 748px!important; |
| | | overflow: scroll; |
| | | } |
| | | } |
| | | @media screen and (min-width: 1680px) and (max-width: 1920px){ |
| | | .device_list{ |
| | | height: 748px!important; |
| | | overflow: scroll; |
| | | } |
| | | } |
| | | @media screen and (min-width: 1400px) and (max-width: 1680px){ |
| | | .device_list{ |
| | | height: 600px!important; |
| | | overflow: scroll; |
| | | } |
| | | } |
| | | @media screen and (min-width: 1280px) and (max-width: 1400px){ |
| | | .device_list{ |
| | | height: 501px!important; |
| | | overflow: scroll; |
| | | } |
| | | } |
| | | @media screen and (max-width: 1280px){ |
| | | .device_list{ |
| | | height: 501px!important; |
| | | overflow: scroll; |
| | | } |
| | | } |
| | | </style> |