ysy 2 ani în urmă
părinte
comite
fcaaff3ff3

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

@@ -96,7 +96,7 @@ export default {
   save: async (data) => {
     const res = await request.post('/main/producerouting/save', data);
     if (res.data.code == 0) {
-      return res.data.message;
+      return res.data.data;
     }
   },
   //删除

+ 1 - 1
src/views/material/product/components/link-msg.vue

@@ -113,7 +113,7 @@
           },
           {
             label: '生产版本',
-            prop: ''
+            prop: 'produceVersionName'
           },
           {
             label: '工艺路线版本',

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

@@ -13,12 +13,12 @@
 
         <el-col :span="8">
           <el-form-item label="工艺路线组名称:" prop="name">
-            <el-input v-model="form.name" clearable placeholder="请输入" />
+            <el-input v-model="form.name" :disabled="isUpdate" clearable placeholder="请输入" />
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="所属工厂:" prop="factoryId">
-            <el-select v-model="form.factoryId" placeholder="请选择" filterable>
+            <el-select v-model="form.factoryId" placeholder="请选择" filterable :disabled="isUpdate">
               <el-option v-for="item in fList" :key="item.id" :label="item.name" :value="item.id">
               </el-option>
             </el-select>
@@ -26,7 +26,7 @@
         </el-col>
 
         <el-col :span="8">
-          <el-form-item label="生产版本:" prop="produceVersionId">
+          <el-form-item label="生产版本:" prop="produceVersionId" :disabled="isUpdate">
             <el-select v-model="form.produceVersionId" filterable placeholder="请选择" :style="{ width: '100%' }">
               <el-option v-for="item in versionList" :key="item.code" :label="item.code + '-' + item.name"
                 :value="item.id">
@@ -43,7 +43,7 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="状态:" prop="status">
-            <el-select v-model="form.status" placeholder="" filterable>
+            <el-select v-model="form.status" placeholder="" filterable :disabled="isUpdate">
               <el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value">
               </el-option>
             </el-select>
@@ -52,16 +52,26 @@
 
 
       </el-row>
+
     </el-form>
 
+    <user-taskinstance v-if="step == 2" :taskInfo="form" @refresh="refresh" />
+
     <template v-slot:footer>
-      <el-button @click="updateVisible(false)">取消</el-button>
-      <el-button type="primary" :loading="loading" @click="save">
-        保存
+      <el-button type="primary" v-if="step == 1" :loading="loading" @click="save">
+        确定
       </el-button>
+
+
+
+
     </template>
 
 
+
+
+
+
   </ele-modal>
 </template>
 
@@ -69,10 +79,10 @@
 
 import route from '@/api/technology/route';
 import { pageList } from '@/api/technology/version/version.js';
-
+import UserTaskinstance from './user-taskinstance.vue';
 export default {
   components: {
-
+    UserTaskinstance
   },
   props: {
     // 弹窗是否打开
@@ -94,8 +104,7 @@ export default {
     return {
       defaultForm,
       fList: [], //仓库列表
-      categoryCode: '',
-      categoryName: '',
+
       // 表单数据
       form: { ...defaultForm },
 
@@ -122,13 +131,20 @@ export default {
         ],
         version: [
           { required: true, message: '请输入工艺路线版本', trigger: 'blur' }
+        ],
+        produceVersionId: [
+        { required: true, message: '请输入生产版本', trigger: 'blur' }
         ]
+
       },
       versionList: [],
       // 提交状态
       loading: false,
       // 是否是修改
-      isUpdate: false
+      isUpdate: false,
+
+      step: 1,
+
     };
   },
   computed: {
@@ -154,20 +170,21 @@ export default {
         }
 
         this.loading = true;
-        let title = this.isUpdate ? '修改' : '新建'; // 提交的名称或编号是否有效率有用的标识,
+
 
 
         route
           .save(this.form)
-          .then((msg) => {
-            this.form = {};
-            this.categoryName = '';
-            this.categoryCode = '';
+          .then((data) => {
+            if (!this.isUpdate) {
+              this.form.id = data
+              this.step = 2
+            }
+
+
             this.loading = false;
-            let tit = title + msg;
-            this.$message.success(tit);
-            this.updateVisible(false);
-            this.$emit('done');
+            this.$message.success('操作成功');
+
           })
           .catch((e) => {
             this.loading = false;
@@ -185,16 +202,25 @@ export default {
       this.versionList = res.list;
     },
 
+
     /* 更新visible */
     updateVisible(value) {
       this.$emit('update:visible', value);
-    }
+    },
+
+    refresh() {
+      this.updateVisible(false)
+      this.$emit('done')
+    },
+
+
   },
 
   watch: {
     async visible(visible) {
 
       if (visible) {
+        this.step = 1
         this.getVersionList()
         const res = await route.Flist({
           pageNum: 1,
@@ -203,15 +229,18 @@ export default {
         });
         this.fList = res.list;
         if (this.data) {
+
           const res = await route.getById(this.data.id);
 
           this.$util.assignObject(this.form, {
             ...res
           });
+          this.step = 2
           this.isUpdate = true;
         } else {
           const res = await route.getCode();
           this.form.code = res;
+          this.step = 1
           this.isUpdate = false;
         }
       } else {

+ 55 - 82
src/views/technology/route/components/user-taskinstance.vue

@@ -1,9 +1,8 @@
 <!-- 用户编辑弹窗 -->
 <template>
-  <ele-modal width="1060px" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
-    custom-class="ele-dialog-form" :title="`给工序【${this.data?.code}${this.data?.name}】配置工序`"
-    @update:visible="updateVisible">
+  <div>
     <div class="ele-body">
+
       <ele-pro-table ref="table" :needPage="false" :columns="columns" :datasource="datasource" row-key="id">
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
@@ -12,17 +11,19 @@
           </el-button>
         </template>
 
-        <!-- 状态列 -->
+        <template v-slot:sort="{ row }">
+          <el-input v-model.number="row.sort" placeholder="请输入排序"></el-input>
+        </template>
 
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
           <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit(row)">
             修改
           </el-link>
-          <el-link :type="row.id ? 'primary' : 'info'" :underline="false" icon="el-icon-setting"
+          <!-- <el-link :type="row.id ? 'primary' : 'info'" :underline="false" icon="el-icon-setting"
             @click="openSetting(row)">
             配置工艺参数
-          </el-link>
+          </el-link> -->
           <el-popconfirm class="ele-action" title="删除数据操作立即生效!!!确定要删除当前工序吗?" @confirm="remove(row)">
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -32,17 +33,21 @@
           </el-popconfirm>
         </template>
       </ele-pro-table>
+
+      <div class="btn_box rx-bc">
+        <el-select v-model="versionUpgradeType" placeholder="请选择">
+          <el-option label="不升级" :value="0" />
+          <el-option label="小版本" :value="1" />
+          <el-option label="大版本" :value="2" />
+        </el-select>
+        <el-button type="primary" @click="save">
+          确定
+        </el-button>
+      </div>
+
     </div>
 
-    <template v-slot:footer>
-      <el-button @click="updateVisible(false)">取消</el-button>
-      <el-button type="primary" :loading="loading" @click="save(false)">
-        保存
-      </el-button>
-      <el-button type="primary" :loading="loading" @click="save(true)">
-        保存并关闭
-      </el-button>
-    </template>
+
     <ele-modal width="1720px" :visible="addDialog" :append-to-body="true" :close-on-click-modal="true"
       @update:visible="closeAdd">
       <Production :data="tableData" ref="ProductionCom" />
@@ -57,7 +62,7 @@
     <user-edit :visible.sync="showEdit" :controlList="controlList" :data="current" @done="reload" ref="userEdit" />
     <!-- 配置工艺参数 -->
     <user-setting :visible.sync="showSetting" :data="current" ref="userSetting" />
-  </ele-modal>
+  </div>
 </template>
 
 <script>
@@ -69,10 +74,9 @@ import control from '@/api/technology/control';
 export default {
   components: { Production, UserEdit, UserSetting },
   props: {
-    // 弹窗是否打开
-    visible: Boolean,
+
     // 修改回显的数据
-    data: Object
+    taskInfo: Object
   },
   data() {
     return {
@@ -82,15 +86,24 @@ export default {
       ],
       // 表格列配置
       columns: [
+
+        {
+          prop: 'sort',
+          label: '排序',
+          align: 'center',
+          slot: 'sort',
+          minWidth: 160
+        },
         {
           prop: 'code',
           label: '工序编码',
           // sortable: 'custom',
           showOverflowTooltip: true,
           align: 'center',
-
           minWidth: 110
         },
+
+
         {
           prop: 'name',
           label: '工序名称',
@@ -131,7 +144,10 @@ export default {
       current: {},
       removeList: [],
       tableData: [],
-      controlList: []
+      controlList: [],
+
+      visible: true,
+      versionUpgradeType: 0
     };
   },
 
@@ -156,9 +172,7 @@ export default {
     showAddLog() {
       this.tableData = this.$refs.table.getData();
       this.addDialog = true;
-      // this.$nextTick(() => {
-      //   this.$refs.ProductionCom.reload();
-      // });
+
     },
     /* 打开编辑弹窗 */
     openEdit(row) {
@@ -170,9 +184,6 @@ export default {
     },
 
     getControlList() {
-      const params = {
-        pageNum: 1, size: -1
-      }
       control.list().then(res => {
         this.controlList = res.list
       })
@@ -210,10 +221,9 @@ export default {
     },
     /* 表格数据源 */
     async datasource({ page, limit, where }) {
-      if (this.data?.id) {
-        console.log(22222);
+      if (this.taskInfo?.id) {
         const res = await route.taskinstanceList({
-          routingId: this.data.id,
+          routingId: this.taskInfo.id,
           isDetail: true,
           pageNum: 1,
           size: -1
@@ -226,7 +236,7 @@ export default {
       }
     },
     /* 保存编辑 */
-    save(isClose) {
+    save() {
       let arr = this.$refs.table.getData();
       if (arr.length == 0) {
         this.$message.warning('至少配置一条工序才能保存');
@@ -244,66 +254,19 @@ export default {
 
       route
         .taskinstanceSave({
-          routingId: this.data.id,
+          routingId: this.taskInfo.id,
+          versionUpgradeType: this.versionUpgradeType,
           taskInstanceList: arr1
         })
         .then((res) => {
           if (res) {
             this.$message.success('保存成功!');
-            if (isClose) {
-              this.updateVisible(false);
-            } else {
-              this.reload();
-            }
+            this.$emit('refresh')
           }
         });
-      // arr.forEach((it) => {
-      //   if (!it.taskId) {
-      //     this.$set(it, 'taskId', this.data.id);
-      //   }
-      // });
-      // producetask
-      //   .paramSave({
-      //     removeList: this.removeList,
-      //     saveList: arr
-      //   })
-      //   .then(() => {
-      //     this.$message.success('保存成功!');
-      //     this.updateVisible(false);
-      //   });
-
-      // this.$refs.form.validate((valid) => {
-      //   if (!valid) {
-      //     return false;
-      //   }
-      //   if (!this.isUpdate) {
-      //     delete this.form.id;
-      //   }
-
-      //   this.form.workBeat.beatTimes = this.totalTime;
 
-      //   this.loading = true;
-      //   producetask
-      //     .save(this.form)
-      //     .then((msg) => {
-      //       this.form = {};
-      //       this.loading = false;
-      //       this.$message.success(msg);
-      //       this.updateVisible(false);
-      //       this.$emit('done');
-      //     })
-      //     .catch((e) => {
-      //       this.loading = false;
-      //       // this.$message.error(e.message);
-      //     });
-      // });
     },
-    /* 更新visible */
-    updateVisible(value) {
-      this.removeList = [];
-      this.$refs.table.setData([]);
-      this.$emit('update:visible', value);
-    }
+
   },
 
   watch: {
@@ -317,3 +280,13 @@ export default {
   }
 };
 </script>
+
+<style lang="scss" scoped>
+.btn_box {
+  width: 100%;
+  margin-top: 10px;
+
+
+
+}
+</style>

+ 22 - 29
src/views/technology/route/index.vue

@@ -4,7 +4,7 @@
       <!-- 搜索表单 -->
       <user-search @search="reload" />
       <!-- 数据表格 -->
-      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
+      <ele-pro-table  ref="table" :columns="columns" :datasource="datasource"  :selection.sync="selection" row-key="id">
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
           <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
@@ -24,8 +24,12 @@
           <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit(row)">
             修改
           </el-link>
-          <el-link type="primary" :underline="false" icon="el-icon-setting" @click="openSetting(row)">
-            配置工序
+
+
+
+
+          <el-link type="primary" :underline="false" icon="el-icon-document" @click="openHistory(row)">
+            历史版本
           </el-link>
 
           <el-popconfirm v-if="row.status != 1" class="ele-action" title="确定要删除当前工序吗?" @confirm="remove(row)">
@@ -36,18 +40,15 @@
             </template>
           </el-popconfirm>
 
-
-          <el-link type="primary" :underline="false" icon="el-icon-document" @click="openHistory(row)">
-            查看历史版本
-          </el-link>
+          
 
         </template>
       </ele-pro-table>
     </el-card>
     <!-- 编辑弹窗 -->
     <user-edit :visible.sync="showEdit" :data="current" @done="reload" ref="userEdit" />
-    <!-- 自身工序弹窗 -->
-    <user-taskinstance :visible.sync="showTaskinstance" :data="current" ref="userTaskinstance" />
+
+
 
     <!-- 历史版本弹框 -->
     <historyModal  ref="historyRefs"></historyModal>
@@ -59,7 +60,7 @@
 <script>
 import UserSearch from './components/user-search.vue';
 import UserEdit from './components/user-edit.vue';
-import UserTaskinstance from './components/user-taskinstance.vue';
+
 import historyModal from './components/historyModal.vue'
 import route from '@/api/technology/route';
 export default {
@@ -67,7 +68,6 @@ export default {
   components: {
     UserSearch,
     UserEdit,
-    UserTaskinstance,
     historyModal
   },
   data() {
@@ -98,27 +98,23 @@ export default {
           align: 'center',
           minWidth: 110
         },
+ 
+
         {
-          align: 'center',
-          prop: 'categoryCode',
-          label: '产品编码',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'categoryName',
-          label: '产品名称',
+          prop: 'version',
+          label: '工艺路线版本',
           align: 'center',
           showOverflowTooltip: true,
           minWidth: 110
         },
+
         {
-          prop: 'version',
-          label: '工艺路线版本',
+          prop: 'produceVersionName',
+          label: '生产版本',
           align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
+          showOverflowTooltip: true
         },
+        
         {
           prop: 'status',
           label: '状态',
@@ -138,7 +134,7 @@ export default {
 
         }
       ],
-      showTaskinstance: false,
+
       // 表格选中数据
       selection: [],
       // 当前编辑数据
@@ -165,10 +161,7 @@ export default {
       });
       return res;
     },
-    openSetting(row) {
-      this.current = row;
-      this.showTaskinstance = true; // 显示编辑弹窗 true/false 不显示弹窗 true/false 不显示
-    },
+
     checkStatus(row) {
       let obj = this.statusList.find((it) => it.value == row.status);
       return obj.label;