|
|
@@ -60,16 +60,22 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column width="180" label="操作" align="right">
|
|
|
- <template slot="header" slot-scope="scope">
|
|
|
+ <template slot="header">
|
|
|
<div style="display: flex">
|
|
|
-
|
|
|
- <el-input v-model="userName" placeholder="输入姓名查询" clearable
|
|
|
- @change="changeUserName"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="userName"
|
|
|
+ placeholder="输入姓名查询"
|
|
|
+ clearable
|
|
|
+ autocomplete="new-password"
|
|
|
+ @change="changeUserName"
|
|
|
+ ></el-input>
|
|
|
<div
|
|
|
v-if="staffList.length !== 0 && isMore"
|
|
|
class="zw-page-list-more"
|
|
|
>
|
|
|
- <el-button type="text" @click="getMore()">更多<i class="el-icon-caret-bottom"></i></el-button>
|
|
|
+ <el-button type="text" @click="getMore()"
|
|
|
+ >更多<i class="el-icon-caret-bottom"></i
|
|
|
+ ></el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -85,32 +91,28 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column width="80" label="操作">
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-<!-- <template slot-scope="{ row }">-->
|
|
|
-<!-- <el-button-->
|
|
|
-<!-- size="mini"-->
|
|
|
-<!-- type="primary"-->
|
|
|
-<!-- @click="choiceAsset(row)"-->
|
|
|
-<!-- :disabled="row.disabled"-->
|
|
|
-<!-- icon="el-icon-arrow-right"-->
|
|
|
-<!-- circle-->
|
|
|
-<!-- >-->
|
|
|
-<!-- </el-button>-->
|
|
|
-<!-- </template>-->
|
|
|
+ <el-table-column width="80" label="操作">
|
|
|
+ <!-- <template slot-scope="{ row }">-->
|
|
|
+ <!-- <el-button-->
|
|
|
+ <!-- size="mini"-->
|
|
|
+ <!-- type="primary"-->
|
|
|
+ <!-- @click="choiceAsset(row)"-->
|
|
|
+ <!-- :disabled="row.disabled"-->
|
|
|
+ <!-- icon="el-icon-arrow-right"-->
|
|
|
+ <!-- circle-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- </el-button>-->
|
|
|
+ <!-- </template>-->
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-<!-- <div-->
|
|
|
-<!-- v-if="staffList.length !== 0 && isMore"-->
|
|
|
-<!-- class="zw-page-list-more"-->
|
|
|
-<!-- >-->
|
|
|
-<!-- <el-link @click="getMore()" type="primary"-->
|
|
|
-<!-- >更多<i class="el-icon-caret-bottom"></i>-->
|
|
|
-<!-- </el-link>-->
|
|
|
-<!-- </div>-->
|
|
|
+ <!-- <div-->
|
|
|
+ <!-- v-if="staffList.length !== 0 && isMore"-->
|
|
|
+ <!-- class="zw-page-list-more"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <el-link @click="getMore()" type="primary"-->
|
|
|
+ <!-- >更多<i class="el-icon-caret-bottom"></i>-->
|
|
|
+ <!-- </el-link>-->
|
|
|
+ <!-- </div>-->
|
|
|
</el-container>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
@@ -191,20 +193,25 @@
|
|
|
},
|
|
|
props: {
|
|
|
type: {},
|
|
|
- hasAccount:{
|
|
|
- default:0
|
|
|
+ hasAccount: {
|
|
|
+ default: 0
|
|
|
},
|
|
|
- factoryId:String,
|
|
|
-
|
|
|
+ factoryId: String
|
|
|
},
|
|
|
created() {},
|
|
|
methods: {
|
|
|
open(selectedList) {
|
|
|
+ this.resetSearchState();
|
|
|
this.dialogVisible = true;
|
|
|
- this.pageNum = 1;
|
|
|
this.selectStafflist = selectedList;
|
|
|
this.getInfo();
|
|
|
},
|
|
|
+ resetSearchState() {
|
|
|
+ this.userName = '';
|
|
|
+ this.staffList = [];
|
|
|
+ this.pageNum = 1;
|
|
|
+ this.isMore = false;
|
|
|
+ },
|
|
|
//初始数据
|
|
|
async getInfo() {
|
|
|
let list = await listOrganizations();
|
|
|
@@ -213,27 +220,26 @@
|
|
|
idField: 'id',
|
|
|
parentIdField: 'parentId'
|
|
|
});
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.handleNodeClick(this.treeList[0])
|
|
|
- this.$refs.tree.setCurrentKey(this.treeList[0].id)
|
|
|
-
|
|
|
- })
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.handleNodeClick(this.treeList[0]);
|
|
|
+ this.$refs.tree.setCurrentKey(this.treeList[0].id);
|
|
|
+ });
|
|
|
//this.treeList = res.data;
|
|
|
},
|
|
|
- //选择分类
|
|
|
- handleNodeClick(data) {
|
|
|
- this.currentData = data
|
|
|
- this.staffList = [];
|
|
|
- this.pageNum = 1;
|
|
|
- this.form.groupId = data.id;
|
|
|
- let params = {
|
|
|
- pageNum: 1,
|
|
|
- size: this.size,
|
|
|
- groupId: this.form.groupId,
|
|
|
- // hasAccount:this.hasAccount
|
|
|
- };
|
|
|
- this.getStaffList(params);
|
|
|
- },
|
|
|
+ //选择分类
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.currentData = data;
|
|
|
+ this.staffList = [];
|
|
|
+ this.pageNum = 1;
|
|
|
+ this.form.groupId = data.id;
|
|
|
+ let params = {
|
|
|
+ pageNum: 1,
|
|
|
+ size: this.size,
|
|
|
+ groupId: this.form.groupId
|
|
|
+ // hasAccount:this.hasAccount
|
|
|
+ };
|
|
|
+ this.getStaffList(params);
|
|
|
+ },
|
|
|
changeUserName() {
|
|
|
this.staffList = [];
|
|
|
this.pageNum = 1;
|
|
|
@@ -244,91 +250,93 @@
|
|
|
groupId: this.form.groupId,
|
|
|
name: this.userName
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
this.getStaffList(params);
|
|
|
},
|
|
|
- //获取员工列表
|
|
|
- async getStaffList(params) {
|
|
|
- console.log(this.factoryId,'factoryId')
|
|
|
- if(this.factoryId){
|
|
|
- params['factoryId']=this.factoryId
|
|
|
+ //获取员工列表
|
|
|
+ async getStaffList(params) {
|
|
|
+ console.log(this.factoryId, 'factoryId');
|
|
|
+ if (this.factoryId) {
|
|
|
+ params['factoryId'] = this.factoryId;
|
|
|
}
|
|
|
- let res = await getUserPage(params);
|
|
|
- let list = res.list;
|
|
|
-
|
|
|
- list.forEach((el) => {
|
|
|
- let _index = this.selectStafflist.findIndex((n) => n.id == el.id);
|
|
|
- if (_index !== -1) {
|
|
|
- el.disabled = true;
|
|
|
+ let res = await getUserPage(params);
|
|
|
+ let list = res.list;
|
|
|
+
|
|
|
+ list.forEach((el) => {
|
|
|
+ let _index = this.selectStafflist.findIndex((n) => n.id == el.id);
|
|
|
+ if (_index !== -1) {
|
|
|
+ el.disabled = true;
|
|
|
+ } else {
|
|
|
+ el.disabled = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.staffList = [...this.staffList, ...list];
|
|
|
+
|
|
|
+ if (this.staffList.length < res.count) {
|
|
|
+ this.isMore = true;
|
|
|
} else {
|
|
|
- el.disabled = false;
|
|
|
+ this.isMore = false;
|
|
|
}
|
|
|
- });
|
|
|
- this.staffList = [...this.staffList, ...list];
|
|
|
-
|
|
|
- if (this.staffList.length < res.count) {
|
|
|
- this.isMore = true;
|
|
|
- } else {
|
|
|
- this.isMore = false;
|
|
|
- }
|
|
|
- // this.pageNum = res.pageNum;
|
|
|
- },
|
|
|
- //查询更多员工
|
|
|
- async getMore() {
|
|
|
- this.pageNum = this.pageNum + 1;
|
|
|
- let params = {
|
|
|
- pageNum:this.pageNum,
|
|
|
- size: this.size,
|
|
|
- groupId: this.form.groupId,
|
|
|
- name: this.userName
|
|
|
- };
|
|
|
- this.getStaffList(params);
|
|
|
- },
|
|
|
- //选择员工
|
|
|
- choiceAsset(info) {
|
|
|
- let data = JSON.parse(JSON.stringify(info));
|
|
|
- if (info.teamId &&this.type!='bpm') {
|
|
|
- this.$confirm('当前员工已有所属班组, 是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.selectStafflist.push(data);
|
|
|
- info.disabled = true;
|
|
|
+ // this.pageNum = res.pageNum;
|
|
|
+ },
|
|
|
+ //查询更多员工
|
|
|
+ async getMore() {
|
|
|
+ this.pageNum = this.pageNum + 1;
|
|
|
+ let params = {
|
|
|
+ pageNum: this.pageNum,
|
|
|
+ size: this.size,
|
|
|
+ groupId: this.form.groupId,
|
|
|
+ name: this.userName
|
|
|
+ };
|
|
|
+ this.getStaffList(params);
|
|
|
+ },
|
|
|
+ //选择员工
|
|
|
+ choiceAsset(info) {
|
|
|
+ let data = JSON.parse(JSON.stringify(info));
|
|
|
+ if (info.teamId && this.type != 'bpm') {
|
|
|
+ this.$confirm('当前员工已有所属班组, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
- } else {
|
|
|
- this.selectStafflist.push(data);
|
|
|
- info.disabled = true;
|
|
|
- }
|
|
|
- },
|
|
|
- //删除已选员工
|
|
|
- deleteSelectStaff(info, index) {
|
|
|
- this.staffList.forEach((el) => {
|
|
|
- if (el.id == info.id) {
|
|
|
- el.disabled = false;
|
|
|
+ .then(() => {
|
|
|
+ this.selectStafflist.push(data);
|
|
|
+ info.disabled = true;
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ } else {
|
|
|
+ this.selectStafflist.push(data);
|
|
|
+ info.disabled = true;
|
|
|
}
|
|
|
- });
|
|
|
- this.selectStafflist.splice(index, 1);
|
|
|
- },
|
|
|
- //保存
|
|
|
- sumbit() {
|
|
|
- if (this.selectStafflist.length === 0) {
|
|
|
- this.$message.warning('请选择员工');
|
|
|
- } else {
|
|
|
- this.$emit('confirm', JSON.parse(JSON.stringify(this.selectStafflist)));
|
|
|
- this.handleClose();
|
|
|
+ },
|
|
|
+ //删除已选员工
|
|
|
+ deleteSelectStaff(info, index) {
|
|
|
+ this.staffList.forEach((el) => {
|
|
|
+ if (el.id == info.id) {
|
|
|
+ el.disabled = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.selectStafflist.splice(index, 1);
|
|
|
+ },
|
|
|
+ //保存
|
|
|
+ sumbit() {
|
|
|
+ if (this.selectStafflist.length === 0) {
|
|
|
+ this.$message.warning('请选择员工');
|
|
|
+ } else {
|
|
|
+ this.$emit(
|
|
|
+ 'confirm',
|
|
|
+ JSON.parse(JSON.stringify(this.selectStafflist))
|
|
|
+ );
|
|
|
+ this.handleClose();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.resetSearchState();
|
|
|
+ this.selectStafflist = [];
|
|
|
+ this.dialogVisible = false;
|
|
|
}
|
|
|
- },
|
|
|
- handleClose() {
|
|
|
- this.staffList = [];
|
|
|
- this.selectStafflist = [];
|
|
|
- this.userName = '';
|
|
|
- this.dialogVisible = false;
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|