quwangxin há 2 anos atrás
pai
commit
eceff59ec2

+ 11 - 1
src/api/produceOrder/index.js

@@ -118,7 +118,17 @@ export async function writeOffWork (data) {
 }
 //包装要求
 export async function getPackageList (code) {
-  const res = await request.get(`/aps/workorder/getPackageList/${code} `);
+  const res = await request.get(`/aps/workorder/getPackageList/${code}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//根据工序ID查询设备信息
+export async function getDeviceByTaskId (params) {
+  const res = await request.get(
+    `/main/producetask/getDeviceByTaskId/${params.taskId}/${params.rootCategoryLevelId}`
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 187 - 0
src/components/EquipmentDailog/report-equipment.vue

@@ -0,0 +1,187 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    title="添加工单-选择设备"
+    width="65vw"
+    append-to-body
+  >
+    <div class="search-box">
+      设备名称
+      <el-input placeholder="请输入" v-model="name"></el-input>
+    </div>
+    <!-- 数据表格 -->
+    <!-- :highlight-current-row="isSingle" -->
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      @done="handleDone"
+      row-key="id"
+      :needPage="false"
+      :initLoad="false"
+      :selection.sync="selectionList"
+      :datasource="datasourceShow"
+      :current.sync="current"
+      highlight-current-row
+      height="45vh"
+      @row-click="choose"
+    >
+      <template v-slot:select="{ row }">
+        <el-radio class="radio" v-model="radio" :label="row.id"
+          ><i></i
+        ></el-radio>
+      </template>
+    </ele-pro-table>
+    <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 { getDeviceByTaskId } from '@/api/produceOrder/index';
+  export default {
+    props: {
+      taskId: {
+        type: String,
+        default: ''
+      }
+    },
+    data () {
+      return {
+        visible: false,
+        current: null,
+        name: '',
+        selectionList: [],
+        memoList: [],
+        datasource: [],
+        isSingle: false,
+        callback: null,
+        radio: ''
+      };
+    },
+    computed: {
+      columns () {
+        const list = [
+          {
+            label: '设备编码',
+            prop: 'code'
+          },
+          {
+            label: '设备名称',
+            prop: 'name'
+          },
+          // {
+          //   label: '生产状态',
+          //   prop: 'status'
+          // },
+          {
+            label: '未完成工单数',
+            prop: 'incompleteOrderNum'
+          },
+          {
+            label: '预计完成时间',
+            prop: 'planCompleteDate'
+          },
+          // {
+          //   label: '产能',
+          //   prop: 'capacityNum',
+          //   width: 200,
+          //   formatter: (row) =>
+          //     row.capacityNum + ' ' + row.capacityUnit + '/' + row.capacityTime
+          // },
+          {
+            label: '末单牌号',
+            prop: 'lastOrderGrade'
+          }
+        ];
+
+        if (!this.isSingle) {
+          list.push({
+            slot: 'select',
+            prop: 'select',
+            label: '选择',
+            align: 'center'
+          });
+        }
+        return list;
+      },
+      datasourceShow () {
+        return this.datasource?.filter((item) => {
+          if (this.name) {
+            return item.name.includes(this.name);
+          }
+
+          return true;
+        });
+      }
+    },
+    methods: {
+      openSingle (list = [], callback) {
+        this.memoList = list;
+        this.callback = callback;
+        this.isSingle = true;
+        this.visible = true;
+        this._getList();
+      },
+      handleDone ({ data }) {
+        if (this.memoList.length) {
+          this.$nextTick(() => {
+            this.$refs.table.setCurrentRow(
+              data.find(
+                (item) =>
+                  item.id ==
+                  (this.memoList[0].deviceId ||
+                    this.memoList[0].sourceInstanceId)
+              )
+            );
+          });
+        }
+      },
+      async _getList () {
+        const data = await getDeviceByTaskId({
+          rootCategoryLevelId: '4',
+          taskId: this.taskId
+        });
+        this.datasource = data || [];
+      },
+      confirm () {
+        if (this.isSingle) {
+          if (!this.current) return this.$message.error('请选择数据');
+
+          this.callback && this.callback(this.current);
+        } else {
+          if (!this.current) return this.$message.error('请选择数据');
+          this.$emit('success', [this.current]);
+        }
+
+        this.cancel();
+      },
+      cancel () {
+        this.$refs.table.setCurrentRow();
+        this.$refs.table.clearSelection();
+        this.radio = '';
+        this.current = null;
+        this.visible = false;
+      },
+      // 单击获取id
+      choose (row) {
+        this.current = row;
+        this.radio = row.id;
+      }
+    }
+  };
+</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>

+ 6 - 7
src/views/produceOrder/components/report/Common.vue

@@ -202,16 +202,13 @@
         >
       </el-descriptions>
     </el-card>
-    <equipmentDailog
-      ref="equipmentRef"
-      :produceVersionId="infoData.produceVersionId"
-    />
+    <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
   </el-form>
 </template>
 
 <script>
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
-  import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import { reportCount } from '@/api/produceOrder';
   import dayjs from 'dayjs';
   export default {
@@ -313,8 +310,10 @@
           (res) => {
             this.workReportDeviceList.code = res.code;
             this.workReportDeviceList.name = res.name;
-            this.workReportDeviceList.model = res.modelType;
-            this.workReportDeviceList.specification = res.specification;
+
+            this.workReportDeviceList.model = res.category?.category?.modelType;
+            this.workReportDeviceList.specification =
+              res.category?.category?.specification;
             this.workReportDeviceList.sourceInstanceId = res.id;
             this.workReportDeviceList.rootCategoryLevelId =
               res.rootCategoryLevelId;

+ 1 - 4
src/views/produceOrder/components/report/Drying.vue

@@ -219,10 +219,7 @@
         >
       </el-descriptions>
     </el-card>
-    <workshopDailog
-      ref="workshopRef"
-      :produceVersionId="infoData.produceVersionId"
-    />
+    <workshopDailog ref="workshopRef" :taskId="taskInfo.id" />
     <catogaryDialog ref="catogaryDialogRef" />
   </el-form>
 </template>

+ 5 - 8
src/views/produceOrder/components/report/Extrusion.vue

@@ -252,11 +252,7 @@
         ></el-descriptions-item>
       </el-descriptions>
     </el-card>
-    <equipmentDailog
-      ref="equipmentRef"
-      :isPlan="true"
-      :produceVersionId="infoData.produceVersionId"
-    />
+    <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
     <materialDialog
       ref="materialRef"
       :params="{
@@ -272,7 +268,7 @@
 <script>
   import { realTimeStorage } from '@/api/mainData';
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
-  import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import materialDialog from '../materialDialog.vue';
   import catogaryDialog from '../catogaryDialog.vue';
   import { reportCount } from '@/api/produceOrder';
@@ -428,8 +424,9 @@
           (res) => {
             this.workReportDeviceList.code = res.code;
             this.workReportDeviceList.name = res.name;
-            this.workReportDeviceList.model = res.modelType;
-            this.workReportDeviceList.specification = res.specification;
+            this.workReportDeviceList.model = res.category?.category?.modelType;
+            this.workReportDeviceList.specification =
+              res.category?.category?.specification;
             this.workReportDeviceList.sourceInstanceId = res.id;
             this.workReportDeviceList.rootCategoryLevelId =
               res.rootCategoryLevelId;

+ 6 - 7
src/views/produceOrder/components/report/Furnace.vue

@@ -80,16 +80,13 @@
         >
       </el-descriptions>
     </el-card>
-    <equipmentDailog
-      ref="equipmentRef"
-      :produceVersionId="infoData.produceVersionId"
-    />
+    <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
   </el-form>
 </template>
 
 <script>
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
-  import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import { reportCount } from '@/api/produceOrder';
   import dayjs from 'dayjs';
   export default {
@@ -189,8 +186,10 @@
           (res) => {
             this.workReportDeviceList.code = res.code;
             this.workReportDeviceList.name = res.name;
-            this.workReportDeviceList.model = res.modelType;
-            this.workReportDeviceList.specification = res.specification;
+
+            this.workReportDeviceList.model = res.category?.category?.modelType;
+            this.workReportDeviceList.specification =
+              res.category?.category?.specification;
             this.workReportDeviceList.sourceInstanceId = res.id;
             this.workReportDeviceList.rootCategoryLevelId =
               res.rootCategoryLevelId;

+ 6 - 7
src/views/produceOrder/components/report/HalfAdded.vue

@@ -214,17 +214,14 @@
         >
       </el-descriptions>
     </el-card>
-    <equipmentDailog
-      ref="equipmentRef"
-      :produceVersionId="infoData.produceVersionId"
-    />
+    <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
     <catogaryDialog ref="catogaryDialogRef" />
   </el-form>
 </template>
 
 <script>
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
-  import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import { reportCount } from '@/api/produceOrder';
   import catogaryDialog from '../catogaryDialog.vue';
   import dayjs from 'dayjs';
@@ -354,8 +351,10 @@
           (res) => {
             this.workReportDeviceList.code = res.code;
             this.workReportDeviceList.name = res.name;
-            this.workReportDeviceList.model = res.modelType;
-            this.workReportDeviceList.specification = res.specification;
+
+            this.workReportDeviceList.model = res.category?.category?.modelType;
+            this.workReportDeviceList.specification =
+              res.category?.category?.specification;
             this.workReportDeviceList.sourceInstanceId = res.id;
             this.workReportDeviceList.rootCategoryLevelId =
               res.rootCategoryLevelId;

+ 6 - 7
src/views/produceOrder/components/report/Heating.vue

@@ -220,17 +220,14 @@
         >
       </el-descriptions>
     </el-card>
-    <equipmentDailog
-      ref="equipmentRef"
-      :produceVersionId="infoData.produceVersionId"
-    />
+    <equipmentDailog ref="equipmentRef" :taskId="taskInfo.id" />
     <catogaryDialog ref="catogaryDialogRef" />
   </el-form>
 </template>
 
 <script>
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
-  import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import { reportCount } from '@/api/produceOrder';
   import catogaryDialog from '../catogaryDialog.vue';
   import dayjs from 'dayjs';
@@ -363,8 +360,10 @@
           (res) => {
             this.workReportDeviceList.code = res.code;
             this.workReportDeviceList.name = res.name;
-            this.workReportDeviceList.model = res.modelType;
-            this.workReportDeviceList.specification = res.specification;
+
+            this.workReportDeviceList.model = res.category?.category?.modelType;
+            this.workReportDeviceList.specification =
+              res.category?.category?.specification;
             this.workReportDeviceList.sourceInstanceId = res.id;
             this.workReportDeviceList.rootCategoryLevelId =
               res.rootCategoryLevelId;

+ 1 - 1
src/views/produceOrder/components/report/Sinter.vue

@@ -82,7 +82,7 @@
 
 <script>
   import personSelectRemote from '@/components/CommomSelect/person-select-remote';
-  import equipmentDailog from '@/components/EquipmentDailog/equipment-dailog';
+  import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import { reportCount } from '@/api/produceOrder';
   export default {
     components: { personSelectRemote, equipmentDailog },