|
|
@@ -28,6 +28,22 @@
|
|
|
@click="add"
|
|
|
>新增</el-button
|
|
|
>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ v-if="
|
|
|
+ (attributeData.approvalStatus != 1 &&
|
|
|
+ attributeData.approvalStatus != 2 &&
|
|
|
+ !isWt &&
|
|
|
+ attributeData.parentId == '0') ||
|
|
|
+ !attributeData.resourceBomId
|
|
|
+ "
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="createRoute(null)"
|
|
|
+ >创建工艺路线</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
<!-- 状态列 -->
|
|
|
<template v-slot:status="{ row }">
|
|
|
@@ -63,6 +79,16 @@
|
|
|
</ele-pro-table>
|
|
|
</el-card>
|
|
|
<routingDialog ref="routingDialogRef" @reload="reload"></routingDialog>
|
|
|
+
|
|
|
+ <!-- 编辑弹窗 -->
|
|
|
+ <user-edit
|
|
|
+ :visible.sync="showEdit"
|
|
|
+ :data="current"
|
|
|
+ @done="routeReload"
|
|
|
+ :isUpdate="isUpdate"
|
|
|
+ ref="userEdit"
|
|
|
+ :isBomRoute="isBomRoute"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -70,12 +96,17 @@
|
|
|
import { getMbomPage } from '@/api/material/BOM';
|
|
|
import routingDialog from './routingDialog.vue';
|
|
|
import route from '@/api/technology/route';
|
|
|
-
|
|
|
- import { workingProcedureUpdate } from '@/api/material/BOM';
|
|
|
+ import UserEdit from '@/views/technology/route/components/user-edit.vue';
|
|
|
+ import {
|
|
|
+ workingProcedureUpdate,
|
|
|
+ workingProcedureSave
|
|
|
+ } from '@/api/material/BOM';
|
|
|
+ // import { workingProcedureUpdate } from '@/api/material/BOM';
|
|
|
export default {
|
|
|
name: 'technologyRoute',
|
|
|
components: {
|
|
|
- routingDialog
|
|
|
+ routingDialog,
|
|
|
+ UserEdit
|
|
|
},
|
|
|
props: {
|
|
|
taskParam: Object,
|
|
|
@@ -171,13 +202,15 @@
|
|
|
// 是否显示编辑弹窗
|
|
|
showEdit: false,
|
|
|
detailEdit: false,
|
|
|
+ isUpdate: false,
|
|
|
|
|
|
statusList: [
|
|
|
{ label: '草稿', value: -1 },
|
|
|
{ label: '失效', value: 0 },
|
|
|
{ label: '生效', value: 1 }
|
|
|
],
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ isBomRoute: false
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -191,6 +224,109 @@
|
|
|
|
|
|
this.$refs.routingDialogRef.open(this.taskParam, this.tableData);
|
|
|
},
|
|
|
+
|
|
|
+ createRoute(row) {
|
|
|
+ this.current = row;
|
|
|
+ this.showEdit = true;
|
|
|
+ this.isBomRoute = true;
|
|
|
+ this.$refs.userEdit.isUpdate = true;
|
|
|
+ this.$refs.userEdit.$refs.form &&
|
|
|
+ this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
+ },
|
|
|
+
|
|
|
+ routeReload(routeID) {
|
|
|
+ this.getAllRouteData(routeID);
|
|
|
+ },
|
|
|
+
|
|
|
+ async getAllRouteData(routeID) {
|
|
|
+ const res = await route.list({
|
|
|
+ pageNum: 1,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+
|
|
|
+ const dataList = [];
|
|
|
+
|
|
|
+ if (routeID && res.list.length != 0) {
|
|
|
+ const data = res.list.find((item) => item.id == routeID);
|
|
|
+
|
|
|
+ if (data) {
|
|
|
+ dataList.push(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.selected(dataList);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ selected(dataList) {
|
|
|
+ console.log('1112233');
|
|
|
+ // let routingId = this.selection.map((it) => it.id);
|
|
|
+ let routingId = dataList.map((it) => it.id);
|
|
|
+
|
|
|
+ route.getProcessById(routingId).then((data) => {
|
|
|
+ console.log(this.tableData);
|
|
|
+ if (this.tableData.taskParam) {
|
|
|
+ let newArr = [];
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ let isHas = false;
|
|
|
+ for (let j = 0; j < this.tableData.taskParam.length; j++) {
|
|
|
+ if (
|
|
|
+ data[i].sourceTaskId ==
|
|
|
+ this.tableData.taskParam[j].sourceTaskId
|
|
|
+ ) {
|
|
|
+ isHas = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isHas) {
|
|
|
+ newArr.push(data[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ workingProcedureUpdate({
|
|
|
+ id: this.tableData.id,
|
|
|
+ categoryId: this.taskParam.categoryId,
|
|
|
+ bomCategoryId: this.taskParam.id,
|
|
|
+ categoryCode: this.taskParam.categoryCode,
|
|
|
+ processRoute: {
|
|
|
+ list: this.tableData.processRoute.list.concat(dataList)
|
|
|
+ },
|
|
|
+ taskParam: this.tableData.taskParam.concat(newArr)
|
|
|
+ }).then(() => {
|
|
|
+ // this.$emit('reload');
|
|
|
+ this.reload();
|
|
|
+ this.showEdit = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ workingProcedureSave({
|
|
|
+ categoryId: this.taskParam.categoryId,
|
|
|
+ bomCategoryId: this.taskParam.id,
|
|
|
+ categoryCode: this.taskParam.categoryCode,
|
|
|
+ processRoute: {
|
|
|
+ list: this.selection
|
|
|
+ },
|
|
|
+ taskParam: data.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ versions: this.taskParam.versions,
|
|
|
+ status: this.taskParam.status
|
|
|
+ };
|
|
|
+ })
|
|
|
+ }).then(() => {
|
|
|
+ let taskParam = data.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ versions: this.taskParam.versions,
|
|
|
+ status: this.taskParam.status
|
|
|
+ };
|
|
|
+ });
|
|
|
+ // this.$emit('reload');
|
|
|
+ this.reload();
|
|
|
+ this.showEdit = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
search(e) {
|
|
|
this.reload(this.where);
|
|
|
},
|