|
|
@@ -72,17 +72,61 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <!-- <el-form-item label="执行人" required prop="teamId">
|
|
|
+ <el-col v-if="!addForm.planExecuteType" :span="8">
|
|
|
+ <el-form-item label="部门">
|
|
|
+ <deptSelect
|
|
|
+ v-model="addForm.groupId"
|
|
|
+ @changeGroup="searchDeptNodeClick"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col v-if="!addForm.planExecuteType" :span="8">
|
|
|
+ <el-form-item label="指定负责人" prop="executeUsersIds">
|
|
|
+ <el-select
|
|
|
+ v-model="addForm.executeUsersIds"
|
|
|
+ size="small"
|
|
|
+ style="width: 100%"
|
|
|
+ multiple
|
|
|
+ filterable
|
|
|
+ @change="executeIdListChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in executorList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col v-if="addForm.planExecuteType" :span="8">
|
|
|
+ <!-- <el-form-item label="班组" prop="teamId">
|
|
|
+ <el-select
|
|
|
+ v-model="addForm.teamId"
|
|
|
+ size="small"
|
|
|
+ @change="teamChange"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :value="i.id"
|
|
|
+ :label="i.name"
|
|
|
+ v-for="i in allTeamList"
|
|
|
+ :key="i.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item label="执行人" required prop="teamId">
|
|
|
<el-select
|
|
|
v-model="addForm.teamId"
|
|
|
placeholder="请选择班组"
|
|
|
filterable
|
|
|
style="width: 120px"
|
|
|
@change="checkTeamList(addForm.teamId)"
|
|
|
+ disabled
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in teamList"
|
|
|
+ v-for="item in allTeamList"
|
|
|
:label="item.name"
|
|
|
:value="item.id"
|
|
|
:key="item.id"
|
|
|
@@ -109,33 +153,6 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- </el-form-item> -->
|
|
|
-
|
|
|
- <el-form-item label="部门">
|
|
|
- <deptSelect
|
|
|
- v-model="addForm.groupId"
|
|
|
- @changeGroup="searchDeptNodeClick"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
-
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="报工人" prop="executeUsersIds">
|
|
|
- <el-select
|
|
|
- v-model="addForm.executeUsersIds"
|
|
|
- size="small"
|
|
|
- style="width: 100%"
|
|
|
- multiple
|
|
|
- filterable
|
|
|
- @change="executeIdListChange"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in executorList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- :label="item.name"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -315,6 +332,7 @@
|
|
|
import { producetaskrulerecordSaveOrUpdateAndSubmit } from '@/api/recordRules/index.js';
|
|
|
import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
+ import { getteampage } from '@/api/workforceManagement/team';
|
|
|
|
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
|
@@ -392,7 +410,8 @@
|
|
|
recordRulesExecuteMethodId: null,
|
|
|
recordRulesExecuteMethodName: '',
|
|
|
// 产出类型 1-原材料,2-在制品,3.BOM标准产出
|
|
|
- outputType: 1
|
|
|
+ outputType: 1,
|
|
|
+ planExecuteType: 0
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
@@ -487,7 +506,8 @@
|
|
|
{ label: '物料统计', value: '2' },
|
|
|
{ label: '工序统计', value: '3' }
|
|
|
],
|
|
|
- executorList: []
|
|
|
+ executorList: [],
|
|
|
+ allTeamList: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -577,6 +597,7 @@
|
|
|
}
|
|
|
// 获取审核人列表、巡点检人员
|
|
|
this.getUserList();
|
|
|
+ this.getAllTeamList();
|
|
|
},
|
|
|
methods: {
|
|
|
// 外部调用,打开弹窗
|
|
|
@@ -602,15 +623,19 @@
|
|
|
i.checkUsersIds = i.checkUsers.map((j) => j.userId);
|
|
|
if (i.checkUsersIds.length == 0 && data.executeUsers.length > 0) {
|
|
|
// 默认执行人作为检查人
|
|
|
- i.checkUsersIds = data.executeUsers.map((j) => j.userId);
|
|
|
- i.checkUsers = data.executeUsers.map((j) => {
|
|
|
- return {
|
|
|
- teamId: j.teamId,
|
|
|
- teamName: j.teamName,
|
|
|
- userId: j.userId,
|
|
|
- userName: j.userName
|
|
|
- };
|
|
|
- });
|
|
|
+ i.checkUsersIds = data.executeUsers
|
|
|
+ .filter((i) => i.userId)
|
|
|
+ .map((j) => j.userId);
|
|
|
+ i.checkUsers = data.executeUsers
|
|
|
+ .filter((i) => i.userId)
|
|
|
+ .map((j) => {
|
|
|
+ return {
|
|
|
+ teamId: j.teamId,
|
|
|
+ teamName: j.teamName,
|
|
|
+ userId: j.userId,
|
|
|
+ userName: j.userName
|
|
|
+ };
|
|
|
+ });
|
|
|
}
|
|
|
return i;
|
|
|
});
|
|
|
@@ -618,18 +643,35 @@
|
|
|
console.log('this.addForm', this.addForm);
|
|
|
|
|
|
// 处理数据
|
|
|
- this.addForm.executeUsersIds = this.addForm.executeUsers.map(
|
|
|
- (i) => i.userId
|
|
|
- );
|
|
|
+ this.addForm.executeUsersIds = this.addForm.executeUsers
|
|
|
+ .map((i) => i.userId)
|
|
|
+ .filter((i) => i); // 过滤掉 undefined
|
|
|
|
|
|
this.addForm.teamId =
|
|
|
this.addForm.executeUsers.length > 0
|
|
|
? this.addForm.executeUsers[0].teamId
|
|
|
: '';
|
|
|
|
|
|
- if (this.addForm.executeUsers.length > 0) {
|
|
|
- this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '';
|
|
|
- this.searchDeptNodeClick(this.addForm.groupId);
|
|
|
+ if (
|
|
|
+ this.addForm.executeUsers.length > 0 &&
|
|
|
+ !this.addForm.planExecuteType
|
|
|
+ ) {
|
|
|
+ let groupIds = this.addForm.executeUsers
|
|
|
+ .map((i) => i.groupId)
|
|
|
+ .filter(
|
|
|
+ (item, index, arr) => arr.indexOf(item) === index && item
|
|
|
+ );
|
|
|
+
|
|
|
+ if (groupIds.includes('1')) {
|
|
|
+ this.addForm.groupId = '1';
|
|
|
+ } else {
|
|
|
+ this.addForm.groupId =
|
|
|
+ this.addForm.executeUsers[0]?.groupId + '' || '1';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.addForm.groupId) {
|
|
|
+ this.searchDeptNodeClick(this.addForm.groupId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (!this.addForm.teamId && this.teamList.length > 0) {
|
|
|
@@ -918,23 +960,48 @@
|
|
|
},
|
|
|
// 负责人变更 同步执行人列表
|
|
|
executeIdListChange() {
|
|
|
- this.addForm.executeUsers = this.addForm.executeUsersIds.map(
|
|
|
- (userId) => {
|
|
|
+ this.addForm.executeUsers = this.addForm.executeUsersIds
|
|
|
+ .map((userId) => {
|
|
|
const user = this.executorList.find((u) => u.id === userId);
|
|
|
+ if (!user) return null;
|
|
|
return {
|
|
|
userId: user.id,
|
|
|
userName: user.name,
|
|
|
groupId: user.groupId,
|
|
|
groupName: user.groupName
|
|
|
};
|
|
|
- }
|
|
|
- );
|
|
|
+ })
|
|
|
+ .filter((i) => i);
|
|
|
// 同步详情执行人
|
|
|
this.addForm.details.forEach((detail) => {
|
|
|
detail.checkUsersIds = this.addForm.executeUsersIds;
|
|
|
detail.checkUsers = this.addForm.executeUsers;
|
|
|
});
|
|
|
console.log('this.addForm.executeUsers', this.addForm.executeUsers);
|
|
|
+ },
|
|
|
+ async getAllTeamList() {
|
|
|
+ const { list } = await getteampage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ console.log('teamAllList 班组', list);
|
|
|
+ this.allTeamList = list;
|
|
|
+ },
|
|
|
+ teamChange() {
|
|
|
+ console.log('this.addForm.teamId', this.addForm.teamId);
|
|
|
+ // 当前班组
|
|
|
+ const currentTeam = this.allTeamList.find(
|
|
|
+ (item) => item.id === this.addForm.teamId
|
|
|
+ );
|
|
|
+ if (currentTeam) {
|
|
|
+ // 同步执行人
|
|
|
+ this.addForm.executeUser = [
|
|
|
+ {
|
|
|
+ teamId: currentTeam.id,
|
|
|
+ teamName: currentTeam.name
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|