|
|
@@ -5,7 +5,7 @@
|
|
|
v-if="visible"
|
|
|
append-to-body
|
|
|
custom-class="ele-dialog-form"
|
|
|
- :title="dialogTitle"
|
|
|
+ :title="title"
|
|
|
:close-on-click-modal="false"
|
|
|
:before-close="close"
|
|
|
:maxable="true"
|
|
|
@@ -32,7 +32,6 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="计划配置名称" prop="name">
|
|
|
<el-input
|
|
|
- :disabled="dialogTitle === '派单'"
|
|
|
v-model="addForm.name"
|
|
|
size="small"
|
|
|
placeholder="请输入"
|
|
|
@@ -43,9 +42,6 @@
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="自动派单" prop="autoOrder">
|
|
|
<el-select
|
|
|
- :disabled="
|
|
|
- dialogTitle === '派单' || dialogTitle.includes('量具送检')
|
|
|
- "
|
|
|
v-model="addForm.autoOrder"
|
|
|
size="small"
|
|
|
style="width: 100%"
|
|
|
@@ -62,7 +58,6 @@
|
|
|
<div style="display: flex">
|
|
|
<el-input
|
|
|
type="number"
|
|
|
- :disabled="dialogTitle === '派单'"
|
|
|
v-model="addForm.duration"
|
|
|
size="small"
|
|
|
placeholder="请输入"
|
|
|
@@ -74,28 +69,20 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col
|
|
|
- :span="8"
|
|
|
- v-if="addForm.autoOrder && !dialogTitle.includes('量具送检')"
|
|
|
- >
|
|
|
+ <el-col :span="8">
|
|
|
<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-col :span="8">
|
|
|
<el-form-item label="负责人" prop="executorId">
|
|
|
<el-select
|
|
|
v-model="addForm.executorId"
|
|
|
size="small"
|
|
|
style="width: 100%"
|
|
|
- :disabled="isBindPlan"
|
|
|
multiple
|
|
|
filterable
|
|
|
>
|
|
|
@@ -108,10 +95,9 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8" v-if="!dialogTitle.includes('量具送检')">
|
|
|
+ <el-col :span="8">
|
|
|
<el-form-item label="审核人" prop="approvalUserId">
|
|
|
<el-select
|
|
|
- :disabled="dialogTitle === '派单'"
|
|
|
v-model="addForm.approvalUserId"
|
|
|
size="small"
|
|
|
clearable
|
|
|
@@ -133,22 +119,10 @@
|
|
|
dictName="紧急程度"
|
|
|
clearable
|
|
|
v-model="addForm.urgent"
|
|
|
- :disabled="dialogTitle === '派单'"
|
|
|
>
|
|
|
</DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <!-- <el-col :span="8">
|
|
|
- <el-form-item label="状态" prop="status">
|
|
|
- <el-switch
|
|
|
- v-model="addForm.status"
|
|
|
- active-text="开"
|
|
|
- inactive-text="关"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col> -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
<el-input
|
|
|
@@ -158,41 +132,17 @@
|
|
|
:rows="2"
|
|
|
placeholder="请详细说明"
|
|
|
size="small"
|
|
|
- :disabled="dialogTitle === '派单'"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-tabs
|
|
|
- v-model="tabsValue"
|
|
|
- type="card"
|
|
|
- :closable="dialogTitle !== '派单'"
|
|
|
- @tab-click="handleTab"
|
|
|
- @tab-remove="removeTab"
|
|
|
- >
|
|
|
- <el-tab-pane
|
|
|
- v-for="(item, ruleIdListIndex) in ruleIdList"
|
|
|
- :key="item.ruleId"
|
|
|
- :label="item.name"
|
|
|
- :name="item.ruleId"
|
|
|
- >
|
|
|
+ <el-tabs type="card">
|
|
|
+ <el-tab-pane v-if="ruleInfo" :label="ruleInfo.name">
|
|
|
<div class="el-tab_box">
|
|
|
<div class="equipmentList_box">
|
|
|
- <header-title title="设备列表">
|
|
|
- <div v-if="dialogTitle !== '派单'">
|
|
|
- <el-button
|
|
|
- size="small"
|
|
|
- icon="el-icon-plus"
|
|
|
- class="ele-btn-icon"
|
|
|
- type="primary"
|
|
|
- :disables="hasCategoryId"
|
|
|
- @click="handleAdd(ruleIdList, ruleIdListIndex)"
|
|
|
- >新增</el-button
|
|
|
- >
|
|
|
- </div>
|
|
|
- </header-title>
|
|
|
- <el-table :data="item.equipmentList" border>
|
|
|
+ <header-title title="设备列表"> </header-title>
|
|
|
+ <el-table :data="deviceList" border>
|
|
|
<el-table-column label="序号" type="index" width="50">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="设备名称" align="center" prop="name">
|
|
|
@@ -216,25 +166,13 @@
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-if="dialogTitle !== '派单'"
|
|
|
- label="操作"
|
|
|
- width="100"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- @click="deleteEquipment(scope.$index)"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="ruleMatters_box">
|
|
|
<header-title title="规则事项">
|
|
|
- <div v-if="dialogTitle !== '派单'">
|
|
|
+ <div>
|
|
|
<el-button
|
|
|
+ v-if="productionInfo.executeStatus == 0"
|
|
|
size="small"
|
|
|
icon="el-icon-plus"
|
|
|
class="ele-btn-icon"
|
|
|
@@ -244,7 +182,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
</header-title>
|
|
|
- <el-table :data="item.ruleItems" border>
|
|
|
+ <el-table v-if="ruleInfo" :data="ruleInfo.ruleItems" border>
|
|
|
<el-table-column label="序号" width="50">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.$index + 1 }}</span>
|
|
|
@@ -357,13 +295,12 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-if="dialogTitle !== '派单'"
|
|
|
- label="操作"
|
|
|
- width="100"
|
|
|
- >
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="deleteItem(scope.$index)"
|
|
|
+ <el-button
|
|
|
+ v-if="productionInfo.executeStatus == 0"
|
|
|
+ type="text"
|
|
|
+ @click="deleteItem(scope.$index)"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</template>
|
|
|
@@ -376,126 +313,65 @@
|
|
|
</el-form>
|
|
|
<template v-slot:footer>
|
|
|
<el-button @click="visible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="save">
|
|
|
- {{ dialogTitle === '派单' ? '派单' : '保存' }}</el-button
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="submit"
|
|
|
+ :disabled="productionInfo.executeStatus != 0"
|
|
|
>
|
|
|
- </template>
|
|
|
- <!-- -->
|
|
|
- <operation-guideDialog ref="operationGuideDialog" @save="saveEdit" />
|
|
|
- <!-- 添加规则 -->
|
|
|
- <ele-modal
|
|
|
- width="800px"
|
|
|
- :visible="addDialog"
|
|
|
- :append-to-body="true"
|
|
|
- title="规则配置"
|
|
|
- :close-on-click-modal="true"
|
|
|
- @update:visible="closeAdd"
|
|
|
- :maxable="true"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="ruleObj.ruleId"
|
|
|
- size="small"
|
|
|
- style="width: 100%"
|
|
|
- @change="handleRuleNameChange"
|
|
|
- :disabled="isBindPlan"
|
|
|
- filterable
|
|
|
+ 派单</el-button
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="item in ruleNameList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- :label="item.code + '-' + item.name"
|
|
|
- @click.native="ruleChange(item)"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- <template v-slot:footer>
|
|
|
- <el-button @click="addDialog = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="addRule"> 添加 </el-button>
|
|
|
- </template>
|
|
|
- </ele-modal>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <OperationGuideDialog
|
|
|
+ ref="operationGuideDialog"
|
|
|
+ @save="saveEdit"
|
|
|
+ ></OperationGuideDialog>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { getDetail, getCode } from '@/api/ruleManagement/matter';
|
|
|
- import { getRule, getCategory } from '@/api/ruleManagement/plan';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
import OperationGuideDialog from './operationGuideDialog.vue';
|
|
|
import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
- import { pageList } from '@/api/technology/version/version.js';
|
|
|
- import { getById, saveOrUpdate } from '@/api/maintenance/patrol_maintenance';
|
|
|
+ import { getById } from '@/api/maintenance/patrol_maintenance';
|
|
|
import { getFile } from '@/api/system/file';
|
|
|
- import { deepClone } from 'ele-admin/lib/utils/core';
|
|
|
+ import { getAssetInfo } from '@/api/produce/device';
|
|
|
+ import { saveRuleRecord } from '@/api/producetaskrulerecord/index.js';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
deptSelect,
|
|
|
OperationGuideDialog
|
|
|
},
|
|
|
- props: {
|
|
|
- dialogTitle: {
|
|
|
- type: String,
|
|
|
- default: () => {
|
|
|
- return '新增巡检点计划配置';
|
|
|
- }
|
|
|
- }
|
|
|
- // visible: {
|
|
|
- // type: Boolean,
|
|
|
- // default: false
|
|
|
- // }
|
|
|
- },
|
|
|
+ emits: ['reload'],
|
|
|
+ props: {},
|
|
|
data() {
|
|
|
- const defaultForm = {
|
|
|
- id: null,
|
|
|
- code: '',
|
|
|
- name: '',
|
|
|
- modelType: '',
|
|
|
- brandNum: '',
|
|
|
- specification: '',
|
|
|
- measuringUnit: '',
|
|
|
-
|
|
|
- bomList: []
|
|
|
+ const formData = {
|
|
|
+ code: '', // 计划配置单号
|
|
|
+ name: '', // 计划配置名称
|
|
|
+ autoOrder: 1, // 自动派单
|
|
|
+ ruleId: '', // 规则id
|
|
|
+ ruleName: '', // 规则名称
|
|
|
+ duration: null, // 计划完成时长
|
|
|
+ categoryId: '', // 设备类别id
|
|
|
+ approvalUserId: '', // 审核人id
|
|
|
+ groupId: '', // 巡点检部门code
|
|
|
+ executorId: [], // 巡点检人员id
|
|
|
+ executorPhone: '',
|
|
|
+ status: 1, // 状态
|
|
|
+ remark: '', // 备注
|
|
|
+ urgent: '1', // 紧急程度
|
|
|
+ type: '',
|
|
|
+ groupName: '',
|
|
|
+ isTempRecord: 0
|
|
|
};
|
|
|
+
|
|
|
return {
|
|
|
visible: false,
|
|
|
- ruleIndex: 0, // 规则index
|
|
|
- ruleId: '',
|
|
|
- formLabel: '',
|
|
|
- isBindPlan: false,
|
|
|
- ruleObj: {
|
|
|
- ruleId: '',
|
|
|
- name: '',
|
|
|
- code: '',
|
|
|
- equipmentList: []
|
|
|
- },
|
|
|
- ruleIdList: [],
|
|
|
- addForm: {
|
|
|
- id: '',
|
|
|
- code: '', // 计划配置单号
|
|
|
- name: '', // 计划配置名称
|
|
|
- autoOrder: 1, // 自动派单
|
|
|
- ruleId: '', // 规则id
|
|
|
- ruleName: '', // 规则名称
|
|
|
- duration: null, // 计划完成时长
|
|
|
- categoryId: '', // 设备类别id
|
|
|
- approvalUserId: '', // 审核人id
|
|
|
- groupId: '', // 巡点检部门code
|
|
|
- executorId: [], // 巡点检人员id
|
|
|
- executorPhone: '',
|
|
|
- status: 1, // 状态
|
|
|
- remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
- },
|
|
|
- ruleNameList: [], // 规则列表
|
|
|
+ addForm: formData,
|
|
|
uerList: [], // 审核人列表
|
|
|
executorList: [], // 业务人员列表
|
|
|
- defaultForm,
|
|
|
- // 表单数据
|
|
|
- form: {
|
|
|
- ...defaultForm
|
|
|
- },
|
|
|
-
|
|
|
- versionList: [],
|
|
|
|
|
|
// 表单验证规则
|
|
|
addFormRules: {
|
|
|
@@ -528,70 +404,6 @@
|
|
|
]
|
|
|
},
|
|
|
|
|
|
- columns: [
|
|
|
- {
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '子项编号',
|
|
|
- prop: 'subCode',
|
|
|
- action: 'subCode'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '物料名称',
|
|
|
- prop: 'categoryName',
|
|
|
- action: 'categoryName'
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- label: '是否回收料',
|
|
|
- prop: 'isReworkBom',
|
|
|
- action: 'isReworkBom',
|
|
|
- slot: 'isReworkBom',
|
|
|
- width: 95
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- label: '物料编码',
|
|
|
- prop: 'categoryCode'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '牌号',
|
|
|
- prop: 'brandNum'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '型号',
|
|
|
- prop: 'modelType'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '数量',
|
|
|
- prop: 'count'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '计量单位',
|
|
|
- prop: 'unit'
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- label: '附件',
|
|
|
- slot: 'bomArtFiles',
|
|
|
- action: 'bomArtFiles',
|
|
|
- minWidth: 100
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- label: '单位',
|
|
|
- prop: 'weightUnit'
|
|
|
- },
|
|
|
-
|
|
|
- {
|
|
|
- label: '备注',
|
|
|
- prop: 'remark'
|
|
|
- }
|
|
|
- ],
|
|
|
-
|
|
|
statusList: [
|
|
|
{ label: '草稿', value: -1 },
|
|
|
{ label: '失效', value: 0 },
|
|
|
@@ -600,29 +412,28 @@
|
|
|
|
|
|
// 提交状态
|
|
|
loading: false,
|
|
|
-
|
|
|
- categoryId: null,
|
|
|
-
|
|
|
- current: null,
|
|
|
-
|
|
|
- materialShow: false,
|
|
|
-
|
|
|
- tabsList: [],
|
|
|
- tableData: [],
|
|
|
-
|
|
|
- taskId: null,
|
|
|
-
|
|
|
- addDialog: false,
|
|
|
- tabsValue: null,
|
|
|
-
|
|
|
- hasCategoryId: false,
|
|
|
- getByIdData: {}
|
|
|
+ // 规则信息
|
|
|
+ ruleInfo: null,
|
|
|
+ // 设备信息
|
|
|
+ deviceList: [],
|
|
|
+ // 事项信息
|
|
|
+ productionInfo: null,
|
|
|
+ // 工艺路线
|
|
|
+ workOrderInfo: null,
|
|
|
+ // 工序信息
|
|
|
+ produceTaskInfo: null
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
// 是否开启响应式布局
|
|
|
styleResponsive() {
|
|
|
return this.$store.state.theme.styleResponsive;
|
|
|
+ },
|
|
|
+ title() {
|
|
|
+ if (this.ruleInfo) {
|
|
|
+ return `新增${this.ruleInfo.name}计划`;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -630,8 +441,6 @@
|
|
|
if (val) {
|
|
|
// 获取审核人列表数据
|
|
|
this.getUserList();
|
|
|
- // 获取规则名称
|
|
|
- this._getRuleNameList();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
@@ -640,285 +449,65 @@
|
|
|
this.visible = false;
|
|
|
},
|
|
|
// 初始化
|
|
|
- async init(row, tips) {
|
|
|
+ async init(row, workOrderInfo, produceTaskInfo) {
|
|
|
console.log(row);
|
|
|
- console.log(tips);
|
|
|
+ this.productionInfo = row;
|
|
|
+ this.workOrderInfo = workOrderInfo;
|
|
|
+ this.produceTaskInfo = produceTaskInfo;
|
|
|
this.visible = true;
|
|
|
- if (row) {
|
|
|
- this.getInfo(row.id, tips);
|
|
|
- } else {
|
|
|
- // 获取计划配置单号
|
|
|
- this.getOrderCode(tips);
|
|
|
- this.addForm = {
|
|
|
- code: '', // 计划配置单号
|
|
|
- name: '', // 计划配置名称
|
|
|
- autoOrder: 1, // 自动派单
|
|
|
- ruleId: '', // 规则id
|
|
|
- ruleName: '', // 规则名称
|
|
|
- duration: null, // 计划完成时长
|
|
|
- categoryId: '', // 设备类别id
|
|
|
- approvalUserId: '', // 审核人id
|
|
|
- groupId: '', // 巡点检部门code
|
|
|
- executorId: [], // 巡点检人员id
|
|
|
- executorPhone: '',
|
|
|
- status: 1, // 状态
|
|
|
- remark: '', // 备注
|
|
|
- urgent: '1'
|
|
|
- };
|
|
|
- this.ruleIdList = [];
|
|
|
- this.isBindPlan = false;
|
|
|
- this.planRuleEquiList = [];
|
|
|
- // this.matterRulesList = [];
|
|
|
- }
|
|
|
- this.formLabel = this.dialogTitle.includes('巡点检')
|
|
|
- ? '巡点检'
|
|
|
- : this.dialogTitle.includes('保养')
|
|
|
- ? '保养'
|
|
|
- : this.dialogTitle.includes('量具送检')
|
|
|
- ? '量具送检'
|
|
|
- : this.dialogTitle.includes('运行记录')
|
|
|
- ? '运行记录'
|
|
|
- : '盘点';
|
|
|
- const typeOptions = {
|
|
|
- 巡点检: 1,
|
|
|
- 保养: 2,
|
|
|
- 维修: 3,
|
|
|
- 计划性维修: 4,
|
|
|
- 量具送检: 5,
|
|
|
- 运行记录: 6
|
|
|
- };
|
|
|
- this.$set(this.addForm, 'type', typeOptions[this.formLabel]);
|
|
|
|
|
|
- // const planRuleTypeObj = {
|
|
|
- // 巡点检: 'PATROL',
|
|
|
- // 保养: 'MAINTAIN',
|
|
|
- // 量具送检: '',
|
|
|
- // 盘点: 'INVENTORY'
|
|
|
- // };
|
|
|
- // this.addForm.planType = planRuleTypeObj[this.formLabel];
|
|
|
- },
|
|
|
- autoOrderChange(val) {
|
|
|
- if (val == 0) {
|
|
|
- this.addForm.executorId = '';
|
|
|
- this.addForm.groupId = '';
|
|
|
- }
|
|
|
- },
|
|
|
- ruleChange(item) {
|
|
|
- this.ruleObj.name = item.name;
|
|
|
- this.ruleObj.code = item.code;
|
|
|
- },
|
|
|
- save() {
|
|
|
- console.log(this.addForm, 888);
|
|
|
- console.log(this.ruleIdList);
|
|
|
- if (this.ruleIdList && this.ruleIdList.length > 0) {
|
|
|
- this.$refs.addFormRef.validate(async (valid) => {
|
|
|
- console.log(valid);
|
|
|
- if (valid) {
|
|
|
- const planDeviceList = this.ruleIdList.map((ruleItem) => {
|
|
|
- return ruleItem.equipmentList.map((item) => {
|
|
|
- return {
|
|
|
- // equiCode: item.code,
|
|
|
- // equiName: item.name,
|
|
|
- deviceId: item.id,
|
|
|
- codeNumber: item.codeNumber,
|
|
|
- // equiModel: item.modelType,
|
|
|
- equiLocation: item.position[0] && item.position[0].pathName,
|
|
|
- equiLocationCode:
|
|
|
- item.position[0] && item.position[0].pathIds,
|
|
|
- workItems: ruleItem.ruleItems ? ruleItem.ruleItems : []
|
|
|
- // categoryId: item.category.categoryLevelId,
|
|
|
- // categoryName: item.category.categoryLevelName
|
|
|
- // sparePart: ruleItem.sparePart ? obj.sparePart : []
|
|
|
- };
|
|
|
- });
|
|
|
- });
|
|
|
- let boolen = planDeviceList.every((item) => item.length > 0);
|
|
|
- console.log(planDeviceList);
|
|
|
- if (!boolen) {
|
|
|
- this.$message.error('请添加设备!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- let sendMsg = this.ruleIdList.map((item, index) => {
|
|
|
- return {
|
|
|
- ...this.addForm,
|
|
|
- ruleId: item.ruleId,
|
|
|
- categoryId: item.categoryId,
|
|
|
- planDeviceList: planDeviceList[index],
|
|
|
- executorId: this.addForm.executorId
|
|
|
- ? this.addForm.executorId.join(',')
|
|
|
- : ''
|
|
|
- };
|
|
|
- });
|
|
|
- let type = '';
|
|
|
- if (this.dialogTitle === '派单') {
|
|
|
- type = '派单';
|
|
|
- } else {
|
|
|
- type = this.dialogTitle.includes('新增') ? '新增' : '编辑';
|
|
|
- }
|
|
|
- // return
|
|
|
- try {
|
|
|
- let res = await saveOrUpdate(sendMsg);
|
|
|
- if (res) {
|
|
|
- this.$message.success(type + '成功!');
|
|
|
- this.$emit('done');
|
|
|
- this.visible = false;
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.$message.error(type + '失败!');
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ if (this.productionInfo.executeStatus != 0) {
|
|
|
+ // 执行中 已执行 获取基本信息
|
|
|
+ this.getInfo();
|
|
|
} else {
|
|
|
- this.$message.error('请添加规则!');
|
|
|
+ // 获取设备信息 规则列表
|
|
|
+ this.getRuleInfoAndList(row);
|
|
|
+ this.getDeviceId(row.deviceId);
|
|
|
}
|
|
|
},
|
|
|
- // 保存操作指导数据
|
|
|
- saveEdit(data, index) {
|
|
|
- console.log(this.matterRulesList);
|
|
|
- console.log(data);
|
|
|
- console.log(index);
|
|
|
- this.$set(
|
|
|
- this.ruleIdList[this.ruleIndex].ruleItems[index],
|
|
|
- 'operationGuide',
|
|
|
- data
|
|
|
- );
|
|
|
- },
|
|
|
- /* 打开操作手册编辑款 */
|
|
|
- openOperationGuideDialogDialog(row, index) {
|
|
|
- if (this.dialogTitle !== '派单') {
|
|
|
- this.$refs.operationGuideDialog.open(row, index);
|
|
|
- }
|
|
|
- },
|
|
|
- deleteEquipment(index) {
|
|
|
- this.ruleIdList[this.ruleIndex].equipmentList.splice(index, 1);
|
|
|
- },
|
|
|
- deleteItem(index) {
|
|
|
- if (this.ruleIdList[this.ruleIndex].ruleItems.length > 1) {
|
|
|
- this.ruleIdList[this.ruleIndex].ruleItems.splice(index, 1);
|
|
|
- } else {
|
|
|
- this.$message.error('至少要有一个规则事项!');
|
|
|
- }
|
|
|
- },
|
|
|
- addPostscript() {
|
|
|
- console.log(
|
|
|
- 'this.matterRulesList---------------',
|
|
|
- this.matterRulesList
|
|
|
- );
|
|
|
- this.ruleIdList[this.ruleIndex].ruleItems.push({
|
|
|
- sort: null,
|
|
|
- name: '',
|
|
|
- content: '',
|
|
|
- norm: '',
|
|
|
- isNew: true,
|
|
|
- operationGuide: {
|
|
|
- procedureList: [],
|
|
|
- toolList: []
|
|
|
- }
|
|
|
+ // 已执行获取基本信息
|
|
|
+ async getInfo() {
|
|
|
+ const { data } = await getById(this.productionInfo.eamPlanIds[0]);
|
|
|
+ console.log('data 基本信息', data);
|
|
|
+ // 数据回显
|
|
|
+ this.$util.assignObject(this.addForm, data);
|
|
|
+ // 类型转换
|
|
|
+ this.addForm.urgent = this.addForm.urgent + '';
|
|
|
+ this.addForm.executorId = data.executorId.split(',');
|
|
|
+ // 获取部门用户列表
|
|
|
+ this.getUserList({ groupId: data.groupId });
|
|
|
+ this.ruleInfo = data.ruleInfo;
|
|
|
+ this.ruleInfo.ruleItems = data.planDeviceList[0]?.workItems || [];
|
|
|
+ this.deviceList = data.planDeviceList.map((item) => {
|
|
|
+ return {
|
|
|
+ name: item.substance.name,
|
|
|
+ position: item.substance.position,
|
|
|
+ id: item.substance.id,
|
|
|
+ fixCode: item.substance.fixCode,
|
|
|
+ codeNumber: item.substance.codeNumber
|
|
|
+ };
|
|
|
});
|
|
|
},
|
|
|
- async getInfo(id, tips) {
|
|
|
- console.log(id);
|
|
|
- try {
|
|
|
- const res = await getById(id);
|
|
|
- console.log('res----------', res);
|
|
|
- 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 = [
|
|
|
- {
|
|
|
- id: res.data.id,
|
|
|
- ruleId: res.data.ruleId,
|
|
|
- name: res.data.name,
|
|
|
- code: res.data.code,
|
|
|
- categoryId: res.data.categoryId,
|
|
|
- equipmentList: res.data.planDeviceList.map((item) => {
|
|
|
- return {
|
|
|
- name: item.substance.name,
|
|
|
- position: item.substance.position,
|
|
|
- id: item.substance.id,
|
|
|
- fixCode: item.substance.fixCode,
|
|
|
- codeNumber: item.substance.codeNumber
|
|
|
- // category: {
|
|
|
- // categoryLevelId: item.categoryId,
|
|
|
- // categoryLevelName: item.categoryName
|
|
|
- // }
|
|
|
- };
|
|
|
- }),
|
|
|
- ruleItems: res.data.planDeviceList[0].workItems
|
|
|
- }
|
|
|
- ];
|
|
|
- console.log(this.ruleIdList);
|
|
|
- this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
-
|
|
|
- // this._getMatterRulesDetails(res.ruleId);
|
|
|
- this.$set(this.addForm, 'code', res.data.code);
|
|
|
- this.$set(this.addForm, 'urgent', JSON.stringify(res.data.urgent));
|
|
|
- this.$set(this.addForm, 'executorId', res.data.executorId.split(','));
|
|
|
- this.$set(this.addForm, 'imageUrl', {});
|
|
|
- console.log(this.rootData);
|
|
|
-
|
|
|
- this.getUserList({ groupId: res.data.groupId });
|
|
|
- // const rep = await getTreeByType(0);
|
|
|
- // console.log('sasas', res);
|
|
|
- // const ids = this.findTopLevelAncestorId(
|
|
|
- // rep.data,
|
|
|
- // res.categoryLevelId
|
|
|
- // );
|
|
|
- // this.rootId = ids;
|
|
|
- // // await this._getEquipmentList(res.categoryLevelId, this.isBindPlan);
|
|
|
- // let keys = [];
|
|
|
- // res.deviceInfo.map((item) => {
|
|
|
- // keys.push(item.substanceId);
|
|
|
- // });
|
|
|
- // this.$nextTick(() => {
|
|
|
- // this.$refs.equiListTree.setCheckedKeys(keys);
|
|
|
- // });
|
|
|
- // this.clickedTreeNode = true;
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- }
|
|
|
+ // 获取规则信息 和 规则事项列表
|
|
|
+ async getRuleInfoAndList(row) {
|
|
|
+ // 事项规则
|
|
|
+ const data = await getDetail(row.ruleId);
|
|
|
+ console.log('事项规则', data);
|
|
|
+ this.ruleInfo = data;
|
|
|
+ this.addForm.ruleId = data.id;
|
|
|
+ this.addForm.ruleName = data.name;
|
|
|
+ this.addForm.type = data.ruleType;
|
|
|
+ // code 生成
|
|
|
+ this.getOrderCode(data.ruleType);
|
|
|
},
|
|
|
- // 获取设备分类数据
|
|
|
- async categoryEquipment(id) {
|
|
|
- const params = { categoryLevelId: id, pageNum: 1, size: -1 };
|
|
|
- console.log('params==', params);
|
|
|
- const data = await getCategory(params);
|
|
|
- console.log(data);
|
|
|
- this.equipmentList = data.list;
|
|
|
- },
|
|
|
- // 选择设备
|
|
|
- chooseEquipment(data, index, categoryId) {
|
|
|
- this.$set(
|
|
|
- this.ruleIdList[index],
|
|
|
- 'equipmentList',
|
|
|
- this.ruleIdList[index].equipmentList.concat(data)
|
|
|
- );
|
|
|
- this.$set(this.ruleIdList[index], 'categoryId', categoryId);
|
|
|
- console.log(this.ruleIdList);
|
|
|
- },
|
|
|
- // 获取计划配置单号
|
|
|
- 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);
|
|
|
- }
|
|
|
- if (tips.includes('量具送检')) {
|
|
|
- const code = await getCode('quantity_code');
|
|
|
- this.$set(this.addForm, 'code', code);
|
|
|
- }
|
|
|
- if (tips.includes('运行记录')) {
|
|
|
- const code = await getCode('runRecord_code');
|
|
|
- this.$set(this.addForm, 'code', code);
|
|
|
- }
|
|
|
+ // 查询设备信息
|
|
|
+ async getDeviceId(id) {
|
|
|
+ const data = await getAssetInfo(id);
|
|
|
+ this.deviceList = [data];
|
|
|
+ console.log('data -- 设备信息', data);
|
|
|
+ this.addForm.categoryId = data.categoryId;
|
|
|
},
|
|
|
+
|
|
|
//选择部门(搜索)
|
|
|
searchDeptNodeClick(info, data) {
|
|
|
if (info) {
|
|
|
@@ -947,7 +536,6 @@
|
|
|
data = Object.assign(data, params);
|
|
|
}
|
|
|
const res = await getUserPage(data);
|
|
|
- console.log('res------------', res);
|
|
|
if (params) {
|
|
|
this.executorList = res.list;
|
|
|
} else {
|
|
|
@@ -955,186 +543,124 @@
|
|
|
}
|
|
|
} catch (error) {}
|
|
|
},
|
|
|
- // 获取规则名列表
|
|
|
- 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 || [];
|
|
|
- }
|
|
|
- }
|
|
|
- if (
|
|
|
- this.dialogTitle === '新增量具送检计划配置' ||
|
|
|
- this.dialogTitle === '编辑量具送检计划配置'
|
|
|
- ) {
|
|
|
- const res = await getRule({
|
|
|
- status: 1,
|
|
|
- type: 5,
|
|
|
- pageNum: 1,
|
|
|
- size: -1
|
|
|
- });
|
|
|
- if (res.list) {
|
|
|
- this.ruleNameList = res.list || [];
|
|
|
- }
|
|
|
- }
|
|
|
- if (
|
|
|
- this.dialogTitle === '新增运行记录配置' ||
|
|
|
- this.dialogTitle === '编辑运行记录配置'
|
|
|
- ) {
|
|
|
- const res = await getRule({
|
|
|
- status: 1,
|
|
|
- type: 6,
|
|
|
- pageNum: 1,
|
|
|
- size: -1
|
|
|
- });
|
|
|
- if (res.list) {
|
|
|
- this.ruleNameList = res.list || [];
|
|
|
- }
|
|
|
+ autoOrderChange(val) {
|
|
|
+ if (val == 0) {
|
|
|
+ this.addForm.executorId = '';
|
|
|
+ this.addForm.groupId = '';
|
|
|
}
|
|
|
},
|
|
|
downloadFile(file) {
|
|
|
getFile({ objectName: file.storePath }, file.name);
|
|
|
},
|
|
|
-
|
|
|
- openEdit(index) {
|
|
|
- this.current = this.form.bomList[index];
|
|
|
- console.log(this.current);
|
|
|
- this.materialShow = true;
|
|
|
- },
|
|
|
-
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where }) {
|
|
|
- return [];
|
|
|
- },
|
|
|
-
|
|
|
- async getVersionList() {
|
|
|
- const res = await pageList({
|
|
|
- pageNum: 1,
|
|
|
- size: 100
|
|
|
+ // 添加事项规则
|
|
|
+ addPostscript() {
|
|
|
+ this.ruleInfo.ruleItems.push({
|
|
|
+ sort: null,
|
|
|
+ name: '',
|
|
|
+ content: '',
|
|
|
+ norm: '',
|
|
|
+ isNew: true,
|
|
|
+ operationGuide: {
|
|
|
+ procedureList: [],
|
|
|
+ toolList: []
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
- this.versionList = res.list;
|
|
|
- },
|
|
|
-
|
|
|
- handleAdd(ruleIdList, ruleIdListIndex) {
|
|
|
- this.$refs.productRefs.open(ruleIdList, ruleIdListIndex);
|
|
|
},
|
|
|
-
|
|
|
- // /* 更新visible */
|
|
|
- // updateVisible(value) {
|
|
|
- // this.$emit('update:visible', value);
|
|
|
- // },
|
|
|
-
|
|
|
- handleAddTab() {
|
|
|
- this.tableData = this.tabsList;
|
|
|
- this.addDialog = true;
|
|
|
- },
|
|
|
-
|
|
|
- handleTab(e) {
|
|
|
- this.ruleIndex = e.index;
|
|
|
- // this.ruleIdList[e.index].ruleItems = this._getMatterRulesDetails(this.ruleId)
|
|
|
- },
|
|
|
-
|
|
|
- removeTab(targetName) {
|
|
|
- this.$confirm('是否删除当前工序?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.ruleIdList.forEach((e, index) => {
|
|
|
- if (e.ruleId == targetName) {
|
|
|
- this.ruleIdList.splice(index, 1);
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.ruleIdList.length == 1) {
|
|
|
- this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- },
|
|
|
-
|
|
|
- /*关闭选择参数*/
|
|
|
- closeAdd() {
|
|
|
- this.addDialog = false;
|
|
|
+ /* 打开操作手册编辑款 */
|
|
|
+ openOperationGuideDialogDialog(row, index) {
|
|
|
+ this.$refs.operationGuideDialog.open(row, index);
|
|
|
},
|
|
|
- // 规则名称下拉触发
|
|
|
- handleRuleNameChange(val) {
|
|
|
- this.ruleId = val;
|
|
|
- console.log('勾选的规则----', val);
|
|
|
- this.getRulesDetails(val);
|
|
|
+ // 删除事项规则
|
|
|
+ deleteItem(index) {
|
|
|
+ if (this.ruleInfo.ruleItems.length > 1) {
|
|
|
+ this.ruleInfo.ruleItems.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ this.$message.error('至少要有一个规则事项!');
|
|
|
+ }
|
|
|
},
|
|
|
- async getRulesDetails(val) {
|
|
|
- const res = await getDetail(val);
|
|
|
- this.hasCategoryId = res?.categoryId;
|
|
|
- this.getByIdData = res;
|
|
|
- console.log(res, 'sssssssssssssssssssssss');
|
|
|
+ // 保存操作指导数据
|
|
|
+ saveEdit(data, index) {
|
|
|
+ this.$set(this.ruleInfo.ruleItems[index], 'operationGuide', data);
|
|
|
},
|
|
|
- // 封装 - 获取规则下面的详情数据及事项
|
|
|
- async _getMatterRulesDetails(val) {
|
|
|
- const res = await getDetail(val);
|
|
|
- return res.ruleItems;
|
|
|
+ // code生成
|
|
|
+ async getOrderCode(type) {
|
|
|
+ if (type == 1) {
|
|
|
+ const data = await getCode('patrolconfig_code');
|
|
|
+ this.addForm.code = data;
|
|
|
+ }
|
|
|
+ if (type == 2) {
|
|
|
+ const data = await getCode('maintainconfig_code');
|
|
|
+ this.addForm.code = data;
|
|
|
+ }
|
|
|
+ if (type == 5) {
|
|
|
+ const data = await getCode('quantity_code');
|
|
|
+ this.addForm.code = data;
|
|
|
+ }
|
|
|
},
|
|
|
- async addRule() {
|
|
|
- let boolen = this.ruleIdList.every((item) => {
|
|
|
- return this.ruleId != item.ruleId;
|
|
|
- });
|
|
|
- if (boolen) {
|
|
|
- this.ruleObj.ruleItems = await this._getMatterRulesDetails(
|
|
|
- this.ruleId
|
|
|
- );
|
|
|
-
|
|
|
- for (let i = 0; i < this.ruleObj.ruleItems.length; i++) {
|
|
|
- const id = this.getByIdData?.categoryId;
|
|
|
- const name = this.getByIdData?.categoryName;
|
|
|
-
|
|
|
- this.ruleObj.ruleItems[i].categoryId = id;
|
|
|
- this.ruleObj.ruleItems[i].categoryName = name;
|
|
|
-
|
|
|
- this.ruleObj.ruleItems[i].isNew = true;
|
|
|
+ // 提交
|
|
|
+ submit() {
|
|
|
+ // 验证表单
|
|
|
+ this.$refs.addFormRef.validate(async (valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- this.ruleIdList.push(deepClone(this.ruleObj));
|
|
|
+ // 处理数据
|
|
|
+ console.log('this.addForm', this.addForm);
|
|
|
|
|
|
- console.log('this.ruleIdList--------', this.ruleIdList);
|
|
|
+ try {
|
|
|
+ let deviceInfo = this.deviceList[0] || {};
|
|
|
|
|
|
- this.addDialog = false;
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.ruleIdList.length == 1) {
|
|
|
- this.tabsValue = this.ruleIdList[0].ruleId;
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message.error('请误重复添加规则');
|
|
|
- }
|
|
|
+ // 请求参数
|
|
|
+ const body = {
|
|
|
+ planList: [
|
|
|
+ {
|
|
|
+ ...this.addForm,
|
|
|
+ executorId: this.addForm.executorId.join(','),
|
|
|
+ planDeviceList: [
|
|
|
+ {
|
|
|
+ deviceId: deviceInfo.id,
|
|
|
+ codeNumber: deviceInfo.codeNumber,
|
|
|
+ workItems: this.ruleInfo.ruleItems
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ produceRoutingId: this.workOrderInfo.produceRoutingId,
|
|
|
+ produceRoutingName: this.workOrderInfo.produceRoutingName,
|
|
|
+ produceTaskConfigId: this.productionInfo.produceTaskConfigId,
|
|
|
+ produceTaskId: this.productionInfo.produceTaskId,
|
|
|
+ reportWorkType: this.productionInfo.reportWorkType,
|
|
|
+ ruleId: this.productionInfo.ruleId,
|
|
|
+ workOrderCode: this.workOrderInfo.code,
|
|
|
+ workOrderId: this.workOrderInfo.id,
|
|
|
+ batchNo: this.workOrderInfo.batchNo,
|
|
|
+ executeMethod: this.productionInfo.executeMethod,
|
|
|
+ formingNum: this.workOrderInfo.formingNum,
|
|
|
+ productCode: this.workOrderInfo.productCode,
|
|
|
+ productModel: this.workOrderInfo.productModel,
|
|
|
+ productName: this.workOrderInfo.productName,
|
|
|
+ specification: this.workOrderInfo.specification,
|
|
|
+ isTempRecord: 0,
|
|
|
+ itemType: this.productionInfo.itemType
|
|
|
+ };
|
|
|
+
|
|
|
+ console.log('body', body);
|
|
|
+
|
|
|
+ await saveRuleRecord(body);
|
|
|
+ this.$message.success('派单成功!');
|
|
|
+ this.resetFormDate();
|
|
|
+ this.visible = false;
|
|
|
+ this.$emit('reload');
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error('派单失败!');
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- onClose() {
|
|
|
- console.log('关闭窗口');
|
|
|
- this.visible = false;
|
|
|
+ // 重置表单
|
|
|
+ resetFormDate() {
|
|
|
+ this.$refs.addFormRef.resetFields();
|
|
|
+ this.addForm = formData;
|
|
|
}
|
|
|
}
|
|
|
};
|