|
|
@@ -37,17 +37,63 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="8" v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')">
|
|
|
+ <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
|
|
|
+ <el-form-item label="类型" prop="executeUserType">
|
|
|
+ <el-select v-model="addForm.executeUserType" :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="dispatchStatus && addForm.executeUserType == 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="dispatchStatus && addForm.executeUserType == 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('量具送检')">
|
|
|
- <el-form-item label="负责人" prop="executorId">
|
|
|
+ <el-col :span="8" v-if="dispatchStatus && addForm.executeUserType == 0 && !dialogTitle.includes('量具送检')">
|
|
|
+ <!-- <el-form-item label="负责人" prop="executorId">
|
|
|
<el-select v-model="addForm.executorId" 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('量具送检')">
|
|
|
@@ -260,7 +306,7 @@ import {
|
|
|
getAssetList,
|
|
|
getInfoById
|
|
|
} from '@/api/ruleManagement/plan';
|
|
|
-import { saveOrUpdate } from '@/api/maintenance/patrol_maintenance';
|
|
|
+import { saveOrUpdate, getteampage } from '@/api/maintenance/patrol_maintenance';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
import { getTreeByType } from '@/api/classifyManage';
|
|
|
import MaterialAdd from './MaterialAdd.vue';
|
|
|
@@ -298,7 +344,7 @@ export default {
|
|
|
brandNum: '',
|
|
|
specification: '',
|
|
|
measuringUnit: '',
|
|
|
-
|
|
|
+ type: 0,
|
|
|
bomList: []
|
|
|
};
|
|
|
return {
|
|
|
@@ -329,7 +375,21 @@ export default {
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
+ urgent: '1',
|
|
|
+ executeIdList: [],
|
|
|
+ executeUsers: [
|
|
|
+ // {
|
|
|
+ // groupId: 0,
|
|
|
+ // groupName: '',
|
|
|
+ // teamId: 0,
|
|
|
+ // teamName: '',
|
|
|
+ // userId: 0,
|
|
|
+ // userName: ''
|
|
|
+ // }
|
|
|
+ ],
|
|
|
+ teamId: '',
|
|
|
+ type: 0,
|
|
|
+ executeUserType: 0,
|
|
|
},
|
|
|
ruleNameList: [], // 规则列表
|
|
|
uerList: [], // 审核人列表
|
|
|
@@ -368,9 +428,15 @@ export default {
|
|
|
executorId: [
|
|
|
{ required: true, message: '请选择巡点检人员', trigger: 'change' }
|
|
|
],
|
|
|
+ executeIdList: [
|
|
|
+ { required: true, message: '请选择人员', trigger: 'change' }
|
|
|
+ ],
|
|
|
urgent: [
|
|
|
{ required: true, message: '请选择紧急程度', trigger: 'change' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ teamId: [
|
|
|
+ { required: true, message: '请选择班组', trigger: 'change' }
|
|
|
+ ],
|
|
|
},
|
|
|
|
|
|
columns: [
|
|
|
@@ -461,13 +527,18 @@ export default {
|
|
|
tabsValue: null,
|
|
|
|
|
|
hasCategoryId: false,
|
|
|
- getByIdData: {}
|
|
|
+ getByIdData: {},
|
|
|
+ teamAllList: [],
|
|
|
+ model: ''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
// 是否开启响应式布局
|
|
|
styleResponsive() {
|
|
|
return this.$store.state.theme.styleResponsive;
|
|
|
+ },
|
|
|
+ dispatchStatus() {
|
|
|
+ return ((this.addForm.autoOrder && (this.model == 'add' || this.model == 'edit')) || (((!this.addForm.autoOrder && this.addForm.planStatus == 0) || (this.addForm.autoOrder &&this.addForm.planStatus == 4)) && this.model == 'dispatch'))
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -477,6 +548,8 @@ export default {
|
|
|
this.getUserList();
|
|
|
// 获取规则名称
|
|
|
this._getRuleNameList();
|
|
|
+ // 获取所有班组
|
|
|
+ this.getAllTeamList();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -485,9 +558,11 @@ export default {
|
|
|
this.visible = false;
|
|
|
},
|
|
|
// 初始化
|
|
|
- async init(row, tips) {
|
|
|
+ async init(type, row, tips) {
|
|
|
console.log(row);
|
|
|
console.log(tips);
|
|
|
+ console.log(type);
|
|
|
+ this.model = type;
|
|
|
this.visible = true;
|
|
|
if (row) {
|
|
|
this.getInfo(row.id, tips);
|
|
|
@@ -508,7 +583,21 @@ export default {
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
+ urgent: '1',
|
|
|
+ type: 0,
|
|
|
+ teamId: '',
|
|
|
+ executeIdList: [], // 负责人id
|
|
|
+ executeUserType: 0, // 执行人类型 0:部门 1:班组 0:个人
|
|
|
+ executeUsers: [
|
|
|
+ // {
|
|
|
+ // groupId: 0,
|
|
|
+ // groupName: '',
|
|
|
+ // teamId: 0,
|
|
|
+ // teamName: '',
|
|
|
+ // userId: 0,
|
|
|
+ // userName: ''
|
|
|
+ // }
|
|
|
+ ],
|
|
|
};
|
|
|
this.ruleIdList = [];
|
|
|
this.isBindPlan = false;
|
|
|
@@ -542,10 +631,50 @@ export default {
|
|
|
// };
|
|
|
// 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);
|
|
|
+ },
|
|
|
+ async getAllTeamList() {
|
|
|
+ const { list } = await getteampage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ console.log('teamAllList 班组', list);
|
|
|
+ this.teamAllList = list;
|
|
|
+ },
|
|
|
+ teamChange(v) {
|
|
|
+ console.log('teamChange', v);
|
|
|
+ this.$set(this.addForm, 'teamId', v);
|
|
|
+ // 当前班组
|
|
|
+ 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 = [];
|
|
|
this.addForm.groupId = '';
|
|
|
+ this.addForm.executeIdList = '';
|
|
|
}
|
|
|
},
|
|
|
ruleChange(item) {
|
|
|
@@ -557,7 +686,7 @@ export default {
|
|
|
console.log(this.ruleIdList);
|
|
|
if (this.ruleIdList && this.ruleIdList.length > 0) {
|
|
|
this.$refs.addFormRef.validate(async (valid) => {
|
|
|
- console.log(valid);
|
|
|
+ // console.log(valid);
|
|
|
if (valid) {
|
|
|
const planDeviceList = this.ruleIdList.map((ruleItem) => {
|
|
|
return ruleItem.equipmentList.map((item) => {
|
|
|
@@ -586,6 +715,7 @@ export default {
|
|
|
let sendMsg = this.ruleIdList.map((item, index) => {
|
|
|
return {
|
|
|
...this.addForm,
|
|
|
+ autoOrder: this.model == 'dispatch' ? 1 : this.addForm.autoOrder,
|
|
|
ruleId: item.ruleId,
|
|
|
categoryId: item.categoryId,
|
|
|
planDeviceList: planDeviceList[index],
|
|
|
@@ -697,6 +827,34 @@ export default {
|
|
|
}
|
|
|
];
|
|
|
console.log(this.ruleIdList);
|
|
|
+
|
|
|
+ // 处理回显数据
|
|
|
+ if (this.addForm.executeUserType === 0) {
|
|
|
+ // 个人
|
|
|
+ this.addForm.executeIdList = this.addForm.executeUsers.map(
|
|
|
+ (item) => item.userId
|
|
|
+ );
|
|
|
+
|
|
|
+ let groupIds = this.addForm.executeUsers
|
|
|
+ .map((i) => i.groupId)
|
|
|
+ .filter((i) => i);
|
|
|
+ groupIds = Array.from(new Set(groupIds));
|
|
|
+
|
|
|
+ if (groupIds.includes('1')) {
|
|
|
+ // 包含全部部门,置空
|
|
|
+ this.addForm.groupId = '1';
|
|
|
+ } else {
|
|
|
+ this.addForm.groupId = this.addForm.executeUsers[0]?.groupId || '1';
|
|
|
+ }
|
|
|
+
|
|
|
+ groupIds.map((item) => {
|
|
|
+ this.searchDeptNodeClick(item);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 班组
|
|
|
+ this.addForm.teamId = this.addForm.executeUsers?.[0]?.teamId || '';
|
|
|
+ }
|
|
|
+
|
|
|
this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
|
|
|
// this._getMatterRulesDetails(res.ruleId);
|
|
|
@@ -704,11 +862,12 @@ export default {
|
|
|
this.$set(this.addForm, 'urgent', JSON.stringify(res.data.urgent));
|
|
|
this.$set(this.addForm, 'executorId', res.data.executorId.split(',').filter((i) => i));
|
|
|
this.$set(this.addForm, 'imageUrl', {});
|
|
|
- console.log(this.rootData);
|
|
|
+ // console.log(this.rootData);
|
|
|
if(res.data.groupId){
|
|
|
- this.getUserList({ groupId: res.data.groupId });
|
|
|
+ this.getUserList({ groupId: res.data.groupId });
|
|
|
|
|
|
}
|
|
|
+ console.log('addForm~~~~', this.addForm);
|
|
|
// const rep = await getTreeByType(0);
|
|
|
// console.log('sasas', res);
|
|
|
// const ids = this.findTopLevelAncestorId(
|
|
|
@@ -729,6 +888,12 @@ export default {
|
|
|
console.log(error);
|
|
|
}
|
|
|
},
|
|
|
+ typeChange() {
|
|
|
+ this.addForm.groupId = '';
|
|
|
+ this.addForm.executeIdList = [];
|
|
|
+ this.addForm.teamId = '';
|
|
|
+ this.addForm.executorId = [];
|
|
|
+ },
|
|
|
// 获取设备分类数据
|
|
|
async categoryEquipment(id) {
|
|
|
const params = { categoryLevelId: id, pageNum: 1, size: -1 };
|