ysy 2 роки тому
батько
коміт
37c73af78d

+ 10 - 2
src/api/technology/version/version.js

@@ -27,7 +27,6 @@ export async function versionDetail(id) {
 
 
 // 生产版本新增、编辑
-
 export async function versionSave(data) {
   const res = await request.post('/main/produceversion/save', data);
   if (res.data.code == 0) {
@@ -72,4 +71,13 @@ export async function syncVersion(data) {
     return res.data.code;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+// 根据工艺路线编码获取历史版本
+export async function getHistoryByCode(id) {
+  const res = await request.get(`/main/producerouting/getHistoryByCode/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 2 - 2
src/views/material/product/index.vue

@@ -25,14 +25,14 @@
           >
             <!-- 表头工具栏 -->
             <template v-slot:action="{ row }">
-              <!-- <el-link
+               <el-link
                 type="primary"
                 :underline="false"
                 icon="el-icon-edit"
                 @click="handleEdit(row)"
               >
                 修改
-              </el-link> -->
+              </el-link> 
             </template>
           </ele-pro-table>
         </template>

+ 126 - 0
src/views/technology/route/components/historyModal.vue

@@ -0,0 +1,126 @@
+<template>
+    <el-dialog title="历史版本" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+        :close-on-press-escape="false" append-to-body width="60%">
+ 
+                    <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
+                        class="dict-table">
+                        <!-- 表头工具栏 -->
+                        <template v-slot:action="{ row }">
+                            <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
+                        </template>
+                    </ele-pro-table>
+ 
+ 
+    </el-dialog>
+</template>
+  
+<script>
+import AssetTree from '@/components/AssetTree';
+import { getHistoryByCode } from '@/api/technology/version/version.js';
+export default {
+    components: { AssetTree },
+    data() {
+        return {
+            visible: false,
+            // 表格列配置
+            columns: [
+                {
+                    columnKey: 'index',
+                    type: 'index',
+                    width: 45,
+                    align: 'center',
+                    reserveSelection: true
+                },
+                {
+                    prop: 'code',
+                    label: '产品编码'
+                },
+                {
+                    prop: 'name',
+                    label: '产品名称',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'brandNum',
+                    label: '牌号'
+                },
+                {
+                    prop: 'modelType',
+                    label: '型号'
+                },
+                {
+                    prop: 'measuringUnit',
+                    label: '计量单位'
+                },
+                {
+                    prop: 'packingUnit',
+                    label: '包装单位'
+                },
+             
+            ],
+         
+            form: null
+        }
+    },
+
+    watch: {
+
+    },
+    methods: {
+        /* 表格数据源 */
+        datasource({ page, where, limit }) {
+            return getHistoryByCode(this.form.id);
+        },
+
+
+        open(item) {
+            if (item) {
+             this.form = item
+             console.log( this.form )
+            }
+            this.visible = true
+        },
+
+
+        handleClose() {
+            this.visible = false
+            this.current = null
+            this.radio = ''
+        },
+
+    }
+}
+</script>
+  
+<style lang="scss" scoped>
+.tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+}
+
+.table_col {
+    padding-left: 10px;
+
+    ::v-deep .el-table th.el-table__cell {
+        background: #f2f2f2;
+    }
+}
+
+.pagination {
+    text-align: right;
+    padding: 10px 0;
+}
+
+.btns {
+    text-align: center;
+    padding: 10px 0;
+}
+
+.topsearch {
+    margin-bottom: 15px;
+}
+</style>
+  

+ 1 - 1
src/views/technology/route/components/user-search.vue

@@ -65,7 +65,7 @@
       const defaultWhere = {
         code: '',
         name: '',
-        status: ''
+        status: -1
       };
       return {
         // 表单数据

+ 203 - 235
src/views/technology/route/index.vue

@@ -4,32 +4,14 @@
       <!-- 搜索表单 -->
       <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"
-            @click="openEdit(null)"
-          
-          >新增</el-button>
+        <template v-slot:toolbar>
+          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
+            @click="openEdit(null)">新增</el-button>
 
-          <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-refresh-left"
-            class="ele-btn-icon"
-            @click='refreshData'
-            :loading="loading"
-          >刷新</el-button>
+          <el-button size="small" type="primary" icon="el-icon-refresh-left" class="ele-btn-icon" @click='refreshData'
+            :loading="loading">刷新</el-button>
         </template>
 
         <!-- 状态列 -->
@@ -39,245 +21,231 @@
 
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-        <el-link
-            type="primary"
-            :underline="false"
-            icon="el-icon-edit"
-            @click="openEdit(row)"
-          >
+          <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>
+          <el-link type="primary" :underline="false" icon="el-icon-setting" @click="openSetting(row)">
             配置工序
           </el-link>
 
-         <el-popconfirm
-            v-if="row.status != 1"
-            class="ele-action"
-            title="确定要删除当前工序吗?"
-            @confirm="remove(row)"
-          >
+          <el-popconfirm v-if="row.status != 1" class="ele-action" title="确定要删除当前工序吗?" @confirm="remove(row)">
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
                 删除
               </el-link>
             </template>
-          </el-popconfirm> 
+          </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-edit :visible.sync="showEdit" :data="current" @done="reload" ref="userEdit" />
     <!-- 自身工序弹窗 -->
-    <user-taskinstance
-      :visible.sync="showTaskinstance"
-      :data="current"
-      ref="userTaskinstance"
-    />
+    <user-taskinstance :visible.sync="showTaskinstance" :data="current" ref="userTaskinstance" />
+
+    <!-- 历史版本弹框 -->
+    <historyModal  ref="historyRefs"></historyModal>
+
+
   </div>
 </template>
 
 <script>
-  import UserSearch from './components/user-search.vue';
-  import UserEdit from './components/user-edit.vue';
-  import UserTaskinstance from './components/user-taskinstance.vue';
+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 {
+  name: 'technologyRoute',
+  components: {
+    UserSearch,
+    UserEdit,
+    UserTaskinstance,
+    historyModal
+  },
+  data() {
+    return {
+      // 表格列配置
+      columns: [
+        // {
+        //   columnKey: 'selection',
+        //   type: 'selection',
+        //   width: 45,
+        //   align: 'center',
+        //   fixed: 'left'
+        // },
 
-  import route from '@/api/technology/route';
+        {
+          prop: 'code',
+          label: '工艺路线组编码',
+          // sortable: 'custom',
+          showOverflowTooltip: true,
+          align: 'center',
 
-  export default {
-    name: 'technologyRoute',
-    components: {
-      UserSearch,
-      UserEdit,
-      UserTaskinstance
-    },
-    data() {
-      return {
-        // 表格列配置
-        columns: [
-          // {
-          //   columnKey: 'selection',
-          //   type: 'selection',
-          //   width: 45,
-          //   align: 'center',
-          //   fixed: 'left'
-          // },
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '工艺路线名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          align: 'center',
+          prop: 'categoryCode',
+          label: '产品编码',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'categoryName',
+          label: '产品名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'version',
+          label: '工艺路线版本',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          slot: 'status',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
 
-          {
-            prop: 'code',
-            label: '工艺路线组编码',
-            // sortable: 'custom',
-            showOverflowTooltip: true,
-            align: 'center',
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 220,
+          align: 'left',
+          resizable: false,
+          slot: 'action',
 
-            minWidth: 110
-          },
-          {
-            prop: 'name',
-            label: '工艺路线名称',
-            showOverflowTooltip: true,
-            align: 'center',
-            minWidth: 110
-          },
-          {
-            align: 'center',
-            prop: 'categoryCode',
-            label: '产品编码',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'categoryName',
-            label: '产品名称',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'version',
-            label: '工艺路线版本',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'status',
-            label: '状态',
-            align: 'center',
-            slot: 'status',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
+        }
+      ],
+      showTaskinstance: false,
+      // 表格选中数据
+      selection: [],
+      // 当前编辑数据
+      current: null,
+      // 是否显示编辑弹窗
+      showEdit: false,
 
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 220,
-            align: 'left',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
-          }
-        ],
-        showTaskinstance: false,
-        // 表格选中数据
-        selection: [],
-        // 当前编辑数据
-        current: null,
-        // 是否显示编辑弹窗
-        showEdit: false,
-        // 是否显示导入弹窗
-        showImport: false,
-        statusList: [
-          { label: '草稿', value: -1 },
-          { label: '失效', value: 0 },
-          { label: '生效', value: 1 }
-        ],
-        loading:false
-      };
+      statusList: [
+        { label: '草稿', value: -1 },
+        { label: '失效', value: 0 },
+        { label: '生效', value: 1 }
+      ],
+      loading: false
+    };
+  },
+  methods: {
+    /* 表格数据源 */
+    async datasource({ page, limit, where, order }) {
+      const res = await route.list({
+        ...where,
+        ...order,
+        pageNum: page,
+        size: limit
+      });
+      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;
     },
-    methods: {
-      /* 表格数据源 */
-      async datasource({ page, limit, where, order }) {
-        const res = await route.list({
-          ...where,
-          ...order,
-          pageNum: page,
-          size: limit
-        });
-        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;
-      },
 
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ page: 1, where: where });
-      },
-      /* 打开编辑弹窗 */
-      openEdit(row) {
-        this.current = row;
-        this.showEdit = true;
-        this.$refs.userEdit.$refs.form &&
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where: where });
+    },
+    /* 打开编辑弹窗 */
+    openEdit(row) {
+      this.current = row;
+      this.showEdit = true;
+      this.$refs.userEdit.$refs.form &&
         this.$refs.userEdit.$refs.form.clearValidate();
-      },
-      /* 打开导入弹窗 */
-      openImport() {
-        this.showImport = true;
-      },
-      /* 删除 */
-      remove(row) {
-        const loading = this.$loading({ lock: true });
+    },
+   /* 打开历史版本 */
+   openHistory(row) {
+     this.$refs.historyRefs.open(row)
+   },
+    /* 删除 */
+    remove(row) {
+      const loading = this.$loading({ lock: true });
 
-        route
-          .delete(row.id)
-          .then((msg) => {
-            loading.close();
-            this.$message.success('删除' + msg);
-            this.reload();
-          })
-          .catch((e) => {
-            loading.close();
-            // this.$message.error(e.message);
-          });
-      },
-      /* 批量删除 */
-      removeBatch() {
-        if (!this.selection.length) {
-          this.$message.error('请至少选择一条数据');
-          return;
-        }
-        this.$confirm('确定要删除选中的工序吗?', '提示', {
-          type: 'warning'
+      route
+        .delete(row.id)
+        .then((msg) => {
+          loading.close();
+          this.$message.success('删除' + msg);
+          this.reload();
         })
-          .then(() => {
-            const loading = this.$loading({ lock: true });
-            producetask
-              .delete(this.selection.map((d) => d.id))
-              .then((msg) => {
-                loading.close();
-                this.$message.success('删除' + msg);
-                this.reload();
-              })
-              .catch((e) => {
-                loading.close();
-                // this.$message.error(e.message);
-              });
-          })
-          .catch(() => {});
-      },
-      
-      // 刷新数据
-      refreshData(){
-          this.loading = true;
-          route.syncRouting().then(res=>{
-             if(res=='0'){
-               this.loading = false;
-                this.$message.success('数据刷新成功!')
-                this.reload()
-             }
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
+        .catch((e) => {
+          loading.close();
+          // this.$message.error(e.message);
+        });
+    },
+    /* 批量删除 */
+    removeBatch() {
+      if (!this.selection.length) {
+        this.$message.error('请至少选择一条数据');
+        return;
       }
-      
+      this.$confirm('确定要删除选中的工序吗?', '提示', {
+        type: 'warning'
+      })
+        .then(() => {
+          const loading = this.$loading({ lock: true });
+          producetask
+            .delete(this.selection.map((d) => d.id))
+            .then((msg) => {
+              loading.close();
+              this.$message.success('删除' + msg);
+              this.reload();
+            })
+            .catch((e) => {
+              loading.close();
+              // this.$message.error(e.message);
+            });
+        })
+        .catch(() => { });
+    },
+
+    // 刷新数据
+    refreshData() {
+      this.loading = true;
+      route.syncRouting().then(res => {
+        if (res == '0') {
+          this.loading = false;
+          this.$message.success('数据刷新成功!')
+          this.reload()
+        }
+      })
+        .catch((e) => {
+          this.loading = false;
+        });
     }
-  };
+
+  }
+};
 </script>

+ 1 - 1
src/views/technology/version/components/bomModal.vue

@@ -8,7 +8,7 @@
             <!-- 表格 -->
 
             <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
-                :need-page="false" class="dict-table" @cell-click="cellClick">
+            :need-page="true" class="dict-table" @cell-click="cellClick">
 
 
                 <!-- 表头工具栏 -->

+ 3 - 19
src/views/technology/version/components/route-search.vue

@@ -27,19 +27,7 @@
           />
         </el-form-item>
       </el-col> -->
-      <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 4 }">
-        <el-form-item label="状态:" label-width="70px">
-          <el-select v-model="where.status" filterable placeholder="请选择">
-            <el-option
-              v-for="item in statusList"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value"
-            >
-            </el-option>
-          </el-select>
-        </el-form-item>
-      </el-col>
+
 
       <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
         <el-form-item label-width="20px">
@@ -65,16 +53,12 @@
       const defaultWhere = {
         code: '',
         name: '',
-        status: ''
+        status: 1
       };
       return {
         // 表单数据
         where: { ...defaultWhere },
-        statusList: [
-          { label: '草稿', value: -1 },
-          { label: '失效', value: 0 },
-          { label: '生效', value: 1 }
-        ]
+   
       };
     },
     computed: {

+ 1 - 12
src/views/technology/version/components/routeModal.vue

@@ -8,7 +8,7 @@
             <!-- 表格 -->
 
             <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
-                :need-page="false" class="dict-table" @cell-click="cellClick">
+                :need-page="true" class="dict-table" @cell-click="cellClick">
 
                 <!-- 状态列 -->
                 <template v-slot:status="{ row }">
@@ -46,7 +46,6 @@ export default {
                     label: '工艺路线组编码',
                     showOverflowTooltip: true,
                     align: 'center',
-
                     minWidth: 110
                 },
                 {
@@ -165,13 +164,6 @@ export default {
 </script>
   
 <style lang="scss" scoped>
-.tree_col {
-    border: 1px solid #eee;
-    padding: 10px 0;
-    box-sizing: border-box;
-    height: 500px;
-    overflow: auto;
-}
 
 .table_col {
     padding-left: 10px;
@@ -191,8 +183,5 @@ export default {
     padding: 10px 0;
 }
 
-.topsearch {
-    margin-bottom: 15px;
-}
 </style>