yangpeixing
15 小时以前 027b75833ae1bc3bd1bb597b18c65c9177fa62d4
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSClient/src/views/widesea_wms/Order/InboundOrder.vue
@@ -5,13 +5,19 @@
 *业务请在@/extension/widesea_wms/taskinfo/Dt_Task.js此处编写
 -->
<template>
    <div class="switch">
        <span class="switchTitle">自动打印</span>
        <el-switch v-model="value1" @change="handleSwitchChange" />
    </div>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
        :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
        :table="table" :extend="extend" />
</template>
<script>
import http from "@/api/http";
import extend from "@/extension/widesea_wms/Order/InboundOrder.js";
import { ref, defineComponent } from "vue";
import { ref, defineComponent, onMounted } from "vue"; // æ–°å¢ž onMounted
export default defineComponent({
    setup() {
        const table = ref({
@@ -23,7 +29,6 @@
            sortName: "upperOrderNo"
        });
        const editFormFields = ref({
            // id: "",
            orderNo: "",
            upperOrderNo: "",
            materialNo: "",
@@ -44,16 +49,13 @@
                { "title": "数量", "field": "quantity", "type": "text" },
            ],
        ]);
        const searchFormFields = ref({
        });
        const searchFormFields = ref({});
        const searchFormOptions = ref([
            [
                { "title": "订单编号", "field": "orderNo", "type": "text" },
                { "title": "上游单号", "field": "upperOrderNo", "type": "text" },
                { "title": "需求分类", "field": "demandClassification", "type": "text" },
                { "title": "单据类型", "field": "orderType", "type": "select", dataKey:"orderTypeEmun", data: [] },
                { "title": "单据类型", "field": "orderType", "type": "select", dataKey: "orderTypeEmun", data: [] },
            ],
            [
                { "title": "物料编码", "field": "materialNo", type: "text" },
@@ -75,9 +77,8 @@
            { field: 'materialName', title: '物料名称', type: 'string', width: 180, align: 'left' },
            { field: 'quantity', title: '数量', type: 'string', width: 90, align: 'left' },
            { field: 'demandClassification', title: '需求分类', type: 'string', width: 180, align: 'left' },
            { field: 'orderType', title: '单据类型', type: 'string', width: 110, align: 'left' , bind: { key: "orderTypeEmun", data: [] } },
            { field: 'orderType', title: '单据类型', type: 'string', width: 110, align: 'left', bind: { key: "orderTypeEmun", data: [] } },
            { field: 'wareHouseId', title: '仓库', type: 'string', width: 120, align: 'left', bind: { key: "WareAreaTypeEnable", data: [] } },
            // { field: 'warehouseName', title: '仓库名称', type: 'string', width: 120, align: 'left' },
            { field: 'datetime', title: '时间', type: 'string', width: 180, align: 'left' },
            { field: 'lineNumber', title: '行号', type: 'string', width: 90, align: 'left' },
            { field: 'productDrawingNumber', title: '图号', type: 'string', width: 180, align: 'left' },
@@ -98,6 +99,41 @@
            sortName: "",
            key: ""
        });
        // å®šä¹‰å¼€å…³çŠ¶æ€
        const value1 = ref(false);
        const getAutomaticPrintStatus = async () => {
            try {
                // è¯·æ±‚后端接口获取当前状态
                const res = await http.get(`/api/InboundOrder/GetAutomaticPrint`);
                // åˆå§‹åŒ–开关值
                if (res !== undefined) {
                    value1.value = res;
                }
                console.log("自动打印状态初始化完成:", value1.value);
            } catch (error) {
                console.error("获取自动打印状态失败:", error);
                // å¼‚常时默认关闭
                value1.value = false;
            }
        };
        onMounted(() => {
            getAutomaticPrintStatus();
        });
        const handleSwitchChange = async (val) => {
            try {
                await http.get(`/api/InboundOrder/AutomaticPrint?AutomaticPrintStatus=${val}`);
                console.log("自动打印状态已修改为:", val);
            } catch (error) {
                console.error("修改自动打印状态失败:", error);
                // å¤±è´¥æ—¶å›žæ»šå¼€å…³çŠ¶æ€
                value1.value = !val;
            }
        };
        return {
            table,
            extend,
@@ -107,7 +143,23 @@
            searchFormOptions,
            columns,
            detail,
            value1, // æš´éœ²å¼€å…³çŠ¶æ€
            handleSwitchChange // æš´éœ²æ–¹æ³•
        };
    },
    }
});
</script>
<style>
.switch {
    text-align: center;
    position: fixed;
    top: 7.1rem;
    left: 54rem;
    z-index: 9999;
}
.switchTitle {
    font-size: 15px;
    margin-left: 20px;
}
</style>