|
|
@@ -64,9 +64,36 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
+ <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
+ <el-select v-model="addForm.type" 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 && addForm.type == 1 && !dialogTitle.includes('量具送检')">
|
|
|
+ <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 teamAllList"
|
|
|
+ :key="i.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
<el-col
|
|
|
:span="8"
|
|
|
- v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
|
|
|
+ v-if="!addForm.autoOrder && addForm.type == 0 && !dialogTitle.includes('量具送检')"
|
|
|
>
|
|
|
<el-form-item label="部门" prop="groupId">
|
|
|
<deptSelect
|
|
|
@@ -78,9 +105,9 @@
|
|
|
</el-col>
|
|
|
<el-col
|
|
|
:span="8"
|
|
|
- v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
|
|
|
+ v-if="!addForm.autoOrder && addForm.type == 0 && !dialogTitle.includes('量具送检')"
|
|
|
>
|
|
|
- <el-form-item label="负责人" prop="executorId">
|
|
|
+ <!-- <el-form-item label="负责人" prop="executorId">
|
|
|
<el-select
|
|
|
v-model="addForm.executorId"
|
|
|
size="small"
|
|
|
@@ -96,6 +123,24 @@
|
|
|
: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('量具送检')">
|
|
|
@@ -423,6 +468,7 @@
|
|
|
import { getById } from '@/api/maintenance/patrol_maintenance';
|
|
|
import { getFile } from '@/api/system/file';
|
|
|
import { deepClone } from 'ele-admin/lib/utils/core';
|
|
|
+ import { getteampage } from '@/api/workforceManagement/team';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -486,7 +532,10 @@
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
+ urgent: '1',
|
|
|
+ executeIdList: [], // 负责人id
|
|
|
+ teamId: '', // 班组id
|
|
|
+ type: 0,
|
|
|
},
|
|
|
ruleNameList: [], // 规则列表
|
|
|
uerList: [], // 审核人列表
|
|
|
@@ -527,6 +576,15 @@
|
|
|
],
|
|
|
urgent: [
|
|
|
{ required: true, message: '请选择紧急程度', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ executeIdList: [
|
|
|
+ { required: true, message: '请选择', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ teamId: [
|
|
|
+ { required: true, message: '请选择', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ type: [
|
|
|
+ { required: true, message: '请选择', trigger: 'change' }
|
|
|
]
|
|
|
},
|
|
|
|
|
|
@@ -618,7 +676,8 @@
|
|
|
tabsValue: null,
|
|
|
|
|
|
hasCategoryId: false,
|
|
|
- getByIdData: {}
|
|
|
+ getByIdData: {},
|
|
|
+ teamAllList: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -635,10 +694,19 @@
|
|
|
// 获取规则名称
|
|
|
this._getRuleNameList();
|
|
|
}
|
|
|
+ },
|
|
|
+ info: {
|
|
|
+ handler(newVal) {
|
|
|
+ if (newVal) {
|
|
|
+ this.init({ id: this.planId });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
console.log('触发');
|
|
|
+ this.getAllTeamList();
|
|
|
this.init({ id: this.planId });
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -700,6 +768,58 @@
|
|
|
// };
|
|
|
// this.addForm.planType = planRuleTypeObj[this.formLabel];
|
|
|
},
|
|
|
+ // 负责人变更 同步执行人列表
|
|
|
+ executeIdListChange() {
|
|
|
+ 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);
|
|
|
+ },
|
|
|
+ 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();
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
autoOrderChange(val) {
|
|
|
if (val == 0) {
|
|
|
this.addForm.executorId = [];
|
|
|
@@ -745,6 +865,7 @@
|
|
|
let sendMsg = this.ruleIdList.map((item, index) => {
|
|
|
return {
|
|
|
...this.addForm,
|
|
|
+ autoOrder: this.dialogTitle === '派单' ? 1 : this.addForm.autoOrder,
|
|
|
ruleId: item.ruleId,
|
|
|
categoryId: item.categoryId,
|
|
|
planDeviceList: planDeviceList[index],
|
|
|
@@ -828,12 +949,13 @@
|
|
|
const res = await getById(id);
|
|
|
|
|
|
console.log('res----------', res.data);
|
|
|
- this.addForm = res.data;
|
|
|
-
|
|
|
- this.addForm.id = res.data.planId;
|
|
|
- if (this.dialogTitle === '派单') {
|
|
|
- this.addForm.autoOrder = 1;
|
|
|
- }
|
|
|
+
|
|
|
+ const data = res.data
|
|
|
+ // this.addForm = res.data;
|
|
|
+ // this.addForm.id = res.data.planId;
|
|
|
+ // if (this.dialogTitle === '派单') {
|
|
|
+ // this.addForm.autoOrder = 1;
|
|
|
+ // }
|
|
|
this.isBindPlan = res.isBindPlan;
|
|
|
// this.categoryEquipment(res.categoryLevelId);
|
|
|
this.ruleIdList = [
|
|
|
@@ -860,8 +982,36 @@
|
|
|
}
|
|
|
];
|
|
|
console.log(this.ruleIdList);
|
|
|
- this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
|
|
|
+ // 处理回显数据
|
|
|
+ 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';
|
|
|
+ }
|
|
|
+
|
|
|
+ groupIds.map((item) => {
|
|
|
+ this.searchDeptNodeClick(item);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 班组
|
|
|
+ res.teamId = res.executeUsers?.[0]?.teamId || '';
|
|
|
+ }
|
|
|
+ this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
+ this.$set(this, 'addForm', data);
|
|
|
+ this.$set(this.addForm, 'id', data.planId);
|
|
|
// this._getMatterRulesDetails(res.ruleId);
|
|
|
this.$set(this.addForm, 'code', res.data.code);
|
|
|
this.$set(this.addForm, 'urgent', JSON.stringify(res.data.urgent));
|