695593266@qq.com 7 mesi fa
parent
commit
7df03e4cf4

+ 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",

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

@@ -7,3 +7,14 @@ export async function getDailyList(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();
       }
     }

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

+ 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,

+ 223 - 24
src/views/wanLong/index.vue

@@ -1,4 +1,4 @@
-<!-- <template>
+<template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
       <seek-page :seekList="seekList" @search="search"></seek-page>
@@ -11,21 +11,37 @@
         :current.sync="current"
         highlight-current-row
         row-key="id"
-        :pageSize="20"
         :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 }">
-          <span class="clickable" @click="onClickSubCountAllFirst(row)">
-            {{ row.subCountAllFirst != null ? row.subCountAllFirst : 0 }}
-          </span>
+          <el-input v-model="row.subCountAllFirst" @change="changeUpate(row)" />
         </template>
 
         <template slot="subCountSendFirst" slot-scope="{ row }">
-          <span class="clickable" @click="onClickSubCountSendFirst(row)">
-            {{ row.subCountSendFirst != null ? row.subCountSendFirst : 0 }}
-          </span>
+          <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>
@@ -33,7 +49,10 @@
 </template>
 
 <script>
-  import { getDailyList } from '@/api/wanLong/index';
+  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',
@@ -45,19 +64,73 @@
         selection: [],
         tableHeight: 'calc(100vh - 320px)',
         dynamicColumns: [], // 保存 taskList 动态列
-        taskNames: [] // taskName 列名数组
+        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: '开始时间:',
+            label: '选择日期:',
             value: 'startTime',
             type: 'date',
-            dateType: 'daterange',
-            placeholder: ''
+            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
           }
         ];
       },
@@ -175,9 +248,18 @@
             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'
@@ -195,11 +277,37 @@
       }
     },
 
+    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: limit,
+          size: -1,
           ...where
         }).then((res) => {
           const data = res.data || [];
@@ -232,7 +340,23 @@
       },
 
       search(e) {
-        this.$refs.table.reload(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) {
@@ -249,6 +373,89 @@
       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 失败,请检查控制台');
+        }
       }
     }
   };
@@ -259,12 +466,4 @@
     cursor: pointer;
     color: #409eff;
   }
-</style>  -->
-
-<template> </template>
-
-<script>
-  export default {};
-</script>
-
-<style></style>
+</style>

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

@@ -1,207 +0,0 @@
-<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>

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