695593266@qq.com 7 miesięcy temu
rodzic
commit
7b9fdebc26

+ 9 - 0
src/api/wanLong/index.js

@@ -0,0 +1,9 @@
+import request from '@/utils/request';
+
+export async function getDailyList(data) {
+  const res = await request.post(`/mes/index/produceDayReportForms`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 64 - 4
src/views/beEntrusted/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-      <order-search @search="reload" ref="searchRef"> </order-search>
+      <!-- <order-search @search="reload" ref="searchRef"> </order-search> -->
+      <seek-page :seekList="seekList" @search="search"></seek-page>
       <ele-pro-table
         ref="table"
         :columns="columns"
@@ -152,6 +153,7 @@
   import createOrder from './components/create-order.vue';
   import { getList, warehouseEntry, update } from '@/api/beEntrusted/index';
   import goodsDetail from './components/goodsDetail.vue';
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
 
   import {
     getWarehouseList
@@ -175,8 +177,9 @@
         current: null,
         warehouseId: '',
         warehouseList: [],
-        tableHeight: 'calc(100vh - 340px)',
-        selection: []
+        tableHeight: 'calc(100vh - 320px)',
+        selection: [],
+        factoryList: []
       };
     },
     computed: {
@@ -397,10 +400,48 @@
             showOverflowTooltip: true
           }
         ];
+      },
+
+      seekList() {
+        return [
+          {
+            label: '类型:',
+            value: 'type',
+            type: 'select',
+            labelWidth: 50,
+            planList: this.typeList
+          },
+          {
+            label: '名称:',
+            value: 'name',
+            type: 'input',
+            labelWidth: 50
+          },
+          {
+            label: '请托工厂:',
+            value: 'applyFactoriesId',
+            type: 'select',
+            planList: this.factoryList
+          },
+          {
+            label: '受托工厂:',
+            value: 'beEntrustedFactoriesId',
+            type: 'select',
+            planList: this.factoryList
+          },
+          {
+            label: '完成时间:',
+            value: 'planDeliveryTime',
+            type: 'date',
+            dateType: 'daterange',
+            placeholder: ''
+          }
+        ];
       }
     },
     created() {
       this.requestDict('请托类型');
+      this.getFactoryList();
       getWarehouseList().then((res) => {
         this.warehouseList = res;
       });
@@ -418,6 +459,21 @@
       open(type, row) {
         this.$refs.create.open(type, row);
       },
+
+      async getFactoryList() {
+        const { list } = await warehouseDefinition.getFactoryarea({
+          pageNum: 1,
+          size: 999,
+          type: 1
+        });
+
+        list.forEach((item) => {
+          item.label = item.name;
+          item.value = item.id;
+        });
+
+        this.factoryList = list || [];
+      },
       salesToProductionOpen(type) {
         if (this.selection.length == 0) {
           return this.$message.warning('请选择一条数据');
@@ -476,6 +532,10 @@
         this.reload();
       },
 
+      search(e) {
+        this.reload(e);
+      },
+
       receiveGoos(item, type) {
         this.$refs.goodsDetailRef.open(item, type);
       },
@@ -484,7 +544,7 @@
         if (fullscreen) {
           this.tableHeight = 'calc(100vh - 120px)';
         } else {
-          this.tableHeight = 'calc(100vh - 340px)';
+          this.tableHeight = 'calc(100vh - 320px)';
         }
       }
     }

+ 11 - 3
src/views/entrust/components/create.vue

@@ -721,8 +721,6 @@
             describes: '',
             totalCount: copy.formingNum,
             taskList: [],
-            taskId: '',
-            taskName: '',
             beEntrustedFactoriesId: '',
             beEntrustedFactoriesName: '',
             status: '',
@@ -762,7 +760,17 @@
             size: -1
           });
 
-          item.taskList = res.list;
+          let { list } = res;
+          if (list.length) {
+            list = list.filter((it) => it.taskId != -2);
+            let arr = list.findIndex((it) => it.id == item.taskId);
+
+            if (arr != -1) {
+              list.splice(0, arr);
+            }
+
+            item.taskList = list;
+          }
         }
       },
 

+ 3 - 3
src/views/entrust/index.vue

@@ -240,7 +240,7 @@
         warehouseId: '',
         selection: [],
         warehouseList: [],
-        tableHeight: 'calc(100vh - 340px)',
+        tableHeight: 'calc(100vh - 320px)',
         factoryList: [],
         typeList: []
       };
@@ -518,7 +518,7 @@
           },
           {
             label: '完成时间:',
-            value: 'createTime',
+            value: 'planDeliveryTime',
             type: 'date',
             dateType: 'daterange',
             placeholder: ''
@@ -638,7 +638,7 @@
         if (fullscreen) {
           this.tableHeight = 'calc(100vh - 120px)';
         } else {
-          this.tableHeight = 'calc(100vh - 340px)';
+          this.tableHeight = 'calc(100vh - 320px)';
         }
       },
 

+ 86 - 19
src/views/produce/components/outsourcing/index.vue

@@ -234,6 +234,7 @@
             v-model="form.taskId"
             placeholder="请选择"
             style="width: 260px"
+            @change="taskListChange"
           >
             <el-option
               v-for="item in pleaseNewStepsList"
@@ -564,20 +565,71 @@
         this.attributeData.name = this.taskObj.taskName + '请托';
       }
 
-      if (this.chooseType == '2') {
-        this.form.pleaseEntrustDeptName = this.$store.state.user.info.groupName;
-        this.form.pleaseEntrustDeptId = this.$store.state.user.info.groupId;
-        this.form.pleaseEntrustUserName = this.$store.state.user.info.name;
-        this.form.pleaseEntrustUserId = this.$store.state.user.info.userId;
+      // if (this.chooseType == '2') {
+      //   this.form.pleaseEntrustDeptName = this.$store.state.user.info.groupName;
+      //   this.form.pleaseEntrustDeptId = this.$store.state.user.info.groupId;
+      //   this.form.pleaseEntrustUserName = this.$store.state.user.info.name;
+      //   this.form.pleaseEntrustUserId = this.$store.state.user.info.userId;
+      //   const newList = this.workData.list.map((item) => {
+      //     const copy = this.deepCopy(item);
+
+      //     Object.assign(copy, {
+      //       describes: '',
+      //       totalCount: copy.formingNum,
+      //       taskList: [],
+      //       beEntrustedFactoriesId: '',
+      //       beEntrustedFactoriesName: '',
+      //       status: '',
+      //       beEntrustedDeptName: '',
+      //       beEntrustedDeptId: '',
+      //       measuringUnit: copy.unit,
+      //       categoryName: copy.productName,
+      //       categoryCode: copy.productCode,
+      //       workOrderId: copy.id,
+      //       workOrderCode: copy.code,
+      //       brandNum: copy.brandNo,
+      //       modelType: copy.model,
+      //       name: '',
+      //       type: '',
+      //       planDeliveryTime: copy.startTime,
+      //       applyDeptId: this.form.pleaseEntrustDeptId,
+      //       applyDeptName: this.form.pleaseEntrustDeptName,
+      //       applyFactoriesId: this.form.factoriesId,
+      //       applyFactoriesName: this.form.factoriesName
+      //     });
+
+      //     return copy;
+      //   });
+
+      //   const data = Object.assign(this.form, newList[0]);
+      //   this.form = this.deepCopy(data);
+      //   console.log(this.taskObj, '工单数据');
+      //   this.form.name = this.taskObj.name
+      //     ? this.taskObj.name + '请托'
+      //     : this.taskObj.taskTypeName + '请托';
+
+      //   this.getTaskInstanceByIdFn(this.workListIds);
+      // }
+
+      if (this.chooseType === '2') {
+        const userInfo = this.$store.state.user.info;
+
+        Object.assign(this.form, {
+          pleaseEntrustDeptName: userInfo.groupName,
+          pleaseEntrustDeptId: userInfo.groupId,
+          pleaseEntrustUserName: userInfo.name,
+          pleaseEntrustUserId: userInfo.userId
+        });
+
+        console.log(this.workData.list, 'form数据');
+
         const newList = this.workData.list.map((item) => {
           const copy = this.deepCopy(item);
 
-          Object.assign(copy, {
+          const commonData = {
             describes: '',
             totalCount: copy.formingNum,
             taskList: [],
-            taskId: '',
-            taskName: '',
             beEntrustedFactoriesId: '',
             beEntrustedFactoriesName: '',
             status: '',
@@ -597,20 +649,23 @@
             applyDeptName: this.form.pleaseEntrustDeptName,
             applyFactoriesId: this.form.factoriesId,
             applyFactoriesName: this.form.factoriesName
-          });
+          };
+
+          return Object.assign(copy, commonData);
+        });
 
-          return copy;
+        this.form = this.deepCopy({
+          ...this.form,
+          ...newList[0]
         });
 
-        const data = Object.assign(this.form, newList[0]);
-        this.form = this.deepCopy(data);
+        console.log(this.form, '最终form数据');
+
         this.form.name = this.taskObj.name
-          ? this.taskObj.name + '请托'
-          : this.taskObj.taskTypeName + '请托';
-        const taskId = this.taskObj.name
-          ? this.taskObj.id
-          : this.taskObj.taskId;
-        this.getTaskInstanceByIdFn(this.workListIds, taskId);
+          ? `${this.taskObj.name}请托`
+          : `${this.taskObj.taskTypeName}请托`;
+
+        this.getTaskInstanceByIdFn(this.workListIds);
       }
     },
 
@@ -632,7 +687,9 @@
           let { data } = res;
           if (data.length) {
             data = data.filter((item) => item.taskId != -2);
-            let arr = data.findIndex((item) => item.sourceTaskId == taskId);
+            let arr = data.findIndex((item) =>
+              item.name ? item.sourceTaskId : item.taskId == this.form.taskId
+            );
 
             if (arr != -1) {
               data.splice(0, arr);
@@ -742,6 +799,14 @@
         this.$refs.timeDialogRef.open(this.attributeData, null, false);
       },
 
+      taskListChange() {
+        const data = this.pleaseNewStepsList.filter(
+          (it) => it.taskId == this.form.taskId
+        );
+
+        this.form.taskName = data[0].taskTypeName;
+      },
+
       changeTaskId(e) {
         console.log(e);
         const arr = this.newStepsList.find((item) => item.taskId === e);
@@ -864,6 +929,8 @@
           const list = [];
           list.push(this.form);
 
+          console.log(this.form, '最终form数据111111');
+
           URL(list)
             .then((res) => {
               this.loading.close();

+ 6 - 10
src/views/produce/components/workPlan/detailsIndex.vue

@@ -60,7 +60,7 @@
         getQualityType(row)
       }}</template>
       <template v-slot:qualityMode="{ row }">{{
-        getQualityMode(row)
+        getQualityMode(row.qualityMode)
       }}</template>
       <template v-slot:accessory="scope">
         <el-link
@@ -211,7 +211,7 @@
             showOverflowTooltip: true
           },
           {
-            label: '检方式',
+            label: '检方式',
             prop: 'qualityMode',
             slot: 'qualityMode',
             align: 'center',
@@ -537,14 +537,10 @@
         return label;
       },
 
-      getQualityMode(item) {
-        let label = '';
-        this.qualityMode.forEach((i) => {
-          if (i.value == item.qualityType) {
-            label = i.label;
-          }
-        });
-        return label;
+      getQualityMode(num) {
+        const res = this.qualityMode.find((item) => item.value == num);
+
+        return res ? res.label : '';
       },
 
       async getTnspectionPlanType() {

+ 4 - 2
src/views/produce/components/workPlan/edit.vue

@@ -1266,7 +1266,8 @@
             .then((msg) => {
               this.loading = false;
               this.$message.success(msg);
-              this.cancel();
+              this.visible = false;
+              // this.cancel();
               this.$emit('done');
             })
             .catch((e) => {
@@ -1420,7 +1421,8 @@
             .then((msg) => {
               this.loading = false;
               this.$message.success(msg);
-              this.cancel();
+              this.visible = false;
+              // this.cancel();
               this.$emit('done');
             })
             .catch((e) => {

+ 270 - 0
src/views/wanLong/index.vue

@@ -0,0 +1,270 @@
+<!-- <template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <seek-page :seekList="seekList" @search="search"></seek-page>
+
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        cache-key="wanLongDailyList"
+        :current.sync="current"
+        highlight-current-row
+        row-key="id"
+        :pageSize="20"
+        :height="tableHeight"
+        :selection.sync="selection"
+        @fullscreen-change="fullscreenChange"
+      >
+        <template slot="subCountAllFirst" slot-scope="{ row }">
+          <span class="clickable" @click="onClickSubCountAllFirst(row)">
+            {{ row.subCountAllFirst != null ? row.subCountAllFirst : 0 }}
+          </span>
+        </template>
+
+        <template slot="subCountSendFirst" slot-scope="{ row }">
+          <span class="clickable" @click="onClickSubCountSendFirst(row)">
+            {{ row.subCountSendFirst != null ? row.subCountSendFirst : 0 }}
+          </span>
+        </template>
+      </ele-pro-table>
+    </el-card>
+  </div>
+</template>
+
+<script>
+  import { getDailyList } from '@/api/wanLong/index';
+
+  export default {
+    name: 'wanLongIndex',
+
+    data() {
+      return {
+        loading: false,
+        current: null,
+        selection: [],
+        tableHeight: 'calc(100vh - 320px)',
+        dynamicColumns: [], // 保存 taskList 动态列
+        taskNames: [] // taskName 列名数组
+      };
+    },
+
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '开始时间:',
+            value: 'startTime',
+            type: 'date',
+            dateType: 'daterange',
+            placeholder: ''
+          }
+        ];
+      },
+
+      columns() {
+        const baseColumns = [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '物品名称',
+            prop: 'categoryName',
+            width: 150,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '物品编码',
+            prop: 'categoryCode',
+            width: 160,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '图号',
+            prop: 'imgCode',
+            width: 160,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '图纸版本',
+            prop: 'version',
+            width: 160,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '重量',
+            prop: 'productUnitWeight',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '型号',
+            prop: 'modelType',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '规格',
+            prop: 'specification',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+
+          {
+            label: '中间状态数量',
+            prop: 'middleNum',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '库存数量',
+            prop: 'availableCountBase',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+
+          {
+            label: '下料初始值',
+            prop: 'subCountAllFirst',
+            width: 120,
+            slot: 'subCountAllFirst',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '下料总数量',
+            prop: 'subCountAll',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+
+          {
+            label: '送货初始值',
+            prop: 'subCountSendFirst',
+            width: 120,
+            slot: 'subCountSendFirst',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '送货数量',
+            prop: 'subCountSend',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '备注',
+            prop: 'remark',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '日期',
+            prop: 'date',
+            width: 100,
+            showOverflowTooltip: true,
+            align: 'center'
+          }
+        ];
+
+        return baseColumns.concat(this.dynamicColumns);
+      }
+    },
+
+    methods: {
+      datasource({ page, limit, where }) {
+        return getDailyList({
+          pageNum: page,
+          size: limit,
+          ...where
+        }).then((res) => {
+          const data = res.data || [];
+
+          if (data.length) {
+            const firstItem = data[0];
+            if (firstItem.taskList && firstItem.taskList.length) {
+              this.taskNames = firstItem.taskList.map((t) => t.taskName);
+              this.dynamicColumns = firstItem.taskList.map((t) => ({
+                label: t.taskName,
+                prop: `task_${t.taskName}`,
+                width: 100,
+                align: 'center'
+              }));
+            }
+          }
+
+          const tableData = data.map((item) => {
+            const taskFields = {};
+            if (item.taskList && item.taskList.length) {
+              item.taskList.forEach((t) => {
+                taskFields[`task_${t.taskName}`] = t.quantity;
+              });
+            }
+            return Object.assign({}, item, taskFields);
+          });
+
+          return tableData;
+        });
+      },
+
+      search(e) {
+        this.$refs.table.reload(e);
+      },
+
+      fullscreenChange(fullscreen) {
+        this.tableHeight = fullscreen
+          ? 'calc(100vh - 120px)'
+          : 'calc(100vh - 320px)';
+      },
+
+      onClickSubCountAllFirst(row) {
+        console.log('点击下料初始值', row);
+        this.$message.info(`下料初始值: ${row.subCountAllFirst}`);
+      },
+
+      onClickSubCountSendFirst(row) {
+        console.log('点击送货初始值', row);
+        this.$message.info(`送货初始值: ${row.subCountSendFirst}`);
+      }
+    }
+  };
+</script>
+
+<style scoped>
+  .clickable {
+    cursor: pointer;
+    color: #409eff;
+  }
+</style>  -->
+
+<template> </template>
+
+<script>
+  export default {};
+</script>
+
+<style></style>

+ 207 - 0
src/views/wanLong/workItemTable.vue

@@ -0,0 +1,207 @@
+<template>
+  <ele-pro-table
+    ref="tableRef"
+    :columns="columns"
+    :datasource="tableData"
+    border
+    height="600"
+    cache-key="wanLongDailyList"
+    :current.sync="current"
+    highlight-current-row
+    row-key="id"
+    :height="tableHeight"
+    :selection.sync="selection"
+    @fullscreen-change="fullscreenChange"
+  >
+    <!-- 下料初始值点击事件 -->
+    <template slot="subCountAllFirst" slot-scope="{ row }">
+      <span class="clickable" @click="onClickSubCountAllFirst(row)">
+        {{ row.subCountAllFirst != null ? row.subCountAllFirst : 0 }}
+      </span>
+    </template>
+
+    <!-- 送货初始值点击事件 -->
+    <template slot="subCountSendFirst" slot-scope="{ row }">
+      <span class="clickable" @click="onClickSubCountSendFirst(row)">
+        {{ row.subCountSendFirst != null ? row.subCountSendFirst : 0 }}
+      </span>
+    </template>
+  </ele-pro-table>
+</template>
+
+<script>
+  export default {
+    name: 'workItemTable',
+
+    props: {
+      data: {
+        type: Array,
+        default: () => []
+      }
+    },
+
+    data() {
+      return {
+        current: null,
+        selection: [],
+        tableHeight: 'calc(100vh - 320px)'
+      };
+    },
+
+    computed: {
+      tableData() {
+        return this.data.map((item) => {
+          const taskFields = {};
+          if (item.taskList && item.taskList.length) {
+            item.taskList.forEach((t) => {
+              taskFields[`task_${t.taskName}`] = t.quantity;
+            });
+          }
+          return Object.assign({}, item, taskFields);
+        });
+      },
+
+      columns() {
+        if (!this.data || !this.data.length) return [];
+
+        const first = this.data[0];
+
+        const baseColumns = [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '物品名称',
+            prop: 'categoryName',
+            width: 150,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '物品编码',
+            prop: 'categoryCode',
+            width: 160,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '重量',
+            prop: 'productUnitWeight',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '型号',
+            prop: 'modelType',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '规格',
+            prop: 'specification',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '库存数量',
+            prop: 'availableCountBase',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+
+          {
+            label: '下料初始值',
+            prop: 'subCountAllFirst',
+            width: 120,
+            slot: 'subCountAllFirst',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '下料总数量',
+            prop: 'subCountAll',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+
+          {
+            label: '送货初始值',
+            prop: 'subCountSendFirst',
+            width: 120,
+            slot: 'subCountSendFirst',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '送货数量',
+            prop: 'subCountSend',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '日期',
+            prop: 'date',
+            width: 100,
+            showOverflowTooltip: true,
+            align: 'center'
+          }
+        ];
+
+        let taskColumns = [];
+        if (first.taskList && first.taskList.length) {
+          taskColumns = first.taskList.map((t) => ({
+            label: t.taskName,
+            prop: `task_${t.taskName}`, // 对应 tableData 的字段
+            width: 100,
+            align: 'center'
+          }));
+        }
+
+        return baseColumns.concat(taskColumns);
+      }
+    },
+
+    methods: {
+      onClickSubCountAllFirst(row) {
+        console.log('点击下料初始值', row);
+      },
+
+      onClickSubCountSendFirst(row) {
+        console.log('点击送货初始值', row);
+      },
+
+      fullscreenChange(fullscreen) {
+        if (fullscreen) {
+          this.tableHeight = 'calc(100vh - 120px)';
+        } else {
+          this.tableHeight = 'calc(100vh - 320px)';
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped>
+  .clickable {
+    cursor: pointer;
+    color: #409eff;
+  }
+</style>