695593266@qq.com 1 неделя назад
Родитель
Сommit
712bac0308

+ 16 - 0
src/api/technology/production/index.js

@@ -45,6 +45,22 @@ export default {
       return res.data;
     }
   },
+  //发布
+  publish: async (data) => {
+    const res = await request.post('/main/producetask/publish', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
+  //历史版本
+  history: async (taskId) => {
+    const res = await request.get(`/main/producetask/history/${taskId}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  },
   //删除
   delete: async (data) => {
     const res = await request.delete('/main/producetask/delete', { data });

+ 0 - 1
src/views/factoryModel/station/components/edit.vue

@@ -985,7 +985,6 @@
               factoryName: res.factoryName
             }
           };
-
           // this.form = this.deepCopy(Object.assign({}, this.form, res));
 
           // console.log(this.form, 'this.form1');

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

@@ -742,11 +742,12 @@
     },
     computed: {
       totalTime() {
+        const workBeat = this.form.workBeat || {};
         let to =
-          (-this.form.workBeat.restTimes +
-            -this.form.workBeat.preTimes +
-            -this.form.workBeat.proTimes +
-            -this.form.workBeat.otherTimes) *
+          (-workBeat.restTimes +
+            -workBeat.preTimes +
+            -workBeat.proTimes +
+            -workBeat.otherTimes) *
           -1;
         return to;
       },
@@ -825,9 +826,18 @@
           console.log(this.form, 'this.form');
           if (this.data) {
             const res = await producetask.getById(this.data.id);
+            const defaultData = this.defaultForm();
 
             this.$util.assignObject(this.form, {
-              ...res
+              ...res,
+              intervalTime: {
+                ...defaultData.intervalTime,
+                ...((res && res.intervalTime) || {})
+              },
+              workBeat: {
+                ...defaultData.workBeat,
+                ...((res && res.workBeat) || {})
+              }
             });
 
             this.isUpdate = true;

+ 21 - 7
src/views/technology/production/index.vue

@@ -108,6 +108,10 @@
           {{ typeLabel(row.type) }}
         </template>
 
+        <template v-slot:version="{ row }">
+          <span v-if="row.version">{{ 'V ' + row.version + '.0' }}</span>
+        </template>
+
         <template v-slot:processLabel="{ row }">
           <el-tag v-if="row.processLabel == 1">自制</el-tag>
           <el-tag v-if="row.processLabel == 2" type="success">委外</el-tag>
@@ -177,6 +181,10 @@
               <el-link type="primary" :underline="false"> 发布 </el-link>
             </template>
           </el-popconfirm>
+
+          <el-link type="primary" :underline="false" @click="openHistory(row)">
+            历史版本
+          </el-link>
         </template>
       </ele-pro-table>
     </el-card>
@@ -225,6 +233,8 @@
     <userSettingMatterProcessDrawer
       ref="userSettingMatterProcessDrawerRef"
     ></userSettingMatterProcessDrawer>
+
+    <history-modal ref="historyModalRef" />
   </div>
 </template>
 
@@ -244,6 +254,7 @@
   import dictMixins from '@/mixins/dictMixins';
   import productionCheck from './components/productionCheck.vue';
   import { getFactoryarea } from '@/api/factoryModel';
+  import HistoryModal from './components/history-modal.vue';
 
   export default {
     name: 'technologyProduction',
@@ -257,7 +268,8 @@
       WorkCenter,
       userSettingMatter,
       userSettingMatterProcessDrawer,
-      productionCheck
+      productionCheck,
+      HistoryModal
     },
     data() {
       return {
@@ -357,7 +369,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 230,
+            width: 300,
             align: 'center',
             resizable: false,
             slot: 'action',
@@ -566,15 +578,17 @@
         this.openEdit(row, true);
       },
 
+      openHistory(row) {
+        this.$refs.historyModalRef.open(row);
+      },
+
       async release(row) {
         const loading = this.$loading({ lock: true });
         try {
-          const detail = await producetask.getById(row.id);
-          await producetask.save({
-            ...detail,
-            isRelease: 1
+          const res = await producetask.publish({
+            taskId: row.id
           });
-          this.$message.success('发布成功');
+          this.$message.success((res && res.message) || '发布成功');
           this.reload();
         } finally {
           loading.close();