|
|
@@ -35,29 +35,64 @@
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="类型" prop="autoOrder">
|
|
|
- <el-select v-model="addForm.type" size="small" @change="typeChange" style="width: 100%">
|
|
|
+ <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
+ <el-select v-model="addForm.type" :disabled="isBindPlan" size="small" @change="typeChange" style="width: 100%">
|
|
|
<el-option :value="1" label="班组"></el-option>
|
|
|
<el-option :value="0" label="个人"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')">
|
|
|
+
|
|
|
+ <el-col :span="8" v-if="dispatchType && addForm.type == 1 && !dialogTitle.includes('量具送检')">
|
|
|
+ <el-form-item label="班组" prop="teamId">
|
|
|
+ <el-select
|
|
|
+ v-model="addForm.teamId"
|
|
|
+ :disabled="isBindPlan"
|
|
|
+ size="small"
|
|
|
+ @change="teamChange"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ :value="i.id"
|
|
|
+ :label="i.name"
|
|
|
+ v-for="i in teamAllList"
|
|
|
+ :key="i.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="8" v-if="dispatchType && addForm.type == 0 && !dialogTitle.includes('量具送检')">
|
|
|
<el-form-item label="部门" prop="groupId">
|
|
|
<deptSelect v-model="addForm.groupId" @changeGroup="searchDeptNodeClick" :disabled="isBindPlan" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="
|
|
|
- addForm.autoOrder &&
|
|
|
- !dialogTitle.includes('量具送检') &&
|
|
|
- addForm.type == 0
|
|
|
+ <el-col :span="8" v-if="dispatchType && addForm.type == 0 && !dialogTitle.includes('量具送检')
|
|
|
">
|
|
|
- <el-form-item label="负责人" prop="executeIdList">
|
|
|
+ <!-- <el-form-item label="负责人" prop="executeIdList">
|
|
|
<el-select v-model="addForm.executeIdList" size="small" style="width: 100%" :disabled="isBindPlan" multiple
|
|
|
filterable>
|
|
|
<el-option v-for="item in executorList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
|
|
</el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+ <el-form-item label="负责人" prop="executeIdList">
|
|
|
+ <el-select
|
|
|
+ v-model="addForm.executeIdList"
|
|
|
+ :disabled="isBindPlan"
|
|
|
+ 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 :span="8" v-if="!dialogTitle.includes('量具送检')">
|
|
|
@@ -277,6 +312,7 @@ import {
|
|
|
bomTaskDelete,
|
|
|
getByTaskId
|
|
|
} from '@/api/material/BOM';
|
|
|
+import { getteampage } from '@/api/workforceManagement/team';
|
|
|
|
|
|
import { getFile } from '@/api/system/file';
|
|
|
import { deepClone } from 'ele-admin/lib/utils/core';
|
|
|
@@ -308,7 +344,6 @@ export default {
|
|
|
brandNum: '',
|
|
|
specification: '',
|
|
|
measuringUnit: '',
|
|
|
-
|
|
|
bomList: []
|
|
|
};
|
|
|
return {
|
|
|
@@ -338,7 +373,9 @@ export default {
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
+ urgent: '1',
|
|
|
+ teamId: '', // 班组id
|
|
|
+ executeUsers: [], // 执行人
|
|
|
},
|
|
|
ruleNameList: [], // 规则列表
|
|
|
uerList: [], // 审核人列表
|
|
|
@@ -377,9 +414,15 @@ export default {
|
|
|
executeIdList: [
|
|
|
{ required: true, message: '请选择人员', trigger: 'change' }
|
|
|
],
|
|
|
+ teamId: [
|
|
|
+ { required: true, message: '请选择班组', trigger: 'change' }
|
|
|
+ ],
|
|
|
urgent: [
|
|
|
{ required: true, message: '请选择紧急程度', trigger: 'change' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ type: [
|
|
|
+ { required: true, message: '请选择', trigger: 'change' }
|
|
|
+ ],
|
|
|
},
|
|
|
|
|
|
columns: [
|
|
|
@@ -470,13 +513,18 @@ export default {
|
|
|
tabsValue: null,
|
|
|
|
|
|
hasCategoryId:false,
|
|
|
- getByIdData:{}
|
|
|
+ getByIdData:{},
|
|
|
+ modelType: '',
|
|
|
+ teamAllList: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
// 是否开启响应式布局
|
|
|
styleResponsive() {
|
|
|
return this.$store.state.theme.styleResponsive;
|
|
|
+ },
|
|
|
+ dispatchType() {
|
|
|
+ return ((this.addForm.autoOrder && (this.modelType == 'add' || this.modelType == 'edit')) || (!this.addForm.autoOrder && this.modelType == 'dispatch'))
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -498,13 +546,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.getAllTeamList();
|
|
|
this.getUserList({groupId: "1"});
|
|
|
},
|
|
|
methods: {
|
|
|
// 初始化
|
|
|
- async init(row, tips) {
|
|
|
+ async init(type, row, tips) {
|
|
|
console.log(row);
|
|
|
console.log(tips);
|
|
|
+ this.modelType = type;
|
|
|
if (row) {
|
|
|
this.getInfo(row.id);
|
|
|
} else {
|
|
|
@@ -525,7 +575,9 @@ export default {
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
+ urgent: '1',
|
|
|
+ teamId: '', // 班组id
|
|
|
+ executeUsers: [], // 执行人
|
|
|
};
|
|
|
this.ruleIdList = [];
|
|
|
this.isBindPlan = false;
|
|
|
@@ -533,9 +585,44 @@ export default {
|
|
|
// this.matterRulesList = [];
|
|
|
}
|
|
|
},
|
|
|
- typeChange() {
|
|
|
- this.addForm.groupId = '';
|
|
|
- this.addForm.executeIdList = [];
|
|
|
+ async getAllTeamList() {
|
|
|
+ const { list } = await getteampage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ console.log('teamAllList 班组', list);
|
|
|
+ this.teamAllList = list;
|
|
|
+ },
|
|
|
+ teamChange() {
|
|
|
+ console.log('this.addForm.teamId', this.addForm.teamId);
|
|
|
+ // 当前班组
|
|
|
+ const currentTeam = this.teamAllList.find(
|
|
|
+ (item) => item.id === this.addForm.teamId
|
|
|
+ );
|
|
|
+ if (currentTeam) {
|
|
|
+ // 同步执行人
|
|
|
+ this.addForm.executeUsers = [
|
|
|
+ {
|
|
|
+ teamId: currentTeam.id,
|
|
|
+ teamName: currentTeam.name
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ typeChange(v) {
|
|
|
+ console.log('typeChange', v, this.addForm.executeIdList);
|
|
|
+ // this.addForm.groupId = '';
|
|
|
+ // this.addForm.executeIdList = [];
|
|
|
+ // this.addForm.teamId = '';
|
|
|
+ // this.addForm.executeUsers = [];
|
|
|
+ this.$set(this.addForm, 'executeUsers', []);
|
|
|
+ if(v == 0) {
|
|
|
+ this.$set(this.addForm, 'groupId', '');
|
|
|
+ this.$set(this.addForm, 'executeIdList', []);
|
|
|
+ } else {
|
|
|
+ this.$set(this.addForm, 'teamId', '');
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
},
|
|
|
ruleChange(item) {
|
|
|
this.ruleObj.name = item.name;
|
|
|
@@ -675,7 +762,8 @@ export default {
|
|
|
try {
|
|
|
const res = await getInfoById(id);
|
|
|
console.log('res----------', res);
|
|
|
- this.addForm = res;
|
|
|
+ // this.addForm = res;
|
|
|
+
|
|
|
this.isBindPlan = res.isBindPlan;
|
|
|
this.categoryEquipment(res.categoryLevelId);
|
|
|
this.ruleIdList = res.planConfigVOList.map((item) => {
|
|
|
@@ -700,17 +788,52 @@ export default {
|
|
|
ruleItems: item.ruleMatters
|
|
|
};
|
|
|
});
|
|
|
+
|
|
|
+ // 处理回显数据
|
|
|
+ if (res.type === 0) {
|
|
|
+ // 个人
|
|
|
+ res.executeIdList = res.executeUsers.map(
|
|
|
+ (item) => item.userId
|
|
|
+ );
|
|
|
+
|
|
|
+ let groupIds = res.executeUsers
|
|
|
+ .map((i) => i.groupId)
|
|
|
+ .filter((i) => i);
|
|
|
+ groupIds = Array.from(new Set(groupIds));
|
|
|
+
|
|
|
+ if (groupIds.includes('1')) {
|
|
|
+ // 包含全部部门,置空
|
|
|
+ res.groupId = '1';
|
|
|
+ } else {
|
|
|
+ res.groupId = res.executeUsers?.[0]?.groupId || '1';
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.addForm.teamId = ''
|
|
|
+ // this.$set(this.addForm, 'teamId', '');
|
|
|
+
|
|
|
+ groupIds.map((item) => {
|
|
|
+ this.searchDeptNodeClick(item);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 班组
|
|
|
+ res.teamId = res.executeUsers?.[0]?.teamId || '';
|
|
|
+ // this.$set(this.addForm, 'groupId', '');
|
|
|
+ // this.$set(this.addForm, 'executeIdList', []);
|
|
|
+ // this.addForm.groupId = ''
|
|
|
+ // this.addForm.executeIdList = []
|
|
|
+ }
|
|
|
this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
if (res.groupId) {
|
|
|
const params = { groupId: res.groupId };
|
|
|
this.getUserList(params);
|
|
|
}
|
|
|
+ this.$set(this, 'addForm', res)
|
|
|
// this._getMatterRulesDetails(res.ruleId);
|
|
|
this.$set(this.addForm, 'code', res.code);
|
|
|
this.$set(this.addForm, 'urgent', JSON.stringify(res.urgent));
|
|
|
- this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
|
|
|
+ // this.$set(this.addForm, 'executeIdList', res.executeId.split(','));
|
|
|
this.$set(this.addForm, 'imageUrl', {});
|
|
|
- console.log(this.rootData);
|
|
|
+ // console.log(this.rootData);
|
|
|
const rep = await getTreeByType(0);
|
|
|
console.log('sasas', res);
|
|
|
const ids = this.findTopLevelAncestorId(
|
|
|
@@ -772,20 +895,36 @@ export default {
|
|
|
},
|
|
|
//选择部门(搜索)
|
|
|
async searchDeptNodeClick(info, data) {
|
|
|
+ console.log('searchDeptNodeClick', info, data);
|
|
|
if (info) {
|
|
|
// 根据部门获取人员
|
|
|
- this.addForm.groupName = data.name;
|
|
|
+ // this.addForm.groupName = data.name;
|
|
|
const params = { groupId: info };
|
|
|
await this.getUserList(params);
|
|
|
- if (this.addForm.type == 1) {
|
|
|
- this.addForm.executeIdList = this.executorList.map(
|
|
|
- (item) => item.id
|
|
|
- );
|
|
|
- }
|
|
|
+ // if (this.addForm.type == 1) {
|
|
|
+ // this.addForm.executeIdList = this.executorList.map(
|
|
|
+ // (item) => item.id
|
|
|
+ // );
|
|
|
+ // }
|
|
|
} else {
|
|
|
this.addForm.groupId = null;
|
|
|
}
|
|
|
},
|
|
|
+ // 负责人变更 同步执行人列表
|
|
|
+ executeIdListChange(v) {
|
|
|
+ console.log('executeIdListChange', v);
|
|
|
+ this.addForm.executeUsers = this.addForm.executeIdList.map((userId) => {
|
|
|
+ const user = this.executorList.find((u) => u.id === userId);
|
|
|
+ return {
|
|
|
+ userId: user.id,
|
|
|
+ userName: user.name,
|
|
|
+
|
|
|
+ groupId: user.groupId,
|
|
|
+ groupName: user.groupName
|
|
|
+ };
|
|
|
+ });
|
|
|
+ console.log('this.addForm.executeUsers', this.addForm.executeUsers);
|
|
|
+ },
|
|
|
// 过滤计划完成时长
|
|
|
formDataDurationTime(value) {
|
|
|
if (value > 0) {
|