|
|
@@ -28,7 +28,6 @@
|
|
|
>
|
|
|
删除
|
|
|
</el-button>
|
|
|
-
|
|
|
</template>
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="{ row }">
|
|
|
@@ -68,14 +67,14 @@
|
|
|
components: {
|
|
|
staffSelection
|
|
|
},
|
|
|
- props:{
|
|
|
- factoryId:String
|
|
|
+ props: {
|
|
|
+ factoryId: String
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
columns: [
|
|
|
- {
|
|
|
- columnKey: 'selection',
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
type: 'selection',
|
|
|
width: 45,
|
|
|
align: 'center',
|
|
|
@@ -86,8 +85,7 @@
|
|
|
width: 45,
|
|
|
type: 'index',
|
|
|
columnKey: 'index',
|
|
|
- align: 'center',
|
|
|
-
|
|
|
+ align: 'center'
|
|
|
},
|
|
|
{
|
|
|
prop: 'name',
|
|
|
@@ -97,6 +95,10 @@
|
|
|
prop: 'jobNumber',
|
|
|
label: '工号'
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'loginName',
|
|
|
+ label: '账号'
|
|
|
+ },
|
|
|
{
|
|
|
prop: 'phone',
|
|
|
label: '电话'
|
|
|
@@ -109,7 +111,7 @@
|
|
|
resizable: false,
|
|
|
slot: 'action',
|
|
|
showOverflowTooltip: true,
|
|
|
- fixed:'right'
|
|
|
+ fixed: 'right'
|
|
|
}
|
|
|
],
|
|
|
datasource: [],
|
|
|
@@ -119,43 +121,40 @@
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- remove (row) {
|
|
|
+ remove(row) {
|
|
|
let index = this.datasource.findIndex((n) => n.id == row.id);
|
|
|
if (index !== -1) {
|
|
|
this.datasource.splice(index, 1);
|
|
|
- this.deleteUserIds.push((row.id));
|
|
|
+ this.deleteUserIds.push(row.id);
|
|
|
this.$emit('deleteIds', this.deleteUserIds);
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
|
|
|
handAllDel() {
|
|
|
console.log(this.selection);
|
|
|
- console.log(this.datasource)
|
|
|
+ console.log(this.datasource);
|
|
|
|
|
|
this.selection.forEach((e) => {
|
|
|
- this.datasource.forEach((f,i) => {
|
|
|
- if(e.id == f.id){
|
|
|
+ this.datasource.forEach((f, i) => {
|
|
|
+ if (e.id == f.id) {
|
|
|
this.datasource.splice(i, 1);
|
|
|
- this.deleteUserIds.push((f.id));
|
|
|
+ this.deleteUserIds.push(f.id);
|
|
|
this.$emit('deleteIds', this.deleteUserIds);
|
|
|
}
|
|
|
-
|
|
|
- })
|
|
|
+ });
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
|
|
|
- handlAdd () {
|
|
|
- if(!this.factoryId){
|
|
|
- this.$message.warning('请先选择所属工厂!');
|
|
|
- return
|
|
|
+ handlAdd() {
|
|
|
+ if (!this.factoryId) {
|
|
|
+ this.$message.warning('请先选择所属工厂!');
|
|
|
+ return;
|
|
|
}
|
|
|
this.$refs.staffSelection.open(
|
|
|
JSON.parse(JSON.stringify(this.datasource))
|
|
|
);
|
|
|
},
|
|
|
- confirmStaffSelection (data) {
|
|
|
+ confirmStaffSelection(data) {
|
|
|
data.forEach((element) => {
|
|
|
if (!('isLeader' in element)) {
|
|
|
// isLeader 是否为班组长
|
|
|
@@ -166,7 +165,7 @@
|
|
|
this.setDefaultLeader();
|
|
|
},
|
|
|
// 设置默认班组长
|
|
|
- setDefaultLeader () {
|
|
|
+ setDefaultLeader() {
|
|
|
if (this.datasource.length <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
@@ -176,7 +175,7 @@
|
|
|
}
|
|
|
},
|
|
|
// 设置班组长
|
|
|
- setLeader (row) {
|
|
|
+ setLeader(row) {
|
|
|
console.log(row);
|
|
|
this.datasource.forEach((n) => {
|
|
|
n.isLeader = false;
|
|
|
@@ -184,7 +183,7 @@
|
|
|
row.isLeader = true;
|
|
|
},
|
|
|
// 设置班组长(id)
|
|
|
- setLeaderId (id) {
|
|
|
+ setLeaderId(id) {
|
|
|
let result = this.datasource.find((n) => id == n.id);
|
|
|
|
|
|
if (result) {
|
|
|
@@ -195,13 +194,12 @@
|
|
|
}
|
|
|
},
|
|
|
// 清空表格
|
|
|
- restTable () {
|
|
|
+ restTable() {
|
|
|
this.datasource = [];
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 获取班组长id
|
|
|
- getTwi () {
|
|
|
+ getTwi() {
|
|
|
let result = this.datasource.find((n) => n.isLeader == true);
|
|
|
if (result) {
|
|
|
return result.id;
|