|
|
@@ -340,29 +340,42 @@
|
|
|
<script>
|
|
|
import RuleItemSelection from '@/components/ruleItemSelection';
|
|
|
import AddSpareDialog from '@/components/addSpareDialog';
|
|
|
- import {deepClone} from "@/utils";
|
|
|
- import { getRule , getCategory , getAssetList , saveOrUpdate , getInfoById } from '@/api/ruleManagement/plan';
|
|
|
- import { getDetail , getCode } from '@/api/ruleManagement/matter';
|
|
|
- import { getUserPage } from '@/api/system/organization';
|
|
|
- import { getTreeByType } from '@/api/classifyManage';
|
|
|
- import equipmentSelect from '@/components/CommomSelect/equipment-select.vue';
|
|
|
- import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
- export default {
|
|
|
- name: 'addPatrolConfigDialog',
|
|
|
- components: {
|
|
|
- RuleItemSelection,
|
|
|
- AddSpareDialog,
|
|
|
- equipmentSelect,
|
|
|
- deptSelect
|
|
|
+ import { deepClone } from '@/utils';
|
|
|
+ import {
|
|
|
+ getRule,
|
|
|
+ getCategory,
|
|
|
+ getAssetList,
|
|
|
+ saveOrUpdate,
|
|
|
+ getInfoById
|
|
|
+ } from '@/api/ruleManagement/plan';
|
|
|
+ import { getDetail, getCode } from '@/api/ruleManagement/matter';
|
|
|
+ import { getUserPage } from '@/api/system/organization';
|
|
|
+ import { getTreeByType } from '@/api/classifyManage';
|
|
|
+ import equipmentSelect from '@/components/CommomSelect/equipment-select.vue';
|
|
|
+ import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
+ export default {
|
|
|
+ name: 'addPatrolConfigDialog',
|
|
|
+ components: {
|
|
|
+ RuleItemSelection,
|
|
|
+ AddSpareDialog,
|
|
|
+ equipmentSelect,
|
|
|
+ deptSelect
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ dialogTitle: {
|
|
|
+ type: String,
|
|
|
+ default: () => {
|
|
|
+ return '新增巡点检计划配置';
|
|
|
+ }
|
|
|
},
|
|
|
isBindPlan: {
|
|
|
type: Boolean,
|
|
|
default: function () {
|
|
|
- return false
|
|
|
+ return false;
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
defaultProps: {
|
|
|
label: 'showName'
|
|
|
@@ -378,9 +391,9 @@
|
|
|
executorList: [],
|
|
|
currentEquItemIndex: 0,
|
|
|
formLabel: '',
|
|
|
- treeData:[],
|
|
|
+ treeData: [],
|
|
|
addForm: {
|
|
|
- code:'', // 计划配置单号
|
|
|
+ code: '', // 计划配置单号
|
|
|
name: '', // 计划配置名称
|
|
|
autoOrder: 1, // 自动派单
|
|
|
ruleId: '', // 规则id
|
|
|
@@ -393,20 +406,20 @@
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent:''
|
|
|
+ urgent: ''
|
|
|
},
|
|
|
- // 计划规则设备列表
|
|
|
- planRuleEquiList: [
|
|
|
- {
|
|
|
- equiCode: '', // 设备编码 equCode
|
|
|
- equiName: '', // 设备名称 name
|
|
|
- equiModel: '', // 设备型号 specifications
|
|
|
- equiLocation: '', // 设备位置
|
|
|
- // 设备备品备件 - 巡点检不需要备品备件,保养需要
|
|
|
- sparePart: [ ],
|
|
|
- totalCost:0,
|
|
|
- }
|
|
|
- ],
|
|
|
+ // 计划规则设备列表
|
|
|
+ planRuleEquiList: [
|
|
|
+ {
|
|
|
+ equiCode: '', // 设备编码 equCode
|
|
|
+ equiName: '', // 设备名称 name
|
|
|
+ equiModel: '', // 设备型号 specifications
|
|
|
+ equiLocation: '', // 设备位置
|
|
|
+ // 设备备品备件 - 巡点检不需要备品备件,保养需要
|
|
|
+ sparePart: [],
|
|
|
+ totalCost: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
addFormRules: {
|
|
|
name: [
|
|
|
{ required: true, message: '请输入计划配置名称', trigger: 'blur' }
|
|
|
@@ -420,9 +433,9 @@
|
|
|
duration: [
|
|
|
{ required: true, message: '请输入计划完成时长', trigger: 'blur' }
|
|
|
],
|
|
|
- categoryLevelId:[
|
|
|
- { required: true, message: '请选择设备分类', trigger: 'change' }
|
|
|
- ],
|
|
|
+ categoryLevelId: [
|
|
|
+ { required: true, message: '请选择设备分类', trigger: 'change' }
|
|
|
+ ],
|
|
|
categoryId: [
|
|
|
{ required: true, message: '请选择设备类别', trigger: 'change' }
|
|
|
],
|
|
|
@@ -432,82 +445,80 @@
|
|
|
executeIdList: [
|
|
|
{ required: true, message: '请选择巡点检人员', trigger: 'change' }
|
|
|
],
|
|
|
- urgent: [
|
|
|
+ urgent: [
|
|
|
{ required: true, message: '请选择紧急程度', trigger: 'change' }
|
|
|
- ],
|
|
|
+ ]
|
|
|
},
|
|
|
- ruleNameList:[],
|
|
|
- addDialogLoading:false,
|
|
|
- equipmentList:[],
|
|
|
- rootId:null,
|
|
|
- }
|
|
|
+ ruleNameList: [],
|
|
|
+ addDialogLoading: false,
|
|
|
+ equipmentList: [],
|
|
|
+ rootId: null
|
|
|
+ };
|
|
|
},
|
|
|
- ,
|
|
|
+ computed: {},
|
|
|
watch: {
|
|
|
- addPatrolConfigDialog (val) {
|
|
|
+ addPatrolConfigDialog(val) {
|
|
|
if (val) {
|
|
|
this.formLabel = this.dialogTitle.includes('巡点检')
|
|
|
? '巡点检'
|
|
|
: this.dialogTitle.includes('保养')
|
|
|
? '保养'
|
|
|
- : '盘点'
|
|
|
+ : '盘点';
|
|
|
// 获取审核人列表数据
|
|
|
- this.getUserList()
|
|
|
+ this.getUserList();
|
|
|
// 获取部门
|
|
|
// this.getDeptList()
|
|
|
// 获取规则名称
|
|
|
- this._getRuleNameList()
|
|
|
+ this._getRuleNameList();
|
|
|
}
|
|
|
- },
|
|
|
- },
|
|
|
- created(){
|
|
|
+ }
|
|
|
},
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
- async init(row,tips){
|
|
|
- if(row){
|
|
|
- this.getInfo(row.id)
|
|
|
- }else{
|
|
|
- // 获取计划配置单号
|
|
|
- this.getOrderCode(tips)
|
|
|
- this.planRuleEquiList = []
|
|
|
- this.matterRulesList = []
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- async getInfo(id){
|
|
|
- const res = await getInfoById(id)
|
|
|
- this.addForm = res
|
|
|
- this.categoryEquipment(res.categoryLevelId)
|
|
|
- const params = { groupId: res.groupId }
|
|
|
- this.getUserList(params)
|
|
|
- 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,'imageUrl',{})
|
|
|
- this._getEquipmentList(res.categoryId)
|
|
|
- let keys = []
|
|
|
- res.deviceInfo.map(item=>{
|
|
|
- keys.push(item.substanceId)
|
|
|
- })
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.equiListTree.setCheckedKeys(keys)
|
|
|
- })
|
|
|
- this.clickedTreeNode = true
|
|
|
- },
|
|
|
+ async init(row, tips) {
|
|
|
+ if (row) {
|
|
|
+ this.getInfo(row.id);
|
|
|
+ } else {
|
|
|
+ // 获取计划配置单号
|
|
|
+ this.getOrderCode(tips);
|
|
|
+ this.planRuleEquiList = [];
|
|
|
+ this.matterRulesList = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
+ async getInfo(id) {
|
|
|
+ const res = await getInfoById(id);
|
|
|
+ this.addForm = res;
|
|
|
+ this.categoryEquipment(res.categoryLevelId);
|
|
|
+ const params = { groupId: res.groupId };
|
|
|
+ this.getUserList(params);
|
|
|
+ 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, 'imageUrl', {});
|
|
|
+ this._getEquipmentList(res.categoryId);
|
|
|
+ let keys = [];
|
|
|
+ res.deviceInfo.map((item) => {
|
|
|
+ keys.push(item.substanceId);
|
|
|
+ });
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.equiListTree.setCheckedKeys(keys);
|
|
|
+ });
|
|
|
+ this.clickedTreeNode = true;
|
|
|
+ },
|
|
|
|
|
|
- handleClose () {
|
|
|
- this.clickedTreeNode = false
|
|
|
- this.addPatrolConfigDialog = false
|
|
|
- this.$refs.addFormRef.resetFields()
|
|
|
+ handleClose() {
|
|
|
+ this.clickedTreeNode = false;
|
|
|
+ this.addPatrolConfigDialog = false;
|
|
|
+ this.$refs.addFormRef.resetFields();
|
|
|
if (this.$refs.equiListTree) {
|
|
|
this.$refs.equiListTree.setCheckedKeys([]);
|
|
|
}
|
|
|
- this.currentEquItemIndex = 0
|
|
|
- this.equipmentInfo = {}
|
|
|
+ this.currentEquItemIndex = 0;
|
|
|
+ this.equipmentInfo = {};
|
|
|
this.addForm = {
|
|
|
- code:'', // 计划配置单号
|
|
|
+ code: '', // 计划配置单号
|
|
|
name: '', // 计划配置名称
|
|
|
autoOrder: 1, // 自动派单
|
|
|
ruleId: '', // 规则id
|
|
|
@@ -519,473 +530,304 @@
|
|
|
executorPhone: '',
|
|
|
status: 1, // 状态
|
|
|
remark: '', // 备注
|
|
|
- urgent:''
|
|
|
- }
|
|
|
- this.equipmentList = []
|
|
|
+ urgent: ''
|
|
|
+ };
|
|
|
+ this.equipmentList = [];
|
|
|
},
|
|
|
// 设备分类选择
|
|
|
- async handleEquipmentClassChange (item) {
|
|
|
- this.clickedTreeNode = true
|
|
|
- this.equipmentInfo = {}
|
|
|
- this._getEquipmentList(item.id)
|
|
|
+ async handleEquipmentClassChange(item) {
|
|
|
+ this.clickedTreeNode = true;
|
|
|
+ this.equipmentInfo = {};
|
|
|
+ this._getEquipmentList(item.id);
|
|
|
},
|
|
|
// 封装 - 获取设备分类列表
|
|
|
- async _getEquipmentList (val) {
|
|
|
- const params = { pageNum: 1,size: -1, categoryId: val, rootCategoryLevelId: this.rootId }
|
|
|
+ async _getEquipmentList(val) {
|
|
|
+ const params = {
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1,
|
|
|
+ categoryId: val,
|
|
|
+ rootCategoryLevelId: this.rootId
|
|
|
+ };
|
|
|
try {
|
|
|
- const res = await getAssetList(params)
|
|
|
- this.planRuleEquiList = res.list
|
|
|
- this.planRuleEquiList.map(item=>{
|
|
|
- item.showName = item.name+'('+item.code+')'
|
|
|
- })
|
|
|
- this.currentEquItemIndex = 0
|
|
|
- const item = this.planRuleEquiList[0]
|
|
|
- const equiLocation = this.getEquiLocation(item)
|
|
|
+ const res = await getAssetList(params);
|
|
|
+ this.planRuleEquiList = res.list;
|
|
|
+ this.planRuleEquiList.map((item) => {
|
|
|
+ item.showName = item.name + '(' + item.code + ')';
|
|
|
+ });
|
|
|
+ this.currentEquItemIndex = 0;
|
|
|
+ const item = this.planRuleEquiList[0];
|
|
|
+ const equiLocation = this.getEquiLocation(item);
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.equiListTree.setCurrentKey(item.id)
|
|
|
+ this.$refs.equiListTree.setCurrentKey(item.id);
|
|
|
this.equipmentInfo = {
|
|
|
equiCode: item.code,
|
|
|
equiName: item.name,
|
|
|
equiModel: item.category.modelType,
|
|
|
equiLocation: equiLocation
|
|
|
- }
|
|
|
- this.planRuleEquiList[0]['equiLocation'] = equiLocation
|
|
|
+ };
|
|
|
+ this.planRuleEquiList[0]['equiLocation'] = equiLocation;
|
|
|
|
|
|
- // 对比详情返回的数据和设备分类下面所有的设备列表,将sparePart同步过去
|
|
|
- if(this.addForm.deviceInfo){
|
|
|
- for (let i = 0; i < this.planRuleEquiList.length; i++) {
|
|
|
- for (let j = 0; j < this.addForm.deviceInfo.length; j++) {
|
|
|
- if ( this.planRuleEquiList[i].code === this.addForm.deviceInfo[j].substance.code ) {
|
|
|
- this.$set(this.planRuleEquiList[i],'sparePart',this.addForm.deviceInfo[j].sparePart)
|
|
|
- this.$set(this.planRuleEquiList[i],'totalCost',this.addForm.deviceInfo[j].totalCost)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ // 对比详情返回的数据和设备分类下面所有的设备列表,将sparePart同步过去
|
|
|
+ if (this.addForm.deviceInfo) {
|
|
|
+ for (let i = 0; i < this.planRuleEquiList.length; i++) {
|
|
|
+ for (let j = 0; j < this.addForm.deviceInfo.length; j++) {
|
|
|
+ if (
|
|
|
+ this.planRuleEquiList[i].code ===
|
|
|
+ this.addForm.deviceInfo[j].substance.code
|
|
|
+ ) {
|
|
|
+ this.$set(
|
|
|
+ this.planRuleEquiList[i],
|
|
|
+ 'sparePart',
|
|
|
+ this.addForm.deviceInfo[j].sparePart
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.planRuleEquiList[i],
|
|
|
+ 'totalCost',
|
|
|
+ this.addForm.deviceInfo[j].totalCost
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
} catch (error) {
|
|
|
- this.planRuleEquiList = []
|
|
|
+ this.planRuleEquiList = [];
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 获取审核人列表、巡点检人员
|
|
|
- async getUserList (params) {
|
|
|
+ async getUserList(params) {
|
|
|
try {
|
|
|
- let data = { pageNum: 1 ,size:-1 }
|
|
|
+ let data = { pageNum: 1, size: -1 };
|
|
|
// 如果传了参数就是获取巡点检人员数据
|
|
|
if (params) {
|
|
|
- data = Object.assign(data, params)
|
|
|
- }
|
|
|
- },
|
|
|
- isBindPlan: {
|
|
|
- type: Boolean,
|
|
|
- default: function () {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- defaultProps: {
|
|
|
- label: 'showName'
|
|
|
- },
|
|
|
- addPatrolConfigDialog: false,
|
|
|
- matterRulesList: [], // 选择规则名称的时候,获取的事项
|
|
|
- equipmentInfo: {},
|
|
|
- clickedTreeNode: false,
|
|
|
- selectedMatter: [],
|
|
|
- selectedSpare: [],
|
|
|
- uerList: [],
|
|
|
- deptList: [],
|
|
|
- executorList: [],
|
|
|
- currentEquItemIndex: 0,
|
|
|
- formLabel: '',
|
|
|
- treeData: [],
|
|
|
- addForm: {
|
|
|
- code: '', // 计划配置单号
|
|
|
- name: '', // 计划配置名称
|
|
|
- autoOrder: 1, // 自动派单
|
|
|
- ruleId: '', // 规则id
|
|
|
- ruleName: '', // 规则名称
|
|
|
- duration: null, // 计划完成时长
|
|
|
- categoryId: '', // 设备类别id
|
|
|
- approvalUserId: '', // 审核人id
|
|
|
- groupId: '', // 巡点检部门code
|
|
|
- executeIdList: [], // 巡点检人员id
|
|
|
- executorPhone: '',
|
|
|
- status: 1, // 状态
|
|
|
- remark: '', // 备注
|
|
|
- urgent: '',
|
|
|
- bizType: 0
|
|
|
- },
|
|
|
- // 计划规则设备列表
|
|
|
- planRuleEquiList: [
|
|
|
- {
|
|
|
- equiTypeId: '', // 设备分类Id
|
|
|
- equiTypeName: '', // 设备分类名字
|
|
|
- equiCode: '', // 设备编码 equCode
|
|
|
- equiName: '', // 设备名称 name
|
|
|
- equiModel: '', // 设备型号 specifications
|
|
|
- equiLocation: '', // 设备位置
|
|
|
- equiLocationCode: '', // 设备位置code
|
|
|
- // 设备备品备件 - 巡点检不需要备品备件,保养需要
|
|
|
- sparePart: [],
|
|
|
- totalCost: 0
|
|
|
- }
|
|
|
- ],
|
|
|
- addFormRules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入计划配置名称', trigger: 'blur' }
|
|
|
- ],
|
|
|
- autoOrder: [
|
|
|
- { required: true, message: '请选择是否自动派单', trigger: 'change' }
|
|
|
- ],
|
|
|
- ruleId: [
|
|
|
- { required: true, message: '请选择规则名称', trigger: 'change' }
|
|
|
- ],
|
|
|
- duration: [
|
|
|
- { required: true, message: '请输入计划完成时长', trigger: 'blur' }
|
|
|
- ],
|
|
|
- categoryLevelId: [
|
|
|
- { required: true, message: '请选择设备分类', trigger: 'change' }
|
|
|
- ],
|
|
|
- categoryId: [
|
|
|
- { required: true, message: '请选择设备类别', trigger: 'change' }
|
|
|
- ],
|
|
|
- groupId: [
|
|
|
- { required: true, message: '请选择巡点检部门', trigger: 'change' }
|
|
|
- ],
|
|
|
- executeIdList: [
|
|
|
- { required: true, message: '请选择巡点检人员', trigger: 'change' }
|
|
|
- ],
|
|
|
- urgent: [
|
|
|
- { required: true, message: '请选择紧急程度', trigger: 'change' }
|
|
|
- ]
|
|
|
- },
|
|
|
- ruleNameList: [],
|
|
|
- addDialogLoading: false,
|
|
|
- equipmentList: [],
|
|
|
- // deptData:[], //部门树
|
|
|
- // classifyTree:[], //设备分类树
|
|
|
- rootId: null
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {},
|
|
|
- watch: {
|
|
|
- addPatrolConfigDialog (val) {
|
|
|
- if (val) {
|
|
|
- this.formLabel = this.dialogTitle.includes('巡点检')
|
|
|
- ? '巡点检'
|
|
|
- : this.dialogTitle.includes('保养')
|
|
|
- ? '保养'
|
|
|
- : '盘点';
|
|
|
- // 获取审核人列表数据
|
|
|
- this.getUserList();
|
|
|
- // 获取部门
|
|
|
- // this.getDeptList()
|
|
|
- // 获取规则名称
|
|
|
- this._getRuleNameList();
|
|
|
+ data = Object.assign(data, params);
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- created () {},
|
|
|
- methods: {
|
|
|
- async init (row, tips) {
|
|
|
- if (row) {
|
|
|
- this.getInfo(row.id);
|
|
|
+ const res = await getUserPage(data);
|
|
|
+ if (params) {
|
|
|
+ this.executorList = res.list;
|
|
|
} else {
|
|
|
- // 获取计划配置单号
|
|
|
- this.getOrderCode(tips);
|
|
|
- this.planRuleEquiList = [];
|
|
|
- this.matterRulesList = [];
|
|
|
+ this.uerList = res.list;
|
|
|
}
|
|
|
- },
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
|
|
|
//选择部门(搜索)
|
|
|
- searchDeptNodeClick (info) {
|
|
|
+ searchDeptNodeClick(info) {
|
|
|
if (info) {
|
|
|
// 根据部门获取人员
|
|
|
- const params = { groupId: info }
|
|
|
- this.getUserList(params)
|
|
|
+ const params = { groupId: info };
|
|
|
+ this.getUserList(params);
|
|
|
} else {
|
|
|
- this.addForm.groupId = null
|
|
|
+ this.addForm.groupId = null;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ // 分类树的选择
|
|
|
+ chooseClassify(val) {
|
|
|
+ this.categoryEquipment(val);
|
|
|
+ },
|
|
|
|
|
|
- // 分类树的选择
|
|
|
- chooseClassify(val){
|
|
|
- this.categoryEquipment(val)
|
|
|
- },
|
|
|
-
|
|
|
- getRootId(val){
|
|
|
- this.rootId = val
|
|
|
- },
|
|
|
+ getRootId(val) {
|
|
|
+ this.rootId = val;
|
|
|
+ },
|
|
|
|
|
|
- // 获取设备分类数据
|
|
|
- async categoryEquipment(id){
|
|
|
- const params = {categoryLevelId:id,pageNum:1,size:-1}
|
|
|
- const data = await getCategory(params)
|
|
|
- this.equipmentList = data.list
|
|
|
- },
|
|
|
+ // 获取设备分类数据
|
|
|
+ async categoryEquipment(id) {
|
|
|
+ const params = { categoryLevelId: id, pageNum: 1, size: -1 };
|
|
|
+ const data = await getCategory(params);
|
|
|
+ this.equipmentList = data.list;
|
|
|
+ },
|
|
|
|
|
|
- // 获取计划配置单号
|
|
|
- async getOrderCode (tips) {
|
|
|
- if(tips.includes('巡点检')){
|
|
|
- const data = await getCode('patrolconfig_code');
|
|
|
- this.$set(this.addForm, 'code', data);
|
|
|
- }
|
|
|
- if(tips.includes('保养')){
|
|
|
- const code = await getCode('maintainconfig_code');
|
|
|
- this.$set(this.addForm, 'code', code);
|
|
|
- }
|
|
|
- },
|
|
|
+ // 获取计划配置单号
|
|
|
+ async getOrderCode(tips) {
|
|
|
+ if (tips.includes('巡点检')) {
|
|
|
+ const data = await getCode('patrolconfig_code');
|
|
|
+ this.$set(this.addForm, 'code', data);
|
|
|
+ }
|
|
|
+ if (tips.includes('保养')) {
|
|
|
+ const code = await getCode('maintainconfig_code');
|
|
|
+ this.$set(this.addForm, 'code', code);
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
// 封装 - 获取设备位置名称和code方法
|
|
|
getEquiLocation(data) {
|
|
|
// 设备位置名称
|
|
|
- const path = data.position[0].path
|
|
|
- const arry = []
|
|
|
- path.map(item=>{
|
|
|
- arry.push(item.name)
|
|
|
- })
|
|
|
- const equiLocation = arry.join('/')
|
|
|
- return equiLocation
|
|
|
+ const path = data.position[0].path;
|
|
|
+ const arry = [];
|
|
|
+ path.map((item) => {
|
|
|
+ arry.push(item.name);
|
|
|
+ });
|
|
|
+ const equiLocation = arry.join('/');
|
|
|
+ return equiLocation;
|
|
|
},
|
|
|
// 设备列表树点击
|
|
|
- handleNodeClick (data, node) {
|
|
|
- const equiLocation = this.getEquiLocation(data)
|
|
|
+ handleNodeClick(data, node) {
|
|
|
+ const equiLocation = this.getEquiLocation(data);
|
|
|
this.equipmentInfo = {
|
|
|
equiCode: data.code,
|
|
|
equiName: data.name,
|
|
|
equiId: data.id,
|
|
|
equiModel: data.category.modelType,
|
|
|
equiLocation: equiLocation
|
|
|
- }
|
|
|
+ };
|
|
|
// 保存当前点击的设备列表某节点的index,在添加操作事项的时候,可以将事项list放到对应的节点对象中,以及切换节点的时候回显事项list
|
|
|
this.currentEquItemIndex = this.planRuleEquiList.findIndex(
|
|
|
- item => item.code === data.code
|
|
|
- )
|
|
|
- this.clickedTreeNode = true
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['equiLocation'] = equiLocation
|
|
|
+ (item) => item.code === data.code
|
|
|
+ );
|
|
|
+ this.clickedTreeNode = true;
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex]['equiLocation'] =
|
|
|
+ equiLocation;
|
|
|
},
|
|
|
// 获取规则名列表
|
|
|
- async _getRuleNameList () {
|
|
|
- if(this.dialogTitle==='新增保养计划配置'||this.dialogTitle==='编辑保养计划配置'){
|
|
|
- const res = await getRule({status:1,type:2,pageNum:1,size:-1})
|
|
|
- if (res.list) {
|
|
|
- this.ruleNameList = res.list || []
|
|
|
- }
|
|
|
+ async _getRuleNameList() {
|
|
|
+ if (
|
|
|
+ this.dialogTitle === '新增保养计划配置' ||
|
|
|
+ this.dialogTitle === '编辑保养计划配置'
|
|
|
+ ) {
|
|
|
+ const res = await getRule({
|
|
|
+ status: 1,
|
|
|
+ type: 2,
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ if (res.list) {
|
|
|
+ this.ruleNameList = res.list || [];
|
|
|
+ }
|
|
|
}
|
|
|
- if (this.dialogTitle==='新增巡点检计划配置'||this.dialogTitle==='编辑巡点检计划配置'){
|
|
|
- const res = await getRule({status:1,type:1,pageNum:1,size:-1})
|
|
|
- if (res.list) {
|
|
|
- this.ruleNameList = res.list || []
|
|
|
- }
|
|
|
- } catch (error) {}
|
|
|
- },
|
|
|
-
|
|
|
- //选择部门(搜索)
|
|
|
- searchDeptNodeClick (info) {
|
|
|
- if (info) {
|
|
|
- // 根据部门获取人员
|
|
|
- const params = { groupId: info };
|
|
|
- this.getUserList(params);
|
|
|
- } else {
|
|
|
- this.addForm.groupId = null;
|
|
|
+ if (
|
|
|
+ this.dialogTitle === '新增巡点检计划配置' ||
|
|
|
+ this.dialogTitle === '编辑巡点检计划配置'
|
|
|
+ ) {
|
|
|
+ const res = await getRule({
|
|
|
+ status: 1,
|
|
|
+ type: 1,
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+ if (res.list) {
|
|
|
+ this.ruleNameList = res.list || [];
|
|
|
}
|
|
|
- },
|
|
|
-
|
|
|
- // 分类树的选择
|
|
|
- chooseClassify (val) {
|
|
|
- this.categoryEquipment(val);
|
|
|
- },
|
|
|
-
|
|
|
- getRootId (val) {
|
|
|
- this.rootId = val;
|
|
|
- },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 规则名称下拉触发
|
|
|
+ handleRuleNameChange(val) {
|
|
|
+ this._getMatterRulesDetails(val);
|
|
|
+ },
|
|
|
+ // 封装 - 获取规则下面的详情数据及事项
|
|
|
+ async _getMatterRulesDetails(val) {
|
|
|
+ const res = await getDetail(val);
|
|
|
+ this.matterRulesList = res.ruleItems;
|
|
|
+ },
|
|
|
|
|
|
- // 获取设备分类数据
|
|
|
- async categoryEquipment (id) {
|
|
|
- const params = { categoryLevelId: id, pageNum: 1, size: -1 };
|
|
|
- const data = await getCategory(params);
|
|
|
- this.equipmentList = data.list;
|
|
|
- },
|
|
|
+ // 添加备品备件
|
|
|
+ addSpareItems() {
|
|
|
+ if (!this.clickedTreeNode) {
|
|
|
+ return this.$message.warning('请选择设备分类!');
|
|
|
+ }
|
|
|
+ this.$refs.addSpareDialogRef.open();
|
|
|
+ if (this.planRuleEquiList[this.currentEquItemIndex]['sparePart']) {
|
|
|
+ this.selectedSpare =
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex]['sparePart'];
|
|
|
+ } else {
|
|
|
+ this.selectedSpare = [];
|
|
|
+ }
|
|
|
+ // console.log('this.selectedSpare',this.selectedSpare)
|
|
|
+ },
|
|
|
|
|
|
- // 获取计划配置单号
|
|
|
- async getOrderCode (tips) {
|
|
|
- if (tips.includes('巡点检')) {
|
|
|
- const data = await getCode('patrolconfig_code');
|
|
|
- this.$set(this.addForm, 'code', data);
|
|
|
- }
|
|
|
- if (tips.includes('保养')) {
|
|
|
- const code = await getCode('maintainconfig_code');
|
|
|
- this.$set(this.addForm, 'code', code);
|
|
|
+ // 从备品备件弹窗将数据丢到备品备件配置
|
|
|
+ spareItemSelectSubmit(list) {
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex]['sparePart'] = list.map(
|
|
|
+ (item) => {
|
|
|
+ return {
|
|
|
+ categoryName: item.name,
|
|
|
+ model: item.modelType,
|
|
|
+ needNum: item.num,
|
|
|
+ parValue: item.univalenceUnit,
|
|
|
+ unitPrice: item.univalence,
|
|
|
+ unit: item.measuringUnit,
|
|
|
+ code: item.code,
|
|
|
+ id: item.id
|
|
|
+ };
|
|
|
}
|
|
|
- },
|
|
|
-
|
|
|
- // 封装 - 获取设备位置名称和code方法
|
|
|
- getEquiLocation (data) {
|
|
|
- // 设备位置名称
|
|
|
- const path = data.position[0].path;
|
|
|
- const arry = [];
|
|
|
- path.map((item) => {
|
|
|
- arry.push(item.name);
|
|
|
- });
|
|
|
- const equiLocation = arry.join('/');
|
|
|
- // 设备位置编码
|
|
|
- const equiLocationCode = data.position[0].pathIds;
|
|
|
- return { equiLocation, equiLocationCode };
|
|
|
- },
|
|
|
- // 设备列表树点击
|
|
|
- handleNodeClick (data, node) {
|
|
|
- const { equiLocation, equiLocationCode } = this.getEquiLocation(data);
|
|
|
- this.equipmentInfo = {
|
|
|
- equiCode: data.code,
|
|
|
- equiName: data.name,
|
|
|
- equiId: data.id,
|
|
|
- equiModel: data.category.modelType,
|
|
|
- equiLocation: equiLocation,
|
|
|
- equiLocationCode: equiLocationCode
|
|
|
- };
|
|
|
- // 保存当前点击的设备列表某节点的index,在添加操作事项的时候,可以将事项list放到对应的节点对象中,以及切换节点的时候回显事项list
|
|
|
- this.currentEquItemIndex = this.planRuleEquiList.findIndex(
|
|
|
- (item) => item.code === data.code
|
|
|
- );
|
|
|
- this.clickedTreeNode = true;
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['equiLocation'] =
|
|
|
- equiLocation;
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['equiLocationCode'] =
|
|
|
- equiLocationCode;
|
|
|
- },
|
|
|
- // 获取规则名列表
|
|
|
- async _getRuleNameList () {
|
|
|
- if (
|
|
|
- this.dialogTitle === '新增保养计划配置' ||
|
|
|
- this.dialogTitle === '编辑保养计划配置'
|
|
|
- ) {
|
|
|
- const res = await getRule({ type: 2, pageNum: 1, size: -1 });
|
|
|
- if (res.list) {
|
|
|
- this.ruleNameList = res.list || [];
|
|
|
- }
|
|
|
- }
|
|
|
- if (
|
|
|
- this.dialogTitle === '新增巡点检计划配置' ||
|
|
|
- this.dialogTitle === '编辑巡点检计划配置'
|
|
|
- ) {
|
|
|
- const res = await getRule({ type: 1, pageNum: 1, size: -1 });
|
|
|
- if (res.list) {
|
|
|
- this.ruleNameList = res.list || [];
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 规则名称下拉触发
|
|
|
- handleRuleNameChange (val) {
|
|
|
- this._getMatterRulesDetails(val);
|
|
|
- },
|
|
|
- // 封装 - 获取规则下面的详情数据及事项
|
|
|
- async _getMatterRulesDetails (val) {
|
|
|
- const res = await getDetail(val);
|
|
|
- this.matterRulesList = res.ruleItems;
|
|
|
- },
|
|
|
+ );
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
|
|
|
- // 添加备品备件
|
|
|
- addSpareItems () {
|
|
|
- if (!this.clickedTreeNode) {
|
|
|
- return this.$message.warning('请选择设备分类!');
|
|
|
- }
|
|
|
- this.$refs.addSpareDialogRef.open();
|
|
|
- if (this.planRuleEquiList[this.currentEquItemIndex]['sparePart']) {
|
|
|
- this.selectedSpare =
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['sparePart'];
|
|
|
- } else {
|
|
|
- this.selectedSpare = [];
|
|
|
- }
|
|
|
- // console.log('this.selectedSpare',this.selectedSpare)
|
|
|
- },
|
|
|
+ // 删除备品备件
|
|
|
+ handleDeleteSpareItem(index) {
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex]['sparePart'].splice(
|
|
|
+ index,
|
|
|
+ 1
|
|
|
+ );
|
|
|
+ this.changeNum();
|
|
|
+ },
|
|
|
|
|
|
- // 从备品备件弹窗将数据丢到备品备件配置
|
|
|
- spareItemSelectSubmit (list) {
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['sparePart'] = list.map(
|
|
|
- (item) => {
|
|
|
- return {
|
|
|
- categoryName: item.name,
|
|
|
- model: item.modelType,
|
|
|
- needNum: item.num,
|
|
|
- parValue: item.univalenceUnit,
|
|
|
- unitPrice: item.univalence,
|
|
|
- unit: item.measuringUnit,
|
|
|
- code: item.code,
|
|
|
- id: item.id
|
|
|
- };
|
|
|
+ // 改变input数据重新计算总费用
|
|
|
+ changeNum() {
|
|
|
+ let applayList =
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex].sparePart;
|
|
|
+ let total = 0;
|
|
|
+ applayList.map((item) => {
|
|
|
+ if (item.needNum && item.needNum != '') {
|
|
|
+ switch (item.parValue) {
|
|
|
+ case 'wanyuan': {
|
|
|
+ item.chengs = 10000;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'yuan': {
|
|
|
+ item.chengs = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
- );
|
|
|
- this.$forceUpdate();
|
|
|
- },
|
|
|
-
|
|
|
- // 删除备品备件
|
|
|
- handleDeleteSpareItem (index) {
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex]['sparePart'].splice(
|
|
|
- index,
|
|
|
- 1
|
|
|
- );
|
|
|
- this.changeNum();
|
|
|
- },
|
|
|
-
|
|
|
- // 改变input数据重新计算总费用
|
|
|
- changeNum () {
|
|
|
- let applayList =
|
|
|
- this.planRuleEquiList[this.currentEquItemIndex].sparePart;
|
|
|
- let total = 0;
|
|
|
- applayList.map((item) => {
|
|
|
- if (item.needNum && item.needNum != '') {
|
|
|
- switch (item.parValue) {
|
|
|
- case 'wanyuan': {
|
|
|
- item.chengs = 10000;
|
|
|
- break;
|
|
|
- }
|
|
|
- total = total + item.needNum*item.unitPrice*item.chengs
|
|
|
- }
|
|
|
- })
|
|
|
- this.$set(this.planRuleEquiList[this.currentEquItemIndex],'totalCost',total)
|
|
|
+ item.cost = item.needNum * item.unitPrice * item.chengs;
|
|
|
+ total = total + item.needNum * item.unitPrice * item.chengs;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$set(
|
|
|
+ this.planRuleEquiList[this.currentEquItemIndex],
|
|
|
+ 'totalCost',
|
|
|
+ total
|
|
|
+ );
|
|
|
},
|
|
|
|
|
|
// 提交
|
|
|
- submit () {
|
|
|
- this.$refs.addFormRef.validate(async valid => {
|
|
|
+ submit() {
|
|
|
+ this.$refs.addFormRef.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
try {
|
|
|
- const selectList = this.$refs.equiListTree.getCheckedNodes();
|
|
|
- this.addForm.deviceInfo = selectList.map(
|
|
|
- item => {
|
|
|
- return {
|
|
|
- substanceId: item.id,
|
|
|
- sparePart: item.sparePart?item.sparePart:[],
|
|
|
- totalCost:item.totalCost
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
- this.addForm.executeId = this.addForm.executeIdList.join(',')
|
|
|
- this.addForm.ruleType = this.dialogTitle.includes('巡点检')
|
|
|
- ? 1
|
|
|
- : this.dialogTitle.includes('保养')
|
|
|
- ? 2
|
|
|
- : 3
|
|
|
- const res = await saveOrUpdate(this.addForm)
|
|
|
- if (res) {
|
|
|
- const type = this.dialogTitle.includes('新增')
|
|
|
- ? '新增'
|
|
|
- : '编辑';
|
|
|
- this.handleClose();
|
|
|
- this.$message.success(type + '成功!');
|
|
|
- this.$emit('done');
|
|
|
- }
|
|
|
- } catch (error) {}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ const selectList = this.$refs.equiListTree.getCheckedNodes();
|
|
|
+ this.addForm.deviceInfo = selectList.map((item) => {
|
|
|
+ return {
|
|
|
+ substanceId: item.id,
|
|
|
+ sparePart: item.sparePart ? item.sparePart : [],
|
|
|
+ totalCost: item.totalCost
|
|
|
+ };
|
|
|
+ });
|
|
|
+ this.addForm.executeId = this.addForm.executeIdList.join(',');
|
|
|
+ this.addForm.ruleType = this.dialogTitle.includes('巡点检')
|
|
|
+ ? 1
|
|
|
+ : this.dialogTitle.includes('保养')
|
|
|
+ ? 2
|
|
|
+ : 3;
|
|
|
+ const res = await saveOrUpdate(this.addForm);
|
|
|
+ if (res) {
|
|
|
+ const type = this.dialogTitle.includes('新增')
|
|
|
+ ? '新增'
|
|
|
+ : '编辑';
|
|
|
+ this.handleClose();
|
|
|
+ this.$message.success(type + '成功!');
|
|
|
+ this.$emit('done');
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -1011,67 +853,48 @@
|
|
|
color: #000;
|
|
|
font-weight: 700;
|
|
|
}
|
|
|
- .el-form-item__error {
|
|
|
- padding-top: 0;
|
|
|
+ .equipment_tree {
|
|
|
+ height: 510px;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+ ::v-deep .el-tree-node__expand-icon.el-icon-caret-right {
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ ::v-deep
|
|
|
+ .el-tree--highlight-current
|
|
|
+ .el-tree-node.is-current
|
|
|
+ > .el-tree-node__content {
|
|
|
+ background-color: #d7f1fd !important;
|
|
|
}
|
|
|
}
|
|
|
- .equipment_box {
|
|
|
- display: flex;
|
|
|
- .left_aside {
|
|
|
- width: 300px;
|
|
|
- border: 1px solid #797979;
|
|
|
- margin-right: 5px;
|
|
|
- .equipment_list_title {
|
|
|
+ .right_aside {
|
|
|
+ flex: 1;
|
|
|
+ border: 1px solid #797979;
|
|
|
+ padding: 10px;
|
|
|
+ .equipment_info {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ .item_info {
|
|
|
+ width: 33%;
|
|
|
height: 34px;
|
|
|
line-height: 34px;
|
|
|
- text-align: center;
|
|
|
- background-color: #d7d7d7;
|
|
|
- color: #000;
|
|
|
- font-weight: 700;
|
|
|
- }
|
|
|
- .equipment_tree {
|
|
|
- height: 510px;
|
|
|
- overflow: auto;
|
|
|
- }
|
|
|
- ::v-deep .el-tree-node__expand-icon.el-icon-caret-right {
|
|
|
- padding: 0;
|
|
|
- }
|
|
|
- ::v-deep
|
|
|
- .el-tree--highlight-current
|
|
|
- .el-tree-node.is-current
|
|
|
- > .el-tree-node__content {
|
|
|
- background-color: #d7f1fd !important;
|
|
|
- }
|
|
|
- }
|
|
|
- .right_aside {
|
|
|
- flex: 1;
|
|
|
- border: 1px solid #797979;
|
|
|
- padding: 10px;
|
|
|
- .equipment_info {
|
|
|
display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
- border: 1px solid #ddd;
|
|
|
- .item_info {
|
|
|
- width: 33%;
|
|
|
- height: 34px;
|
|
|
- line-height: 34px;
|
|
|
- display: flex;
|
|
|
- .item_label {
|
|
|
- width: 90px;
|
|
|
- text-align: center;
|
|
|
- background-color: #f2f2f2;
|
|
|
- font-weight: 700;
|
|
|
- }
|
|
|
+ .item_label {
|
|
|
+ width: 90px;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #f2f2f2;
|
|
|
+ font-weight: 700;
|
|
|
+ }
|
|
|
+ .item_value {
|
|
|
+ border-bottom: 1px solid #f2f2f2;
|
|
|
+ flex: 1;
|
|
|
+ padding-left: 5px;
|
|
|
+ }
|
|
|
+ &:last-child {
|
|
|
+ width: 100%;
|
|
|
.item_value {
|
|
|
- border-bottom: 1px solid #f2f2f2;
|
|
|
- flex: 1;
|
|
|
- padding-left: 5px;
|
|
|
- }
|
|
|
- &:last-child {
|
|
|
- width: 100%;
|
|
|
- .item_value {
|
|
|
- border: 0;
|
|
|
- }
|
|
|
+ border: 0;
|
|
|
}
|
|
|
}
|
|
|
}
|