Procházet zdrojové kódy

生产版本列表查看页对接提交

LAPTOP-16IUEB3P\Lenovo před 2 roky
rodič
revize
7dbf90af25

+ 18 - 0
src/api/technology/version/version.js

@@ -15,3 +15,21 @@ export async function pageList (params) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 获取生产版本详情
+export async function versionDetail(id) {
+  const res = await request.get(`/main/produceversion/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据工艺路线编码获取工序
+export async function getProcessByRoute(data) {
+  const res = await request.post('/main/producerouting/taskinstance/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 304 - 0
src/views/technology/version/components/link-material-dialog.vue

@@ -0,0 +1,304 @@
+<template>
+  <ele-modal :visible.sync="visible" :title="`给工序【${row.code}${row.name}】分配物料`" width="90%" @close="cancel">
+    <el-row :gutter="40">
+      <el-col :span="12">
+        <headerTitle>
+          <template v-slot:title>
+            可分配
+            <el-button
+              type="primary"
+              class="ml20"
+              size="mini"
+              @click="handleConect"
+              >分配</el-button
+            >
+          </template>
+        </headerTitle>
+        <ele-pro-table
+          ref="table"
+          :columns="columns"
+          :datasource="datasourceShow"
+          :selection.sync="selection"
+          cache-key="link-material-dialog"
+          height="45vh"
+          :initLoad="false"
+          :need-page="false"
+        >
+        </ele-pro-table>
+      </el-col>
+      <el-col :span="12">
+        <headerTitle>
+          <template v-slot:title>
+            已关联
+            <el-button
+              type="primary"
+              class="ml20"
+              size="mini"
+              @click="handleCancelConect"
+              >取消分配</el-button>
+          </template>
+        </headerTitle>
+        <ele-pro-table
+          ref="tableRight"
+          :columns="columnsRight"
+          :datasource="datasourceRightShow"
+          :selection.sync="selectionRight"
+          height="45vh"
+          :initLoad="false"
+          :need-page="false"
+          cache-key="link-material-dialog-right"
+        >
+          <template v-slot:capacity="{ row }">
+            <el-row>
+              <el-col :span="8">
+                <el-input v-model="row.quantity"></el-input
+              ></el-col>
+              <el-col :span="8">
+                <DictSelection
+                  class="line-select"
+                  dictName="重量单位"
+                  clearable
+                  v-model="row.quantityUnitId"
+                >
+                </DictSelection
+              ></el-col>
+              <el-col :span="8">
+                <DictSelection
+                  class="line-select"
+                  dictName="提前期单位"
+                  clearable
+                  v-model="row.timeUnit"
+                >
+                </DictSelection
+              ></el-col>
+            </el-row>
+          </template>
+          <template v-slot:angle="{ row }">
+            <DictSelection dictName="角度" clearable v-model="row.angle">
+            </DictSelection>
+          </template> </ele-pro-table
+      ></el-col>
+    </el-row>
+
+    <div slot="footer" class="footer">
+      <el-button type="primary" @click="save">保存</el-button>
+      <el-button @click="cancel">取消</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import {
+    getRelatesInformationList,
+    unassociated,
+    productTieUpMaterial
+  } from '@/api/material/product.js';
+  import dictMixins from '@/mixins/dictMixins';
+  import categorySelect from '@/components/CommomSelect/category-select.vue';
+  export default {
+    mixins: [dictMixins],
+    components: { categorySelect },
+    data () {
+      return {
+        visible: false,
+        row: {},
+        datasource: [],
+        datasourceShow: [],
+        datasourceRightShow: [],
+        datasourceRight: [],
+        selectionRight: [],
+        selection: [],
+        whereRight: {},
+        where: {},
+        type: '',
+        idMap: {
+          8: '1678278350275198977',
+          4: '1678277959244431361',
+          5: '1678277781556936705'
+        }
+      };
+    },
+    created () {
+      // this.requestDict('类型用途');
+    },
+    computed: {
+      // catogaryName () {
+      //   return this.getDictValue('类型用途', this.type);
+      // },
+      dict () {},
+      columns () {
+        return [
+          {
+            type: 'selection',
+            align: 'center'
+          },
+          {
+            label: '子项编号',
+            prop: 'categoryLevelGroupName'
+          },
+          {
+            label: '子项物料编码',
+            prop: 'code'
+          },
+          {
+            label: '子项物料名称',
+            prop: 'name'
+          },
+          {
+            label: '基本数量',
+            prop: 'modelType'
+          },
+          {
+            label: '单位',
+            prop: 'unit'
+          }
+        ];
+      },
+      columnsRight () {
+        return [
+          {
+            type: 'selection',
+            align: 'center'
+          },
+          {
+            label: '子项编号',
+            prop: 'categoryLevelGroupName'
+          },
+          {
+            label: '子项物料编码',
+            prop: 'code'
+          },
+          {
+            label: '子项物料名称',
+            prop: 'name'
+          },
+          {
+            label: '基本数量',
+            prop: 'modelType'
+          },
+          {
+            label: '单位',
+            prop: 'unit'
+          }
+        ];
+      }
+    },
+    methods: {
+      open (row) {
+        this.row = row;
+        this.getDatasource();
+        this.getDatasourceRight();
+        this.visible = true;
+      },
+      cancel () {
+        this.visible = false;
+      },
+      async save () {
+        if (!this.datasourceRightShow.length) {
+          return this.$message.error('请添加关联数据');
+        }
+        const params = {
+          mainCategoryId: this.row.categoryLevelId,
+          mainCategoryLevelRootId: this.row.categoryLevelGroupId,
+          materialDetailsPOList: this.datasourceRightShow.map((i) => ({
+            ...i,
+            categoryLevelRootId: this.type
+          }))
+        };
+        await productTieUpMaterial(params);
+        this.cancel();
+
+        this.$message.success('操作成功!');
+        this.$emit('success');
+      },
+      handleConect () {
+        if (!this.selection.length) {
+          return this.$message.error('请选择关联数据');
+        }
+        this.datasource = this.datasource.filter((i) =>
+          this.selection.find((t) => t.categoryId != i.categoryId)
+        );
+        this.datasourceShow = this.datasourceShow.filter((i) =>
+          this.selection.find((t) => t.categoryId != i.categoryId)
+        );
+
+        this.datasourceRightShow.push(...this.selection);
+        this.datasourceRight.push(...this.selection);
+
+        this.selection = [];
+      },
+      handleCancelConect () {
+        if (!this.selectionRight.length) {
+          return this.$message.error('请选择取消关联数据');
+        }
+
+        this.datasourceRight = this.datasourceRight.filter((i) =>
+          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+        );
+        this.datasourceRightShow = this.datasourceRightShow.filter((i) =>
+          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+        );
+
+        this.datasourceShow.push(...this.selectionRight);
+        this.datasource.push(...this.selectionRight);
+
+        this.selectionRight = [];
+      },
+      reload () {
+        this.datasourceShow = this.datasource.filter((item) => {
+          return (
+            (!this.where.categoryLevelGroupId ||
+              item.categoryLevelGroupId.includes(
+                this.where.categoryLevelGroupId
+              )) &&
+            (!this.where.code || item.code.includes(this.where.code)) &&
+            (!this.where.name || item.name.includes(this.where.name)) &&
+            (!this.where.modelType ||
+              item.modelType.includes(this.where.modelType))
+          );
+        });
+      },
+      reloadRight () {
+        this.datasourceRightShow = this.datasourceRight.filter((item) => {
+          return (
+            (!this.whereRight.categoryLevelGroupId ||
+              item.categoryLevelGroupId.includes(
+                this.whereRight.categoryLevelGroupId
+              )) &&
+            (!this.whereRight.code ||
+              item.code.includes(this.whereRight.code)) &&
+            (!this.whereRight.name ||
+              item.name.includes(this.whereRight.name)) &&
+            (!this.whereRight.modelType ||
+              item.modelType.includes(this.whereRight.modelType))
+          );
+        });
+      },
+      async getDatasource () {
+        const data = await unassociated({
+          categoryLevelGroupId: this.idMap[this.type]
+        });
+        this.datasource = data.slice(0);
+        this.datasourceShow = data.slice(0);
+      },
+      async getDatasourceRight () {
+        const data = await getRelatesInformationList({
+          mainCategoryId: this.row.categoryLevelId,
+          // categoryLevelGroupId: this.idMap[this.type],
+          categoryLevelRootId: this.type
+        });
+        this.datasourceRight = data.slice(0);
+        this.datasourceRightShow = data.slice(0);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .ml20 {
+    margin-left: 20px;
+  }
+  .footer {
+    text-align: right;
+  }
+</style>

+ 66 - 66
src/views/technology/version/details.vue

@@ -11,28 +11,27 @@
            <el-row>
              <el-col :span="8">
                <el-form-item label="版本号">
-                 <span>  </span>
+                 <span> {{infoData.code}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="版本名称">
-                 <span>  </span>
+                 <span> {{infoData.name}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="所属工厂">
-                 <span>
-                 </span>
+                 <span> {{infoData.factoryName}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品编码">
-
+                   <span> {{infoData.categoryCode}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品名称">
-                 <span> </span>
+                 <span> {{infoData.categoryName}} </span>
                </el-form-item>
              </el-col>
            </el-row>
@@ -42,109 +41,110 @@
            <el-row>
              <el-col :span="8">
                <el-form-item label="工艺路线编码">
-                 <span>  </span>
+                 <span> {{infoData.routingCode}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工艺路线名称">
-                 <span>  </span>
+                 <span> {{infoData.categoryName}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="工艺路线版本">
-                 <span>
-                 </span>
+                 <span> {{infoData.routingName}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品BOM编码">
+                  <span> {{infoData.bomCode}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品BOM名称">
-                 <span> </span>
+                 <span> {{infoData.bomName}} </span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="产品BOM版本">
-                 <span> </span>
+                 <span> {{infoData.bomVersion}} </span>
                </el-form-item>
              </el-col>
            </el-row>
-           <ele-pro-table
-             ref="table"
-             :columns="columns"
-             :datasource="datasource"
-             row-key="id"
+           <el-table
+             ref="multipleTable"
+             :data="tableData"
+             tooltip-effect="dark"
+             style="width: 100%"
+             border
+             :header-cell-style="{ background: '#F0F3F3' }"
            >
-           </ele-pro-table>
+             <el-table-column prop="code" label="工序编号"/>
+             <el-table-column prop="name" label="工序名称" />
+             <el-table-column prop="controlName" label="工序控制码" />
+             <el-table-column prop="workCenterName" label="工作中心" />
+             <el-table-column label="操作">
+                <template slot-scope="{row}">
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    icon="el-icon-edit"
+                    @click="allocateMaterials(row)"
+                  >
+                    分配物料
+                  </el-link>
+                </template>
+             </el-table-column>
+           </el-table>
        </el-form>
     </el-card>
+    <linkMaterialDialog ref="linkMaterialDialogRef" @success="success" />
   </div>
 </template>
 <script>
   import dictMixins from '@/mixins/dictMixins';
-  import {  getDetail  } from '@/api/ruleManagement/matter'
-  import route from '@/api/technology/route';
+  import { versionDetail , getProcessByRoute } from '@/api/technology/version/version.js';
+  import linkMaterialDialog from './components/link-material-dialog.vue';
 export default {
   mixins: [dictMixins],
-  components: {  },
+  components: { linkMaterialDialog },
   data () {
     return {
-       // 表格列配置
-       columns: [
-         {
-           prop: 'code',
-           label: '工序编号',
-           showOverflowTooltip: true,
-           align: 'center',
-           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
-         }
-       ],
+      infoData:{},
+      tableData:[]
     }
   },
   async created () {
-  //   this.getInfo()
-	 // this.requestDict('规则类型');
+    this.getInfo()
   },
   methods: {
-    /* 表格数据源 */
-    async datasource({ page, limit, where, order }) {
-      const res = await route.list({
-        ...where,
-        ...order,
-        pageNum: page,
-        size: limit
-      });
-      return res;
-    },
     async getInfo () {
-      const data = await getDetail(this.$route.query.id)
-        this.tableData = data.ruleItems
+      const data = await versionDetail(this.$route.query.id)
         this.infoData = data
+        if(data.routingId){
+            this.getProcessList()
+        }
+    },
+
+    getProcessList(){
+       let params = {
+          isDetail: false,
+          pageNum: 1,
+          routingId: this.infoData.routingId,
+          size: -1
+       }
+       getProcessByRoute(params).then(res=>{
+           this.tableData = res.list
+       })
     },
 
+    success () {
+      this.getProcessList()
+    },
+
+    // 点击分配物料
+    allocateMaterials(row){
+       this.$refs.linkMaterialDialogRef.open(row);
+    },
     goBack(){
       this.$router.go(-1)
     }

+ 2 - 2
vue.config.js

@@ -32,10 +32,10 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://192.168.3.51:18086', // 测试
-        target: 'http://192.168.3.35:8080', // kang杨威
+        // target: 'http://192.168.3.35:8080', // kang杨威
         // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        // target: 'http://192.168.3.33:8080', // 谢一平
+        target: 'http://192.168.3.33:8080', // 谢一平
         // target: 'http://192.168.3.64:8080', // 粟勋
         // target: 'http://192.168.3.34:8080', // 刘毅
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域