Эх сурвалжийг харах

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-aps into dev

LAPTOP-16IUEB3P\Lenovo 2 жил өмнө
parent
commit
35fe9cf8a3

+ 2 - 2
src/api/classifyManage/itemInformation.js

@@ -1,7 +1,7 @@
 import request from '@/utils/request';
 // 物品信息列表
-export async function getList (data) {
-  const res = await request.post('/main/category/getList', data);
+export async function getList (params) {
+  const res = await request.get('/main/category/getList', { params });
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 12 - 2
src/api/productionPlan/index.js

@@ -3,8 +3,18 @@ import request from '@/utils/request';
 /**
  * 列表
  */
-export async function getList (params) {
-  const res = await request.get('/aps/productionplan/page', { params });
+export async function getList (data) {
+  const res = await request.post('/aps/productionplan/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 保存
+ */
+export async function save (data) {
+  const res = await request.post('/aps/productionplan/save', data);
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 12 - 0
src/api/productionPlan/order.js

@@ -0,0 +1,12 @@
+import request from '@/utils/request';
+
+/**
+ * 工单发布
+ */
+export async function release (data) {
+  const res = await request.post('/aps/workorder/release', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 10 - 8
src/store/modules/user.js

@@ -13,16 +13,18 @@ const formatRouter = (list) => {
     let arr = [];
     for (const p of list) {
       if (p.menuType === 2) {
-        p.children = [];
-        authorities.push(p);
+        // p.children = [];
+        // authorities.push(p);
+        p.hide = true;
+      }
+      //  else {
+      if (p.children?.length) {
+        p.children = fn(p.children);
       } else {
-        if (p.children?.length) {
-          p.children = fn(p.children);
-        } else {
-          p.children = [];
-        }
-        arr.push(p);
+        p.children = [];
       }
+      arr.push(p);
+      // }
     }
 
     return arr;

+ 116 - 0
src/views/productionPlan/components/equipment-dailog.vue

@@ -0,0 +1,116 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    title="添加工单-选择设备"
+    width="65vw"
+    append-to-body
+  >
+    <div class="search-box">
+      设备名称
+      <el-input placeholder="请输入" v-model="name"></el-input>
+      <el-button type="primary" @click="handleSearch">搜索</el-button>
+    </div>
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :needPage="false"
+      :selection.sync="selectionList"
+      :datasource="datasource"
+      height
+    />
+
+    <div class="footer" slot="footer">
+      <el-button @click="cancel">取消</el-button>
+      <el-button @click="confirm" type="primary">确定</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import { getList } from '@/api/classifyManage/itemInformation';
+  export default {
+    data () {
+      return {
+        visible: false,
+        name: '',
+        selectionList: [],
+        tableList: [],
+        columns: [
+          {
+            label: '设备编码',
+            prop: 'code'
+          },
+          {
+            label: '设备名称',
+            prop: 'name'
+          },
+          {
+            label: '生产状态',
+            prop: 'planStatus'
+          },
+          {
+            label: '未完成工单数',
+            prop: 'code'
+          },
+          {
+            label: '预计完成时间',
+            prop: 'code'
+          },
+          {
+            label: '产能',
+            prop: 'code'
+          },
+          {
+            label: '末单牌号',
+            prop: 'code'
+          },
+          {
+            type: 'selection',
+            align: 'center'
+          }
+        ]
+      };
+    },
+    methods: {
+      open (list) {
+        this.visible = true;
+      },
+      datasource () {
+        return getList({
+          pageNum: 1,
+          size: -1,
+          name: this.name,
+          categoryLevelId: '4'
+        });
+      },
+      handleSearch () {
+        this.$refs.table.reload();
+      },
+      confirm () {
+        if (this.selectionList.length) return this.$message.error('请选择数据');
+
+        this.$emit('success', this.selectionList);
+
+        this.cancel();
+      },
+      cancel () {
+        this.visible = false;
+        this.$refs.table.clear;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .search-box {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+    margin-bottom: 20px;
+    .el-input {
+      width: 220px;
+      margin: 0 32px;
+    }
+  }
+</style>

+ 27 - 3
src/views/productionPlan/components/plan-view.vue

@@ -2,7 +2,7 @@
   <div>
     <div class="description">
       <div class="label">方案说明</div>
-      <div class="content">
+      <!-- <div class="content">
         <template v-for="(item, index) in rules">
           <template v-for="(itm, idx) in item.list">
             <template v-if="!itm.lastDisabled">
@@ -10,7 +10,7 @@
             </template>
           </template>
         </template>
-      </div>
+      </div> -->
       <div class="operate">
         <el-button type="primary" plain>发布当前方案</el-button>
         <el-button type="primary">保存</el-button>
@@ -18,7 +18,9 @@
     </div>
 
     <div class="display-box">
-      <el-button type="primary" plain size="small">添加工单</el-button>
+      <el-button type="primary" plain size="small" @click="addOrder"
+        >添加工单</el-button
+      >
       <el-button type="primary" plain size="small">删除</el-button>
       <div class="items">
         <span class="label">累计工单条数</span>
@@ -81,11 +83,15 @@
       </el-table-column>
       <el-table-column type="selection"></el-table-column>
     </el-table>
+    <equipmentDailog ref="equipmentDailogRef" @success="equipmentSelect" />
   </div>
 </template>
 
 <script>
+  import equipmentDailog from './equipment-dailog.vue';
+  import { save } from '@/api/productionPlan/index.js';
   export default {
+    components: { equipmentDailog },
     data () {
       return {
         tableData: [],
@@ -124,6 +130,24 @@
           }
         ]
       };
+    },
+    methods: {
+      addOrder () {
+        this.$refs.equipmentDailogRef.open(this.tableData);
+      },
+      equipmentSelect (list) {
+        this.tableData = this.tableData.filter((item) =>
+          list.find((i) => i.id == item.id)
+        );
+
+        this.tableData = list.reduce((cur, pre) => {
+          if (!cur.find((i) => i.id == pre.id)) {
+            cur.push(pre);
+          }
+
+          return cur;
+        }, this.tableData);
+      }
     }
   };
 </script>

+ 11 - 3
src/views/productionPlan/components/productionPlan-search.vue

@@ -199,15 +199,21 @@
       }
     },
     watch: {
-      activeName () {
-        this.search();
+      activeName: {
+        handler () {
+          if (this.activeName) {
+            this.where.status = this.statusOpt[this.activeName][0].value;
+            this.search();
+          }
+        },
+        immediate: true
       }
     },
     created () {},
     methods: {
       /* 搜索 */
       search () {
-        const where = this.where;
+        const where = { ...this.where };
         for (const key in where) {
           if (Array.isArray(where[key])) {
             where[`${key}End`] = where[key][1];
@@ -215,6 +221,8 @@
           }
         }
 
+        where.status = where.status.split(',');
+
         this.$emit('search', where);
       },
       /*  重置 */

+ 27 - 10
src/views/productionPlan/index.vue

@@ -9,7 +9,7 @@
         :activeName="activeName"
       >
       </productionPlan-search>
-      <el-tabs v-model="activeName" type="card" @tab-click="handleTabChange">
+      <el-tabs v-model="activeName" type="card">
         <el-tab-pane label="未发布" name="first"></el-tab-pane>
         <el-tab-pane label="已发布" name="second"></el-tab-pane>
       </el-tabs>
@@ -17,6 +17,7 @@
       <ele-pro-table
         ref="table"
         :key="activeName"
+        :initLoad="false"
         :columns="columns"
         :datasource="datasource"
         :cache-key="`${activeName}ProductionPlanTable`"
@@ -27,14 +28,24 @@
             type="primary"
             :underline="false"
             icon="el-icon-truck"
-            @click="handleOrderPublish(row)"
+            @click="handleOrderPublish(1, row)"
           >
             发布工单
           </el-link>
-          <el-link type="primary" :underline="false" icon="el-icon-truck">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-truck"
+            @click="handleOrderPublish(2, row)"
+          >
             重新发布
           </el-link>
-          <el-link type="primary" :underline="false" icon="el-icon-edit">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="handleOrderPublish(3, row)"
+          >
             修改计划
           </el-link>
           <el-link type="primary" :underline="false" icon="el-icon-edit">
@@ -66,7 +77,7 @@
           first: [
             { label: '所有状态', value: '1,2' },
             { label: '待发布', value: '1' },
-            { label: '发布状态', value: '2' }
+            { label: '发布失败', value: '2' }
           ],
           second: [
             { label: '所有状态', value: '0,3,4,5,6' },
@@ -231,13 +242,13 @@
             minWidth: 110
           },
           {
-            prop: 'planStatus',
+            prop: 'status',
             label: '状态',
             align: 'center',
             minWidth: 110,
             formatter: (row) => {
               const obj = this.statusOpt[this.activeName].find(
-                (i) => i.value == row.orderType
+                (i) => i.value == row.status
               );
               return obj && obj.label;
             }
@@ -280,9 +291,13 @@
         });
       },
       // 发布工单
-      handleOrderPublish (row) {
+      handleOrderPublish (type, row) {
         this.$router.push({
-          path: '/productionPlan/workOrderPublish'
+          path: '/productionPlan/workOrderPublish',
+          query: {
+            type,
+            row: JSON.stringify(row)
+          }
         });
       },
       handleTabChange () {
@@ -291,7 +306,9 @@
 
       /* 刷新表格 */
       reload (where) {
-        this.$refs.table.reload({ page: 1, where });
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
       },
 
       goDetail (row) {

+ 51 - 18
src/views/productionPlan/workOrderPublish.vue

@@ -6,26 +6,48 @@
         </el-page-header>
       </div>
 
-      <el-descriptions title="" :column="6" border>
-        <el-descriptions-item label="计划编号"
-          >kooriookami</el-descriptions-item
+      <el-descriptions title="" :column="6" border class="mb-20">
+        <el-descriptions-item label="计划编号">{{
+          infoData.code
+        }}</el-descriptions-item>
+        <el-descriptions-item label="计划类型">{{
+          infoData.code
+        }}</el-descriptions-item>
+        <el-descriptions-item label="产品编码">{{
+          infoData.productCode
+        }}</el-descriptions-item>
+        <el-descriptions-item label="牌号">{{
+          infoData.brandNo
+        }}</el-descriptions-item>
+        <el-descriptions-item label="型号">{{
+          infoData.model
+        }}</el-descriptions-item>
+        <el-descriptions-item label="生产版本">{{
+          infoData.code
+        }}</el-descriptions-item>
+        <el-descriptions-item label="工艺路线名称">{{
+          infoData.code
+        }}</el-descriptions-item>
+        <el-descriptions-item label="工艺路线版本">{{
+          infoData.code
+        }}</el-descriptions-item>
+        <el-descriptions-item label="产品数量"
+          >{{ infoData.productNum
+          }}{{ infoData.productUnitWeight }}</el-descriptions-item
         >
-        <el-descriptions-item label="计划类型"
-          >18100000000</el-descriptions-item
+        <el-descriptions-item label="产品重量"
+          >{{ infoData.productWeight
+          }}{{ infoData.productUnitWeight }}</el-descriptions-item
         >
-        <el-descriptions-item label="产品编码">苏州市</el-descriptions-item>
-        <el-descriptions-item label="牌号">苏州市</el-descriptions-item>
-        <el-descriptions-item label="型号">苏州市</el-descriptions-item>
-        <el-descriptions-item label="生产版本">苏州市</el-descriptions-item>
-        <el-descriptions-item label="工艺路线名称">苏州市</el-descriptions-item>
-        <el-descriptions-item label="工艺路线版本">苏州市</el-descriptions-item>
-        <el-descriptions-item label="产品数量">苏州市</el-descriptions-item>
-        <el-descriptions-item label="产品重量">苏州市</el-descriptions-item>
-        <el-descriptions-item label="要求成型数量">苏州市</el-descriptions-item>
-        <el-descriptions-item label="要求成型重量">苏州市</el-descriptions-item>
+        <el-descriptions-item label="要求成型数量">{{
+          infoData.requiredFormingNum
+        }}</el-descriptions-item>
+        <el-descriptions-item label="要求成型重量">{{
+          infoData.code
+        }}</el-descriptions-item>
       </el-descriptions>
 
-      <div class="rules-box">
+      <!-- <div class="rules-box">
         <div class="rule-label">工单生成规则</div>
         <div class="rule-wrapper">
           <div class="content">
@@ -64,7 +86,7 @@
             <el-button type="primary" plain>一键生成方案</el-button>
           </div>
         </div>
-      </div>
+      </div> -->
 
       <el-tabs v-model="activeName" type="card">
         <el-tab-pane label="默认" name="first"
@@ -122,8 +144,15 @@
             value: '',
             list: [{ label: '末单均衡', value: 0 }]
           }
-        ]
+        ],
+        infoData: {}
       };
+    },
+    created () {
+      const { query = {} } = this.$route;
+      this.infoData = JSON.parse(query.row || '{}');
+
+      this.type = query.type;
     }
   };
 </script>
@@ -163,4 +192,8 @@
       }
     }
   }
+
+  .mb-20 {
+    margin-bottom: 20px;
+  }
 </style>

+ 2 - 2
vue.config.js

@@ -31,8 +31,8 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        // target: 'http://192.168.3.35:8080', // kang杨威
-        target: 'http://192.168.3.38:8080', // 陈潇
+        target: 'http://192.168.3.35:8080', // kang杨威
+        // target: 'http://192.168.3.38:8080', // 陈潇
         // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
         // target: 'http://192.168.3.33:8080', // 谢一平