#
Junjie
2025-02-14 ac4341ea6b66ae02427d39d35f41d42d78b2eb2e
zy-asrs-admin/src/components/orderOut/orderOutBatchPreview/index.vue
@@ -20,6 +20,8 @@
let currentOrder = ref(null);
let searchInput = ref(null);
let tableData = ref([]);
const operationPortList = ref([])
const globalOperationPort = ref(null)
const open = ref(false);
const showWidth = ref("60%")
const records = ref([])
@@ -105,6 +107,14 @@
        })
        tmp.push({
            title: formatMessage('db.man_order_detl.operationPort', '作业口'),
            dataIndex: 'operationPort',
            width: 140,
            ellipsis: true,
            fixed: 'right',
        })
        tmp.push({
            title: '',
            dataIndex: 'handleStatus',
            width: 100,
@@ -140,16 +150,48 @@
    })
}
const handleOrderOutPreview = () => {
async function getOperationPort() {
    let resp = await post('/api/operationPort/list', {})
    let result = resp.data;
    if (result.code == 200) {
        let data = result.data;
        let tmp = []
        data.forEach((item) => {
            tmp.push({
                label: item.flag,
                value: item.id
            })
        })
        operationPortList.value = tmp;
    } else if (result.code === 401) {
        message.error(result.msg);
        logout()
    } else {
        message.error(result.msg);
    }
}
const handleOrderOutPreview = async () => {
    await getOperationPort();
    loading.value = true;
    tableData.value = []
    let defaultOperationPort = "";
    if (operationPortList.value.length > 0) {
        defaultOperationPort = operationPortList.value[0].value;
        globalOperationPort.value = defaultOperationPort;
    }
    post('/api/out/orderOut/batch/preview', {
        orderDetlIds: records.value,
    }).then((resp) => {
        let result = resp.data;
        if (result.code == 200) {
            tableData.value = result.data;
            let tmp = result.data;
            tmp.forEach((item) => {
                item.operationPort = defaultOperationPort;
            })
            tableData.value = tmp;
            loading.value = false;
        }
    })
@@ -189,6 +231,14 @@
    })
}
const handleGlobalOperationPortChange = () => {
    if(tableData.value.length > 0) {
        tableData.value.forEach((item) => {
            item.operationPort = globalOperationPort.value;
        })
    }
}
defineExpose({
    open,
    showWidth,
@@ -207,6 +257,10 @@
    <div>
        <a-modal v-model:open="open" :width="showWidth" :title="formatMessage('page.orderOutPreview.preview', '预览订单出库')"
            @ok="handleOk">
            <div>
                <span>作业口:</span>
                <a-select v-model:value="globalOperationPort" :options="operationPortList" @change="handleGlobalOperationPortChange"></a-select>
            </div>
            <a-table :data-source="tableData" :loading="loading" :defaultExpandAllRows="false" :key="TABLE_KEY"
                rowKey="id" :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns">
                <template #bodyCell="{ column, text, record, index }">
@@ -228,6 +282,10 @@
                            </div>
                        </div>
                    </template>
                    <template v-if="column.dataIndex === 'operationPort'">
                        <a-select v-model:value="record.operationPort" :options="operationPortList"></a-select>
                    </template>
                </template>
            </a-table>
        </a-modal>