Sfoglia il codice sorgente

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

lucw 10 mesi fa
parent
commit
a374e456b4

+ 1 - 0
package.json

@@ -34,6 +34,7 @@
     "ele-admin": "^1.11.2",
     "element-tree-line": "^0.2.1",
     "element-ui": "2.15.7",
+    "file-saver": "^2.0.5",
     "github-markdown-css": "^5.1.0",
     "highlight.js": "9.18.5",
     "html2canvas": "^1.4.1",

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

@@ -0,0 +1,20 @@
+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));
+}
+
+export async function updateDaily(data) {
+  const res = await request.post(
+    `/mes/index/updateProduceDayReportForms`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 10 - 3
src/components/common/seekPage.vue

@@ -88,8 +88,11 @@
     },
 
     data() {
+      const today = new Date();
       return {
-        defaultWhere: {},
+        defaultWhere: {
+          startTime: today
+        },
         dropdownVisible: false,
         seekListRow: [],
         deboListRow: []
@@ -147,7 +150,7 @@
       /** 生成字段属性 */
       getFieldProps(item) {
         const base = {
-          clearable: true,
+          clearable: item.clearable !== undefined ? item.clearable : true,
           placeholder:
             item.placeholder ||
             (item.type === 'input' ? '请输入内容' : '请选择'),
@@ -176,6 +179,7 @@
             return {
               ...base,
               type: item.dateType || 'daterange',
+              defaultValue: this.today,
               'value-format': 'yyyy-MM-dd HH:mm:ss',
               'range-separator': '至',
               'start-placeholder': '开始日期',
@@ -212,7 +216,10 @@
 
       /** 重置 */
       reset() {
-        this.defaultWhere = {};
+        const today = new Date();
+        this.defaultWhere = {
+          startTime: today
+        };
         this.search();
       }
     }

+ 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)';
         }
       }
     }

+ 20 - 73
src/views/entrust/components/create.vue

@@ -153,7 +153,7 @@
         icon="el-icon-plus"
         class="ele-btn-icon"
         @click="addOder"
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && type != 'edit'"
         style="margin-bottom: 10px"
       >
         新建
@@ -165,7 +165,7 @@
         icon="el-icon-delete"
         class="ele-btn-icon"
         @click="removeOder"
-        v-if="type != 'detail'"
+        v-if="type != 'detail' && type != 'edit'"
         plain
         style="margin-bottom: 10px"
       >
@@ -438,7 +438,7 @@
             }
           },
           {
-            prop: 'code',
+            prop: 'workOrderCode',
             label: '生产工单号',
             align: 'center',
             minWidth: 110,
@@ -704,22 +704,16 @@
           return;
         }
 
-        // 只使用 id 作为唯一 key(你要求按 id 对比)
         const getKey = (item) => item.id;
-
-        // 新旧数据的 key 集合
         const newKeys = new Set(list.map(getKey));
         const oldKeys = new Set(this.orderList.map(getKey));
 
-        // 1️⃣ 保留原数据中在新数据里依然存在的项(不做任何修改)
         const keptOldList = this.orderList.filter((oldItem) =>
           newKeys.has(getKey(oldItem))
         );
 
-        // 2️⃣ 找出需要新增的项(id 不在旧数据中)
         const addedItems = list.filter((item) => !oldKeys.has(getKey(item)));
 
-        // 3️⃣ 处理新增项
         const newList = addedItems.map((item) => {
           const copy = this.deepCopy(item);
 
@@ -727,8 +721,6 @@
             describes: '',
             totalCount: copy.formingNum,
             taskList: [],
-            taskId: '',
-            taskName: '',
             beEntrustedFactoriesId: '',
             beEntrustedFactoriesName: '',
             status: '',
@@ -743,6 +735,7 @@
             modelType: copy.model,
             name: '',
             type: '',
+            workOrderCode: copy.code,
             planDeliveryTime: copy.startTime,
             applyDeptId: this.form.pleaseEntrustDeptId,
             applyDeptName: this.form.pleaseEntrustDeptName,
@@ -753,59 +746,7 @@
           return copy;
         });
 
-        // 4️⃣ 合并:保留原来的 + 新增
         this.orderList = [...keptOldList, ...newList];
-        // if (!list || list.length === 0) {
-        //   this.orderList = [];
-        //   return;
-        // }
-
-        // const getKey = (item) => item.id ?? item.apsWorkOrderCode ?? '';
-        // const existingKeys = new Set(this.orderList.map(getKey));
-
-        // const commonList = list.filter((item) =>
-        //   existingKeys.has(getKey(item))
-        // );
-
-        // const newList = list.filter((item) => !existingKeys.has(getKey(item)));
-
-        // const mergedList = [];
-
-        // commonList.forEach((it) => {
-        //   mergedList.push(this.deepCopy(it));
-        // });
-
-        // newList.forEach((item) => {
-        //   Object.assign(item, {
-        //     describes: '',
-        //     totalCount: item.formingNum,
-        //     taskList: [],
-        //     taskId: '',
-        //     taskName: '',
-        //     beEntrustedFactoriesId: '',
-        //     beEntrustedFactoriesName: '',
-        //     status: '',
-        //     beEntrustedDeptName: '',
-        //     beEntrustedDeptId: '',
-        //     measuringUnit: item.unit,
-        //     categoryName: item.productName,
-        //     categoryCode: item.productCode,
-        //     workOrderId: item.id,
-        //     workOrderCode: item.code,
-        //     brandNum: item.brandNo,
-        //     modelType: item.model,
-        //     name: this.form.name,
-        //     type: this.form.type,
-        //     planDeliveryTime: item.startTime,
-        //     applyDeptId: this.form.pleaseEntrustDeptId,
-        //     applyDeptName: this.form.pleaseEntrustDeptName,
-        //     applyFactoriesId: this.form.factoriesId,
-        //     applyFactoriesName: this.form.factoriesName
-        //   });
-        //   mergedList.push(this.deepCopy(item));
-        // });
-
-        // this.orderList = mergedList;
 
         this.getOrderTaskList();
       },
@@ -819,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;
+          }
         }
       },
 
@@ -880,23 +831,19 @@
             item.status = type == 1 ? 0 : 1;
             item.approvalStatus = type == 1 ? 0 : 1;
           });
-
           let URL;
 
           const clearOrderIds = () => {
             this.orderList.forEach((it) => (it.id = ''));
           };
 
-          if (type === 1 && this.form.id) {
-            // 编辑
-            URL = update;
-          } else if (type === 1) {
-            // 新增
-            URL = save;
-            clearOrderIds();
+          if (type === 1) {
+            URL = this.type === 'edit' ? update : save;
           } else {
-            // 其他类型提交
             URL = addSubmit;
+          }
+
+          if (this.type === 'add' && (type !== 1 || type === 1)) {
             clearOrderIds();
           }
 

+ 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)';
         }
       },
 

+ 7 - 7
src/views/produce/components/jobBooking/components/batchSemiProductJobBom.vue

@@ -2055,13 +2055,13 @@
       choosePrint() {},
 
       pritJuRen() {
-        this.choosePrintTemplate = true;
-        // if (this.printStyle == 'juRen1') {
-        //   this.$refs.juRenPackOneRef.open(
-        //     this.printData,
-        //     this.item.workOrderId
-        //   );
-        // }
+        // this.choosePrintTemplate = true;
+        if (this.printStyle == 'juRen1') {
+          this.$refs.juRenPackOneRef.open(
+            this.printData,
+            this.item.workOrderId
+          );
+        }
       }
     },
 

+ 14 - 0
src/views/produce/components/new_produceOrder.vue

@@ -67,6 +67,12 @@
         </div>
       </template>
 
+      <template v-slot:workOrderType="{ row }">
+        <span v-if="row.workOrderType == 1">普通订单</span>
+        <span v-if="row.workOrderType == 2">临时订单</span>
+        <span v-if="row.workOrderType == 3">受托订单</span>
+      </template>
+
       <template v-slot:status="{ row }">
         <span> {{ sumStatus(row) }}</span>
       </template>
@@ -191,6 +197,14 @@
             minWidth: 110,
             showOverflowTooltip: true
           },
+          {
+            prop: 'workOrderType',
+            label: '订单类型',
+            slot: 'workOrderType',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
           {
             prop: 'singleReport',
             slot: 'singleReport',

+ 2 - 2
src/views/produce/components/outsourcing/addPlease.vue

@@ -243,7 +243,6 @@
     methods: {
       open(workOrderId, workData, taskObj) {
         this.taskObj = taskObj;
-        console.log(taskObj, 'taskObj');
         const newList = workData.list.map((item) => {
           const copy = this.deepCopy(item);
 
@@ -277,7 +276,8 @@
           return copy;
         });
 
-        this.form = Object.assign(this.form, newList[0]);
+        const data = Object.assign(this.form, newList[0]);
+        this.form = this.deepCopy(data);
         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;

+ 76 - 7
src/views/produce/components/outsourcing/details.vue

@@ -170,6 +170,10 @@
         <span> {{ getDictValue('请托类型', row.type + '') }}</span>
       </template>
 
+      <template v-slot:totalCount="{ row }">
+        <span> {{ row.totalCount }}{{ row.measuringUnit }}</span>
+      </template>
+
       <template v-slot:status="{ row }">
         <el-tag>{{
           row.status == 0 ? '未提交' : row.status == 1 ? '已提交' : '已发布'
@@ -177,10 +181,15 @@
       </template>
 
       <template v-slot:sendStatus="{ row }">
-        <el-tag v-if="row.sendStatus == 0">{{ '未发货' }}</el-tag>
-        <el-tag v-else-if="row.sendStatus == 1">{{ '已发货' }}</el-tag>
-        <el-tag v-else-if="row.sendStatus == 2">{{ '已收货' }}</el-tag>
-        <span v-else>无</span>
+        <el-tag v-if="row.sendStatus == 0 || !row.sendStatus">{{
+          '未发货'
+        }}</el-tag>
+        <el-tag v-else-if="row.sendStatus == 1" type="success">{{
+          '已发货'
+        }}</el-tag>
+        <el-tag v-else-if="row.sendStatus == 2" type="success">{{
+          '已收货'
+        }}</el-tag>
       </template>
 
       <template v-slot:approvalStatus="{ row }">
@@ -240,7 +249,7 @@
         <el-link
           type="primary"
           :underline="false"
-          @click="sendGoods(row)"
+          @click="sendGoods(row, 'add')"
           v-if="
             row.approvalStatus == 2 && (row.sendStatus == 0 || !row.sendStatus)
           "
@@ -248,6 +257,18 @@
           发货
         </el-link>
 
+        <el-link
+          type="primary"
+          :underline="false"
+          @click="sendGoods(row, 'detail')"
+          v-if="
+            row.approvalStatus == 2 &&
+            (row.sendStatus == 1 || row.sendStatus == 2)
+          "
+        >
+          发货详情
+        </el-link>
+
         <el-link
           type="primary"
           :underline="false"
@@ -265,6 +286,9 @@
     <detail ref="detailsRef"></detail>
 
     <timeDialog ref="timeDialogRef"></timeDialog>
+    <goodsDetail ref="goodsDetailRef" @done="reloads"></goodsDetail>
+
+    <Create ref="create" @refresh="reloads" />
   </div>
 </template>
 
@@ -279,13 +303,18 @@
   import { getFile } from '@/api/system/file';
   import { getList as getPleaseListData } from '@/api/entrust/index';
   import { getByCode } from '@/api/system/dictionary-data';
+  import Create from '@/views/entrust/components/create.vue';
+  import goodsDetail from '@/views/entrust/components/goodsDetail.vue';
+  import { remove, submit, warehouseEntry } from '@/api/entrust/index.js';
   export default {
     components: {
       search,
       flow,
       release,
       Detail,
-      timeDialog
+      timeDialog,
+      Create,
+      goodsDetail
     },
 
     props: {
@@ -568,6 +597,7 @@
           },
           {
             prop: 'totalCount',
+            slot: 'totalCount',
             label: '请托数量',
             align: 'center',
             width: 130,
@@ -778,12 +808,46 @@
         }
       },
 
+      remove(id) {
+        let ids = id || this.selection.map((item) => item.id);
+        remove(ids).then((res) => {
+          this.$message.success('删除' + res);
+          this.reloads();
+        });
+      },
+
+      submit(item) {
+        this.$confirm('是否提交该请托单的审核流程?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            submit({
+              businessId: item.id,
+              beEntrustedDeptId: item.beEntrustedDeptId
+            }).then((res) => {
+              this.$message.success('提交' + res.message);
+              this.reloads();
+            });
+          })
+          .catch(() => {});
+      },
+
       getPleaseType(item) {
         const data = this.pleaseTypeList.filter((it) => it.value == item.type);
 
         return data.length != 0 ? data[0].label : '';
       },
 
+      sendGoods(item, type) {
+        this.$refs.goodsDetailRef.open(item, type);
+      },
+
+      open(type, row) {
+        this.$refs.create.open(type, row);
+      },
+
       async getDataList(code) {
         this.workOrderCode = code;
         await getList({
@@ -798,7 +862,6 @@
       },
 
       async getPleaseData(code) {
-        console.log(code, '22000');
         this.workOrderCode = code;
         await getPleaseListData({
           pageNum: 1,
@@ -828,6 +891,12 @@
         this.$refs.timeDialogRef.open(row, 'details');
       },
 
+      reloads() {
+        this.$nextTick(() => {
+          this.getPleaseData(this.workOrderCode);
+        });
+      },
+
       handleRelease(row) {
         this.$refs.releaseRef.open(row);
       },

+ 347 - 118
src/views/produce/components/outsourcing/index.vue

@@ -185,17 +185,17 @@
       </el-form>
     </div>
 
-    <div v-if="activeName == '5'">
+    <div v-if="activeName == '2'">
       <el-form
         label-width="100px"
-        :rules="rules"
+        :rules="rulesPlease"
         ref="form"
-        :model="attributeData"
+        :model="form"
       >
         <el-form-item label="请托名称:" prop="name">
           <el-input
             placeholder=""
-            v-model="attributeData.name"
+            v-model="form.name"
             style="width: 260px"
           ></el-input>
         </el-form-item>
@@ -203,7 +203,7 @@
         <el-form-item label="请托类型:" prop="type">
           <DictSelection
             dictName="请托类型"
-            v-model="attributeData.type"
+            v-model="form.type"
             style="width: 260px"
           ></DictSelection>
         </el-form-item>
@@ -211,7 +211,7 @@
         <el-form-item label="紧急程度:" prop="priority">
           <el-select
             style="width: 260px"
-            v-model="attributeData.priority"
+            v-model="form.priority"
             placeholder="请选择"
             clearable
           >
@@ -224,24 +224,20 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="请托数量:" prop="formedNumLast">
-          <el-input
-            placeholder="请输入请托数量"
-            type="number"
-            v-model="attributeData.formedNumLast"
-            style="width: 260px"
-          ></el-input>
+        <el-form-item label="请托数量:" prop="totalCount">
+          <el-input v-model="form.totalCount" style="width: 260px">
+            <template slot="append">{{ form.measuringUnit }}</template>
+          </el-input>
         </el-form-item>
-        <el-form-item label="请托到:" prop="taskIdes">
+        <el-form-item label="请托工序:" prop="taskId">
           <el-select
-            v-model="attributeData.taskIdes"
+            v-model="form.taskId"
             placeholder="请选择"
             style="width: 260px"
-            @change="changeTaskId"
-            multiple
+            @change="taskListChange"
           >
             <el-option
-              v-for="item in newStepsList"
+              v-for="item in pleaseNewStepsList"
               :key="item.taskId"
               :label="item.taskTypeName"
               :value="item.taskId"
@@ -249,106 +245,82 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="请托场景:" prop="sceneText">
+        <!--
+        <el-form-item label="请托人:" prop="pleaseEntrustUserId">
           <el-input
-            placeholder=""
-            v-model="attributeData.sceneText"
+            v-model="form.pleaseEntrustUserName"
+            clearable
             disabled
             style="width: 260px"
-          ></el-input>
-        </el-form-item>
-        <!-- v-if="attributeData.isFirstTask != 1" -->
-        <el-form-item label="直接入库:" borderBottom prop="warehouseId">
-          <div style="display: flex">
-            <div
-              style="font-size: 15px"
-              v-if="attributeData.clientEnvironmentId == 2"
-              >是</div
-            >
-            <!-- <el-checkbox-group v-model="isInWarehouse" size="15px" v-if="attributeData.clientEnvironmentId != 2 ">
-                            <el-checkbox labelSize="15px" iconSize="10px" activeColor="#157A2C" name="true"
-                                label="是"></el-checkbox>
-                        </el-checkbox-group> -->
-            <!-- <el-checkbox labelSize="15px" iconSize="10px" v-model="isInWarehouse" activeColor="#157A2C" name="true"
-                                label="是" v-if="attributeData.clientEnvironmentId != 2 "></el-checkbox> -->
-            <el-select
-              v-if="attributeData.clientEnvironmentId == 2 || isInWarehouse"
-              v-model="attributeData.warehouseId"
-              placeholder="请选择"
-              style="width: 260px"
-            >
-              <el-option
-                v-for="item in warehouseList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.id"
-              >
-              </el-option>
-            </el-select>
-          </div>
+          />
         </el-form-item>
 
-        <el-form-item label="请托单位:">
-          <el-select
-            v-model="attributeData.factoriesId"
-            placeholder="请选择"
+        <el-form-item label="请托部门:" prop="pleaseEntrustDeptName">
+          <el-input
+            v-model="form.pleaseEntrustDeptName"
+            clearable
+            disabled
             style="width: 260px"
-            @change="changeTaskId"
           >
-            <el-option
-              v-for="item in factoryList"
-              :key="item.factoryId"
-              :label="item.factoryName"
-              :value="item.factoryId"
-            >
-            </el-option>
-          </el-select>
+          </el-input>
         </el-form-item>
 
-        <el-form-item
-          label="工艺路线:"
-          borderBottom
-          style="font-size: 15px"
-          prop="produceRoutingId"
-          v-if="
-            attributeData.clientEnvironmentId != 2 &&
-            attributeData.isFirstTask != 1 &&
-            isInWarehouse &&
-            isInWarehouse.length == 0
-          "
-        >
+        <el-form-item label="所属工厂:" prop="factoriesName">
+          <el-input v-model="form.factoriesName" disabled style="width: 260px">
+          </el-input>
+        </el-form-item> -->
+
+        <el-form-item label="受托工厂:" prop="beEntrustedFactoriesId">
           <el-select
-            v-model="attributeData.produceRoutingId"
-            placeholder="请选择"
             style="width: 260px"
+            v-model="form.beEntrustedFactoriesId"
+            placeholder="请选择"
+            clearable
           >
             <el-option
-              v-for="item in produceList"
+              v-for="item in factoryList"
               :key="item.id"
               :label="item.name"
               :value="item.id"
+              @click.native="factoryListChange(item)"
             >
             </el-option>
           </el-select>
         </el-form-item>
 
-        <el-form-item label="交付交期:" prop="requireDeliveryTime">
+        <el-form-item label="受托部门:" prop="beEntrustedDeptId">
+          <deptSelect
+            style="width: 260px"
+            v-model="form.beEntrustedDeptId"
+            @changeGroup="beEntrustedDeptIdChange"
+          />
+        </el-form-item>
+
+        <el-form-item label="完成日期:" prop="planDeliveryTime">
           <el-date-picker
-            v-model="attributeData.requireDeliveryTime"
-            value-format="yyyy-MM-dd"
+            v-model="form.planDeliveryTime"
+            type="datetime"
             style="width: 260px"
-            type="date"
-            placeholder="选择日期"
+            placeholder="选择日期时间"
+            format="yyyy-MM-dd HH:mm:ss"
+            value-format="yyyy-MM-dd HH:mm:ss"
           >
           </el-date-picker>
         </el-form-item>
 
-        <el-form-item label="生产备注:">
+        <el-form-item label="是否尾工序:" prop="isLast">
+          <el-radio-group v-model="form.isLast">
+            <el-radio :label="1">是</el-radio>
+            <el-radio :label="0">否</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item label="需求描述:">
           <el-input
             type="textarea"
             :autosize="{ minRows: 2, maxRows: 4 }"
             placeholder="请输入内容"
-            v-model="textarea2"
+            v-model="form.describes"
             style="width: 260px"
           >
           </el-input>
@@ -356,8 +328,9 @@
       </el-form>
 
       <div class="btn-box">
-        <el-button type="primary" @click="confirm">确认</el-button>
         <el-button type="primary" @click="cancel">取消</el-button>
+        <el-button type="primary" @click="save(1)"> 保存 </el-button>
+        <el-button type="primary" @click="save(2)"> 提交 </el-button>
       </div>
     </div>
 
@@ -370,9 +343,13 @@
   import { contactList } from '@/api/produce/bom.js';
   import { getFactoryarea } from '@/api/aps';
   import timeDialog from './timeDialog.vue';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import { getTaskInstanceById } from '@/api/produce/index';
+  import { save, addSubmit, update } from '@/api/entrust/index';
   export default {
     components: {
-      timeDialog
+      timeDialog,
+      deptSelect
     },
     data() {
       return {
@@ -457,13 +434,62 @@
           ]
         },
 
+        rulesPlease: {
+          type: [{ required: true, message: '请选择', trigger: 'change' }],
+          name: [{ required: true, message: '请输入', trigger: 'change' }],
+
+          workOrderCode: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          beEntrustedDeptId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          finishTime: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          beEntrustedFactoriesId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          isLast: [{ required: true, message: '请选择', trigger: 'change' }],
+          planDeliveryTime: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          totalCount: [
+            { required: true, message: '请输入', trigger: 'change' }
+          ],
+          taskId: [{ required: true, message: '请选择', trigger: 'change' }]
+        },
+
+        form: {
+          type: '',
+          priority: '',
+          name: '',
+          pleaseEntrustDeptName: '',
+          pleaseEntrustUserName: '',
+          factoriesName: '',
+          beEntrustedFactoriesId: '',
+          beEntrustedDeptId: '',
+          isLast: 0,
+          describes: '',
+          taskId: '',
+          planDeliveryTime: '',
+          beEntrustedDeptName: '',
+          beEntrustedFactoriesName: '',
+          pleaseEntrustDeptId: '',
+          pleaseEntrustUserId: '',
+          factoriesId: '',
+          factoriesName: '',
+          status: '',
+          approvalStatus: ''
+        },
+
         loading: false,
         operationType: null,
-        workListIds: [],
         activeName: this.chooseType,
         textarea2: '',
         gysList: [],
         factoryList: [],
+        pleaseNewStepsList: [],
         clientEnvironmentId: this.$store.state.user.info.clientEnvironmentId
       };
     },
@@ -472,13 +498,21 @@
         type: Object,
         default: () => ({})
       },
-      taskName: {
-        type: String,
+      taskObj: {
+        type: Object,
         default: ''
       },
       chooseType: {
         type: String,
         default: '1'
+      },
+      workListIds: {
+        type: String,
+        default: ''
+      },
+      workData: {
+        type: Object,
+        default: () => ({})
       }
     },
 
@@ -514,22 +548,124 @@
         immediate: true
       }
     },
-    computed: {
-      taskObj() {
-        return this.$store.state.user.taskObj;
-      }
-    },
+    // computed: {
+    //   taskObj() {
+    //     return this.$store.state.user.taskObj;
+    //   }
+    // },
 
     mounted() {
       this.getContactList();
       this.getFactoryList();
-      console.log(this.taskName, '委托');
       if (this.chooseType == '1') {
-        this.attributeData.name = this.taskName + '委外';
-        // this.$set(this.outsourceFormVal, 'name', this.taskName + '委托');
+        this.attributeData.name = this.taskObj.name
+          ? this.taskObj.name + '委外'
+          : this.taskObj.taskTypeName + '委外';
       } else if (this.chooseType == '2') {
-        this.attributeData.name = this.taskName + '请托';
-        // this.$set(this.outsourceFormVal, 'name', this.taskName + '请托');
+        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;
+      //   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);
+
+          const commonData = {
+            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 Object.assign(copy, commonData);
+        });
+
+        this.form = this.deepCopy({
+          ...this.form,
+          ...newList[0]
+        });
+
+        console.log(this.form, '最终form数据');
+
+        this.form.name = this.taskObj.name
+          ? `${this.taskObj.name}请托`
+          : `${this.taskObj.taskTypeName}请托`;
+
+        this.getTaskInstanceByIdFn(this.workListIds);
       }
     },
 
@@ -546,6 +682,24 @@
         });
       },
 
+      async getTaskInstanceByIdFn(workOrderId, taskId) {
+        await getTaskInstanceById(workOrderId).then((res) => {
+          let { data } = res;
+          if (data.length) {
+            data = data.filter((item) => item.taskId != -2);
+            let arr = data.findIndex((item) =>
+              item.name ? item.sourceTaskId : item.taskId == this.form.taskId
+            );
+
+            if (arr != -1) {
+              data.splice(0, arr);
+            }
+
+            this.pleaseNewStepsList = data;
+          }
+        });
+      },
+
       async getFactoryList() {
         let par = {
           type: 1,
@@ -563,10 +717,41 @@
             //   };
             // });
           }
+          const data = this.factoryList.filter(
+            (it) => it.factoryId == this.$store.state.user.info.factoryId
+          );
+
+          if (data.length != 0) {
+            this.form.factoriesId = data[0].factoryId;
+            this.form.factoriesName = data[0].factoryName;
+          }
         });
         console.log(this.factoryList, '工厂数据111');
       },
 
+      beEntrustedDeptIdChange(val, row) {
+        this.form.beEntrustedDeptName = row.name;
+      },
+      factoryListChange(row) {
+        this.form.beEntrustedFactoriesName = row.name;
+      },
+
+      deepCopy(obj, hash = new WeakMap()) {
+        if (obj === null) return null;
+        if (obj instanceof Date) return new Date(obj);
+        if (obj instanceof RegExp) return new RegExp(obj);
+        if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
+        if (hash.has(obj)) return hash.get(obj);
+
+        const result = Array.isArray(obj) ? [] : {};
+        hash.set(obj, result);
+
+        return Object.keys(obj).reduce((acc, key) => {
+          acc[key] = this.deepCopy(obj[key], hash);
+          return acc;
+        }, result);
+      },
+
       async getContactList() {
         let param = {
           pageNum: 1,
@@ -614,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);
@@ -684,21 +877,6 @@
                 this.attributeData.supplierName = obj ? obj.name : '';
               }
 
-              this.attributeData.taskIdes.forEach((it) => {
-                this.newStepsList.filter((i) => {
-                  if (i.taskId == it) {
-                    this.attributeData.taskDataList.push(i);
-                  }
-                });
-              });
-              this.attributeData.taskIds =
-                this.attributeData.taskIdes.join(',');
-              this.$emit('changePlugIn', this.attributeData, this.activeName);
-            } else if (this.activeName == '2') {
-              const obj = this.factoryList.find(
-                (item) => item.id === this.attributeData.factoriesId
-              );
-              this.attributeData.factoriesName = obj ? obj.name : '';
               this.attributeData.taskIdes.forEach((it) => {
                 this.newStepsList.filter((i) => {
                   if (i.taskId == it) {
@@ -716,13 +894,60 @@
           }
         });
       },
+
+      save(type) {
+        this.$refs.form.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+
+          let URL;
+
+          const clearOrderIds = () => {
+            this.form.id = '';
+          };
+
+          if (type === 1) {
+            // 新增
+            URL = save;
+            clearOrderIds();
+          } else {
+            // 其他类型提交
+            URL = addSubmit;
+            clearOrderIds();
+          }
+
+          this.loading = this.$loading({
+            lock: true,
+            text: '加载中',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+
+          this.form.status = type == 1 ? 0 : 1;
+          this.form.approvalStatus = type == 1 ? 0 : 1;
+
+          const list = [];
+          list.push(this.form);
+
+          console.log(this.form, '最终form数据111111');
+
+          URL(list)
+            .then((res) => {
+              this.loading.close();
+              this.$message.success('成功');
+              this.cancel();
+            })
+            .catch((e) => {
+              this.loading.close();
+            });
+        });
+      },
       cancel() {
         this.$emit('changeCancel', this.activeName);
       }
     },
     created() {
       this.operationType = null;
-      this.workListIds = [];
     }
   };
 </script>
@@ -773,4 +998,8 @@
   ::v-deep .el-form-item {
     margin-bottom: 13px !important;
   }
+
+  ::v-deep .ele-basic-select {
+    width: 260px !important;
+  }
 </style>

+ 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) => {

+ 12 - 10
src/views/produce/index.vue

@@ -255,7 +255,9 @@
                 ></outsourcingDetails>
                 <outsourcing
                   :outsourceFormVal="outsourceForm"
-                  :taskName="taskObj.name"
+                  :taskObj="taskObj"
+                  :workListIds="workListIds[0]"
+                  :workData="workData"
                   @changePlugIn="changePlugIn"
                   @changeCancel="changeCancel"
                   :chooseType="chooseType"
@@ -1100,15 +1102,15 @@
       outsourcingAdd(type, activeName) {
         this.getTaskInstanceByIdFn(this.workListIds[0]);
         this.chooseType = activeName;
-        if (this.chooseType == 1) {
-          this.isStep = true;
-        } else {
-          this.$refs.addPleaseRef.open(
-            this.workListIds[0],
-            this.workData,
-            this.taskObj
-          );
-        }
+        // if (this.chooseType == 1) {
+        this.isStep = true;
+        // } else {
+        //   this.$refs.addPleaseRef.open(
+        //     this.workListIds[0],
+        //     this.workData,
+        //     this.taskObj
+        //   );
+        // }
       },
 
       refreshPlease() {

+ 14 - 0
src/views/produceOrder/index.vue

@@ -123,6 +123,12 @@
           <span v-if="row.sourceType == 3">受托转订单</span>
         </template>
 
+        <template v-slot:workOrderType="{ row }">
+          <span v-if="row.workOrderType == 1">普通订单</span>
+          <span v-if="row.workOrderType == 2">临时订单</span>
+          <span v-if="row.workOrderType == 3">受托订单</span>
+        </template>
+
         <template v-slot:outsourceStatus="{ row }">
           <div v-if="row.outsourceStatus">
             <span v-if="row.outsourceStatus == 1">未委外</span>
@@ -532,6 +538,14 @@
             minWidth: 110,
             showOverflowTooltip: true
           },
+          {
+            prop: 'workOrderType',
+            label: '订单类型',
+            slot: 'workOrderType',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
           {
             prop: 'productionPlanCode',
             label: '计划编号',

+ 10 - 21
src/views/produceOrder/workReport.vue

@@ -206,9 +206,12 @@
                         v-if="!isStep && !isOutsource && !isPleaseEntrust"
                         :chooseType="chooseType"
                       ></outsourcingDetails>
+
                       <outsourcing
                         :outsourceFormVal="outsourceForm"
-                        :taskName="taskObj.taskTypeName"
+                        :taskObj="taskObj"
+                        :workListIds="workListIds[0]"
+                        :workData="workInfoList"
                         @changePlugIn="changePlugIn"
                         @changeCancel="changeCancel"
                         :chooseType="chooseType"
@@ -429,7 +432,8 @@
         curTaskObj: null,
         produceList: [],
         workPlanType: '',
-        isPleaseEntrust: false
+        isPleaseEntrust: false,
+        workInfoList: {}
       };
     },
 
@@ -905,29 +909,14 @@
         }
       },
 
-      // outsourcingAdd() {
-      //   this.getTaskInstanceByIdFn(this.workListIds[0]);
-      //   this.isStep = true;
-      // },
-
       outsourcingAdd(type, activeName) {
-        // this.getTaskInstanceByIdFn(this.workListIds[0]);
-        // this.chooseType = activeName;
-        // this.isStep = true;
         this.getTaskInstanceByIdFn(this.workListIds[0]);
         this.chooseType = activeName;
-        if (this.chooseType == 1) {
-          this.isStep = true;
-        } else {
-          const dataList = { list: [] };
-          dataList.list.push(this.workData);
 
-          this.$refs.addPleaseRef.open(
-            this.workListIds[0],
-            dataList,
-            this.taskObj
-          );
-        }
+        this.isStep = true;
+
+        this.workInfoList = { list: [] };
+        this.workInfoList.list.push(this.workData);
       },
 
       async handOutsource(workOrderId) {

+ 14 - 0
src/views/produceWord/index.vue

@@ -27,6 +27,12 @@ r++<template>
           <span v-if="row.sourceType == 3">受托转订单</span>
         </template>
 
+        <template v-slot:workOrderType="{ row }">
+          <span v-if="row.workOrderType == 1">普通订单</span>
+          <span v-if="row.workOrderType == 2">临时订单</span>
+          <span v-if="row.workOrderType == 3">受托订单</span>
+        </template>
+
         <template v-slot:priority="{ row }">
           <div style="display: flex">
             <el-input
@@ -203,6 +209,14 @@ r++<template>
             minWidth: 110,
             showOverflowTooltip: true
           },
+          {
+            prop: 'workOrderType',
+            label: '订单类型',
+            slot: 'workOrderType',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
           {
             prop: 'model',
             label: '型号',

+ 11 - 3
src/views/taskList/components/Ddtails.vue

@@ -137,7 +137,14 @@
           :xs="12"
         >
           <el-form-item :label="item.label" class="form80">
-            <el-input v-model="current[item.prop]" disabled></el-input>
+            <el-input v-model="current[item.prop]" disabled>
+              <!-- <template
+                slot="append"
+                v-if="item.label == '要求生产数量:'"
+              >
+              {{  }}
+              </template> -->
+            </el-input>
           </el-form-item>
         </el-col>
       </el-row>
@@ -232,14 +239,15 @@
         fieldMap: {
           orderList: [
             { label: '计划批次号:', prop: 'batchNo' },
+            { label: '工单编码:', prop: 'mesWorkOrderCode' },
             { label: '编码', prop: 'productCode' },
             { label: '名称', prop: 'productName' },
             { label: '规格', prop: 'specification' },
             { label: '生产订单编码:', prop: 'workOrderCode' },
             { label: '计划编号:', prop: 'productionPlanCode' },
             { label: '工艺路线:', prop: 'produceRoutingName' },
-            { label: '要求生产数量:', prop: 'quantity' },
-            { label: '要求生产重量:', prop: 'weight' },
+            { label: '要求生产数量:', prop: 'formingNum' },
+            { label: '要求生产重量:', prop: 'formingWeight' },
             { label: '所属工厂:', prop: 'factoryName' },
             { label: '所属班组:', prop: 'assignTeamName' },
             { label: '计划开始时间:', prop: 'planStartTime' },

+ 3 - 2
src/views/taskList/index.vue

@@ -608,12 +608,13 @@
       details(type, row) {
         let currentRow = {
           assignCode: row.assignCode,
+          mesWorkOrderCode: row.mesWorkOrderCode,
           workOrderCode: row.workOrderCode,
           productionPlanCode: row.productionPlanCode,
           produceRoutingName: row.produceRoutingName,
-          formingNum: row.quantity,
+          formingNum: row.formingNum,
           assignTeamName: row.assignTeamName,
-          formingWeight: row.quantity,
+          formingWeight: row.formingWeight,
           planStartTime: row.planStartTime,
           planCompleteTime: row.planCompleteTime,
           startTime: row.startTime,

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

@@ -0,0 +1,469 @@
+<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"
+        :height="tableHeight"
+        :selection.sync="selection"
+        @fullscreen-change="fullscreenChange"
+      >
+        <template v-slot:toolbar>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="printData('add')"
+          >
+            下载
+          </el-button></template
+        >
+        <template slot="subCountAllFirst" slot-scope="{ row }">
+          <el-input v-model="row.subCountAllFirst" @change="changeUpate(row)" />
+        </template>
+
+        <template slot="subCountSendFirst" slot-scope="{ row }">
+          <el-input
+            v-model="row.subCountSendFirst"
+            @change="changeUpate(row)"
+          />
+        </template>
+
+        <template slot="difference" slot-scope="{ row }">
+          <el-input v-model="row.difference" @change="changeUpate(row)" />
+        </template>
+
+        <template slot="remark" slot-scope="{ row }">
+          <el-input v-model="row.remark" @change="changeUpate(row)" />
+        </template>
+      </ele-pro-table>
+    </el-card>
+  </div>
+</template>
+
+<script>
+  import { getDailyList, updateDaily } from '@/api/wanLong/index';
+  import { getTreeByPid } from '@/api/classifyManage';
+  import * as XLSX from 'xlsx';
+  import { saveAs } from 'file-saver';
+
+  export default {
+    name: 'wanLongIndex',
+
+    data() {
+      return {
+        loading: false,
+        current: null,
+        selection: [],
+        tableHeight: 'calc(100vh - 320px)',
+        dynamicColumns: [], // 保存 taskList 动态列
+        taskNames: [], // taskName 列名数组
+        categoryData: [],
+        categoryType: [],
+
+        orderStatus: [
+          {
+            value: 4,
+            label: '待生产'
+          },
+          {
+            value: 5,
+            label: '生产中'
+          },
+          {
+            value: 6,
+            label: '已完成'
+          },
+          {
+            value: 7,
+            label: '已延期'
+          },
+          {
+            value: 9,
+            label: '暂停'
+          },
+          {
+            value: 10,
+            label: '终止'
+          }
+        ]
+      };
+    },
+
+    computed: {
+      seekList() {
+        const today = new Date();
+        const year = today.getFullYear();
+        const month = String(today.getMonth() + 1).padStart(2, '0');
+        const day = String(today.getDate()).padStart(2, '0');
+
+        const dateStr = `${year}-${month}-${day}`;
+
+        return [
+          {
+            label: '选择日期:',
+            value: 'startTime',
+            type: 'date',
+            dateType: 'date',
+            placeholder: '',
+            defaultValue: dateStr,
+            clearable: false,
+            width: 220
+          },
+          {
+            label: '物品分类:',
+            value: 'categoryLevelId',
+            type: 'select',
+            placeholder: '',
+            planList: this.categoryType
+          },
+          {
+            label: '工单状态:',
+            value: 'workOrderStatusList',
+            type: 'select',
+            placeholder: '',
+            multiple: true,
+            planList: this.orderStatus
+          }
+        ];
+      },
+
+      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: 'difference',
+            slot: 'difference',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '备注',
+            prop: 'remark',
+            slot: 'remark',
+            width: 120,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            label: '日期',
+            prop: 'date',
+            width: 100,
+            showOverflowTooltip: true,
+            align: 'center'
+          }
+        ];
+
+        return baseColumns.concat(this.dynamicColumns);
+      }
+    },
+
+    created() {
+      this.getTreeData();
+    },
+
+    methods: {
+      datasource({ page, limit, where }) {
+        if (Object.keys(where).length == 0) {
+          const today = new Date();
+          const year = today.getFullYear();
+          const month = String(today.getMonth() + 1).padStart(2, '0');
+          const day = String(today.getDate()).padStart(2, '0');
+
+          const dateStr = `${year}-${month}-${day}`;
+          where.startTime = dateStr + ' 00:00:00';
+          where.endTime = dateStr + ' 23:59:59';
+          console.log(where.startTime, '8888');
+        } else {
+          if (where.startTime) {
+            let times = this.formatDate(where.startTime).split(' ');
+
+            where.endTime = times[0] + ' 00:00:00';
+            where.startTime = times[0] + ' 23:59:59';
+          } else {
+            console.log(where.startTime, '9999');
+            where.startTime = '';
+            where.endTime = '';
+          }
+        }
+        return getDailyList({
+          pageNum: page,
+          size: -1,
+          ...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.reload(e);
+      },
+
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+
+      async changeUpate(item) {
+        const filteredData = Object.keys(item).reduce((acc, key) => {
+          if (!key.startsWith('task_')) {
+            acc[key] = item[key];
+          }
+          return acc;
+        }, {});
+        await updateDaily(filteredData);
+      },
+
+      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}`);
+      },
+
+      formatNode(node) {
+        return {
+          id: node.id,
+          parentId: node.parentId,
+          name: node.name,
+          code: node.code,
+          value: node.value || node.id,
+          label: node.label || node.name,
+          sortNum: node.sortNum
+        };
+      },
+
+      formatDate(date) {
+        const d = new Date(date);
+        const yyyy = d.getFullYear();
+        const mm = String(d.getMonth() + 1).padStart(2, '0');
+        const dd = String(d.getDate()).padStart(2, '0');
+        const hh = String(d.getHours()).padStart(2, '0');
+        const mi = String(d.getMinutes()).padStart(2, '0');
+        const ss = String(d.getSeconds()).padStart(2, '0');
+        return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`;
+      },
+
+      async getTreeData() {
+        try {
+          const res = await getTreeByPid(9);
+          const rootNode = res.data?.[0];
+
+          if (!rootNode || !rootNode.children) {
+            this.categoryType = [];
+            return;
+          }
+
+          this.categoryType = rootNode.children.map((child) =>
+            this.formatNode(child)
+          );
+        } catch (error) {
+          this.categoryType = [];
+        }
+      },
+      async printData() {
+        try {
+          const tableData = this.$refs.table?.getData?.() || [];
+          if (!tableData.length) {
+            this.$message.warning('当前表格没有数据可导出');
+            return;
+          }
+
+          const allColumns = this.columns
+            .concat(this.dynamicColumns)
+            .filter(
+              (col) =>
+                col.columnKey !== 'selection' && col.columnKey !== 'index'
+            );
+
+          const exportData = tableData.map((row) => {
+            const obj = {};
+            allColumns.forEach((col) => {
+              const key = col.prop || col.columnKey;
+              if (key) {
+                obj[col.label] = row[key] ?? '';
+              }
+            });
+            return obj;
+          });
+
+          const ws = XLSX.utils.json_to_sheet(exportData);
+
+          const wb = XLSX.utils.book_new();
+          XLSX.utils.book_append_sheet(wb, ws, '表格数据');
+          const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
+          saveAs(
+            new Blob([wbout], { type: 'application/octet-stream' }),
+            '生产日报.xlsx'
+          );
+
+          this.$message.success('导出成功');
+        } catch (err) {
+          console.error(err);
+          this.$message.error('导出 Excel 失败,请检查控制台');
+        }
+      }
+    }
+  };
+</script>
+
+<style scoped>
+  .clickable {
+    cursor: pointer;
+    color: #409eff;
+  }
+</style>

+ 1 - 1
vue.config.js

@@ -37,7 +37,7 @@ module.exports = {
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.116:18086', // 赵沙金
+        // target: 'http://192.168.1.116:18086', // 赵沙金
         // target: 'http://192.168.1.251:18086', // 开发环境
         // target: 'http://192.168.1.103:18086',192.168.1.116
         // target: 'http://192.168.1.144:18086',

File diff suppressed because it is too large
+ 303 - 303
yarn.lock


Some files were not shown because too many files changed in this diff