695593266@qq.com 9 месяцев назад
Родитель
Сommit
93993bea6a

+ 1 - 1
src/api/technology/route/index.js

@@ -51,7 +51,7 @@ export default {
       data
     );
     if (res.data.code == 0) {
-      return res.data.message;
+      return res.data;
     }
   },
   //工艺路线工序实例-删除

+ 140 - 4
src/views/material/BOMmanage/components/routing.vue

@@ -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);
       },

+ 3 - 1
src/views/material/BOMmanage/components/workingProcedure.vue

@@ -792,6 +792,8 @@
   import { newFilePageAPI } from '@/api/material/file';
   import { getBomGetById, getDetailList } from '@/api/material/BOM.js';
   import mbomDatailList from './mbomDatailList.vue';
+  import { setFileUrl } from '@/components/addDoc/util.js';
+
   export default {
     components: {
       userSearch,
@@ -1251,7 +1253,7 @@
       },
 
       fileDetails(row) {
-        this.$refs.browseRef.setFileUrl(row);
+        window.open(setFileUrl(row));
       },
       addJob() {
         this.$refs.jobRef.open();

+ 1 - 1
src/views/technology/production/components/user-edit.vue

@@ -699,7 +699,7 @@
                 (this.isUpdate ? '修改' : '新建') + msg.message
               );
               this.updateVisible(false);
-              this.$emit('done');
+              this.$emit('done', msg.data);
             })
             .catch((e) => {
               this.loading = false;

+ 22 - 8
src/views/technology/route/components/user-edit.vue

@@ -128,14 +128,18 @@
       visible: Boolean,
       isUpdate: Boolean,
       // 修改回显的数据
-      data: Object
+      data: Object,
+      isBomRoute: {
+        type: Boolean,
+        default: false
+      }
     },
     data() {
       const defaultForm = {
         code: '',
         name: '',
         factoryId: '',
-        status: -1,
+        status: 1,
         categoryId: '',
         produceVersionId: '',
         version: '1.0',
@@ -192,6 +196,14 @@
         removeList: []
       };
     },
+
+    mounted() {
+      console.log(this.isBomRoute, 'isBomRoute');
+      if (this.isBomRoute) {
+        this.form.status = 1;
+      }
+    },
+
     computed: {
       statusTitle() {
         return this.isUpdate ? '修改' : '保存';
@@ -248,12 +260,14 @@
 
           route
             .taskinstanceSave(param)
-            .then((msg) => {
-              if (msg) {
-                this.$message.success(msg);
-                this.updateVisible(false);
-                this.$emit('done');
-              }
+            .then((res) => {
+              console.log(res, 'msg77777');
+
+              // if (msg) {
+              this.$message.success(res.message);
+              this.updateVisible(false);
+              this.$emit('done', res.data);
+              // }
             })
             .finally(() => {});
         });

+ 101 - 3
src/views/technology/route/components/user-taskinstance.vue

@@ -20,6 +20,16 @@
           >
             添加工序
           </el-button>
+
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="showAddProcess"
+          >
+            新增工序
+          </el-button>
         </template>
 
         <template v-slot:orderNum="{ row }">
@@ -90,17 +100,29 @@
       :data="current"
       ref="userSetting"
     />
+
+    <!-- 新增工序 -->
+    <add-process
+      :visible.sync="showProcessEdit"
+      :data="currentData"
+      :controlList="controlList"
+      ref="addProcessRef"
+      :typeList="typeList"
+      @done="reloadProcess"
+    />
   </div>
 </template>
 
 <script>
   import route from '@/api/technology/route';
   import Production from './production';
+  import producetask from '@/api/technology/production';
   import UserEdit from './production/components/user-edit.vue';
   import UserSetting from './production/components/user-setting.vue';
   import control from '@/api/technology/control';
+  import addProcess from '@/views/technology/production/components/user-edit.vue';
   export default {
-    components: { Production, UserEdit, UserSetting },
+    components: { Production, UserEdit, UserSetting, addProcess },
     props: {
       // 修改回显的数据
       taskInfo: Object,
@@ -173,12 +195,42 @@
         addDialog: false,
         showSetting: false,
         showEdit: false,
-        current: {},
+        showProcessEdit: false,
+        current: null,
         removeList: [],
         tableData: [],
         controlList: [],
 
-        visible: true
+        visible: true,
+        showEdit: false,
+        typeList: [
+          {
+            value: 1,
+            label: '普通工序'
+          },
+          // {
+          //   value: 2,
+          //   label: '抽样质检'
+          // },
+
+          {
+            value: 3,
+            label: '抽样质检'
+          },
+          {
+            value: 4,
+            label: '包装工序'
+          },
+          {
+            value: 6,
+            label: '质检工序'
+          },
+          {
+            value: 7,
+            label: '生产准备'
+          }
+        ],
+        currentData: null
       };
     },
 
@@ -259,6 +311,52 @@
         return [];
       },
 
+      reloadProcess(processId) {
+        this.getProcessData(processId);
+      },
+
+      async getProcessData(processId) {
+        const res = await producetask.list({
+          pageNum: 1,
+          isDetail: true,
+          size: -1
+        });
+
+        let data = [];
+
+        if (processId && res.list.length != 0) {
+          const processData = res.list.find((it) => it.id == processId);
+
+          if (processData) {
+            data.push(processData);
+          }
+        }
+
+        if (data.length != 0) {
+          let len = this.$refs.table.getData().length + 1;
+          let arrM = data.map((item, index) => {
+            return { ...item.detail, orderNum: len + index };
+          });
+          arrM.forEach((element) => {
+            if (element.id) {
+              this.$set(element, 'sourceTaskId', element.id);
+              delete element.id;
+            }
+          });
+
+          this.$refs.table.setData([...this.$refs.table.getData(), ...arrM]);
+          this.$emit('taskList', this.$refs.table.getData());
+        }
+      },
+
+      showAddProcess() {
+        this.getControlList();
+        this.currentData = undefined;
+        this.showProcessEdit = true;
+        this.$refs.addProcessRef.$refs.form &&
+          this.$refs.addProcessRef.$refs.form.clearValidate();
+      },
+
       async getList() {
         this.removeList = [];
         if (this.isEdit) {

+ 2 - 2
vue.config.js

@@ -37,13 +37,13 @@ module.exports = {
         // target: 'http://192.168.1.176:18086',
 
         // target: 'http://192.168.1.251:18086',
-        // target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18186',
 
         // target: 'http://192.168.1.251:18087',
 
-        target: 'http://192.168.1.116:18086',
+        // target: 'http://192.168.1.116:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {