ÎļþÃû´Ó src/views/base/modules/FactoryManager/FactoryEquipment.vue ÐÞ¸Ä |
| | |
| | | <template> |
| | | <a-card :bordered="false"> |
| | | <template v-if="this.productionId"> |
| | | <template v-if="this.factoryId"> |
| | | <div class="table-page-search-wrapper"> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | |
| | | <a-col :md="6" :sm="12"> |
| | | <a-form-item label="设å¤ç¼å·"> |
| | | <a-input placeholder="请è¾å
¥è®¾å¤ç¼å·" v-model="queryParam.equipmentId"></a-input> |
| | | <a-col :md="12" :sm="12"> |
| | | <a-form-item label="人åç¼å·"> |
| | | <a-input placeholder="请è¾å
¥äººåç¼å·" v-model="queryParam.username"></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :md="6" :sm="8"> |
| | | <a-col :md="12" :sm="12"> |
| | | <a-button type="primary" @click="searchQuery" icon="search">æ¥è¯¢</a-button> |
| | | <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">éç½®</a-button> |
| | | </a-col> |
| | |
| | | </a-form> |
| | | </div> |
| | | <div class="table-operator" style="border-top: 5px"> |
| | | <a-button @click="handleAddUserFactory" type="primary" icon="plus" style="margin-top: 16px">æ·»å 产线人å</a-button> |
| | | |
| | | <a-dropdown v-if="selectedRowKeys.length > 0"> |
| | | <a-menu slot="overlay" @click="handleMenuClick"> |
| | | <a-menu-item key="1"> |
| | |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
| | | @change="handleTableChange"> |
| | | |
| | | <!--<template slot="avatarslot" slot-scope="text, record, index">--> |
| | | <!--<div class="anty-img-wrap">--> |
| | | <!--<a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>--> |
| | | <!--</div>--> |
| | | <!--</template>--> |
| | | |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a-popconfirm title="ç¡®å®ç§»é¤å?" @confirm="() => handleDelete(record.id)"> |
| | | <a>ç§»é¤</a> |
| | |
| | | </template> |
| | | <a-card v-else :bordered="false" style="height:200px"> |
| | | <a-empty> |
| | | <span slot="description"> 请å
éæ©ä¸ä¸ªé¨é¨! </span> |
| | | <span slot="description"> 请å
éæ©ä¸ä¸ªäº§çº¿! </span> |
| | | </a-empty> |
| | | </a-card> |
| | | <Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal> |
| | | </a-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import { filterObj } from '@/utils/util'; |
| | | import {queryTreeListForRole,queryDepartPermission,saveDepartPermission} from '@/api/api' |
| | | import {JeecgListMixin} from '@/mixins/JeecgListMixin' |
| | | import { getAction,postAction } from '@/api/manage' |
| | | import qs from 'qs' |
| | | import { getAction,postAction,deleteAction } from '@/api/manage' |
| | | import SelectUserModal from './SelectUserModal' |
| | | export default { |
| | | name: 'FactoryEquipment', |
| | | name: 'UserFactory', |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | SelectUserModal |
| | | }, |
| | | data(){ |
| | | return { |
| | | queryParam:{}, |
| | |
| | | } |
| | | }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | title: '人åç¼å·', |
| | | align: "center", |
| | | dataIndex: 'equipmentId', |
| | | dataIndex: 'username', |
| | | width: 120, |
| | | // sorter: true |
| | | }, |
| | | { |
| | | title: '设å¤åç§°', |
| | | title: '人ååç§°', |
| | | align: "center", |
| | | width: 150, |
| | | dataIndex: 'equipmentName', |
| | | dataIndex: 'realname', |
| | | }, |
| | | { |
| | | title: '设å¤ç±»å', |
| | | align: "center", |
| | | width: 120, |
| | | dataIndex: 'equipmentType', |
| | | // scopedSlots: {customRender: "avatarslot"} |
| | | }, |
| | | |
| | | { |
| | | title: '驱å¨ç±»å', |
| | | align: "center", |
| | | width: 80, |
| | | dataIndex: 'driveType', |
| | | // sorter: true |
| | | }, |
| | | |
| | | { |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | |
| | | |
| | | ], |
| | | disableMixinCreated:true, |
| | | productionId:"", |
| | | title:"é¨é¨æéé
ç½®", |
| | | factoryId:"", |
| | | title:"产线人åé
ç½®", |
| | | visible: false, |
| | | loading: false, |
| | | url:{ |
| | | list:'/mdc/mdcEquipment/equipmentListByProduction', |
| | | removeEquipmentForDepart:'/mdc/mdcEquipment/removeEquipmentForProduction', |
| | | list:'/sys/user/userFactoryList', |
| | | deleteUserFactory:'/sys/user/deleteUserFactory', |
| | | serachEquipment:'/mdc/mdcEquipment/equipmentListByProduction', |
| | | removeEquipmentsForProduction:"/mdc/mdcEquipment/removeEquipmentsForProduction" |
| | | deleteBatch:"/sys/user/deleteUserFactoryBatch", |
| | | addUserFactory:'/sys/user/addBaseUserFactory' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | show(productionId){ |
| | | this.productionId=productionId |
| | | show(factoryId){ |
| | | this.factoryId=factoryId |
| | | this.loadData(); |
| | | }, |
| | | close () { |
| | |
| | | this.loadData(); |
| | | }, |
| | | searchQuery() { |
| | | var id = this.queryParam.equipmentId |
| | | this.loading = true; |
| | | var params = this.getQueryParams();//æ¥è¯¢æ¡ä»¶ |
| | | |
| | | params.pageNo = this.ipagination.current; |
| | | params.pageSize = this.ipagination.pageSize; |
| | | getAction(this.url.serachEquipment,{equipmentId:this.queryParam.equipmentId,productionId:this.productionId,pageNo:params.pageNo,pageSize:params.pageSize}).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; |
| | | } |
| | | //update-end---author:zhangyafei Date:20201118 forï¼éé
ä¸åé¡µçæ°æ®å表------------ |
| | | }else{ |
| | | // this.$message.warning(res.message) |
| | | this.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | } |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | this.loadData(); |
| | | }, |
| | | handleTableChange(pagination, filters, sorter) { |
| | | //å页ãæåºãçéååæ¶è§¦å |
| | | //TODO çé |
| | | // console.log(pagination) |
| | | if (Object.keys(sorter).length > 0) { |
| | | this.isorter.column = sorter.field; |
| | | this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" |
| | |
| | | this.loadData(); |
| | | }, |
| | | loadData(){ |
| | | //å è½½æ°æ® è¥ä¼ å
¥åæ°1åå 载第ä¸é¡µçå
容 |
| | | // if (arg === 1) { |
| | | // this.ipagination.current = 1; |
| | | // } |
| | | var params = this.getQueryParams();//æ¥è¯¢æ¡ä»¶ |
| | | |
| | | params.pageNo = this.ipagination.current; |
| | | params.pageSize = this.ipagination.pageSize; |
| | | 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) |
| | | { |
| | |
| | | }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 |
| | |
| | | param.field = this.getQueryField(); |
| | | param.pageNo = this.ipagination.current; |
| | | param.pageSize = this.ipagination.pageSize; |
| | | param.productionId = this.productionId; |
| | | param.factoryId = this.factoryId; |
| | | //è·åç¨æ·å®å¶ç忰屿§ |
| | | if (this.getCustomQueryParams) { |
| | | param = this.getCustomQueryParams(param); |
| | |
| | | |
| | | return filterObj(param); |
| | | }, |
| | | handleDelete(equipmentId){ |
| | | handleDelete(id){ |
| | | |
| | | postAction(this.url.removeEquipmentForDepart,qs.stringify({productionId:this.productionId,equipmentId:equipmentId})).then((res)=>{ |
| | | deleteAction(this.url.deleteUserFactory,{factoryId:this.factoryId,userId:id}).then((res)=>{ |
| | | if (res.success) { |
| | | this.$notification.success({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | this.loadData(this.productionId); |
| | | this.loadData(this.factoryId); |
| | | }else{ |
| | | this.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | |
| | | } |
| | | }, |
| | | batchDel: function () { |
| | | if(!this.url.removeEquipmentsForProduction){ |
| | | this.$message.error("请设置url.removeEquipmentsForProduction屿§!") |
| | | if(!this.url.deleteBatch){ |
| | | this.$message.error("请设置url.deleteBatch屿§!") |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length <= 0) { |
| | |
| | | content: "æ¯å¦å é¤é䏿°æ®?", |
| | | onOk: function () { |
| | | that.loading = true; |
| | | postAction(that.url.removeEquipmentsForProduction,qs.stringify({productionId:that.productionId,equipmentIds:ids})).then((res) => { |
| | | deleteAction(that.url.deleteBatch,{factoryId:that.factoryId,userIds:ids}).then((res) => { |
| | | if (res.success) { |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(that.selectedRowKeys.length) |
| | | // that.$message.success(res.message); |
| | | this.$notification.success({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | | }); |
| | | that.loadData(that.productionId); |
| | | that.loadData(that.factoryId); |
| | | that.onClearSelected(); |
| | | } else { |
| | | // that.$message.warning(res.message); |
| | | this.$notification.warning({ |
| | | message:'æ¶æ¯', |
| | | description:res.message |
| | |
| | | }); |
| | | } |
| | | }, |
| | | handleAddUserFactory() { |
| | | if (this.factoryId == '') { |
| | | this.$message.error('è¯·éæ©ä¸ä¸ªäº§çº¿!') |
| | | } else { |
| | | this.$refs.selectUserModal.visible = true |
| | | } |
| | | }, |
| | | selectOK(data) { |
| | | let params = {} |
| | | params.factoryId = this.factoryId |
| | | params.userIdList = [] |
| | | for (var a = 0; a < data.length; a++) { |
| | | params.userIdList.push(data[a]) |
| | | } |
| | | console.log(params) |
| | | postAction(this.url.addUserFactory, params).then((res) => { |
| | | if (res.success) { |
| | | this.loadData() |
| | | this.$message.success(res.message) |
| | | } else { |
| | | this.$message.warning(res.message) |
| | | } |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |