From 7e0c515f1170d41a62dc73c1ea7c6cb4e40ce3c9 Mon Sep 17 00:00:00 2001 From: cuijian <cuijian@xalxzn.com> Date: 星期六, 28 六月 2025 21:58:33 +0800 Subject: [PATCH] 供应商管理、线边库管理、产线人员绑定 --- src/views/base/modules/FactoryManager/UserFactory.vue | 149 ++++++++++++++++++++----------------------------- 1 files changed, 60 insertions(+), 89 deletions(-) diff --git a/src/views/base/modules/FactoryManager/FactoryEquipment.vue b/src/views/base/modules/FactoryManager/UserFactory.vue similarity index 63% rename from src/views/base/modules/FactoryManager/FactoryEquipment.vue rename to src/views/base/modules/FactoryManager/UserFactory.vue index c9ada63..fc69a7d 100644 --- a/src/views/base/modules/FactoryManager/FactoryEquipment.vue +++ b/src/views/base/modules/FactoryManager/UserFactory.vue @@ -1,16 +1,16 @@ <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> @@ -18,6 +18,8 @@ </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"> @@ -44,12 +46,6 @@ :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> @@ -59,21 +55,24 @@ </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:{}, @@ -89,34 +88,17 @@ } }, { - 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', @@ -127,22 +109,23 @@ ], 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 () { @@ -155,39 +138,14 @@ 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" @@ -196,19 +154,12 @@ 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) { @@ -216,9 +167,7 @@ }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 @@ -239,7 +188,7 @@ 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); @@ -250,15 +199,15 @@ 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:'娑堟伅', @@ -275,8 +224,8 @@ } }, batchDel: function () { - if(!this.url.removeEquipmentsForProduction){ - this.$message.error("璇疯缃畊rl.removeEquipmentsForProduction灞炴��!") + if(!this.url.deleteBatch){ + this.$message.error("璇疯缃畊rl.deleteBatch灞炴��!") return } if (this.selectedRowKeys.length <= 0) { @@ -297,19 +246,17 @@ 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 @@ -322,6 +269,30 @@ }); } }, + 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> -- Gitblit v1.9.3