快乐的昕的电脑
2025-10-10 3e9975c591183d77e25b506292d702da653a94fb
components/mold.vue
@@ -104,6 +104,8 @@
   export default {
      data() {
         return {
            machineNo: '',//机台编码
                workOrderNo: '',//工单号
            pageIndex: 1,
            pageSize: 18,
            total: 0,
@@ -173,14 +175,44 @@
         confirmTool() {
            this.showToolDialog = false;
         },
         handleUpTool() {
            // 上刀提交逻辑,调用后端接口
            this.$showMessage('上刀提交成功(示例)');
         },
         handleDownTool() {
            // 下刀提交逻辑,调用后端接口
            this.$showMessage('下刀提交成功(示例)');
         },
            async handleUpTool() {
                const payload = {
                    workOrderNo: this.workOrderNo,   // 工单号
                    machineNo: this.machineNo,       // 机台编号
                    toolNo: this.selectedToolNo,     // 刀具编号
                    type: '上刀',                         // 上刀
                    useLimit: this.useLimitInput ? Number(this.useLimitInput) : null // 使用上限
                };
                const res = await this.$post({
                    url: '/MesCutterLedger/SubmitToolAction',
                    data: JSON.stringify(payload),
                    headers: { 'Content-Type': 'application/json' }
                });
                if (res.status === 0) {
                    this.$showMessage('上刀提交成功');
                } else {
                    this.$showMessage(res.message || '上刀提交失败');
                }
            },
            async handleDownTool() {
                const payload = {
                    workOrderNo: this.workOrderNo,
                    machineNo: this.machineNo,
                    toolNo: this.selectedToolNo,
                    type: '下刀', // 下刀
                    useLimit: this.useLimitInput ? Number(this.useLimitInput) : null
                };
                const res = await this.$post({
                    url: '/MesCutterLedger/SubmitToolAction',
                    data: JSON.stringify(payload),
                    headers: { 'Content-Type': 'application/json' }
                });
                if (res.status === 0) {
                    this.$showMessage('下刀提交成功');
                } else {
                    this.$showMessage(res.message || '下刀提交失败');
                }
            },
         cancel() {
            this.selectedToolNo = '';
            this.toolName = '';
@@ -193,7 +225,9 @@
      },
      mounted() {
         // 页面加载时拉取全部刀具
         this.fetchTools('');
         this.fetchTools('');
            this.machineNo = uni.getStorageSync('machineNo') || '';// 读取本地缓存的机台编号
            this.workOrderNo = uni.getStorageSync('workOrderNo') || '';// 读取本地缓存的工单编号
      }
   };
</script>